or /go/?, so search criteria is in the key of the GET array require_once("../../common/base.php"); require_once("../../common/sql/dbfuncs.php"); require_once("base.php"); // Determine a valid key if (!empty($_GET)) { $keys = array_keys($_GET); $key = $keys[0]; } else { $uri = $_SERVER['REQUEST_URI']; if (substr($uri, 0, 2) == "/~") $key = substr($uri, 1); } if (isset($key)) { $dbc = GotoConnect(); // first, check if id if (is_numeric($key)) { $result = dbgetvalue("select link from Links where id = %s", $key); if (!is_null($result)) ServeRedirect($result); } else { // try key entry if ($key[0] != "~") { $result = dbgetvalue("select link from Links where name = %s", $key); if (!is_null($result)) ServeRedirect($result); } // try tikiwiki if ($key[0] == "~" && strlen($key) <= 10) { dbclose($dbc); // construct wildcard version $newkey = ""; for ($ii = 1; $ii < strlen($key); $ii++) { if ($ii > 1 && ctype_upper($key[$ii])) $newkey .= ' '; $newkey .= $key[$ii] . "%"; } $dbc = TikiConnect(); $result = dbgetarray("select pageName from tiki_pages where pageName like %s", $newkey); // eliminate non-public pagese foreach ($result as $key => $pageName) { $objectId = md5("wiki page" . strtolower($pageName)); $perms = dbgetvalue("select count(*) from `users_objectpermissions` where `groupName` = 'Anonymous' and `permName` = 'tiki_p_view' and `objectType` = 'wiki page' and `objectId` = %s", $objectId); if ($perms == 0) unset($result[$key]); } if (count($result) == 1) { $resvals = array_values($result); ServeRedirect(sprintf("http://www.existencia.org/docs/tiki-index.php?page=%s", urlencode($resvals[0]))); } } } dbclose($dbc); } include("error.html"); function ServeRedirect($destURL) { $header = "Location: $destURL"; header($header); print "\n"; print "\n"; print ""; print "\n"; print "\n"; print "

Redirecting you to $destURL

\n"; print "\n"; print "\n"; exit(0); } ?>