public static function startSession() { if (!$_SESSION) { session_start(); } $maincfg = ErApplication::getMainCfg(); self::$_storage = $maincfg['application']['session']['mainstorage']; }
/** * Autoload class method */ private function setAutoload() { spl_autoload_register(function ($className) { $className = str_replace("\\", DIRECTORY_SEPARATOR, $className); $classPath = ErApplication::fileExists($className, "php"); if ($classPath) { require_once $classPath; } }); }
public function routeAction() { $request = new Request(); $request->initRequest(); $post = $request->getPost(); ErSession::saveToSession('start', $post['start']); ErSession::saveToSession('finish', $post['finish']); if ($post['findaction']) { ErApplication::redirect(ErApplication::getBaseUrl() . 'road/index'); } else { ErApplication::redirect(ErApplication::getBaseUrl() . 'road/addroute'); } }
private function renderItem(array $block) { foreach ($block as $blockItem) { if (!is_array($blockItem[1])) { $file = $blockItem[1]; $tplFile = ErApplication::fileExists($file, "tpl") ? $file : "404"; $params = $blockItem[0]; ob_start(); include $tplFile . ".tpl"; $this->_renderCahe .= ob_get_clean(); } else { $this->renderItem($blockItem); } } }
private function __construct() { $mainCfg = ErApplication::getMainCfg(); $host = $mainCfg["dbsettings"]["host"]; $name = $mainCfg["dbsettings"]["name"]; $login = $mainCfg["dbsettings"]["login"]; $password = $mainCfg["dbsettings"]["password"]; try { $this->connDB = new PDO("mysql:host=" . $host . ";dbname=" . $name, $login, $password, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); // $stmt = $this->connDB->prepare("set_client='utf8'"); // $stmt->execute(); // $stmt = $this->connDB->prepare("set character_set_results='utf8'"); // $stmt->execute(); // $stmt = $this->connDB->prepare("set collation_connection='utf8_general_ci'"); // $stmt->execute(); // $stmt = $this->connDB->prepare("SET NAMES utf8"); // $stmt->execute(); } catch (PDOException $e) { echo "Error!: " . $e->getMessage() . "<br/>"; die; } }
public function __construct($entity) { $mainCfg = ErApplication::getInstance()->getMainCfg(); $this->dbTable = $mainCfg["dbsettings"]["tableprefix"] . strtolower($entity); }
public function saveRouteAction() { $message = ErMessenger::getInstance(); $request = new Request(); $request->initRequest(); $post = $request->getPost(); $userEmail = ErSession::getFromSession('user'); $roadMapper = new RoadMapper(); $road = new Roadrout(); $road->id = (string) time(); $road->driverid = $userEmail; $road->start = $post['id_citystart']; $road->start_adress = $post['id_streetstart']; $road->finish = $post['id_cityfinish']; $road->finish_adress = $post['id_streetfinish']; $road->terms = $post['dopinfo']; $road->autoid = $post['regnumber']; $road->freeseats = $post['seats']; $road->price = $post['price']; $road->startdate = $post['dateDep']; $road->timetrip = $post['dateArrival']; $road->status = 'opened'; if ($roadMapper->insertNewRoad($road)) { $message->setSucceedMessage('202', 'index/index'); ErApplication::redirect('/'); } else { $message->setErrMessage('100', 'road/addRoute'); ErApplication::redirect('road/addRoute'); } }
public function getPersonalDataAction() { $message = ErMessenger::getInstance(); $userEmail = ErSession::getFromSession('user'); if (isset($userEmail)) { echo json_encode($this->fetchUserData($userEmail)); } else { $message->setNotesMessage('303', 'index/index'); ErApplication::redirect(ErApplication::getBaseUrl()); } }
<?php error_reporting(E_ALL & ~E_NOTICE); //error_reporting(E_ALL); //if(!$_SESSION) { session_start(); } require_once "application/ErApplication.php"; $app = ErApplication::getInstance(); $app->init(); $_fc = $app->getFC(); $_fc->run();