public function execute() { if (false === ($page = GWF_Page::getByID(Common::getGetString('pageid')))) { return $this->module->error('err_page'); } $user = GWF_User::getStaticOrGuest(); $this->is_author = $this->module->isAuthor($user); $this->is_owner = $this->is_author || $page->isOwner($user); if (!$this->is_owner && !$this->is_author) { return GWF_HTML::err('ERR_NO_PERMISSION'); } $this->page = $page; $this->user = $user; $this->is_oowner = $this->is_author ? true : $page->getOtherPage()->isOwner($user); $back = ''; if (isset($_POST['edit'])) { $back .= $this->onEdit(); } elseif (isset($_POST['unlock'])) { return $this->onUnlock() . $this->templateEdit(); } elseif (isset($_POST['delete'])) { return $this->onDelete() . $this->templateEdit(); } elseif (isset($_POST['translate'])) { GWF_Website::redirect($this->module->getMethodURL('Translate', '&pageid=' . $page->getID())); die; } elseif (isset($_POST['upload'])) { require_once GWF_CORE_PATH . 'module/PageBuilder/PB_Uploader.php'; $back .= PB_Uploader::onUpload($this->module) . $this->templateEdit(); } return $back . $this->templateEdit(); }
private function onRegister() { $form = $this->getForm(); $errorsA = $errorsB = ''; if (false !== ($errorsA = $form->validate($this->module)) || false !== ($errorsB = $this->onRegisterB())) { return $errorsA . $errorsB . $this->templateForm(); } $username = Common::getPost('username'); $password = Common::getPost('password'); $email = Common::getPost('email'); $birthdate = sprintf('%04d%02d%02d', Common::getPost('birthdatey'), Common::getPost('birthdatem'), Common::getPost('birthdated')); $default_country = $this->module->cfgDetectCountry() ? GWF_IP2Country::detectCountryID() : 0; $countryid = $form->getVar('countryid', $default_country); require_once GWF_CORE_PATH . 'module/Register/GWF_UserActivation.php'; $token = GWF_UserActivation::generateToken(); $ua = new GWF_UserActivation(array('username' => $username, 'email' => $email, 'token' => $token, 'birthdate' => $birthdate, 'countryid' => $countryid, 'password' => GWF_Password::hashPasswordS($password), 'timestamp' => time(), 'ip' => GWF_IP6::getIP(GWF_IP_EXACT))); if (false === $ua->insert()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)) . $this->templateForm(); } if ($this->module->wantEmailActivation()) { return $this->sendEmail($username, $email, $token, $password); } else { GWF_Website::redirect(GWF_WEB_ROOT . 'quick_activate/' . $token); } return $this->module->message('msg_registered'); }
public function execute() { if (false !== ($error = $this->sanitize())) { return $error; } $nav = $this->module->templateNav(); $back = ''; # Enable if (false !== Common::getPost('enable')) { $back .= $this->onEnable('enabled'); } elseif (false !== Common::getPost('disable')) { $back .= $this->onEnable('disabled'); } elseif (false !== Common::getPost('defaults')) { $back .= $this->onDefaults(); } elseif (false !== Common::getPost('update')) { $back .= $this->onUpdate(); } elseif (false !== Common::getPost('admin_sect')) { if ($this->mod->hasAdminSection()) { GWF_Website::redirect($this->mod->getAdminSectionURL()); return ''; } else { $back .= $this->module->error('err_no_admin_sect'); } } # Form return $nav . $back . $this->templateModule(); }
private function onShowAvatar($userid) { if (false === ($user = GWF_User::getByID($userid))) { return GWF_HTML::err('ERR_UNKNOWN_USER'); } if (false === GWF_AvatarGallery::onViewed($user)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } GWF_Website::redirect(GWF_WEB_ROOT . 'profile/' . $user->urlencode('user_name')); return "Redirecting..."; }
private static function onActivated(Module_Register $module, GWF_User $user) { if (false === GWF_Hook::call(GWF_Hook::ACTIVATE, $user, array(true))) { return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } if ($module->wantAutoLogin()) { if (false === GWF_Session::onLogin($user)) { return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } GWF_Website::redirect(GWF_WEB_ROOT . 'welcome'); } else { return $module->message('msg_activated'); } }
public function execute() { if (false !== ($iso = Common::getPost('iso'))) { GWF_Website::redirect(GWF_WEB_ROOT . 'lang_ranking/' . $iso); die; } if (false === ($lang = GWF_Language::getByISO(Common::getGet('iso')))) { if (false === ($lang = GWF_Language::getByISO('en'))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } } if (false !== ($username = Common::getGet('username'))) { return $this->templateRankingFor($lang, $username); } return $this->templateRanking($lang, GWF_Session::getUser()); }
public function execute(GWF_Module $module) { if (GWF_Session::haveCookies()) { GWF_Session::set(GWF_Browser::SESS_DETECTION, 1); GWF_Session::set(GWF_Browser::SESS_RESOLUTION, array(intval(Common::getGet('w', -1)), intval(Common::getGet('h', -1)))); GWF_Website::redirectBack(); } else { $url = Common::getGet('url', GWF_Session::getLastURL()); if ($module->cfgFallbackSessions()) { GWF_Session::createFallback($url); GWF_Website::redirect(GWF_WEB_ROOT . 'index.php?mo=GWF&me=CookieCheck&level=2&url=' . urlencode($url)); } else { GWF_Website::redirectBack(); } } }
private function onQuickJump() { $jumps = Common::getPost('quickjumps'); if (!is_array($jumps)) { return $this->module->error('err_site') . '1'; } foreach ($jumps as $key => $value) { if ($value === '0') { continue; } if (false === ($site = WC_Site::getByID($value))) { return $this->module->error('err_site') . '2'; } $sid = $site->getVar('site_id'); GWF_Website::redirect(GWF_WEB_ROOT . 'site/details/' . $sid . '/' . $site->urlencodeSEO('site_name')); return ''; } return $this->module->error('err_site') . '3'; }
public function execute() { if (false === ($this->user = GWF_Session::getUser())) { return GWF_HTML::err('ERR_LOGIN_REQUIRED'); } if (false === ($this->site = WC_Site::getByID_Class(Common::getGetString('siteid')))) { return $this->module->error('err_site'); } if (!GWF_User::isInGroupS(GWF_Group::STAFF)) { $this->module->includeClass('WC_SiteAdmin'); if (!$this->site->isSiteAdmin($this->user)) { return GWF_HTML::err('ERR_NO_PERMISSION'); } } $this->module->includeClass('WC_Warbox'); # ADD if (isset($_POST['add'])) { return $this->onAdd(); #.$this->templateOverview(); } if (isset($_GET['add'])) { return $this->templateAdd(); } # EDIT if (false !== ($boxid = Common::getGetString('edit', false))) { if (false === ($box = WC_Warbox::getByIDs($boxid, $this->site->getID()))) { return $this->module->error('err_site'); } } if (isset($_POST['flags'])) { GWF_Website::redirect($this->module->getMethodURL('Warflags', '&wbid=' . $boxid)); } if (isset($_POST['edit'])) { return $this->onEdit($box); } if (isset($_GET['edit'])) { return $this->templateEdit($box); } # OVERVIEW return $this->templateOverview(); }
public function execute() { if (false === ($mod_gb = GWF_Module::loadModuleDB('Guestbook', true))) { return GWF_HTML::err('ERR_MODULE_MISSING', array('Guestbook')); } $mod_gb instanceof Module_Guestbook; $user = GWF_Session::getUser(); if (!$mod_gb->canCreateGuestbook($user)) { return $this->module->error('err_create_gb'); } if (false !== ($gb = $mod_gb->getGuestbook($user->getID()))) { GWF_Website::redirect($gb->hrefEdit()); return ''; // return $this->module->error('err_have_gb'); } $options = GWF_Guestbook::DEFAULT_OPTIONS; $gb = new GWF_Guestbook(array('gb_uid' => $user->getID(), 'gb_title' => $user->getVar('user_name') . 's Guestbook', 'gb_descr' => $user->getVar('user_name') . 's Guestbook', 'gb_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'gb_options' => $options)); if (false === $gb->insert()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->module->message('msg_created_gb', array(GWF_WEB_ROOT . 'guestbook/edit/' . $gb->getID())); }
public function execute(GWF_Module $module) { $url = Common::getGet('url', GWF_Session::getLastURL()); switch (Common::getGet('level')) { case '1': if (GWF_Session::haveCookies() === true) { GWF_Website::redirectBack(); } elseif ($module->cfgFallbackSessions()) { GWF_Session::createFallback($url); GWF_Website::redirect(GWF_WEB_ROOT . 'index.php?mo=GWF&me=CookieCheck&level=2&url=' . urlencode($url)); } else { GWF_Website::redirect($url); } break; case '2': // var_dump($_SERVER); GWF_Website::redirect($url); break; default: return GWF_HTML::err('ERR_PARAMETER', array(__FILE__, __LINE__, 'level')); } }
public function execute() { if (isset($_POST['delete'])) { die(GWF_Website::redirect($this->module->getMethodURL('Delete'))); } if (false !== Common::getPost('drop_avatar')) { return $this->onDeleteAvatar() . $this->templateForm(); } if (false !== Common::getPost('change')) { return $this->onChange() . $this->templateForm(); } if (false !== Common::getPost('approvemail')) { return $this->onApproveMail() . $this->templateForm(); } if (false !== Common::getPost('setup_gpg')) { return $this->onSetupGPG() . $this->templateForm(); } if (false !== Common::getPost('remove_gpg')) { return $this->onRemoveGPG() . $this->templateForm(); } return $this->templateForm(); }
private function onLoggedIn(GWF_User $user, $isAjax) { $last_url = GWF_Session::getLastURL(); if (false === GWF_Session::onLogin($user, isset($_POST['bind_ip']))) { return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } require_once GWF_CORE_PATH . 'module/Login/GWF_LoginHistory.php'; GWF_LoginHistory::insertEvent($user->getID()); # save last login time $user->saveVar('user_lastlogin', time()); if ($this->module->cfgCleanupAlways()) { GWF_LoginFailure::cleanupUser($user->getID()); } if ($isAjax) { return sprintf('1:%s', GWF_Session::getSessID()); } else { GWF_Session::set('GWF_LOGIN_BACK', $last_url); if (false !== ($lang = $user->getLanguage())) { GWF_Language::setCurrentLanguage($lang); } if (0 < ($fails = GWF_LoginFailure::getFailCount($user, $this->module->cfgTryExceed()))) { GWF_Session::set('GWF_LOGIN_FAILS', $fails); } GWF_Website::redirect(GWF_WEB_ROOT . 'welcome'); } }
private function create() { if (false === ($this->rec = GWF_User::getByName(Common::getPost('username'))) && false === ($this->rec = GWF_User::getByName(Common::getPost('username_sel')))) { return GWF_HTML::err('ERR_UNKNOWN_USER') . $this->module->requestMethodB('Overview'); } GWF_Website::redirect(GWF_WEB_ROOT . 'pm/send/to/' . $this->rec->urlencode('user_name')); die; }
private function checkSuperuserPassword() { if ($this->cfgHasPassword()) { if (!$this->isSuperuser()) { if (!$this->isMethodSelected('Superuser')) { GWF_Website::redirect($this->getSuperuserBlockURL()); return false; } } } return true; }