Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.php 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. <?php
  2. $transactions_bills = $db->select('transactions', "trans_type=? ORDER BY date_posted DESC", array("Bill"));
  3. $transaction_bill_list = array();
  4. foreach ($transactions_bills as $transaction)
  5. {
  6. if (!is_array($transaction))
  7. {
  8. $transaction_bill_list = array($transactions_bills);
  9. break;
  10. }
  11. array_push($transaction_bill_list, $transaction);
  12. }
  13. $transactions_one_time = $db->select('transactions', "trans_type=? ORDER BY date_posted DESC", array("One-Time"));
  14. $transaction_one_time_list = array();
  15. foreach ($transactions_one_time as $transaction)
  16. {
  17. if (!is_array($transaction))
  18. {
  19. $transaction_one_time_list = array($transactions_one_time);
  20. break;
  21. }
  22. array_push($transaction_one_time_list, $transaction);
  23. }
  24. $transactions_donations = $db->select('transactions', "trans_type=? ORDER BY date_posted DESC", array("Donation"));
  25. $transaction_donation_list = array();
  26. foreach ($transactions_donations as $transaction)
  27. {
  28. if (!is_array($transaction))
  29. {
  30. $transaction_donation_list = array($transactions_donations);
  31. break;
  32. }
  33. array_push($transaction_donation_list, $transaction);
  34. }
  35. $total_donations = $db->select('transactions', "trans_type=? GROUP BY currency", array("Donation"), "sum(amount) TotalAmount, currency");
  36. $total_donation_list = array();
  37. foreach ($total_donations as $total)
  38. {
  39. if (!is_array($total))
  40. {
  41. $total_donation_list = array($total_donations);
  42. break;
  43. }
  44. array_push($total_donation_list, $total);
  45. }
  46. $total_bills = $db->select('transactions', "trans_type=? GROUP BY currency", array("Bill"), "sum(amount) TotalAmount, currency");
  47. $total_bill_list = array();
  48. foreach ($total_bills as $total)
  49. {
  50. if (!is_array($total))
  51. {
  52. $total_bill_list = array($total_bills);
  53. break;
  54. }
  55. array_push($total_bill_list, $total);
  56. }
  57. $total_one_time = $db->select('transactions', "trans_type=? GROUP BY currency", array("One-Time"), "sum(amount) TotalAmount, currency");
  58. $total_one_time_list = array();
  59. foreach ($total_one_time as $total)
  60. {
  61. if (!is_array($total))
  62. {
  63. $total_one_time_list = array($total_one_time);
  64. break;
  65. }
  66. array_push($total_one_time_list, $total);
  67. }
  68. $total_net = $db->select('transactions', "1=? GROUP BY currency", array("1"), "sum(amount) TotalAmount, currency");
  69. $total_net_list = array();
  70. foreach ($total_net as $total)
  71. {
  72. if (!is_array($total))
  73. {
  74. $total_net_list = array($total_net);
  75. break;
  76. }
  77. array_push($total_net_list, $total);
  78. }
  79. $takedowns = $db->select('takedowns', "1=? ORDER BY date_requested DESC", array("1"));
  80. $takedown_list = array();
  81. foreach ($takedowns as $takedown)
  82. {
  83. if (!is_array($takedown))
  84. {
  85. $takedown_list = array($takedowns);
  86. break;
  87. }
  88. array_push($takedown_list, $takedown);
  89. }
  90. $total_size = $db->select('uploads', "1=? ORDER BY upload_date DESC", array("1"), "sum(filesize) TotalSize");
  91. $uploads = $db->select('uploads', "1=?", array("1"));
  92. $upload_list = array();
  93. foreach ($uploads as $upload)
  94. {
  95. if (!is_array($upload))
  96. {
  97. $upload_list = array($uploads);
  98. break;
  99. }
  100. array_push($upload_list, $upload);
  101. }
  102. $pastes = $db->select('paste', "1=? ORDER BY pid DESC LIMIT 1", array("1"));
  103. $paste_list = array();
  104. foreach ($pastes as $paste)
  105. {
  106. if (!is_array($paste))
  107. {
  108. $paste_list = array($pastes);
  109. break;
  110. }
  111. array_push($paste_list, $paste);
  112. }
  113. $users = $db->select('users', "1=?", array("1"));
  114. $user_list = array();
  115. foreach ($users as $use)
  116. {
  117. if (!is_array($use))
  118. {
  119. $user_list = array($users);
  120. break;
  121. }
  122. array_push($user_list, $use);
  123. }
  124. ?>
  125. <div class="container">
  126. <div class="row">
  127. <div class="col-sm-10 col-sm-offset-1">
  128. <h2 class="text-center"><b>Behind the Scenes</b></h2>
  129. <hr>
  130. <p>
  131. Here you can view all of Teknik's financial information, takedown requests and the actions we took, as well as some general statistics for the site's services.
  132. </p>
  133. <p>
  134. If you would like to request additional information about Teknik, please feel free to contact us through our <a href="<?php echo get_page_url("contact", $CONF); ?>" target="_blank">Contact Form</a> or by emailing us at <a href="mailto:support@<?php echo $CONF['host']; ?>">support@<?php echo $CONF['host']; ?></a>.
  135. </p>
  136. <p>
  137. Want to make a donation? Visit our <a href="<?php echo get_page_url("about", $CONF); ?>" target="_blank">About Page</a> and choose a donation method at the bottom.
  138. </p>
  139. <br />
  140. <h2 class="text-center"><b>Statistics</b></h2>
  141. <hr>
  142. <div class="row">
  143. <div class="col-sm-6">
  144. <h3>Uploads</h3>
  145. <p>Number of Uploads: <?php echo count($upload_list); ?></p>
  146. <p>Total Size: <?php echo bytesToSize($total_size['TotalSize']); ?></p>
  147. </div>
  148. <div class="col-sm-6">
  149. <h3>Pastes</h3>
  150. <p>Number of Pastes: <?php echo $paste_list[0]['id']; ?></p>
  151. </div>
  152. </div>
  153. <div class="row">
  154. <div class="col-sm-6">
  155. <h3>Users</h3>
  156. <p>Number of Users: <?php echo count($user_list); ?></p>
  157. </div>
  158. <div class="col-sm-6">
  159. <h3>Usage</h3>
  160. <p>No Usage Reports</p>
  161. </div>
  162. </div>
  163. <br />
  164. <h2 class="text-center"><b>Transactions</b></h2>
  165. <hr>
  166. <h3 class="text-center">Total Amounts</h3>
  167. <div class="row">
  168. <div class="col-sm-3 text-center">
  169. <h4>Donations</h4>
  170. <?php
  171. foreach ($total_donation_list as $total)
  172. {
  173. echo "<p>".round($total['TotalAmount'], 2)." ".$total['currency'];
  174. }
  175. ?>
  176. </div>
  177. <div class="col-sm-3 text-center">
  178. <h4>Bills</h4>
  179. <?php
  180. foreach ($total_bill_list as $total)
  181. {
  182. echo "<p>".round($total['TotalAmount'], 2)." ".$total['currency'];
  183. }
  184. ?>
  185. </div>
  186. <div class="col-sm-3 text-center">
  187. <h4>One-Time Payments</h4>
  188. <?php
  189. foreach ($total_one_time_list as $total)
  190. {
  191. echo "<p>".round($total['TotalAmount'], 2)." ".$total['currency'];
  192. }
  193. ?>
  194. </div>
  195. <div class="col-sm-3 text-center">
  196. <h4>Net Profit</h4>
  197. <?php
  198. foreach ($total_net_list as $total)
  199. {
  200. echo "<p>".round($total['TotalAmount'], 2)." ".$total['currency'];
  201. }
  202. ?>
  203. </div>
  204. </div>
  205. <?php
  206. if ($transactions_bills)
  207. {
  208. ?>
  209. <h3>Bills</h3>
  210. <?php
  211. $current_month = date("F",time())+1;
  212. $first_event = true;
  213. foreach ($transaction_bill_list as $transaction)
  214. {
  215. $transaction_date = (isset($transaction['date_posted'])) ? $transaction['date_posted'] : "";
  216. $transaction_reason = (isset($transaction['reason'])) ? $transaction['reason'] : "";
  217. $transaction_amount = (isset($transaction['amount'])) ? $transaction['amount'] : "";
  218. $transaction_currency = (isset($transaction['currency'])) ? $transaction['currency'] : "";
  219. $new_month_tag = false;
  220. if ($current_month != date("F",strtotime($transaction_date)))
  221. {
  222. $new_month_tag = true;
  223. }
  224. $current_month = date("F",strtotime($transaction_date));
  225. $current_year = date("Y",strtotime($transaction_date));
  226. ?>
  227. <?php if (!$first_event && $new_month_tag) { ?>
  228. </div>
  229. <?php } ?>
  230. <?php if ($new_month_tag) { ?>
  231. <div class="row">
  232. <div class="col-sm-12">
  233. <button type="button" class="btn btn-default" data-toggle="collapse" data-target="#bills-<?php echo $current_month.'-'.$current_year; ?>"><?php echo $current_month.', '.$current_year; ?></button>
  234. </div>
  235. </div>
  236. <br />
  237. <div id="bills-<?php echo $current_month.'-'.$current_year; ?>" class="collapse">
  238. <div class="row">
  239. <div class="col-sm-2">
  240. <h4><strong>Date</strong></h4>
  241. </div>
  242. <div class="col-sm-2">
  243. <h4><strong>Amount</strong></h4>
  244. </div>
  245. <div class="col-sm-8">
  246. <h4><strong>Reason for Transaction</strong></h4>
  247. </div>
  248. </div>
  249. <?php } ?>
  250. <div class="row">
  251. <div class="col-sm-2">
  252. <?php echo $transaction_date; ?>
  253. </div>
  254. <div class="col-sm-2">
  255. <?php echo $transaction_amount." <var>".$transaction_currency."</var>"; ?>
  256. </div>
  257. <div class="col-sm-8">
  258. <?php echo $transaction_reason; ?>
  259. </div>
  260. </div>
  261. <br />
  262. <?php
  263. $first_event = false;
  264. }
  265. ?>
  266. </div>
  267. <?php
  268. }
  269. if ($transactions_one_time)
  270. {
  271. ?>
  272. <h3>One-Time Payments</h3>
  273. <?php
  274. $current_month = date("F",time())+1;
  275. $first_event = true;
  276. foreach ($transaction_one_time_list as $transaction)
  277. {
  278. $transaction_date = (isset($transaction['date_posted'])) ? $transaction['date_posted'] : "";
  279. $transaction_reason = (isset($transaction['reason'])) ? $transaction['reason'] : "";
  280. $transaction_amount = (isset($transaction['amount'])) ? $transaction['amount'] : "";
  281. $transaction_currency = (isset($transaction['currency'])) ? $transaction['currency'] : "";
  282. $new_month_tag = false;
  283. if ($current_month != date("F",strtotime($transaction_date)))
  284. {
  285. $new_month_tag = true;
  286. }
  287. $current_month = date("F",strtotime($transaction_date));
  288. $current_year = date("Y",strtotime($transaction_date));
  289. ?>
  290. <?php if (!$first_event && $new_month_tag) { ?>
  291. </div>
  292. <?php } ?>
  293. <?php if ($new_month_tag) { ?>
  294. <div class="row">
  295. <div class="col-sm-12">
  296. <button type="button" class="btn btn-default" data-toggle="collapse" data-target="#One-Time-<?php echo $current_month.'-'.$current_year; ?>"><?php echo $current_month.' - '.$current_year; ?></button>
  297. </div>
  298. </div>
  299. <br />
  300. <div id="One-Time-<?php echo $current_month.'-'.$current_year; ?>" class="collapse">
  301. <div class="row">
  302. <div class="col-sm-2">
  303. <h4><strong>Date</strong></h4>
  304. </div>
  305. <div class="col-sm-2">
  306. <h4><strong>Amount</strong></h4>
  307. </div>
  308. <div class="col-sm-8">
  309. <h4><strong>Reason for Transaction</strong></h4>
  310. </div>
  311. </div>
  312. <?php } ?>
  313. <div class="row">
  314. <div class="col-sm-2">
  315. <?php echo $transaction_date; ?>
  316. </div>
  317. <div class="col-sm-2">
  318. <?php echo $transaction_amount." <var>".$transaction_currency."</var>"; ?>
  319. </div>
  320. <div class="col-sm-8">
  321. <?php echo $transaction_reason; ?>
  322. </div>
  323. </div>
  324. <br />
  325. <?php
  326. $first_event = false;
  327. }
  328. ?>
  329. </div>
  330. <?php
  331. }
  332. if ($transactions_donations)
  333. {
  334. ?>
  335. <h3>Donations</h3>
  336. <?php
  337. $current_month = date("F",time())+1;
  338. $first_event = true;
  339. foreach ($transaction_donation_list as $transaction)
  340. {
  341. $transaction_date = (isset($transaction['date_posted'])) ? $transaction['date_posted'] : "";
  342. $transaction_reason = (isset($transaction['reason'])) ? $transaction['reason'] : "";
  343. $transaction_amount = (isset($transaction['amount'])) ? $transaction['amount'] : "";
  344. $transaction_currency = (isset($transaction['currency'])) ? $transaction['currency'] : "";
  345. $new_month_tag = false;
  346. if ($current_month != date("F",strtotime($transaction_date)))
  347. {
  348. $new_month_tag = true;
  349. }
  350. $current_month = date("F",strtotime($transaction_date));
  351. $current_year = date("Y",strtotime($transaction_date));
  352. ?>
  353. <?php if (!$first_event && $new_month_tag) { ?>
  354. </div>
  355. <?php } ?>
  356. <?php if ($new_month_tag) { ?>
  357. <div class="row">
  358. <div class="col-sm-12">
  359. <button type="button" class="btn btn-default" data-toggle="collapse" data-target="#donations-<?php echo $current_month.'-'.$current_year; ?>"><?php echo $current_month.' - '.$current_year; ?></button>
  360. </div>
  361. </div>
  362. <br />
  363. <div id="donations-<?php echo $current_month.'-'.$current_year; ?>" class="collapse">
  364. <div class="row">
  365. <div class="col-sm-2">
  366. <h4><strong>Date</strong></h4>
  367. </div>
  368. <div class="col-sm-2">
  369. <h4><strong>Amount</strong></h4>
  370. </div>
  371. <div class="col-sm-8">
  372. <h4><strong>Reason for Transaction</strong></h4>
  373. </div>
  374. </div>
  375. <?php } ?>
  376. <div class="row">
  377. <div class="col-sm-2">
  378. <?php echo $transaction_date; ?>
  379. </div>
  380. <div class="col-sm-2">
  381. <?php echo $transaction_amount." <var>".$transaction_currency."</var>"; ?>
  382. </div>
  383. <div class="col-sm-8">
  384. <?php echo $transaction_reason; ?>
  385. </div>
  386. </div>
  387. <br />
  388. <?php
  389. $first_event = false;
  390. }
  391. ?>
  392. </div>
  393. <?php
  394. }
  395. ?>
  396. <br />
  397. <h2 class="text-center"><b>Takedowns</b></h2>
  398. <hr>
  399. <?php
  400. if ($takedown_list)
  401. {
  402. $current_month = date("F",time())+1;
  403. $first_event = true;
  404. foreach ($takedown_list as $takedown)
  405. {
  406. $takedown_date = (isset($takedown['date_requested'])) ? $takedown['date_requested'] : "";
  407. $takedown_requester = (isset($takedown['requester'])) ? $takedown['requester'] : "";
  408. $takedown_reason = (isset($takedown['reason'])) ? $takedown['reason'] : "";
  409. $takedown_action = (isset($takedown['action'])) ? $takedown['action'] : "";
  410. $new_month_tag = false;
  411. if ($current_month != date("F",strtotime($takedown_date)))
  412. {
  413. $new_month_tag = true;
  414. }
  415. $current_month = date("F",strtotime($takedown_date));
  416. $current_year = date("Y",strtotime($takedown_date));
  417. ?>
  418. <?php if (!$first_event && $new_month_tag) { ?>
  419. </div>
  420. <?php } ?>
  421. <?php if ($new_month_tag) { ?>
  422. <div class="row">
  423. <div class="col-sm-12">
  424. <button type="button" class="btn btn-default" data-toggle="collapse" data-target="#donations-<?php echo $current_month.'-'.$current_year; ?>"><?php echo $current_month.' - '.$current_year; ?></button>
  425. </div>
  426. </div>
  427. <br />
  428. <div id="donations-<?php echo $current_month.'-'.$current_year; ?>" class="collapse">
  429. <div class="row">
  430. <div class="col-sm-2">
  431. <h4><strong>Date</strong></h4>
  432. </div>
  433. <div class="col-sm-2">
  434. <h4><strong>Requester</strong></h4>
  435. </div>
  436. <div class="col-sm-2">
  437. <h4><strong>Action Taken</strong></h4>
  438. </div>
  439. <div class="col-sm-6">
  440. <h4><strong>Takedown Reason</strong></h4>
  441. </div>
  442. </div>
  443. <?php } ?>
  444. <div class="row">
  445. <div class="col-sm-2">
  446. <p><?php echo $takedown_date; ?></p>
  447. </div>
  448. <div class="col-sm-2">
  449. <p><?php echo $takedown_requester; ?></p>
  450. </div>
  451. <div class="col-sm-2">
  452. <p><?php echo $takedown_action; ?></p>
  453. </div>
  454. <div class="col-sm-6">
  455. <?php echo $takedown_reason; ?>
  456. </div>
  457. </div>
  458. <br />
  459. <?php
  460. $first_event = false;
  461. }
  462. ?>
  463. </div>
  464. <?php
  465. }
  466. else
  467. {
  468. echo "<h3 class='text-center'>No Takedowns Requested</h3>";
  469. }
  470. ?>
  471. <br />
  472. </div>
  473. </div>
  474. </div>