public function getAndClauses(array $definitions, $db_field) { if ($definitions['operator'] == "LIKE" && strlen($this->_post[$definitions['alias']]) > 0) { $this->queryString .= ' ' . $definitions['clause'] . ' ' . $definitions['table'] . '.' . $db_field . ' ' . $definitions['operator'] . ' "%' . $this->_post[$definitions['alias']] . '%" '; } elseif ($definitions['operator'] != "LIKE" && strlen($this->_post[$definitions['alias']]) > 0) { $this->queryString .= ' ' . $definitions['clause'] . ' ' . $definitions['table'] . '.' . $db_field . ' ' . $definitions['operator'] . ' "' . trim($this->_post[$definitions['alias']]) . '" '; } $querySession = SessionController::getInstance(); $querySession->setSessionVar('adminQuery', $this->queryString); $querySession->setSessionVar('tagQuery', $this->_post['name']); }
public function setWebmasterAutentication() { if (isset($_POST['submit'])) { if ($_POST['password'] == "esbien") { $webmasterSession = SessionController::getInstance(); $webmasterSession->setSessionVar('webmaster', 1); } if (isset($_SESSION['webmaster'])) { header('Location: index.php'); } } }
public function openShopSession() { if (isset($_POST['shop_action'])) { $db = PDOQuery::getInstance(); $db->connect(); $sql = "INSERT INTO shop_session\n\t\t\t\t\t\t(id_user, id_shop, date, is_active)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t(?, ?, ?, 1)"; $res = $db->prepareQuery($sql); $res->execute(array($_SESSION['id_employee'], $_SESSION['id_shop'], time())); SessionController::getInstance()->setSessionVar('shop_session_id', $db->insert_id()); $db->close(); } }
public function login( DatabaseConnection $connection ) { if( null == $connection || null == $this->user ) { echo "something null"; return; } if ( $this->user->login( $connection ) ) { $this->session = SessionController::getInstance(); $this->session->setMessage( "Welcome back {$this->user->username}"); $this->session->setupAuthorizedSession( $this->user ); } else { echo "not logged in"; print_r( $this->user); } }
private function __construct() { $this->connection = DatabaseConnection::getInstance(); $this->session = SessionController::getInstance(); $this->session->start(); $this->appSettings = new ApplicationSettings(APPLICATION_SETTINGS_FILE, ENVIRONMENT); $username = ''; $this->messages = array(ERROR_MESSAGES => array(), WARNING_MESSAGES => array(), INFORMATIONAL_MESSAGES => array()); if (isset($_SESSION['username'])) { $username = $_SESSION['username']; } $this->user = new User($username, ''); if ($this->session->isSessionAuthenticated()) { $this->user->restoreUserFromUsername($this->connection); } }
<?php session_start(); require_once dirname(__FILE__) . '/settings.inc.php'; require_once dirname(__FILE__) . '/functions.php'; require_once dirname(__FILE__) . '/defines.inc.php'; require_once dirname(__FILE__) . '/defines.uri.inc.php'; require_once dirname(__FILE__) . '/smarty.config.inc.php'; require_once _CONFIG_DIR_ . 'autoload.php'; /* Get Context */ $context = Context::getContext(); /* instantiate language class */ $context->languageList = array(1 => 'en', 2 => 'es', 3 => 'de', 4 => 'nl'); $context->language = new MultiLanguageClass($context->languageList); define(_ID_LANG_, $context->language->getLanguageId()); //contains session object $context->session = SessionController::getInstance(); /* Get Smarty */ $context->smarty = $smarty;
public function start() { $session = SessionController::getInstance(); $session->setSessionVar('crumb_list', $this->setCrumbQueue()); $this->deleteEndCrumbUnMatches(); }
public static function setShopSession() { $id_shop = $_GET['id_shop']; if (isset($_GET['id_shop']) || empty($id_shop) || !is_numeric($id_shop)) { SessionController::getInstance()->setSessionVar('id_shop', $_GET['id_shop']); return true; } return false; }
private function buildList($action) { $objects = $this->scaffoldObject->find("all"); $length = count($objects); if (0 == $length) { $session = SessionController::getInstance(); $session->addMessage("Could not find and objects of type {$this->scaffoldObject->table_name}. Please create a new {$this->scaffoldObject->table_name} object."); print_r($_SESSION); exit(0); } $this->loadXML("<table></table>"); $root = $this->documentElement; $root->setAttribute("class", "scaffolding_list"); $thead = $this->createElement("thead"); $keys = array_keys($objects[0]->values); $tr = $this->createElement("tr"); foreach ($keys as $key) { $td = $this->createElement("td", $key); $tr->appendChild($td); } $thead->appendChild($tr); $root->appendChild($thead); $tbody = $this->createElement("tbody"); for ($i = 0; $i < $length; $i++) { $tr = $this->createElement("tr"); $class = 0 == $i % 2 ? "scaffolding_list_row_even" : "scaffolding_list_row_odd"; $tr->setAttribute("class", $class); foreach ($keys as $key) { $td = $this->createElement("td", $objects[$i]->{$key}); $tr->appendChild($td); } $tbody->appendChild($tr); } $root->appendChild($tbody); }
public function getOrderDirection() { if (!isset($_GET['orderBy'])) { return $_SESSION['asc']; } if ($_SESSION['order'] == true) { SessionController::getInstance()->setSessionVar('order', false); SessionController::getInstance()->setSessionVar('asc', 'ASC'); } else { SessionController::getInstance()->setSessionVar('order', true); SessionController::getInstance()->setSessionVar('asc', 'DESC'); } return $_SESSION['asc']; }