Пример #1
0
 /**
  * Function used to find a script by name
  *
  * This function will attempt to retrieve a valid script from the script list.
  *
  * @param string $name The name of the script (no default)
  */
 private static function HandleScript($name)
 {
     self::SetError('error', 'ERROR_SCRIPT_NOT_FOUND');
     // Set 404 incase anything goes wrong
     if (preg_match(LWC::REGEX_PATH, $name) && !preg_match(LWC::REGEX_PATH_BREAKOUT, $name)) {
         if (is_array(self::$scripts)) {
             foreach (self::$scripts as $script) {
                 if ($script['key'] == $name) {
                     if (session('rank') >= $script['minrank'] && session('rank') <= $script['maxrank']) {
                         // Check if user is allowed to access this script
                         self::$script = $script;
                     } else {
                         self::SetError('error', 'ERROR_SCRIPT_FORBIDDEN');
                     }
                     // User is not allowed to access this script
                 }
             }
         }
     }
 }