/** * Get the current path information * * @access public * * @param $path path information * @return $pi path information array */ public static function pathInfo($path) { Log::in("query - Path Info"); $explodedPath = array(); /* Path structure is :- * /db name/content type/category/filename */ /* Check for root */ if ($path == '/') { $pi[PI_LEVEL] = PL_ROOT; Log::out("query - Path Info - root level"); return $pi; } /* Explode the path and pass back */ $explodedPath = explode('/', $path); /* Database - must have this */ if ($explodedPath[1] != "") { Log::output("query - Path Info - db level"); $pi[PI_LEVEL] = PL_DB; $pi[PI_DB] = $explodedPath[1]; } /* Content type */ if (isset($explodedPath[2])) { if ($explodedPath[2] != "") { Log::output("query - Path Info - content type"); $pi[PI_LEVEL] = PL_TYPE; $pi[PI_TYPE] = $explodedPath[2]; for ($i = 0; $i < PT_LAST; $i++) { if (Query::$_tableType[$i][0] == $pi[PI_TYPE]) { $pi[PI_TI] = Query::$_tableType[$i]; } } } } /* Category */ if (isset($explodedPath[3])) { if ($explodedPath[3] != "") { Log::output("query - Path Info - category"); $pi[PI_LEVEL] = PL_CATEGORY; $pi[PI_CATEGORY] = $explodedPath[3]; } } /* File name */ if (isset($explodedPath[4])) { if ($explodedPath[4] != "") { Log::output("query - Path Info - filename is {$explodedPath['4']}"); $pi[PI_LEVEL] = PL_FILENAME; $filenoext = explode('.', $explodedPath[4]); /* Check for file names with a '.' in them */ if (count($filenoext) == 2 || count($filenoext) == 1) { $pi[PI_FILENAME] = $filenoext[0]; } else { array_pop($filenoext); $fullfilename = implode('.', $filenoext); $pi[PI_FILENAME] = $fullfilename; } /* Check for sanity */ $sane = Query::_sanitizeFilename($explodedPath[4]); if (!$sane) { $pi[PI_INSANE] = 1; } } } Log::out("query - Path Info"); return $pi; }