Просмотр файла vavok-1.5.3/adminpanel/index.php

Размер файла: 8.55Kb
  1. <?php
  2. /*
  3. * (c) Aleksandar Vranešević
  4. * Author: Aleksandar Vranešević
  5. * URI: https://vavok.net
  6. * Updated: 24.07.2020. 18:59:18
  7. */
  8.  
  9. require_once"../include/startup.php";
  10.  
  11. if (!$users->check_permissions('adminpanel', 'show')) { redirect_to("../"); }
  12.  
  13. $action = isset($_GET['action']) ? check($_GET['action']) : '';
  14.  
  15. if ($action == 'refver') {
  16.  
  17. $vavokStableVersionURL = "http://www.vavok.net/cms/version.txt";
  18. $key = 'stableversion'; // key to save cache with
  19.  
  20. // refresh latest version
  21. $currentVersion = @fopen($vavokStableVersionURL);
  22. if (!empty($currentVersion)) {
  23. Cache::save($key, $currentVersion); // save data to cache file
  24. } else {
  25. $ch = curl_init();
  26. curl_setopt ($ch, CURLOPT_URL, $vavokStableVersionURL);
  27. curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
  28. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
  29. $currentVersion = curl_exec($ch);
  30. if (curl_errno($ch)) {
  31. echo curl_error($ch);
  32. echo "\n<br />";
  33. $currentVersion = '';
  34. } else {
  35. curl_close($ch);
  36.  
  37. Cache::save($key, $currentVersion); // save data to cache file
  38. }
  39. if (!is_string($currentVersion) || !strlen($currentVersion)) {
  40. $currentVersion = '';
  41. }
  42. }
  43.  
  44. header("Location: index.php");
  45. exit;
  46. }
  47.  
  48. $my_title = $lang_home['admpanel'];
  49. require_once BASEDIR . "themes/" . MY_THEME . "/index.php";
  50. if (empty($action)) {
  51.  
  52. /*
  53. Moderator access level or bigger
  54. */
  55.  
  56. echo '<a href="adminchat.php" class="btn btn-outline-primary sitelink">' . $lang_admin['admchat'] . '</a>';
  57. echo '<a href="adminlist.php" class="btn btn-outline-primary sitelink">' . $lang_admin['modlist'] . '</a>';
  58. echo '<a href="reglist.php" class="btn btn-outline-primary sitelink">' . $lang_admin['notconf'] . '</a>';
  59.  
  60. $totalUsers = $db->count_row('vavok_users') - 1; // - 1 - do not count "System"
  61. echo '<a href="../pages/userlist.php" class="btn btn-outline-primary sitelink">' . $lang_admin['userlist'] . ' (' . $totalUsers . ')</a>';
  62.  
  63. /*
  64. Super moderator access level or bigger
  65. */
  66.  
  67. if ($users->is_moderator(103) || $users->is_moderator(105) || $users->is_administrator()) {
  68.  
  69. if (file_exists('reports.php')) {
  70. echo '<a href="reports.php" class="btn btn-outline-primary sitelink">' . $lang_admin['usrcomp'] . '</a>';
  71. }
  72.  
  73. if (file_exists('upload.php')) {
  74. echo '<a href="upload.php" class="btn btn-outline-primary sitelink">' . $lang_admin['upload'] . '</a>';
  75. echo '<a href="uploaded_files.php" class="btn btn-outline-primary sitelink">' . $lang_admin['uplFiles'] . '</a>';
  76. echo '<a href="search_uploads.php" class="btn btn-outline-primary sitelink">Search uploaded files</a>'; // update lang
  77. }
  78.  
  79. }
  80.  
  81. /*
  82. Head moderator access level or bigger
  83. */
  84.  
  85. if ($_SESSION['permissions'] == 101 || $_SESSION['permissions'] == 102 || $_SESSION['permissions'] == 103) {
  86.  
  87. echo '<hr>';
  88.  
  89. echo '<a href="addban.php" class="btn btn-outline-primary sitelink">' . $lang_admin['banunban'] . '</a>';
  90. echo '<a href="banlist.php" class="btn btn-outline-primary sitelink">' . $lang_admin['banlist'] . '</a>';
  91.  
  92. }
  93.  
  94. /*
  95. Administrator access level or bigger
  96. */
  97.  
  98. if ($users->is_administrator()) {
  99.  
  100. echo '<hr>';
  101.  
  102. if (file_exists('forumadmin.php')) {
  103. echo '<a href="forumadmin.php?action=fcats" class="btn btn-outline-primary sitelink">' . $lang_admin['forumcat'] . '</a>';
  104. echo '<a href="forumadmin.php?action=forums" class="btn btn-outline-primary sitelink">' . $lang_admin['forums'] . '</a>';
  105. }
  106. if (file_exists('gallery/manage_gallery.php')) {
  107. echo'<a href="gallery/manage_gallery.php" class="btn btn-outline-primary sitelink">' . $lang_admin['gallery'] . '</a>';
  108. }
  109. if (file_exists('votes.php')) {
  110. echo'<a href="votes.php" class="btn btn-outline-primary sitelink">' . $lang_admin['pools'] . '</a>';
  111. }
  112. if (file_exists("antiword.php")) {
  113. echo '<a href="antiword.php" class="btn btn-outline-primary sitelink">' . $lang_admin['badword'] . '</a>';
  114. }
  115.  
  116. echo '<a href="statistics.php" class="btn btn-outline-primary sitelink">' . $lang_home['statistic'] . '</a>';
  117. echo '<a href="users.php" class="btn btn-outline-primary sitelink">' . $lang_admin['mngprof'] . '</a>';
  118.  
  119. }
  120.  
  121. if (file_exists('news.php') && ($users->is_administrator() || $users->check_permissions('news', 'show'))) {
  122. echo '<a href="news.php" class="btn btn-outline-primary sitelink">' . $lang_admin['sitenews'] . '</a>';
  123. }
  124.  
  125. if (file_exists('files.php') && ($users->is_administrator() || $users->check_permissions('pageedit'))) {
  126. echo '<a href="files.php" class="btn btn-outline-primary sitelink">' . $lang_admin['mngpage'] . '</a>';
  127. }
  128.  
  129. /*
  130. Head administrator access level
  131. */
  132.  
  133. if ($users->is_administrator(101)) {
  134.  
  135. echo '<hr>';
  136.  
  137. echo '<a href="settings.php" class="btn btn-outline-primary sitelink">' . $lang_admin['syssets'] . '</a>';
  138. echo '<a href="ban.php" class="btn btn-outline-primary sitelink">' . $lang_admin['ipbanp'] . ' (' . counter_string(BASEDIR . 'used/ban.dat') . ')</a>';
  139. if (file_exists('subscribe.php')) {
  140. echo '<a href="subscribe.php" class="btn btn-outline-primary sitelink">' . $lang_admin['subscriptions'] . '</a>';
  141. }
  142. echo '<a href="index.php?action=sysmng" class="btn btn-outline-primary sitelink">' . $lang_admin['sysmng'] . '</a>';
  143. if (file_exists('logfiles.php')) {
  144. echo '<a href="logfiles.php" class="btn btn-outline-primary sitelink">' . $lang_admin['logcheck'] . '</a>';
  145. }
  146. if (file_exists('email-queue.php')) {
  147. echo '<a href="email-queue.php" class="btn btn-outline-primary sitelink">Add to email queue</a>';
  148. }
  149. }
  150.  
  151. }
  152.  
  153. if ($action == 'clear' && $users->is_administrator(101)) {
  154.  
  155. echo '<p>';
  156. if (file_exists('delusers.php')) {
  157. echo '<a href="delusers.php" class="btn btn-outline-primary sitelink">' . $lang_admin['cleanusers'] . '</a>';
  158. }
  159. echo '<a href="./?action=clrmlog" class="btn btn-outline-primary sitelink">' . $lang_admin['cleanmodlog'] . '</a>';
  160.  
  161. echo '</p>';
  162.  
  163. }
  164.  
  165. if ($action == "clrmlog" && $users->is_administrator(101)) {
  166. $sql = "DELETE FROM mlog";
  167. $db->query($sql);
  168.  
  169. echo '<p><img src="../images/img/open.gif" alt="" /> ' . $lang_admin['mlogcleaned'] . '</p>';
  170.  
  171. }
  172.  
  173. if ($action == "sysmng" && $users->is_administrator(101)) {
  174. echo '<p>';
  175. echo '<a href="systems.php" class="btn btn-outline-primary sitelink">' . $lang_admin['chksystem'] . '</a>';
  176. echo '<a href="./?action=clear" class="btn btn-outline-primary sitelink">' . $lang_admin['cleansys'] . '</a>';
  177. if (file_exists('backup.php')) {
  178. echo '<a href="backup.php" class="btn btn-outline-primary sitelink">' . $lang_admin['backup'] . '</a>';
  179. }
  180. echo '<a href="serverbenchmark.php" class="btn btn-outline-primary sitelink">Server benchmark</a>';
  181. // update
  182. // echo '<a href="index.php?action=opttbl">Optimize tables</a>'; // update lang
  183. echo '</p>';
  184. }
  185.  
  186. if ($action == "opttbl" && $users->is_administrator(101)) {
  187. $alltables = mysql_query("SHOW TABLES");
  188.  
  189. while ($table = mysql_fetch_assoc($alltables)) {
  190. foreach ($table as $db => $tablename) {
  191. $sql = "OPTIMIZE TABLE `" . $tablename . "`";
  192. $db->query($sql);
  193. }
  194. }
  195.  
  196. echo '<p><img src="../images/img/reload.gif" alt="" /> Optimized successfully!</p>'; // update lang
  197. }
  198.  
  199. // check vavok cms version
  200. if ($action == 'version') {
  201. $version = $vavok_version;
  202. $key = 'checkver'; // key to save cache with
  203. // get cached data from file cache, also check if cached data is not old
  204.  
  205. echo'<div class="b">Vavok CMS ' . $lang_home['version'] . ': <b>' . $vavok_version . '</b>';
  206.  
  207. if ($version != $last_ver && !empty($last_ver)) {
  208. echo '<p><img src="../images/img/close.gif" alt="" /> ' . $lang_admin['newver'] . '!</p>';
  209. echo '<p><img src="../images/img/reload.gif" alt="" /> Latest version: ' . $last_ver . '</p>';
  210. echo '<a href="index.php?action=refver" class="btn btn-outline-primary sitelink">Refresh</a>';
  211. } else {
  212. echo '<p><img src="../images/img/reload.gif" alt=""> ' . $lang_admin['hnewver'] . '!</p>';
  213. }
  214.  
  215. echo '</div>';
  216.  
  217. }
  218.  
  219. if (!empty($action)) {
  220. echo '<p><a href="./" class="btn btn-outline-primary sitelink">' . $lang_home['admpanel'] . '</a></p>';
  221. }
  222.  
  223. echo '<p><a href="../" class="btn btn-primary homepage">' . $lang_home['home'] . '</a></p>';
  224.  
  225. require_once BASEDIR . "themes/" . MY_THEME . "/foot.php";
  226.  
  227. ?>