示例#1
0
 /**
  * Execute the php code associated with a $hook
  * @param string $hook
  * @param array $hook_info
  * @param array $args
  *
  */
 public static function ExecHook($hook, $info, $args = array())
 {
     global $dataDir, $gp_current_hook;
     if (gp_safe_mode) {
         if (isset($args[0])) {
             return $args[0];
         }
         return;
     }
     if (!is_array($args)) {
         $args = array($args);
     }
     $gp_current_hook[] = $hook;
     //value
     if (!empty($info['value'])) {
         $args[0] = $info['value'];
     }
     $args = \gp\tool\Output::ExecInfo($info, $args);
     array_pop($gp_current_hook);
     if (isset($args[0])) {
         return $args[0];
     }
     return false;
 }
示例#2
0
 /**
  * Find the requested admin script and execute it if the user has permissions to view it
  *
  */
 private function RunAdminScript()
 {
     global $dataDir, $langmessage;
     if (strtolower($this->requested) == 'admin') {
         $this->AdminPanel();
         return;
     }
     //resolve request for /Admin_Theme_Content if the request is for /Admin_Theme_Conent/1234
     $request_string = str_replace('_', '/', $this->requested);
     $parts = explode('/', $request_string);
     do {
         $request_string = implode('/', $parts);
         $scriptinfo = $this->GetScriptInfo($request_string);
         if (is_array($scriptinfo)) {
             if (\gp\admin\Tools::HasPermission($request_string)) {
                 $this->OrganizeFrequentScripts($request_string);
                 \gp\tool\Output::ExecInfo($scriptinfo, array('page' => $this));
                 return;
             }
             message($langmessage['not_permitted']);
             $this->AdminPanel();
             return;
         }
         //these are here because they should be available to everyone
         switch ($request_string) {
             case 'Admin/Finder':
                 if (\gp\admin\Tools::HasPermission('Admin_Uploaded')) {
                     includeFile('thirdparty/finder/connector.php');
                     return;
                 }
                 break;
         }
         array_pop($parts);
     } while (count($parts));
     $this->Redirect();
 }
示例#3
0
 public static function ExecInfo($scriptinfo)
 {
     ob_start();
     \gp\tool\Output::ExecInfo($scriptinfo);
     return ob_get_clean();
 }