public function errorHandler($errno, $errstr, $errfile = "", $errline = "", $errcontext = "") { $message = "errno:" . $errno . " errstr:" . $errstr . " errfile:" . $errfile . " errline:" . $errline . " errcontext:" . json_encode($errcontext) . " Backtrace: " . clm_core::getBacktrace(); switch ($errno) { case E_USER_ERROR: $this->addError("E_USER_ERROR", $message); break; case E_ERROR: $this->addError("E_ERROR", $message); break; case E_USER_WARNING: $this->addWarning("E_USER_WARNING", $message); break; case E_WARNING: $this->addWarning("E_WARNING", $message); break; case E_USER_NOTICE: $this->addNotice("E_USER_NOTICE", $message); break; case E_NOTICE: $this->addNotice("E_NOTICE", $message); break; default: $this->addUnknown("Unknown", $message); break; } // Normales Handling bleibt aktiv return false; }
function clm_api_db_season_enable($id = -1) { $id = clm_core::$load->make_valid($id, 0, -1); // Nur Saisons mit einer gültigen ID und die geändert oder neu ist, kann aktiviert werden. if ($id != -1 && (clm_core::$db->saison->get($id)->isChange() || !clm_core::$db->saison->get($id)->isNew())) { // Aktiviere die gewählte Saison clm_core::$db->saison->get($id)->published = 1; clm_core::$db->saison->get($id)->archiv = 0; clm_core::$db->saison->write(); // Schreibe die Änderungen // Archive alle anderen die bisher aktiv waren $sql = "UPDATE #__clm_saison SET archiv=1 WHERE published=1 AND archiv=0 AND id!=" . $id; clm_core::$db->query($sql); if (clm_core::$db->saison->get($id)->isNew() && clm_core::$access->getId() != -1) { // Kopiere den aktuellen Benutzer in die neue Saison $user = clm_core::$db->user->get(clm_core::$access->getId()); $sql = "REPLACE INTO #__clm_user " . " (`sid`, `jid`, `name`, `username` ,`aktive` ,`email` ,`tel_fest` " . " ,`tel_mobil`, `usertype`, `zps`, `mglnr` " . " ,`mannschaft`, `published`, `bemerkungen`, `bem_int` ) " . ' VALUES ( ' . $id . ', ' . clm_core::$db->escape($user->jid) . ',"' . clm_core::$db->escape($user->name) . '", "' . clm_core::$db->escape($user->username) . '", 1, "' . clm_core::$db->escape($user->email) . '", "' . clm_core::$db->escape($user->tel_fest) . '" ' . ' ,"' . clm_core::$db->escape($user->tel_mobil) . '", "admin", "' . clm_core::$db->escape($user->zps) . '", "' . clm_core::$db->escape($user->mglnr) . '" ' . ' , 0, 1, "' . clm_core::$db->escape($user->bemerkungen) . '", "' . clm_core::$db->escape($user->bem_int) . '" )'; } else { $data = clm_core::$cms->getUserData(); // Aktualisiere einen alten Benutzer oder Erstelle einen neuen in der aktuellen Saison $sql = "REPLACE INTO #__clm_user " . " (`sid`, `jid`, `username`, `name`, `usertype`,`aktive`,`published`, `email`) " . ' VALUES ( ' . $id . ', ' . clm_core::$db->escape(clm_core::$access->getJid()) . ', "' . clm_core::$db->escape(clm_core::$access->getUsername()) . '", "' . clm_core::$db->escape(clm_core::$access->getName()) . '", "admin",1,1, "' . clm_core::$db->escape($data[3]) . '")'; } clm_core::$db->query($sql); clm_core::$access = new clm_class_access(); return array(true, "m_enableSeasonSuccess"); } else { return array(false, "e_noSeasonToEnable"); } }
public function query($query) { if (!($result = $this->db[0]->query(clm_core::$load->db_add_prefix($query, $this->db[1])))) { clm_core::addError("sql invalid", $query . " (" . $this->db[0]->error . ")" . " Backtrace: " . clm_core::getBacktrace()); } else { return $result; } }
function clm_function_load_css($css) { $path = clm_core::$path . DS . "css" . DS . $css . '.php'; if (file_exists($path)) { require_once $path; } else { clm_core::addWarning("css missing", $path . " (" . $css . ")" . " Backtrace: " . clm_core::getBacktrace()); } }
function clm_function_load_view($view, $args, $div = true) { clm_core::$load->load_css("reset"); if (!function_exists("clm_view_" . $view)) { $path = clm_core::$path . DS . "views" . DS . $view . '.php'; if (file_exists($path)) { require_once $path; } else { clm_core::addError("view missing", $path . " (" . $view . ")" . " Backtrace: " . clm_core::getBacktrace()); } } ob_start(); $out[0] = call_user_func_array("clm_view_" . $view, $args); if ($div) { $out[1] = '<div class="clm_view_' . $view . '">' . ob_get_contents() . "</div>"; } else { $out[1] = ob_get_contents(); } ob_end_clean(); return $out; }
/** * log schreiben */ function write() { clm_core::addDeprecated($this->aktion, json_encode($this->params)); }
public function logout() { clm_core::$access = new clm_class_access(); return true; }
public static function shutdown() { $error = error_get_last(); if ($error["type"] == E_ERROR) { clm_core::errorHandler($error["type"], $error["message"], $error["file"], $error["line"]); } restore_error_handler(); restore_exception_handler(); }
private static function log($api, $args, $output) { // Verhindert das Einbinden und Durchsuchen der Log Datei falls nicht notwendig (optional) if (isset(clm_core::$log)) { return; } // Einbinden der Liste der zu loggenden APIs if (is_null(self::$logs)) { $path = clm_core::$path . DS . "includes" . DS . 'logs.php'; require $path; self::$logs = $logs; } // Loggen? if (in_array($api, self::$logs)) { clm_core::addInfo($api, json_encode(array("input" => $args, "output" => $output))); } return; }
function clm_api_db_season_save($id = -1, $published = null, $archiv = null, $name = null, $bemerkungen = null, $bem_int = null, $datum = null) { $id = clm_core::$load->make_valid($id, 0, -1); // Eine bereits bestehende Saison wird bearbeitet if ($id != -1 && !clm_core::$db->saison->get($id)->isNew()) { if (is_null($published)) { $published = clm_core::$db->saison->get($id)->published; } if (is_null($archiv)) { $archiv = clm_core::$db->saison->get($id)->archiv; } if (is_null($name)) { $name = clm_core::$db->saison->get($id)->name; } if (is_null($bemerkungen)) { $bemerkungen = clm_core::$db->saison->get($id)->bemerkungen; } if (is_null($bem_int)) { $bem_int = clm_core::$db->saison->get($id)->bem_int; } if (is_null($datum)) { $datum = clm_core::$db->saison->get($id)->datum; } } $published = clm_core::$load->make_valid($published, 9, 0, array(0, 1)); $archiv = clm_core::$load->make_valid($archiv, 9, 0, array(0, 1)); $name = clm_core::$load->make_valid($name, 8, ""); $bemerkungen = clm_core::$load->make_valid($bemerkungen, 8, ""); $bem_int = clm_core::$load->make_valid($bem_int, 8, ""); $datum = clm_core::$load->make_valid($datum, 8, "0000-00-00 00:00:00"); $notice = "m_changeSeasonSuccess"; $enableSeason = false; if ($name == "") { return array(false, "e_needSeasonName", -1); } // Neue Saison erstellen falls übergebene ID ungültig oder nicht vorhanden if ($id == -1 || clm_core::$db->saison->get($id)->isNew()) { $id = clm_core::$db->saison->getMax() + 1; if ($published == 1 && $archiv == 0) { $enableSeason = true; } } else { $publishedOld = clm_core::$db->saison->get($id)->published; $archivOld = clm_core::$db->saison->get($id)->archiv; // Es gibt nur eine aktive Saison, diese kann nicht deaktiviert werden. if ($publishedOld == 1 && $archivOld == 0 && ($published == 0 || $archiv == 1)) { $published = 1; $archiv = 0; $notice = "e_lastSeason"; } // Die Season war vorher nicht aktiv und wird es nun if (($publishedOld == 0 || $archivOld == 1) && $published == 1 && $archiv == 0) { $enableSeason = true; } } clm_core::$db->saison->get($id)->name = $name; clm_core::$db->saison->get($id)->bemerkungen = $bemerkungen; clm_core::$db->saison->get($id)->bem_int = $bem_int; clm_core::$db->saison->get($id)->datum = $datum; if ($enableSeason) { $out = clm_core::$api->db_season_enable($id); $out[2] = $id; return $out; } else { clm_core::$db->saison->get($id)->published = $published; clm_core::$db->saison->get($id)->archiv = $archiv; clm_core::$db->saison->write(); // Erneuere die Rechteverwaltung clm_core::$access = new clm_class_access(); return array(true, $notice, $id); } }