public function addServerNotification($pNotification, $forceReload = true) { if ($pNotification instanceof Notification) { require_once dirname(__FILE__) . '/DatabaseManager.php'; $pNotification->setServerMessage(TRUE); $databaseManager = new DatabaseManager(); $databaseManager->openTable('user_permissions', json_decode(DatabaseManager::$table3)); $notifications = $databaseManager->getValues(array("server_notify" => array("operator" => "=", "value" => "1"))); if (!empty($notifications) && is_array($notifications)) { foreach ($notifications as $user) { $userId = $user['userid']; $this->addNotification($pNotification, $userId, false); // reload will be called later } } if ($forceReload) { $this->forceReload(); } } }
public function getJwtInfoBySignature($signature, $userid) { $databaseAuthtokens = new DatabaseManager(); $json = json_decode(DatabaseManager::$table11); $databaseAuthtokens->openTable("jwt", $json); $arrayToken['user'] = array('operator' => '=', 'value' => $userid, 'type' => 'i'); $arrayToken['signature'] = array('operator' => '=', 'value' => $signature, 'type' => 's'); $resultToken1 = $databaseAuthtokens->getValues($arrayToken, 1); return $resultToken1; }
function getSimpleStorage($name, $default = "", $device = TRUE, $timestamp = FALSE) { global $loginManager; $databaseManager = new DatabaseManager(); $databaseManager->openTable("plugin_settings", DatabaseManager::$table8); $pluginId = $this->getPluginName(); $authtoken = $loginManager->getAuthtoken(); $where = array("name" => array("value" => $name), "plugin" => array("value" => $pluginId)); if ($device) { $where["authtoken"] = array("value" => $authtoken); } $result = $databaseManager->getValues($where, 1); if (!empty($result) && !empty($result['value'])) { return $result['value']; } return $default; }