示例#1
0
 function execute()
 {
     $html = new HTMLKeep();
     $cgi = new Cgi();
     $hako = new HakoKP();
     $this->parseInputData();
     $hako->init($this);
     $cgi->getCookies();
     $html->header();
     switch ($this->mode) {
         case "TOKP":
             if ($this->passCheck()) {
                 $this->toMode($this->dataSet['ISLANDID'], $hako);
                 $hako->init($this);
             }
             $html->main($this->dataSet, $hako);
             break;
         case "FROMKP":
             if ($this->passCheck()) {
                 $this->fromMode($this->dataSet['ISLANDID'], $hako);
                 $hako->init($this);
             }
             $html->main($this->dataSet, $hako);
             break;
         case "enter":
         default:
             if ($this->passCheck()) {
                 $html->main($this->dataSet, $hako);
             }
             break;
     }
     $html->footer();
 }
示例#2
0
 function execute()
 {
     $html = new HtmlPresent();
     $hako = new HakoPresent();
     $cgi = new Cgi();
     $this->parseInputData();
     $hako->init($this);
     $cgi->getCookies();
     $html->header();
     switch ($this->mode) {
         case "PRESENT":
             if ($this->passCheck()) {
                 $this->presents($this->dataSet, $hako);
             }
             $html->main($this->dataSet, $hako);
             break;
         case "PUNISH":
             if ($this->passCheck()) {
                 $this->punish($this->dataSet, $hako);
             }
             $html->main($this->dataSet, $hako);
             break;
         case "enter":
             if ($this->passCheck()) {
                 $html->main($this->dataSet, $hako);
             }
             break;
         default:
             $html->enter();
             break;
     }
     $html->footer();
 }
示例#3
0
 function execute()
 {
     $html = new HtmlAdmin();
     $cgi = new Cgi();
     $cgi->getCookies();
     $html->header();
     $html->enter();
     $html->footer();
 }
示例#4
0
 function execute()
 {
     $html = new HtmlMenteSafe();
     $cgi = new Cgi();
     $this->parseInputData();
     $cgi->getCookies();
     $html->header();
     switch ($this->mode) {
         case "NEW":
             if ($this->passCheck()) {
                 $this->newMode();
             }
             $html->main($this->dataSet);
             break;
         case "CURRENT":
             if ($this->passCheck()) {
                 $this->currentMode($this->dataSet['NUMBER']);
             }
             $html->main($this->dataSet);
             break;
         case "DELETE":
             if ($this->passCheck()) {
                 $this->delMode($this->dataSet['NUMBER']);
             }
             $html->main($this->dataSet);
             break;
         case "NTIME":
             if ($this->passCheck()) {
                 $this->timeMode();
             }
             $html->main($this->dataSet);
             break;
         case "STIME":
             if ($this->passCheck()) {
                 $this->stimeMode($this->dataSet['SSEC']);
             }
             $html->main($this->dataSet);
             break;
         case "setup":
             $this->setupMode();
             $html->enter();
             break;
         case "enter":
             if ($this->passCheck()) {
                 $html->main($this->dataSet);
             }
             break;
         default:
             $html->enter();
             break;
     }
     $html->footer();
 }
 public function hookCheckForBlockedHost()
 {
     if (!Cgi::getMode()) {
         $ipFilter = new IpFilter();
         if ($ipFilter->isBlocked()) {
             throw new IPBlockedException("This host is blocked!");
         }
     }
 }
 /**
  * Record current request in requests log
  */
 public function recordRequest($ip = null)
 {
     if (Cgi::getMode()) {
         return;
     }
     if ($ip === null) {
         $ip = $_SERVER['REMOTE_ADDR'];
     }
     $this->query->exec("INSERT INTO `" . Tbl::get('TBL_SECURITY_REQUESTS_LOG') . "` (`ip`) \n\t\t\t\t\t\t\t\tVALUES ('{$ip}')\n\t\t\t\t\t\t\t\tON DUPLICATE KEY UPDATE `count` = `count` + 1");
 }
示例#7
0
 function execute()
 {
     $html = new HtmlAxes();
     $cgi = new Cgi();
     $this->parseInputData();
     $cgi->getCookies();
     $html->header();
     switch ($this->mode) {
         case "enter":
             if ($this->passCheck()) {
                 $html->main($this->dataSet);
             }
             break;
         default:
             $html->enter();
             break;
     }
     $html->footer();
 }
示例#8
0
 /**
  * Check if remote IP is blocked by our system
  * 
  * @return boolean
  */
 public function isBlocked($cacheMinutes = null)
 {
     if (Cgi::getMode()) {
         return true;
     }
     $isBlocked = $this->isBlockedByIP($cacheMinutes) || $this->isBlockedByCountry($cacheMinutes);
     $isWhiteListed = $this->isWhitelistedIP($cacheMinutes);
     if ($isBlocked and !$isWhiteListed) {
         return true;
     }
     return false;
 }
示例#9
0
 /**
  * Record current request in requests log
  */
 public function recordRequest($ip = null)
 {
     if (Cgi::getMode()) {
         return;
     }
     if ($ip === null) {
         $ip = $_SERVER['REMOTE_ADDR'];
     }
     $qb = new QueryBuilder();
     $qb->insert(Tbl::get('TBL_SECURITY_REQUESTS_LOG'))->values(array('ip' => $ip))->onDuplicateKeyUpdate()->set(new Field('count'), $qb->expr()->sum(new Field('count'), 1));
     $this->query->exec($qb->getSQL());
 }
示例#10
0
 /**
  * 
  *
  * @param protocol $protocol
  * @return unknown
  */
 public static function pageURL()
 {
     $hostConfig = ConfigManager::getConfig("Host")->AuxConfig;
     if (Cgi::getMode()) {
         return $hostConfig->cgiHost;
     }
     if (empty($_SERVER["SERVER_NAME"])) {
         $_SERVER["SERVER_NAME"] = $hostConfig->cgiHost;
     }
     $page_url = "";
     if (isset($_SERVER["SERVER_PORT"]) and $_SERVER["SERVER_PORT"] != "80") {
         $page_url .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
     } else {
         $page_url .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
     }
     return $page_url;
 }
示例#11
0
require_once STINGLE_PATH . "core/Exceptions/InvalidArrayArgumentException.class.php";
require_once STINGLE_PATH . "core/Exceptions/InvalidIntegerArgumentException.class.php";
require_once STINGLE_PATH . "core/Exceptions/InvalidTimestampArgumentException.class.php";
require_once STINGLE_PATH . "functions/system.php";
require_once STINGLE_PATH . "functions/func.php";
register_shutdown_function("shutdown");
set_exception_handler("default_exception_handler");
set_error_handler(create_function('$severity, $message, $file, $line', 'throw new ErrorException($message, $severity, $severity, $file, $line);'));
$config = new Config($CONFIG);
ConfigManager::setGlobalConfig($config);
Reg::register('packageMgr', new PackageManager());
error_reporting($config->site->error_reporting);
session_name($config->site->site_id);
session_start();
ob_start('stingleOutputHandler');
Cgi::setMode(defined("IS_CGI"));
Debug::setMode($config->Debug->enabled);
SiteMode::set($config->SiteMode->mode);
// Register User Hooks
if (isset($config->Hooks)) {
    foreach (get_object_vars($config->Hooks) as $hookName => $funcName) {
        if (is_object($funcName)) {
            foreach (get_object_vars($funcName) as $regFuncName) {
                HookManager::registerHook(new Hook($hookName, $regFuncName));
            }
        } else {
            HookManager::registerHook(new Hook($hookName, $funcName));
        }
    }
}
// Init packages/plugins
示例#12
0
 function execute()
 {
     global $init;
     $ally = new Ally();
     $cgi = new Cgi();
     $this->parseInputData();
     $cgi->getCookies();
     if (!$ally->readIslands($cgi)) {
         HTML::header();
         HakoError::noDataFile();
         HTML::footer();
         exit;
     }
     $cgi->setCookies();
     $html = new HtmlAlly();
     $com = new MakeAlly();
     $html->header();
     switch ($this->mode) {
         case "JoinA":
             // 同盟の結成・変更・解散・加盟・脱退
             $html->newAllyTop($ally, $this->dataSet);
             break;
         case "newally":
             // 同盟の結成・変更
             $com->makeAllyMain($ally, $this->dataSet);
             break;
         case "delally":
             // 同盟の解散
             $com->deleteAllyMain($ally, $this->dataSet);
             break;
         case "inoutally":
             // 同盟の加盟・脱退
             $com->joinAllyMain($ally, $this->dataSet);
             break;
         case "Allypact":
             // コメントの変更
             $html->tempAllyPactPage($ally, $this->dataSet);
             break;
         case "AllypactUp":
             // コメントの更新
             $com->allyPactMain($ally, $this->dataSet);
             break;
         case "AmiOfAlly":
             // 同盟の情報
             $html->amityOfAlly($ally, $this->dataSet);
             break;
         default:
             // 箱庭データとのデータ統合処理(ターン処理に組み込んでいないため)
             if ($com->allyReComp($ally)) {
                 break;
             }
             $html->allyTop($ally, $this->dataSet);
             break;
     }
     $html->footer();
 }
示例#13
0
 function execute()
 {
     $hako = new Hako();
     $cgi = new Cgi();
     $cgi->parseInputData();
     $cgi->getCookies();
     $fp = "";
     if (!$hako->readIslands($cgi)) {
         HTML::header();
         HakoError::noDataFile();
         HTML::footer();
         Util::unlock($lock);
         exit;
     }
     $lock = Util::lock($fp);
     if (FALSE == $lock) {
         exit;
     }
     $cgi->setCookies();
     $_developmode = isset($cgi->dataSet['DEVELOPEMODE']) ? $cgi->dataSet['DEVELOPEMODE'] : "";
     if (mb_strtolower($_developmode) == "javascript") {
         $html = new HtmlMapJS();
         $com = new MakeJS();
     } else {
         $html = new HtmlMap();
         $com = new Make();
     }
     switch ($cgi->mode) {
         case "turn":
             $turn = new Turn();
             $html = new HtmlTop();
             $html->header();
             $turn->turnMain($hako, $cgi->dataSet);
             $html->main($hako, $cgi->dataSet);
             // ターン処理後、TOPページopen
             $html->footer();
             break;
         case "owner":
             $html->header();
             $html->owner($hako, $cgi->dataSet);
             $html->footer();
             break;
         case "command":
             $html->header();
             $com->commandMain($hako, $cgi->dataSet);
             $html->footer();
             break;
         case "new":
             $html->header();
             $com->newIsland($hako, $cgi->dataSet);
             $html->footer();
             break;
         case "comment":
             $html->header();
             $com->commentMain($hako, $cgi->dataSet);
             $html->footer();
             break;
         case "print":
             $html->header();
             $html->visitor($hako, $cgi->dataSet);
             $html->footer();
             break;
         case "targetView":
             $html->head();
             $html->printTarget($hako, $cgi->dataSet);
             //$html->footer();
             break;
         case "change":
             $html->header();
             $com->changeMain($hako, $cgi->dataSet);
             $html->footer();
             break;
         case "ChangeOwnerName":
             $html->header();
             $com->changeOwnerName($hako, $cgi->dataSet);
             $html->footer();
             break;
         case "conf":
             $html = new HtmlTop();
             $html->header();
             $html->register($hako, $cgi->dataSet);
             $html->footer();
             break;
         case "log":
             $html = new HtmlTop();
             $html->header();
             $html->log();
             $html->footer();
             break;
         default:
             $html = new HtmlTop();
             $html->header();
             $html->main($hako, $cgi->dataSet);
             $html->footer();
     }
     Util::unlock($lock);
     exit;
 }