Пример #1
0
 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();
 }
Пример #2
0
 public function execute()
 {
     GWF_Website::plaintext();
     GWF3::setConfig('store_last_url', false);
     $lat = $this->module->lat();
     $lon = $this->module->lon();
     $descr = trim(Common::getGetString('pp_descr'));
     $descr = $descr === '' ? null : $descr;
     $id = Common::getGetInt('pp_id', 0);
     $user = GWF_User::getStaticOrGuest();
     $uid = $user->getID();
     if (!GWF_ProfilePOI::changeAllowed($id, $uid)) {
         $this->module->ajaxError('Permission error!');
     }
     $count = $id === 0 ? GWF_ProfilePOI::getPOICount($uid) : 0;
     $max_pois = $this->module->cfgAllowedPOIs();
     if ($count >= $max_pois) {
         $this->module->ajaxErr('err_poi_exceed');
     }
     $poi = new GWF_ProfilePOI(array('pp_id' => $id, 'pp_uid' => $uid, 'pp_lat' => $lat, 'pp_lon' => $lon, 'pp_descr' => $descr));
     $poi->replace();
     $data = $poi->getGDOData();
     $data['user_name'] = $user->getVar('user_name');
     die(json_encode($data));
 }
Пример #3
0
 public function execute()
 {
     $user = GWF_User::getStaticOrGuest();
     GWF_Website::addJavascriptInline($this->getInlineJS($user));
     $tVars = array('worlds' => $this->getWorlds($user));
     GWF3::setDesign('jqmsl4');
     return $this->module->template('shadowclient.tpl', $tVars);
 }
Пример #4
0
 private function getData()
 {
     $table = GDO::table('WC_Warflags');
     $by = Common::getGetString('by', 'wf_order');
     $dir = Common::getGetString('dir', 'ASC');
     $orderby = $table->getMultiOrderby($by, $dir);
     return WC_Warflag::getForBoxAndUser($this->box, GWF_User::getStaticOrGuest(), $orderby);
 }
Пример #5
0
 private function onJoin($array)
 {
     if (false !== ($error = GWF_Form::validateCSRF_WeakS())) {
         return GWF_HTML::error('Join Group', $error);
     }
     if (false === ($group = GWF_Group::getByID(key($array)))) {
         return $this->module->error('err_unk_group');
     }
     return $this->module->getMethod('Join')->onQuickJoin($group, GWF_User::getStaticOrGuest());
 }
Пример #6
0
 public function templateVotes(WC_Challenge $chall)
 {
     $user = GWF_User::getStaticOrGuest();
     $userid = $user->getID();
     $has_solved = WC_ChallSolved::hasSolved($userid, $chall->getID());
     Module_WeChall::includeForums();
     $form_vote = $this->getFormVote($chall, $has_solved, $userid);
     $tVars = array('chall' => $chall, 'has_solved' => $has_solved, 'form_vote' => $form_vote->templateX($this->module->lang('ft_vote_chall', array($chall->display('chall_title')))));
     return $this->module->templatePHP('chall_votes.php', $tVars);
 }
Пример #7
0
 public function execute()
 {
     $module = $this->module;
     $module instanceof Module_PageBuilder;
     $user = GWF_User::getStaticOrGuest();
     GWF_Website::setMetaTags($module->lang('mt_overview'));
     GWF_Website::setMetaDescr($module->lang('md_overview'));
     GWF_Website::setPageTitle($module->lang('overview_title'));
     $tVars = array('add_perms' => $module->isAuthor($user), 'add_guest' => $module->cfgLockedPosting(), 'href_add' => GWF_WEB_ROOT . 'index.php?mo=PageBuilder&me=Add', 'href_search' => GWF_WEB_ROOT . 'index.php?mo=PageBuilder&me=Search');
     return $this->module->template('overview.tpl', $tVars);
 }
Пример #8
0
 public function execute()
 {
     GWF3::setConfig('log_request', false);
     $back = array();
     $user = GWF_User::getStaticOrGuest();
     $back['news'] = (int) $this->module->getNewsCount();
     $back['pm'] = (int) WC_HTML::getUnreadPMCount($user);
     $back['links'] = (int) WC_HTML::getUnreadLinksCount($user);
     $back['forum'] = (int) WC_HTML::getUnreadThreadCount($user);
     return json_encode($back);
 }
Пример #9
0
 private function templateShowLyrics(Slay_Song $song)
 {
     $sid = $song->getID();
     $user = GWF_User::getStaticOrGuest();
     $staff = $user->isStaff();
     $table = GDO::table('Slay_Lyrics');
     $perm = $staff ? '' : ' AND ssl_options&' . Slay_Lyrics::ENABLED;
     $where = "ssl_sid={$sid}{$perm}";
     $tVars = array('song' => $song, 'lyrics' => $table->selectAll('*', $where, 'ssl_date ASC', array('user'), -1, -1, GDO::ARRAY_O), 'is_admin' => $staff);
     return $this->module->template('lyrics.tpl', $tVars);
 }
Пример #10
0
 public function templateSiteDetail(WC_Site $site)
 {
     $this->module->includeVotes();
     //		$this->module->includeForums();
     //		GWF_Module::loadModuleDB('Forum', true, true);
     //		GWF_ForumBoard::init(true, true);
     //		GWF_Module::loadModuleDB('Votes', true);
     $time = $this->module->cfgLastPlayersTime();
     $tVars = array('site' => $site, 'boxcount' => $site->getBoxCount(), 'descr' => WC_SiteDescr::getDescription($site->getID()), 'site_quickjump' => $this->module->templateSiteQuickjumpDetail(), 'latest_players_time' => GWF_Time::humanDuration($time), 'latest_players' => $this->getLatestPlayers($time, $site->getID()), 'jquery' => Common::getGet('ajax') !== false, 'can_vote' => $site->canVote(GWF_User::getStaticOrGuest()));
     $ajax = isset($_GET['ajax']) ? '_ajax' : '';
     return $this->module->templatePHP('site_detail' . $ajax . '.php', $tVars);
 }
Пример #11
0
 private function templatePlaces()
 {
     GWF_Website::addJavascript($this->googleMapsPath());
     GWF_Website::addJavascript(GWF_WEB_ROOT_NO_LANG . 'js/module/Profile/profile.js?v=57');
     // 		GWF_Website::addJavascript(GWF_WEB_ROOT_NO_LANG.'js/3p/fancybox/jquery.fancybox.pack.js');
     // 		GWF_Website::addCSS(GWF_WEB_ROOT_NO_LANG.'js/3p/fancybox/jquery.fancybox.css');
     // 		GWF_Website::addCSS(GWF_WEB_ROOT_NO_LANG.'css/profile_poi.css');
     $user = GWF_User::getStaticOrGuest();
     $userid = $user->getID();
     $table = GDO::table('GWF_ProfilePOI');
     $tVars = array('user_id' => $userid, 'is_admin' => $user->isAdmin() ? 'true' : 'false', 'total' => $table->countRows(), 'visible' => $table->countRows(GWF_ProfilePOI::wherePermissions(), array('users', 'profiles', 'whitelist')), 'js_trans' => $this->jsTrans(), 'form_delete' => $this->formDelete(), 'pois' => GWF_ProfilePOI::getPOICount($userid), 'maxp' => $this->module->cfgAllowedPOIs(), 'api_key' => $this->module->cfgMapsApiKey(), 'protocol' => Common::getProtocol(), 'init_lat' => 0, 'init_lon' => 0);
     return $this->module->templatePHP('places.php', $tVars);
 }
Пример #12
0
 private function form(GWF_User $user)
 {
     $u = GWF_User::getStaticOrGuest();
     $data = array();
     if ('' === ($email = $u->getValidMail())) {
         $data['email'] = array(GWF_Form::STRING, $u->getValidMail(), $this->module->lang('th_user_email'));
     }
     $data['message'] = array(GWF_Form::MESSAGE, '', $this->module->lang('th_message'));
     if ($u->isGuest()) {
         $data['captcha'] = array(GWF_Form::CAPTCHA);
     }
     $data['send'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_sendmail'));
     return new GWF_Form($this, $data);
 }
Пример #13
0
 private function getForm($row)
 {
     $user = GWF_User::getStaticOrGuest();
     if ($row === false) {
         $email = $user->getValidMail();
         $type = 0;
         $langid = GWF_Language::getCurrentID();
     } else {
         $email = $row->getEMail();
         $type = $row->getType();
         $langid = $row->getLangID();
     }
     $data = array('email' => array(GWF_Form::STRING, $email, $this->module->lang('th_email')), 'type' => array(GWF_Form::SELECT, GWF_Newsletter::getTypeSelectB($this->module, 'type', $type), $this->module->lang('th_type')), 'langid' => array(GWF_Form::SELECT, GWF_LangSelect::single(GWF_Language::SUPPORTED, 'langid', $langid), $this->module->lang('th_langid')), 'sign' => array(GWF_Form::SUBMIT, $this->module->lang('btn_sign'), ''));
     return new GWF_Form(GDO::table('GWF_Newsletter'), $data);
 }
Пример #14
0
 private function getQuickSearchTable()
 {
     $user = GWF_User::getStaticOrGuest();
     $orders = GDO::table('GWF_Order');
     $orders instanceof GWF_Order;
     $o = Common::getGet('o') !== false;
     $bit = $o ? 'o' : 't';
     $sortURL = $this->getMethodHref('&' . $bit . '=1&by=%BY%&dir=%DIR%');
     $fields = $orders->getSearchableFields($user);
     $term = Common::getRequestString('term', '');
     // 		var_dump($fields, $term);
     if (false === ($conditions = GWF_QuickSearch::getQuickSearchConditions($orders, $fields, $term))) {
         $conditions = '0';
     }
     return GWF_TableGDO::display($this->module, $orders, $user, $sortURL, $conditions, 25, true);
 }
Пример #15
0
 public static function validateType(Module_PageBuilder $m, $arg, $locked_mode)
 {
     switch ($arg) {
         case GWF_Page::SMARTY:
         case GWF_Page::HTML:
             if ($m->isAuthor(GWF_User::getStaticOrGuest())) {
                 return false;
             }
             break;
         case GWF_Page::BBCODE:
             return false;
         default:
             break;
     }
     return $m->lang('err_type');
 }
Пример #16
0
 private function templateTermine()
 {
     $l = new GWF_LangTrans($this->module->getModuleFilePath('lang/termine'));
     GWF_Website::setPageTitle($l->lang('page_title'));
     $termine = GDO::table('Konzert_Termin');
     $where = 'kt_options&1';
     $by = Common::getGetString('by', self::DEFAULT_BY);
     $dir = Common::getGetString('dir', self::DEFAULT_DIR);
     $orderby = $termine->getMultiOrderby($by, $dir);
     $nItems = $termine->countRows($where);
     $nPages = GWF_PageMenu::getPagecount(self::IPP, $nItems);
     $page = Common::clamp(Common::getGetInt('page'), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, self::IPP);
     $tVars = array('l' => $l, 'href_admin' => $this->module->getMethodURL('AdminTermine'), 'user' => GWF_User::getStaticOrGuest(), 'termine' => $termine->selectObjects('*', $where, $orderby, self::IPP, $from), 'pagemenu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'index.php?mo=Konzert&me=Termine&by=' . urlencode($by) . '&dir=' . urlencode($dir) . '&page=%PAGE%'), 'sort_url' => GWF_WEB_ROOT . 'index.php?mo=Konzert&me=Termine&by=%BY%&dir=%DIR%&page=1');
     return $this->module->template('termine.tpl', $tVars);
 }
Пример #17
0
 public function execute()
 {
     if (false === ($chall = WC_Challenge::getByID(Common::getGetString('cid')))) {
         return $this->module->error('err_chall');
     }
     $user = GWF_User::getStaticOrGuest();
     $token = Common::getGetString('token');
     $length = Common::clamp(Common::getGetInt('length'), 1);
     require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php';
     require_once GWF_CORE_PATH . 'module/WeChall/WC_MathChall.php';
     if (!WC_ChallSolved::hasSolved($user->getID(), $chall->getID())) {
         if (!WC_MathChall::checkToken($chall, $length, $token)) {
             return $this->module->error('err_token');
         }
     }
     return $this->templateSolutions($chall, $user, $length, $token);
 }
Пример #18
0
function ttr2_request(WC_Challenge $chall, GWF_Form $form)
{
    if (false !== ($errors = $form->validate($chall))) {
        return $errors;
    }
    # Generate reset token
    $sid = GWF_Session::getSessSID();
    $email = $form->getVar('email');
    $token = ttr2_random(16);
    if (!TTR2_Tokens::insertToken($sid, $email, $token)) {
        return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
    }
    # If it's your own real mail, even send it for the lulz :)
    if ($email === GWF_User::getStaticOrGuest()->getValidMail()) {
        ttr2_mail_me($chall, $email, $token);
    }
    return GWF_HTML::message($chall->lang('title'), $chall->lang('msg_mail_sent'));
}
Пример #19
0
 public static function wherePermissions()
 {
     $user = GWF_User::getStaticOrGuest();
     if ($user->isAdmin()) {
         return '1';
     }
     $uid = $user->getID();
     $level = $user->getLevel();
     $whitelist = GDO::table('GWF_ProfilePOIWhitelist')->getTableName();
     $white_on = GWF_Profile::POI_WHITELIST;
     $user_deleted = GWF_User::DELETED;
     $whereown = "pp_uid={$uid}";
     $whereguest = "pp_uid=0";
     $wherealive = "(pp_uid=0 OR (user_options&{$user_deleted}=0))";
     $wherescore = "prof_options&{$white_on}=0 AND prof_poi_score<={$level}";
     $wherewhite = "prof_options&{$white_on} AND (SELECT 1 FROM {$whitelist} WHERE pw_uida=pp_uid AND pw_uidb={$uid})";
     return "{$wherealive} AND ({$whereguest} OR {$whereown} OR {$wherescore} OR {$wherewhite})";
 }
Пример #20
0
function sidologyRemixCheckAnswer(WC_Challenge $chall, $answer)
{
    if (false !== ($error = $chall->isAnswerBlocked(GWF_User::getStaticOrGuest()))) {
        echo $error;
        return;
    }
    $solution = '726f3a30c8ae485b4f34d5ff0fed05552d3da60b';
    # :) HappyCracking!
    $hash = $answer;
    for ($i = 0; $i < 100000; $i++) {
        $hash = sha1($hash);
    }
    // 	echo "$hash<br/>\n";
    if ($hash === $solution) {
        $chall->onChallengeSolved();
    } else {
        echo WC_HTML::error('err_wrong');
    }
}
Пример #21
0
function ttr2_submit(WC_Challenge $chall)
{
    if ('' === ($answer = Common::getPostString('answer', ''))) {
        return;
    }
    $sessid = GWF_Session::getSessSID();
    # First check all "custom" solutions
    $solutions = TTR2_Tokens::getSolutions($sessid);
    foreach ($solutions as $solution) {
        if ($solution['ttr_token'] === $answer) {
            echo GWF_HTML::message($chall->lang('title'), $chall->lang('msg_reset_own', array(htmlspecialchars($solution['ttr_email']))));
            return;
        }
    }
    # Now lets check "THE" solution
    $solution = TTR2_Tokens::getSolution($sessid);
    $chall->setSolution($solution['ttr_token']);
    $chall->onSolve(GWF_User::getStaticOrGuest(), $answer);
}
Пример #22
0
 public function execute()
 {
     $back = 'Request headers:<ul>' . PHP_EOL;
     foreach (apache_request_headers() as $key => $v) {
         $back .= sprintf('<li>%s: %s</li>' . PHP_EOL, htmlspecialchars($key), htmlspecialchars($v));
     }
     $back .= '</ul><br/><br/><ul>Response Headers:<ul>' . PHP_EOL;
     foreach (apache_response_headers() as $key => $v) {
         $back .= sprintf('<li>%s: %s</li>' . PHP_EOL, htmlspecialchars($key), htmlspecialchars($v));
     }
     $back .= '</ul>' . PHP_EOL;
     if (GWF_User::getStaticOrGuest()->isAdmin()) {
         $back .= '<br/><br/>$_SERVER variables:<ul>';
         foreach ($_SERVER as $key => $v) {
             $back .= sprintf('<li>%s: %s</li>' . PHP_EOL, htmlspecialchars($key), htmlspecialchars($v));
         }
         $back .= '</ul>';
     }
     return $back;
 }
Пример #23
0
 public static function multi($name, $selected = true, $allow_empty = true, $own_groups_only = true)
 {
     $user = GWF_User::getStaticOrGuest();
     if (false === ($groups = GDO::table('GWF_Group')->select('group_id, group_name'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if ($selected === true) {
         $selected = Common::getPostArray($name, array());
     }
     $data = array();
     if ($allow_empty) {
         $data[] = array('0', GWF_HTML::lang('sel_group'));
     }
     while (false !== ($group = GDO::table('GWF_Group')->fetch($groups, GDO::ARRAY_N))) {
         if ($own_groups_only && !$user->isInGroupName($group[1])) {
             continue;
         }
         $data[] = $group;
     }
     return GWF_Select::multi($name, $data, $selected);
 }
Пример #24
0
 private function sanitize()
 {
     if (!GWF_User::isLoggedIn() && !$this->module->cfgGuestPMs()) {
         return GWF_HTML::err('ERR_LOGIN_REQUIRED');
     }
     $this->user = GWF_User::getStaticOrGuest();
     if ($this->user->isBot()) {
         return $this->module->error('err_bot');
     }
     if (false !== ($uname = Common::getGet('to'))) {
         if (false === ($this->rec = GWF_User::getByName($uname)) || $this->rec->isDeleted()) {
             return GWF_HTML::err('ERR_UNKNOWN_USER');
         }
     }
     if (false !== ($pmid = Common::getGetString('reply', false))) {
         if (false === ($pm = GWF_PM::getByID($pmid))) {
             return $this->module->error('err_pm');
         }
         $this->rec = $pm->getSender();
     }
     if (false !== ($pmid = Common::getGetString('quote', false))) {
         if (false === ($pm = GWF_PM::getByID($pmid))) {
             return $this->module->error('err_pm');
         }
         $this->rec = $pm->getSender();
     }
     if ($this->rec === false) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if (false !== ($error = $this->module->validate_limits($this->user, $this->rec))) {
         return GWF_HTML::error('PM', $error);
     }
     if ($this->rec === false) {
         $pmid = max(Common::getGetInt('reply'), Common::getGetInt('quote'));
         if (false !== ($error = $this->sanitizePM($pmid))) {
             return $error;
         }
     }
     return false;
 }
Пример #25
0
 private function profile(GWF_User $user)
 {
     if (false === ($profile = GWF_Profile::getProfile($user->getID()))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     $watcher = GWF_User::getStaticOrGuest();
     if ($profile->isRobotHidden() && $watcher->isWebspider()) {
         return $this->module->error('err_no_spiders');
     }
     if (false === ($prof_view = GWF_Session::getOrDefault('prof_view', false))) {
         $prof_view = array();
     }
     $uid = $user->getID();
     if (!in_array($uid, $prof_view, true)) {
         $prof_view[] = $uid;
         if (false === $profile->increase('prof_views', 1)) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
     }
     GWF_Session::set('prof_view', $prof_view);
     $tVars = array('user' => $user, 'profile' => $profile, 'jquery' => Common::getGet('ajax') !== false);
     return $this->module->templatePHP('profile.php', $tVars);
 }
Пример #26
0
 public function onQuickSearch($term)
 {
     $posts = GDO::table('GWF_ForumPost');
     $fields = $posts->getSearchableFields(GWF_User::getStaticOrGuest());
     $_GET['term'] = $term = trim($term);
     //		$term = Common::getRequest('term', '');
     if (false === ($conditions = GWF_QuickSearch::getQuickSearchConditions($posts, $fields, $term))) {
         $conditions = '0';
     }
     $permQuery = GWF_ForumPost::getPermQuery();
     $conditions .= ' AND (' . $permQuery . ')';
     $by = Common::getGet('by', 'post_date');
     $dir = Common::getGet('dir', 'DESC');
     $orderby = $posts->getMultiOrderby($by, $dir);
     $ipp = $this->module->getThreadsPerPage();
     $nItems = $posts->countRows($conditions);
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     $page = Common::clamp(Common::getGet('page', 1), 1, $nPages);
     $href = $this->getMethodHref(sprintf('&term=%s&by=%s&dir=%s&page=%%PAGE%%', urlencode($term), urlencode($by), urlencode($dir)));
     $this->pagemenu = GWF_PageMenu::display($page, $nPages, $href);
     $result = GWF_QuickSearch::search($posts, $fields, $term, $orderby, $ipp, GWF_PageMenu::getFrom($page, $ipp), $permQuery);
     $this->sortURL = $this->getMethodHref(sprintf('&term=%s&by=%%BY%%&dir=%%DIR%%&page=1', urlencode($term)));
     return $this->templateSearch($result, $term);
 }
Пример #27
0
 public function showPage(GWF_Page $page)
 {
     $page->increase('page_views', 1);
     $robot = $page->isOptionEnabled(GWF_PAGE::INDEXED) ? 'index,' : 'noindex,';
     $robot .= $page->isOptionEnabled(GWF_PAGE::FOLLOW) ? 'follow' : 'nofollow';
     GWF_Website::addMeta(array('robots', $robot, 0), true);
     GWF_Website::setMetaDescr($page->getVar('page_meta_desc'));
     GWF_Website::setMetaTags($page->getVar('page_meta_tags'));
     GWF_Website::setPageTitle($page->getVar('page_title'));
     GWF_Website::addInlineCSS($page->getVar('page_inline_css'));
     $translations = $this->getPageTranslations($page);
     $user = GWF_User::getStaticOrGuest();
     $tVars = array('page' => $page, 'page_views' => $page->getVar('page_views'), 'title' => $page->display('page_title'), 'author' => $page->display('page_author_name'), 'created' => GWF_Time::displayDate($page->getVar('page_create_date')), 'modified' => GWF_Time::displayDate($page->getVar('page_date')), 'content' => $this->getPageContent($page), 'comments' => $this->getPageComments($page), 'form_reply' => $this->getPageCommentsForm($page), 'pagemenu' => $this->getPagemenuComments($page), 'translations' => $translations, 'trans_string' => $this->getPageTranslationsString($page, $translations), 'similar' => $this->getSimilarPages($page), 'edit_permission' => $page->isOwner($user) || $this->module->isAuthor($user));
     return $this->module->template('show_page.tpl', $tVars);
 }
Пример #28
0
 /**
  * Initialize by ConfigOptions
  * @return GWF3 
  */
 public function init()
 {
     $config =& self::$CONFIG;
     if (true === $config['start_debug']) {
         GWF_Debug::enableErrorHandler();
         GWF_Debug::setMailOnError((GWF_DEBUG_EMAIL & 2) > 0);
     }
     if (true === $config['kick_banned_ip']) {
         $this->onKickBannedIP();
     }
     if (true === defined('GWF_WEBSITE_DOWN')) {
         $this->setConfig('load_module', false);
         $this->setConfig('autoload_modules', false);
         $this->setConfig('no_session', true);
     }
     // 		$db = gdo_db();
     if (false === $config['no_session']) {
         $this->onStartSession($config['blocking']);
     }
     if (true === $config['website_init']) {
         $db = gdo_db();
         GWF_Website::init();
     }
     if (true === $config['do_logging']) {
         $this->onStartLogging($config['no_session']);
     }
     if (true === $config['autoload_modules']) {
         $this->onAutoloadModules();
     }
     if (true === $config['get_user']) {
         GWF_Template::addMainTvars(array('user' => self::$user = GWF_User::getStaticOrGuest()));
     }
     if (true === $config['load_module']) {
         $this->onLoadModule();
     }
     if (true === defined('GWF_WEBSITE_DOWN')) {
         die($this->onDisplayPage(GWF_WEBSITE_DOWN));
     }
     return $this;
 }
Пример #29
0
 private function onTranslate(GWF_Page $page)
 {
     $form = $this->formTranslate($page);
     if (false !== ($error = $form->validate($this->module))) {
         return $error;
     }
     $options = 0;
     $options |= GWF_Page::ENABLED;
     $options |= GWF_Page::TRANSLATION;
     $options |= $page->isLoginRequired() ? GWF_Page::LOGIN_REQUIRED : 0;
     $options |= $this->locked_mode ? GWF_Page::LOCKED : 0;
     $options |= $page->getMode();
     $options |= $page->getShowFlags();
     $gstring = $page->getVar('page_groups');
     $tags = ',' . trim(trim($form->getVar('tags')), ',') . ',';
     $author = GWF_User::getStaticOrGuest();
     $time = time();
     $date = GWF_Time::getDate(GWF_Time::LEN_SECOND, $time);
     $newpage = new GWF_Page(array('page_id' => '0', 'page_otherid' => $page->getID(), 'page_lang' => $form->getVar('lang'), 'page_author' => $author->getID(), 'page_author_name' => $author->getVar('user_name'), 'page_groups' => $gstring, 'page_create_date' => $date, 'page_date' => $date, 'page_time' => $time, 'page_url' => $form->getVar('url'), 'page_title' => $form->getVar('title'), 'page_cat' => '0', 'page_meta_tags' => $tags, 'page_meta_desc' => $form->getVar('descr'), 'page_content' => $form->getVar('content'), 'page_views' => '0', 'page_options' => $options, 'page_inline_css' => $page->getVar('page_inline_css')));
     if (false === $newpage->insert()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     // 		if (false === GWF_PageGID::updateGIDs($newpage, $gstring))
     // 		{
     // 			return GWF_HTML::err('ERR_DATABASE', array(__FILE__,__LINE__));
     // 		}
     if (false === GWF_PageTags::updateTags($newpage, $tags, $form->getVar('lang'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $this->module->writeHTA()) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     if ($this->locked_mode) {
         $this->module->sendModMails();
         return $this->module->message('msg_added_locked');
     }
     if (false === GWF_PageHistory::push($newpage)) {
         GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_trans');
 }
Пример #30
0
<?php

$username = GWF_User::getStaticOrGuest()->displayUsername();
echo sprintf('Hello %s, welcome to the news page.', $username);