Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
 public function validate_site_classname(Module_WeChall $m, $arg)
 {
     if (false !== WC_Site::getByClassName($arg)) {
         return $m->lang('err_classname_dup');
     }
     $max = $m->cfgMaxSitenameLen();
     if (1 !== preg_match('/^[a-z][a-z0-9_]+$/iD', $arg)) {
         return $m->lang('err_site_classname', array(1, $max));
     }
     $len = GWF_String::strlen($arg);
     if ($len < 1 || $len > $max) {
         return $m->lang('err_site_classname', array(1, $max));
     }
     return false;
 }
Exemplo n.º 3
0
 private function sanitize()
 {
     if (false === Common::getGet('no_session')) {
         return 'The mandatory parameter \'no_session\' is not set. Try \'&no_session=1\'.';
     }
     # Validate Date
     if (false !== ($date = Common::getGet('datestamp'))) {
         if (GWF_Time::isValidDate($date, false, GWF_Date::LEN_SECOND)) {
             $this->time = GWF_Time::getTimestamp($date);
         }
     }
     # Validate username
     if (false !== ($username = Common::getGet('username'))) {
         if (false === ($this->user = GWF_User::getByName($username))) {
             return GWF_HTML::err('ERR_UNKNOWN_USER');
         }
         if (false !== ($error = $this->module->isExcludedFromAPI($this->user, Common::getGet('password')))) {
             return $error;
         }
     }
     # Validate sitename
     if (false !== ($sitename = Common::getGet('sitename'))) {
         if (false === ($this->site = WC_Site::getByName($sitename)) && false === ($this->site = WC_Site::getByClassName($sitename))) {
             return $this->module->error('err_site');
         }
     }
     # Validate Limit
     if (in_array(Common::getGet('masterkey'), self::$masterKeys)) {
         $max_limit = PHP_INT_MAX;
     } elseif ($this->user === false && $this->site === false) {
         $max_limit = self::MAX_LIMIT_ALL;
     } else {
         $max_limit = self::MAX_LIMIT_SINGLE;
     }
     $this->limit = Common::clamp(Common::getGet('limit', self::DEFAULT_LIMIT), 1, $max_limit);
     //		if (!isset($no_block))
     //		{
     //			require_once 'core/module/WeChall/WC_API_Block.php';
     //			if (WC_API_Block::isBlocked())
     //			{
     //				return $this->module->error('err_api_block');
     //			}
     //		}
     return false;
 }
Exemplo n.º 4
0
 public function execute()
 {
     if (!($site = WC_Site::getByClassName(Common::getGetString('site')))) {
         $this->module->ajaxErr('err_site');
     }
     require_once GWF_CORE_PATH . 'module/WeChall/WC_HistoryUser2.php';
     $table = GDO::table('WC_HistoryUser2');
     $orderby = 'userhist_date DESC';
     $siteid = $site->getVar('site_id');
     $conditions = "userhist_sid={$siteid}";
     $items = $table->selectObjects('*', $conditions, $orderby, 15);
     $feed = new GWF_RSS();
     $feed->setTitle($this->l('siterss_title', array($site->displayName())));
     $feed->setItems($items);
     $feed->setFeedURL($_SERVER['REQUEST_URI']);
     $feed->setWebURL(Common::getAbsoluteURL('site/history/' . $site->displayName()));
     die($feed->export());
 }
Exemplo n.º 5
0
 public function execute()
 {
     $syntax = 'syntax: ' . Common::getAbsoluteURL('remoteupdate.php') . '?sitename=FOO&username=BAR';
     $server = htmlspecialchars($_SERVER['SERVER_NAME'], ENT_QUOTES);
     $unknownsite = 'Join us: ' . Common::getAbsoluteURL('join_us');
     # "Join us: http://$server/join.php";
     $unknownuser = '******' . Common::getAbsoluteURL('register') . ' for global ranking. Please note that the username is case sensitive for remoteupdates.';
     // flag for images. 0=normal text, 1=default image, we can assign different image styles to higher numbers
     $img = (int) Common::getGet('img', 0);
     if ($img === 1) {
         header("Content-Type: image/png");
     }
     if (false === ($sitename = Common::getRequest('sitename'))) {
         $this->outDie($syntax);
     }
     if (false === ($onsitename = Common::getRequest('username'))) {
         $this->outDie($syntax);
     }
     if ($sitename === 'FOO' && $onsitename === 'BAR') {
         $this->outDie('Doh! Not literally!');
     }
     if (false === ($site = WC_Site::getByName($sitename)) && false === ($site = WC_Site::getByClassName($sitename))) {
         $this->outExit($unknownsite);
     }
     $this->module->includeClass('WC_RegAt');
     if (false === ($user = WC_RegAt::getUserByOnsiteName($onsitename, $site->getID()))) {
         $this->outExit($unknownuser);
     }
     # Update him
     $result = $site->onUpdateUser($user);
     $site->saveOption(WC_Site::AUTO_UPDATE, true);
     # Output result
     switch ($img) {
         case 0:
             $this->outResult($result);
             break;
         case 1:
             $this->imgDisplayText($result->getMessage());
             break;
     }
 }
Exemplo n.º 6
0
 private static function installSiteColors(Module_WeChall $module)
 {
     $classnames = array('WC' => 'c6d0da', 'HQ' => '00ffff', 'Rankk' => 'a50000', 'TBS' => 'f8b128', 'Elec' => 'ffff00', 'Asp' => 'cdcdcd', 'HS' => '48633b', 'NC' => '5d5d5d', 'DYM' => 'fec752', 'Lost' => 'bbbbbb', 'Yash' => 'aaaaaa', 'Mirmo' => '232323', 'BQ' => 'dbdbdc', 'NF' => '93836e', 'Hispa' => '8ddc42', 'HTS' => '409fff', 'TIL' => '688ade', 'ElH' => 'e2e9ee', 'TT1' => '2370aa', 'TDH' => 'ffec62', 'MiB' => '42d153', 'Ma' => '008000', 'PHM' => '000000', 'BBox' => '', 'Euler' => 'c7e1f8', '0ID' => 'ed8c0f', 'HDE' => '', 'Hax' => '00b000', 'HBH' => 'bec8c5', 'Hacker' => 'd0f4df', 'Bl0' => '', 'SA' => '11141d', 'osix' => '2e506b', 'RCode' => 'f60101', 'CSTC' => '8883b8', 'LB' => '4d8ac7', 'Asta' => '000000', 'WoW' => 'ffffff', 'THC' => '804b69', 'HBBS' => 'd0d0d0', 'CLIB' => 'ffffff', 'ST' => '202020', 'Root' => '000000', 'SPOJ' => '07077e');
     foreach ($classnames as $classname => $color) {
         if ($color !== '') {
             if (false !== ($site = WC_Site::getByClassName($classname))) {
                 $site->saveVar('site_color', $color);
             }
         }
     }
 }
Exemplo n.º 7
0
    die(file_get_contents('who.php'));
}
chdir('../../../');
define('GWF_PAGE_TITLE', 'What is your Name?');
require_once 'challenge/html_head.php';
require_once GWF_CORE_PATH . 'module/WeChall/WC_CryptoChall.php';
require_once GWF_CORE_PATH . 'module/WeChall/solutionbox.php';
if (false === ($chall = WC_Challenge::getByTitle(GWF_PAGE_TITLE))) {
    $chall = WC_Challenge::dummyChallenge(GWF_PAGE_TITLE, 5, 'challenge/Mawekl/what_is_your_name/index.php', false);
}
$chall->showHeader();
require_once 'challenge/Mawekl/what_is_your_name/solution.php';
what_is_your_name_check_solution($chall);
$url1 = 'who.php';
$url2 = 'index.php?show=source';
$url3 = 'index.php?highlight=christmas';
$url4 = WC_Site::getByClassName('ST')->getURL();
$url4 = sprintf('<a href="%s" style="color: #eee;">Security Traps</a>', $url4);
if (false === ($mawekl = GWF_User::getByName('Mawekl'))) {
    $mawekl = 'Mawekl';
} else {
    $mawekl = sprintf('<a href="%s">Mawekl</a>', $mawekl->getProfileHREF());
}
$text = $chall->lang('info', array($mawekl, $url1, $url2, $url3, $url4));
htmlTitleBox($chall->lang('title'), $text);
if (Common::getGetString('highlight') === 'christmas') {
    echo GWF_Message::display('[php title=who.php]' . file_get_contents('challenge/Mawekl/what_is_your_name/who.php') . '[/php]');
}
formSolutionbox($chall);
echo $chall->copyrightFooter();
require_once 'challenge/html_foot.php';
Exemplo n.º 8
0
 private function showSiteDetail($input)
 {
     $classname = trim(Common::substrFrom($input, ' ', ''));
     if (false === ($site = WC_Site::getByClassName($classname))) {
         die('Unknown Site ' . $classname);
     }
     require_once GWF_CORE_PATH . 'module/WeChall/WC_SiteDescr.php';
     $descr = WC_SiteDescr::getDescription($site->getID());
     //		$descr = $site->getVar('site_description');
     //		$message = $descr;
     $message = Common::stripMessage($descr, 148);
     die(sprintf('%s (%s challs): %s - %s', $site->displayName(), $site->getChallcount(), $site->getVar('site_url'), $message));
 }