public function delSesValue($ses_name) { try { unset($_SESSION[$ses_name]); } catch (Exception $e) { throw Exeption::ThrowDef('Failed delete sesions var - ' . $e); } }
public function delCookie($name) { try { SetCookie($name, ""); } catch (Exception $e) { throw Exeption::ThrowDef('Failed delete cookie var - ' . $e); } }
function __destruct() { try { fclose($this->fp); } catch (Exception $e) { throw Exeption::ThrowDef('Failed close work file log' . $e->getMessage()); } }
public function __construct() { if (file_exists(APP_DIR . '/config/default_application.ini')) { $this->ArrayIni = parse_ini_file(APP_DIR . '/config/' . APP_CONF); } else { throw Exeption::ThrowDef('File configuration not found'); } }
public function __construct($conn = "mysql") { try { $param_ini = new Config(); switch ($conn) { case "mysql": $this->_pdo = new PDO($param_ini->getVar('db.conn'), $param_ini->getVar('db.user'), $param_ini->getVar('db.pass')); break; case "mssql": $this->_pdo = new PDO($param_ini->getVar('db.conn_mssql'), $param_ini->getVar('db.user_mssql'), $param_ini->getVar('db.pass_mssql')); break; default: $this->_pdo = new PDO($param_ini->getVar('db.conn_' . $conn), $param_ini->getVar('db.user_' . $conn), $param_ini->getVar('db.pass_' . $conn)); } //if ($conn == "mysql") $this->_pdo = new PDO($param_ini->getVar('db.conn'),$param_ini->getVar('db.user'),$param_ini->getVar('db.pass')); //if ($conn == "mssql") $this->_pdo = new PDO($param_ini->getVar('db.conn_mssql'),$param_ini->getVar('db.user_mssql'),$param_ini->getVar('db.pass_mssql')); } catch (\PDOException $e) { throw Exeption::ThrowDb($e); } }
public function viewLayout($lay, $layout_params = null) { if (file_exists(APP_DIR . "/modules/" . $this->module_name . "/layouts/" . $lay . ".phtml")) { require_once APP_DIR . "/modules/" . $this->module_name . "/layouts/" . $lay . ".phtml"; } else { throw Exeption::ThrowDef("Error : not found layout " . $lay); } }
public function order($field = null) { if (is_string($field) && $field != null) { $this->_sql .= ' order by ' . $field; } else { throw Exeption::ThrowDef('Order is null or array'); } return $this; }
<?php use MVC\Controller; use Thr\Exept as Exeption; define("MODULE_DIR", dirname(__FILE__)); spl_autoload_register(function ($className) { $classes = MODULE_DIR . "/" . str_replace("\\", "/", $className) . ".php"; $libs = APP_DIR . "/libs/" . str_replace("\\", "/", $className) . ".php"; if (file_exists($classes)) { require_once $classes; } else { if (file_exists($libs)) { require_once $libs; } else { throw Exeption::ThrowDef("NOT FOUND CLASS - " . $libs); } } }); $obj = new Controller(); $obj->run();