Exemple #1
0
 public static function getGDOHeaders2(GWF_Module $module, GWF_Sortable $gdo, $user, $sortURL)
 {
     # Possible fields...
     $fields = $gdo->getSortableFields($user);
     # Gather the current selected sorting
     $curBy = explode(',', Common::getGet('by', ''));
     $curDir = explode(',', Common::getGet('dir', ''));
     $cur = array();
     foreach ($curBy as $i => $cby) {
         if (preg_match('/^[a-zA-Z_]+&?[0-9]*$/', $cby) !== 1) {
             continue;
         }
         if (!in_array($cby, $fields, true)) {
             continue;
         }
         //			if (false === ($cby = $gdo->getWhitelistedBy($cby, false))) {
         //				continue;
         //			}
         $cd = isset($curDir[$i]) ? $curDir[$i] : 'ASC';
         $cd = GDO::getWhitelistedDirS($cd, 'ASC');
         $cur[$cby] = $cd;
     }
     $headers = array();
     foreach ($fields as $field) {
         $curV = array_key_exists($field, $cur) ? $cur[$field] : '';
         $headers[] = array($module->lang('th_' . $field), $curV === 'ASC' ? self::getTHeadURL($sortURL, $cur, $field, 'ASC', $field) : self::getTHeadURL($sortURL, $cur, $field, 'ASC'), $curV === 'DESC' ? self::getTHeadURL($sortURL, $cur, $field, 'DESC', $field) : self::getTHeadURL($sortURL, $cur, $field, 'DESC'), $curV === 'ASC', $curV === 'DESC', $curV === '');
     }
     return $headers;
 }
Exemple #2
0
 public function execute(GWF_Module $module)
 {
     if (false === ($order = GWF_Order::getByToken(Common::getPost('gwf_token')))) {
         return $module->error('err_order');
     }
     if (!$order->isCreated()) {
         return $module->error('err_order');
     }
     return $this->onPay($module, $order);
 }
Exemple #3
0
 public static function validateCat($arg, $allowZero = true)
 {
     if ($arg == 0 && $allowZero || GWF_Category::categoryExists($arg)) {
         return false;
     }
     return GWF_Module::loadModuleDB('Cateogry', false, true)->lang('err_cat');
 }
Exemple #4
0
 public function execute(GWF_Module $module)
 {
     if (false === ($order = GWF_Order::getByToken(Common::getPost('gwf_token')))) {
         return $module->error('err_order');
     }
     if (!$order->isCreated()) {
         return $module->error('err_order');
     }
     if ($order->getOrderPriceTotal() > 0) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     if (false !== Common::getPost('pay_x')) {
         return $this->onPay($module, $order);
     }
     return $this->templatePay($module, $order);
 }
Exemple #5
0
 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();
         }
     }
 }
Exemple #6
0
 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();
 }
Exemple #7
0
 public function execute()
 {
     # Page exists?
     if (false === ($page = GWF_Page::getByID(Common::getGetString('pageid')))) {
         header($_SERVER['SERVER_PROTOCOL'] . " 404 Not Found");
         return $this->module->error('err_404');
     }
     # Have permission to see?
     if (!$this->checkPermission($page)) {
         header($_SERVER['SERVER_PROTOCOL'] . " 403 Forbidden");
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     # Load comments?
     if ($page->isOptionEnabled(GWF_Page::COMMENTS)) {
         $this->mod_c = GWF_Module::loadModuleDB('Comments', true, true);
         if (false === ($this->comments = $page->getComments())) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
         $_REQUEST['cmts_id'] = $this->comments->getID();
     }
     # Exec ...
     $back = '';
     if (isset($_POST['reply'])) {
         $back = $this->onReply($page);
     }
     return $this->showPage($page) . $back;
 }
Exemple #8
0
 private static function includeClasses()
 {
     $module = GWF_Module::getModule('Forum');
     $classnames = array();
     foreach ($classnames as $classname) {
         $module->includeClass($classname);
     }
 }
Exemple #9
0
 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();
 }
Exemple #10
0
 public function execute()
 {
     GWF_Module::loadModuleDB('Votes')->onInclude();
     if (false !== ($error = $this->sanitize())) {
         return $error;
     }
     GWF_Website::addJavascript(GWF_WEB_ROOT . 'js/module/Links/gwf_links.js');
     return $this->overview();
 }
Exemple #11
0
 public function execute()
 {
     GWF_Module::loadModuleDB('Forum', true);
     if (false !== ($array = Common::getPostArray('part'))) {
         return $this->onPart($array) . $this->templateGroups();
     }
     if (false !== ($array = Common::getPostArray('join'))) {
         return $this->onJoin($array) . $this->templateGroups();
     }
     return $this->templateGroups();
 }
Exemple #12
0
 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 function __call($name, $args)
 {
     if (false === ($mo = Common::substrUntil($name, '_'))) {
         return GWF_HTML::error('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     $me = Common::substrFrom($name, '_');
     if (false === ($module = GWF_Module::loadModuleDB($mo))) {
         return GWF_HTML::error('ERR_MODULE_MISSING', array(__FILE__, __LINE__));
     }
     return $module->execute($me);
 }
Exemple #14
0
function warscore_function($socket, $pid)
{
    # Init GWF
    $gwf = new GWF3(getcwd(), array('website_init' => false, 'autoload_modules' => false, 'load_module' => false, 'start_debug' => true, 'get_user' => false, 'log_request' => false, 'no_session' => true, 'store_last_url' => false, 'ignore_user_abort' => false));
    gdo_db();
    GWF_Debug::setDieOnError(false);
    GWF_HTML::init();
    if (false === ($wechall = GWF_Module::loadModuleDB('WeChall', true, true, true))) {
        warscore_error($socket, 'Cannot load WeChall!');
    }
    $wechall->includeClass('WC_Warbox');
    $wechall->includeClass('WC_WarToken');
    $wechall->includeClass('WC_Warflag');
    $wechall->includeClass('WC_Warflags');
    $wechall->includeClass('sites/warbox/WCSite_WARBOX');
    if (false === ($input = socket_read($socket, 2048))) {
        warscore_error($socket, 'Read Error 1!');
    }
    warscore_debug("GOT INPUT: {$input}");
    if (false === ($username = Common::substrUntil($input, "\n", false))) {
        warscore_error($socket, 'No username sent!');
    }
    if (false === ($user = GWF_User::getByName($username))) {
        warscore_error($socket, 'Unknown user!');
    }
    warscore_debug("GOT USER: {$username}");
    if ('' === ($token = Common::substrFrom($input, "\n", ''))) {
        warscore_error($socket, 'No token sent!');
    }
    $token = trim(Common::substrUntil($token, "\n", $token));
    if (!WC_WarToken::isValidWarToken($user, $token)) {
        warscore_error($socket, 'Invalid Token!');
    }
    if (!socket_getpeername($socket, $client_ip, $client_port)) {
        warscore_error($socket, 'Socket Error 2!');
    }
    echo "{$client_ip}\n";
    $boxes = WC_Warbox::getByIP($client_ip);
    if (count($boxes) === 0) {
        warscore_error($socket, 'Unknown Warbox!');
    }
    warscore_debug("GOT N BOXES: " . count($boxes));
    $curr_port = 0;
    foreach ($boxes as $box) {
        $box instanceof WC_Warbox;
        if ($curr_port !== $box->getVar('wb_port')) {
            $curr_port = $box->getVar('wb_port');
            warscore_identd($socket, $box, $user, $client_ip, $client_port);
        }
    }
    socket_write($socket, 'Bailing out! You should not see me.');
    socket_close($socket);
    die(0);
}
Exemple #15
0
 private function formEdit()
 {
     $mod_cat = GWF_Module::loadModuleDB('Category', true, true);
     $page = $this->page;
     $user = $this->user;
     $data = array();
     $data['url'] = array(GWF_Form::STRING, $page->getVar('page_url'), $this->module->lang('th_url'));
     // 		if ($this->is_author)
     // 		{
     $data['type'] = array(GWF_Form::SELECT, GWF_PageType::select($this->module, $page->getMode()), $this->module->lang('th_type'));
     // 		}
     if ($this->is_oowner) {
         $data['groups'] = array(GWF_Form::SELECT_A, GWF_GroupSelect::multi('groups', $this->getSelectedGroups($page), true, true), $this->module->lang('th_groups'));
     }
     $data['noguests'] = array(GWF_Form::CHECKBOX, $page->isLoginRequired(), $this->module->lang('th_noguests'));
     if ($this->is_author) {
         $data['index'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::INDEXED), $this->module->lang('th_index'));
         $data['follow'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::FOLLOW), $this->module->lang('th_follow'));
         $data['sitemap'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::IN_SITEMAP), $this->module->lang('th_in_sitemap'));
     }
     $data['enabled'] = array(GWF_Form::CHECKBOX, $page->isEnabled(), $this->module->lang('th_enabled'));
     $data['title'] = array(GWF_Form::STRING, $page->getVar('page_title'), $this->module->lang('th_title'));
     if ($mod_cat !== false) {
         $data['cat'] = array(GWF_Form::SELECT, GWF_CategorySelect::single('cat', Common::getPostString('cat')), $this->module->lang('th_cat'));
     }
     $data['descr'] = array(GWF_Form::STRING, $page->getVar('page_meta_desc'), $this->module->lang('th_descr'));
     $data['tags'] = array(GWF_Form::STRING, trim($page->getVar('page_meta_tags'), ','), $this->module->lang('th_tags'));
     $data['show_author'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_AUTHOR), $this->module->lang('th_show_author'));
     $data['show_similar'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_SIMILAR), $this->module->lang('th_show_similar'));
     $data['show_modified'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_MODIFIED), $this->module->lang('th_show_modified'));
     $data['show_trans'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_TRANS), $this->module->lang('th_show_trans'));
     $data['show_comments'] = array(GWF_Form::CHECKBOX, $page->wantComments(), $this->module->lang('th_show_comments'));
     if ($this->is_author) {
         $data['home_page'] = array(GWF_Form::CHECKBOX, $this->module->cfgHomePage() === $page->getOtherID(), $this->module->lang('th_home_page'));
     }
     $data['file'] = array(GWF_Form::FILE_OPT, '', $this->module->lang('th_file'));
     $data['upload'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_upload'));
     if ($this->is_author) {
         $data['inline_css'] = array(GWF_Form::MESSAGE_NOBB, $page->getVar('page_inline_css'), $this->module->lang('th_inline_css'));
     }
     if ($page->getMode() === GWF_Page::BBCODE) {
         $data['content'] = array(GWF_Form::MESSAGE, $page->getVar('page_content'), $this->module->lang('th_content'));
     } else {
         $data['content'] = array(GWF_Form::MESSAGE_NOBB, $page->getVar('page_content'), $this->module->lang('th_content'));
     }
     $buttons = array('edit' => $this->module->lang('btn_edit'), 'translate' => $this->module->lang('btn_translate'));
     if ($this->is_author && $page->isLocked()) {
         $buttons['unlock'] = $this->module->lang('btn_unlock');
     }
     $buttons['delete'] = $this->module->lang('btn_delete');
     $data['buttons'] = array(GWF_Form::SUBMITS, $buttons);
     return new GWF_Form($this, $data);
 }
Exemple #16
0
 public function execute(GWF_Module $module)
 {
     require_once GWF_GESHI_PATH;
     $geshi = new GeSHi();
     $langs = $geshi->get_supported_languages(false);
     sort($langs);
     //		$this->niceArray($langs, false, '-------')
     $this->niceArray($langs, 'python', 'Python');
     $this->niceArray($langs, 'perl', 'Perl');
     $this->niceArray($langs, 'cpp', 'CPP');
     $this->niceArray($langs, 'php', 'PHP');
     $back = $module->lang('th_lang') . ':' . PHP_EOL;
     $back .= '<select id="bb_code_lang_sel">' . PHP_EOL;
     $back .= '<option value="0">' . $module->lang('th_lang') . '</option>' . PHP_EOL;
     foreach ($langs as $lang) {
         $back .= sprintf('<option value="%s">%s</option>', $lang, $lang) . PHP_EOL;
     }
     $back .= '</select>' . PHP_EOL;
     $back .= $module->lang('th_title') . ': <input type="text" name="bb_code_title" id="bb_code_title" size="20" value="" />' . PHP_EOL;
     $back .= '<input type="submit" name="bb_code_insert" value="' . $module->lang('btn_code') . '" onclick="return bbInsertCodeNow();" />' . PHP_EOL;
     return $back;
 }
Exemple #17
0
 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'));
     }
 }
Exemple #18
0
 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;
 }
Exemple #19
0
 private static function recalcVotes(Module_WeChall $module, $dropTable)
 {
     if (false === ($mod_votes = GWF_Module::loadModuleDB('Votes', true))) {
         return GWF_HTML::err('ERR_MODULE_MISSING', array('Votes'));
     }
     if (false === WC_Site::onRecalcAllVotes()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === WC_Challenge::onRecalcAllVotes()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return '';
 }
Exemple #20
0
 public function execute()
 {
     if (false === ($mod_votes = GWF_Module::loadModuleDB('Votes', true))) {
         return GWF_HTML::err('ERR_MODULE_MISSING', array('Votes'));
     }
     if (false === ($chall = WC_Challenge::getByID(Common::getGet('cid', 0)))) {
         return $this->module->error('err_chall');
     }
     require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php';
     if (false !== Common::getPost('vote')) {
         return $this->onVote($chall) . $this->templateVotes($chall);
     }
     return $this->templateVotes($chall);
 }
Exemple #21
0
 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);
 }
Exemple #22
0
 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'));
 }
Exemple #23
0
 public function onStartup()
 {
     $this->onLoadLanguage();
     self::$instance = $this;
     $payment_modules = GDO::table('GWF_Module')->selectColumn('module_name', 'module_options&1 AND module_name like \'Payment%\'', 'module_priority ASC');
     foreach ($payment_modules as $modulename) {
         GWF_Module::loadModuleDB($modulename);
     }
     //		$modules = GWF_Module::getModules();
     //		foreach ($modules as $name => $module)
     //		{
     //			if (Common::startsWith($name, 'Payment') && is_array($module))
     //			{
     //				GWF_Module::getModule($name, true);
     //			}
     //		}
     //		$this->onLoadLanguage();
 }
Exemple #24
0
 private static function checkLinksDown(Module_Links $module)
 {
     GWF_Module::loadModuleDB('Votes')->onInclude();
     $links = GDO::table('GWF_Links');
     $limit = $module->cfgCheckAmount();
     $cut = time() - $module->cfgCheckInterval();
     $dead = GWF_Links::DEAD;
     if (false === ($result = $links->selectObjects('*', "link_lastcheck<{$cut} AND link_options&{$dead}=0", 'link_lastcheck DESC', $limit))) {
         return self::error("Database error Links-1");
     }
     if (0 === ($left = count($result))) {
         return self::notice('No links to check.');
     }
     self::notice("Checking {$left} links.");
     foreach ($result as $link) {
         self::checkLinkDown($module, $link);
     }
 }
Exemple #25
0
 public function execute()
 {
     if (false === ($mod_c = GWF_Module::loadModuleDB('Comments', true, true))) {
         return GWF_HTML::err('ERR_MODULE_MISSING', array('Comments'));
     }
     if (false === ($news = GWF_News::getByID(Common::getGetString('newsid')))) {
         return $this->module->error('err_news');
     }
     $key = $news->getCommentsKey();
     $gid = GWF_Group::getByName(GWF_Group::MODERATOR)->getID();
     if (false === ($comments = GWF_Comments::getOrCreateComments($key, 0, $gid))) {
         return $this->module->error('err_news');
     }
     $_REQUEST['cmts_id'] = $comments->getID();
     $back = '';
     if (isset($_POST['reply'])) {
         return $this->onReply($mod_c, $news, $comments);
     }
     return $back . $this->templateComments($mod_c, $news, $comments);
 }
Exemple #26
0
 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()));
 }
Exemple #27
0
 private function formAdd()
 {
     $mod_cat = GWF_Module::loadModuleDB('Category', true, true);
     $data = array();
     $data['url'] = array(GWF_Form::STRING, '', $this->module->lang('th_url'));
     $data['type'] = array(GWF_Form::SELECT, GWF_PageType::select($this->module), $this->module->lang('th_type'));
     $data['lang'] = array(GWF_Form::SELECT, GWF_LangSelect::single(1, 'lang'), $this->module->lang('th_lang'));
     $data['groups'] = array(GWF_Form::SELECT_A, GWF_GroupSelect::multi('groups', true, true, true), $this->module->lang('th_groups'));
     $data['noguests'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_noguests'));
     if ($this->is_author) {
         $data['index'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_index'));
         $data['follow'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_follow'));
         $data['sitemap'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_in_sitemap'));
     }
     $data['title'] = array(GWF_Form::STRING, '', $this->module->lang('th_title'));
     if ($mod_cat !== false) {
         $data['cat'] = array(GWF_Form::SELECT, GWF_CategorySelect::single('cat', Common::getPostString('cat')), $this->module->lang('th_cat'));
     }
     $data['descr'] = array(GWF_Form::STRING, '', $this->module->lang('th_descr'));
     $data['tags'] = array(GWF_Form::STRING, '', $this->module->lang('th_tags'));
     $data['show_author'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_author'));
     $data['show_similar'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_similar'));
     $data['show_modified'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_modified'));
     $data['show_trans'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_trans'));
     $data['show_comments'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_comments'));
     if ($this->is_author) {
         $data['home_page'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_home_page'));
     }
     $data['file'] = array(GWF_Form::FILE_OPT, '', $this->module->lang('th_file'));
     $data['upload'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_upload'));
     if ($this->is_author) {
         $data['inline_css'] = array(GWF_Form::MESSAGE_NOBB, '', $this->module->lang('th_inline_css'));
     }
     $data['content'] = array(GWF_Form::MESSAGE_NOBB, '', $this->module->lang('th_content'));
     $buttons = array('preview' => $this->module->lang('btn_preview'), 'add' => $this->module->lang('btn_add'));
     $data['buttons'] = array(GWF_Form::SUBMITS, $buttons);
     return new GWF_Form($this, $data);
 }
Exemple #28
0
function crackcha_answer(WC_Challenge $chall)
{
    if ('' === ($answer = Common::getGetString('answer', ''))) {
        echo $chall->lang('err_no_answer');
        return;
    }
    if (false === ($solution = GWF_Session::getOrDefault('WCC_CRACKCHA_CHARS', false))) {
        echo $chall->lang('err_no_problem');
        return;
    }
    if ($answer === $solution) {
        crackcha_increase_solved();
        echo $chall->lang('msg_success', array(GWF_Session::getOrDefault('WCC_CRACKCHA_SOLVED', 0), WCC_CRACKCHA_NEED));
        if (crackcha_solved()) {
            GWF_Module::loadModuleDB('Forum', true, true);
            Module_WeChall::includeForums();
            $chall->onChallengeSolved(GWF_Session::getUserID());
        }
    } else {
        echo $chall->lang('msg_failed', array($answer, $solution));
    }
    GWF_Session::remove('WCC_CRACKCHA_CHARS');
}
Exemple #29
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();
 }
Exemple #30
0
function salesman_check_answer(WC_Challenge $chall, $answer)
{
    if (salesman_has_problem() === true) {
        if (salesman_check_answer_B($chall, $answer) === true) {
            $level = salesman_getLevel();
            $level++;
            if ($level > WCC_TR_CU_COUNT) {
                if (false !== ($module = GWF_Module::loadModuleDB('Forum'))) {
                    $module->onInclude();
                }
                $chall->onChallengeSolved(GWF_Session::getUserID());
                $level = 1;
                GWF_Session::set('WCC_TR_CU_LEVEL', $level);
                return $chall->lang('msg_solved');
            }
            GWF_Session::set('WCC_TR_CU_LEVEL', $level);
            return $chall->lang('msg_next_level', array($level));
        } else {
            return salesman_fail($chall);
        }
    } else {
        return $chall->lang('err_no_prob');
    }
}