EVE-KILL /
zKillboard
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /* zKillboard |
||
| 3 | * Copyright (C) 2012-2015 EVE-KILL Team and EVSCO. |
||
| 4 | * |
||
| 5 | * This program is free software: you can redistribute it and/or modify |
||
| 6 | * it under the terms of the GNU Affero General Public License as published by |
||
| 7 | * the Free Software Foundation, either version 3 of the License, or |
||
| 8 | * (at your option) any later version. |
||
| 9 | * |
||
| 10 | * This program is distributed in the hope that it will be useful, |
||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 13 | * GNU Affero General Public License for more details. |
||
| 14 | * |
||
| 15 | * You should have received a copy of the GNU Affero General Public License |
||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
| 17 | */ |
||
| 18 | |||
| 19 | if (!User::isLoggedIn()) { |
||
| 20 | $app->render("login.html"); |
||
| 21 | die(); |
||
| 22 | } |
||
| 23 | |||
| 24 | $userID = User::getUserID(); |
||
| 25 | $key = "me"; |
||
| 26 | $error = ""; |
||
| 27 | |||
| 28 | $bannerUpdates = array(); |
||
| 29 | $aliasUpdates = array(); |
||
| 30 | |||
| 31 | if(isset($req)) |
||
| 32 | $key = $req; |
||
| 33 | |||
| 34 | global $twig, $adFreeMonthCost, $baseAddr; |
||
| 35 | if($_POST) |
||
| 36 | { |
||
| 37 | // Check for adfree purchase |
||
| 38 | $purchase = Util::getPost("purchase"); |
||
| 39 | if ($purchase) |
||
| 40 | { |
||
| 41 | if ($purchase == "donate") |
||
| 42 | { |
||
| 43 | $amount = User::getBalance($userID); |
||
| 44 | if ($amount > 0) { |
||
| 45 | Db::execute("insert into zz_account_history (userID, purchase, amount) values (:userID, :purchase, :amount)", |
||
| 46 | array(":userID" => $userID, ":purchase" => "donation", ":amount" => $amount)); |
||
| 47 | Db::execute("update zz_account_balance set balance = 0 where userID = :userID", array(":userID" => $userID)); |
||
| 48 | $twig->addGlobal("accountBalance", User::getBalance($userID)); |
||
| 49 | $error = "Thank you VERY much for your donation!"; |
||
| 50 | } else $error = "Gee, thanks for nothing..."; |
||
| 51 | } |
||
| 52 | else |
||
| 53 | { |
||
| 54 | $months = str_replace("buy", "", $purchase); |
||
| 55 | if ($months > 12 || $months < 0) $months = 1; |
||
| 56 | $balance = User::getBalance($userID); |
||
| 57 | $amount = $adFreeMonthCost * $months; |
||
| 58 | $bonus = floor($months / 6); |
||
| 59 | $months += $bonus; |
||
| 60 | if ($balance >= $amount) |
||
| 61 | { |
||
| 62 | $dttm = UserConfig::get("adFreeUntil", null); |
||
| 63 | $now = $dttm == null ? " now() " : "'$dttm'"; |
||
| 64 | $newDTTM = Db::queryField("select date_add($now, interval $months month) as dttm", "dttm", array(), 0); |
||
| 65 | Db::execute("update zz_account_balance set balance = balance - :amount where userID = :userID", |
||
| 66 | array(":userID" => $userID, ":amount" => $amount)); |
||
| 67 | Db::execute("insert into zz_account_history (userID, purchase, amount) values (:userID, :purchase, :amount)", |
||
| 68 | array(":userID" => $userID, ":purchase" => $purchase, ":amount" => $amount)); |
||
| 69 | UserConfig::set("adFreeUntil", $newDTTM); |
||
| 70 | |||
| 71 | $twig->addGlobal("accountBalance", User::getBalance($userID)); |
||
| 72 | $error = "Funds have been applied for $months month" . ($months == 1 ? "" : "s") . ", you are now ad free until $newDTTM"; |
||
| 73 | Log::log("Ad free time purchased by user $userID for $months months with " . number_format($amount) . " ISK"); |
||
| 74 | } else $error = "Insufficient Funds... Nice try though...."; |
||
| 75 | } |
||
| 76 | } |
||
| 77 | |||
| 78 | |||
| 79 | $keyid = Util::getPost("keyid"); |
||
| 80 | $vcode = Util::getPost("vcode"); |
||
| 81 | $label = Util::getPost("label"); |
||
| 82 | // Apikey stuff |
||
| 83 | if(isset($keyid) || isset($vcode)) |
||
| 84 | { |
||
| 85 | $check = Api::checkAPI($keyid, $vcode); |
||
| 86 | if($check == "success") |
||
| 87 | { |
||
| 88 | $error = Api::addKey($keyid, $vcode, $label); |
||
| 89 | } |
||
| 90 | else |
||
| 91 | { |
||
| 92 | $error = $check; |
||
| 93 | } |
||
| 94 | } |
||
| 95 | |||
| 96 | $deletesessionid = Util::getPost("deletesessionid"); |
||
| 97 | // delete a session |
||
| 98 | if(isset($deletesessionid)) |
||
| 99 | User::deleteSession($userID, $deletesessionid); |
||
| 100 | |||
| 101 | $deletekeyid = Util::getPost("deletekeyid"); |
||
| 102 | $deleteentity = Util::getPost("deleteentity"); |
||
| 103 | // Delete an apikey |
||
| 104 | if(isset($deletekeyid) && !isset($deleteentity)) |
||
| 105 | $error = Api::deleteKey($deletekeyid); |
||
| 106 | |||
| 107 | // Theme |
||
| 108 | $theme = Util::getPost("theme"); |
||
| 109 | if(isset($theme)) |
||
| 110 | { |
||
| 111 | UserConfig::set("theme", $theme); |
||
| 112 | $app->redirect($_SERVER["REQUEST_URI"]); |
||
| 113 | } |
||
| 114 | |||
| 115 | // Style |
||
| 116 | $style = Util::getPost("style"); |
||
| 117 | if(isset($style)) |
||
| 118 | { |
||
| 119 | UserConfig::set("style", $style); |
||
| 120 | $app->redirect($_SERVER["REQUEST_URI"]); |
||
| 121 | } |
||
| 122 | |||
| 123 | |||
| 124 | $email = Util::getPost("email"); |
||
| 125 | |||
| 126 | if(isset($email)) |
||
| 127 | { |
||
| 128 | Db::execute("UPDATE zz_users SET email = :email WHERE id = :userID", array(":email" => $email, ":userID" => $userID)); |
||
| 129 | } |
||
| 130 | |||
| 131 | // Password |
||
| 132 | $orgpw = Util::getPost("orgpw"); |
||
| 133 | $password = Util::getPost("password"); |
||
| 134 | $password2 = Util::getPost("password2"); |
||
| 135 | // Password |
||
| 136 | if(isset($orgpw) && isset($password) && isset($password2)) |
||
| 137 | { |
||
| 138 | if($password != $password2) |
||
| 139 | $error = "Passwords don't match, try again"; |
||
| 140 | elseif(Password::checkPassword($orgpw) == true) |
||
| 141 | { |
||
| 142 | Password::updatePassword($password); |
||
| 143 | $error = "Password updated"; |
||
| 144 | } |
||
| 145 | else |
||
| 146 | $error = "Original password is wrong, please try again"; |
||
| 147 | } |
||
| 148 | |||
| 149 | $timeago = Util::getPost("timeago"); |
||
| 150 | if(isset($timeago)) |
||
| 151 | UserConfig::set("timeago", $timeago); |
||
| 152 | |||
| 153 | $showVideo = Util::getPost("showVideo"); |
||
| 154 | if(isset($showVideo)) |
||
| 155 | UserConfig::set("showVideo", $showVideo); |
||
| 156 | |||
| 157 | $deleteentityid = Util::getPost("deleteentityid"); |
||
| 158 | $deleteentitytype = Util::getPost("deleteentitytype"); |
||
| 159 | // Tracker |
||
| 160 | if(isset($deleteentityid) && isset($deleteentitytype)) |
||
| 161 | { |
||
| 162 | $q = UserConfig::get("tracker_" . $deleteentitytype); |
||
| 163 | foreach($q as $k => $ent) |
||
| 164 | { |
||
| 165 | if($ent["id"] == $deleteentityid) |
||
| 166 | { |
||
| 167 | unset($q[$k]); |
||
| 168 | $error = $ent["name"]." has been removed"; |
||
| 169 | } |
||
| 170 | } |
||
| 171 | UserConfig::set("tracker_" . $deleteentitytype, $q); |
||
| 172 | } |
||
| 173 | |||
| 174 | $entity = Util::getPost("entity"); |
||
| 175 | $entitymetadata = Util::getPost("entitymetadata"); |
||
| 176 | // Tracker |
||
| 177 | if((isset($entity) && $entity != null) && (isset($entitymetadata) && $entitymetadata != null)) |
||
| 178 | { |
||
| 179 | $entitymetadata = json_decode("$entitymetadata", true); |
||
| 180 | $entities = UserConfig::get("tracker_" . $entitymetadata['type']); |
||
| 181 | $entity = array('id' => $entitymetadata['id'], 'name' => $entitymetadata['name']); |
||
| 182 | |||
| 183 | if(empty($entities) || !in_array($entity, $entities)) |
||
| 184 | { |
||
| 185 | $entities[] = $entity; |
||
| 186 | UserConfig::set("tracker_" . $entitymetadata['type'], $entities); |
||
| 187 | $error = "{$entitymetadata['name']} has been added to your tracking list"; |
||
| 188 | } |
||
| 189 | else |
||
| 190 | $error = "{$entitymetadata['name']} is already being tracked"; |
||
| 191 | } |
||
| 192 | |||
| 193 | $ddcombine = Util::getPost("ddcombine"); |
||
| 194 | if(isset($ddcombine)) |
||
| 195 | UserConfig::set("ddcombine", $ddcombine); |
||
| 196 | |||
| 197 | $ddmonthyear = Util::getPost("ddmonthyear"); |
||
| 198 | if(isset($ddmonthyear)) |
||
| 199 | UserConfig::set("ddmonthyear",$ddmonthyear); |
||
| 200 | |||
| 201 | $subdomain = Util::getPost("subdomain"); |
||
| 202 | if ($subdomain) |
||
| 203 | { |
||
| 204 | $banner = Util::getPost("banner"); |
||
| 205 | $alias = Util::getPost("alias"); |
||
| 206 | $bannerUpdates = array("$subdomain" => $banner); |
||
| 207 | if (strlen($alias) == 0 || (strlen($alias) >= 6 && strlen($alias) <= 64)) $aliasUpdates = array("$subdomain" => $alias); |
||
| 208 | // table is updated if user is ceo/executor in code thta loads this information below |
||
| 209 | } |
||
| 210 | } |
||
| 211 | $data["entities"] = Account::getUserTrackerData(); |
||
| 212 | |||
| 213 | // Theme |
||
| 214 | $theme = UserConfig::get("theme", "zkillboard"); |
||
| 215 | $data["themesAvailable"] = Util::themesAvailable(); |
||
| 216 | $data["currentTheme"] = $theme; |
||
| 217 | |||
| 218 | // Style |
||
| 219 | $data["stylesAvailable"] = $theme::availableStyles(); |
||
| 220 | $data["currentStyle"] = UserConfig::get("style"); |
||
| 221 | |||
| 222 | $data["apiKeys"] = Api::getKeys($userID); |
||
| 223 | $data["apiChars"] = Api::getCharacters($userID); |
||
| 224 | $charKeys = Api::getCharacterKeys($userID); |
||
| 225 | $charKeys = Info::addInfo($charKeys); |
||
| 226 | $data["apiCharKeys"] = $charKeys; |
||
| 227 | $data["userInfo"] = User::getUserInfo(); |
||
| 228 | $data["timeago"] = UserConfig::get("timeago"); |
||
| 229 | $data["showVideo"] = UserConfig::get("showVideo"); |
||
| 230 | $data["ddcombine"] = UserConfig::get("ddcombine"); |
||
| 231 | $data["ddmonthyear"] = UserConfig::get("ddmonthyear"); |
||
| 232 | $data["useSummaryAccordion"] = UserConfig::get("useSummaryAccordion", true); |
||
| 233 | $data["sessions"] = User::getSessions($userID); |
||
| 234 | $data["history"] = User::getPaymentHistory($userID); |
||
| 235 | |||
| 236 | $apiChars = Api::getCharacters($userID); |
||
| 237 | $domainChars = array(); |
||
| 238 | if ($apiChars != null) foreach($apiChars as $apiChar) { |
||
| 239 | $char = Info::getPilotDetails($apiChar["characterID"], null); |
||
|
0 ignored issues
–
show
|
|||
| 240 | $char["corpTicker"] = modifyTicker(Db::queryField("select ticker from zz_corporations where corporationID = :corpID", "ticker", array(":corpID" => $char["corporationID"]))); |
||
| 241 | $char["alliTicker"] = modifyTicker(Db::queryField("select ticker from zz_alliances where allianceID = :alliID", "ticker", array(":alliID" => $char["allianceID"]))); |
||
| 242 | |||
| 243 | $domainChars[] = $char; |
||
| 244 | } |
||
| 245 | |||
| 246 | $corps = array(); |
||
| 247 | $allis = array(); |
||
| 248 | foreach ($domainChars as $domainChar) { |
||
| 249 | if (@$domainChar["isCEO"]) { |
||
| 250 | $subdomain = modifyTicker($domainChar["corpTicker"]) . ".$baseAddr"; |
||
| 251 | if (isset($bannerUpdates[$subdomain])) { |
||
| 252 | $banner = $bannerUpdates[$subdomain]; |
||
| 253 | |||
| 254 | Db::execute("insert into zz_subdomains (subdomain, banner) values (:subdomain, :banner) on duplicate key update banner = :banner", array(":subdomain" => $subdomain, ":banner" => $banner)); |
||
| 255 | $error = "$subdomain has been updated, please wait up to 2 minutes for the changes to take effect."; |
||
| 256 | } |
||
| 257 | if (isset($aliasUpdates[$subdomain])) |
||
| 258 | { |
||
| 259 | $alias = $aliasUpdates[$subdomain]; |
||
| 260 | // Make sure no one else has the alias |
||
| 261 | $count = Db::queryField("select count(*) count from zz_subdomains where alias = :alias and subdomain != :subdomain", "count", array(":subdomain" => $subdomain, ":alias" => $alias)); |
||
| 262 | if ($count == 0 || strlen($alias) == 0) |
||
| 263 | { |
||
| 264 | Db::execute("insert into zz_subdomains (subdomain, alias) values (:subdomain, :alias) on duplicate key update alias = :alias", array(":subdomain" => $subdomain, ":alias" => $alias)); |
||
| 265 | $error = "$subdomain has been updated, please wait up to 2 minutes for the changes to take effect."; |
||
| 266 | } else |
||
| 267 | { |
||
| 268 | $error = "Sorry, someone has already taken the subdomain $alias"; |
||
| 269 | } |
||
| 270 | } |
||
| 271 | |||
| 272 | $corpStatus = Db::queryRow("select adfreeUntil, banner, alias from zz_subdomains where subdomain = :subdomain", array(":subdomain" => $subdomain), 0); |
||
| 273 | $domainChar["adfreeUntil"] = @$corpStatus["adfreeUntil"]; |
||
| 274 | $domainChar["banner"] = @$corpStatus["banner"]; |
||
| 275 | $domainChar["alias"] = @$corpStatus["alias"]; |
||
| 276 | $corps[] = $domainChar; |
||
| 277 | } |
||
| 278 | if (@$domainChar["isExecutorCEO"]) { |
||
| 279 | $subdomain = modifyTicker($domainChar["alliTicker"]) . ".$baseAddr"; |
||
| 280 | if (isset($bannerUpdates[$subdomain])) { |
||
| 281 | $banner = $bannerUpdates[$subdomain]; |
||
| 282 | Db::execute("insert into zz_subdomains (subdomain, banner) values (:subdomain, :banner) on duplicate key update banner = :banner", array(":subdomain" => $subdomain, ":banner" => $banner)); |
||
| 283 | $error = "Banner updated for $subdomain, please wait 2 minutes for the change to take effect."; |
||
| 284 | } |
||
| 285 | $status = Db::queryRow("select adfreeUntil, banner from zz_subdomains where subdomain = :subdomain", array(":subdomain" => $subdomain), 0); |
||
| 286 | $domainChar["adfreeUntil"] = @$status["adfreeUntil"]; |
||
| 287 | $domainChar["banner"] = @$status["banner"]; |
||
| 288 | $allis[] = $domainChar; |
||
| 289 | } |
||
| 290 | |||
| 291 | $showFacebook = Util::getPost("showFacebook"); |
||
| 292 | if ($showFacebook) |
||
| 293 | { |
||
| 294 | UserConfig::set("showFacebook", $showFacebook == "true"); |
||
| 295 | $error = "Facebook setting updated to " . ($showFacebook ? " display." : " not display.") . " The next page load will reflect the change."; |
||
| 296 | } |
||
| 297 | } |
||
| 298 | $data["domainCorps"] = $corps; |
||
| 299 | $data["domainAllis"] = $allis; |
||
| 300 | $data["domainChars"] = $domainChars; |
||
| 301 | $data["showFacebook"] = UserConfig::get("showFacebook", true); |
||
| 302 | |||
| 303 | $app->render("account.html", array("data" => $data, "message" => $error, "key" => $key, "reqid" => $reqid)); |
||
| 304 | |||
| 305 | function modifyTicker($ticker) { |
||
| 306 | $ticker = str_replace(" ", "_", $ticker); |
||
| 307 | $ticker = preg_replace('/^\./', "dot.", $ticker); |
||
| 308 | $ticker = preg_replace('/\.$/', ".dot", $ticker); |
||
| 309 | return strtolower($ticker); |
||
| 310 | } |
||
| 311 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: