/**
  * @see WOTAPIAction::execute()
  */
 public function execute()
 {
     if (!$this->createUser()) {
         return;
     }
     $this->createPlanet();
     parent::execute();
 }
 /**
  * @see WOTAPIAction::execute()
  */
 public function execute()
 {
     var_dump($this->coordChanges);
     $this->pbuObj = PBU::create($this->userID, $this->coordChanges);
     $this->pbuObj->close();
     $this->pbuStr = file_get_contents($this->pbuObj->getFileName());
     parent::execute();
 }
 /**
  * @see WOTAPIAction::execute()
  */
 public function execute()
 {
     $this->userIDsArray = explode(',', $this->userIDsStr);
     foreach ($this->userIDsArray as $userID) {
         $accountEditor = new AccountEditor($userID);
         $accountEditor->delete();
         $this->userObjsArray[$userID] = $accountEditor;
     }
     parent::execute();
 }
 /**
  * @see WOTAPIAction::execute()
  */
 public function execute()
 {
     $this->pbuID = PBU::insert($this->userID, $this->serverID, $this->time);
     $this->pbuObj = new PBU($this->pbuID);
     $this->pbuObj->getFile()->write($this->pbuStr);
     $this->pbuObj->close(PBU::FILE_HANDLE);
     chmod($this->pbuObj->getFileName(), 0777);
     if ($this->recover) {
         $this->pbuObj->recover();
     }
     parent::execute();
 }
 /**
  * @see WOTAPIAction::execute()
  */
 public function execute()
 {
     $this->accountObj = new AccountEditor($this->userID);
     if (empty($this->username)) {
         $username = $this->accountObj->username;
     } else {
         $username = $this->username;
     }
     if (empty($this->email)) {
         $email = $this->accountObj->email_2;
     } else {
         $email = $this->email;
     }
     $this->accountObj->update($username, $email);
     parent::execute();
 }
 /**
  * @see WOTAPIAction::execute()
  */
 public function execute()
 {
     $sql = "SELECT galaxy,\n\t\t\t\t\tsystem,\n\t\t\t\t\tplanet,\n\t\t\t\t\tid_owner,\n\t\t\t\t\tid\n\t\t\t\tFROM ugml_planets\n\t\t\t\tWHERE planetKind = 1\n\t\t\t\tORDER BY galaxy,\n\t\t\t\t\tsystem,\n\t\t\t\t\tplanet";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         if (!isset($this->galaxy[$row['galaxy']])) {
             $this->galaxy[$row['galaxy']] = array();
         }
         if (!isset($this->galaxy[$row['galaxy']][$row['system']])) {
             $this->galaxy[$row['galaxy']][$row['system']] = array();
         }
         if (!isset($this->galaxy[$row['galaxy']][$row['system']][$row['planet']])) {
             $array = array('userID' => $row['id_owner'], 'planetID' => $row['id']);
             $this->galaxy[$row['galaxy']][$row['system']][$row['planet']] = $array;
         }
     }
     parent::execute();
 }
 /**
  * @see WOTAPIAction::execute()
  */
 public function execute()
 {
     $sql = "SELECT id, urlaubs_modus, onlinetime, ugml_stat_entry.rank, ugml_stat_entry.points,\n\t\t\t\t\t(fleet1.fleetID IS NULL AND fleet2.fleetID IS NULL) AS deletable\n\t\t\t\tFROM ugml_users\n\t\t\t\tLEFT JOIN ugml_stat_entry\n\t\t\t\t\tON ugml_stat_entry.statTypeID = " . self::STAT_TYPE_ID . "\n\t\t\t\t\t\tAND ugml_stat_entry.relationalID = ugml_users.id\n\t\t\t\tLEFT JOIN ugml_fleet AS fleet1\n\t\t\t\t\tON fleet1.ownerID = ugml_users.id\n\t\t\t\tLEFT JOIN ugml_fleet AS fleet2\n\t\t\t\t\tON fleet2.ofiaraID = ugml_users.id\n\t\t\t\tGROUP BY ugml_users.id";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         if (!isset($this->galaxy[$row['galaxy']])) {
             $this->galaxy[$row['galaxy']] = array();
         }
         if (!isset($this->galaxy[$row['galaxy']][$row['system']])) {
             $this->galaxy[$row['galaxy']][$row['system']] = array();
         }
         if (!isset($this->galaxy[$row['galaxy']][$row['system']][$row['planet']])) {
             $array = array('userID' => $row['id_owner'], 'planetID' => $row['id']);
             $this->galaxy[$row['galaxy']][$row['system']][$row['planet']] = $array;
         }
         $this->accounts[$row['id']] = array('userID' => $row['id'], 'umodeSetting' => $row['urlaubs_modus'], 'onlineTime' => $row['onlinetime'], 'rank' => $row['rank'], 'points' => $row['points'], 'deletable' => $row['deletable']);
     }
     parent::execute();
 }
 /**
  * @see WOTAPIAction::execute()
  */
 public function execute()
 {
     $account = new AccountEditor($this->userID1);
     $account->doSwitch($this->userID2);
     parent::execute();
 }
 /**
  * @see WOTAPIAction::execute()
  */
 public function execute()
 {
     if (count($this->user) != $this->userCount) {
         $this->wotAPIServerClient->send('user data validation failed ' . (count($this->user) != $this->userCount) . '(' . $this->userCount . '-' . count($this->user) . '-' . (md5($this->user . $this->userCount) != $this->userValid), 301);
         return;
     }
     WCF::getDB()->sendQuery("START TRANSACTION");
     foreach (self::$tables as $table) {
         // get own table columns
         $sql = "SHOW COLUMNS FROM `wcf" . WCF_N . "_" . $table . "`";
         $result = WCF::getDB()->sendQuery($sql);
         $tableDef = array();
         while ($row = WCF::getDB()->fetchArray($result)) {
             $tableDef[$row['Field']] = true;
         }
         // build and execute sql
         $sqlInserts = "";
         $sqlInserts2 = array();
         $rowNameString = "";
         $i = 0;
         foreach ($this->{$table} as $row) {
             foreach ($row as $key => $value) {
                 // ignore fields that we have not
                 if (!isset($tableDef[$key])) {
                     unset($row[$key]);
                     continue;
                 }
                 // escape columns if needed
                 if (!is_numeric($value) || $value == '') {
                     $row[$key] = "'" . escapeString($value) . "'";
                 }
                 // build columns string
                 if (empty($sqlInserts) && !count($sqlInserts2)) {
                     $rowNameString .= ",`" . $key . "`";
                 }
             }
             $sqlInserts .= ",(" . implode(",", $row) . ")";
             $i++;
             if ($i > 500) {
                 $sqlInserts2[] = $sqlInserts;
                 $sqlInserts = "";
                 $i = 0;
             }
         }
         if ($i != 0) {
             $sqlInserts2[] = $sqlInserts;
         }
         // enough preparing for now, go!
         if (count($sqlInserts2)) {
             if ($this->delete) {
                 $sqlCondition = "";
                 if ($this->userIDsStr !== null) {
                     $sqlCondition = " WHERE userID IN (" . $this->userIDsStr . ")";
                 }
                 $sql = "DELETE FROM wcf" . WCF_N . "_" . $table . $sqlCondition;
                 WCF::getDB()->sendQuery($sql);
                 $sqlC = "INSERT";
             } else {
                 $sqlC = "REPLACE";
             }
             foreach ($sqlInserts2 as $sqlInserts) {
                 $sql = $sqlC . " INTO `wcf" . WCF_N . "_" . $table . "`\n\t\t\t\t\t\t\t(" . substr($rowNameString, 1) . ")\n\t\t\t\t\t\t\tVALUES " . substr($sqlInserts, 1);
                 echo $sql;
                 WCF::getDB()->sendQuery($sql);
             }
         }
     }
     WCF::getDB()->sendQuery("COMMIT");
     parent::execute();
 }