Ejemplo n.º 1
0
 public static function list_of_existing_permissions()
 {
     $perms = array();
     $a = method_invoke_all("perms");
     foreach ($a as $b) {
         $perms = array_merge($perms, $b);
     }
     return $perms;
 }
Ejemplo n.º 2
0
 public function system_init()
 {
     if (self::$_data == null) {
         self::$_data = new stdClass();
         $res = method_invoke_all("constants");
         foreach ($res as $result) {
             if (is_array($result)) {
                 foreach ($result as $key => $value) {
                     $this->{$key} = $value;
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 public static function create($name, $id = null)
 {
     $g = new GroupObject();
     try {
         if ($id != null) {
             $g->gid = $id;
         }
         $g->label = $name;
         $g->save();
     } catch (Exception_Database_Exists $e) {
         return false;
     }
     $g->load_by_label($name);
     method_invoke_all("hook_group_create", array($g->gid));
     return true;
 }
Ejemplo n.º 4
0
 public function runWidgets($position = WidgetObject::WIDGET_LATERAL_LEFT, callable $callable = null)
 {
     $w = WidgetObject::loadByPosition($position);
     if ($callable != null) {
         foreach ($w as $k => $v) {
             $run = true;
             $r = method_invoke_all("permissions", array($v->permissions));
             foreach ($r as $tt) {
                 if ($tt == false) {
                     $run = false;
                 }
             }
             if ($run) {
                 $callable(call_user_func($v->callback));
             }
         }
     }
 }
Ejemplo n.º 5
0
 public static function getStatusNotifications()
 {
     method_invoke_all("getStatusNotifier", array(), true);
     return self::$notifications;
 }
Ejemplo n.º 6
0
 public static function access_check($page, $page_to_access)
 {
     $res = array();
     $res = method_invoke_all("check_permission", $page, $page_to_access);
     return count(array_filter($res)) == count($res);
 }
Ejemplo n.º 7
0
<?php

$_SESSION['log'] = array();
$user = null;
$group = null;
//echo 'com.exhan'.' '.'30121991\n<br/>';
//echo 'com.exhan'.' '.'Wv8zurR4fFrpUmPh\n';
//require 'settings.php';
require 'system/require.php';
system_reset_variables();
system_init();
system_session_start();
system_module_load();
method_invoke_all("main");
system_module_action();
system_theme_action();
system_session_save();
Ejemplo n.º 8
0
 public static function page_profile($id_user = null)
 {
     $theme = new Theme();
     $isMyProfil = false;
     if ($id_user == null) {
         $id_user = self::get_user_logged_id();
         $isMyProfil = true;
     }
     $u = new UserObject();
     $u->load($id_user);
     $url_avatar = $u->get_avatar();
     $output = "";
     $output .= "<div id=\"profil_top\">";
     $output .= "<div id=\"profil_top_avatar\" class=\"avatar\" style=\"background-image:url({$url_avatar});\">";
     if ($isMyProfil) {
         $output .= Theme::linking(Page::url("/profile/settings/avatar"), "<span id=\"profil_top_avatar_changeBG\"></span><span id=\"profil_top_avatar_changeTxt\">" . t("Modifier") . "</span>");
     }
     $output .= "</div>";
     $output .= "<div id=\"profil_top_avatar_nom\">";
     if ($isMyProfil) {
         $output .= "<i class=\"fa fa-user fa-fw\" title=\"Mon profil\"></i>";
     }
     $output .= $u->firstname . " " . $u->lastname;
     $output .= "</div>";
     $output .= "</div>";
     $output .= "<div class=\"page_contenu_sep\"></div>";
     $output .= "<div id=\"profil_buttons\">";
     $result = method_invoke_all("hook_profile_view", array($id_user));
     foreach ($result as $r) {
         $output .= $r;
     }
     $output .= "<div class=\"clear\"></div>";
     $output .= "</div>";
     $theme->add_to_body($output);
     $theme->process_theme(Theme::STRUCT_DEFAULT);
 }
Ejemplo n.º 9
0
 public static function scan_all_modules()
 {
     $Directory = new RecursiveDirectoryIterator('./modules');
     $Iterator = new RecursiveIteratorIterator($Directory);
     $regex = new RegexIterator($Iterator, '/^.+\\module.php$/i', RecursiveRegexIterator::GET_MATCH);
     $systemModules = get_all_classes_implementing_interfaces("SystemModule");
     $res = array();
     $enabled = method_invoke_all("info");
     $modules = array();
     $systemModules = array_map('strtolower', $systemModules);
     $available = array();
     foreach ($enabled as $k => $e) {
         $modules[$e['name']] = $e;
         $modules[$e['name']]["path"] = "";
         $modules[$e['name']]["system_module"] = in_array(strtolower($e["name"]), $systemModules) ? "1" : "0";
         $modules[$e['name']]["enabled"] = 1;
     }
     foreach ($regex as $item) {
         $data = file_get_contents($item[0]);
         if (preg_match("/@moduleName ([A-Za-z0-9_]+)/", $data, $matches)) {
             include_once $item[0];
             $res = method_invoke($matches[1], "info");
             $res["path"] = $item[0];
             $res["system_module"] = 0;
             $res['enabled'] = 0;
             $available[$matches[1]] = $res;
         }
     }
     foreach ($available as $k => $v) {
         if (in_array($k, array_keys($modules))) {
             $modules[$k]['path'] = $v['path'];
         } else {
             $modules[$k] = $v;
         }
     }
     return $modules;
 }
Ejemplo n.º 10
0
 public static function uninstall_module($module_name)
 {
     if (!module_manager::is_enabled($module_name) && module_manager::is_installed($module_name)) {
         $module = self::get_module($module_name);
         require $module->module_path;
         $result = method_invoke($module_name, "uninstall");
         method_invoke_all("uninstall_schema", $module_name);
         database::update("module_manager", array("module_installed" => 0), "module_name = '%module'", array("%module" => $module_name));
         self::update_action($module_name);
     }
 }
Ejemplo n.º 11
0
 public function get_declared_pages()
 {
     $res = method_invoke_all("menu", array(), true);
     $t = array();
     foreach ($res as $k => $v) {
         $k = trim(preg_replace("(/+)", "/", $k), "/");
         if ($k == "") {
             $keys = array("/" => $v);
         } else {
             $keys = $this->sub_menu($k, $v);
         }
         $t = array_merge_recursive($t, $keys);
     }
     return $t;
 }