コード例 #1
0
ファイル: LWCore.class.php プロジェクト: sonicmaster/RPG
 /**
  * @see WCF::__construct()
  */
 public function __construct()
 {
     // include options before locking
     try {
         $this->initOptions();
     } catch (Exception $e) {
         // ignore ...
     }
     // check locking
     $userID = @intval($_COOKIE[COOKIE_PREFIX . 'userID']);
     if ($userID) {
         $i = 0;
         do {
             try {
                 LWUtil::checkLock($userID);
                 // everything okay
                 break;
             } catch (SystemException $e) {
                 if ($i >= 6) {
                     die($e->getMessage());
                 }
                 ++$i;
                 usleep(500000);
             }
         } while (true);
     }
     // bugfix
     if (WCF::getDB() !== null) {
         return false;
     }
     parent::__construct();
     // game-frontend only
     if ($this->getUser()->userID == 0) {
         return;
     }
     $args = array_merge($_GET, $_POST);
     if (isset($args['password'])) {
         unset($args['password']);
     }
     // log request
     $sql = "INSERT INTO ugml_request\r\n\t\t\t\t(userID, `time`, ip,\r\n\t\t\t\t data)\r\n\t\t\t\tVALUES\r\n\t\t\t\t(" . $this->getUser()->userID . ", " . TIME_NOW . ", INET_ATON('" . $_SERVER['REMOTE_ADDR'] . "'),\r\n\t\t\t\t '" . escapeString(SerializeUtil::serialize(array('page' => LWUtil::getFileName(), 'args' => $args))) . "')";
     WCF::getDB()->sendQuery($sql);
     self::$requestID = WCF::getDB()->getInsertID();
     if ($this->getUser()->lastLoginTime < TIME_NOW - 60 * 60 * 12 && $this->getUser()->lastLoginTime > 1188597600 && !defined('LOGIN')) {
         self::logout('index.htm');
     }
     if ($this->getUser()) {
         if ($this->getUser()->urlaubs_modus == 2) {
             $sql = "UPDATE ugml_users\r\n\t\t\t\t\t\tSET urlaubs_modus = 0\r\n\t\t\t\t\t\tWHERE id = " . $this->getUser()->userID;
             WCF::getDB()->sendQuery($sql);
             Session::resetSessions($this->getUser()->userID);
             $this->getUser()->urlaubs_modus = 0;
         }
     }
     $this->initPlanet();
     // detect bots
     /*require_once(LW_DIR.'lib/data/protection/BotDetector.class.php');
     		new BotDetector();*/
     $this->initSpec();
 }
コード例 #2
0
ファイル: LWCore.class.php プロジェクト: sonicmaster/RPG
 /**
  * @see WCF::__construct()
  */
 public function __construct()
 {
     // include options before locking
     try {
         $this->initOptions();
     } catch (Exception $e) {
         // ignore ...
     }
     // check locking
     $userID = @intval($_COOKIE[COOKIE_PREFIX . 'userID']);
     if ($userID) {
         $i = 0;
         do {
             try {
                 LWUtil::checkLock($userID);
                 // everything okay
                 break;
             } catch (SystemException $e) {
                 if ($i >= 6) {
                     die($e->getMessage());
                 }
                 ++$i;
                 usleep(500000);
             }
         } while (true);
     }
     // bugfix
     if (WCF::getDB() !== null) {
         return false;
     }
     parent::__construct();
     // game-frontend only
     if ($this->getUser()->userID == 0) {
         return;
     }
     $args = array_merge($_GET, $_POST);
     if (isset($args['password'])) {
         unset($args['password']);
     }
     // log request
     $sql = "INSERT INTO ugml_request\n\t\t\t\t(userID, `time`, ip,\n\t\t\t\t data)\n\t\t\t\tVALUES\n\t\t\t\t(" . $this->getUser()->userID . ", " . TIME_NOW . ", INET_ATON('" . $_SERVER['REMOTE_ADDR'] . "'),\n\t\t\t\t '" . escapeString(SerializeUtil::serialize(array('page' => LWUtil::getFileName(), 'args' => $args))) . "')";
     WCF::getDB()->sendQuery($sql);
     self::$requestID = WCF::getDB()->getInsertID();
     if ($this->getUser()->lastLoginTime < TIME_NOW - 60 * 60 * 12 && $this->getUser()->lastLoginTime > 1188597600 && !defined('LOGIN')) {
         self::logout('index.htm');
     }
     if ($this->getUser()) {
         if ($this->getUser()->urlaubs_modus == 2) {
             $sql = "UPDATE ugml_users\n\t\t\t\t\t\tSET urlaubs_modus = 0\n\t\t\t\t\t\tWHERE id = " . $this->getUser()->userID;
             WCF::getDB()->sendQuery($sql);
             Session::resetSessions($this->getUser()->userID);
             $this->getUser()->urlaubs_modus = 0;
         }
     }
     // TODO dirty banned-fix
     if ($this->getUser()->wotBanned) {
         $row = WCF::getDB()->getFirstRow("SELECT * FROM ugml_banned WHERE who = '" . WCF::getUser()->username . "' ORDER BY id DESC");
         require_once WCF_DIR . 'lib/system/exception/NamedUserException.class.php';
         throw new NamedUserException('Du bist bis ' . date("d.m.Y G:i:s", $row['longer']) . ' von <a href="mailto:' . $row['email'] . '?subject=banned:' . $row['who'] . '">' . $row['author'] . '</a> gesperrt. Grund:<br><br>' . $row['theme'], 'Gebannt');
     }
     $this->initPlanet();
     // detect bots
     /*require_once(LW_DIR.'lib/data/protection/BotDetector.class.php');
     		new BotDetector();*/
     $this->initSpec();
 }