From 2cb1563f63386b35a69e460051aa9b4a2851d104 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Wed, 30 May 2012 07:30:44 -0400
Subject: [PATCH] - Added (clickable) placeholders to client messaging function. - Added check so that the client password isn't inserted into the message (for security reasons).

---
 server/server.php |   39 +++++++++++++++++++--------------------
 1 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/server/server.php b/server/server.php
index 5e27cb5..3683f19 100644
--- a/server/server.php
+++ b/server/server.php
@@ -40,7 +40,7 @@
 /*
  * Try to Load the server configuration from the master-db
  */
-if ($app->dbmaster->connect()) {
+if ($app->dbmaster->connect_error == NULL) {
 	$server_db_record = $app->dbmaster->queryOneRecord("SELECT * FROM server WHERE server_id = " . $conf['server_id']);
 
 	$conf['last_datalog_id'] = (int) $server_db_record['updated'];
@@ -133,7 +133,7 @@
 /*
  * Next we try to process the datalog
  */
-if ($app->db->connect() && $app->dbmaster->connect()) {
+if ($app->db->connect_error == NULL && $app->dbmaster->connect_error == NULL) {
 
 	// Check if there is anything to update
 	if ($conf['mirror_server_id'] > 0) {
@@ -144,29 +144,28 @@
 
 	$tmp_num_records = $tmp_rec['number'];
 	unset($tmp_rec);
-
+	
+	//** Load required base-classes
+	$app->uses('modules,plugins,file,services');
+	//** Load the modules that are in the mods-enabled folder
+	$app->modules->loadModules('all');
+	//** Load the plugins that are in the plugins-enabled folder
+	$app->plugins->loadPlugins('all');
 	if ($tmp_num_records > 0) {
-		/*
-		  There is something to do, triggert by the database -> do it!
-		 */
-		// Write the Log
 		$app->log("Found $tmp_num_records changes, starting update process.", LOGLEVEL_DEBUG);
-		// Load required base-classes
-		$app->uses('modules,plugins,file,services');
-		// Load the modules that are in the mods-enabled folder
-		$app->modules->loadModules('all');
-		// Load the plugins that are in the plugins-enabled folder
-		$app->plugins->loadPlugins('all');
-		// Go through the sys_datalog table and call the processing functions
-		// from the modules that are hooked on to the table actions
+		//** Go through the sys_datalog table and call the processing functions
+		//** from the modules that are hooked on to the table actions
 		$app->modules->processDatalog();
-		// Restart services that need to after configuration
-		$app->services->processDelayedActions();
-		// All modules are already loaded and processed, so there is NO NEED to load the core once again...
-		$needStartCore = false;
 	}
+	//** Process actions from sys_remoteaction table
+	$app->modules->processActions();
+	//** Restart services that need to after configuration
+	$app->services->processDelayedActions();
+	//** All modules are already loaded and processed, so there is NO NEED to load the core once again...
+	$needStartCore = false;
+	
 } else {
-	if (!$app->db->connect()) {
+	if ($app->db->connect->connect_error == NULL) {
 		$app->log('Unable to connect to local server.' . $app->db->errorMessage, LOGLEVEL_WARN);
 	} else {
 		$app->log('Unable to connect to master server.' . $app->dbmaster->errorMessage, LOGLEVEL_WARN);

--
Gitblit v1.9.1