"Phuses"), array("user", "*", "pictures", "title"=>"Pix"), array("user", "*", "thoughts", "title"=>"Thoughts"), array("user", "*", "phuses", "title"=>"Phuses"), array("user", "*", "friends", "title"=>"Friends"), array("pix", "title"=>"Pix"), array("thoughts", "title"=>"Thoughts"), array("phuses", "title"=>(isset($uri[2])?$uri[2]:null)), array("people", "*", "title"=>"People"), array("my", "profile", "edit", "title"=>"Edit My Profile"), array("my", "thoughts", "title"=>"My Thoughts"), array("my", "phuses", "title"=>"My Phuses"), array("my", "pictures", "title"=>"My Pix"), array("my", "messages", "title"=>"My Messages"), array("my", "friends", "title"=>"My Friends"), array("my", "friends", "phuses", "title"=>"My Friends Phuses"), array("my", "friends", "pictures", "title"=>"My Friends Pix"), array("my", "friends", "thoughts", "title"=>"My Friends Thoughts") ); foreach($targets as $key) { $thisDepth = 0; $depth = 0; for($i=0; $i<6; $i++) { if(isset($uri[$i+1]) && isset($key[$i])) : if($key[$i] == strtolower($uri[$i+1]) || $key[$i] == "*") { $thisDepth++; } endif; } if($thisDepth > $depth) { $pageTitle = $key["title"]; $depth = $thisDepth; } } //================= ROUTING ===================// switch($uri[1]) { case "test": require_once($_SERVER['DOCUMENT_ROOT']."/application/constructors/weblog_pinger.php"); $ping = new Weblog_Pinger(); $ping->ping_all("nathan Moore's PhuseBox", "http://phusebox.net/user/nathan"); exit; break; case "logout"; $auth->logout(); break; case "rss": require_once($_SERVER['DOCUMENT_ROOT']."/application/content/rss.php"); exit; break; case "user": if(isset($pb_user)) $uri[2] = $pb_user; // backwards compatible $query = "SELECT a.user, a.id, CONCAT(b.fname,' ',b.lname) AS name FROM users AS a, profile AS b WHERE a.user = '".str_replace("%20"," ",addslashes(trim($uri[2])))."' AND a.id = b.userId LIMIT 1"; $result = mysql_query($query); $data = mysql_fetch_row($result); $thisUser = stripslashes($data[0]); $userId = stripslashes($data[1]); $fullname = stripslashes($data[2]); if(!$fullname) $fullname = $thisUser; // temporary pinging to catch up blog seraches (06.09.07) //require_once($_SERVER['DOCUMENT_ROOT']."/application/constructors/weblog_pinger.php"); //$ping = new Weblog_Pinger(); //$ping->ping_all($fullname."'s PhuseBox", "http://phusebox.net/user/".thisUser); loadClass("user"); $user = new user($thisUser); $profile = new Account($thisUser); // Check Relationship if($account->confirmed) { if($userId == $account->id) { $relationship = "me"; } else { $query = "SELECT COUNT(*), conf FROM friends WHERE user1 = '".$account->id."' AND user2 = '".$userId."' GROUP BY user1 LIMIT 1"; $result = mysql_query($query); $data = mysql_fetch_row($result); if($data[0] > 0 && $data[1] == 1) $relationship = "friend"; if($data[0] > 0 && $data[1] != 1) $relationship = "pending"; if(!$data) $relationship = "stranger"; } } $pageTitle = $fullname." (".$thisUser.")"." - ".$pageTitle; break; } //================= TEMPLATING ===================// if(!isset($contentPath)) { if(file_exists($_SERVER['DOCUMENT_ROOT']."/application/content/".$uri[1].".php")) $contentPath = $_SERVER['DOCUMENT_ROOT']."/application/content/".$uri[1].".php"; else $contentPath = $_SERVER['DOCUMENT_ROOT']."/application/content/404.php"; } require_once($templatePath); ?>