예제 #1
0
 /**
  *
  */
 public static function GetScriptInfo(&$requested, $redirect = true)
 {
     global $dataDir, $gp_index, $gp_titles;
     $scripts['special_site_map']['class'] = '\\gp\\special\\Map';
     $scripts['special_galleries']['class'] = '\\gp\\special\\Galleries';
     $scripts['special_contact']['class'] = '\\gp\\special\\Contact';
     $scripts['special_missing']['class'] = '\\gp\\special\\Missing';
     $scripts['special_gpsearch']['class'] = '\\gp\\special\\Search';
     //check for use of a index instead of a page title
     $translated = \gp\tool::SpecialHref($requested);
     if ($translated != $requested) {
         $requested = $translated;
         if ($redirect) {
             $title = \gp\tool::GetUrl($requested, http_build_query($_GET), false);
             \gp\tool::Redirect($title);
         }
     }
     //get the script info
     $parts = explode('/', $requested);
     do {
         $requested = implode('/', $parts);
         if (isset($gp_index[$requested])) {
             $index = $gp_index[$requested];
             // Merge page data & script data if both exist
             if (isset($scripts[$index]) && isset($gp_titles[$index])) {
                 return array_merge($scripts[$index], $gp_titles[$index]);
             }
             if (isset($scripts[$index])) {
                 return $scripts[$index];
             }
             if (isset($gp_titles[$index])) {
                 return $gp_titles[$index];
             }
         }
         array_pop($parts);
     } while (count($parts));
     return false;
 }