PageRenderTime 36ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/administrationmodule/class.php

https://github.com/exponentcms/exponent-cms-1
PHP | 102 lines | 65 code | 18 blank | 19 comment | 16 complexity | 0459db359444fe98b21707fb7541dc83 MD5 | raw file
  1. <?php
  2. ##################################################
  3. #
  4. # Copyright (c) 2004-2006 OIC Group, Inc.
  5. # Written and Designed by James Hunt
  6. #
  7. # This file is part of Exponent
  8. #
  9. # Exponent is free software; you can redistribute
  10. # it and/or modify it under the terms of the GNU
  11. # General Public License as published by the Free
  12. # Software Foundation; either version 2 of the
  13. # License, or (at your option) any later version.
  14. #
  15. # GPL: http://www.gnu.org/licenses/gpl.txt
  16. #
  17. ##################################################
  18. class administrationmodule {
  19. function name() { return exponent_lang_loadKey('modules/administrationmodule/class.php','module_name'); }
  20. function author() { return 'OIC Group, Inc'; }
  21. function description() { return exponent_lang_loadKey('modules/administrationmodule/class.php','module_description'); }
  22. function hasContent() { return false; }
  23. function hasSources() { return false; }
  24. function hasViews() { return true; }
  25. function supportsWorkflow() { return false; }
  26. function permissions($internal = "") {
  27. $i18n = exponent_lang_loadFile('modules/administrationmodule/class.php');
  28. $permissions = array('administrate'=>$i18n['perm_admin']);
  29. $menu = array();
  30. $dir = BASE.'modules/administrationmodule/tasks';
  31. if (is_readable($dir)) {
  32. $dh = opendir($dir);
  33. while (($file = readdir($dh)) !== false) {
  34. if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) {
  35. $menu = array_merge($menu,include($dir.'/'.$file));
  36. }
  37. }
  38. }
  39. foreach (array_keys($menu) as $header) {
  40. $permissions[strtolower(str_replace(' ','_',$header))] = $header;
  41. }
  42. return $permissions;
  43. }
  44. function deleteIn($loc) {
  45. // Do nothing, no content
  46. }
  47. function copyContent($from_loc,$to_loc) {
  48. // Do nothing, no content
  49. }
  50. function spiderContent($item = null) {
  51. // Do nothing, no content
  52. return false;
  53. }
  54. function show($view,$loc = null,$title = "") {
  55. global $user;
  56. $menu = array();
  57. $dir = BASE.'modules/administrationmodule/tasks';
  58. if (is_readable($dir)) {
  59. $dh = opendir($dir);
  60. while (($file = readdir($dh)) !== false) {
  61. if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) {
  62. $menu = array_merge($menu,include($dir.'/'.$file));
  63. }
  64. }
  65. }
  66. $template = new template('administrationmodule',$view,$loc);
  67. $level = 99;
  68. if (exponent_sessions_isset('uilevel')) {
  69. $level = exponent_sessions_get('uilevel');
  70. }
  71. $template->assign('can_manage_nav', exponent_permissions_checkOnModule("manage","navigationmodule"));
  72. $template->assign('editMode',exponent_sessions_loggedIn() && $level != UILEVEL_PREVIEW);
  73. $template->assign('title',$title);
  74. $template->assign('previewMode',($level == UILEVEL_PREVIEW));
  75. $template->assign('menu',$menu);
  76. $template->assign('moduletitle',$title);
  77. $template->assign('user',$user);
  78. $perms = administrationmodule::permissions();
  79. $template->assign('check_permissions',array_flip($perms));
  80. $template->register_permissions(array_keys($perms),exponent_core_makeLocation('administrationmodule'));
  81. $template->output($view);
  82. }
  83. }
  84. ?>