public function Run() { if (layout::Ret()->Ready() and $this->output) { $this->output .= layout::Ret()->Display(); error::Ret()->Warn("Output found from action - " . stack::Ret()->GetAction() . " - and layout - " . layout::Ret()->GetTemplate()); } elseif (layout::Ret()->Ready()) { $this->output = layout::Ret()->Display(); } return $this->output; }
/** * */ public function Display() { switch ($this->type) { case 'smarty': if ($this->template === null) { error::Ret()->Log('Call to display without defining template' . print_r(array('stack' => stack::Ret(), 'debug_backtrace' => debug_backtrace()), true)); } else { $this->CallBack('display'); $this->smarty->assign('url_prefix', URL_PREFIX); $this->smarty->assign('config', config::Ret()); $this->smarty->assign('server_name', $_SERVER['SERVER_NAME']); $this->smarty->assign('http_referer', isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] !== '' ? $_SERVER['HTTP_REFERER'] : null); $this->smarty->assign('session', $_SESSION); $this->smarty->assign('utility', utility::Ret()); // die('<pre>' . print_r(array($_SESSION,debug_backtrace()),true)); $this->smarty->display($this->template); } break; default: error::Ret()->Log('Unable to Display(). Undefined type (' . $this->type . ')'); } }
/** * * @return boolean */ public function CheckPassword() { if ($this->id === null) { $u = stack::Ret()->Check('email', null, 'POST'); $p = stack::Ret()->Check('password', null, 'POST'); if ($u === NULL || $p === NULL) { return false; } $xss = stack::Ret()->Check('xss', null, 'POST'); if ($this->CheckXSS($xss)) { $pass = strtoupper(hash('sha1', SHA1_SALT . $p)); $sql_check_password = <<<SQL SELECT \tid FROM users WHERE \temail = :email \tAND password = SHA1(:password) ; SQL; // TODO: select remaining parameters database::Ret()->Query($sql_check_password, array(':email' => $u, ':password' => strtoupper(hash('sha1', SHA1_SALT . $p)))); if (database::Ret()->CheckQuery()) { $user = database::Ret()->Fetch(); $this->id = $user['id']; return $this->__CreateDatabaseSession(); } else { error::Ret()->Log('Query failed'); } } else { error::Ret()->Log('Failed XSS'); } } else { return true; } return false; }