Kabano is a PHP web application listing alpine huts. https://kabano.org/
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.

d.admin.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?
  2. if(isset($controller->splitted_url[1]) && $user->rankIsHigher("moderator")) {
  3. switch ($controller->splitted_url[1]) {
  4. case '': case 'admin':
  5. $head['title'] = "Administration";
  6. include ($config['views_folder']."d.admin.html");
  7. break;
  8. case 'git-pull':
  9. if ($user->rankIsHigher("administrator")) {
  10. $head['title'] = "Mise à jour";
  11. $output = array();
  12. chdir($config['abs_root_folder']);
  13. exec("git pull origin master", $output);
  14. include ($config['views_folder']."d.admin.git-pull.html");
  15. }
  16. else {
  17. $notfound = 1;
  18. }
  19. break;
  20. case 'logs':
  21. if ($user->rankIsHigher("moderator")) {
  22. $head['title'] = "Logs";
  23. $files_list = scandir($config['logs_folder']);
  24. if (isset($controller->splitted_url[2]) && is_numeric($controller->splitted_url[2]) && intval($controller->splitted_url[2]) < count($files_list)-2) {
  25. $filenb = $controller->splitted_url[2];
  26. }
  27. else {
  28. $filenb = 0;
  29. }
  30. chdir($config['logs_folder']);
  31. exec("tail -n 200 ".$files_list[$filenb+2]." | tac", $output);
  32. include ($config['views_folder']."d.admin.logs.html");
  33. }
  34. else {
  35. $notfound = 1;
  36. }
  37. break;
  38. default:
  39. $notfound = 1;
  40. break;
  41. }
  42. }
  43. else if($user->rankIsHigher("moderator")) {
  44. $head['title'] = "Administration";
  45. include ($config['views_folder']."d.admin.html");
  46. }
  47. else {
  48. $notfound = 1;
  49. }
  50. ?>