public function execute() { if (false === ($mod_pay = GWF_Module::getModule('Payment'))) { return GWF_HTML::err('ERR_MODULE_MISSING', array('Payment')); } // INIT $isAdmin = GWF_User::isAdminS(); $modules = GWF_Module::loadModulesFS(); foreach ($modules as $i => $m) { if (!$isAdmin) { if ($m->getPrice() > 100000) { unset($modules[$i]); } } } GWF_Module::sortModules($modules, 'module_name', 'asc'); $this->modules = $modules; // Modules to purchase if (false !== Common::getPost('on_order_2_x')) { return $this->onOrder(); } // Actions if (Common::getPost('purchase')) { return $this->onPurchase(); } if (false !== Common::getGet('zipper')) { return $this->onZip(); } return $this->templatePurchase(); }
/** * @return Module_Forum */ public static function getInstance() { static $instance = true; if ($instance === true) { $instance = GWF_Module::getModule('Forum'); } return $instance; }
private static function includeClasses() { $module = GWF_Module::getModule('Forum'); $classnames = array(); foreach ($classnames as $classname) { $module->includeClass($classname); } }
public function displayLang() { # FIXME: page_lang not assigned //if (false === ($lang = GWF_Language::getByID($this->getVar('page_lang')))) { if (false === ($lang = GWF_Language::getByID(1))) { return GWF_Module::getModule('PageBuilder')->lang('lang_all'); } return $lang->displayName(); }
public static function validate($name, $value, $allow_blank) { if ($allow_blank && !$value) { return false; } if (in_array($value, Slay_Song::$KEYS, true)) { return false; } unset($_POST[$name]); return GWF_Module::getModule('Slaytags')->lang('err_key'); }
public static function convert(GWF_User $user, $password) { if (false === ($row = self::table(__CLASS__)->getRow($user->getID()))) { return true; } $oldHash = self::oldHash($password); if ($oldHash !== $row->getVar('pmap_password')) { return GWF_Module::getModule('WeChall')->error('err_password'); } $row->delete(); $user->saveVar('user_password', GWF_Password::hashPasswordS($password)); return true; }
private function onMove($modulename) { $modules = GWF_Module::getModules(); usort($modules, array(__CLASS__, 'sortByPriority')); $mode = $this->getMoveMode(); if (false === ($current = GWF_Module::getModule($modulename))) { return $this->module->error('err_mod_not_installed'); } $order = array('first' => false, 'prev' => false, 'curr' => $current, 'next' => false, 'last' => false); $curr = $current; $prev = $current; $realprev = false; $priority = 1; foreach ($modules as $m) { if ($order['first'] === false) { $order['first'] = $m; } $prev = $curr; $curr = $m; if ($curr->getName() == $modulename) { $realprev = $prev; } if ($prev->getName() === $modulename) { $order['next'] = $m; } $m->saveVar('module_priority', $priority++); } $order['prev'] = $prev; $order['last'] = $curr; switch ($mode) { case self::$MOVE_UP: $exchange = $order['prev']; break; case self::$MOVE_DOWN: $exchange = $order['next']; break; case self::$MOVE_FIRST: $exchange = $order['first']; break; case self::$MOVE_LAST: $exchange = $order['last']; break; default: die('F****D UP!'); } $this->switchPriority($current, $exchange); $_GET['by'] = 'module_priority'; $_GET['dir'] = 'ASC'; return $this->module->requestMethodB('Modules'); }
public function execute() { # SEO GWF_Website::setMetaTags($this->module->lang('mt_list')); GWF_Website::setMetaDescr($this->module->lang('md_list')); GWF_Website::setPageTitle($this->module->lang('pt_list')); $user = GWF_Session::getUser(); # Permission // if ((false === ($user = GWF_Session::getUser())) && (!$this->module->cfgAnonDown())) { // return GWF_HTML::err('ERR_NO_PERMISSION'); // } if (false !== ($mod_pay = GWF_Module::getModule('Payment'))) { $mod_pay->onInclude(); } return $this->templateList($user); }
private function getPollSelect() { if (false === ($mv = GWF_Module::getModule('Votes'))) { return GWF_HTML::lang('ERR_MODULE_MISSING', array('Votes')); } $uid = GWF_Session::getUserID(); if (false === ($polltable = GDO::table('GWF_VoteMulti'))) { return GWF_HTML::lang('ERR_MODULE_MISSING', array('Votes')); } $polls = $polltable->selectAll('vm_id, vm_title', "vm_uid={$uid}", 'vm_title ASC', NULL, -1, -1, GDO::ARRAY_N); $data = array(array('0', $this->module->lang('sel_poll'))); foreach ($polls as $poll) { $data[] = $poll; // $data[] = $poll;array($poll[0], $poll->getVar('vm_title'), ); } return GWF_Select::display('pollid', $data, Common::getPostString('pollid', '0')); }
public function execute() { if (false !== ($mod_forum = GWF_Module::getModule('Forum', true))) { $mod_forum->onInclude(); GWF_ForumBoard::init(false); } if (false !== Common::getPost('quicktranslate')) { return $this->onQuickTranslate(); } $newsid = (int) Common::getGet('newsid', '0'); $langid = (int) Common::getGet('langid', '0'); if (false === ($news = GWF_News::getNewsItem($newsid))) { return $this->module->error('err_news'); } // if (false === ($news->loadTranslations())) { // return GWF_HTML::err('ERR_UNKNOWN_LANGUAGE'); // } if (false === ($lang = GWF_Language::getByID($langid))) { return GWF_HTML::err('ERR_UNKNOWN_LANGUAGE'); } if (!GWF_Language::isSupported($langid)) { return GWF_HTML::err('ERR_UNKNOWN_LANGUAGE'); } $this->news = $news; $this->lang = $lang; if (false !== Common::getPost('edit')) { return $this->onEdit() . $this->templateEdit(); } if (false !== Common::getPost('translate')) { return $this->onTranslate(); } if (false !== Common::getPost('preview')) { return $this->onPreview(); } return $this->templateEdit(); }
public function saveModuleVar($key, $value) { if (false === parent::saveModuleVar($key, $value)) { return false; } if ($key === 'dl_gvotes') { if (false === ($mod_vote = GWF_Module::getModule('Votes'))) { return true; } $mod_vote->onInclude(); $guest_votes = GWF_VoteScore::GUEST_VOTES; switch ($value) { case 'YES': if (false === GDO::table('GWF_VoteScore')->update("vs_options=vs_options|{$guest_votes}", "vs_name LIKE 'dl_%' ")) { return false; } break; case 'NO': if (false === GDO::table('GWF_VoteScore')->update("vs_options=vs_options-{$guest_votes}", "vs_options&{$guest_votes} AND vs_name LIKE 'dl_%' ")) { return false; } break; default: var_dump(sprintf('Error: Module_Download::saveModuleVar(%s, %s): ', $key, $value)); break; } } return true; }
private static function fix_missing_site_threads(GDO_Database $db_from, GDO_Database $db_to, array &$db_offsets) { GDO::setCurrentDB($db_to); $table = GDO::table('WC_Site'); $module = GWF_Module::getModule('WeChall'); // Boards // if (false === ($result = $table->select('*'))) // { // echo GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); // return false; // } // while (false !== ($site = $table->fetch($result, GDO::ARRAY_O))) // { // $site instanceof WC_Site; // if (false === GDO::table('GWF_ForumBoard')->select('1', "board_id={$site->getBoardID()}")) // { // GWF_Cronjob::notice(sprintf('Site %s has no board!', $site->getClassName())); // $site->onCreateBoard(); // } // } // $table->free($result); // Threads if (false === ($result = $table->select('*'))) { echo GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); return false; } while (false !== ($site = $table->fetch($result, GDO::ARRAY_O))) { $site instanceof WC_Site; if (false === $site->getThread()) { GWF_Cronjob::notice(sprintf('Site %s has no thread!', $site->getClassName())); $site->onCreateThread($module); } } $table->free($result); }
<?php echo WC_HTML::accountButtons(); ?> <?php $user = GWF_Session::getUser(); if (false !== ($mod_gb = GWF_Module::getModule('Guestbook'))) { $mod_gb->onInclude(); if (false !== ($gb = $mod_gb->getGuestbook($user->getID()))) { echo GWF_Button::generic(WC_HTML::lang('btn_manage_gb'), $gb->hrefEdit()); } elseif ($mod_gb->canCreateGuestbook($user)) { echo GWF_Button::generic(WC_HTML::lang('btn_manage_gb'), Module_WeChall::hrefCreateGB()); } } // //if (false !== ($mod_ug = GWF_Module::getModule('Usergroups'))) { // if ($mod_ug->hasGroup($user)) { // echo GWF_Button::generic(WC_HTML::lang('btn_manage_ug'), $mod_ug->hrefEdit($user->getID())); // } // elseif ($mod_ug->canCreateGroup($user)) { // echo GWF_Button::generic(WC_HTML::lang('btn_manage_ug'), $mod_ug->hrefCreate()); // } //} ?> <h1><?php echo $tLang->lang('ft_settings'); ?> </h1> <p><?php echo $tLang->lang('pi_help');
public static function displayMenu() { if (false === ($module = GWF_Module::getModule('WeChall'))) { return GWF_HTML::err('ERR_MODULE_MISSING', array('WeChall')); } $back = '<nav id="wc_menu">'; $back .= '<ul>'; $back .= self::displayMenuLangSelect($module) . PHP_EOL; $back .= self::displayMenuNews($module) . PHP_EOL; // $back .= self::displayMenuAbout($module).PHP_EOL; $back .= self::displayMenuLinks($module) . PHP_EOL; $back .= self::displayMenuSites($module) . PHP_EOL; // $back .= self::displayMenuPapers($module).PHP_EOL; $back .= self::displayMenuForum($module) . PHP_EOL; $back .= self::displayMenuRanking($module) . PHP_EOL; $back .= self::displayMenuChallenges($module) . PHP_EOL; $back .= self::displayMenuAccount($module) . PHP_EOL; $back .= self::displayMenuPM($module) . PHP_EOL; // $back .= self::displayMenuStats($module).PHP_EOL; $back .= self::displayMenuDownload($module) . PHP_EOL; // $back .= self::displayMenuChat($module).PHP_EOL; $back .= self::displayMenuGroups($module) . PHP_EOL; // $back .= self::displayMenuUserPages($module).PHP_EOL; $back .= self::displayMenuAdmin($module) . PHP_EOL; $back .= self::displayMenuLogout($module) . PHP_EOL; $back .= '</ul></nav>'; $back .= '<div class="cl"></div>'; return $back; }
public static function isBBCodeAllowedS() { return GWF_Module::getModule('Chat')->isBBCodeAllowed(); }
public static function accountButtons() { $l = GWF_Module::getModule('PoolTool')->getLanguage(); return GWF_Button::wrapStart() . GWF_Button::generic($l->lang('menu_profile'), GWF_WEB_ROOT . 'profile_settings') . GWF_Button::wrapEnd(); }
<?php chdir('../../'); apache_setenv('no-gzip', 1); ini_set('zlib.output_compression', 0); //ini_set('implicit_flush', 1); #ob_implicit_flush(); require_once 'gwf3.class.php'; GWF3::onLoadConfig(GWF_CONFIG_PATH); # Get the modules. $modules = GWF_Module::loadModulesDB(); # Start session if (false === GWF_Session::start(false)) { GWF3::LogDie('Session error. GWF not installed?'); } # Init core templates and stuff GWF_Language::init(); GWF_HTML::initCronjob(); # Yay, a http stream \o/ GWF_Javascript::streamHeader(); # Call Chat::AjaxStream if (false === ($module = GWF_Module::getModule('Chat'))) { GWF3::logDie('MISSING MODULE'); } $module->onLoadLanguage(); $module->onInclude(); $module->requestMethodB('AjaxStream');
public static function installPollTableB($user, $name, $title, array $options, $gid = 0, $level = 0, $is_multi, $guest_votes, $is_public = false, $result = GWF_VoteMulti::SHOW_RESULT_ALWAYS, $reverse = true) { if (false === ($module = GWF_Module::getModule('Votes'))) { return GWF_HTML::err('ERR_MODULE_MISSING', array('Votes')); } // Poll exists if (false !== ($poll = GWF_VoteMulti::getByName($name))) { return $module->error('err_pollname_taken'); } // View flag ok if (!GWF_VoteMulti::isValidViewFlag($result)) { return $module->error('err_multiview'); } $taken = array(); $errors = array(); foreach ($options as $i => $option) { if ('' === ($option = trim($option))) { $errors[] = $module->lang('err_option_empty', array($i + 1)); } elseif (in_array($option, $taken, true)) { $errors[] = $module->lang('err_option_twice', array(GWF_HTML::display($option))); } else { $taken[] = $option; } } if (count($taken) === 0) { $errors[] = $module->lang('err_no_options'); } if (count($errors) > 0) { return GWF_HTML::error('Votes', $errors); } $flags = 0; $flags |= GWF_VoteMulti::ENABLED; $flags |= $is_multi ? GWF_VoteMulti::MULTIPLE_CHOICE : 0; $flags |= $guest_votes ? GWF_VoteMulti::GUEST_VOTES : 0; $flags |= $is_public ? 0 : GWF_VoteMulti::INTERNAL_VOTE; $flags |= $reverse === false ? GWF_VoteMulti::IRREVERSIBLE : 0; $flags |= $result; if (false === ($poll = GWF_VoteMulti::fakePoll($name, $title, $user, $flags, $gid, $level))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (false === $poll->insertPoll($taken)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return ''; }
public function displayStatus() { return GWF_Module::getModule('Helpdesk')->lang('status_' . $this->getStatus()); }
public static function populateAll() { chdir(GWF_PATH); self::$size_unpacked = 0; self::populate('extra/font'); self::populate('core'); self::populate('www/js'); self::populate('www/tpl'); self::populate('www/img'); GWF_Module::getModule('VersionServer')->getMethod('Zipper'); foreach (VersionServer_Zipper::$protected_files as $fullpath) { self::populateFile(GWF_WWW_PATH . 'protected', $fullpath); } // foreach (VersionServer_Zipper::$protected_dirs as $fullpath) // { // self::populateRec(GWF_WWW_PATH.'protected', $fullpath); // } foreach (VersionServer_Zipper::$rootfiles as $fullpath) { self::populateFile(GWF_PATH, GWF_PATH . $fullpath); } // foreach (self::$whitelist as $data) // { // list($basedir, $modulename, $designname, $fullpath) = $data; // self::populateFile($basedir, $fullpath, $modulename, $designname); // } chdir(GWF_WWW_PATH); }
public function displayButtons() { if (false === ($module = GWF_Module::getModule('Votes'))) { return ''; } $module instanceof Module_Votes; return $module->templateVoteScore($this); }
private function leftPanelLanguage() { if (false === ($ml = GWF_Module::getModule('Language'))) { return ''; } $back = ''; $ml instanceof Module_Language; $back .= $ml->getSwitchLangSelect(); return $back; }
public function showResults($pixels = 100) { if (false === ($module = GWF_Module::getModule('Votes'))) { return GWF_HTML::err('ERR_MODULE_MISSING', array('Votes')); } $module->onLoadLanguage(); $tVars = array('form_action' => $module->getMethodURL('VotePoll'), 'poll' => $this, 'pixels' => $pixels, 'href_edit' => $this->hrefEdit()); return $module->templatePHP('poll.php', $tVars); }
echo wcProfileOwnLinks($u, $mod_links); } # Challs if (WC_Challenge::getScoreForUser($u) > 0) { Module_WeChall::includeForums(); // GWF_Module::getModule('Forum')->onInclude(); # Profile Challs $method = $wechall->getMethod('ChallsProfile'); $method instanceof WeChall_ChallsProfile; echo $method->templateChalls($u); # Created By if ($u->getID() !== '1') { $method = $wechall->getMethod('Challs'); $method instanceof WeChall_Challs; echo $method->templateChalls(false, $u->getID(), '', '', '', false, false); } } # Guestbook echo wcProfileGuestbook($u); # Groups echo wcProfileUsergroup($u, GWF_User::isLoggedIn()); GWF_Website::setPageTitle($tLang->lang('pt_profile', array($u->displayUsername()))); GWF_Website::setMetaDescr($tLang->lang('md_profile', array($u->displayUsername()))); GWF_Website::addMetaDescr(' ' . GWF_Module::getModule('WeChall')->getMethod('API_Bot')->showGlobal($u->getVar('user_name'))); //$tags = ''; //foreach ($regats as $regat) //{ // $regat instanceof WC_RegAt; // $tags .= ', '.$regat->getSite()->displayName(); //} //GWF_Website::addMetaTags($tags);
public static function getTitles() { return GWF_Module::getModule('Helpdesk')->lang('titles'); }
<?php $is_staff = $tVars['may_add']; if ($tVars['can_sign']) { echo '<div class="gwf_buttons_outer"><div class="gwf_buttons">' . GWF_Button::generic($tLang->lang('btn_sign'), $tVars['href_sign_news']) . '</div></div>'; } ?> <?php $id = 1; ?> <div class="gwf_newsbox"> <?php echo $tVars['page_menu']; if ($tVars['page'] === 1) { $wc = GWF_Module::getModule('WeChall'); echo $wc->showBirthdayNews(); echo $wc->showChallengeNews(); echo $wc->showSiteMasterNews(); echo $wc->showAccountLinkNews(); } ?> <?php foreach ($tVars['news'] as $news) { /*$news instanceof GWF_News; $t = $news->getTranslation();*/ ?> <div class="gwf_newsbox_item gwf_tr_<?php $id = 1 - $id; echo $id; ?>
function wcProfileGuestbook(GWF_User $user) { $gb = GWF_TABLE_PREFIX . 'guestbook'; $userid = $user->getID(); if (false === gdo_db()->queryFirst("SELECT 1 FROM {$gb} WHERE gb_uid={$userid} AND gb_options&1=0")) { return ''; } if (false === ($mod_gb = GWF_Module::getModule('Guestbook'))) { return ''; } $mod_gb->onInclude(); if (false === ($gb = $mod_gb->getGuestbook($userid))) { return ''; } $mod_gb->onLoadLanguage(); return $mod_gb->getMethod('Show')->templateShow($mod_gb, $gb); }
private function onOrder(GWF_Download $dl) { // Check for Payment, as it`s not a required dependency. if (false === ($mod_pay = GWF_Module::getModule('Payment'))) { return GWF_HTML::err('ERR_MODULE_MISSING', array('Payment')); } $user = GWF_User::getStaticOrGuest(); $paysite = Common::getPost('paysite', 'xx'); $dl->setVar('your_token', GWF_DownloadToken::generateToken()); return Module_Payment::displayOrder2S($this->module, $dl, $user, $paysite); }
public static function loadModulesFS() { if (false == ($files = @scandir(GWF_CORE_PATH . 'module'))) { echo GWF_HTML::err('ERR_FILE_NOT_FOUND', array('core/module')); return false; } $modules = array(); foreach ($files as $name) { if ($name[0] === '.') { continue; } if (false !== ($module = GWF_Module::getModule($name))) { continue; } if (false === ($module = self::loadModuleFS($name))) { continue; } GWF_Module::$MODULES[$name] = $module; } return GWF_Module::$MODULES; }
public function adjustFlags(GWF_Group $group) { if (false === ($mod_forum = GWF_Module::getModule('Forum'))) { return false; } $mod_forum->onInclude(); if (false === ($board = GWF_ForumBoard::getByID($group->getBoardID()))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } # Adjust Board and Thread Flags $gid = 0; $guestview = true; switch ($group->getVisibleMode()) { case GWF_Group::VISIBLE: // $board->saveVar('board_gid', 0); // $board->saveGuestView(true); // $board->saveOption(GWF_ForumBoard::GUEST_VIEW, true); // $this->adjustThreads($board, 0, true); // return false; break; case GWF_Group::COMUNITY: // $board->saveVar('board_gid', 0); // $board->saveGuestView(false); // $board->saveOption(GWF_ForumBoard::GUEST_VIEW, false); $guestview = false; break; case GWF_Group::HIDDEN: case GWF_Group::SCRIPT: // $board->saveVar('board_gid', $group->getID()); // $board->saveGuestView(false); // $board->saveOption(GWF_ForumBoard::GUEST_VIEW, false); $gid = $group->getID(); $guestview = false; break; default: return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } $board->saveGroupID($gid); $board->saveGuestView($guestview); }