Example #1
0
 /**
  * @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();
 }
 /**
  * Updates ships and resources.
  */
 public function update()
 {
     $fleetData = $this->getPoolData();
     foreach ($fleetData as &$fleetDate) {
         $fleetObj = Fleet::getInstance($fleetDate['fleetID']);
         $fleetDate['resources'] = array('metal' => $fleetObj->metal, 'crystal' => $fleetObj->crystal, 'deuterium' => $fleetObj->deuterium);
         $fleetDate['spec'] = $fleetObj->fleet;
         $fleetDate['missionID'] = $fleetObj->missionID;
     }
     if (isset($fleetData[0])) {
         $fleet0 = Fleet::getInstance($fleetData[0]['fleetID']);
         if ($fleet0->missionID == 11 && $fleetData[0]['passage'] == "flight") {
             $formation = $fleet0->getNavalFormation();
             foreach ($fleetData as $key => &$fleetDate) {
                 if (!isset($formation->fleets[$fleetDate['fleetID']])) {
                     unset($fleetData[$key]);
                 }
             }
         }
     }
     $sql = "UPDATE ugml_ovent\n\t\t\t\tSET data = '" . SerializeUtil::serialize($fleetData) . "'\n\t\t\t\tWHERE oventID = " . $this->oventID;
     WCF::getDB()->sendQuery($sql);
 }
Example #3
0
 /**
  * Inserts a new overview event row.
  * 
  * @param	int		ovent type id
  * @param	int		time
  * @param	mixed	event id (may be null)
  * @param	int		relational id
  * @param	array	additional fields
  * @param	bool	checked
  * @param	array	data
  * @return	int		ovent id
  */
 public static function insert($oventTypeID, $time, $eventID, $relationalID, $additionalFields, $checked, $data)
 {
     $sql = "INSERT INTO ugml_ovent\r\n\t\t\t\t(oventTypeID, `time`, eventID,\r\n\t\t\t\t relationalID, checked, data,\r\n\t\t\t\t " . implode(',', array_keys($additionalFields)) . ")\r\n\t\t\t\tVALUES\r\n\t\t\t\t(" . $oventTypeID . ", " . $time . ", " . $eventID . ",\r\n\t\t\t\t " . $relationalID . ", " . intval($checked) . ", '" . SerializeUtil::serialize($data) . "',\r\n\t\t\t\t " . implode(',', $additionalFields) . ")";
     WCF::getDB()->sendQuery($sql);
     return WCF::getDB()->getInsertID();
 }
Example #4
0
 /**
  * Unserializes the pool data.
  */
 private function extractPool()
 {
     if (!count($this->poolData)) {
         $this->poolData = SerializeUtil::unserialize($this->data['data']);
     }
 }
Example #5
0
    You should have received a copy of the GNU Affero General Public License
    along with WOT Game.  If not, see <http://www.gnu.org/licenses/>.
*/
define('INSIDE', true);
$ugamela_root_path = '../';
include $ugamela_root_path . 'extension.inc';
include $ugamela_root_path . 'common.' . $phpEx;
if (!check_user()) {
    header("Location: login.php");
    die;
}
require_once LW_DIR . 'lib/util/SerializeUtil.class.php';
$alt = $neu = 0;
$sql = "SELECT data\n\t\tFROM ugml_request\n\t\tWHERE `time` > " . (TIME_NOW - 86400);
$result = WCF::getDB()->sendUnbufferedQuery($sql);
echo "sent query ...";
while ($row = WCF::getDB()->fetchArray($result)) {
    $data = SerializeUtil::unserialize($row['data']);
    if ($data['page'] == 'overview') {
        $alt++;
    } else {
        if ($data['page'] == 'index' && $data['args']['page'] == 'Overview') {
            $neu++;
        }
    }
}
echo "Gesamt: " . ($alt + $neu) . "<br />";
echo "Alt: " . $alt . "<br />";
echo "Neu: " . $neu . "<br />";
echo "Alt / Neu: " . $alt / ($alt + $neu) . "<br />";
Example #6
0
 /**
  * @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();
 }