includes/paths.php
changeset 58 8f532d8ab5f5
parent 55 622d04f8719d
child 73 0a74676a2f2f
equal deleted inserted replaced
48:fc9762553a3c 58:8f532d8ab5f5
   511         'pageid'=>$url
   511         'pageid'=>$url
   512       );
   512       );
   513   }
   513   }
   514   function getParam($id = 0)
   514   function getParam($id = 0)
   515   {
   515   {
   516     if(isset($_SERVER['PATH_INFO']))
   516     // using !empty here is a bugfix for IIS 5.x on Windows 2000 Server
       
   517     // It may affect other IIS versions as well
       
   518     if(isset($_SERVER['PATH_INFO']) && !empty($_SERVER['PATH_INFO']))
   517     {
   519     {
   518       $pi = explode('/', $_SERVER['PATH_INFO']);
   520       $pi = explode('/', $_SERVER['PATH_INFO']);
   519       $id = $id + 2;
   521       $id = $id + 2;
   520       return isset($pi[$id]) ? $pi[$id] : false;
   522       return isset($pi[$id]) ? $pi[$id] : false;
   521     }
   523     }
   530       $k = array_keys($_GET);
   532       $k = array_keys($_GET);
   531       foreach($k as $c)
   533       foreach($k as $c)
   532       {
   534       {
   533         if(substr($c, 0, 1) == '/')
   535         if(substr($c, 0, 1) == '/')
   534         {
   536         {
   535           
       
   536           // Bugfix for apache somehow passing dots as underscores
   537           // Bugfix for apache somehow passing dots as underscores
   537           global $mime_types;
   538           global $mime_types;
   538           $exts = array_keys($mime_types);
   539           $exts = array_keys($mime_types);
   539           $exts = '(' . implode('|', $exts) . ')';
   540           $exts = '(' . implode('|', $exts) . ')';
   540           if ( preg_match( '#_'.$exts.'#i', $c ) )
   541           if ( preg_match( '#_'.$exts.'#i', $c ) )
   549     }
   550     }
   550   }
   551   }
   551   
   552   
   552   function getAllParams()
   553   function getAllParams()
   553   {
   554   {
   554     if(isset($_SERVER['PATH_INFO']))
   555     // using !empty here is a bugfix for IIS 5.x on Windows 2000 Server
       
   556     // It may affect other IIS versions as well
       
   557     if(isset($_SERVER['PATH_INFO']) && !empty($_SERVER['PATH_INFO']))
   555     {
   558     {
   556       $pi = explode('/', $_SERVER['PATH_INFO']);
   559       $pi = explode('/', $_SERVER['PATH_INFO']);
   557       unset($pi[0], $pi[1]);
   560       unset($pi[0], $pi[1]);
   558       return implode('/', $pi);
   561       return implode('/', $pi);
   559     }
   562     }