]> projects.mako.cc - scuttle/blobdiff - search.php
Merge branch 'php8'
[scuttle] / search.php
index f0919d89480921826d0bb0025752c9d1f5d93136..7420dd286856287dc1ad7167f070d2f9e6038e34 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 /***************************************************************************
-Copyright (c) 2005 - 2006 Scuttle project
-http://sourceforge.net/projects/scuttle/
+Copyright (c) 2005 - 2006 Marcus Campbell
 http://scuttle.org/
 
 This program is free software; you can redistribute it and/or modify
@@ -19,7 +18,7 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ***************************************************************************/
 
-require_once('header.inc.php');
+require_once 'header.inc.php';
 
 // POST
 if (isset($_POST['terms'])) {
@@ -28,12 +27,19 @@ if (isset($_POST['terms'])) {
 
 // GET
 } else {
-    $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
-    $templateservice =& ServiceFactory::getServiceInstance('TemplateService');
-    $userservice =& ServiceFactory::getServiceInstance('UserService');
+    $sf = new ServiceFactory();
+    $bookmarkservice =& $sf->getServiceInstance('BookmarkService');
+    $templateservice =& $sf->getServiceInstance('TemplateService');
+    $userservice     =& $sf->getServiceInstance('UserService');
 
     $logged_on_userid = $userservice->getCurrentUserId();
-    list($url, $range, $terms, $page) = explode('/', $_SERVER['PATH_INFO']);
+
+    # explode the path
+    $path_exploded = explode('/', $_SERVER['PATH_INFO']);
+    $url = (count($path_exploded) > 0 ? $path_exploded[0] : NULL);
+    $range = (count($path_exploded) > 1 ? $path_exploded[1] : NULL);
+    $terms = (count($path_exploded) > 2 ? $path_exploded[2] : NULL);
+    $page = (count($path_exploded) > 3 ? $path_exploded[3] : NULL);
 
     $tplvars = array();
     $tplVars['loadjs'] = true;

Benjamin Mako Hill || Want to submit a patch?