1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00

Upgrade to movim 20150810

This commit is contained in:
src386 2015-08-10 23:42:45 +02:00
parent b72c9e176c
commit ca10b3e3df
42 changed files with 348 additions and 325 deletions

View file

@ -8,4 +8,4 @@ DO NOT USE
**Changelog** **Changelog**
Current Movim version : 20150731. Current Movim version : 20150810.

View file

@ -49,10 +49,9 @@ sudo su -c "cd $final_path && php composer.phar install" -s /bin/sh www-data
# Movim configuration # Movim configuration
sudo cp $final_path/config/db.example.inc.php $final_path/config/db.inc.php 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@username@$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@password@$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@/ws/@$path/ws/" $final_path/app/assets/js/movim_websocket.js
sudo sed -i "s@PATHTOCHANGE@$path@g" $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 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 locale:$language"
sudo su -c "cd $final_path && php mud.php config loglevel:1" sudo su -c "cd $final_path && php mud.php config loglevel:1"

14
sources/.bzrignore Executable file
View file

@ -0,0 +1,14 @@
*~
*#*
cache.tmp
log/*
locales/files.list
*.pdf
*.swp
./cache
./config/*
./lib/Modl
./lib/Moxl
./users/*
./log

4
sources/.dir-locals.el Executable file
View file

@ -0,0 +1,4 @@
((nil . ((indent-tabs-mode . nil)
(tab-width . 4)
(fill-column . 80)))
(c-mode . ((c-file-style . "stroustrup"))))

8
sources/.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
/vendor
/log
/users
/cache
*~
/config/db.inc.php
/composer.lock
/composer.phar

22
sources/.htaccess Executable file
View file

@ -0,0 +1,22 @@
Options -Indexes
AddType application/x-web-app-manifest+json .webapp
<IfModule mod_rewrite.c>
# 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}]
</IfModule>

View file

@ -1,6 +1,6 @@
/** /**
* Movim Javascript Template functions * Movim Javascript Template functions
* *
* These are the default callback functions that users may (or may not) use. * 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 * Note that all of them take only one parameter. Don't be fooled by this, the
@ -86,6 +86,13 @@ var MovimTpl = {
return false; 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() { scrollPanel : function() {
var selector = document.querySelector('main section > div:first-child:nth-last-child(2) ~ div div'); var selector = document.querySelector('main section > div:first-child:nth-last-child(2) ~ div div');
@ -116,9 +123,12 @@ var MovimTpl = {
return; return;
} }
//if(!document.querySelector(element).contains(e.target)) //if(!document.querySelector(element).contains(e.target))
movim_remove_class(element, classname); movim_remove_class(element, classname);
}, },
toggleActionButton : function() {
movim_toggle_class('.button.action', 'active');
},
hideContextMenu : function() { hideContextMenu : function() {
movim_remove_class('ul.context_menu', 'shown'); movim_remove_class('ul.context_menu', 'shown');
}, },

View file

@ -41,9 +41,9 @@ var MovimWebsocket = {
init : function() { init : function() {
if(SECURE_WEBSOCKET) { if(SECURE_WEBSOCKET) {
var uri = 'wss://' + BASE_HOST + 'PATHTOCHANGE/ws/'; var uri = 'wss://' + BASE_HOST + '/ws/';
} else { } else {
var uri = 'ws://' + BASE_HOST + 'PATHTOCHANGE/ws/'; var uri = 'ws://' + BASE_HOST + '/ws/';
} }
this.connection = new WebSocket(uri); this.connection = new WebSocket(uri);

View file

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

View file

@ -2,8 +2,7 @@
namespace Modl; namespace Modl;
class Config extends Model { class Config extends Model {
public $environment;
public $description; public $description;
public $theme; public $theme;
public $locale; public $locale;
@ -17,43 +16,40 @@ class Config extends Model {
public $password; public $password;
public $rewrite; public $rewrite;
public $sizelimit; public $sizelimit;
public function __construct() { public function __construct() {
$this->_struct = ' $this->_struct = '
{ {
"environment" : "description" :
{"type":"string", "size":64, "mandatory":true },
"description" :
{"type":"text" }, {"type":"text" },
"theme" : "theme" :
{"type":"string", "size":32, "mandatory":true }, {"type":"string", "size":32, "mandatory":true },
"locale" : "locale" :
{"type":"string", "size":8, "mandatory":true }, {"type":"string", "size":8, "mandatory":true },
"maxusers" : "maxusers" :
{"type":"int", "size":16 }, {"type":"int", "size":16 },
"loglevel" : "loglevel" :
{"type":"string", "size":16, "mandatory":true }, {"type":"string", "size":16, "mandatory":true },
"timezone" : "timezone" :
{"type":"string", "size":16, "mandatory":true }, {"type":"string", "size":16, "mandatory":true },
"xmppwhitelist" : "xmppwhitelist" :
{"type":"text" }, {"type":"text" },
"info" : "info" :
{"type":"text" }, {"type":"text" },
"unregister" : "unregister" :
{"type":"int", "size":1 }, {"type":"int", "size":1 },
"username" : "username" :
{"type":"string", "size":32, "mandatory":true }, {"type":"string", "size":32, "mandatory":true },
"password" : "password" :
{"type":"string", "size":64, "mandatory":true }, {"type":"string", "size":64, "mandatory":true },
"rewrite" : "rewrite" :
{"type":"int", "size":1 }, {"type":"int", "size":1 },
"sizelimit" : "sizelimit" :
{"type":"int", "size":16 } {"type":"int", "size":16 }
}'; }';
parent::__construct(); parent::__construct();
$this->environment = 'development';
$this->description = __('global.description'); $this->description = __('global.description');
$this->theme = 'material'; $this->theme = 'material';
$this->locale = 'en'; $this->locale = 'en';

View file

@ -6,8 +6,7 @@ class ConfigDAO extends SQL {
function set(Config $c) { function set(Config $c) {
$this->_sql = ' $this->_sql = '
update config update config
set environment = :environment, set description = :description,
description = :description,
theme = :theme, theme = :theme,
locale = :locale, locale = :locale,
maxusers = :maxusers, maxusers = :maxusers,
@ -20,11 +19,10 @@ class ConfigDAO extends SQL {
password = :password, password = :password,
rewrite = :rewrite, rewrite = :rewrite,
sizelimit = :sizelimit'; sizelimit = :sizelimit';
$this->prepare( $this->prepare(
'Config', 'Config',
array( array(
'environment' => $c->environment,
'description' => $c->description, 'description' => $c->description,
'theme' => $c->theme, 'theme' => $c->theme,
'locale' => $c->locale, 'locale' => $c->locale,
@ -40,25 +38,24 @@ class ConfigDAO extends SQL {
'sizelimit' => $c->sizelimit 'sizelimit' => $c->sizelimit
) )
); );
$this->run('Config'); $this->run('Config');
if(!$this->_effective) { if(!$this->_effective) {
$this->_sql = ' $this->_sql = '
truncate table config;'; truncate table config;';
$this->prepare( $this->prepare(
'Config', 'Config',
array( array(
) )
); );
$this->run('Config'); $this->run('Config');
$this->_sql = ' $this->_sql = '
insert into config insert into config
( (
environment,
description, description,
theme, theme,
locale, locale,
@ -75,7 +72,6 @@ class ConfigDAO extends SQL {
) )
values values
( (
:environment,
:description, :description,
:theme, :theme,
:locale, :locale,
@ -91,11 +87,10 @@ class ConfigDAO extends SQL {
:sizelimit :sizelimit
) )
'; ';
$this->prepare( $this->prepare(
'Config', 'Config',
array( array(
'environment' => $c->environment,
'description' => $c->description, 'description' => $c->description,
'theme' => $c->theme, 'theme' => $c->theme,
'locale' => $c->locale, 'locale' => $c->locale,
@ -111,7 +106,7 @@ class ConfigDAO extends SQL {
'sizelimit' => $c->sizelimit 'sizelimit' => $c->sizelimit
) )
); );
$this->run('Config'); $this->run('Config');
} }
} }
@ -121,7 +116,7 @@ class ConfigDAO extends SQL {
select * from config'; select * from config';
$this->prepare('Config', array()); $this->prepare('Config', array());
$conf = $this->run('Config', 'item'); $conf = $this->run('Config', 'item');
if(!isset($conf)) if(!isset($conf))

View file

@ -84,6 +84,24 @@ class Postn extends Model {
parent::__construct(); 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) { public function set($item, $from, $delay = false, $node = false) {
if($item->item) if($item->item)
$entry = $item->item; $entry = $item->item;
@ -125,16 +143,7 @@ class Postn extends Model {
$summary = ''; $summary = '';
if($entry->entry && $entry->entry->content) { if($entry->entry && $entry->entry->content) {
if((string)$entry->entry->content->attributes()->type == 'text') $content = $this->getContent($entry->entry->content);
$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;
} elseif($summary == '') } elseif($summary == '')
$content = __(''); $content = __('');
else else

View file

@ -14,7 +14,7 @@
* *
* See COPYING for licensing information. * See COPYING for licensing information.
*/ */
class AdminMain extends WidgetBase class AdminMain extends WidgetBase
{ {
function load() { function load() {
@ -46,7 +46,7 @@ class AdminMain extends WidgetBase
} }
$cd->set($config); $cd->set($config);
//set timezone //set timezone
if(isset($form['timezone'])) { if(isset($form['timezone'])) {
date_default_timezone_set($form['timezone']); date_default_timezone_set($form['timezone']);
@ -71,7 +71,7 @@ class AdminMain extends WidgetBase
{ {
$cd = new \Modl\ConfigDAO(); $cd = new \Modl\ConfigDAO();
$config = $cd->get(); $config = $cd->get();
$this->view->assign('conf', $cd->get()); $this->view->assign('conf', $cd->get());
$this->view->assign('logs', $this->view->assign('logs',
array( array(
@ -79,11 +79,6 @@ class AdminMain extends WidgetBase
1 => $this->__('log.syslog'), 1 => $this->__('log.syslog'),
2 => $this->__('log.syslog_files')) 2 => $this->__('log.syslog_files'))
); );
$this->view->assign('envs',
array(
'development' => 'Development',
'production' => 'Production')
);
$this->view->assign('bosh_info4', $this->view->assign('bosh_info4',
$this->__('bosh.info4', '<a href="http://wiki.movim.eu/en:install">', '</a>')); $this->__('bosh.info4', '<a href="http://wiki.movim.eu/en:install">', '</a>'));
@ -99,7 +94,7 @@ class AdminMain extends WidgetBase
if(isset($_SERVER['HTTP_MOD_REWRITE']) && $_SERVER['HTTP_MOD_REWRITE']) { if(isset($_SERVER['HTTP_MOD_REWRITE']) && $_SERVER['HTTP_MOD_REWRITE']) {
$this->view->assign('server_rewrite', true); $this->view->assign('server_rewrite', true);
} }
$this->view->assign('timezones', getTimezoneList()); $this->view->assign('timezones', getTimezoneList());
$this->view->assign('langs', loadLangArray()); $this->view->assign('langs', loadLangArray());
} }

View file

@ -7,7 +7,7 @@
<div class="select"> <div class="select">
<select id="locale" name="locale"> <select id="locale" name="locale">
<option value="en">English (default)</option>'; <option value="en">English (default)</option>';
{loop="$langs"} {loop="$langs"}
<option value="{$key}" <option value="{$key}"
{if="$conf->locale == $key"} {if="$conf->locale == $key"}
selected="selected" selected="selected"
@ -19,22 +19,6 @@
</div> </div>
</div> </div>
<div>
<label for="da">{$c->__('general.environment')}</label>
<div class="select">
<select id="environment" name="environment">';
{loop="$envs"}
<option value="{$key}"
{if="$conf->environment == $key"}
selected="selected"
{/if}>
{$value}
</option>
{/loop}
</select>
</div>
</div>
<!-- <!--
<div> <div>
<input type="text" name="sizelimit" id="sizelimit" value="{$conf->sizelimit}" /> <input type="text" name="sizelimit" id="sizelimit" value="{$conf->sizelimit}" />
@ -44,7 +28,7 @@
<div> <div>
<div class="select"> <div class="select">
<select id="loglevel" name="loglevel"> <select id="loglevel" name="loglevel">
{loop="$logs"} {loop="$logs"}
<option value="{$key}" <option value="{$key}"
{if="$conf->loglevel == $key"} {if="$conf->loglevel == $key"}
selected="selected" selected="selected"
@ -122,7 +106,7 @@
<br /> <br />
<h3>{$c->__('rewrite.title')}</h3> <h3>{$c->__('rewrite.title')}</h3>
<div> <div>
<ul class="thick simple"> <ul class="thick simple">
<li class="action"> <li class="action">
@ -146,7 +130,7 @@
<br /> <br />
<h3>{$c->__('credentials.title')}</h3> <h3>{$c->__('credentials.title')}</h3>
{if="$conf->user == 'admin' || $conf->pass == sha1('password')"} {if="$conf->user == 'admin' || $conf->pass == sha1('password')"}
<div class="message error"> <div class="message error">
{$c->__('credentials.info')} {$c->__('credentials.info')}
@ -158,19 +142,19 @@
<input type="text" id="username" name="username" value="{$conf->username}"/> <input type="text" id="username" name="username" value="{$conf->username}"/>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<div> <div>
<input type="password" id="password" name="password" value=""/> <input type="password" id="password" name="password" value=""/>
<label for="password">{$c->__('credentials.password')}</label> <label for="password">{$c->__('credentials.password')}</label>
</div> </div>
<div> <div>
<input type="password" id="repassword" name="repassword" value=""/> <input type="password" id="repassword" name="repassword" value=""/>
<label for="repassword">{$c->__('credentials.re_password')}</label> <label for="repassword">{$c->__('credentials.re_password')}</label>
</div> </div>
<input <input
type="submit" type="submit"
class="button color green oppose" class="button color green oppose"
value="{$c->__('button.submit')}"/> value="{$c->__('button.submit')}"/>
<div class="clear"></div> <div class="clear"></div>
</form> </form>

View file

@ -4,7 +4,6 @@ general = General Settings
[general] [general]
theme = Theme theme = Theme
language = Default language language = Default language
environment = Environment
log_verbosity = Log verbosity log_verbosity = Log verbosity
timezone = Server Timezone timezone = Server Timezone
limit = User folder size limit (in bytes) limit = User folder size limit (in bytes)

View file

@ -37,7 +37,7 @@
<li class="subheader"> <li class="subheader">
{$c->__('compatibility.info')} {$c->__('compatibility.info')}
</li> </li>
{if="$dbconnected"} {if="$dbconnected"}
{if="$dbinfos > 0"} {if="$dbinfos > 0"}
<li> <li>
@ -56,22 +56,13 @@
{/if} {/if}
<li id="websocket_error"> <li id="websocket_error">
<span class="icon bubble color red">
<i class="zmdi zmdi-code-setting"></i>
</span>
<span>
{$c->__('compatibility.websocket')}
</span>
</li>
<!--<li id="xmpp_websocket_error">
<span class="icon bubble color red"> <span class="icon bubble color red">
<i class="zmdi zmdi-code-setting"></i> <i class="zmdi zmdi-code-setting"></i>
</span> </span>
<span> <span>
{$c->__('compatibility.xmpp_websocket')} <code>{$websocketurl}</code> {$c->__('compatibility.websocket')}
</span> </span>
</li>--> </li>
{if="!$c->version()"} {if="!$c->version()"}
<li class="condensed"> <li class="condensed">
@ -121,11 +112,10 @@
{if="!$_SERVER['HTTP_MOD_REWRITE']"} {if="!$_SERVER['HTTP_MOD_REWRITE']"}
<li> <li>
<span class="icon bubble color orange"> <span class="icon bubble color orange">
<i class="zmdi zmdi-mode-edit"></i> <i class="zmdi zmdi-edit"></i>
</span> </span>
<span>{$c->__('compatibility.rewrite')}</span> <span>{$c->__('compatibility.rewrite')}</span>
</li> </li>
{/if} {/if}
</ul> </ul>
<!--<script type="text/javascript">AdminTest.testXMPPWebsocket('{$websocketurl}');</script>-->
</div> </div>

View file

@ -14,7 +14,7 @@
* *
* See COPYING for licensing information. * See COPYING for licensing information.
*/ */
class Api extends WidgetBase { class Api extends WidgetBase {
function load() function load()
{ {
@ -30,7 +30,7 @@ class Api extends WidgetBase {
'</a>', '</a>',
'<a href="'.$this->route('pods').'">', '<a href="'.$this->route('pods').'">',
'</a>')); '</a>'));
$json = requestURL(MOVIM_API.'status', 1, array('uri' => BASE_URI)); $json = requestURL(MOVIM_API.'status', 1, array('uri' => BASE_URI));
$json = json_decode($json); $json = json_decode($json);
@ -55,10 +55,15 @@ class Api extends WidgetBase {
function ajaxRegister() function ajaxRegister()
{ {
$rewrite = false; $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; $rewrite = true;
} }
$json = requestURL( $json = requestURL(
MOVIM_API.'register', MOVIM_API.'register',
1, 1,
@ -78,7 +83,7 @@ class Api extends WidgetBase {
{ {
$cd = new \Modl\ConfigDAO(); $cd = new \Modl\ConfigDAO();
$config = $cd->get(); $config = $cd->get();
$config->unregister = !$config->unregister; $config->unregister = !$config->unregister;
$cd->set($config); $cd->set($config);

View file

@ -75,7 +75,7 @@ class Chat extends WidgetBase
Notification::append('chat|'.$from, $contact->getTrueName(), $message->body, $avatar, 4); 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 // If the message is from me
} /*else { } /*else {
$from = $message->jidto; $from = $message->jidto;
@ -90,7 +90,6 @@ class Chat extends WidgetBase
if(!preg_match('#^\?OTR#', $message->body)) { if(!preg_match('#^\?OTR#', $message->body)) {
RPC::call('Chat.appendMessage', $this->prepareMessage($message)); RPC::call('Chat.appendMessage', $this->prepareMessage($message));
} }
RPC::call('MovimTpl.scrollPanel');
} }
function onComposing($array) function onComposing($array)
@ -154,7 +153,7 @@ class Chat extends WidgetBase
$html = $view->draw('_chat_state', true); $html = $view->draw('_chat_state', true);
RPC::call('movim_fill', $jid.'_state', $html); RPC::call('movim_fill', $jid.'_state', $html);
RPC::call('MovimTpl.scrollPanel'); //RPC::call('MovimTpl.scrollPanel');
} }
/** /**

View file

@ -2,7 +2,6 @@
<section id="{$jid}_messages"> <section id="{$jid}_messages">
<ul class="{if="$muc"}thin simple{else}middle{/if}" id="{$jid}_conversation"></ul> <ul class="{if="$muc"}thin simple{else}middle{/if}" id="{$jid}_conversation"></ul>
</section> </section>
<div id="{$jid}_state"></div>
</div> </div>
<div class="chat_box"> <div class="chat_box">
<ul class="thin"> <ul class="thin">
@ -15,7 +14,7 @@
</div> </div>
<form> <form>
<div> <div>
<textarea <textarea
rows="1" rows="1"
id="chat_textarea" id="chat_textarea"
data-jid="{$jid}" data-jid="{$jid}"

View file

@ -17,7 +17,7 @@
</span> </span>
</li> </li>
</ul> </ul>
<div id="chat_header" class="return active r1" onclick="MovimTpl.hidePanel(); Chat_ajaxGet();"> <div id="chat_header" class="return active r1 condensed" onclick="MovimTpl.hidePanel(); Chat_ajaxGet();">
<span id="back" class="icon"><i class="zmdi zmdi-arrow-back"></i></span> <span id="back" class="icon"><i class="zmdi zmdi-arrow-back"></i></span>
<h2> <h2>
{if="$contact != null"} {if="$contact != null"}
@ -26,5 +26,6 @@
{$jid|echapJS} {$jid|echapJS}
{/if} {/if}
</h2> </h2>
<h4 id="{$jid}_state">{$contact->jid}</h4>
</h2> </h2>
</div> </div>

View file

@ -1,5 +1 @@
<ul class="simple thin"> {$message}
<li>
<p>{$message}</p>
</li>
</ul>

View file

@ -54,6 +54,8 @@ var Chat = {
var bubble = null; var bubble = null;
var id = null; var id = null;
var scrolled = MovimTpl.isPanelScrolled();
if(message.type == 'groupchat') { if(message.type == 'groupchat') {
bubble = Chat.room.cloneNode(true); bubble = Chat.room.cloneNode(true);
@ -115,7 +117,7 @@ var Chat = {
} }
} }
MovimTpl.scrollPanel(); if(scrolled) MovimTpl.scrollPanel();
} }
} }

View file

@ -4,7 +4,15 @@
<h1>{$c->__('chats.empty_title')}</h1> <h1>{$c->__('chats.empty_title')}</h1>
<h4>{$c->__('chats.empty')}</h4> <h4>{$c->__('chats.empty')}</h4>
</div> </div>
<a class="button action color" onclick="MovimTpl.toggleActionButton()">
<a onclick="Chats_ajaxAdd()" class="button action color">
<i class="zmdi zmdi-plus"></i> <i class="zmdi zmdi-plus"></i>
<ul class="actions">
<li onclick="Chats_ajaxAdd()">
<i class="zmdi zmdi-account-add"></i>
</li>
<li onclick="Rooms_ajaxAdd()">
<i class="zmdi zmdi-accounts-add"></i>
</li>
</ul>
</a> </a>

View file

@ -39,7 +39,9 @@
</ul> </ul>
</header> </header>
<section> <section>
{$value->contentcleaned} <content>
{$value->contentcleaned}
</content>
</section> </section>
<footer> <footer>
<ul class="thin"> <ul class="thin">

View file

@ -1,12 +1,5 @@
<div> <div>
<ul class="active">
<li onclick="Rooms_ajaxAdd()">
<span class="icon">
<i class="zmdi zmdi-accounts-add"></i>
</span>
</li>
</ul>
<span id="menu" class="on_mobile icon active" onclick="MovimTpl.toggleMenu()"><i class="zmdi zmdi-menu"></i></span> <span id="menu" class="on_mobile icon active" onclick="MovimTpl.toggleMenu()"><i class="zmdi zmdi-menu"></i></span>
<span class="on_desktop icon"><i class="zmdi zmdi-comments"></i></span> <span class="on_desktop icon"><i class="zmdi zmdi-comments"></i></span>
<h2 class="r1">{$c->__('page.chats')}</h2> <h2>{$c->__('page.chats')}</h2>
</div> </div>

View file

@ -77,14 +77,27 @@
{else} {else}
<span>{$c->__('hello.contact_post')}</span> <span>{$c->__('hello.contact_post')}</span>
{/if} {/if}
<p>
<span class="info">{$value->published|strtotime|prepareDate}</span> {if="$value->node == 'urn:xmpp:microblog:0'"}
<a href="{$c->route('contact', $value->getContact()->jid)}">
<p class="more"> <i class="zmdi zmdi-account"></i> {$value->getContact()->getTrueName()}
{if="current(explode('.', $value->origin)) != 'nsfw'"} </a>
{$value->contentcleaned|strip_tags:'<img><img/>'} {else}
{$value->origin} /
<a href="{$c->route('group', array($value->origin, $value->node))}">
<i class="zmdi zmdi-pages"></i> {$value->node}
</a>
{/if} {/if}
{$value->published|strtotime|prepareDate}
</p> </p>
{if="$value->privacy"}
<span class="info" title="{$c->__('menu.public')}">
<i class="zmdi zmdi-portable-wifi"></i>
</span>
{/if}
<p>{$value->contentcleaned|strip_tags}</p>
</li> </li>
{/loop} {/loop}
<a href="{$c->route('news')}"> <a href="{$c->route('news')}">

View file

@ -37,6 +37,7 @@
{else} {else}
<span class="icon thumb color {$value->node|stringToColor}">{$value->node|firstLetterCapitalize}</span> <span class="icon thumb color {$value->node|stringToColor}">{$value->node|firstLetterCapitalize}</span>
{/if} {/if}
{if="$value->title != null"} {if="$value->title != null"}
<span>{$value->title}</span> <span>{$value->title}</span>
{else} {else}
@ -48,6 +49,7 @@
<i class="zmdi zmdi-account"></i> {$value->getContact()->getTrueName()} <i class="zmdi zmdi-account"></i> {$value->getContact()->getTrueName()}
</a> </a>
{else} {else}
{$value->origin} /
<a href="{$c->route('group', array($value->origin, $value->node))}"> <a href="{$c->route('group', array($value->origin, $value->node))}">
<i class="zmdi zmdi-pages"></i> {$value->node} <i class="zmdi zmdi-pages"></i> {$value->node}
</a> </a>

View file

@ -47,6 +47,7 @@
</a> </a>
{/if} {/if}
{if="$post->node != 'urn:xmpp:microblog:0'"} {if="$post->node != 'urn:xmpp:microblog:0'"}
{$post->origin} /
<a href="{$c->route('group', array($post->origin, $post->node))}"> <a href="{$c->route('group', array($post->origin, $post->node))}">
<i class="zmdi zmdi-pages"></i> {$post->node} <i class="zmdi zmdi-pages"></i> {$post->node}
</a> </a>
@ -58,7 +59,9 @@
</header> </header>
<section> <section>
{$post->contentcleaned} <content>
{$post->contentcleaned}
</content>
</section> </section>
<footer> <footer>
@ -127,7 +130,7 @@
</div> </div>
</form> </form>
<span class="icon gray"> <span class="icon gray">
<i class="zmdi zmdi-public"></i> <i class="zmdi zmdi-portable-wifi"></i>
</span> </span>
<span> <span>
<a target="_blank" href="{$c->route('blog', array($post->origin))}"> <a target="_blank" href="{$c->route('blog', array($post->origin))}">

View file

@ -28,6 +28,7 @@
{/if} {/if}
</span> </span>
<p> <p>
{$value->origin} /
<a href="{$c->route('group', array($value->origin, $value->node))}"> <a href="{$c->route('group', array($value->origin, $value->node))}">
<i class="zmdi zmdi-pages"></i> {$value->node} <i class="zmdi zmdi-pages"></i> {$value->node}
</a> </a>

View file

@ -144,6 +144,7 @@ class Publish extends WidgetBase
$p = new PostPublish; $p = new PostPublish;
$p->setFrom($this->user->getLogin()) $p->setFrom($this->user->getLogin())
->setTo($form->to->value) ->setTo($form->to->value)
->setContent($form->content->value)
->setNode($form->node->value); ->setNode($form->node->value);
//->setLocation($geo) //->setLocation($geo)
//->enableComments() //->enableComments()

View file

@ -25,23 +25,18 @@ class System extends WidgetBase {
$r = new Route; $r = new Route;
$this->view->assign('current_page', $r->find()); $this->view->assign('current_page', $r->find());
if(!isset($_SERVER['HTTP_MOD_REWRITE']) || !$_SERVER['HTTP_MOD_REWRITE']) if(!isset($_SERVER['HTTP_MOD_REWRITE']) || !$_SERVER['HTTP_MOD_REWRITE'])
$this->view->assign('page_key_uri', '?q='); $this->view->assign('page_key_uri', '?q=');
else else
$this->view->assign('page_key_uri', ''); $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')); $this->view->assign('secure_websocket', file_get_contents(CACHE_PATH.'websocket'));
// And we load some public values of the system configuration // And we load some public values of the system configuration
$cd = new \Modl\ConfigDAO(); $cd = new \Modl\ConfigDAO();
$config = $cd->get(); $config = $cd->get();
$public_conf = array( $public_conf = array(
'bosh_url' => $config->boshurl, 'bosh_url' => $config->boshurl,
'timezone' => $config->timezone 'timezone' => $config->timezone

View file

@ -3,7 +3,6 @@
var BASE_HOST = '{$base_host}'; var BASE_HOST = '{$base_host}';
var ERROR_URI = '{$error_uri}'; var ERROR_URI = '{$error_uri}';
var PAGE_KEY_URI = '{$page_key_uri}'; var PAGE_KEY_URI = '{$page_key_uri}';
var FAIL_SAFE = '{$fail_safe}';
var CURRENT_PAGE = '{$current_page}'; var CURRENT_PAGE = '{$current_page}';
var SERVER_CONF = {$server_conf}; var SERVER_CONF = {$server_conf};
var SECURE_WEBSOCKET= {$secure_websocket}; var SECURE_WEBSOCKET= {$secure_websocket};

View file

@ -9,7 +9,7 @@ use Monolog\Handler\SyslogHandler;
/** /**
* Error Handler... * Error Handler...
*/ */
function systemErrorHandler($errno, $errstr, $errfile, $errline, $errcontext = null) function systemErrorHandler($errno, $errstr, $errfile, $errline, $errcontext = null)
{ {
$log = new Logger('movim'); $log = new Logger('movim');
$log->pushHandler(new SyslogHandler('movim')); $log->pushHandler(new SyslogHandler('movim'));
@ -17,6 +17,29 @@ function systemErrorHandler($errno, $errstr, $errfile, $errline, $errcontext = n
return false; 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();
?>
<div style="font-family: Arial; text-align: center;">
<h2>Oops... something went wrong.</h2>
<p>But don't panic. The NSA is on the case.</p>
</div>
<?php
if (ob_get_contents()) ob_end_clean();
}
}
/** /**
* Manage boot order * Manage boot order
*/ */
@ -24,22 +47,22 @@ class Bootstrap {
function boot($light = false) { function boot($light = false) {
//define all needed constants //define all needed constants
$this->setConstants(); $this->setConstants();
mb_internal_encoding("UTF-8"); mb_internal_encoding("UTF-8");
//First thing to do, define error management (in case of error forward) //First thing to do, define error management (in case of error forward)
$this->setLogs(); $this->setLogs();
//Check if vital system need is OK //Check if vital system need is OK
$this->checkSystem(); $this->checkSystem();
if(!$light) $this->setBrowserSupport(); if(!$light) $this->setBrowserSupport();
$this->loadSystem(); $this->loadSystem();
$this->loadCommonLibraries(); $this->loadCommonLibraries();
$this->loadDispatcher(); $this->loadDispatcher();
$this->loadHelpers(); $this->loadHelpers();
$loadmodlsuccess = $this->loadModl(); $loadmodlsuccess = $this->loadModl();
$this->setTimezone(); $this->setTimezone();
@ -59,7 +82,7 @@ class Bootstrap {
DOCUMENT_ROOT.'/cache/test.tmp', DOCUMENT_ROOT.'/cache/test.tmp',
); );
$errors=array(); $errors=array();
if(!is_writable(DOCUMENT_ROOT)) if(!is_writable(DOCUMENT_ROOT))
$errors[] = 'We\'re unable to write to folder '.DOCUMENT_ROOT.': check rights'; $errors[] = 'We\'re unable to write to folder '.DOCUMENT_ROOT.': check rights';
else { else {
@ -78,12 +101,12 @@ class Bootstrap {
touch(DOCUMENT_ROOT.'/users/index.html'); touch(DOCUMENT_ROOT.'/users/index.html');
} }
} }
foreach($listWritableFile as $fileName) { foreach($listWritableFile as $fileName) {
if (!file_exists($fileName)) { if (!file_exists($fileName)) {
if (touch($fileName) !== true) { if (touch($fileName) !== true) {
$errors[] = 'We\'re unable to write to '.$fileName.': check rights'; $errors[] = 'We\'re unable to write to '.$fileName.': check rights';
} }
}else if (is_writable($fileName) !== true) { }else if (is_writable($fileName) !== true) {
$errors[] = 'We\'re unable to write to file '.$fileName.': check rights'; $errors[] = 'We\'re unable to write to file '.$fileName.': check rights';
} }
@ -111,9 +134,9 @@ class Bootstrap {
define('BASE_URI', $this->getBaseUri()); define('BASE_URI', $this->getBaseUri());
define('CACHE_URI', $this->getBaseUri() . 'cache/'); define('CACHE_URI', $this->getBaseUri() . 'cache/');
define('SESSION_ID', getenv('sid')); define('SESSION_ID', getenv('sid'));
define('THEMES_PATH', DOCUMENT_ROOT . '/themes/'); define('THEMES_PATH', DOCUMENT_ROOT . '/themes/');
define('USERS_PATH', DOCUMENT_ROOT . '/users/'); define('USERS_PATH', DOCUMENT_ROOT . '/users/');
define('APP_PATH', DOCUMENT_ROOT . '/app/'); define('APP_PATH', DOCUMENT_ROOT . '/app/');
@ -122,13 +145,13 @@ class Bootstrap {
define('LOCALES_PATH', DOCUMENT_ROOT . '/locales/'); define('LOCALES_PATH', DOCUMENT_ROOT . '/locales/');
define('CACHE_PATH', DOCUMENT_ROOT . '/cache/'); define('CACHE_PATH', DOCUMENT_ROOT . '/cache/');
define('LOG_PATH', DOCUMENT_ROOT . '/log/'); define('LOG_PATH', DOCUMENT_ROOT . '/log/');
define('VIEWS_PATH', DOCUMENT_ROOT . '/app/views/'); define('VIEWS_PATH', DOCUMENT_ROOT . '/app/views/');
define('HELPERS_PATH', DOCUMENT_ROOT . '/app/helpers/'); define('HELPERS_PATH', DOCUMENT_ROOT . '/app/helpers/');
define('WIDGETS_PATH', DOCUMENT_ROOT . '/app/widgets/'); define('WIDGETS_PATH', DOCUMENT_ROOT . '/app/widgets/');
define('MOVIM_API', 'https://api.movim.eu/'); define('MOVIM_API', 'https://api.movim.eu/');
if (!defined('DOCTYPE')) { if (!defined('DOCTYPE')) {
define('DOCTYPE','text/html'); define('DOCTYPE','text/html');
} }
@ -136,7 +159,7 @@ class Bootstrap {
private function isServerSecured() { private function isServerSecured() {
if(( if((
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "") isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "")
|| (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https")) { || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https")) {
return true; return true;
} }
@ -150,7 +173,7 @@ class Bootstrap {
return trim(fgets($f)); return trim(fgets($f));
} }
} }
private function getBaseUri() { private function getBaseUri() {
$dirname = dirname($_SERVER['PHP_SELF']); $dirname = dirname($_SERVER['PHP_SELF']);
$path = (($dirname == DIRECTORY_SEPARATOR) ? '' : $dirname).'/'; $path = (($dirname == DIRECTORY_SEPARATOR) ? '' : $dirname).'/';
@ -175,7 +198,7 @@ class Bootstrap {
return $uri; return $uri;
} }
} }
private function loadSystem() { private function loadSystem() {
// Loads up all system libraries. // Loads up all system libraries.
require_once(SYSTEM_PATH . "/i18n/i18n.php"); require_once(SYSTEM_PATH . "/i18n/i18n.php");
@ -186,16 +209,15 @@ class Bootstrap {
require_once(SYSTEM_PATH . "UtilsPicture.php"); require_once(SYSTEM_PATH . "UtilsPicture.php");
require_once(SYSTEM_PATH . "Cache.php"); require_once(SYSTEM_PATH . "Cache.php");
require_once(SYSTEM_PATH . "Event.php"); require_once(SYSTEM_PATH . "Event.php");
require_once(SYSTEM_PATH . "MovimException.php");
require_once(SYSTEM_PATH . "RPC.php"); require_once(SYSTEM_PATH . "RPC.php");
require_once(SYSTEM_PATH . "User.php"); require_once(SYSTEM_PATH . "User.php");
require_once(SYSTEM_PATH . "Picture.php"); require_once(SYSTEM_PATH . "Picture.php");
} }
private function loadCommonLibraries() { private function loadCommonLibraries() {
// XMPPtoForm lib // XMPPtoForm lib
require_once(LIB_PATH . "XMPPtoForm.php"); require_once(LIB_PATH . "XMPPtoForm.php");
// SDPtoJingle and JingletoSDP lib :) // SDPtoJingle and JingletoSDP lib :)
require_once(LIB_PATH . "SDPtoJingle.php"); require_once(LIB_PATH . "SDPtoJingle.php");
require_once(LIB_PATH . "JingletoSDP.php"); require_once(LIB_PATH . "JingletoSDP.php");
@ -206,7 +228,7 @@ class Bootstrap {
require $file; require $file;
} }
} }
private function loadDispatcher() { private function loadDispatcher() {
require_once(SYSTEM_PATH . "template/TplPageBuilder.php"); require_once(SYSTEM_PATH . "template/TplPageBuilder.php");
require_once(SYSTEM_PATH . "controllers/BaseController.php"); require_once(SYSTEM_PATH . "controllers/BaseController.php");
@ -232,7 +254,7 @@ class Bootstrap {
$cd = new \Modl\ConfigDAO(); $cd = new \Modl\ConfigDAO();
$config = $cd->get(); $config = $cd->get();
if($user->isLogged()) { if($user->isLogged()) {
$lang = $user->getConfig('language'); $lang = $user->getConfig('language');
if(isset($lang)) { if(isset($lang)) {
@ -249,41 +271,15 @@ class Bootstrap {
loadLanguage($config->locale); loadLanguage($config->locale);
} }
} }
private function setLogs() { private function setLogs() {
/*$cd = new \Modl\ConfigDAO(); ini_set('display_errors', 0);
$config = $cd->get(); ini_set('error_log', DOCUMENT_ROOT.'/log/php.log');
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');
}
set_error_handler('systemErrorHandler', E_ALL); set_error_handler('systemErrorHandler', E_ALL);
register_shutdown_function('fatalErrorShutdownHandler');
} }
private function setTimezone() { private function setTimezone() {
// We set the default timezone to the server timezone // We set the default timezone to the server timezone
$cd = new \Modl\ConfigDAO(); $cd = new \Modl\ConfigDAO();
@ -291,7 +287,7 @@ class Bootstrap {
// And we set a global offset // And we set a global offset
define('TIMEZONE_OFFSET', getTimezoneOffset($config->timezone)); define('TIMEZONE_OFFSET', getTimezoneOffset($config->timezone));
date_default_timezone_set($config->timezone); date_default_timezone_set($config->timezone);
} }
@ -307,7 +303,7 @@ class Bootstrap {
// We load Movim Data Layer // We load Movim Data Layer
$db = Modl\Modl::getInstance(); $db = Modl\Modl::getInstance();
$db->setModelsPath(APP_PATH.'models'); $db->setModelsPath(APP_PATH.'models');
Modl\Utils::loadModel('Config'); Modl\Utils::loadModel('Config');
Modl\Utils::loadModel('Presence'); Modl\Utils::loadModel('Presence');
Modl\Utils::loadModel('Contact'); Modl\Utils::loadModel('Contact');
@ -327,13 +323,13 @@ class Bootstrap {
} else { } else {
throw new MovimException('Cannot find config/db.inc.php file'); throw new MovimException('Cannot find config/db.inc.php file');
} }
$db->setConnectionArray($conf); $db->setConnectionArray($conf);
$db->connect(); $db->connect();
return true; return true;
} }
private function setBrowserSupport() { private function setBrowserSupport() {
if(isset( $_SERVER['HTTP_USER_AGENT'])) { if(isset( $_SERVER['HTTP_USER_AGENT'])) {
$useragent = $_SERVER['HTTP_USER_AGENT']; $useragent = $_SERVER['HTTP_USER_AGENT'];
@ -366,7 +362,7 @@ class Bootstrap {
switch($browser) { switch($browser) {
case 'Firefox': case 'Firefox':
if($browser_version > 3.5) if($browser_version > 30.0)
$compatible = true; $compatible = true;
break; break;
case 'IE': case 'IE':
@ -385,7 +381,7 @@ class Bootstrap {
define('BROWSER_COMP', $compatible); define('BROWSER_COMP', $compatible);
} }
private function startingSession() { private function startingSession() {
$s = \Sessionx::start(); $s = \Sessionx::start();
$s->load(); $s->load();

View file

@ -5,13 +5,13 @@ $conf = array(
# The type can be 'pgsql' or 'mysql' # The type can be 'pgsql' or 'mysql'
'type' => 'mysql', 'type' => 'mysql',
# The database username # The database username
'username' => 'yhuser', 'username' => 'username',
# The password # The password
'password' => 'yhpwd', 'password' => 'password',
# Where can we find the database ? # Where can we find the database ?
'host' => 'localhost', 'host' => 'localhost',
# The port number, 3306 for MySQL and 5432 for PostGreSQL # The port number, 3306 for MySQL and 5432 for PostGreSQL
'port' => 3306, 'port' => 3306,
# The database name # The database name
'database' => 'yhdb' 'database' => 'movim'
); );

View file

@ -30,7 +30,7 @@ if($argsize == 2) {
} }
$md = Modl\Modl::getInstance(); $md = Modl\Modl::getInstance();
$infos = $md->check(); $infos = $md->check();
if($infos != null) { if($infos != null) {
echo colorize("The database need to be updated before running the daemon\n", 'green'); 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("\nTo update the database run\n", 'green');
echo colorize("php mud.php db set\n", 'purple'); echo colorize("php mud.php db set\n", 'purple');
exit;
break; break;
} }

View file

@ -40,52 +40,13 @@
define('DOCUMENT_ROOT', dirname(__FILE__)); define('DOCUMENT_ROOT', dirname(__FILE__));
require_once(DOCUMENT_ROOT.'/bootstrap.php'); require_once(DOCUMENT_ROOT.'/bootstrap.php');
use Monolog\Logger; $bootstrap = new Bootstrap();
use Monolog\Handler\SyslogHandler;
try { $bootstrap->boot();
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();
$rqst = new FrontController(); $rqst = new FrontController();
$rqst->handle(); $rqst->handle();
WidgetWrapper::getInstance(false); WidgetWrapper::getInstance(false);
// Closing stuff // Closing stuff
WidgetWrapper::destroyInstance(); WidgetWrapper::destroyInstance();
} catch (Exception $e) {
$log = new Logger('movim');
$log->pushHandler(new SyslogHandler('movim'));
$log->addInfo($e->getMessage());
if (ENVIRONMENT === 'development' && !FAIL_SAFE) {
?>
<div id="final_exception" class="error debug">
<h2>An error happened</h2>
<p><?php print $e->getMessage();?></p>
</div>
<?php
} elseif(!FAIL_SAFE) {
?>
<div class="carreful">
<h2> Oops... something went wrong.</h2>
<p>But don't panic. The NSA is on the case.</p>
</div>
<?php
}
if(FAIL_SAFE) {
$r = new Route;
$rqst = new FrontController();
$rqst->handle();
}
}

View file

@ -50,9 +50,13 @@ $stdin_behaviour = function ($data) use (&$conn, $loop, &$buffer, &$connector, &
$cd = new \Modl\ConfigDAO(); $cd = new \Modl\ConfigDAO();
$config = $cd->get(); $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"); #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 { } else {
return; return;

View file

@ -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 />';
}
}
?>

View file

@ -1,8 +1,8 @@
<?php <?php
class Route extends \BaseController { class Route extends \BaseController {
public $_routes; public $_routes;
private $_page; private $_page;
public function __construct() { public function __construct() {
$this->_routes = array( $this->_routes = array(
'about' => array('x'), 'about' => array('x'),
@ -29,7 +29,7 @@ class Route extends \BaseController {
'visio' => false 'visio' => false
); );
} }
public function find() { public function find() {
$cd = new \Modl\ConfigDAO(); $cd = new \Modl\ConfigDAO();
$config = $cd->get(); $config = $cd->get();
@ -43,13 +43,13 @@ class Route extends \BaseController {
if(isset($this->_routes[$this->_page])) if(isset($this->_routes[$this->_page]))
$route = $this->_routes[$this->_page]; $route = $this->_routes[$this->_page];
if(count($request) && isset($route)) { if(count($request) && isset($route)) {
$i = 0; $i = 0;
foreach($route as $key) { foreach($route as $key) {
if (isset($request[$i])) { if (isset($request[$i])) {
$_GET[$key] = $request[$i]; $_GET[$key] = $request[$i];
} }
$i++; $i++;
} }
} }
@ -65,7 +65,7 @@ class Route extends \BaseController {
return $this->_page; return $this->_page;
} }
public static function urlize($page, $params = false, $tab = false) { public static function urlize($page, $params = false, $tab = false) {
$r = new Route(); $r = new Route();
$routes = $r->_routes; $routes = $r->_routes;
@ -75,8 +75,8 @@ class Route extends \BaseController {
if($page === 'root') if($page === 'root')
return BASE_URI; return BASE_URI;
if(isset($routes[$page])) { if(isset($routes[$page])) {
//if($params != false && count($routes[$page]) != count($params)) { //if($params != false && count($routes[$page]) != count($params)) {
//throw new Exception(__('error.route', $page)); //throw new Exception(__('error.route', $page));
//} else { //} else {
@ -84,8 +84,8 @@ class Route extends \BaseController {
$tab = '#'.$tab; $tab = '#'.$tab;
// Here we got a beautiful rewriten URL ! // Here we got a beautiful rewriten URL !
if($config->rewrite == true if($config->rewrite == true
&& isset($_SERVER['HTTP_MOD_REWRITE']) /*&& isset($_SERVER['HTTP_MOD_REWRITE'])
&& $_SERVER['HTTP_MOD_REWRITE']) { && $_SERVER['HTTP_MOD_REWRITE']*/) {
$uri = BASE_URI . $page; $uri = BASE_URI . $page;
if($params != false && is_array($params)) if($params != false && is_array($params))
foreach($params as $value) foreach($params as $value)
@ -96,7 +96,7 @@ class Route extends \BaseController {
//We construct a classic URL if the rewriting is disabled //We construct a classic URL if the rewriting is disabled
else { else {
$uri = BASE_URI . '?q=' . $page; $uri = BASE_URI . '?q=' . $page;
if($params != false && is_array($params)) { if($params != false && is_array($params)) {
$i = 0; $i = 0;
foreach($params as $value) { foreach($params as $value) {

View file

@ -21,7 +21,7 @@ class Sessionx {
protected static $_instance; protected static $_instance;
private $_max_age = 86400; // 24hour private $_max_age = 86400; // 24hour
private $_timestamp; private $_timestamp;
private $_rid; private $_rid;
private $_id; private $_id;
@ -49,8 +49,8 @@ class Sessionx {
self::$_sessionid = $_COOKIE['MOVIM_SESSION_ID']; self::$_sessionid = $_COOKIE['MOVIM_SESSION_ID'];
} elseif(SESSION_ID) { } elseif(SESSION_ID) {
self::$_sessionid = SESSION_ID; self::$_sessionid = SESSION_ID;
} else { } elseif(!headers_sent()) {
$key = generateKey(32); $key = generateKey(32);
setcookie("MOVIM_SESSION_ID", $key, time()+$this->_max_age, '/', false, APP_SECURED); setcookie("MOVIM_SESSION_ID", $key, time()+$this->_max_age, '/', false, APP_SECURED);
self::$_sessionid = $key; self::$_sessionid = $key;
} }
@ -85,11 +85,11 @@ class Sessionx {
$s->rid = $this->_rid; $s->rid = $this->_rid;
$s->sid = $this->_sid; $s->sid = $this->_sid;
$s->id = $this->_id; $s->id = $this->_id;
$s->port = $this->_port; $s->port = $this->_port;
$s->host = $this->_host; $s->host = $this->_host;
$s->domain = $this->_domain; $s->domain = $this->_domain;
$s->config = serialize($this->_config); $s->config = serialize($this->_config);
$s->active = $this->_active; $s->active = $this->_active;
$s->start = $this->_start; $s->start = $this->_start;
$s->timestamp = $this->_timestamp; $s->timestamp = $this->_timestamp;
$s->mechanism = $this->_mechanism; $s->mechanism = $this->_mechanism;
@ -104,10 +104,10 @@ class Sessionx {
$this->_password = $pass; $this->_password = $pass;
$this->_resource = 'moxl'.\generateKey(6); $this->_resource = 'moxl'.\generateKey(6);
$this->_start = date(DATE_ISO8601); $this->_start = date(DATE_ISO8601);
$this->_rid = rand(1, 2048); $this->_rid = rand(1, 2048);
$this->_id = 0; $this->_id = 0;
$sd = new modl\SessionxDAO(); $sd = new modl\SessionxDAO();
$s = $this->inject(); $s = $this->inject();
$sd->init($s); $sd->init($s);
@ -116,7 +116,7 @@ class Sessionx {
public function load() { public function load() {
$sd = new modl\SessionxDAO(); $sd = new modl\SessionxDAO();
$session = $sd->get(self::$_sessionid); $session = $sd->get(self::$_sessionid);
if(isset($session)) { if(isset($session)) {
$this->_user = $session->username; $this->_user = $session->username;
$this->_password = $session->password; $this->_password = $session->password;

View file

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

View file

@ -290,7 +290,6 @@ input[type=button].flat:focus {
position: fixed; position: fixed;
bottom: 2rem; bottom: 2rem;
right: 2rem; right: 2rem;
border-radius: 10rem;
min-height: 0rem; min-height: 0rem;
min-width: 0rem; min-width: 0rem;
line-height: 7rem; line-height: 7rem;
@ -298,19 +297,33 @@ input[type=button].flat:focus {
width: 7rem; width: 7rem;
z-index: 1; z-index: 1;
font-size: 3.5rem; 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); 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 { .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%); background-image: linear-gradient(to bottom, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.1) 100%);
} }
/*
.button.action:active { .button.action:active {
transform: scale(0.95); transform: scale(0.95);
background-image: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.1) 100%); 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 { li.action div.action .button {
margin: 0.5rem; margin: 0.5rem;
@ -329,3 +342,34 @@ header.big ~ .button.action {
right: calc(70% + 3rem); 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;
}