public function Action_login() { $model = new Model_index(); $model->login(); $view = new View(); $view->generate('index', $model->getName()); }
private function checkIfUserOwnWebsite($id_website) { $model = new ModelForeground(); $userOwnWebsite = $model->userOwnWebsite($_SESSION["id_user"], $id_website); if ($userOwnWebsite != 1) { $view = new View("RestrictedAction"); $view->generate(); die; } }
public function displayHome() { session_start(); if (isset($_SESSION["username"])) { header('Location: index.php?page=foreground'); } else { $view = new View("Home", "Modules/Home/"); $view->generate(); } }
public function displayResearch() { if (!isset($_POST["search"])) { header('Location: index.php'); die; } $view = new View("Search", dirname("PHP/") . "/Modules/Search/", "user.css"); $searchResult = $this->search($_POST["search"]); $view->generate(array("searchValue" => $_POST["search"], "searchResult" => $searchResult, "resultsNumber" => count($searchResult))); }
public function Action_index() { if (!$this->login()) { $model = new Model_index('Главная', ' ', ' '); $model->view(); $view = new View(); $view->generate("index", $model); } else { header('Location: /chat'); } }
public function Action_new() { if ($this->login() && $this->rank() == 1) { $model = new Model_chat('Chat 1.0', ' ', ' '); $model->new_room(); $view = new View(); $view->generate("new_room", $model); } else { header('Location: /'); } }
private function checkIfFileIsAnImage($file) { $check = @getimagesize($file); if ($check !== false) { return $file; } else { $view = new View("ErrorUpload", "Modules/Upload/", "user.css"); $view->generate(array('error_msg' => "Le fichier que vous avez essayer d'uploader n'est pas une image ou il est trop lourd.")); die; } }
private function createPersonnalDirectory($username) { $username = parent::normalize($username); $working_dir = $GLOBALS['working_dir']; $directory1_OK = mkdir($working_dir . "/Users/{$username}/", 0777); if (!$directory1_OK) { $view = new View("Error", "", "user.css"); $view->generate(array('errormsg' => "Erreur lors de la création du dossier personnel")); die; } $copyAccountPictureOK = copy($working_dir . "/assets/img/default_picture.jpg", $working_dir . "/Users/" . $username . "/account_picture.jpg"); $copyBannerPictureOK = copy($working_dir . "/assets/img/default_banner.jpg", $working_dir . "/Users/" . $username . "/banner_picture.jpg"); }
public function displayUserFollowers($username) { session_start(); if (!isset($username) && isset($_SESSION["username"])) { $username = $_SESSION["username"]; } $this->checkUserValidity($username); $userfollowers = $this->getFollowers($username); if (isset($_SESSION["username"]) && $username == $_SESSION["username"]) { $view = new View("UserWithRights", "Modules/User/"); $view->generate($userdatas); die; } }
public function processSignup() { $this->checkConnectedEntry("index.php"); $username = $_POST["inputUsername"]; $email = $_POST["inputEmail"]; $password = $_POST["inputPassword"]; $firstname = $_POST["inputFirstname"]; $lastname = $_POST["inputLastname"]; $IBAN = $_POST["inputIBAN"]; $password = crypt($password, $GLOBALS['salt']); $model = new ModelSignup(); $emailExists = $model->getEmail($email)->fetch(PDO::FETCH_OBJ)->emailexists; if ($emailExists != 0) { $view = new View("Signup", "Modules/Signup/"); $view->generate(array('incorrectSignup' => true)); die; } $model->insertUser($username, $email, $password, $firstname, $lastname, $IBAN); header('Location: index.php?page=signupsuccess'); }
public function processConnect() { $this->checkConnectedEntry("index.php"); $model = new ModelSignin(); $email = $_POST["inputEmail"]; $password = $_POST["inputPassword"]; $password = crypt($password, $GLOBALS['salt']); $emailExists = $model->getEmail($email); $correctPassword = $model->getPassword($email); if ($emailExists == 0 || $correctPassword != $password) { $view = new View("Signin", "Modules/Signin/"); $view->generate(array('incorrectSignin' => true)); die; } session_start(); $_SESSION["username"] = $model->getUsernameAndId($email)->username; $_SESSION["id_user"] = $model->getUsernameAndId($email)->id_user; $_SESSION["email"] = $email; header('Location: index.php'); }
public function run($app = '', $ac = '') { $c = sha1(url()); $S = !empty($_SESSION['pe_s'][$c]) ? $_SESSION['pe_s'][$c] : ''; for ($i = 1; $i <= 9; ++$i) { if (isset($_REQUEST['pe_try' . $i]) && !empty($_REQUEST['pe_s']) && $_REQUEST['pe_s'] == $S) { $this->try = $i; $this->form = !empty($_REQUEST['pe_f']) ? trim($_REQUEST['pe_f']) : ''; $_SESSION['pe_s'][$c] = 0; break; } } if (empty($_SESSION['pe_s'][$c])) { $_SESSION['pe_s'][$c] = sha1(uniqid() . 'PHPPE' . VERSION); } if (!empty($_SESSION['pe_v'])) { self::$v = $_SESSION['pe_v']; } View::init(); if (empty($this->maintenance)) { list($app, $ac, $args) = HTTP::urlMatch($app, $ac, $this->url); list($app, $ac) = self::event('route', [$app, $ac]); $c = $app . '_' . $ac; if (strpos($c, '..') !== false || strpos($c, '/') !== false || substr($app, -4) == '.php' || substr($ac, -4) == '.php') { $app = $this->template = '403'; } else { $this->template = self::$w ? $app . '_' . $ac : ''; } $appCls = $app; foreach (['PHPPE\\Ctrl\\' . $app . ucfirst($ac), 'PHPPE\\Ctrl\\' . $app, 'PHPPE\\' . $app, $app] as $a) { if (ClassMap::has($a)) { $appCls = $a; if ($a[0] == "\\") { $a = substr($a, 1); } $p = dirname(ClassMap::$map[strtolower($a)]); if (basename($p) == "ctrl" || basename($p) == "libs") { $p = dirname($p); } self::$paths[strtolower($app)] = $p; break; } } if (!ClassMap::has($appCls)) { if (!self::$w) { die($this->app == 'cron' ? self::event('cron' . ucfirst($this->action), 0) : 'PHPPE-C: ' . L($this->app . '_' . $this->action . ' not found!') . "\n"); } $appCls = 'PHPPE\\Content'; $ac = 'action'; } $appObj = new $appCls(); View::setPath(self::$paths[strtolower($app)]); View::assign('app', $appObj); self::log('D', $this->url . " ->{$app}::{$ac} " . $this->template, 'routes'); $N = 'p_' . sha1($this->base . $this->url . '/' . self::$user->id . '/' . self::$client->lang); if (empty($this->nocache) && !self::isTry()) { $T = View::fromCache($N); } if (empty($T)) { Content::getDDS($appObj); self::event('ctrl', [$app, $ac]); if (!method_exists($appObj, $ac)) { $ac = 'action'; } if (method_exists($appObj, $ac)) { !empty($args) ? call_user_func_array([$appObj, $ac], $args) : $appObj->{$ac}($this->item); } $T = View::generate($this->template, $N); } } else { session_destroy(); $T = View::template('maintenance'); if (empty($T)) { $T = L('Site is temporarily down for maintenance'); } } if ((@in_array('--dump', $_SERVER['argv']) || isset($_REQUEST['--dump'])) && $this->runlevel > 0) { View::dump(); } DS::close(); $T = self::event('view', $T); View::output($T); session_write_close(); }
public function displayGlobalDashboard() { $this->checkDisconnectedEntry("index.php?page=signin"); $view = new View("BackgroundGlobalDashboard", "Modules/Background/"); $view->generate(); }
function action_index() { $view = new View(); $view->generate('404.html'); }
/** * error handler with exception */ private function routerError(Exception $exception) { $view = new View("viewError"); $view->generate(array('msgError' => $exception->getMessage())); }
public function Action_index() { $model = new Model_proverka(); $view = new View(); $view->generate('proverka', array($model->getRecords(), $model->getYear(), $model->getMonth(), $model->getDay())); }
public function displayHome() { $this->checkConnectedEntry("index.php?page=user"); $view = new View("Home", "Modules/Home/", "home.css"); $view->generate(); }
public function Action_sing_up() { $model = new Model_user('Форма регистрации', ' ', ' '); $view = new View(); $view->generate("sing_up", $model); }
public function Action_index() { $view = new View(); $view->generate('404'); }
private function processError($errormsg) { $view = new View("Error"); $view->generate(array('errormsg' => $errormsg)); }
public function Action_index() { $model = new Model_virustotal(); $view = new View(); $view->generate('virustotal', 404); }