Browse Source

- Fix #25 (need to update Moxl too)

- Delete the MovimException file
pull/29/head
Jaussoin Timothée 10 years ago
parent
commit
9bbb40259f
  1. 2
      app/helpers/StringHelper.php
  2. 1
      bootstrap.php
  3. 8
      linker.php
  4. 26
      system/MovimException.php
  5. 18
      system/widget/WidgetWrapper.php

2
app/helpers/StringHelper.php

@ -309,7 +309,7 @@ function stringToColor($string) {
}
/**
* Return the first letter of a string
* Return the first two letters of a string
* @param string
* @return string
*/

1
bootstrap.php

@ -209,7 +209,6 @@ class Bootstrap {
require_once(SYSTEM_PATH . "UtilsPicture.php");
require_once(SYSTEM_PATH . "Cache.php");
require_once(SYSTEM_PATH . "Event.php");
require_once(SYSTEM_PATH . "MovimException.php");
require_once(SYSTEM_PATH . "RPC.php");
require_once(SYSTEM_PATH . "User.php");
require_once(SYSTEM_PATH . "Picture.php");

8
linker.php

@ -50,9 +50,13 @@ $stdin_behaviour = function ($data) use (&$conn, $loop, &$buffer, &$connector, &
$cd = new \Modl\ConfigDAO();
$config = $cd->get();
$domain = \Moxl\Utils::getDomain($msg->host);
$port = 5222;
$dns = \Moxl\Utils::resolveHost($msg->host);
if(isset($dns[0]['target']) && $dns[0]['target'] != null) $msg->host = $dns[0]['target'];
if(isset($dns[0]['port']) && $dns[0]['port'] != null) $port = $dns[0]['port'];
#fwrite(STDERR, colorize('open a socket to '.$domain, 'yellow')." : ".colorize('sent to XMPP', 'green')."\n");
$connector->create($domain, 5222)->then($xmpp_behaviour);
$connector->create($msg->resolveHost, $port)->then($xmpp_behaviour);
}
} else {
return;

26
system/MovimException.php

@ -1,26 +0,0 @@
<?php
/**
* \brief Movim's custom exception class.
*
* Merely adds a line break to the messages so far. Is expected to become more
* useful in the future.
*/
class MovimException extends Exception
{
/**
* Forces to add a message.
*/
public function __construct($message, $code = 0) {
parent::__construct('Error: ' . $message, $code);
}
/**
* Output proper html error reports.
*/
function __toString() {
return $this->code . ' - ' . $this->message . '<br />';
}
}
?>

18
system/widget/WidgetWrapper.php

@ -1,19 +1,19 @@
<?php
/*
* @file WidgetWraper.php
*
*
* @brief Handle the Widgets
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
@ -39,13 +39,13 @@ class WidgetWrapper
public function registerAll($load = false)
{
$widgets_dir = scandir(APP_PATH ."widgets/");
foreach($widgets_dir as $widget_dir) {
if(is_dir(APP_PATH ."widgets/".$widget_dir) &&
if(is_dir(APP_PATH ."widgets/".$widget_dir) &&
$widget_dir != '..' &&
$widget_dir != '.') {
if($load) $this->loadWidget($widget_dir, true);
array_push($this->_widgets, $widget_dir);
array_push($this->_widgets, $widget_dir);
}
}
}
@ -85,7 +85,7 @@ class WidgetWrapper
$path = APP_PATH . "widgets/$name/$name.php";
}
else {
throw new MovimException(
throw new Exception(
__('error.widget_load_error', $name));
}
@ -136,7 +136,7 @@ class WidgetWrapper
if(!is_array($params))
$params = array();
$result = call_user_func_array(array($widget, $method), $params);
$widget = $method = $params = null;

Loading…
Cancel
Save