public function __construct($table,$cols) { $this->objSQL = new ClsAuieoSQL(); parent::__construct($cols); $objSession=ClsNaanalSession::getInstance(); $this->_siteID=$objSession->getPanelData("client_id"); $this->table=$table; }
function __construct($controlpanel, $encryptURL = false, $ipFilterControlpanel = null, $homepage = false) { $autoSession = getConfigVar("AUTO_SESSION"); if (isset($_REQUEST["webservice"])) { if ($_REQUEST["webservice"] == "getchallenge") { session_start(); } else { if (isset($_REQUEST["accessKey"])) { $sql = "select * from webservice where accessKey='{$_REQUEST["accessKey"]}'"; $pdo = connectPDO(getAppConfig("DATABASE_HOST"), getAppConfig("DATABASE_USER"), getAppConfig("DATABASE_PASSWORD"), getAppConfig("DATABASE_NAME"), getAppConfig("DATABASE_SERVER")); //ClsNaanalPDO::getNamedInstance(); try { $statement = $pdo->query($sql); $arr = $statement->fetchAll(PDO::FETCH_ASSOC); $_SESSION = unserialize(base64_decode($arr[0]["session_object"])); if ($arr[0]["logged"]) { $arrData = array(); $arrData["error"] = "You already logged."; die(json_encode($arrData)); } } catch (Exception $e) { die($e); } } else { if (isset($_REQUEST["sessionName"])) { $sql = "select * from webservice where session='{$_REQUEST["sessionName"]}'"; $pdo = connectPDO(getAppConfig("DATABASE_HOST"), getAppConfig("DATABASE_USER"), getAppConfig("DATABASE_PASSWORD"), getAppConfig("DATABASE_NAME"), getAppConfig("DATABASE_SERVER")); //ClsNaanalPDO::getNamedInstance(); try { $statement = $pdo->query($sql); $arr = $statement->fetchAll(PDO::FETCH_ASSOC); $_SESSION = unserialize(base64_decode($arr[0]["session_object"])); } catch (Exception $e) { die($e); } } } } } else { if (!($autoSession === false)) { session_start(); } } if (isset($_REQUEST["webservice"])) { if (isset($_POST["element"])) { $arr = json_decode($_POST["element"]); foreach ($arr as $pk => $pv) { if ($_REQUEST["webservice"] == "getchallenge") { if ($pk == "webservice" || $pk == "loginname") { continue; } } else { if ($_REQUEST["webservice"] == "getchallenge") { if ($pk == "webservice" || $pk == "accessKey" || $pk == "loginname") { continue; } } else { if ($pk == "element" || $pk == "webservice" || $pk == "sessionName" || $pk == "elementType") { continue; } } } $_POST[$pk] = $pv; } } else { if (isset($_GET["element"])) { $arr = json_decode($_POST["element"]); foreach ($arr as $pk => $pv) { if ($_REQUEST["webservice"] == "getchallenge") { if ($pk == "webservice" || $pk == "loginname") { continue; } } else { if ($_REQUEST["webservice"] == "getchallenge") { if ($pk == "webservice" || $pk == "accessKey" || $pk == "loginname") { continue; } } else { if ($pk == "element" || $pk == "webservice" || $pk == "sessionName" || $pk == "elementType") { continue; } } } $_GET[$pk] = $pv; } } } } if ($homepage === false) { $homepage = getIndexPage(); } parent::__construct($controlpanel, $homepage); if (get_magic_quotes_gpc()) { if (isset($_REQUEST)) { $_REQUEST = $this->sanitize($_REQUEST, false); } if (isset($_GET)) { $_GET = $this->sanitize($_GET, false); } if (isset($_POST)) { $_POST = $this->sanitize($_POST, false); } if (isset($_COOKIE)) { $_COOKIE = $this->sanitize($_COOKIE, false); } if (isset(ClsConfig::$AUTO_SESSION) && ClsConfig::$AUTO_SESSION !== false) { if (isset($_SESSION)) { $_SESSION = $this->sanitize($_SESSION, false); } } if (isset($_FILES)) { $_FILES = $this->sanitize($_FILES, false); } if (isset($_SERVER)) { $_SERVER = $this->sanitize($_SERVER, false); } } else { if (isset($_REQUEST)) { $_REQUEST = $this->sanitize($_REQUEST, true); } if (isset($_GET)) { $_GET = $this->sanitize($_GET, true); } if (isset($_POST)) { $_POST = $this->sanitize($_POST, true); } if (isset($_COOKIE)) { $_COOKIE = $this->sanitize($_COOKIE, true); } if (class_exists("ClsConfig") && isset(ClsConfig::$AUTO_SESSION) && ClsConfig::$AUTO_SESSION !== false) { if (isset($_SESSION)) { $_SESSION = $this->sanitize($_SESSION, true); } } if (isset($_FILES)) { $_FILES = $this->sanitize($_FILES, true); } if (isset($_SERVER)) { $_SERVER = $this->sanitize($_SERVER, false); } } if (isset($_SERVER["PATH_INFO"]) && !empty($_SERVER["PATH_INFO"])) { $arrServerPathInfo = pathinfo($_SERVER["PATH_INFO"]); $arrPathInfo = explode("/", $_SERVER["PATH_INFO"]); array_shift($arrPathInfo); if (!empty($arrPathInfo)) { $_REQUEST["page"] = array_shift($arrPathInfo); $_GET["page"] = $_REQUEST["page"]; } if (!empty($arrPathInfo)) { $_REQUEST["action"] = array_shift($arrPathInfo); $_GET["action"] = $_REQUEST["action"]; } if (isset($arrServerPathInfo["extension"])) { $arPth = pathinfo($_SERVER["SCRIPT_NAME"]); //trace($arPth["dirname"]); $pth = implode("/", $arrPathInfo); header("Location:http://{$_SERVER["SERVER_NAME"]}{$arPth["dirname"]}/{$pth}"); exit; } if (!empty($arrPathInfo)) { $_REQUEST["switch"] = array_shift($arrPathInfo); $_GET["switch"] = $_REQUEST["switch"]; } while (!empty($arrPathInfo)) { $_REQUEST["AUIEO_ACTION_PARAM_DATA"][] = array_shift($arrPathInfo); $_GET["AUIEO_ACTION_PARAM_DATA"][] = $_REQUEST["AUIEO_ACTION_PARAM_DATA"]; } } $autoSession = getConfigVar("AUTO_SESSION"); if (!($autoSession === false)) { $this->objNaanalSession = ClsNaanalSession::getInstance(); } $this->objNaanalRequest = ClsNaanalRequest::getInstance(); $this->objNaanalPost = ClsNaanalPost::getInstance(); $this->objNaanalGet = ClsNaanalGet::getInstance(); $this->files = $_FILES; $this->page = $this->objNaanalRequest->getModule(); $this->module = $this->objNaanalRequest->getModule(); $this->action = $this->objNaanalRequest->getAction(); $this->switch = $this->objNaanalRequest->getSwitch(); if (class_exists("ClsConfig")) { $this->fldUserID = isset(ClsConfig::$FLD_USERID) ? ClsConfig::$FLD_USERID : "userid"; $this->fldUser = isset(ClsConfig::$FLD_USER) ? ClsConfig::$FLD_USER : "******"; $this->fldPassword = isset(ClsConfig::$FLD_PASSWORD) ? ClsConfig::$FLD_PASSWORD : "******"; } $this->encryptURL = $encryptURL; if ($this->encryptURL && isset($_REQUEST["@page"])) { $shld = new URLShield(true, true); $shld->expose(); } }
/** * returns current database ID * @return int */ public static function getCurrentDatabaseID() { $objNaanalSession = ClsNaanalSession::getInstance(); return $objNaanalSession->isPanelDataSet("dynamicdatabase") ? $objNaanalSession->getPanelData("dynamicdatabase") : 0; }
public function byAll($sortBy, $sortDirection) { $from=false; $this->buildFilter($this->objSQL); $this->objSQL->addOrderBy($sortBy,$sortDirection=="ASC"?true:false); ClsNaanalSession::getInstance()->setPanelData("search_sql", $this->objSQL->render()); $arrPager=ClsNaanalRequest::getInstance()->getPager(); $this->objSQL->setLimit($arrPager["start"],$arrPager["items_per_page"]); $sql=$this->objSQL->render(); $count_sql=$this->objSQL->render(true); $arr=$this->_db->getAllAssoc($count_sql); $totalRecords=$arr[0]["count"]; $rs=$this->_db->getAllAssoc($sql); foreach ($rs as $rowNumber => $row) { $this->setValue($row["companyID"],$rowNumber,0); $this->setValue($row["name"],$rowNumber,1); $this->setValue($row["phone1"],$rowNumber,2); $this->setValue($row["keyTechnologies"],$rowNumber,3); $this->setValue($row["dateCreated"],$rowNumber,4); $this->setValue($row["ownerFirstName"]." ".$row["ownerLastName"],$rowNumber,5); } $this->render(); }