diff --git a/app/assets/js/movimrpc.js b/app/assets/js/movimrpc.js
index bf62a6aaf..c51533d00 100644
--- a/app/assets/js/movimrpc.js
+++ b/app/assets/js/movimrpc.js
@@ -110,8 +110,13 @@ function MovimRPC()
this.commit = function()
{
movim_xmlhttp = this.make_xmlhttp();
+
+ if(FAIL_SAFE)
+ var fail_safe = '?fail_safe=1';
+ else
+ var fail_safe = '';
- movim_xmlhttp.open('POST', BASE_URI+'jajax.php', true);
+ movim_xmlhttp.open('POST', BASE_URI+'jajax.php'+fail_safe, true);
var handler = this.handle_rpc_json;
diff --git a/app/models/node/Node.php b/app/models/node/Node.php
index 497a97824..da82cb6df 100644
--- a/app/models/node/Node.php
+++ b/app/models/node/Node.php
@@ -9,6 +9,7 @@ class Node extends ModlModel {
public $config;
public $updated;
public $subscription;
+ public $num;
public function __construct() {
$this->_struct = "
diff --git a/app/models/node/NodeDAO.php b/app/models/node/NodeDAO.php
index 46040dddc..160e21adb 100644
--- a/app/models/node/NodeDAO.php
+++ b/app/models/node/NodeDAO.php
@@ -98,6 +98,12 @@ class NodeDAO extends ModlSQL {
left outer join (select server, node, subscription from subscription where jid = :nodeid)
as s on s.server = node.serverid
and s.node = node.nodeid
+ left outer join (select node, count(node) as num from (
+ select session, node, nodeid from postn
+ where session = :nodeid
+ group by nodeid, node, session
+ order by node) as f group by node)
+ as c on c.node = node.nodeid
where serverid= :serverid
order by node.title, nodeid';
@@ -114,13 +120,6 @@ class NodeDAO extends ModlSQL {
}
function deleteNodes($serverid) {
- /*$serverid = $this->_db->real_escape_string($serverid);
- $sql = '
- delete from Node
- where serverid=\''.$serverid.'\' ';
-
- return $this->_db->query($sql); */
-
$this->_sql = '
delete from node
where serverid= :serverid';
@@ -136,15 +135,6 @@ class NodeDAO extends ModlSQL {
}
function deleteNode($serverid, $nodeid) {
- /*$serverid = $this->_db->real_escape_string($serverid);
- $nodeid = $this->_db->real_escape_string($nodeid);
- $sql = '
- delete from Node
- where serverid=\''.$serverid.'\' and
- nodeid=\''.$nodeid.'\'';
-
- return $this->_db->query($sql); */
-
$this->_sql = '
delete from node
where serverid = :serverid
@@ -162,13 +152,6 @@ class NodeDAO extends ModlSQL {
}
function getNode($serverid, $nodeid) {
- /*$sql = '
- select * from Node
- where nodeid = \''.$nodeid.'\'
- and serverid = \''.$serverid.'\'';
-
- return $this->mapper('Node', $this->_db->query($sql), 'item');*/
-
$this->_sql = '
select * from node
where
diff --git a/app/widgets/Admin/Admin.php b/app/widgets/Admin/Admin.php
index 2f346919e..0bd9199e6 100644
--- a/app/widgets/Admin/Admin.php
+++ b/app/widgets/Admin/Admin.php
@@ -157,6 +157,13 @@ class Admin extends WidgetBase {
\system\Conf::saveConfFile($this->_conf);
}
+ public function ajaxUpdateDatabase()
+ {
+ $md = \modl\Modl::getInstance();
+ $md->check(true);
+ RPC::call('movim_reload_this');
+ }
+
public function ajaxRecreateDatabase()
{
$pd = new \modl\PostnDAO();
@@ -200,16 +207,13 @@ class Admin extends WidgetBase {
$this->createDirs();
$submit = $this->genCallAjax('ajaxAdminSubmit', "movim_parse_form('admin')")
- ."this.className='button color orange icon loading'; setTimeout(function() {location.reload(false)}, 2000);";
+ ."this.className='button color orange icon loading'; setTimeout(function() {location.reload(false)}, 1000);";
$this->_validatebutton = '
'.t('Submit').'';
$html = '
- ';
-
+ $errors = '';
+
+ $dbview->assign('infos', $infos);
+ $dbview->assign('db_update', $this->genCallAjax('ajaxUpdateDatabase')
+ ."this.className='button color orange icon loading'; setTimeout(function() {location.reload(false)}, 1000);");
+ try {
+ $md->connect();
+ } catch(Exception $e) {
+ $errors = $e->getMessage();
+ }
+
+ $dbview->assign('connected', $md->_connected);
+ $dbview->assign('validatebutton', $this->_validatebutton);
+ $dbview->assign('conf', $this->_conf);
+ $dbview->assign('supported_db', $md->getSupportedDatabases());
+ $dbview->assign('errors', $errors);
+ $html = $dbview->draw('_admin_db', true);
+
return $html;
}
function build()
{
?>
+
+
+
+
+ {if="!$connected"}
+
+ {$c->t("Modl wasn't able to connect to the database")}
+
+
+ {$errors}
+
+ {else}
+
+ {$c->t('Movim is connected to the database')}
+
+ {if="$infos != null"}
+ {$c->t('The database need to be updated')}
+
+ {else}
+
+ {$c->t('Movim database is up to date')}
+
+ {/if}
+ {/if}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{$validatebutton}
diff --git a/app/widgets/ServerNodes/ServerNodes.php b/app/widgets/ServerNodes/ServerNodes.php
index 688948d5e..df56f4b11 100644
--- a/app/widgets/ServerNodes/ServerNodes.php
+++ b/app/widgets/ServerNodes/ServerNodes.php
@@ -121,15 +121,19 @@ class ServerNodes extends WidgetCommon
else
$name = $n->nodeid;
- $tag = '';
+ $tags = '';
+
+ if($n->num != null)
+ $tags .= ''.$n->num.'';
+
if($n->subscription == 'subscribed')
- $tag .= ''.t('Subscribed').'';
+ $tags .= ''.t('Subscribed').'';
$html .= '
'.
$name.
- $tag.'
+ $tags.'
';
}
diff --git a/app/widgets/Tabs/tabs.css b/app/widgets/Tabs/tabs.css
index 58088489f..ed929992a 100644
--- a/app/widgets/Tabs/tabs.css
+++ b/app/widgets/Tabs/tabs.css
@@ -11,13 +11,13 @@
#navtabs li {
display: inline-block;
cursor: pointer;
- line-height: 3em;
+
padding: 0em 2em;
white-space: nowrap;
}
#navtabs li a{
display: block;
- height:100%;
+ line-height: 3em;
width:100%;
color: white;
text-decoration: none;
diff --git a/app/widgets/Vcard/Vcard.php b/app/widgets/Vcard/Vcard.php
index f059cd33d..e27429225 100644
--- a/app/widgets/Vcard/Vcard.php
+++ b/app/widgets/Vcard/Vcard.php
@@ -84,8 +84,9 @@ class Vcard extends WidgetBase
$c->photobin = $vcard->photobin->value;
$c->description = trim($vcard->desc->value);
-
- if($vcard->privacy->value == 1)
+ \movim_log('LOOOOOL');
+ \movim_log($vcard->privacy);
+ if($vcard->privacy->value == true)
\modl\Privacy::set($c->jid, 1);
else
\modl\Privacy::set($c->jid, 0);
@@ -326,8 +327,8 @@ class Vcard extends WidgetBase
-
-
+
+
';
diff --git a/bootstrap.php b/bootstrap.php
index 92485ab6e..3353104a5 100644
--- a/bootstrap.php
+++ b/bootstrap.php
@@ -237,9 +237,7 @@ class Bootstrap {
$db->setConnectionArray(\System\Conf::getServerConf());
$db->connect();
-
- //$db->check();
-
+
return true;
}
diff --git a/index.php b/index.php
index 78339cef1..bc47d096e 100644
--- a/index.php
+++ b/index.php
@@ -41,6 +41,13 @@ define('DOCUMENT_ROOT', dirname(__FILE__));
require_once(DOCUMENT_ROOT.'/bootstrap.php');
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();
@@ -55,15 +62,15 @@ try {
} catch (Exception $e) {
//manage errors
\system\Logs\Logger::displayDebugCSS();
- if (ENVIRONMENT === 'development') {
-
+
+ if (ENVIRONMENT === 'development' && !FAIL_SAFE) {
?>
An error happened
getMessage();?>
Oops... something went wrong.
@@ -72,7 +79,7 @@ try {
handle();
}
diff --git a/jajax.php b/jajax.php
index 123e762be..84cb3c057 100644
--- a/jajax.php
+++ b/jajax.php
@@ -33,6 +33,11 @@ try {
// Closing stuff
WidgetWrapper::destroyInstance();
} catch(\Exception $e) {
+ if(isset($_GET['fail_safe']) && (int)$_GET['fail_safe']) {
+ $rpc = new RPC();
+ $rpc->handle_json();
+ }
+
print $e->getMessage();
}
?>
diff --git a/system/Conf.php b/system/Conf.php
index 050158b94..ed00b9410 100644
--- a/system/Conf.php
+++ b/system/Conf.php
@@ -35,7 +35,7 @@ class Conf
'defLang' => 'en',
'maxUsers' => -1,
'logLevel' => 7,
- 'timezone' => getLocalTimezone(),
+ 'timezone' => 'Etc/GMT',
'dbType' => 'mysql',
'dbUsername'=> 'username',
'dbPassword'=> 'password',
@@ -77,7 +77,6 @@ class Conf
}
static function saveConfFile($conf = array()) {
- movim_log($conf);
$doc = new \DOMDocument('1.0', 'UTF-8');
$doc->formatOutput = true;
diff --git a/system/Session.php b/system/Session.php
index 2bbb0dd49..8bbcc3c36 100644
--- a/system/Session.php
+++ b/system/Session.php
@@ -36,8 +36,6 @@ class Session
protected function __construct($name)
{
// Does the database exist?
- //$var = new SessionVar();
-
if(self::$sid == null) {
if(isset($_COOKIE['PHPFASTSESSID'])) {
self::$sid = $_COOKIE['PHPFASTSESSID'];
diff --git a/system/widget/WidgetWrapper.php b/system/widget/WidgetWrapper.php
index c576a7a6c..178c6504d 100644
--- a/system/widget/WidgetWrapper.php
+++ b/system/widget/WidgetWrapper.php
@@ -41,24 +41,28 @@ class WidgetWrapper
private function __construct($register)
{
$this->register_widgets = $register;
- $sess = Session::start(APP_NAME);
- $widgets = $sess->get('loaded_widgets');
- if(is_array($widgets)) {
- $this->loaded_widgets_old = $widgets;
- }
-
- $this->registered_events = $sess->get('registered_events');
-
- // We search all the existent widgets
- $this->all_widgets = array();
-
- $widgets_dir = scandir(APP_PATH ."widgets/");
- foreach($widgets_dir as $widget_dir) {
- if(is_dir(APP_PATH ."widgets/".$widget_dir) &&
- $widget_dir != '..' &&
- $widget_dir != '.')
- array_push($this->all_widgets, $widget_dir);
+ $md = \modl\Modl::getInstance();
+ if($md->_connected) {
+ $sess = Session::start(APP_NAME);
+ $widgets = $sess->get('loaded_widgets');
+
+ if(is_array($widgets)) {
+ $this->loaded_widgets_old = $widgets;
+ }
+
+ $this->registered_events = $sess->get('registered_events');
+
+ // We search all the existent widgets
+ $this->all_widgets = array();
+
+ $widgets_dir = scandir(APP_PATH ."widgets/");
+ foreach($widgets_dir as $widget_dir) {
+ if(is_dir(APP_PATH ."widgets/".$widget_dir) &&
+ $widget_dir != '..' &&
+ $widget_dir != '.')
+ array_push($this->all_widgets, $widget_dir);
+ }
}
}
diff --git a/themes/movim/css/style.css b/themes/movim/css/style.css
index 3662a2cdc..057038956 100644
--- a/themes/movim/css/style.css
+++ b/themes/movim/css/style.css
@@ -619,7 +619,8 @@ ul.list li a.action:hover {
ul.list li span.tag {
background-color: #555;
- padding: 0 1em;
+ padding: 0 0.5em;
+ margin-left: 1em;
color: white;
display: inline-block;
min-width: 3em;
diff --git a/themes/movim/page.tpl b/themes/movim/page.tpl
index 8ceeae1b9..c06fb0c68 100644
--- a/themes/movim/page.tpl
+++ b/themes/movim/page.tpl
@@ -16,7 +16,8 @@
var ERROR_URI = '';
var PAGE_KEY_URI = ''
+ echo '?q='; ?>';
+ var FAIL_SAFE = ;
addCss('css/animations.css');