diff --git a/README.md b/README.md
index 2240618..faeb197 100644
--- a/README.md
+++ b/README.md
@@ -8,4 +8,4 @@ DO NOT USE
**Changelog**
-Current Movim version : 20150731.
+Current Movim version : 20150810.
diff --git a/scripts/install b/scripts/install
index 3e6bc31..eca57e5 100644
--- a/scripts/install
+++ b/scripts/install
@@ -49,10 +49,9 @@ sudo su -c "cd $final_path && php composer.phar install" -s /bin/sh www-data
# Movim configuration
sudo cp $final_path/config/db.example.inc.php $final_path/config/db.inc.php
-sudo sed -i "s/yhuser/$db_user/g" $final_path/config/db.inc.php
-sudo sed -i "s/yhpwd/$db_pwd/g" $final_path/config/db.inc.php
-sudo sed -i "s/yhdb/$db_user/g" $final_path/config/db.inc.php
-sudo sed -i "s@PATHTOCHANGE@$path@g" $final_path/app/assets/js/movim_websocket.js
+sudo sed -i "s@username@$db_user@g" $final_path/config/db.inc.php
+sudo sed -i "s@password@$db_pwd@g" $final_path/config/db.inc.php
+sudo sed -i "s@/ws/@$path/ws/" $final_path/app/assets/js/movim_websocket.js
sudo su -c "cd $final_path && php mud.php db set" -s /bin/sh www-data
sudo su -c "cd $final_path && php mud.php config locale:$language"
sudo su -c "cd $final_path && php mud.php config loglevel:1"
diff --git a/sources/.bzrignore b/sources/.bzrignore
new file mode 100755
index 0000000..2ce4fb1
--- /dev/null
+++ b/sources/.bzrignore
@@ -0,0 +1,14 @@
+*~
+*#*
+cache.tmp
+log/*
+locales/files.list
+*.pdf
+*.swp
+
+./cache
+./config/*
+./lib/Modl
+./lib/Moxl
+./users/*
+./log
diff --git a/sources/.dir-locals.el b/sources/.dir-locals.el
new file mode 100755
index 0000000..b6f02a6
--- /dev/null
+++ b/sources/.dir-locals.el
@@ -0,0 +1,4 @@
+((nil . ((indent-tabs-mode . nil)
+ (tab-width . 4)
+ (fill-column . 80)))
+ (c-mode . ((c-file-style . "stroustrup"))))
diff --git a/sources/.gitignore b/sources/.gitignore
new file mode 100644
index 0000000..35caf9b
--- /dev/null
+++ b/sources/.gitignore
@@ -0,0 +1,8 @@
+/vendor
+/log
+/users
+/cache
+*~
+/config/db.inc.php
+/composer.lock
+/composer.phar
diff --git a/sources/.htaccess b/sources/.htaccess
new file mode 100755
index 0000000..740d33a
--- /dev/null
+++ b/sources/.htaccess
@@ -0,0 +1,22 @@
+Options -Indexes
+AddType application/x-web-app-manifest+json .webapp
+
+ # Tell PHP that the mod_rewrite module is ENABLED.
+ SetEnv HTTP_MOD_REWRITE 1
+
+ # If you have troubles or use VirtualDocumentRoot
+ # uncomment this and set it to the path where your Movim installation is
+ # i.e.:
+ # Movim url: http://example.com
+ # RewriteBase /
+ # Movim url: http://some.example.com/movim
+ # RewriteBase /movim/
+
+ RewriteBase /0.9/
+ RewriteEngine On
+
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteRule (.*) index.php?query=$1 [L]
+ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+
diff --git a/sources/app/assets/js/movim_tpl.js b/sources/app/assets/js/movim_tpl.js
index 7965b78..8566332 100755
--- a/sources/app/assets/js/movim_tpl.js
+++ b/sources/app/assets/js/movim_tpl.js
@@ -1,6 +1,6 @@
/**
* Movim Javascript Template functions
- *
+ *
* These are the default callback functions that users may (or may not) use.
*
* Note that all of them take only one parameter. Don't be fooled by this, the
@@ -86,6 +86,13 @@ var MovimTpl = {
return false;
}
},
+ isPanelScrolled : function() {
+ var selector = document.querySelector('main section > div:first-child:nth-last-child(2) ~ div div');
+
+ if(selector != null) {
+ return (selector.scrollHeight - selector.scrollTop === selector.clientHeight);
+ }
+ },
scrollPanel : function() {
var selector = document.querySelector('main section > div:first-child:nth-last-child(2) ~ div div');
@@ -116,9 +123,12 @@ var MovimTpl = {
return;
}
- //if(!document.querySelector(element).contains(e.target))
+ //if(!document.querySelector(element).contains(e.target))
movim_remove_class(element, classname);
},
+ toggleActionButton : function() {
+ movim_toggle_class('.button.action', 'active');
+ },
hideContextMenu : function() {
movim_remove_class('ul.context_menu', 'shown');
},
diff --git a/sources/app/assets/js/movim_websocket.js b/sources/app/assets/js/movim_websocket.js
index 74c7824..8c29b18 100755
--- a/sources/app/assets/js/movim_websocket.js
+++ b/sources/app/assets/js/movim_websocket.js
@@ -41,9 +41,9 @@ var MovimWebsocket = {
init : function() {
if(SECURE_WEBSOCKET) {
- var uri = 'wss://' + BASE_HOST + 'PATHTOCHANGE/ws/';
+ var uri = 'wss://' + BASE_HOST + '/ws/';
} else {
- var uri = 'ws://' + BASE_HOST + 'PATHTOCHANGE/ws/';
+ var uri = 'ws://' + BASE_HOST + '/ws/';
}
this.connection = new WebSocket(uri);
diff --git a/sources/app/helpers/StringHelper.php b/sources/app/helpers/StringHelper.php
index bd3fb5d..3bd3ff3 100755
--- a/sources/app/helpers/StringHelper.php
+++ b/sources/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
*/
diff --git a/sources/app/models/config/Config.php b/sources/app/models/config/Config.php
index 1c283d6..7d72bdb 100755
--- a/sources/app/models/config/Config.php
+++ b/sources/app/models/config/Config.php
@@ -2,8 +2,7 @@
namespace Modl;
-class Config extends Model {
- public $environment;
+class Config extends Model {
public $description;
public $theme;
public $locale;
@@ -17,43 +16,40 @@ class Config extends Model {
public $password;
public $rewrite;
public $sizelimit;
-
+
public function __construct() {
$this->_struct = '
{
- "environment" :
- {"type":"string", "size":64, "mandatory":true },
- "description" :
+ "description" :
{"type":"text" },
- "theme" :
+ "theme" :
{"type":"string", "size":32, "mandatory":true },
- "locale" :
+ "locale" :
{"type":"string", "size":8, "mandatory":true },
- "maxusers" :
+ "maxusers" :
{"type":"int", "size":16 },
- "loglevel" :
+ "loglevel" :
{"type":"string", "size":16, "mandatory":true },
- "timezone" :
+ "timezone" :
{"type":"string", "size":16, "mandatory":true },
- "xmppwhitelist" :
+ "xmppwhitelist" :
{"type":"text" },
- "info" :
+ "info" :
{"type":"text" },
- "unregister" :
+ "unregister" :
{"type":"int", "size":1 },
- "username" :
+ "username" :
{"type":"string", "size":32, "mandatory":true },
- "password" :
+ "password" :
{"type":"string", "size":64, "mandatory":true },
- "rewrite" :
+ "rewrite" :
{"type":"int", "size":1 },
- "sizelimit" :
+ "sizelimit" :
{"type":"int", "size":16 }
}';
-
+
parent::__construct();
- $this->environment = 'development';
$this->description = __('global.description');
$this->theme = 'material';
$this->locale = 'en';
diff --git a/sources/app/models/config/ConfigDAO.php b/sources/app/models/config/ConfigDAO.php
index 2056503..e6b1d61 100755
--- a/sources/app/models/config/ConfigDAO.php
+++ b/sources/app/models/config/ConfigDAO.php
@@ -6,8 +6,7 @@ class ConfigDAO extends SQL {
function set(Config $c) {
$this->_sql = '
update config
- set environment = :environment,
- description = :description,
+ set description = :description,
theme = :theme,
locale = :locale,
maxusers = :maxusers,
@@ -20,11 +19,10 @@ class ConfigDAO extends SQL {
password = :password,
rewrite = :rewrite,
sizelimit = :sizelimit';
-
+
$this->prepare(
- 'Config',
- array(
- 'environment' => $c->environment,
+ 'Config',
+ array(
'description' => $c->description,
'theme' => $c->theme,
'locale' => $c->locale,
@@ -40,25 +38,24 @@ class ConfigDAO extends SQL {
'sizelimit' => $c->sizelimit
)
);
-
+
$this->run('Config');
-
+
if(!$this->_effective) {
$this->_sql = '
truncate table config;';
$this->prepare(
- 'Config',
+ 'Config',
array(
)
);
-
+
$this->run('Config');
-
+
$this->_sql = '
insert into config
(
- environment,
description,
theme,
locale,
@@ -75,7 +72,6 @@ class ConfigDAO extends SQL {
)
values
(
- :environment,
:description,
:theme,
:locale,
@@ -91,11 +87,10 @@ class ConfigDAO extends SQL {
:sizelimit
)
';
-
+
$this->prepare(
- 'Config',
+ 'Config',
array(
- 'environment' => $c->environment,
'description' => $c->description,
'theme' => $c->theme,
'locale' => $c->locale,
@@ -111,7 +106,7 @@ class ConfigDAO extends SQL {
'sizelimit' => $c->sizelimit
)
);
-
+
$this->run('Config');
}
}
@@ -121,7 +116,7 @@ class ConfigDAO extends SQL {
select * from config';
$this->prepare('Config', array());
-
+
$conf = $this->run('Config', 'item');
if(!isset($conf))
diff --git a/sources/app/models/postn/Postn.php b/sources/app/models/postn/Postn.php
index 3e88e0f..7a948cc 100755
--- a/sources/app/models/postn/Postn.php
+++ b/sources/app/models/postn/Postn.php
@@ -84,6 +84,24 @@ class Postn extends Model {
parent::__construct();
}
+ private function getContent($contents) {
+ $content = '';
+ foreach($contents as $c) {
+ switch($c->attributes()->type) {
+ case 'html':
+ case 'xhtml':
+ return (string)$c->asXML();
+ break;
+ case 'text':
+ default :
+ $content = (string)$c;
+ break;
+ }
+ }
+
+ return $content;
+ }
+
public function set($item, $from, $delay = false, $node = false) {
if($item->item)
$entry = $item->item;
@@ -125,16 +143,7 @@ class Postn extends Model {
$summary = '';
if($entry->entry && $entry->entry->content) {
- if((string)$entry->entry->content->attributes()->type == 'text')
- $content = (string)$entry->entry->content;
- elseif(
- (string)$entry->entry->content->attributes()->type == ('html' || 'xhtml')
- //&& $entry->entry->content->html
- //&& $entry->entry->content->html->body
- ) {
- $content = (string)$entry->entry->content/*->html->body*/->asXML();
- } else
- $content = (string)$entry->entry->content;
+ $content = $this->getContent($entry->entry->content);
} elseif($summary == '')
$content = __('');
else
diff --git a/sources/app/widgets/AdminMain/AdminMain.php b/sources/app/widgets/AdminMain/AdminMain.php
index aa72959..9ec3d7f 100755
--- a/sources/app/widgets/AdminMain/AdminMain.php
+++ b/sources/app/widgets/AdminMain/AdminMain.php
@@ -14,7 +14,7 @@
*
* See COPYING for licensing information.
*/
-
+
class AdminMain extends WidgetBase
{
function load() {
@@ -46,7 +46,7 @@ class AdminMain extends WidgetBase
}
$cd->set($config);
-
+
//set timezone
if(isset($form['timezone'])) {
date_default_timezone_set($form['timezone']);
@@ -71,7 +71,7 @@ class AdminMain extends WidgetBase
{
$cd = new \Modl\ConfigDAO();
$config = $cd->get();
-
+
$this->view->assign('conf', $cd->get());
$this->view->assign('logs',
array(
@@ -79,11 +79,6 @@ class AdminMain extends WidgetBase
1 => $this->__('log.syslog'),
2 => $this->__('log.syslog_files'))
);
- $this->view->assign('envs',
- array(
- 'development' => 'Development',
- 'production' => 'Production')
- );
$this->view->assign('bosh_info4',
$this->__('bosh.info4', '', ''));
@@ -99,7 +94,7 @@ class AdminMain extends WidgetBase
if(isset($_SERVER['HTTP_MOD_REWRITE']) && $_SERVER['HTTP_MOD_REWRITE']) {
$this->view->assign('server_rewrite', true);
}
-
+
$this->view->assign('timezones', getTimezoneList());
$this->view->assign('langs', loadLangArray());
}
diff --git a/sources/app/widgets/AdminMain/adminmain.tpl b/sources/app/widgets/AdminMain/adminmain.tpl
index ed2c23c..79de4cd 100755
--- a/sources/app/widgets/AdminMain/adminmain.tpl
+++ b/sources/app/widgets/AdminMain/adminmain.tpl
@@ -7,7 +7,7 @@
-
-
-
-
-
-
-
+
{if="!$c->version()"}
@@ -121,11 +112,10 @@
{if="!$_SERVER['HTTP_MOD_REWRITE']"}
-
+
{$c->__('compatibility.rewrite')}
{/if}
-
diff --git a/sources/app/widgets/Api/Api.php b/sources/app/widgets/Api/Api.php
index dbf47aa..1a36ad3 100755
--- a/sources/app/widgets/Api/Api.php
+++ b/sources/app/widgets/Api/Api.php
@@ -14,7 +14,7 @@
*
* See COPYING for licensing information.
*/
-
+
class Api extends WidgetBase {
function load()
{
@@ -30,7 +30,7 @@ class Api extends WidgetBase {
'',
'',
''));
-
+
$json = requestURL(MOVIM_API.'status', 1, array('uri' => BASE_URI));
$json = json_decode($json);
@@ -55,10 +55,15 @@ class Api extends WidgetBase {
function ajaxRegister()
{
$rewrite = false;
- if(isset($_SERVER['HTTP_MOD_REWRITE']) && $_SERVER['HTTP_MOD_REWRITE']) {
+
+ $cd = new \Modl\ConfigDAO();
+ $config = $cd->get();
+
+ if($config->rewrite/*isset($_SERVER['HTTP_MOD_REWRITE'])
+ && $_SERVER['HTTP_MOD_REWRITE']*/) {
$rewrite = true;
- }
-
+ }
+
$json = requestURL(
MOVIM_API.'register',
1,
@@ -78,7 +83,7 @@ class Api extends WidgetBase {
{
$cd = new \Modl\ConfigDAO();
$config = $cd->get();
-
+
$config->unregister = !$config->unregister;
$cd->set($config);
diff --git a/sources/app/widgets/Chat/Chat.php b/sources/app/widgets/Chat/Chat.php
index 8ade9af..85ee764 100644
--- a/sources/app/widgets/Chat/Chat.php
+++ b/sources/app/widgets/Chat/Chat.php
@@ -75,7 +75,7 @@ class Chat extends WidgetBase
Notification::append('chat|'.$from, $contact->getTrueName(), $message->body, $avatar, 4);
}
- RPC::call('movim_fill', $from.'_state', '');
+ RPC::call('movim_fill', $from.'_state', $contact->jid);
// If the message is from me
} /*else {
$from = $message->jidto;
@@ -90,7 +90,6 @@ class Chat extends WidgetBase
if(!preg_match('#^\?OTR#', $message->body)) {
RPC::call('Chat.appendMessage', $this->prepareMessage($message));
}
- RPC::call('MovimTpl.scrollPanel');
}
function onComposing($array)
@@ -154,7 +153,7 @@ class Chat extends WidgetBase
$html = $view->draw('_chat_state', true);
RPC::call('movim_fill', $jid.'_state', $html);
- RPC::call('MovimTpl.scrollPanel');
+ //RPC::call('MovimTpl.scrollPanel');
}
/**
diff --git a/sources/app/widgets/Chat/_chat.tpl b/sources/app/widgets/Chat/_chat.tpl
index 1b17234..20a2bd5 100644
--- a/sources/app/widgets/Chat/_chat.tpl
+++ b/sources/app/widgets/Chat/_chat.tpl
@@ -2,7 +2,6 @@
-
-
+
diff --git a/sources/app/widgets/Post/_post_empty.tpl b/sources/app/widgets/Post/_post_empty.tpl
index 90845df..09de87c 100644
--- a/sources/app/widgets/Post/_post_empty.tpl
+++ b/sources/app/widgets/Post/_post_empty.tpl
@@ -28,6 +28,7 @@
{/if}
+ {$value->origin} /
{$value->node}
–
diff --git a/sources/app/widgets/Publish/Publish.php b/sources/app/widgets/Publish/Publish.php
index 03b6d9f..23158cc 100644
--- a/sources/app/widgets/Publish/Publish.php
+++ b/sources/app/widgets/Publish/Publish.php
@@ -144,6 +144,7 @@ class Publish extends WidgetBase
$p = new PostPublish;
$p->setFrom($this->user->getLogin())
->setTo($form->to->value)
+ ->setContent($form->content->value)
->setNode($form->node->value);
//->setLocation($geo)
//->enableComments()
diff --git a/sources/app/widgets/System/System.php b/sources/app/widgets/System/System.php
index 24da7e0..d5fb63e 100755
--- a/sources/app/widgets/System/System.php
+++ b/sources/app/widgets/System/System.php
@@ -25,23 +25,18 @@ class System extends WidgetBase {
$r = new Route;
$this->view->assign('current_page', $r->find());
-
+
if(!isset($_SERVER['HTTP_MOD_REWRITE']) || !$_SERVER['HTTP_MOD_REWRITE'])
$this->view->assign('page_key_uri', '?q=');
else
$this->view->assign('page_key_uri', '');
- if(FAIL_SAFE != null)
- $this->view->assign('fail_safe', FAIL_SAFE);
- else
- $this->view->assign('fail_safe', '');
-
$this->view->assign('secure_websocket', file_get_contents(CACHE_PATH.'websocket'));
// And we load some public values of the system configuration
$cd = new \Modl\ConfigDAO();
$config = $cd->get();
-
+
$public_conf = array(
'bosh_url' => $config->boshurl,
'timezone' => $config->timezone
diff --git a/sources/app/widgets/System/system.tpl b/sources/app/widgets/System/system.tpl
index 357f0a0..5d92193 100755
--- a/sources/app/widgets/System/system.tpl
+++ b/sources/app/widgets/System/system.tpl
@@ -3,7 +3,6 @@
var BASE_HOST = '{$base_host}';
var ERROR_URI = '{$error_uri}';
var PAGE_KEY_URI = '{$page_key_uri}';
- var FAIL_SAFE = '{$fail_safe}';
var CURRENT_PAGE = '{$current_page}';
var SERVER_CONF = {$server_conf};
var SECURE_WEBSOCKET= {$secure_websocket};
diff --git a/sources/bootstrap.php b/sources/bootstrap.php
index 3fde391..14d6892 100755
--- a/sources/bootstrap.php
+++ b/sources/bootstrap.php
@@ -9,7 +9,7 @@ use Monolog\Handler\SyslogHandler;
/**
* Error Handler...
*/
-function systemErrorHandler($errno, $errstr, $errfile, $errline, $errcontext = null)
+function systemErrorHandler($errno, $errstr, $errfile, $errline, $errcontext = null)
{
$log = new Logger('movim');
$log->pushHandler(new SyslogHandler('movim'));
@@ -17,6 +17,29 @@ function systemErrorHandler($errno, $errstr, $errfile, $errline, $errcontext = n
return false;
}
+function fatalErrorShutdownHandler()
+{
+ $last_error = error_get_last();
+ if($last_error['type'] === E_ERROR) {
+ systemErrorHandler(
+ E_ERROR,
+ $last_error['message'],
+ $last_error['file'],
+ $last_error['line']);
+
+ if (ob_get_contents()) ob_clean();
+
+ ?>
+
+
Oops... something went wrong.
+
But don't panic. The NSA is on the case.
+
+ setConstants();
-
+
mb_internal_encoding("UTF-8");
//First thing to do, define error management (in case of error forward)
$this->setLogs();
-
+
//Check if vital system need is OK
$this->checkSystem();
if(!$light) $this->setBrowserSupport();
-
+
$this->loadSystem();
$this->loadCommonLibraries();
$this->loadDispatcher();
$this->loadHelpers();
-
+
$loadmodlsuccess = $this->loadModl();
$this->setTimezone();
@@ -59,7 +82,7 @@ class Bootstrap {
DOCUMENT_ROOT.'/cache/test.tmp',
);
$errors=array();
-
+
if(!is_writable(DOCUMENT_ROOT))
$errors[] = 'We\'re unable to write to folder '.DOCUMENT_ROOT.': check rights';
else {
@@ -78,12 +101,12 @@ class Bootstrap {
touch(DOCUMENT_ROOT.'/users/index.html');
}
}
-
+
foreach($listWritableFile as $fileName) {
if (!file_exists($fileName)) {
if (touch($fileName) !== true) {
$errors[] = 'We\'re unable to write to '.$fileName.': check rights';
- }
+ }
}else if (is_writable($fileName) !== true) {
$errors[] = 'We\'re unable to write to file '.$fileName.': check rights';
}
@@ -111,9 +134,9 @@ class Bootstrap {
define('BASE_URI', $this->getBaseUri());
define('CACHE_URI', $this->getBaseUri() . 'cache/');
-
+
define('SESSION_ID', getenv('sid'));
-
+
define('THEMES_PATH', DOCUMENT_ROOT . '/themes/');
define('USERS_PATH', DOCUMENT_ROOT . '/users/');
define('APP_PATH', DOCUMENT_ROOT . '/app/');
@@ -122,13 +145,13 @@ class Bootstrap {
define('LOCALES_PATH', DOCUMENT_ROOT . '/locales/');
define('CACHE_PATH', DOCUMENT_ROOT . '/cache/');
define('LOG_PATH', DOCUMENT_ROOT . '/log/');
-
+
define('VIEWS_PATH', DOCUMENT_ROOT . '/app/views/');
define('HELPERS_PATH', DOCUMENT_ROOT . '/app/helpers/');
define('WIDGETS_PATH', DOCUMENT_ROOT . '/app/widgets/');
-
+
define('MOVIM_API', 'https://api.movim.eu/');
-
+
if (!defined('DOCTYPE')) {
define('DOCTYPE','text/html');
}
@@ -136,7 +159,7 @@ class Bootstrap {
private function isServerSecured() {
if((
- isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "")
+ isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "")
|| (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https")) {
return true;
}
@@ -150,7 +173,7 @@ class Bootstrap {
return trim(fgets($f));
}
}
-
+
private function getBaseUri() {
$dirname = dirname($_SERVER['PHP_SELF']);
$path = (($dirname == DIRECTORY_SEPARATOR) ? '' : $dirname).'/';
@@ -175,7 +198,7 @@ class Bootstrap {
return $uri;
}
}
-
+
private function loadSystem() {
// Loads up all system libraries.
require_once(SYSTEM_PATH . "/i18n/i18n.php");
@@ -186,16 +209,15 @@ 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");
}
-
+
private function loadCommonLibraries() {
// XMPPtoForm lib
require_once(LIB_PATH . "XMPPtoForm.php");
-
+
// SDPtoJingle and JingletoSDP lib :)
require_once(LIB_PATH . "SDPtoJingle.php");
require_once(LIB_PATH . "JingletoSDP.php");
@@ -206,7 +228,7 @@ class Bootstrap {
require $file;
}
}
-
+
private function loadDispatcher() {
require_once(SYSTEM_PATH . "template/TplPageBuilder.php");
require_once(SYSTEM_PATH . "controllers/BaseController.php");
@@ -232,7 +254,7 @@ class Bootstrap {
$cd = new \Modl\ConfigDAO();
$config = $cd->get();
-
+
if($user->isLogged()) {
$lang = $user->getConfig('language');
if(isset($lang)) {
@@ -249,41 +271,15 @@ class Bootstrap {
loadLanguage($config->locale);
}
}
-
+
private function setLogs() {
- /*$cd = new \Modl\ConfigDAO();
- $config = $cd->get();
-
- try {
- define('ENVIRONMENT', $config->environment);
- } catch (Exception $e) {
- define('ENVIRONMENT','development');//default environment is production
- }*/
- define('ENVIRONMENT','development');//default environment is production
- /**
- * LOG_MANAGEMENT: define where logs are saved, prefer error_log, or log_folder if you use mutual server.
- * 'error_log' : save in file defined on your file server
- * 'log_folder' : save in log folder, in DOCUMENT_ROOT.'/log'
- * 'syslog' : save in global system logs (not in file server logs)
- */
-
- define('LOG_MANAGEMENT','log_folder');
- if (ENVIRONMENT === 'development') {
- ini_set('log_errors', 1);
- ini_set('display_errors', 0);
- ini_set('error_reporting', E_ALL );
-
- } else {
- ini_set('log_errors', 1);
- ini_set('display_errors', 0);
- ini_set('error_reporting', E_ALL ^ E_DEPRECATED ^ E_NOTICE);
- }
- if (LOG_MANAGEMENT === 'log_folder') {
- ini_set('error_log', DOCUMENT_ROOT.'/log/php.log');
- }
+ ini_set('display_errors', 0);
+ ini_set('error_log', DOCUMENT_ROOT.'/log/php.log');
+
set_error_handler('systemErrorHandler', E_ALL);
+ register_shutdown_function('fatalErrorShutdownHandler');
}
-
+
private function setTimezone() {
// We set the default timezone to the server timezone
$cd = new \Modl\ConfigDAO();
@@ -291,7 +287,7 @@ class Bootstrap {
// And we set a global offset
define('TIMEZONE_OFFSET', getTimezoneOffset($config->timezone));
-
+
date_default_timezone_set($config->timezone);
}
@@ -307,7 +303,7 @@ class Bootstrap {
// We load Movim Data Layer
$db = Modl\Modl::getInstance();
$db->setModelsPath(APP_PATH.'models');
-
+
Modl\Utils::loadModel('Config');
Modl\Utils::loadModel('Presence');
Modl\Utils::loadModel('Contact');
@@ -327,13 +323,13 @@ class Bootstrap {
} else {
throw new MovimException('Cannot find config/db.inc.php file');
}
-
+
$db->setConnectionArray($conf);
$db->connect();
return true;
}
-
+
private function setBrowserSupport() {
if(isset( $_SERVER['HTTP_USER_AGENT'])) {
$useragent = $_SERVER['HTTP_USER_AGENT'];
@@ -366,7 +362,7 @@ class Bootstrap {
switch($browser) {
case 'Firefox':
- if($browser_version > 3.5)
+ if($browser_version > 30.0)
$compatible = true;
break;
case 'IE':
@@ -385,7 +381,7 @@ class Bootstrap {
define('BROWSER_COMP', $compatible);
}
-
+
private function startingSession() {
$s = \Sessionx::start();
$s->load();
diff --git a/sources/config/db.example.inc.php b/sources/config/db.example.inc.php
index 72d63c4..6015f3a 100755
--- a/sources/config/db.example.inc.php
+++ b/sources/config/db.example.inc.php
@@ -5,13 +5,13 @@ $conf = array(
# The type can be 'pgsql' or 'mysql'
'type' => 'mysql',
# The database username
- 'username' => 'yhuser',
+ 'username' => 'username',
# The password
- 'password' => 'yhpwd',
+ 'password' => 'password',
# Where can we find the database ?
'host' => 'localhost',
# The port number, 3306 for MySQL and 5432 for PostGreSQL
'port' => 3306,
# The database name
- 'database' => 'yhdb'
+ 'database' => 'movim'
);
diff --git a/sources/daemon.php b/sources/daemon.php
index 9b21329..64def68 100755
--- a/sources/daemon.php
+++ b/sources/daemon.php
@@ -30,7 +30,7 @@ if($argsize == 2) {
}
$md = Modl\Modl::getInstance();
-$infos = $md->check();
+$infos = $md->check();
if($infos != null) {
echo colorize("The database need to be updated before running the daemon\n", 'green');
@@ -40,7 +40,7 @@ if($infos != null) {
echo colorize("\nTo update the database run\n", 'green');
echo colorize("php mud.php db set\n", 'purple');
-
+ exit;
break;
}
diff --git a/sources/index.php b/sources/index.php
index 0260245..5bc0caa 100755
--- a/sources/index.php
+++ b/sources/index.php
@@ -40,52 +40,13 @@
define('DOCUMENT_ROOT', dirname(__FILE__));
require_once(DOCUMENT_ROOT.'/bootstrap.php');
-use Monolog\Logger;
-use Monolog\Handler\SyslogHandler;
+$bootstrap = new Bootstrap();
-try {
- if((isset($_GET['q']) && $_GET['q'] == 'admin') ||
- (isset($_GET['query']) && $_GET['query'] == 'admin')
- )
- define('FAIL_SAFE', true);
- else
- define('FAIL_SAFE', false);
-
- $bootstrap = new Bootstrap();
-
- $bootstrap->boot();
+$bootstrap->boot();
- $rqst = new FrontController();
- $rqst->handle();
+$rqst = new FrontController();
+$rqst->handle();
- WidgetWrapper::getInstance(false);
- // Closing stuff
- WidgetWrapper::destroyInstance();
-
-} catch (Exception $e) {
- $log = new Logger('movim');
- $log->pushHandler(new SyslogHandler('movim'));
- $log->addInfo($e->getMessage());
-
- if (ENVIRONMENT === 'development' && !FAIL_SAFE) {
- ?>
-
-
An error happened
-
getMessage();?>
-
-
-
-
Oops... something went wrong.
-
But don't panic. The NSA is on the case.
-
- handle();
- }
-}
+WidgetWrapper::getInstance(false);
+// Closing stuff
+WidgetWrapper::destroyInstance();
diff --git a/sources/linker.php b/sources/linker.php
index 62c9a4f..29777b8 100755
--- a/sources/linker.php
+++ b/sources/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->host, $port)->then($xmpp_behaviour);
}
} else {
return;
diff --git a/sources/system/MovimException.php b/sources/system/MovimException.php
deleted file mode 100755
index 5482c75..0000000
--- a/sources/system/MovimException.php
+++ /dev/null
@@ -1,26 +0,0 @@
-code . ' - ' . $this->message . '
';
- }
-}
-
-?>
diff --git a/sources/system/Route.php b/sources/system/Route.php
index 72a4c00..0fada85 100755
--- a/sources/system/Route.php
+++ b/sources/system/Route.php
@@ -1,8 +1,8 @@
-_routes = array(
'about' => array('x'),
@@ -29,7 +29,7 @@ class Route extends \BaseController {
'visio' => false
);
}
-
+
public function find() {
$cd = new \Modl\ConfigDAO();
$config = $cd->get();
@@ -43,13 +43,13 @@ class Route extends \BaseController {
if(isset($this->_routes[$this->_page]))
$route = $this->_routes[$this->_page];
-
+
if(count($request) && isset($route)) {
$i = 0;
foreach($route as $key) {
if (isset($request[$i])) {
$_GET[$key] = $request[$i];
- }
+ }
$i++;
}
}
@@ -65,7 +65,7 @@ class Route extends \BaseController {
return $this->_page;
}
-
+
public static function urlize($page, $params = false, $tab = false) {
$r = new Route();
$routes = $r->_routes;
@@ -75,8 +75,8 @@ class Route extends \BaseController {
if($page === 'root')
return BASE_URI;
-
- if(isset($routes[$page])) {
+
+ if(isset($routes[$page])) {
//if($params != false && count($routes[$page]) != count($params)) {
//throw new Exception(__('error.route', $page));
//} else {
@@ -84,8 +84,8 @@ class Route extends \BaseController {
$tab = '#'.$tab;
// Here we got a beautiful rewriten URL !
if($config->rewrite == true
- && isset($_SERVER['HTTP_MOD_REWRITE'])
- && $_SERVER['HTTP_MOD_REWRITE']) {
+ /*&& isset($_SERVER['HTTP_MOD_REWRITE'])
+ && $_SERVER['HTTP_MOD_REWRITE']*/) {
$uri = BASE_URI . $page;
if($params != false && is_array($params))
foreach($params as $value)
@@ -96,7 +96,7 @@ class Route extends \BaseController {
//We construct a classic URL if the rewriting is disabled
else {
$uri = BASE_URI . '?q=' . $page;
-
+
if($params != false && is_array($params)) {
$i = 0;
foreach($params as $value) {
diff --git a/sources/system/Sessionx.php b/sources/system/Sessionx.php
index 6360d0b..1ae2b88 100755
--- a/sources/system/Sessionx.php
+++ b/sources/system/Sessionx.php
@@ -21,7 +21,7 @@ class Sessionx {
protected static $_instance;
private $_max_age = 86400; // 24hour
private $_timestamp;
-
+
private $_rid;
private $_id;
@@ -49,8 +49,8 @@ class Sessionx {
self::$_sessionid = $_COOKIE['MOVIM_SESSION_ID'];
} elseif(SESSION_ID) {
self::$_sessionid = SESSION_ID;
- } else {
- $key = generateKey(32);
+ } elseif(!headers_sent()) {
+ $key = generateKey(32);
setcookie("MOVIM_SESSION_ID", $key, time()+$this->_max_age, '/', false, APP_SECURED);
self::$_sessionid = $key;
}
@@ -85,11 +85,11 @@ class Sessionx {
$s->rid = $this->_rid;
$s->sid = $this->_sid;
$s->id = $this->_id;
- $s->port = $this->_port;
- $s->host = $this->_host;
- $s->domain = $this->_domain;
- $s->config = serialize($this->_config);
- $s->active = $this->_active;
+ $s->port = $this->_port;
+ $s->host = $this->_host;
+ $s->domain = $this->_domain;
+ $s->config = serialize($this->_config);
+ $s->active = $this->_active;
$s->start = $this->_start;
$s->timestamp = $this->_timestamp;
$s->mechanism = $this->_mechanism;
@@ -104,10 +104,10 @@ class Sessionx {
$this->_password = $pass;
$this->_resource = 'moxl'.\generateKey(6);
$this->_start = date(DATE_ISO8601);
-
+
$this->_rid = rand(1, 2048);
$this->_id = 0;
-
+
$sd = new modl\SessionxDAO();
$s = $this->inject();
$sd->init($s);
@@ -116,7 +116,7 @@ class Sessionx {
public function load() {
$sd = new modl\SessionxDAO();
$session = $sd->get(self::$_sessionid);
-
+
if(isset($session)) {
$this->_user = $session->username;
$this->_password = $session->password;
diff --git a/sources/system/widget/WidgetWrapper.php b/sources/system/widget/WidgetWrapper.php
index 60059fd..19a20a2 100644
--- a/sources/system/widget/WidgetWrapper.php
+++ b/sources/system/widget/WidgetWrapper.php
@@ -1,19 +1,19 @@
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;
diff --git a/sources/themes/material/css/form.css b/sources/themes/material/css/form.css
index 4a91339..7ea0dfd 100644
--- a/sources/themes/material/css/form.css
+++ b/sources/themes/material/css/form.css
@@ -290,7 +290,6 @@ input[type=button].flat:focus {
position: fixed;
bottom: 2rem;
right: 2rem;
- border-radius: 10rem;
min-height: 0rem;
min-width: 0rem;
line-height: 7rem;
@@ -298,19 +297,33 @@ input[type=button].flat:focus {
width: 7rem;
z-index: 1;
font-size: 3.5rem;
- transition: all 0.15s ease 0s;
+}
+
+.button.action,
+.button.action .actions li {
+ border-radius: 10rem;
box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.23), 0 0.5rem 1.25rem rgba(0, 0, 0, 0.16);
}
.button.action:hover {
- transform: scale(1.1);
+ /*transform: scale(1.1);*/
background-image: linear-gradient(to bottom, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.1) 100%);
}
-
+/*
.button.action:active {
transform: scale(0.95);
background-image: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.1) 100%);
}
+*/
+.button.action,
+.button.action .actions li,
+.button.action > i {
+ transition: all 0.15s ease 0s;
+}
+
+.button.action.active > i {
+ transform: rotate(135deg);
+}
li.action div.action .button {
margin: 0.5rem;
@@ -329,3 +342,34 @@ header.big ~ .button.action {
right: calc(70% + 3rem);
}
}
+
+.button.action .actions {
+ position: absolute;
+ bottom: 7rem;
+ left: 0;
+ padding: 0;
+}
+
+.button.action .actions li {
+ background-color: white;
+ color: #888;
+ font-size: 3rem;
+ line-height: 6rem;
+ margin: -4rem 0.5rem;
+ width: 6rem;
+ height: 6rem;
+ padding: 0;
+ opacity: 0;
+ transition: all 0.15s ease 0s;
+ pointer-events: none;
+}
+
+.button.action.active .actions li {
+ opacity: 1;
+ pointer-events: auto;
+ margin: 2rem 0.5rem;
+}
+
+.button.action .actions li:hover {
+ background-color: white;
+}