Esempio n. 1
0
 /**
  * @param string $path
  */
 public function __construct($path)
 {
     global $config;
     // trim starting slashes
     $path = ltrim($path, "/");
     // if path is not specified, use the default front page
     if (empty($path)) {
         /* empty is faster than strlen */
         $path = $config->get_string('front_page');
     }
     // break the path into parts
     $args = explode('/', $path);
     // voodoo so that an arg can contain a slash; is
     // this still needed?
     if (strpos($path, "^") !== FALSE) {
         $unescaped = array();
         foreach ($args as $part) {
             $unescaped[] = _decaret($part);
         }
         $args = $unescaped;
     }
     $this->args = $args;
     $this->arg_count = count($args);
 }
Esempio n. 2
0
function _get_query_parts()
{
    if (isset($_GET["q"])) {
        $path = $_GET["q"];
    } else {
        if (isset($_SERVER["PATH_INFO"])) {
            $path = $_SERVER["PATH_INFO"];
        } else {
            $path = "";
        }
    }
    while (strlen($path) > 0 && $path[0] == '/') {
        $path = substr($path, 1);
    }
    $parts = explode('/', $path);
    if (strpos($path, "^") === FALSE) {
        return $parts;
    } else {
        $unescaped = array();
        foreach ($parts as $part) {
            $unescaped[] = _decaret($part);
        }
        return $unescaped;
    }
}