public function execute() { if (false === ($site = WC_Site::getByID(Common::getGet('siteid')))) { return $this->module->error('err_site'); } return $this->templateDDOS($site); }
public function execute() { if (false === ($this->site = WC_Site::getByID(Common::getGetString('siteid')))) { return $this->module->error('err_site'); } return $this->templateBoxes(); }
public function execute() { require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteAdmin.php'; if (false === ($site = WC_Site::getByID(Common::getGet('siteid')))) { return $this->module->error('err_site'); } $this->site = $site; if (false === ($is_admin = GWF_User::isInGroupS(GWF_Group::STAFF))) { if (false === $site->isSiteAdmin(GWF_Session::getUser())) { return GWF_HTML::err('ERR_NO_PERMISSION'); } } if (false !== Common::getPost('add_sitemin')) { return $this->onAddSitemin($site, $is_admin) . $this->templateEdit($site, $is_admin); } if (false !== Common::getPost('rem_sitemin')) { return $this->onRemSitemin($site, $is_admin) . $this->templateEdit($site, $is_admin); } if (false !== Common::getPost('rem_logo')) { return $this->onRemLogo($site, $is_admin) . $this->templateEdit($site, $is_admin); } if (false !== Common::getPost('set_logo')) { return $this->onSetLogo($site, $is_admin) . $this->templateEdit($site, $is_admin); } if (false !== Common::getPost('edit')) { return $this->onEdit($site, $is_admin) . $this->templateEdit($site, $is_admin); } return $this->templateEdit($site, $is_admin); }
private function sanitize() { if (false === ($this->site = WC_Site::getByID(Common::getGetInt('siteid', 0)))) { return array($this->module->lang('err_site')); } require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteAdmin.php'; if (!WC_SiteAdmin::isSiteAdmin(GWF_Session::getUserID(), $this->site->getID()) && !GWF_User::isAdminS()) { return array(GWF_HTML::lang('ERR_NO_PERMISSION')); } return false; }
public function execute() { $_GET['ajax'] = 1; header('Content-Type: text/plain'); if (false === ($this->site = WC_Site::getByID(Common::getGetString('siteid')))) { return 'Unknown site for siteid.'; } if (false === ($date = Common::getGetString('datestamp', false))) { return 'Missing parameter: datestamp.'; } if (!GWF_Time::isValidDate($date, false, GWF_Date::LEN_SECOND)) { return 'Error in parameter: datestamp.'; } $amt = Common::clamp(Common::getGetInt('amt', 5), 1, self::MAX_OUT); return $this->templateOutput($date, $amt); }
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 validate_site(Module_WeChall $module, $arg) { if (false === ($this->site = WC_Site::getByID($arg))) { return $this->module->lang('err_site'); } return false; }
<?php $SITE = WC_Site::getByID(Common::getGetString('sid')); if ($SITE === false) { # fallback $SITE = GDO::table('WC_Site')->selectRandom('*', "site_status='up'", 1, NULL, GDO::ARRAY_O); $SITE = $SITE[0]; } # Put in cats. //$types = array(); # Row types $langs = array(); # Row languages $cats = array(); # Row cats //$types['all'] = array(); //$types['active'] = array(); foreach ($tVars['sites'] as $site) { $site instanceof WC_Site; // var_dump($site->getGDOData()); if ($site->isScored()) { $langid = $site->getLangID(); if (!isset($langs[$langid])) { $langs[$langid] = array(); } $langs[$langid][] = $site; // $types['active'][] = $site; } // else // { // $type = $site->getTypeID(); // if (!isset($types[$type])) {
public static function displayIcons(GWF_User $user) { $back = ''; $db = gdo_db(); $uid = $user->getInt('user_id'); $regats = GWF_TABLE_PREFIX . 'wc_regat'; $query = "SELECT regat_sid, regat_solved FROM {$regats} WHERE regat_uid={$uid}"; if (false === ($result = $db->queryRead($query))) { return ''; } $i = 0; while (false !== ($row = $db->fetchRow($result))) { if (0.05 > ($solved = floatval($row[1]))) { continue; } if (++$i % 5 === 0) { $back .= '<br/>' . PHP_EOL; } $siteid = (int) $row[0]; $site = WC_Site::getByID($siteid); $back .= $site->displayLogoUN($user->getVar('user_name'), $solved, 6, 28, true) . PHP_EOL; } $db->free($result); return $back; }
private function onUnFreeze($data) { if (false !== ($err = GWF_Form::validateCSRF_WeakS())) { return GWF_HTML::error('WeChall', $err); } if (!is_array($data)) { return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } foreach ($data as $key => $value) { break; } $data = explode(',', $key); if (count($data) !== 2) { return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } $userid = intval($data[0]); $siteid = intval($data[1]); if (false === ($user = GWF_User::getByID($userid))) { return GWF_HTML::err('ERR_UNKNOWN_USER'); } if (false === ($site = WC_Site::getByID($siteid))) { return $this->module->error('err_site'); } if (WC_Freeze::isUserFrozenOnSite($userid, $siteid)) { # Unfreeze if (false === WC_Freeze::unfreezeUser($userid, $siteid)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } # Insert event. $rank = WC_RegAt::calcExactRank($user); WC_HistoryUser2::insertEntry($user, $site, 'unban'); } # Done return $this->module->message('msg_unfrozen', array($user->displayUsername(), $site->displayName())); }
private function validate() { $this->validateDimension(); if (false === ($this->user1 = GWF_User::getByName(Common::getRequest('user1', '')))) { return GWF_HTML::err('ERR_UNKNOWN_USER'); } if (false === ($this->user2 = GWF_User::getByName(Common::getRequest('user2', '')))) { // return GWF_HTML::err('ERR_UNKNOWN_USER'); } // Check end date $this->end = sprintf('%04d%02d%02d', intval(Common::getGet('y', 0), 10), intval(Common::getGet('m', 0), 10), intval(Common::getGet('d', 0), 10)); if (!GWF_Time::isValidDate($this->end, false, GWF_Date::LEN_DAY)) { return $this->module->error('err_end_date'); } // Check start date $regdate1 = $this->user1->getVar('user_regdate'); $regdate2 = $this->user2 === false ? $regdate1 : $this->user2->getVar('user_regdate'); $this->start = $regdate1 < $regdate2 ? $regdate1 : $regdate2; $this->start = substr($this->start, 0, GWF_Date::LEN_DAY); if (0 < ($nm = intval(Common::getGet('nm', 0)))) { $time = GWF_Time::getTimestamp($this->end); $time -= $nm * GWF_Time::ONE_MONTH; $time = GWF_Time::getDate(GWF_Date::LEN_DAY, $time); if ($time > $this->start) { $this->start = $time; } } // var_dump($this->start); // Check sites $sites = Common::getGetString('sites'); if ($sites === 'all') { if ($this->user2 === false) { $this->sites = WC_Site::getLinkedSites($this->user1->getID()); } else { $this->sites = WC_Site::getLinkedSitesVS2($this->user1->getID(), $this->user2->getID()); } $temp = array(); foreach ($this->sites as $site) { $temp[$site->getID()] = $site; } $this->sites = $temp; } else { $this->sites = array(); $sites = explode(',', $sites); foreach ($sites as $siteid) { // var_dump($siteid); $siteid = intval(trim($siteid)); if (false !== ($site = WC_Site::getByID($siteid))) { $this->sites[$siteid] = $site; } } } // if (count($this->sites) === 0) { // return $this->module->error('err_no_sites'); // } // Options $opts = explode(',', Common::getGet('opt', '')); foreach ($opts as $opt) { $opt = trim($opt); if ($opt === 'icons') { $this->withIcons = true; } elseif ($opt === 'nums') { $this->withNumbers = true; } elseif ($opt === 'zoom') { $this->withZoom = true; } } // All ok return false; }
private function onRemoveFavorite($sid) { if (false === ($site = WC_Site::getByID($sid))) { return $this->module->error('err_site'); } $userid = GWF_Session::getUserID(); WC_SiteFavorites::setFavorite($userid, $site->getID(), false); return $this->module->message('msg_unmarked_fav', array($site->displayName())); }
private function getClassnameFromID($sid) { static $sites = array(); $sid = (int) $sid; if (!isset($sites[$sid])) { $sites[$sid] = WC_Site::getByID($sid); } if ($sites[$sid] === false) { return 'Unknown SiteID: ' . $sid; } return $sites[$sid]->getVar('site_classname'); }
/** * @return WC_Site */ public function getSite() { return WC_Site::getByID($this->getVar('regat_sid')); }
private function onUpdate($array) { if (!is_array($array)) { return ''; } foreach ($array as $siteid => $stub) { break; } if (false === ($site = WC_Site::getByID($siteid))) { return $this->module->error('err_site'); } return $this->onUpdateB($site, GWF_Session::getUser()); }