application.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <?php
  2. require_once($_SERVER['DOCUMENT_ROOT'] . "/modules/core/header.php");
  3. require_once($_SERVER['DOCUMENT_ROOT'] . "/modules/core/staff.php");
  4. if(empty($_GET['app_id'])) die();
  5. if(!isset($link))
  6. {
  7. $link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
  8. if($link === false)
  9. {
  10. die("ERROR: Could not connect. " . mysqli_connect_error());
  11. }
  12. }
  13. $applicid = $_GET['app_id'];
  14. $user_check_query = "SELECT `reviewed_by` FROM application WHERE `reviewed_by` = '$playersqlid' AND `status` = '1' AND `id` != '$applicid'";
  15. $result = mysqli_query($link, $user_check_query);
  16. $rowcount = $result->num_rows;
  17. $noperm = false;
  18. if($rowcount > 0) $noperm = true;
  19. $user_check_query = "SELECT * FROM `application` WHERE `id` = '$applicid' LIMIT 1";
  20. $result = mysqli_query($link, $user_check_query);
  21. $rowcount = $result->num_rows;
  22. if($rowcount == 0) die();
  23. $result2 = mysqli_fetch_array($result, MYSQLI_ASSOC);
  24. $app_id = $result2['id'];
  25. $master = $result2['master'];
  26. $char_name = $result2['char_name'];
  27. $reviewed_by = $result2['reviewed_by'];
  28. $story = $result2['story'];
  29. $status = $result2['status'];
  30. $ip_address = $result2['ip_address'];
  31. $country = $result2['country_name'];
  32. $country_code = $result2['country_code'];
  33. $accepted = $result2['accepted'];
  34. $origin = $result2['origin'];
  35. $gender = $result2['gender'];
  36. $age = $result2['age'];
  37. $date_of_review = $result2['date_of_review'];
  38. $date_of_verdict = $result2['date_of_verdict'];
  39. $verdict = $result2['reason'];
  40. $_POST['verdict'] = "";
  41. $year = date("Y");
  42. $age = $year - $age;
  43. $flag_1 = "";
  44. $flag_2 = "";
  45. $flag_3 = "";
  46. $flag_4 = "";
  47. $flag_5 = "";
  48. $mastername = returnMaster($link, $master);
  49. mysqli_free_result($result);
  50. $user_check_query = "SELECT `answer1`, `answer2`, `answered_questions` FROM `accounts` WHERE `ID` = '$master' LIMIT 1";
  51. $result = mysqli_query($link, $user_check_query);
  52. $result2 = mysqli_fetch_array($result, MYSQLI_ASSOC);
  53. $answer1 = $result2['answer1'];
  54. $answer2 = $result2['answer2'];
  55. $answered_questions = $result2['answered_questions'];
  56. mysqli_free_result($result);
  57. $user_check_query = "SELECT `name` FROM `bans` WHERE `playerIP` = '$ip_address' LIMIT 1";
  58. $result = mysqli_query($link, $user_check_query);
  59. $rowcount = $result->num_rows;
  60. if($rowcount > 0)
  61. {
  62. $flag_1 = "$rowcount bans on the same IP address";
  63. }
  64. if(strlen($ip_address) > 5 && characterCount($ip_address, ".") > 5)
  65. {
  66. $meci = explode(".", $ip_address);
  67. $partial_ip = $meci[0].".".$meci[1].".".$meci[2];
  68. $user_check_query = "SELECT `playerIP` FROM bans WHERE `playerIP` LIKE '$partial_ip%'";
  69. $result = mysqli_query($link, $user_check_query);
  70. $result2 = mysqli_fetch_array($result, MYSQLI_ASSOC);
  71. $rowcount = $result->num_rows;
  72. $playerIP = $result2['playerIP'];
  73. mysqli_free_result($result);
  74. if($rowcount > 0)
  75. {
  76. $flag_2 = "IP $ip_address matches ban $playerIP on the same subnet";
  77. }
  78. }
  79. $url = "https://en.wikipedia.org/w/api.php?action=opensearch&search=$char_name&limit=1&namespace=0&format=json";
  80. $body = file_get_contents($url);
  81. if(strpos($body, 'wikipedia.org') !== false)
  82. {
  83. $fpos = strpos($body, ',["') + 3;
  84. $spos = strpos($body, '"', $fpos);
  85. $flag_4 = substr($body, $fpos, $spos - $fpos);
  86. $flag_4 = "Wikipedia Article on $flag_4";
  87. $firstpos = strpos($body, "https:");
  88. $secondpos = strpos($body, '"]', $firstpos);
  89. $wiki_link = substr($body, $firstpos);
  90. $wiki_link = str_replace('"]]', "", $wiki_link);
  91. }
  92. $_SESSION['viewingapp'] = $app_id;
  93. if(strlen($story) > 10 && characterCount($story, ".") > 2)
  94. {
  95. $sim = similarApplication($link, $story, $app_id);
  96. if($sim != -1)
  97. {
  98. $flag_5 = "Similar to Application #$sim";
  99. }
  100. }
  101. $user_check_query = "SELECT `id`, `char_name`, `status`, `accepted` FROM `application` WHERE `master` = '$master' AND `id` != '$applicid'";
  102. $result = mysqli_query($link, $user_check_query);
  103. $count = 0;
  104. $PastApplications = array();
  105. while($result2 = mysqli_fetch_array($result, MYSQLI_ASSOC))
  106. {
  107. array_push($PastApplications, $result2);
  108. }
  109. mysqli_free_result($result);
  110. ?>
  111. <router-outlet _ngcontent-tnh-c136="" class="router-outlet"></router-outlet>
  112. <app-character-list _nghost-tnh-c142="">
  113. <div class="content-header" *ngIf="app">
  114. <h3>Application #<?php echo $app_id; ?> - <?php echo $mastername; ?> | <?php echo $char_name; ?>
  115. <?php
  116. switch($status)
  117. {
  118. case 0:
  119. {
  120. ?>
  121. - <strong><span style="color:orange">Pending</span></strong>
  122. <?php
  123. break;
  124. }
  125. case 1:
  126. {
  127. ?>
  128. - <strong><span style="color:#34649f">Reviewing</span></strong>
  129. <?php
  130. break;
  131. }
  132. case 2:
  133. {
  134. if($accepted == 1)
  135. {
  136. ?>
  137. - <strong><span style="color:green">Accepted</span></strong>
  138. <?php
  139. }
  140. else if($accepted == 2)
  141. {
  142. ?>
  143. - <strong><span style="color:tomato">Denied and Banned</span></strong>
  144. <?php
  145. }
  146. else
  147. {
  148. ?>
  149. - <strong><span style="color:tomato">Denied</span></strong>
  150. <?php
  151. }
  152. break;
  153. }
  154. }
  155. ?>
  156. </h3>
  157. </div>
  158. <div id="mask" style="display: none;"><?php echo $char_name; ?></div>
  159. <div class="content" *ngIf="app">
  160. <section class="cstwothirds transparent nopadding">
  161. <section class="card">
  162. <div class="card-title"> In Character Information </div>
  163. <div style="font-size: 15px; background: white; word-wrap: break-word; box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;">
  164. <div style="display: flex; padding: 10px;">
  165. <span style="width: 30%; border: none;">
  166. <b>Character Name:</b><br>
  167. <?php echo $char_name; ?>
  168. </span>
  169. <span style="width: 30%; border: none;">
  170. <b>Origin:</b></br>
  171. <?php echo $origin; ?>
  172. </span>
  173. <span style="width: 20%; border: none;">
  174. <b>Gender:</b></br>
  175. <?php echo $gender; ?>
  176. </span>
  177. <span style="width: 20%; border: none;">
  178. <b>Age:</b></br>
  179. <?php echo $age; ?>
  180. </span>
  181. </div>
  182. <div style="padding: 10px; position: relative;">
  183. <span style="width: 100%;">
  184. <b>Background story:</b><br>
  185. <?php echo $story; ?>
  186. <div style="position: absolute; right: 10px; bottom: 10px; font-size: 12px; opacity: 0.8;">Application Length: <?php echo strlen($story); ?></div><br><br>
  187. </span>
  188. </div>
  189. </div>
  190. </section>
  191. </br>
  192. <section class="card">
  193. <div class="card-title"> Out Of Character Information </div>
  194. <div style="font-size: 15px; background: white; word-wrap: break-word; box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;">
  195. <div style="padding: 10px;">
  196. <span style="width: 100%;">
  197. <b>Have you got any past RP experience on SA-MP or another game? If past RP experience on SA-MP, what server(s) was it and what was your IG name(s)?</b></br>
  198. <?php echo $answer1; ?>
  199. </span>
  200. </div>
  201. <div style="padding: 10px;">
  202. <span style="width: 100%;">
  203. <b>Explain some roleplaying terms, like metagaming and powergaming, and give examples to each.</b></br>
  204. <?php echo $answer2; ?>
  205. </span>
  206. </div>
  207. </div>
  208. </section>
  209. <?php if(($status == 1 && $reviewed_by == $playersqlid) || $status == 2) { ?>
  210. <div class="section-category">
  211. <h4>Verdict</h4>
  212. </div>
  213. <?php } ?>
  214. <section class="transparent nopadding" *ngIf="!app.handled && (!app.reservation || app.reservation.user.id === me.id)">
  215. <form id="hiddenField" action="" method="post" accept-charset="utf-8">
  216. <?php if(($status == 1 && $reviewed_by == $playersqlid) || $status == 2) { ?><textarea style="overflow:hidden" name="verdict" id="verdict" placeholder="<?php echo htmlspecialchars($verdict); ?>" [(ngModel)]="reason" <?php if($status == 2 || $reviewed_by != $playersqlid) { ?>disabled<?php } ?>></textarea><?php } ?>
  217. <?php if($status != 2 && $reviewed_by == $playersqlid) { ?>
  218. <div class="buttons">
  219. <app-button _ngcontent-tnh-c145="" caption="Freeze" icon="fa-check" class="green" _nghost-tnh-c216="" onclick="APPLICATION_HANDLE(1)">
  220. <div _ngcontent-tnh-c216="" class="btn-wrapper">
  221. <div _ngcontent-tnh-c216="" class="button">
  222. <div _ngcontent-tnh-c216="" class="icon"><i _ngcontent-tnh-c216="" class="fa fa-check"></i></div>
  223. <!---->
  224. <div _ngcontent-tnh-c216="" class="caption">Accept</a></div>
  225. <!---->
  226. </div>
  227. <!---->
  228. </div>
  229. </app-button>
  230. <app-button _ngcontent-tnh-c145="" caption="Freeze" icon="fa-times" class="tomato" _nghost-tnh-c216="" onclick="APPLICATION_HANDLE(0)">
  231. <div _ngcontent-tnh-c216="" class="btn-wrapper">
  232. <div _ngcontent-tnh-c216="" class="button">
  233. <div _ngcontent-tnh-c216="" class="icon"><i _ngcontent-tnh-c216="" class="fa fa-times"></i></div>
  234. <!---->
  235. <div _ngcontent-tnh-c216="" class="caption">Deny</div>
  236. <!---->
  237. </div>
  238. <!---->
  239. </div>
  240. </app-button>
  241. <app-button _ngcontent-tnh-c145="" caption="Freeze" icon="fa-snowflake" class="red fl-ri" _nghost-tnh-c216="" onclick="APPLICATION_HANDLE(2)">
  242. <div _ngcontent-tnh-c216="" class="btn-wrapper">
  243. <div _ngcontent-tnh-c216="" class="button">
  244. <div _ngcontent-tnh-c216="" class="icon"><i _ngcontent-tnh-c216="" class="fa fa-gavel"></i></div>
  245. <!---->
  246. <div _ngcontent-tnh-c216="" class="caption">Ban <?php echo $mastername; ?></div>
  247. <!---->
  248. </div>
  249. <!---->
  250. </div>
  251. </app-button>
  252. </div>
  253. </form>
  254. <?php } ?>
  255. <?php if($status == 0 && $noperm == false) { ?>
  256. <div class="buttons">
  257. </br>
  258. <app-button _ngcontent-tnh-c145="" caption="Freeze" icon="fa-eye" class="blue" _nghost-tnh-c216="" onClick="document.location.href='./modules/template/admin/application/review.php?app_id=<?php echo $app_id; ?>'">
  259. <div _ngcontent-tnh-c216="" class="btn-wrapper">
  260. <div _ngcontent-tnh-c216="" class="button">
  261. <div _ngcontent-tnh-c216="" class="icon"><i _ngcontent-tnh-c216="" class="fa fa-eye"></i></div>
  262. <!---->
  263. <div _ngcontent-tnh-c216="" class="caption">Review</div>
  264. <!---->
  265. </div>
  266. <!---->
  267. </div>
  268. </app-button>
  269. </div>
  270. <?php } else if($status == 1) { ?>
  271. </br>
  272. <app-info-bar _ngcontent-tnh-c169="" type="warning" class="cs-1" _nghost-tnh-c215="">
  273. <div _ngcontent-tnh-c215="" class="warning infobar">
  274. <div _ngcontent-tnh-c215="" class="icon"><i _ngcontent-tnh-c215="" class="fa fa-exclamation-triangle fa-fw"></i></div>
  275. <div _ngcontent-tnh-c215="" class="message">This application is being reviewed by <strong><?php echo returnMaster($link, $reviewed_by); ?></strong> since <?php echo $date_of_review; ?></div>
  276. </div>
  277. </app-info-bar>
  278. <?php } else if($status == 2) {
  279. if($accepted == 0) $str = "denied";
  280. else if($accepted == 1) $str = "accepted";
  281. else if($accepted == 2) $str = "denied and banned";?>
  282. </br>
  283. <app-info-bar _ngcontent-tnh-c169="" type="info" class="cs-1" _nghost-tnh-c215="">
  284. <div _ngcontent-tnh-c215="" class="info infobar">
  285. <div _ngcontent-tnh-c215="" class="icon"><i _ngcontent-tnh-c215="" class="fa fa-exclamation-triangle fa-fw"></i></div>
  286. <div _ngcontent-tnh-c215="" class="message">This application was <?php echo $str; ?> by <strong [innerHTML]="app.handler.username"><?php echo returnMaster($link, $reviewed_by); ?></strong> on <?php echo $date_of_verdict; ?></div>
  287. </div>
  288. </app-info-bar>
  289. <?php } ?>
  290. </section>
  291. </br>
  292. </section>
  293. <section class="nopadding transparent csthird">
  294. <section class="card">
  295. <div class="card-title"> Info </div>
  296. <table class="onedimension" cellspacing="0">
  297. <tr>
  298. <td>Account</td>
  299. <td id="master_name"><a><?php echo $mastername; ?></a></td> </tr>
  300. <tr>
  301. <td>Country</td>
  302. <td><img src="/assets/images/flags/<?php echo strtolower($country_code); ?>.svg" width="24" height="24" align="center"> <?php echo $country; ?> </td> </tr> </table> </section>
  303. <section class="card margin-top-10">
  304. <div class="card-title"> Flags </div>
  305. <ul class="flags">
  306. <?php if(strlen($flag_5) > 0) { ?>
  307. <li class="warning cursor-pointer"> <i class="icon fa fa-fw fa-file color-blue"></i> <a href="./admin/application/<?php echo $sim; ?>" target="_blank"><?php echo $flag_5; ?></a> </li>
  308. <?php } ?>
  309. <?php if(strlen($flag_1) > 0) { ?>
  310. <li class="serious cursor"> <i class="icon fa fa-fw fa-gavel color-blue"></i> <?php echo $flag_1; ?> </a> </li>
  311. <?php } ?>
  312. <?php if(strlen($flag_2) > 0) { ?>
  313. <li class="warning"> <i class="icon fa fa-fw fa-gavel color-blue"></i> <?php echo $flag_2; ?> </a> </li>
  314. <?php } ?>
  315. <?php if(strlen($flag_3) > 0) { ?>
  316. <li class="warning cursor-pointer"> <a href="https://whatismyipaddress.com/ip/<?php echo $ip_address; ?>" target="_blank"><?php echo $flag_3; ?></a> </li>
  317. <?php } ?>
  318. <?php if(strlen($flag_4) > 0) { ?>
  319. <li class="warning cursor-pointer"> <i class="icon fa fa-fw fa-user-secret color-blue"></i> <a href="<?php echo $wiki_link; ?>" target="_blank"><?php echo $flag_4; ?></a> </li>
  320. <?php } ?>
  321. <?php if(!strlen($flag_1) && !strlen($flag_2) && !strlen($flag_3) && !strlen($flag_4) && !strlen($flag_5)) { ?>
  322. <div class="description"> <strong>None</strong> </div>
  323. <?php } ?>
  324. <!--<li class="warning cursor-pointer" *ngFor="let flag of app.lsrp_application_flags" (click)="flagClick(flag)"> <i class="icon fa fa-fw" [ngClass]="{\'fa-tv-retro\': flag.flag_type_id === 1, \'fa-copy\': flag.flag_type_id === 5, \'fa-user-secret\': flag.flag_type_id === 4}"></i> <span *ngIf="flag.flag_type_id === 1"> <a target="_blank" href="https://en.wikipedia.org/?curid={{ flag.value }}"> Wikipedia Article on {{ app.name | icname }} </a> </span> <span *ngIf="flag.flag_type_id === 5"> Similar to App #{{ flag.value.application_id }}, score: {{ flag.value.score | number: \'0.0-2\' }} </span> <span *ngIf="flag.flag_type_id === 4"> <a href="https://whatismyipaddress.com/ip/{{ app.ip }}" target="_blank">IP Might be a proxy</a> </span> </li>-->
  325. </ul>
  326. </section>
  327. <section class="card margin-top-10" *ngIf="app.main_account && app.main_account.users">
  328. <div class="card-title"> Other Characters </div>
  329. <div class="other-character nopadding" *ngFor="let character of app.main_account.users" [ngStyle]="character.customStyles">
  330. <?php
  331. $user_check_query = "SELECT `char_name`, `Level`, `LastLogin` FROM characters WHERE `master` = '$master' AND `char_name` != '$char_name' LIMIT 4";
  332. $result = mysqli_query($link, $user_check_query);
  333. $counti = 0;
  334. while($result2 = mysqli_fetch_array($result, MYSQLI_ASSOC))
  335. {
  336. $userii = $result2['char_name'];
  337. $Level = $result2['Level'];
  338. $LastLogin = $result2['LastLogin'];
  339. ?>
  340. <div class="description"> <strong><?php echo $userii; ?></strong> - level <?php echo $Level; ?><br> Last online <?php echo date('m/d/Y', $LastLogin); ?><br> </div>
  341. <!---->
  342. <?php
  343. $counti++;
  344. }
  345. if($counti == 0)
  346. {
  347. ?>
  348. <div class="description"> <strong>None</strong> </div>
  349. <?php
  350. }
  351. mysqli_free_result($result);
  352. ?>
  353. </div>
  354. </section>
  355. <section class="card margin-top-10" *ngIf="app.main_account && app.main_account.users">
  356. <div class="card-title"> Application History </div>
  357. <div class="other-character nopadding" *ngFor="let character of app.main_account.users" [ngStyle]="character.customStyles">
  358. <?php
  359. if(!count($PastApplications))
  360. {
  361. echo '<div class="description"> <strong>None</strong> </div>';
  362. }
  363. for($i = 0; $i < count($PastApplications); ++$i)
  364. {
  365. switch($PastApplications[$i]["status"])
  366. {
  367. case 2:
  368. $PastApplications[$i]["the_status"] = $PastApplications[$i]["accepted"] == 1 ? "Accepted" : "Denied";
  369. break;
  370. default:
  371. $PastApplications[$i]["the_status"] = "Under Review";
  372. break;
  373. }
  374. ?>
  375. <div class="description"> <a href="./admin/application/<?php echo $PastApplications[$i]["id"]; ?>" target="_blank">#<?php echo $PastApplications[$i]["id"]; ?> <?php echo $PastApplications[$i]["char_name"]; ?></a><span style="float: right; padding-right: 10px;"><strong><?php echo $PastApplications[$i]["the_status"]; ?></strong></span> </div>
  376. <?php
  377. }
  378. ?>
  379. </div>
  380. </section>
  381. </section>
  382. </div>
  383. </app-character-list>
  384. <!---->