Esempio n. 1
0
 public function execute()
 {
     if (false === ($site = WC_Site::getByID(Common::getGet('siteid')))) {
         return $this->module->error('err_site');
     }
     return $this->templateDDOS($site);
 }
Esempio n. 2
0
 public function execute()
 {
     if (false === ($this->site = WC_Site::getByID(Common::getGetString('siteid')))) {
         return $this->module->error('err_site');
     }
     return $this->templateBoxes();
 }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
 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);
 }
Esempio n. 6
0
 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';
 }
Esempio n. 7
0
 public function validate_site(Module_WeChall $module, $arg)
 {
     if (false === ($this->site = WC_Site::getByID($arg))) {
         return $this->module->lang('err_site');
     }
     return false;
 }
Esempio n. 8
0
<?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])) {
Esempio n. 9
0
 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;
 }
Esempio n. 10
0
 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()));
 }
Esempio n. 11
0
 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;
 }
Esempio n. 12
0
 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()));
 }
Esempio n. 13
0
 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');
 }
Esempio n. 14
0
 /**
  * @return WC_Site
  */
 public function getSite()
 {
     return WC_Site::getByID($this->getVar('regat_sid'));
 }
Esempio n. 15
0
 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());
 }