/** * Формирует ссылку текущего раздела * * @param Integer $sectionId ID раздела * @return String */ public function restoreBackLink($sectionId) { $this->_sql->selAllWhere("URL", "`id`={$sectionId}"); $res = $this->_sql->getTable(); if ($res[0]["module"] != 0) { $urlPath[] = $res[0]["link"]; $urlFull[] = $res[0]; } $pid = $res[0]["pid"]; while ($pid != 0) { $this->_sql->selAllWhere("URL", "`id`={$pid}"); $subRes = $this->_sql->getTable(); if ($subRes[0]["module"] != 0) { $urlPath[] = $subRes[0]["link"]; $urlFull[] = $subRes[0]; } $pid = $subRes[0]["pid"]; } for ($index = count($urlPath) - 2; $index >= 0; --$index) { $link .= $urlPath["{$index}"] . "/"; } if ($sectionId == $this->_currentID) { $this->_urlPath = $urlFull; } return "/" . $link; }
/** * Получить список ключей в виде ассоциативного массива * * @return Array */ public static function getKeys() { self::dbConnector(); self::$_sql->selAll("REGISTRY"); $out = null; if (self::$_sql->getTable() != null) { foreach (self::$_sql->getTable() as $value) { $out[] = array("key" => $value["key"], "value" => unserialize($value["value_serealized"])); } } return $out; }
public static function chk($username, $accounts_id = NULL) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'traceID' => "session_CFG"); $userKey; //---------------------------------------------------------- $chk = GenFun::error_CHK(array($username)); //---------------------------------------------------------- if ($chk['bool']) { if (is_null(Constants::$mysqli)) { GenFun::hostConnect(); } } else { return $chk; } //---------------------------------------------------------- session_start(); $session_id = GenFun::encrypt(session_id() . self::SALT . $username); //---------------------------------------------------------- if ($chk['bool']) { $chk = MySQL::getTable(SessionLog_const::TBL, array("session_id" => $session_id, "userKey" => $_COOKIE['user'])); } else { return $chk; } //---------------------------------------------------------- $userKey = $username . "-" . rand(0, 13000000); setcookie("user", $userKey); //---------------------------------------------------------- if (sizeof($chk['result']) == 0) { $chk = InsertINTO::go(array("tableID" => SessionLog_const::TBL, "setArr" => array("userKey" => $userKey, "accounts_id" => $accounts_id, "session_id" => $session_id))); } else { $chk = Update::go(SessionLog_const::TBL, array("userKey" => $userKey), array("session_id" => $session_id)); if ($chk['bool']) { $chk['message'] = "session for this user has already been established!!!"; } } //---------------------------------------------------------- return $chk; }
/** * Сканирует URL как разделы. * @throws Exception Раздел не найден */ private function urlScaner() { $pid = 0; $flag = false; foreach ($this->_urlArray as $key => $value) { if (!$flag) { $queryWhere = "`link`='{$value}' AND `pid`={$pid}"; $this->_sql->SelAllWhere("URL", $queryWhere); $arr = $this->_sql->getTable(); $this->_arr = $arr[0]; $pid = $arr[0]["id"]; if ($arr == NULL) { throw new Exception("Error", 404); } else { if ($arr[0]["use_parameters"] == 1) { $flag = true; } } } else { $this->_parameters[] = $value; } } }
public function registerUser($email, $password, $addRowFunction = NULL, $sendConfirmationFunction = NULL, $reDirect = NULL) { Trace::output($this->traceID, "registerUser"); //---------------------------------------------------------- $this->password = $password; $this->email = $email; is_null($addRowFunction) ? $this->addRowFunction = array($this, "addAccountRow") : ($this->addRowFunction = $addRowFunction); $this->tblName = Accounts_const::TBL; is_null($addRowFunction) ? $this->addRowFunction = array($this, "registerConfirmationLink") : ($this->sendConfirmationFunction = $sendConfirmationFunction); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'traceID' => "registerUser"); //---------------------------------------------------------- $chk = GenFun::error_CHK(array($email, $password)); //---------------------------------------------------------- if (!$chk["bool"]) { return $chk; } //---------------------------------------------------------- /*if(!$this->character_CHK($email)) { $chk['bool'] = false; $chk['message'] = "email must only contain numbers, upper, and lowercase characters!!!"; }*/ //---------------------------------------------------------- if (!$this->character_CHK($password)) { $chk['bool'] = false; $chk['message'] = "Password must only contain numbers, upper, and lowercase characters!!!"; } //---------------------------------------------------------- if ($chk['bool']) { $chk = MySQL::getTable(Accounts_const::TBL, array("email" => $email)); } else { return $chk; } //---------------------------------------------------------- if (!$chk['bool'] || $chk['error']) { return $chk; } //---------------------------------------------------------- if (sizeof($chk['result']) != 0) { $chk['bool'] = false; $chk['message'] = "email has already been registered!!!"; } //---------------------------------------------------------- if ($chk['bool']) { $chk = $this->start($chk['result'][0], 1, $this->sendConfirmationFunction, $reDirect); } //---------------------------------------------------------- return $chk; }
private function updateAssets($id, $returnRow = true) { Trace::output($this->traceID, "updateAssets"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'traceID' => "updateAssets"); $insertID = GlobalMas::$mysqli->insert_id; //---------------------------------------------------------- $chk = Update::go(Projects_const::TBL, array(Projects_const::CLM_ASSETS_ID => $insertID), array("id" => $id)); //---------------------------------------------------------- if ($returnRow) { $chk = MySQL::getTable(Assets_const::TBL, array(Assets_const::CLM_ID => $insertID)); } //---------------------------------------------------------- return $chk; }
public function getImages($returnType = "XML") { Trace::output($this->traceID, "getImages"); //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'traceID' => "getImages"); //---------------------------------------------------------- $chk = MySQL::getTable(NicKelmanConst_v0::TBL_IMAGES); //---------------------------------------------------------- if ($returnType == "XML") { if ($chk['bool']) { $chk = GenFun::json_to_xml(json_encode(array("item" => $chk['result'])), true); } } //---------------------------------------------------------- return $chk; }