private static function create_new_token($username) { try { $token = users::generateRandomString(); $dbObj = new dbAPI(); $query = "UPDATE users SET TOKEN = '" . $token . "' where USERNAME = '******'"; $results = $dbObj->run_query($dbObj->db_get_usersDB(), $query); if ($results) { echo $results; return $token; } debugLog::debug_log("create token for user: "******" has failed"); return null; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } }
public static function log($message) { debugLog::debug_log($message); }
public static function add_translation_to_term_meaning($meaning_UID, $text, $lang, $user) { // check if a term meaning exists if (term::get_term_meaning_by_UID($meaning_UID) == null) { debugLog::debug_log("could not locate the term meaning '" . $meaning_UID . "'"); return null; } // check if the same translation exists if (term::get_term_meaning_by_UID($meaning_UID, $lang) != null) { debugLog::debug_log("adding translation to term meaning ('" . $meaning_UID . "') with already existing language ('" . $lang . "') is prohibited"); return null; } $dbObj = new dbAPI(); // add record to database $query = "INSERT INTO TERM_MEAN (UID, TEXT, LANG, ENABLED, USER_ID, CREATION_DATE) VALUES (" . $meaning_UID . ", '" . $text . "', '" . $lang . "', 1, " . $user . ",'" . date("Y-m-d H:i:s") . "')"; $dbObj->run_query($dbObj->db_get_contentDB(), $query); // returns an entity of recently added scope return term::get_term_meaning_by_UID($meaning_UID, $lang); }
public function disable_revision($database_name, $table_name, $whereSttmnt) { $query = "UPDATE " . $table_name . " SET ENABLED = 0 WHERE " . $whereSttmnt . " "; $results = $this->run_query($database_name, $query); if ($results) { // on success return true; } debugLog::debug_log("[disable_revision]: could not disbale rivision. [query]: <br>" . $query . "<hr>"); return false; }