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

Размер файла: 8.36Kb
  1. <?php
  2. // (c) vavok.net
  3. require_once"../include/startup.php";
  4.  
  5. $action = isset($_GET['action']) ? check($_GET['action']) : '';
  6.  
  7. function prev_dir($string) {
  8. $d1 = strrpos($string, "/");
  9. $d2 = substr($string, $d1, 999);
  10. $string = str_replace($d2, "", $string);
  11.  
  12. return $string;
  13. }
  14.  
  15. if ($users->is_reg()) {
  16. if ($_SESSION['permissions'] == 101) {
  17. require_once BASEDIR . "themes/" . MY_THEME . "/index.php";
  18.  
  19. switch ($action) {
  20. default:
  21.  
  22. echo '<img src="../images/img/menu.gif" alt=""> ' . $lang_admin['checksys'] . '<hr>';
  23.  
  24. if (isset($_GET['did'])) {
  25. $did = check($_GET['did']);
  26. } else {
  27. $did = "";
  28. }
  29.  
  30. if (!is_dir("../used" . "$did") || !file_exists("../used" . "$did")) {
  31. header("Location: systems.php");
  32. exit;
  33. }
  34.  
  35. foreach (scandir("../used" . "$did") as $value) {
  36. if ($value != "." && $value != ".." && $value != ".htaccess") {
  37. if (is_file("../used" . "$did/$value")) {
  38. $files[] = "$did/$value";
  39. } elseif (is_dir("../used" . "$did/$value")) {
  40. $dires[] = "$did/$value";
  41. }
  42. }
  43. }
  44.  
  45. if ($did == "") {
  46. if (file_exists("../used/.htaccess")) {
  47. echo '<a href="systems.php?action=pod_chmod&amp;file=/.htaccess" class="btn btn-outline-primary sitelink">[Chmod - ' . permissions("../used/.htaccess") . ']</a> - <font color="#00FF00">' . $lang_admin['file'] . ' .htaccess ' . $lang_admin['exist'] . '</font><br>';
  48.  
  49. if (is_writeable("../used/.htaccess")) {
  50. echo'<font color="#FF0000">' . $lang_admin['wrhtacc'] . '</font><br>';
  51. }
  52. } else {
  53. echo '<font color="#FF0000">' . $lang_admin['warning'] . '!!! ' . $lang_admin['file'] . ' .htaccess ' . $lang_admin['noexist'] . '!<br></font>';
  54. }
  55. }
  56.  
  57. if ((count($files) + count($dires)) > 0) {
  58. if (count($files) > 0) {
  59. if ($did != "") {
  60. if (file_exists("../used" . "$did/.htaccess")) {
  61. echo '<a href="systems.php?action=pod_chmod&amp;file=' . $did . '/.htaccess" class="btn btn-outline-primary sitelink">[CHMOD - ' . permissions("../used" . "$did/.htaccess") . ']</a> - <font color="#00FF00">' . $lang_admin['file'] . ' .htaccess ' . $lang_admin['exist'] . '</font><br>';
  62.  
  63. if (is_writeable("../used" . "$did/.htaccess")) {
  64. echo '<font color="#FF0000">' . $lang_admin['wrhtacc'] . '</font><br>';
  65. }
  66. }
  67. }
  68.  
  69. echo '' . $lang_admin['filecheck'] . ': <br>';
  70.  
  71. $usedfiles = '';
  72. foreach ($files as $value) {
  73. echo '<a href="systems.php?action=pod_chmod&amp;file=' . $value . '" class="btn btn-outline-primary sitelink">[CHMOD - ' . permissions("../used" . "$value") . ']</a> - used' . $value . ' (' . formatsize(filesize("../used" . "$value")) . ') - ';
  74. if (is_writeable("../used" . "$value")) {
  75. echo '<font color="#00FF00">' . $lang_admin['filewrit'] . '</font><br>';
  76. } else {
  77. echo '<font color="#FF0000">' . $lang_admin['filenowrit'] . '</font><br>';
  78. }
  79.  
  80. $usedfiles += filesize("../used" . "$value");
  81. }
  82. echo '<hr>' . $lang_admin['filessize'] . ': ' . formatsize($usedfiles) . '<hr>';
  83. }
  84.  
  85. if (count($dires) > 0) {
  86. echo '' . $lang_admin['checkdirs'] . ': <br>';
  87.  
  88. foreach ($dires as $value) {
  89. echo '<a href="systems.php?action=pod_chmod&amp;file=' . $value . '" class="btn btn-outline-primary sitelink">[CHMOD - ' . permissions("../used" . "$value") . ']</a> - <a href="systems.php?did=' . $value . '" class="btn btn-outline-primary sitelink">used' . $value . '</a> (' . formatsize(read_dir("../used" . "$value")) . ') - ';
  90. if (is_writeable("../used" . "$value")) {
  91. echo '<font color="#00FF00">' . $lang_admin['filewrit'] . '</font><br>';
  92. } else {
  93. echo '<font color="#FF0000">' . $lang_admin['filenowrit'] . '</font><br>';
  94. }
  95.  
  96. $useddires = read_dir("../used" . "$value");
  97. }
  98. echo '<hr>' . $lang_admin['dirsize'] . ': ' . formatsize($useddires) . '<hr>';
  99. }
  100. } else {
  101. echo '' . $lang_admin['dirempty'] . '!<hr>';
  102. }
  103.  
  104. if ($did != "") {
  105. if (prev_dir($did) != "") {
  106. echo '<img src="../images/img/reload.gif" alt=""> <a href="systems.php?did=' . prev_dir($did) . '" class="btn btn-outline-primary sitelink">' . $lang_home['back'] . '</a><br>';
  107. }
  108. echo '<a href="systems.php" class="btn btn-outline-primary sitelink">' . $lang_admin['checksys'] . '</a><br>';
  109. }
  110.  
  111. break;
  112. // CHMOD
  113. case ("pod_chmod"):
  114.  
  115. echo '<img src="../images/img/menu.gif" alt=""> ' . $lang_admin['chchmod'] . '<hr>';
  116.  
  117. if ($_GET['file'] != "" && file_exists("../used/" . $_GET['file'] . "")) {
  118. echo '<form action="systems.php?action=chmod" method=post>';
  119. if (is_file("../used/" . $_GET['file'] . "")) {
  120. echo '' . $lang_admin['file'] . ': ../used' . $_GET['file'] . '<br>';
  121. } elseif (is_dir("../used/" . $_GET['file'] . "")) {
  122. echo '' . $lang_admin['folder'] . ': ../used' . $_GET['file'] . '<br>';
  123. }
  124. echo 'CHMOD: <br><input type="text" name="mode" value="' . permissions("../used/" . $_GET['file'] . "") . '" maxlength="3" /><br>
  125. <input name="file" type="hidden" value="' . $_GET['file'] . '" />
  126. <input type=submit value="' . $lang_home['save'] . '"></form><hr>';
  127.  
  128. } else {
  129. echo 'No file name!<hr>';
  130. }
  131.  
  132. if (prev_dir($_GET['file']) != "") {
  133. echo '<a href="systems.php?did=' . prev_dir($_GET['file']) . '" class="btn btn-outline-primary sitelink">' . $lang_home['back'] . '</a><br>';
  134. }
  135. echo '<a href="systems.php" class="btn btn-outline-primary sitelink">' . $lang_admin['checksys'] . '</a><br>';
  136.  
  137. break;
  138.  
  139. case ("chmod"):
  140.  
  141.  
  142. if ($_POST['file'] != "" && $_POST['mode'] != "") {
  143. if (chmod("../used/" . $_POST['file'] . "", octdec($_POST['mode'])) != false) {
  144. echo '' . $lang_admin['chmodok'] . '!<hr>';
  145. } else {
  146. echo '' . $lang_admin['chmodnotok'] . '!<hr>';
  147. }
  148. } else {
  149. echo '' . $lang_admin['noneededdata'] . '!<hr>';
  150. }
  151.  
  152. if (prev_dir($_POST['file']) != "") {
  153. echo '<a href="systems.php?did=' . prev_dir($_POST['file']) . '" class="btn btn-outline-primary sitelink">' . $lang_home['back'] . '</a><br>';
  154. }
  155. echo '<a href="systems.php" class="btn btn-outline-primary sitelink">' . $lang_admin['checksys'] . '</a><br>';
  156.  
  157. break;
  158. }
  159.  
  160. echo '<a href="index.php" class="btn btn-outline-primary sitelink">' . $lang_home['admpanel'] . '</a><br>
  161. <a href="../" class="btn btn-primary homepage">' . $lang_home['home'] . '</a><br>';
  162. } else {
  163. header("Location: ../index.php?error");
  164. exit;
  165. }
  166. } else {
  167. header("Location: ../index.php?error");
  168. exit;
  169. }
  170.  
  171. require_once BASEDIR . "themes/" . MY_THEME . "/foot.php";
  172.  
  173. ?>