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)); }
public function execute() { GWF_Website::plaintext(); $input = trim(Common::getGetString('username', '')); if (false !== ($onsitename = Common::getGet('onsitename')) && false !== ($sitename = Common::getGet('sitename'))) { die($this->rawOnSiteStats($sitename, $onsitename)); } require_once GWF_CORE_PATH . 'module/WeChall/WC_RegAt.php'; if (Common::getGet('wechall') === 'yes') { die($this->wechallChalls($input)); } if ($input === '') { $message = sprintf('Try %s?username=name/rank. New: ?username=!sitename username/rank. Or: ?username=!sites usernname', 'wechall.php'); die($message); } if (strpos($input, '!sites') === 0) { $this->showSites($input); } elseif (strpos($input, '!site') === 0) { $this->showSiteDetail($input); } elseif (strpos($input, '!') === 0) { $this->showSite($input); } else { die($this->showGlobal($input)); } }
public function execute() { $_GET['ajax'] = 1; GWF_Website::plaintext(); if (false !== ($error = $this->sanitize())) { die($error); } die($this->history()); }
public function execute() { if (false === ($id = Common::getGetInt('id', false))) { return GWF_HTML::err('ERR_PARAMETER', array(__FILE__, __LINE__, 'id')); } if (false === ($log = GWF_AuditLog::getByID($id))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } GWF_Website::plaintext(); die($log->getVar('al_data')); }
public function execute() { GWF_Website::plaintext(); GWF3::setConfig('store_last_url', false); $id = Common::getGetInt('pp_id'); if (!GWF_ProfilePOI::changeAllowed($id, GWF_Session::getUserID())) { $this->module->ajaxError('Permission error!'); } GDO::table('GWF_ProfilePOI')->deleteWhere("pp_id = {$id}"); die("{$id}"); }
public function execute() { GWF_Website::plaintext(); if (false === Common::getGet('no_session')) { die('The mandatory parameter \'no_session\' is not set. Try \'&no_session=1\'.'); } if (false === ($sitename = Common::getGet('sitename'))) { die($this->showAllSites()); } if (false === ($site = WC_Site::getByName($sitename)) && false === ($site = WC_Site::getByClassName($sitename))) { die($this->module->lang('err_site')); } die($this->showSite($site)); }
public function execute() { GWF_Website::plaintext(); if (false === ($uid = Common::getGetString('id'))) { return $this->garbage(); } if (false === ($token = Common::getGetString('token'))) { return $this->garbage(); } if (false === ($mc = Common::getGetString('mc'))) { return $this->garbage(); } return $this->validate($uid, $token, $mc); }
public function execute() { $_GET['ajax'] = 1; GWF_Website::plaintext(); if (false === Common::getGet('no_session')) { die('The mandatory parameter \'no_session\' is not set. Try \'&no_session=1\'.'); } if (false === ($username = Common::getGet('username'))) { die('The mandatory parameter \'username\' is not set. Try \'&username=nickname\'.'); } if (false === ($user = GWF_User::getByName($username))) { die(GWF_HTML::lang('ERR_UNKNOWN_USER')); } die($this->showUser($user, Common::getGet('apikey'))); }
public function execute() { GWF_Website::plaintext(); GWF3::setConfig('store_last_url', false); if (!$this->module->canReadPOIs()) { return $this->module->ajaxErr('err_poi_read_perm'); } $minlat = $this->module->lat('minlat'); $maxlat = $this->module->lat('maxlat'); $minlon = $this->module->lon('minlon'); $maxlon = $this->module->lon('maxlon'); $where_perms = GWF_ProfilePOI::wherePermissions(); $where_place = GWF_ProfilePOI::whereLocations($minlat, $maxlat, $minlon, $maxlon); $where = "({$where_perms}) AND ({$where_place})"; $joins = array('users', 'profiles', 'whitelist'); $result = GDO::table('GWF_ProfilePOI')->selectAll('pp_id, pp_uid, user_name, pp_lat, pp_lon, pp_descr', $where, '', $joins); die(json_encode($result)); }
public function execute() { GWF_Website::plaintext(); if (false === ($datestamp = Common::getGet('datestamp'))) { return 'TRY ?datestamp=YYYYMMDDHHIISS&limit=5'; } if (strlen($datestamp) !== 14) { return 'TRY ?datestamp=YYYYMMDDHHIISS&limit=5'; } if (0 === ($limit = Common::getGetInt('limit', 0))) { return 'TRY ?datestamp=YYYYMMDDHHIISS&limit=5'; } $date = GDO::escape($datestamp); $limit = Common::clamp($limit, 1, 25); if (false === ($result = GDO::table('GWF_ForumThread')->selectObjects('*', "thread_lastdate>='{$date}' AND thread_options&4=0", 'thread_lastdate DESC', $limit))) { return GWF_HTML::lang('ERR_DATABASE', __FILE__, __LINE__); } $back = ''; $unknown = GWF_HTML::lang('unknown'); foreach (array_reverse($result) as $thread) { #timestamp::lock::postid::threadid::posturl::userurl::username::title $thread instanceof GWF_ForumThread; $locked = $thread->getVar('thread_gid') === '0' ? '0' : '1'; $back .= $thread->getVar('thread_tid'); $back .= '::'; $back .= $thread->getVar('thread_lastdate'); $back .= '::'; $back .= $thread->getVar('thread_gid'); $back .= '::'; $back .= 'https://' . GWF_DOMAIN . $thread->getLastPageHREF($locked === '1'); $back .= '::'; $back .= $locked === '1' ? $unknown : $this->getLastPosterName($thread); $back .= '::'; $back .= $locked === '1' ? $unknown : $thread->getVar('thread_title'); $back .= PHP_EOL; } return $back; }
private function previewText(GWF_Mail $mail) { GWF_Website::plaintext(); die($mail->nestedTextBody()); }
/** * Display the page with layout * If ajax is enabled it returns only the module content * @param string|NULL $content replace page content * @return string */ public function onDisplayPage($content = NULL) { if (true === self::getConfig('log_request') && class_exists('GWF_Log')) { GWF_Log::logRequest(); } # Display the page if (true === isset($_GET['ajax'])) { GWF_Website::plaintext(); return self::$page; } else { $page = $content === NULL ? self::$page : $content; return GWF_Website::displayPage($page); } }
private function onCSVExport() { GWF_Website::plaintext(); $flags = WC_Warflag::getByWarbox($this->warbox, 'wf_order ASC'); echo self::CSV_COLUMNS . PHP_EOL; foreach ($flags as $flag) { $flag instanceof WC_Warflag; $input = array($flag->getVar('wf_order'), $flag->getVar('wf_cat'), $flag->getVar('wf_score'), $flag->getVar('wf_title'), $flag->getVar('wf_url'), $flag->getVar('wf_authors'), $flag->getVar('wf_status'), $flag->getVar('wf_login'), '', $flag->isWarchall() ? 'SSH' : 'WEB'); echo GWF_Array::toCSV($input) . PHP_EOL; } die(0); }
private function genConfig() { $vars = array('site_id', 'site_name', 'site_classname', 'wb_id', 'wb_name', 'wb_levels', 'wb_port', 'wb_host', 'wb_user', 'wb_pass', 'wb_weburl', 'wb_ip', 'wb_whitelist', 'wb_blacklist', 'wb_launched_at'); $output = GWF_Array::toCSV($vars) . "\n"; foreach ($this->getWarboxes(true) as $warbox) { $warbox instanceof WC_Warbox; $data = array(); foreach ($vars as $var) { $data[] = $warbox->getVar($var); } $output .= GWF_Array::toCSV($data) . "\n"; } // $format = '%5s, %15s, %5s, %2s, %64s, %24s, %s'."\n"; // $output = vsprintf('#'.$format, explode(',', 'CLS,IP,prt,RS,warhost,displayname,webhost')); // foreach ($this->getWarboxes(true) as $warbox) // { // $warbox instanceof WC_Warbox; // $output .= sprintf(' '.$format, // $warbox->getVar('site_classname'), $warbox->getWarIP(), // $warbox->getWarPort(), $warbox->getWarReduceScore(), // $warbox->getWarHost(), $warbox->getSitename(), $warbox->getURL())."\n"; // } $_GET['ajax'] = 1; GWF_Website::plaintext(); return $output; }
$_GET['me'] = 'null'; require_once 'protected/config.php'; require_once '../gwf3.class.php'; $gwf = new GWF3(dirname(dirname(__FILE__) . '../'), array('init' => true, 'bootstrap' => false, 'website_init' => true, 'autoload_modules' => true, 'load_module' => false, 'load_config' => false, 'start_debug' => true, 'get_user' => true, 'do_logging' => true, 'log_request' => true, 'blocking' => !defined('GWF_SESSION_NOT_BLOCKING'), 'no_session' => false, 'store_last_url' => true, 'ignore_user_abort' => true)); if (false === ($wechall = GWF_Module::loadModuleDB('WeChall', true, true))) { die('GWF3/WC5 not installed?'); } //$error = GWF_Module::startup(); if (defined('GWF_PAGE_TITLE')) { GWF_Website::setPageTitle(GWF_PAGE_TITLE); GWF_Website::setMetaDescr(GWF_PAGE_TITLE . ' challenge on WeChall'); GWF_Website::setMetaTags(GWF_PAGE_TITLE . ', Challenge, WeChall'); } # Include Needed Modules //GWF_Module::getModule('Votes', true); GWF_Module::loadModuleDB('Forum', true); //GWF_Module::getModule('WeChall', true)->onLoadLanguage(); require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php'; //GWF_ForumBoard::init(true); if (isset($_GET['ajax'])) { GWF_Website::plaintext(); return; } $mb = WC_HTML::wantFooter() ? ' style="margin-bottom: -48px;"' : ''; # HTML Header //echo GWF_Website::getPagehead(); if (!defined('NO_HEADER_PLEASE')) { #echo GWF_Doctype::getDoctype(GWF_DEFAULT_DOCTYPE); echo $gwf->onDisplayHead(); # . '<div id="page_wrap">'; }