diff options
author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-03 21:52:30 +0000 |
---|---|---|
committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-03 21:52:30 +0000 |
commit | d5f09b7e4d802cdc2d5f3f876c48ea918c961488 (patch) | |
tree | aa1eb37219c17bef03b1515e5074b4743f89a9a3 | |
parent | b7345f833dea849e94f2ce23fdbe6ab58ba98be3 (diff) | |
download | semanticscuttle-d5f09b7e4d802cdc2d5f3f876c48ea918c961488.tar.gz semanticscuttle-d5f09b7e4d802cdc2d5f3f876c48ea918c961488.tar.bz2 |
make the application work again
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@388 b3834d28-1941-0410-a4f8-b48e95affb8f
90 files changed, 727 insertions, 564 deletions
diff --git a/data/templates/bookmarks.tpl.php b/data/templates/bookmarks.tpl.php index 2b673b7..1768928 100644 --- a/data/templates/bookmarks.tpl.php +++ b/data/templates/bookmarks.tpl.php @@ -1,9 +1,9 @@ <?php /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$tagservice =& ServiceFactory::getServiceInstance('TagService'); -$cdservice =& ServiceFactory::getServiceInstance('CommonDescriptionService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); +$tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); +$cdservice =SemanticScuttle_Service_Factory::getServiceInstance('CommonDescription'); $pageName = isset($pageName)?$pageName:""; @@ -13,7 +13,7 @@ $currenttag = isset($currenttag)?$currenttag:""; $this->includeTemplate($GLOBALS['top_include']); -include('search.inc.php'); +include('search.menu.php'); ?> <?php if($pageName == PAGE_INDEX && $GLOBALS['welcomeMessage']):?> diff --git a/data/templates/dynamictags.inc.php b/data/templates/dynamictags.inc.php index c6b0d16..c1a589f 100644 --- a/data/templates/dynamictags.inc.php +++ b/data/templates/dynamictags.inc.php @@ -20,7 +20,7 @@ ***************************************************************************/ /* Service creation: only useful services are created */ -$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); +$b2tservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark2Tag'); $logged_on_userid = $userservice->getCurrentUserId(); diff --git a/src/SemanticScuttle/search.php b/data/templates/search.menu.php index ce57aea..ce57aea 100644 --- a/src/SemanticScuttle/search.php +++ b/data/templates/search.menu.php diff --git a/data/templates/sidebar.block.common.php b/data/templates/sidebar.block.common.php index 6f1e9f7..7fbc782 100644 --- a/data/templates/sidebar.block.common.php +++ b/data/templates/sidebar.block.common.php @@ -1,5 +1,5 @@ <?php -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); +$b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); $commonTags =& $b2tservice->getRelatedTagsByHash($hash); $commonTags =& $b2tservice->tagCloud($commonTags, 5, 90, 225, 'alphabet_asc'); diff --git a/data/templates/sidebar.block.linked.php b/data/templates/sidebar.block.linked.php index 0fa36c9..6802051 100644 --- a/data/templates/sidebar.block.linked.php +++ b/data/templates/sidebar.block.linked.php @@ -1,6 +1,6 @@ <?php /* Service creation: only useful services are created */ -$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); +$tag2tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); require_once('sidebar.linkedtags.inc.php'); diff --git a/data/templates/sidebar.block.menu.php b/data/templates/sidebar.block.menu.php index ed1069a..6ab5a95 100644 --- a/data/templates/sidebar.block.menu.php +++ b/data/templates/sidebar.block.menu.php @@ -1,6 +1,6 @@ <?php /* Service creation: only useful services are created */ -$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); +$tag2tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); require_once('sidebar.linkedtags.inc.php'); diff --git a/data/templates/sidebar.block.menu2.php b/data/templates/sidebar.block.menu2.php index 8329ef3..fbab636 100644 --- a/data/templates/sidebar.block.menu2.php +++ b/data/templates/sidebar.block.menu2.php @@ -1,6 +1,6 @@ <?php /* Service creation: only useful services are created */ -$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); +$tag2tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); require_once('sidebar.linkedtags.inc.php'); diff --git a/data/templates/sidebar.block.popular.php b/data/templates/sidebar.block.popular.php index 4279620..3f5e8ca 100644 --- a/data/templates/sidebar.block.popular.php +++ b/data/templates/sidebar.block.popular.php @@ -1,6 +1,6 @@ <?php /* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); +$b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); if(!isset($user)) { diff --git a/data/templates/sidebar.block.recent.php b/data/templates/sidebar.block.recent.php index 71f9aa9..4831208 100644 --- a/data/templates/sidebar.block.recent.php +++ b/data/templates/sidebar.block.recent.php @@ -1,6 +1,6 @@ <?php /* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); +$b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); /* Manage input */ $userid = isset($userid)?$userid:NULL; diff --git a/data/templates/sidebar.block.related.php b/data/templates/sidebar.block.related.php index 182ea83..559c648 100644 --- a/data/templates/sidebar.block.related.php +++ b/data/templates/sidebar.block.related.php @@ -1,6 +1,6 @@ <?php /* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); +$b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); if(!isset($user)) $user=""; diff --git a/data/templates/sidebar.block.search.php b/data/templates/sidebar.block.search.php index 4e3c801..ed79f28 100644 --- a/data/templates/sidebar.block.search.php +++ b/data/templates/sidebar.block.search.php @@ -1,6 +1,6 @@ <?php /* Service creation: only useful services are created */ -$searchhistoryservice =& ServiceFactory::getServiceInstance('SearchHistoryService'); +$searchhistoryservice =SemanticScuttle_Service_Factory::getServiceInstance('SearchHistory'); $logged_on_userid = $userservice->getCurrentUserId(); if ($logged_on_userid === false) { diff --git a/data/templates/sidebar.linkedtags.inc.php b/data/templates/sidebar.linkedtags.inc.php index 555eafc..f978339 100644 --- a/data/templates/sidebar.linkedtags.inc.php +++ b/data/templates/sidebar.linkedtags.inc.php @@ -9,8 +9,8 @@ function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode return array('output' => '', 'stoplist' => $stopList); } - $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); - $tagstatservice =& ServiceFactory::getServiceInstance('TagStatService'); + $tag2tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); + $tagstatservice =SemanticScuttle_Service_Factory::getServiceInstance('TagStat'); // link '>' if($level>1) { diff --git a/src/SemanticScuttle/Service.php b/src/SemanticScuttle/Service.php new file mode 100644 index 0000000..a537262 --- /dev/null +++ b/src/SemanticScuttle/Service.php @@ -0,0 +1,35 @@ +<?php +class SemanticScuttle_Service +{ + /** + * SQL database object + * + * @var sql_db + */ + protected $db; + + + + /** + * Returns the single service instance + * + * @internal + * This function can be used once PHP 5.3 is minimum, because only + * 5.3 supports late static binding. For all lower php versions, + * we still need a copy of this method in each service class. + * + * @param DB $db Database object + * + * @return SemanticScuttle_Service + */ + public static function getInstance($db) + { + static $instance; + if (!isset($instance)) { + $instance = new self($db); + } + return $instance; + } + +} +?>
\ No newline at end of file diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php index f119593..6075a0d 100644 --- a/src/SemanticScuttle/Service/Bookmark.php +++ b/src/SemanticScuttle/Service/Bookmark.php @@ -1,23 +1,33 @@ <?php -class BookmarkService { - var $db; +class SemanticScuttle_Service_Bookmark extends SemanticScuttle_Service +{ var $tablename; - function & getInstance(& $db) { + /** + * Returns the single service instance + * + * @param DB $db Database object + * + * @return SemanticScuttle_Service + */ + public static function getInstance($db) + { static $instance; - if (!isset ($instance)) - $instance = & new BookmarkService($db); + if (!isset($instance)) { + $instance = new self($db); + } return $instance; } - function BookmarkService(& $db) { - $this->db = & $db; + public function __construct($db) + { + $this->db = $db; $this->tablename = $GLOBALS['tableprefix'] .'bookmarks'; } function _getbookmark($fieldname, $value, $all = false) { if (!$all) { - $userservice = & ServiceFactory :: getServiceInstance('UserService'); + $userservice = SemanticScuttle_Service_Factory :: getServiceInstance('User'); $sId = $userservice->getCurrentUserId(); $range = ' AND uId = '. $sId; } else { @@ -51,7 +61,7 @@ class BookmarkService { if ($row = & $this->db->sql_fetchrow($dbresult)) { if ($include_tags) { - $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); + $b2tservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark2Tag'); $row['tags'] = $b2tservice->getTagsForBookmark($bid); } $output = $row; @@ -118,7 +128,7 @@ class BookmarkService { return false; } - $userservice = & ServiceFactory::getServiceInstance('UserService'); + $userservice = SemanticScuttle_Service_Factory::getServiceInstance('User'); $user = $userservice->getCurrentUser(); //user has to be either admin, or owner @@ -160,7 +170,7 @@ class BookmarkService { // Note that date is expected to be a string that's interpretable by strtotime(). function addBookmark($address, $title, $description, $privateNote, $status, $categories, $date = NULL, $fromApi = false, $fromImport = false, $sId = -1) { if($sId == -1) { - $userservice = & ServiceFactory :: getServiceInstance('UserService'); + $userservice = SemanticScuttle_Service_Factory :: getServiceInstance('User'); $sId = $userservice->getCurrentUserId(); } @@ -204,7 +214,7 @@ class BookmarkService { $extension = end($uriparts); unset($uriparts); - $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); + $b2tservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark2Tag'); if (!$b2tservice->attachTags($bId, $categories, $fromApi, $extension, false, $fromImport)) { $this->db->sql_transaction('rollback'); message_die(GENERAL_ERROR, 'Could not insert bookmark', '', __LINE__, __FILE__, $sql, $this->db); @@ -260,7 +270,7 @@ class BookmarkService { $extension = end($uriparts); unset($uriparts); - $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); + $b2tservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark2Tag'); if (!$b2tservice->attachTags($bId, $categories, $fromApi, $extension)) { $this->db->sql_transaction('rollback'); message_die(GENERAL_ERROR, 'Could not update bookmark', '', __LINE__, __FILE__, $sql, $this->db); @@ -282,9 +292,9 @@ class BookmarkService { // bookmarks; otherwise, just get the public bookmarks. // - if the $user is set and IS the logged-in user, then get all bookmarks. - $userservice =& ServiceFactory::getServiceInstance('UserService'); - $b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); - $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); + $userservice =SemanticScuttle_Service_Factory::getServiceInstance('User'); + $b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); + $tag2tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); $sId = $userservice->getCurrentUserId(); if ($userservice->isLoggedOn()) { @@ -480,15 +490,15 @@ class BookmarkService { return true; } - function deleteBookmarksForUser($uId) {
- $query = 'DELETE FROM '. $GLOBALS['tableprefix'] .'bookmarks WHERE uId = '. intval($uId);
-
- if (!($dbresult = & $this->db->sql_query($query))) {
- message_die(GENERAL_ERROR, 'Could not delete bookmarks', '', __LINE__, __FILE__, $query, $this->db);
- return false;
- }
-
- return true;
+ function deleteBookmarksForUser($uId) { + $query = 'DELETE FROM '. $GLOBALS['tableprefix'] .'bookmarks WHERE uId = '. intval($uId); + + if (!($dbresult = & $this->db->sql_query($query))) { + message_die(GENERAL_ERROR, 'Could not delete bookmarks', '', __LINE__, __FILE__, $query, $this->db); + return false; + } + + return true; } function countOthers($address) { @@ -496,7 +506,7 @@ class BookmarkService { return false; } - $userservice = & ServiceFactory :: getServiceInstance('UserService'); + $userservice = SemanticScuttle_Service_Factory :: getServiceInstance('User'); $sId = $userservice->getCurrentUserId(); if ($userservice->isLoggedOn()) { diff --git a/src/SemanticScuttle/Service/Bookmark2tag.php b/src/SemanticScuttle/Service/Bookmark2Tag.php index 918fb5b..bd3f3af 100644 --- a/src/SemanticScuttle/Service/Bookmark2tag.php +++ b/src/SemanticScuttle/Service/Bookmark2Tag.php @@ -1,17 +1,28 @@ <?php -class Bookmark2TagService { - var $db; +class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_Service +{ var $tablename; - function &getInstance(&$db) { + + /** + * Returns the single service instance + * + * @param DB $db Database object + * + * @return SemanticScuttle_Service + */ + public static function getInstance($db) + { static $instance; - if (!isset($instance)) - $instance =& new Bookmark2TagService($db); + if (!isset($instance)) { + $instance = new self($db); + } return $instance; } - function Bookmark2TagService(&$db) { - $this->db =& $db; + public function __construct($db) + { + $this->db = $db; $this->tablename = $GLOBALS['tableprefix'] .'bookmarks2tags'; } @@ -42,7 +53,7 @@ class Bookmark2TagService { } } - $tagservice =& ServiceFactory::getServiceInstance('TagService'); + $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); $tags = $tagservice->normalize($tags); @@ -51,7 +62,7 @@ class Bookmark2TagService { for ($i = 0; $i < $tags_count; $i++) { $tags[$i] = trim(strtolower($tags[$i])); if ($fromApi) { - include_once(dirname(__FILE__) .'/../functions.inc.php'); + include_once 'SemanticScuttle/functions.php'; $tags[$i] = convertTag($tags[$i], 'in'); } } @@ -70,7 +81,7 @@ class Bookmark2TagService { // Media and file types if (!is_null($extension)) { - include_once(dirname(__FILE__) .'/../functions.inc.php'); + include_once 'SemanticScuttle/functions.php'; if ($keys = multi_array_search($extension, $GLOBALS['filetypes'])) { $tags[] = 'system:filetype:'. $extension; @@ -93,8 +104,8 @@ class Bookmark2TagService { } } - $bs =& ServiceFactory::getServiceInstance('BookmarkService'); - $tts =& ServiceFactory::getServiceInstance('Tag2TagService'); + $bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); + $tts =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); // Create links between tags foreach($tags as $key => $tag) { @@ -150,7 +161,7 @@ class Bookmark2TagService { } function deleteTag($uId, $tag) { - $bs =& ServiceFactory::getServiceInstance('BookmarkService'); + $bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); $query = 'DELETE FROM '. $this->getTableName(); $query.= ' USING '. $this->getTableName() .', '. $bs->getTableName(); @@ -183,23 +194,23 @@ class Bookmark2TagService { } /* Allow deletion in admin page */ - function deleteTagsForUser($uId) {
- $qmask = 'DELETE FROM %s USING %s, %s WHERE %s.bId = %s.bId AND %s.uId = %d';
- $query = sprintf($qmask,
- $this->getTableName(),
- $this->getTableName(),
- $GLOBALS['tableprefix'].'bookmarks',
- $this->getTableName(),
- $GLOBALS['tableprefix'].'bookmarks',
- $GLOBALS['tableprefix'].'bookmarks',
- $uId);
-
- if (!($dbresult =& $this->db->sql_query($query))) {
- message_die(GENERAL_ERROR, 'Could not delete tags', '', __LINE__, __FILE__, $query, $this->db);
- return false;
- }
-
- return true;
+ function deleteTagsForUser($uId) { + $qmask = 'DELETE FROM %s USING %s, %s WHERE %s.bId = %s.bId AND %s.uId = %d'; + $query = sprintf($qmask, + $this->getTableName(), + $this->getTableName(), + $GLOBALS['tableprefix'].'bookmarks', + $this->getTableName(), + $GLOBALS['tableprefix'].'bookmarks', + $GLOBALS['tableprefix'].'bookmarks', + $uId); + + if (!($dbresult =& $this->db->sql_query($query))) { + message_die(GENERAL_ERROR, 'Could not delete tags', '', __LINE__, __FILE__, $query, $this->db); + return false; + } + + return true; } function &getTagsForBookmark($bookmarkid) { @@ -224,7 +235,7 @@ class Bookmark2TagService { } function &getTags($userid = NULL) { - $userservice =& ServiceFactory::getServiceInstance('UserService'); + $userservice =SemanticScuttle_Service_Factory::getServiceInstance('User'); $logged_on_user = $userservice->getCurrentUserId(); $query = 'SELECT T.tag, COUNT(B.bId) AS bCount FROM '. $GLOBALS['tableprefix'] .'bookmarks AS B INNER JOIN '. $userservice->getTableName() .' AS U ON B.uId = U.'. $userservice->getFieldName('primary') .' INNER JOIN '. $GLOBALS['tableprefix'] .'bookmarks2tags AS T ON B.bId = T.bId'; @@ -299,7 +310,7 @@ class Bookmark2TagService { // Returns the most popular tags used for a particular bookmark hash function &getRelatedTagsByHash($hash, $limit = 20) { - $userservice = & ServiceFactory :: getServiceInstance('UserService'); + $userservice = SemanticScuttle_Service_Factory :: getServiceInstance('User'); $sId = $userservice->getCurrentUserId(); // Logged in if ($userservice->isLoggedOn()) { @@ -329,7 +340,7 @@ class Bookmark2TagService { function &getAdminTags($limit = 30, $logged_on_user = NULL, $days = NULL) { // look for admin ids - $userservice = & ServiceFactory :: getServiceInstance('UserService'); + $userservice = SemanticScuttle_Service_Factory :: getServiceInstance('User'); $adminIds = $userservice->getAdminIds(); // ask for their tags @@ -338,7 +349,7 @@ class Bookmark2TagService { function &getContactTags($user, $limit = 30, $logged_on_user = NULL, $days = NULL) { // look for contact ids - $userservice = & ServiceFactory :: getServiceInstance('UserService'); + $userservice = SemanticScuttle_Service_Factory :: getServiceInstance('User'); $contacts = $userservice->getWatchlist($user); // add the user (to show him/her also his/her tags) @@ -406,8 +417,8 @@ class Bookmark2TagService { } function renameTag($userid, $old, $new, $fromApi = false) { - $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - $tagservice =& ServiceFactory::getServiceInstance('TagService'); + $bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); + $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); if (is_null($userid) || is_null($old) || is_null($new)) return false; diff --git a/src/SemanticScuttle/Service/Cache.php b/src/SemanticScuttle/Service/Cache.php index fe66d38..5ca2843 100644 --- a/src/SemanticScuttle/Service/Cache.php +++ b/src/SemanticScuttle/Service/Cache.php @@ -1,18 +1,27 @@ <?php -class CacheService { +class SemanticScuttle_Service_Cache extends SemanticScuttle_Service +{ var $basedir; var $fileextension = '.cache'; - function &getInstance() { - static $instance; - - if (!isset($instance)) - $instance =& new CacheService(); - - return $instance; - } + /** + * Returns the single service instance + * + * @param DB $db Database object + * + * @return SemanticScuttle_Service + */ + public static function getInstance($db) + { + static $instance; + if (!isset($instance)) { + $instance = new self($db); + } + return $instance; + } - function CacheService() { + protected function __construct() + { $this->basedir = $GLOBALS['dir_cache']; } diff --git a/src/SemanticScuttle/Service/CommonDescription.php b/src/SemanticScuttle/Service/CommonDescription.php index 86e0c0f..ed1ffdd 100644 --- a/src/SemanticScuttle/Service/CommonDescription.php +++ b/src/SemanticScuttle/Service/CommonDescription.php @@ -1,17 +1,27 @@ <?php -class CommonDescriptionService { - var $db; +class SemanticScuttle_Service_CommonDescription extends SemanticScuttle_Service +{ var $tablename; - function &getInstance(&$db) { + /** + * Returns the single service instance + * + * @param DB $db Database object + * + * @return SemanticScuttle_Service + */ + public static function getInstance($db) + { static $instance; - if (!isset($instance)) - $instance =& new CommonDescriptionService($db); + if (!isset($instance)) { + $instance = new self($db); + } return $instance; } - function CommonDescriptionService(&$db) { - $this->db =& $db; + public function __construct($db) + { + $this->db = $db; $this->tablename = $GLOBALS['tableprefix'] .'commondescription'; } diff --git a/src/SemanticScuttle/Service/Factory.php b/src/SemanticScuttle/Service/Factory.php index b5215e3..b4ba28e 100644 --- a/src/SemanticScuttle/Service/Factory.php +++ b/src/SemanticScuttle/Service/Factory.php @@ -1,16 +1,19 @@ <?php /* Connect to the database and build services */ -class ServiceFactory { - function ServiceFactory(&$db, $serviceoverrules = array()) { +class SemanticScuttle_Service_Factory +{ + public function __construct($db, $serviceoverrules = array()) + { } - function &getServiceInstance($name, $servicedir = NULL) { + public function getServiceInstance($name, $servicedir = null) + { global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype; static $instances = array(); static $db; if (!isset($db)) { - require_once(dirname(__FILE__) .'/../includes/db/'. $dbtype .'.php'); + require_once 'SemanticScuttle/db/'. $dbtype .'.php'; $db = new sql_db(); $db->sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist); if(!$db->db_connect_id) { @@ -25,12 +28,15 @@ class ServiceFactory { } if (!class_exists($name)) { if (!isset($servicedir)) { - $servicedir = dirname(__FILE__) .'/'; + $servicedir = 'SemanticScuttle/Service/'; } - require_once($servicedir . strtolower($name) . '.php'); + require_once $servicedir . $name . '.php'; } - $instances[$name] = call_user_func(array($name, 'getInstance'), $db); + $instances[$name] = call_user_func( + array('SemanticScuttle_Service_' . $name, 'getInstance'), + $db + ); } return $instances[$name]; } diff --git a/src/SemanticScuttle/Service/SearchHistory.php b/src/SemanticScuttle/Service/SearchHistory.php index 91457e8..7cffa83 100644 --- a/src/SemanticScuttle/Service/SearchHistory.php +++ b/src/SemanticScuttle/Service/SearchHistory.php @@ -1,18 +1,28 @@ <?php -class SearchHistoryService { - var $db; +class SemanticScuttle_Service_SearchHistory extends SemanticScuttle_Service +{ var $tablename; var $sizeSearchHistory; - function &getInstance(&$db) { + /** + * Returns the single service instance + * + * @param DB $db Database object + * + * @return SemanticScuttle_Service + */ + public static function getInstance($db) + { static $instance; - if (!isset($instance)) - $instance =& new SearchHistoryService($db); + if (!isset($instance)) { + $instance = new self($db); + } return $instance; } - function SearchHistoryService(& $db) { - $this->db =& $db; + public function __construct($db) + { + $this->db = $db; $this->tablename = $GLOBALS['tableprefix'] .'searchhistory'; if(isset($GLOBALS['sizeSearchHistory'])) { $this->sizeSearchHistory = $GLOBALS['sizeSearchHistory']; diff --git a/src/SemanticScuttle/Service/Tag.php b/src/SemanticScuttle/Service/Tag.php index fc44a99..2a70948 100644 --- a/src/SemanticScuttle/Service/Tag.php +++ b/src/SemanticScuttle/Service/Tag.php @@ -1,17 +1,27 @@ <?php -class TagService { - var $db; +class SemanticScuttle_Service_Tag extends SemanticScuttle_Service +{ var $tablename; - function &getInstance(&$db) { + /** + * Returns the single service instance + * + * @param DB $db Database object + * + * @return SemanticScuttle_Service + */ + public static function getInstance($db) + { static $instance; - if (!isset($instance)) - $instance =& new TagService($db); + if (!isset($instance)) { + $instance = new self($db); + } return $instance; } - function TagService(&$db) { - $this->db =& $db; + public function __construct($db) + { + $this->db = $db; $this->tablename = $GLOBALS['tableprefix'] .'tags'; } diff --git a/src/SemanticScuttle/Service/Tag2tag.php b/src/SemanticScuttle/Service/Tag2Tag.php index 956fd49..b209d60 100644 --- a/src/SemanticScuttle/Service/Tag2tag.php +++ b/src/SemanticScuttle/Service/Tag2Tag.php @@ -1,22 +1,33 @@ <?php -class Tag2TagService { - var $db; - var $tablename; - - function &getInstance(&$db) { +class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_Service +{ + protected $tablename; + + /** + * Returns the single service instance + * + * @param DB $db Database object + * + * @return SemanticScuttle_Service + */ + public static function getInstance($db) + { static $instance; - if (!isset($instance)) - $instance =& new Tag2TagService($db); + if (!isset($instance)) { + $instance = new self($db); + } return $instance; } - function Tag2TagService(&$db) { + + function __construct(&$db) + { $this->db =& $db; $this->tablename = $GLOBALS['tableprefix'] .'tags2tags'; } function addLinkedTags($tag1, $tag2, $relationType, $uId) { - $tagservice =& ServiceFactory::getServiceInstance('TagService'); + $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); $tag1 = $tagservice->normalize($tag1); $tag2 = $tagservice->normalize($tag2); @@ -46,7 +57,7 @@ class Tag2TagService { // Return linked tags just for admin users function getAdminLinkedTags($tag, $relationType, $inverseRelation = false, $stopList = array()) { // look for admin ids - $userservice = & ServiceFactory :: getServiceInstance('UserService'); + $userservice = SemanticScuttle_Service_Factory :: getServiceInstance('User'); $adminIds = $userservice->getAdminIds(); //ask for their linked tags @@ -119,7 +130,7 @@ class Tag2TagService { } // try to find data in cache - $tcs = & ServiceFactory::getServiceInstance('TagCacheService'); + $tcs = SemanticScuttle_Service_Factory::getServiceInstance('TagCache'); if(count($stopList) == 0) { $activatedCache = true; } else { @@ -177,7 +188,7 @@ class Tag2TagService { $query = "SELECT DISTINCT tts.tag1 as tag"; $query.= " FROM `". $this->getTableName() ."` tts"; if($orderBy != null) { - $tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $tsts =SemanticScuttle_Service_Factory::getServiceInstance('TagStat'); $query.= ", ".$tsts->getTableName() ." tsts"; } $query.= " WHERE tts.tag1 <> ALL"; @@ -328,7 +339,7 @@ class Tag2TagService { } function renameTag($uId, $oldName, $newName) { - $tagservice =& ServiceFactory::getServiceInstance('TagService'); + $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); $newName = $tagservice->normalize($newName); $query = 'UPDATE `'. $this->getTableName() .'`'; @@ -355,10 +366,10 @@ class Tag2TagService { } function update($tag1, $tag2, $relationType, $uId) { - $tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $tsts =SemanticScuttle_Service_Factory::getServiceInstance('TagStat'); $tsts->updateStat($tag1, $relationType, $uId); - $tcs = & ServiceFactory::getServiceInstance('TagCacheService'); + $tcs = SemanticScuttle_Service_Factory::getServiceInstance('TagCache'); $tcs->deleteByUser($uId); } @@ -366,7 +377,7 @@ class Tag2TagService { $query = 'TRUNCATE TABLE `'. $this->getTableName() .'`'; $this->db->sql_query($query); - $tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $tsts =SemanticScuttle_Service_Factory::getServiceInstance('TagStat'); $tsts->deleteAll(); } diff --git a/src/SemanticScuttle/Service/TagCache.php b/src/SemanticScuttle/Service/TagCache.php index ed2eefc..30f9ebd 100644 --- a/src/SemanticScuttle/Service/TagCache.php +++ b/src/SemanticScuttle/Service/TagCache.php @@ -1,31 +1,43 @@ <?php - -/* - * This class infers on relation between tags by storing all the including tags or synonymous tag. - * For example, if the user creates: tag1>tag2>tag3, the system can infer that tag is included into tag1. - * Instead of computing this relation several times, it is saved into this current table. +/** + * This class infers on relation between tags by storing all + * the including tags or synonymous tag. + * For example, if the user creates: tag1>tag2>tag3, the system + * can infer that tag is included into tag1. + * Instead of computing this relation several times, it is saved + * into this current table. * For synonymy, this table stores also the group of synonymous tags. - * The table must be updated for each modification of the relations between tags. + * The table must be updated for each modification of + * the relations between tags. */ - -class TagCacheService { - var $db; +class SemanticScuttle_Service_TagCache extends SemanticScuttle_Service +{ var $tablename; - function &getInstance(&$db) { + /** + * Returns the single service instance + * + * @param DB $db Database object + * + * @return SemanticScuttle_Service + */ + public static function getInstance($db) + { static $instance; - if (!isset($instance)) - $instance =& new TagCacheService($db); + if (!isset($instance)) { + $instance = new self($db); + } return $instance; } - function TagCacheService(&$db) { - $this->db =& $db; + protected function __construct($db) + { + $this->db =$db; $this->tablename = $GLOBALS['tableprefix'] .'tagscache'; } function getChildren($tag1, $uId) { - $tagservice =& ServiceFactory::getServiceInstance('TagService'); + $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); $tag1 = $tagservice->normalize($tag1); if($tag1 == '') return false; @@ -54,7 +66,7 @@ class TagCacheService { } function addChild($tag1, $tag2, $uId) { - $tagservice =& ServiceFactory::getServiceInstance('TagService'); + $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); $tag1 = $tagservice->normalize($tag1); $tag2 = $tagservice->normalize($tag2); @@ -98,7 +110,7 @@ class TagCacheService { } function existsChild($tag1, $tag2, $uId) { - $tagservice =& ServiceFactory::getServiceInstance('TagService'); + $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); $tag1 = $tagservice->normalize($tag1); $tag2 = $tagservice->normalize($tag2); @@ -202,7 +214,7 @@ class TagCacheService { } function _isSynonymKey($tag1, $uId) { - $tagservice =& ServiceFactory::getServiceInstance('TagService'); + $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); $tag1 = $tagservice->normalize($tag1); $query = "SELECT tag1 FROM `". $this->getTableName() ."`"; @@ -214,7 +226,7 @@ class TagCacheService { } function _isSynonymValue($tag2, $uId) { - $tagservice =& ServiceFactory::getServiceInstance('TagService'); + $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); $tag2 = $tagservice->normalize($tag2); $query = "SELECT tag2 FROM `". $this->getTableName() ."`"; @@ -238,7 +250,7 @@ class TagCacheService { } function _getSynonymKey($tag2, $uId) { - $tagservice =& ServiceFactory::getServiceInstance('TagService'); + $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); $tag2 = $tagservice->normalize($tag2); if($this->_isSynonymKey($tag2)) return $tag2; @@ -267,7 +279,7 @@ class TagCacheService { * $tagExcepted allows to hide a value. */ function _getSynonymValues($tag1, $uId, $tagExcepted = NULL) { - $tagservice =& ServiceFactory::getServiceInstance('TagService'); + $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); $tag1 = $tagservice->normalize($tag1); $tagExcepted = $tagservice->normalize($tagExcepted); diff --git a/src/SemanticScuttle/Service/TagStat.php b/src/SemanticScuttle/Service/TagStat.php index 9d3ca5d..c54dcb7 100644 --- a/src/SemanticScuttle/Service/TagStat.php +++ b/src/SemanticScuttle/Service/TagStat.php @@ -1,22 +1,33 @@ <?php -class TagStatService { - var $db; +class SemanticScuttle_Service_TagStat extends SemanticScuttle_Service +{ + var $tablename; - function &getInstance(&$db) { + /** + * Returns the single service instance + * + * @param DB $db Database object + * + * @return SemanticScuttle_Service + */ + public static function getInstance($db) + { static $instance; - if (!isset($instance)) - $instance =& new TagStatService($db); + if (!isset($instance)) { + $instance = new self($db); + } return $instance; } - function TagStatService(&$db) { - $this->db =& $db; + protected function __construct($db) + { + $this->db = $db; $this->tablename = $GLOBALS['tableprefix'] .'tagsstats'; } function getNbChildren($tag1, $relationType, $uId) { - $tts =& ServiceFactory::getServiceInstance('Tag2TagService'); + $tts =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); $query = "SELECT tag1, relationType, uId FROM `". $tts->getTableName() ."`"; $query.= " WHERE tag1 = '" .$tag1 ."'"; $query.= " AND relationType = '". $relationType ."'"; @@ -91,7 +102,7 @@ class TagStatService { return false; } - $tts =& ServiceFactory::getServiceInstance('Tag2TagService'); + $tts =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); $linkedTags = $tts->getLinkedTags($tag1, $relationType, $uId); $nbDescendants = 0; $maxDepth = 0; @@ -112,7 +123,7 @@ class TagStatService { } function updateAllStat() { - $tts =& ServiceFactory::getServiceInstance('Tag2TagService'); + $tts =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); $query = "SELECT tag1, uId FROM `". $tts->getTableName() ."`"; $query.= " WHERE relationType = '>'"; diff --git a/src/SemanticScuttle/Service/Template.php b/src/SemanticScuttle/Service/Template.php index 05e494c..dbe5670 100644 --- a/src/SemanticScuttle/Service/Template.php +++ b/src/SemanticScuttle/Service/Template.php @@ -1,15 +1,26 @@ <?php -class TemplateService { - var $basedir; +class SemanticScuttle_Service_Template extends SemanticScuttle_Service +{ + protected $basedir; - function &getInstance() { + /** + * Returns the single service instance + * + * @param DB $db Database object + * + * @return SemanticScuttle_Service + */ + public static function getInstance($db) + { static $instance; - if (!isset($instance)) - $instance =& new TemplateService(); + if (!isset($instance)) { + $instance = new self($db); + } return $instance; } - function TemplateService() { + public function __construct() + { $this->basedir = $GLOBALS['TEMPLATES_DIR']; } diff --git a/src/SemanticScuttle/Service/User.php b/src/SemanticScuttle/Service/User.php index 407632b..bc88c0b 100644 --- a/src/SemanticScuttle/Service/User.php +++ b/src/SemanticScuttle/Service/User.php @@ -1,28 +1,39 @@ <?php -class UserService { - var $db; - var $fields = array( +class SemanticScuttle_Service_User extends SemanticScuttle_Service +{ + protected $db; + protected $fields = array( 'primary' => 'uId', 'username' => 'username', 'password' => 'password'); - var $profileurl; - var $tablename; - var $sessionkey; - var $cookiekey; - var $cookietime = 1209600; // 2 weeks - - function &getInstance(&$db) { + protected $profileurl; + protected $tablename; + protected $sessionkey; + protected $cookiekey; + protected $cookietime = 1209600; // 2 weeks + + /** + * Returns the single service instance + * + * @param DB $db Database object + * + * @return SemanticScuttle_Service + */ + public static function getInstance($db) + { static $instance; - if (!isset($instance)) - $instance =& new UserService($db); + if (!isset($instance)) { + $instance = new self($db); + } return $instance; } - function UserService(& $db) { - $this->db =& $db; - $this->tablename = $GLOBALS['tableprefix'] .'users'; + protected function __construct($db) + { + $this->db = $db; + $this->tablename = $GLOBALS['tableprefix'] .'users'; $this->sessionkey = INSTALLATION_ID.'-currentuserid'; - $this->cookiekey = INSTALLATION_ID.'-login'; + $this->cookiekey = INSTALLATION_ID.'-login'; $this->profileurl = createURL('profile', '%2$s'); $this->updateSessionStability(); } @@ -436,21 +447,21 @@ class UserService { return true; } - function getAllUsers ( ) {
- $query = 'SELECT * FROM '. $this->getTableName();
-
- if (! ($dbresult =& $this->db->sql_query($query)) ) {
- message_die(GENERAL_ERROR, 'Could not get users', '', __LINE__, __FILE__, $query, $this->db);
- return false;
- }
-
- $rows = array();
-
- while ( $row = $this->db->sql_fetchrow($dbresult) ) {
- $rows[] = $row;
- }
- $this->db->sql_freeresult($dbresult);
- return $rows;
+ function getAllUsers ( ) { + $query = 'SELECT * FROM '. $this->getTableName(); + + if (! ($dbresult =& $this->db->sql_query($query)) ) { + message_die(GENERAL_ERROR, 'Could not get users', '', __LINE__, __FILE__, $query, $this->db); + return false; + } + + $rows = array(); + + while ( $row = $this->db->sql_fetchrow($dbresult) ) { + $rows[] = $row; + } + $this->db->sql_freeresult($dbresult); + return $rows; } // Returns an array with admin uIds @@ -461,18 +472,18 @@ class UserService { $admins[] = $this->getIdFromUser($adminName); } return $admins; - }
-
- function deleteUser($uId) {
- $query = 'DELETE FROM '. $this->getTableName() .' WHERE uId = '. intval($uId);
-
- if (!($dbresult = & $this->db->sql_query($query))) {
- message_die(GENERAL_ERROR, 'Could not delete user', '', __LINE__, __FILE__, $query, $this->db);
- return false;
- }
-
- return true;
- }
+ } + + function deleteUser($uId) { + $query = 'DELETE FROM '. $this->getTableName() .' WHERE uId = '. intval($uId); + + if (!($dbresult = & $this->db->sql_query($query))) { + message_die(GENERAL_ERROR, 'Could not delete user', '', __LINE__, __FILE__, $query, $this->db); + return false; + } + + return true; + } function sanitisePassword($password) { @@ -601,7 +612,7 @@ class User { function getName() { // Look for value only if not already set if(!isset($this->name)) { - $userservice =& ServiceFactory::getServiceInstance('UserService'); + $userservice =SemanticScuttle_Service_Factory::getServiceInstance('User'); $user = $userservice->getUser($this->id); $this->name = $user['name']; } @@ -611,7 +622,7 @@ class User { function getEmail() { // Look for value only if not already set if(!isset($this->email)) { - $userservice =& ServiceFactory::getServiceInstance('UserService'); + $userservice =SemanticScuttle_Service_Factory::getServiceInstance('User'); $user = $userservice->getUser($this->id); $this->email = $user['email']; } @@ -621,7 +632,7 @@ class User { function getHomepage() { // Look for value only if not already set if(!isset($this->homepage)) { - $userservice =& ServiceFactory::getServiceInstance('UserService'); + $userservice =SemanticScuttle_Service_Factory::getServiceInstance('User'); $user = $userservice->getUser($this->id); $this->homepage = $user['homepage']; } @@ -631,7 +642,7 @@ class User { function getContent() { // Look for value only if not already set if(!isset($this->content)) { - $userservice =& ServiceFactory::getServiceInstance('UserService'); + $userservice =SemanticScuttle_Service_Factory::getServiceInstance('User'); $user = $userservice->getUser($this->id); $this->content = $user['uContent']; } @@ -641,7 +652,7 @@ class User { function getDatetime() { // Look for value only if not already set if(!isset($this->content)) { - $userservice =& ServiceFactory::getServiceInstance('UserService'); + $userservice =SemanticScuttle_Service_Factory::getServiceInstance('User'); $user = $userservice->getUser($this->id); $this->datetime = $user['uDatetime']; } @@ -651,14 +662,14 @@ class User { function isAdmin() { // Look for value only if not already set if(!isset($this->isAdmin)) { - $userservice =& ServiceFactory::getServiceInstance('UserService'); + $userservice =SemanticScuttle_Service_Factory::getServiceInstance('User'); $this->isAdmin = $userservice->isAdmin($this->id); } return $this->isAdmin; } function getNbBookmarks($range = 'public') { - $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); + $bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); return $bookmarkservice->countBookmarks($this->getId(), $range); } } diff --git a/src/SemanticScuttle/header.php b/src/SemanticScuttle/header.php index 024cb06..b01679c 100644 --- a/src/SemanticScuttle/header.php +++ b/src/SemanticScuttle/header.php @@ -1,12 +1,17 @@ <?php -if(!file_exists(dirname(__FILE__) .'/config.inc.php')) { - die('Please copy "config.inc.php.dist" to "config.inc.php"'); +if(!file_exists(dirname(__FILE__) .'/../../data/config.php')) { + die('Please copy "config.php.dist" to "config.php"'); } +set_include_path( + get_include_path() . PATH_SEPARATOR + . dirname(__FILE__) . '/../' +); // 1 // First requirements part (before debug management) -require_once(dirname(__FILE__) .'/config.default.inc.php'); -require_once(dirname(__FILE__) .'/config.inc.php'); -require_once(dirname(__FILE__) .'/constants.inc.php'); // some constants are based on variables from config file +$datadir = dirname(__FILE__) . '/../../data/'; +require_once($datadir . '/config.default.php'); +require_once($datadir . '/config.php'); +require_once 'SemanticScuttle/constants.php'; // some constants are based on variables from config file // Debug Management using constants @@ -21,17 +26,18 @@ if(DEBUG_MODE) { } // 2 // Second requirements part which could display bugs (must come after debug management) -require_once(dirname(__FILE__) .'/services/servicefactory.php'); -require_once(dirname(__FILE__) .'/functions.inc.php'); +require_once 'SemanticScuttle/Service.php'; +require_once 'SemanticScuttle/Service/Factory.php'; +require_once 'SemanticScuttle/functions.php'; // 3 // Third requirements part which import functions from includes/ directory // UTF-8 functions -require_once(dirname(__FILE__) .'/includes/utf8.php'); +require_once 'SemanticScuttle/utf8.php'; // Translation -require_once(dirname(__FILE__) .'/includes/php-gettext/gettext.inc'); +require_once 'php-gettext/gettext.inc'; $domain = 'messages'; T_setlocale(LC_MESSAGES, $locale); T_bindtextdomain($domain, dirname(__FILE__) .'/locales'); @@ -42,10 +48,10 @@ T_textdomain($domain); session_start(); // 5 // Create mandatory services and objects -$userservice =& ServiceFactory::getServiceInstance('UserService'); +$userservice =SemanticScuttle_Service_Factory::getServiceInstance('User'); $currentUser = $userservice->getCurrentObjectUser(); -$templateservice =& ServiceFactory::getServiceInstance('TemplateService'); +$templateservice =SemanticScuttle_Service_Factory::getServiceInstance('Template'); $tplVars = array(); $tplVars['currentUser'] = $currentUser; $tplVars['userservice'] = $userservice; diff --git a/includes/utf8.php b/src/SemanticScuttle/utf8.php index 9ef8113..9ef8113 100644 --- a/includes/utf8.php +++ b/src/SemanticScuttle/utf8.php diff --git a/tests/bookmarksTest.php b/tests/bookmarksTest.php index e229d5e..3bff35d 100644 --- a/tests/bookmarksTest.php +++ b/tests/bookmarksTest.php @@ -19,14 +19,14 @@ class BookmarksTest extends PHPUnit_Framework_TestCase global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix, $TEMPLATES_DIR, $filetypes, $debugMode; require_once('./header.inc.php'); - $this->us =& ServiceFactory::getServiceInstance('UserService'); - $this->bs =& ServiceFactory::getServiceInstance('BookmarkService'); + $this->us =SemanticScuttle_Service_Factory::getServiceInstance('User'); + $this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); $this->bs->deleteAll(); - $this->b2ts=& ServiceFactory::getServiceInstance('Bookmark2TagService'); + $this->b2ts=SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); $this->b2ts->deleteAll(); - $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService'); + $this->tts =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); $this->tts->deleteAll(); - $this->tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $this->tsts =SemanticScuttle_Service_Factory::getServiceInstance('TagStat'); $this->tsts->deleteAll(); } diff --git a/tests/commonDescriptionTest.php b/tests/commonDescriptionTest.php index c8666c2..f73b646 100644 --- a/tests/commonDescriptionTest.php +++ b/tests/commonDescriptionTest.php @@ -21,16 +21,16 @@ class CommonDescriptionTest extends PHPUnit_Framework_TestCase global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix; require_once('./header.inc.php'); - $this->us =& ServiceFactory::getServiceInstance('UserService'); - $this->bs =& ServiceFactory::getServiceInstance('BookmarkService'); + $this->us =SemanticScuttle_Service_Factory::getServiceInstance('User'); + $this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); $this->bs->deleteAll(); - $this->b2ts =& ServiceFactory::getServiceInstance('Bookmark2TagService'); + $this->b2ts =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); $this->b2ts->deleteAll(); - $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService'); + $this->tts =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); $this->tts->deleteAll(); - $this->tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $this->tsts =SemanticScuttle_Service_Factory::getServiceInstance('TagStat'); $this->tsts->deleteAll(); - $this->cds =& ServiceFactory::getServiceInstance('CommonDescriptionService'); + $this->cds =SemanticScuttle_Service_Factory::getServiceInstance('CommonDescription'); $this->cds->deleteAll(); } diff --git a/tests/searchTest.php b/tests/searchTest.php index 2e51717..1dce7dc 100644 --- a/tests/searchTest.php +++ b/tests/searchTest.php @@ -20,16 +20,16 @@ class SearchTest extends PHPUnit_Framework_TestCase global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix; require_once('./header.inc.php'); - $this->us =& ServiceFactory::getServiceInstance('UserService'); - $this->bs =& ServiceFactory::getServiceInstance('BookmarkService'); + $this->us =SemanticScuttle_Service_Factory::getServiceInstance('User'); + $this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); $this->bs->deleteAll(); - $this->b2ts =& ServiceFactory::getServiceInstance('Bookmark2TagService'); + $this->b2ts =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); $this->b2ts->deleteAll(); - $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService'); + $this->tts =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); $this->tts->deleteAll(); - $this->tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $this->tsts =SemanticScuttle_Service_Factory::getServiceInstance('TagStat'); $this->tsts->deleteAll(); - $this->shs =& ServiceFactory::getServiceInstance('SearchHistoryService'); + $this->shs =SemanticScuttle_Service_Factory::getServiceInstance('SearchHistory'); $this->shs->deleteAll(); } diff --git a/tests/tag2TagTest.php b/tests/tag2TagTest.php index 8bb9ef3..ab3114c 100644 --- a/tests/tag2TagTest.php +++ b/tests/tag2TagTest.php @@ -19,14 +19,14 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix; require_once('./header.inc.php'); - $this->us =& ServiceFactory::getServiceInstance('UserService'); - $this->bs =& ServiceFactory::getServiceInstance('BookmarkService'); + $this->us =SemanticScuttle_Service_Factory::getServiceInstance('User'); + $this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); $this->bs->deleteAll(); - $this->b2ts =& ServiceFactory::getServiceInstance('Bookmark2TagService'); + $this->b2ts =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); $this->b2ts->deleteAll(); - $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService'); + $this->tts =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); $this->tts->deleteAll(); - $this->tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $this->tsts =SemanticScuttle_Service_Factory::getServiceInstance('TagStat'); $this->tsts->deleteAll(); } diff --git a/tests/tagsCacheTest.php b/tests/tagsCacheTest.php index 595afb9..7673565 100644 --- a/tests/tagsCacheTest.php +++ b/tests/tagsCacheTest.php @@ -19,16 +19,16 @@ class TagsCacheTest extends PHPUnit_Framework_TestCase global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix, $TEMPLATES_DIR, $debugMode; require_once('./header.inc.php'); - $this->us =& ServiceFactory::getServiceInstance('UserService'); - $this->bs =& ServiceFactory::getServiceInstance('BookmarkService'); + $this->us =SemanticScuttle_Service_Factory::getServiceInstance('User'); + $this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); $this->bs->deleteAll(); - $this->b2ts =& ServiceFactory::getServiceInstance('Bookmark2TagService'); + $this->b2ts =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); $this->b2ts->deleteAll(); - $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService'); + $this->tts =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); $this->tts->deleteAll(); - $this->tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $this->tsts =SemanticScuttle_Service_Factory::getServiceInstance('TagStat'); $this->tsts->deleteAll(); - $this->tcs =& ServiceFactory::getServiceInstance('TagCacheService'); + $this->tcs =SemanticScuttle_Service_Factory::getServiceInstance('TagCache'); $this->tcs->deleteAll(); } diff --git a/tests/tagsTest.php b/tests/tagsTest.php index 49fec6f..d4957c9 100644 --- a/tests/tagsTest.php +++ b/tests/tagsTest.php @@ -16,16 +16,16 @@ class TagsTest extends PHPUnit_Framework_TestCase global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix; require_once('./header.inc.php'); - $this->ts =& ServiceFactory::getServiceInstance('TagService'); + $this->ts =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); $this->ts->deleteAll(); - $this->us =& ServiceFactory::getServiceInstance('UserService'); - $this->bs =& ServiceFactory::getServiceInstance('BookmarkService'); + $this->us =SemanticScuttle_Service_Factory::getServiceInstance('User'); + $this->bs =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); $this->bs->deleteAll(); - $this->b2ts =& ServiceFactory::getServiceInstance('Bookmark2TagService'); + $this->b2ts =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); $this->b2ts->deleteAll(); - $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService'); + $this->tts =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); $this->tts->deleteAll(); - $this->tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $this->tsts =SemanticScuttle_Service_Factory::getServiceInstance('TagStat'); $this->tsts->deleteAll(); } diff --git a/www/about.php b/www/about.php index 878e7e5..9644320 100644 --- a/www/about.php +++ b/www/about.php @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; $tplVars['pagetitle'] = T_('About'); $tplVars['subtitle'] = T_('About'); diff --git a/www/admin.php b/www/admin.php index b57b568..37ebe4b 100644 --- a/www/admin.php +++ b/www/admin.php @@ -1,71 +1,71 @@ -<?php
-/***************************************************************************
- Copyright (C) 2007 - 2008 SemanticScuttle project (fork from Scuttle)
- http://sourceforge.net/projects/semanticscuttle/
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- 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');
+<?php +/*************************************************************************** + Copyright (C) 2007 - 2008 SemanticScuttle project (fork from Scuttle) + http://sourceforge.net/projects/semanticscuttle/ -/* Service creation: only useful services are created */
-$bookmark2tagservice = & ServiceFactory :: getServiceInstance('Bookmark2Tagservice');
-$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService'); -$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService'); -$tagcacheservice = & ServiceFactory :: getServiceInstance('TagCacheService'); -$commondescriptionservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService'); -$searchhistoryservice = & ServiceFactory :: getServiceInstance('SearchHistoryService'); -$tagstatservice = & ServiceFactory :: getServiceInstance('TagStatService');
-
-// Header variables
-$tplVars['subtitle'] = T_('Manage users');
+ This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + You should have received a copy of the GNU General Public License + 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 '../src/SemanticScuttle/header.php'; + +/* Service creation: only useful services are created */ +$bookmark2tagservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark2Tagservice'); +$bookmarkservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark'); +$tag2tagservice = SemanticScuttle_Service_Factory :: getServiceInstance('Tag2Tag'); +$tagcacheservice = SemanticScuttle_Service_Factory :: getServiceInstance('TagCache'); +$commondescriptionservice = SemanticScuttle_Service_Factory :: getServiceInstance('CommonDescription'); +$searchhistoryservice = SemanticScuttle_Service_Factory :: getServiceInstance('SearchHistory'); +$tagstatservice = SemanticScuttle_Service_Factory :: getServiceInstance('TagStat'); + +// Header variables +$tplVars['subtitle'] = T_('Manage users'); $tplVars['loadjs'] = true; $tplVars['sidebar_blocks'] = array('users' ); $tplVars['error'] = ''; -$tplVars['msg'] = '';
-
-if ( !$userservice->isLoggedOn() ) {
- header('Location: '. createURL('login', ''));
- exit();
+$tplVars['msg'] = ''; + +if ( !$userservice->isLoggedOn() ) { + header('Location: '. createURL('login', '')); + exit(); } -
-if ( !$currentUser->isAdmin() ) {
- header('Location: '. createURL('bookmarks', $currentUser->getUsername()));
- exit();
-}
-
+ +if ( !$currentUser->isAdmin() ) { + header('Location: '. createURL('bookmarks', $currentUser->getUsername())); + exit(); +} + @list($url, $action, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL; -
+ if ( $action && (strpos($_SERVER['HTTP_REFERER'], ROOT.'admin') === 0) // Prevent CSRF attacks -) {
- switch ( $action ) {
- case 'delete':
- if ( $user && ($userinfo = $userservice->getUserByUsername($user)) ) {
- $uId = $userinfo['uId'];
+) { + switch ( $action ) { + case 'delete': + if ( $user && ($userinfo = $userservice->getUserByUsername($user)) ) { + $uId = $userinfo['uId']; $tagcacheservice->deleteByUser($uId); - $tag2tagservice->removeLinkedTagsForUser($uId);
- $userservice->deleteUser($uId);
+ $tag2tagservice->removeLinkedTagsForUser($uId); + $userservice->deleteUser($uId); $bookmark2tagservice->deleteTagsForUser($uId); $commondescriptionservice->deleteDescriptionsForUser($uId); $searchhistoryservice->deleteSearchHistoryForUser($uId); - $tagstatservice->deleteTagStatForUser($uId);
- // XXX: don't delete bookmarks before tags, else tags can't be deleted !!!
- $bookmarkservice->deleteBookmarksForUser($uId);
-
- $tplVars['msg'] = sprintf(T_('%s and all his bookmarks and tags were deleted.'), $user);
+ $tagstatservice->deleteTagStatForUser($uId); + // XXX: don't delete bookmarks before tags, else tags can't be deleted !!! + $bookmarkservice->deleteBookmarksForUser($uId); + + $tplVars['msg'] = sprintf(T_('%s and all his bookmarks and tags were deleted.'), $user); } break; case 'checkUrl' : @@ -74,21 +74,21 @@ if ( $action if(!checkUrl($bookmark['bAddress'])) { $tplVars['error'].= T_('Problem with ').$bookmark['bAddress'].' ('. $bookmark['username'] .')<br/>'; } - }
- break;
- default:
- // DO NOTHING
- }
-}
-
-$templatename = 'admin.tpl';
-$users =& $userservice->getObjectUsers();
-
-if ( !is_array($users) ) {
- $users = array();
-}
-
-$tplVars['users'] =& $users;
-
-$templateservice->loadTemplate($templatename, $tplVars);
+ } + break; + default: + // DO NOTHING + } +} + +$templatename = 'admin.tpl'; +$users =& $userservice->getObjectUsers(); + +if ( !is_array($users) ) { + $users = array(); +} + +$tplVars['users'] =& $users; + +$templateservice->loadTemplate($templatename, $tplVars); ?> diff --git a/www/ajax/getadminlinkedtags.php b/www/ajax/getadminlinkedtags.php index 75aae9a..89dd1e6 100644 --- a/www/ajax/getadminlinkedtags.php +++ b/www/ajax/getadminlinkedtags.php @@ -21,12 +21,12 @@ /* Return a json file with list of linked tags */ -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); -$bookmarkservice =& ServiceFactory::getServiceInstance('TagService'); -$tagstatservice =& ServiceFactory::getServiceInstance('TagStatService'); +$b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); +$tagstatservice =SemanticScuttle_Service_Factory::getServiceInstance('TagStat'); /* Managing all possible inputs */ isset($_GET['tag']) ? define('GET_TAG', $_GET['tag']): define('GET_TAG', ''); @@ -36,7 +36,7 @@ isset($_GET['uId']) ? define('GET_UID', $_GET['uId']): define('GET_UID', ''); function displayTag($tag, $uId) { $uId = ($uId==0)?NULL:$uId; // if user is nobody, NULL allows to look for every public tags - $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); + $tag2tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); $output = '{ id:'.rand().', name:\''.$tag.'\''; $linkedTags = $tag2tagservice->getAdminLinkedTags($tag, '>'); diff --git a/www/ajax/getadmintags.php b/www/ajax/getadmintags.php index e3d8025..8345516 100644 --- a/www/ajax/getadmintags.php +++ b/www/ajax/getadmintags.php @@ -21,11 +21,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* Return a json file with list of tags according to current user and sort by popularity*/ -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); -$bookmarkservice =& ServiceFactory::getServiceInstance('TagService'); +$b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); ?> diff --git a/www/ajax/getcontacttags.php b/www/ajax/getcontacttags.php index 9c25e1a..e508655 100644 --- a/www/ajax/getcontacttags.php +++ b/www/ajax/getcontacttags.php @@ -21,11 +21,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* Return a json file with list of tags according to current user and sort by popularity*/ -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); -$bookmarkservice =& ServiceFactory::getServiceInstance('TagService'); +$b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); ?> diff --git a/www/ajax/getlinkedtags.php b/www/ajax/getlinkedtags.php index a34805b..2a93a3d 100644 --- a/www/ajax/getlinkedtags.php +++ b/www/ajax/getlinkedtags.php @@ -21,12 +21,12 @@ /* Return a json file with list of linked tags */ -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); -$bookmarkservice =& ServiceFactory::getServiceInstance('TagService'); -$tagstatservice =& ServiceFactory::getServiceInstance('TagStatService'); +$b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); +$tagstatservice =SemanticScuttle_Service_Factory::getServiceInstance('TagStat'); /* Managing all possible inputs */ isset($_GET['tag']) ? define('GET_TAG', $_GET['tag']): define('GET_TAG', ''); @@ -36,7 +36,7 @@ isset($_GET['uId']) ? define('GET_UID', $_GET['uId']): define('GET_UID', ''); function displayTag($tag, $uId) { $uId = ($uId==0)?NULL:$uId; // if user is nobody, NULL allows to look for every public tags - $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); + $tag2tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); $output = '{ id:'.rand().', name:\''.$tag.'\''; $linkedTags = $tag2tagservice->getLinkedTags($tag, '>', $uId); diff --git a/www/ajax/gettags.php b/www/ajax/gettags.php index 7b8b33a..b6b12c7 100644 --- a/www/ajax/gettags.php +++ b/www/ajax/gettags.php @@ -21,11 +21,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* Return a json file with list of tags according to current user and sort by popularity*/ -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); -$bookmarkservice =& ServiceFactory::getServiceInstance('TagService'); +$b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag'); ?> diff --git a/www/ajaxDelete.php b/www/ajaxDelete.php index a1119ca..f605b3a 100644 --- a/www/ajaxDelete.php +++ b/www/ajaxDelete.php @@ -22,10 +22,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA header('Content-Type: text/xml; charset=UTF-8'); header('Last-Modified: '. gmdate("D, d M Y H:i:s") .' GMT'); header('Cache-Control: no-cache, must-revalidate'); -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService'); +$bookmarkservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark'); /* Managing all possible inputs */ isset($_GET['id']) ? define('GET_ID', $_GET['id']): define('GET_ID', ''); diff --git a/www/ajaxGetTitle.php b/www/ajaxGetTitle.php index fc895db..5d36b72 100644 --- a/www/ajaxGetTitle.php +++ b/www/ajaxGetTitle.php @@ -23,7 +23,7 @@ header('Content-Type: text/xml; charset=UTF-8'); header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT"); header("Cache-Control: no-cache, must-revalidate"); -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Managing all possible inputs */ isset($_GET['url']) ? define('GET_URL', $_GET['url']): define('GET_URL', ''); diff --git a/www/ajaxIsAvailable.php b/www/ajaxIsAvailable.php index ffd4379..139061c 100644 --- a/www/ajaxIsAvailable.php +++ b/www/ajaxIsAvailable.php @@ -23,7 +23,7 @@ header('Content-Type: text/xml; charset=UTF-8'); header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT"); header("Cache-Control: no-cache, must-revalidate"); -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ //No specific services diff --git a/www/alltags.php b/www/alltags.php index 95e797a..0a88288 100644 --- a/www/alltags.php +++ b/www/alltags.php @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); -$cacheservice =& ServiceFactory::getServiceInstance('CacheService'); +$b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); +$cacheservice =SemanticScuttle_Service_Factory::getServiceInstance('Cache'); diff --git a/www/api/export_csv.php b/www/api/export_csv.php index 2389642..c696001 100644 --- a/www/api/export_csv.php +++ b/www/api/export_csv.php @@ -1,47 +1,47 @@ -<?php
-// Export in CSV format in order to allow the import into a spreadsheet tool like Excel
-
+<?php +// Export in CSV format in order to allow the import into a spreadsheet tool like Excel + // Force HTTP authentication first! -require_once('httpauth.inc.php');
-require_once('../header.inc.php');
- -/* Service creation: only useful services are created */
-$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
-
-// Check to see if a tag was specified.
-if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
- $tag = trim($_REQUEST['tag']);
-else
- $tag = NULL;
-
-// Get the posts relevant to the passed-in variables.
-$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, getSortOrder());
-
+require_once('httpauth.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; + +/* Service creation: only useful services are created */ +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); + +// Check to see if a tag was specified. +if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) + $tag = trim($_REQUEST['tag']); +else + $tag = NULL; + +// Get the posts relevant to the passed-in variables. +$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, getSortOrder()); + header("Content-Type: application/csv-tab-delimited-table;charset=UTF-8"); -header("Content-disposition: filename=exportBookmarks.csv");
-
+header("Content-disposition: filename=exportBookmarks.csv"); + //columns titles echo 'url;title;tags;description'; -echo "\n";
-
-foreach($bookmarks['bookmarks'] as $row) {
- if (is_null($row['bDescription']) || (trim($row['bDescription']) == ''))
- $description = '';
- else
- $description = filter(str_replace(array("\r\n", "\n", "\r"),"", $row['bDescription']), 'xml');
-
- $taglist = '';
- if (count($row['tags']) > 0) {
- foreach($row['tags'] as $tag)
- $taglist .= convertTag($tag) .',';
- $taglist = substr($taglist, 0, -1);
- } else {
- $taglist = 'system:unfiled';
- }
-
+echo "\n"; + +foreach($bookmarks['bookmarks'] as $row) { + if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) + $description = ''; + else + $description = filter(str_replace(array("\r\n", "\n", "\r"),"", $row['bDescription']), 'xml'); + + $taglist = ''; + if (count($row['tags']) > 0) { + foreach($row['tags'] as $tag) + $taglist .= convertTag($tag) .','; + $taglist = substr($taglist, 0, -1); + } else { + $taglist = 'system:unfiled'; + } + echo '"'.filter($row['bAddress'], 'xml') .'";"'. filter($row['bTitle'], 'xml') .'";"'. filter($taglist, 'xml') .'";"'. $description .'"'; - echo "\n";
-}
-
-
-?>
+ echo "\n"; +} + + +?> diff --git a/www/api/export_gcs.php b/www/api/export_gcs.php index 6f1f4c2..1eed961 100644 --- a/www/api/export_gcs.php +++ b/www/api/export_gcs.php @@ -5,7 +5,7 @@ // Force HTTP authentication first! //require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; if($GLOBALS['enableGoogleCustomSearch'] == false) { echo "Google Custom Search disabled. You can enable it into the config.inc.php file."; @@ -13,7 +13,7 @@ if($GLOBALS['enableGoogleCustomSearch'] == false) { } /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); /* diff --git a/www/api/export_html.php b/www/api/export_html.php index 55553c2..922901a 100644 --- a/www/api/export_html.php +++ b/www/api/export_html.php @@ -1,54 +1,54 @@ -<?php
-// Implements the del.icio.us API request for all a user's posts, optionally filtered by tag.
-
-// del.icio.us behavior:
-// - doesn't include the filtered tag as an attribute on the root element (we do)
-
+<?php +// Implements the del.icio.us API request for all a user's posts, optionally filtered by tag. + +// del.icio.us behavior: +// - doesn't include the filtered tag as an attribute on the root element (we do) + // Force HTTP authentication first! -require_once('httpauth.inc.php');
-require_once('../header.inc.php');
- -/* Service creation: only useful services are created */
-$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
-
-// Check to see if a tag was specified.
-if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
- $tag = trim($_REQUEST['tag']);
-else
- $tag = NULL;
-
-// Get the posts relevant to the passed-in variables.
-$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, getSortOrder());
-
-
-// Set up the XML file and output all the posts.
+require_once('httpauth.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; + +/* Service creation: only useful services are created */ +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); + +// Check to see if a tag was specified. +if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) + $tag = trim($_REQUEST['tag']); +else + $tag = NULL; + +// Get the posts relevant to the passed-in variables. +$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, getSortOrder()); + + +// Set up the XML file and output all the posts. echo '<!DOCTYPE NETSCAPE-Bookmark-file-1>'."\r\n"; -echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">';
-echo '<!-- This is an automatically generated file. -->'."\r\n";
-echo '<TITLE>Bookmarks</TITLE>'."\r\n";
-echo '<H1 LAST_MODIFIED="'. date('U') .'">Bookmarks for '. htmlspecialchars($currentUser->getUsername()) .''. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') ." from " . $sitename ."</H1>\r\n";
-echo '<DL><p>'."\r\n";
-
-
-
-foreach($bookmarks['bookmarks'] as $row) {
- if (is_null($row['bDescription']) || (trim($row['bDescription']) == ''))
- $description = '';
- else
- $description = 'description="'. filter($row['bDescription'], 'xml') .'" ';
-
- $taglist = '';
- if (count($row['tags']) > 0) {
- foreach($row['tags'] as $tag)
- $taglist .= convertTag($tag) .',';
- $taglist = substr($taglist, 0, -1);
- } else {
- $taglist = 'system:unfiled';
- }
-
- echo "\t<dt><a href=\"". filter($row['bAddress'], 'xml') .'" '. $description .' hash="'. md5($row['bAddress']) .'" tags="'. filter($taglist, 'xml') .'" ADD_DATE="'. date('U', strtotime($row['bDatetime'])) ."\" >" . filter($row['bTitle'], 'xml') ."</a>\r\n";
-}
-
-
-echo '</DL><p>';
-?>
+echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">'; +echo '<!-- This is an automatically generated file. -->'."\r\n"; +echo '<TITLE>Bookmarks</TITLE>'."\r\n"; +echo '<H1 LAST_MODIFIED="'. date('U') .'">Bookmarks for '. htmlspecialchars($currentUser->getUsername()) .''. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') ." from " . $sitename ."</H1>\r\n"; +echo '<DL><p>'."\r\n"; + + + +foreach($bookmarks['bookmarks'] as $row) { + if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) + $description = ''; + else + $description = 'description="'. filter($row['bDescription'], 'xml') .'" '; + + $taglist = ''; + if (count($row['tags']) > 0) { + foreach($row['tags'] as $tag) + $taglist .= convertTag($tag) .','; + $taglist = substr($taglist, 0, -1); + } else { + $taglist = 'system:unfiled'; + } + + echo "\t<dt><a href=\"". filter($row['bAddress'], 'xml') .'" '. $description .' hash="'. md5($row['bAddress']) .'" tags="'. filter($taglist, 'xml') .'" ADD_DATE="'. date('U', strtotime($row['bDatetime'])) ."\" >" . filter($row['bTitle'], 'xml') ."</a>\r\n"; +} + + +echo '</DL><p>'; +?> diff --git a/www/api/export_sioc.php b/www/api/export_sioc.php index 746d0ea..90713e7 100644 --- a/www/api/export_sioc.php +++ b/www/api/export_sioc.php @@ -1,12 +1,12 @@ <?php -/* Export data with semantic format (SIOC: http://sioc-project.org/, FOAF, SKOS, Annotea Ontology) */
-
-require_once('../header.inc.php'); -header('Content-Type: text/xml; charset=utf-8'); //we change headers html defined in headers.inc.php
+/* Export data with semantic format (SIOC: http://sioc-project.org/, FOAF, SKOS, Annotea Ontology) */ -/* Service creation: only useful services are created */
-$userservice =& ServiceFactory::getServiceInstance('UserService'); -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); +require_once '../../src/SemanticScuttle/header.php'; +header('Content-Type: text/xml; charset=utf-8'); //we change headers html defined in headers.inc.php + +/* Service creation: only useful services are created */ +$userservice =SemanticScuttle_Service_Factory::getServiceInstance('User'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); ?> <?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"\n?>"; ?> diff --git a/www/api/httpauth.inc.php b/www/api/httpauth.inc.php index 5dd7444..23e3a5e 100644 --- a/www/api/httpauth.inc.php +++ b/www/api/httpauth.inc.php @@ -1,5 +1,5 @@ <?php -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; // Provides HTTP Basic authentication of a user, and sets two variables, sId and username, // with the user's info. diff --git a/www/api/opensearch.php b/www/api/opensearch.php index a6f79f8..4226957 100644 --- a/www/api/opensearch.php +++ b/www/api/opensearch.php @@ -1,18 +1,18 @@ <?php -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; header("Content-type: text/xml"); ?> -<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
- xmlns:moz="http://www.mozilla.org/2006/browser/search/">
- <ShortName><?php echo $GLOBALS['sitename']?></ShortName>
- <LongName></LongName>
- <Description><?php echo $GLOBALS['welcomeMessage']?></Description>
- <InputEncoding>UTF-8</InputEncoding>
- <Contact><?php echo $GLOBALS['adminemail']?></Contact>
- <Developer>Jan Seifert "jan.seifert@uid.com"</Developer>
- <Tags>semanticscuttle bookmark web</Tags>
- <Image width="16" height="16">data:image/gif;base64,R0lGODlhEAAQAMZ9ANaPE9mREteTHtSXLdmXIdiXJtaYKdiYJ9iYKNeaLtKdP9CdRd2dLNWfQuWiFMqjX9+hNMykXt6jPOCkPM2oaM+paeCpQuGoR+OqOeKpR+GqS9+uWeSwU+ayS+uzOeWxVeWxWOSyWOu0POazXOS0YOm8Zee8cOy+WOm9a/jBLum+bPbCNurAbe7BYuvBc/LDV/LEV+zEdv/KKf/KLP/KLf/LLuzHe//MNP/NN/nMTv/OOf/OPP/OP/jNW//PPvnOVv/QQv7QRv/QRP/RR/HOhP/SSf/STPnRav/TT//TUPfScf/UUvzUXP/UVP/VV/bTfv/WWf/WW//WXP7XYf/XX//XYP/YZPPVmf/ZZv/ZZ/vYeP/aaf/aa//abP/abf/abvvaef/bb//bcfzbfP/ccv/cc//cdP/cdf/dd//deP/def3egP/ee//efP/efv/ffv/ggf/gg//ghP/ghfrfmv/hif/ii//ijP/jkfzjm//kkv7klv/lmP///////////yH5BAEKAH8ALAAAAAAQABAAAAergH+Cg38hhIeHIFcmiIgDLnt0Go2EE1pyd0QbjQMQDC9bZGprKBcjA4IfAQMrQUhOVFlhaGNPMRl/Aw4yMzc7QkZNUlZdZmASqAJKcW1WPDpARUtQUx0RgyR5fHpzUTU4PkMiqIMVNnh2c25lSTQpAIgqdXJvaWReXz0JiCxwbWhiuGCp8uMAohJszhw5AYMJlBwFEHFoYQHBAwUEMHgwgKjBA0QLKFAaKSgQADs=</Image>
- <Url type="text/html" template="<?php echo $GLOBALS['root']?>search.php/all/{searchTerms}"/>
- <moz:SearchForm><?php echo $GLOBALS['root']?></moz:SearchForm>
+<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" + xmlns:moz="http://www.mozilla.org/2006/browser/search/"> + <ShortName><?php echo $GLOBALS['sitename']?></ShortName> + <LongName></LongName> + <Description><?php echo $GLOBALS['welcomeMessage']?></Description> + <InputEncoding>UTF-8</InputEncoding> + <Contact><?php echo $GLOBALS['adminemail']?></Contact> + <Developer>Jan Seifert "jan.seifert@uid.com"</Developer> + <Tags>semanticscuttle bookmark web</Tags> + <Image width="16" height="16">data:image/gif;base64,R0lGODlhEAAQAMZ9ANaPE9mREteTHtSXLdmXIdiXJtaYKdiYJ9iYKNeaLtKdP9CdRd2dLNWfQuWiFMqjX9+hNMykXt6jPOCkPM2oaM+paeCpQuGoR+OqOeKpR+GqS9+uWeSwU+ayS+uzOeWxVeWxWOSyWOu0POazXOS0YOm8Zee8cOy+WOm9a/jBLum+bPbCNurAbe7BYuvBc/LDV/LEV+zEdv/KKf/KLP/KLf/LLuzHe//MNP/NN/nMTv/OOf/OPP/OP/jNW//PPvnOVv/QQv7QRv/QRP/RR/HOhP/SSf/STPnRav/TT//TUPfScf/UUvzUXP/UVP/VV/bTfv/WWf/WW//WXP7XYf/XX//XYP/YZPPVmf/ZZv/ZZ/vYeP/aaf/aa//abP/abf/abvvaef/bb//bcfzbfP/ccv/cc//cdP/cdf/dd//deP/def3egP/ee//efP/efv/ffv/ggf/gg//ghP/ghfrfmv/hif/ii//ijP/jkfzjm//kkv7klv/lmP///////////yH5BAEKAH8ALAAAAAAQABAAAAergH+Cg38hhIeHIFcmiIgDLnt0Go2EE1pyd0QbjQMQDC9bZGprKBcjA4IfAQMrQUhOVFlhaGNPMRl/Aw4yMzc7QkZNUlZdZmASqAJKcW1WPDpARUtQUx0RgyR5fHpzUTU4PkMiqIMVNnh2c25lSTQpAIgqdXJvaWReXz0JiCxwbWhiuGCp8uMAohJszhw5AYMJlBwFEHFoYQHBAwUEMHgwgKjBA0QLKFAaKSgQADs=</Image> + <Url type="text/html" template="<?php echo $GLOBALS['root']?>search.php/all/{searchTerms}"/> + <moz:SearchForm><?php echo $GLOBALS['root']?></moz:SearchForm> </OpenSearchDescription> diff --git a/www/api/posts_add.php b/www/api/posts_add.php index ba3e02c..f396b5e 100644 --- a/www/api/posts_add.php +++ b/www/api/posts_add.php @@ -11,10 +11,10 @@ // Force HTTP authentication require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); // Get all the bookmark's passed-in information if (isset($_REQUEST['url']) && (trim($_REQUEST['url']) != '')) diff --git a/www/api/posts_all.php b/www/api/posts_all.php index 4ecbd7e..4c280c7 100644 --- a/www/api/posts_all.php +++ b/www/api/posts_all.php @@ -6,10 +6,10 @@ // Force HTTP authentication first! require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); // Check to see if a tag was specified. diff --git a/www/api/posts_dates.php b/www/api/posts_dates.php index d4962ff..5f002d1 100644 --- a/www/api/posts_dates.php +++ b/www/api/posts_dates.php @@ -4,10 +4,10 @@ // Force HTTP authentication first! require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); // Check to see if a tag was specified. diff --git a/www/api/posts_delete.php b/www/api/posts_delete.php index d24ba59..7ad332f 100644 --- a/www/api/posts_delete.php +++ b/www/api/posts_delete.php @@ -8,10 +8,10 @@ // Force HTTP authentication first! require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); // Note that del.icio.us only errors out if no URL was passed in; there's no error on attempting diff --git a/www/api/posts_get.php b/www/api/posts_get.php index 34d192e..a6a6102 100644 --- a/www/api/posts_get.php +++ b/www/api/posts_get.php @@ -11,10 +11,10 @@ // Force HTTP authentication first! require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); // Check to see if a tag was specified. diff --git a/www/api/posts_public.php b/www/api/posts_public.php index f7aa955..2ade45e 100644 --- a/www/api/posts_public.php +++ b/www/api/posts_public.php @@ -6,10 +6,10 @@ // Force HTTP authentication first! //require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); // Check to see if a tag was specified. diff --git a/www/api/posts_recent.php b/www/api/posts_recent.php index daa9d39..e8bc644 100644 --- a/www/api/posts_recent.php +++ b/www/api/posts_recent.php @@ -8,10 +8,10 @@ $countMax = 100; // Force HTTP authentication first! require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); // Check to see if a tag was specified. diff --git a/www/api/posts_update.php b/www/api/posts_update.php index 6ea50e2..18e5676 100644 --- a/www/api/posts_update.php +++ b/www/api/posts_update.php @@ -6,10 +6,10 @@ // Force HTTP authentication first! require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); // Get the posts relevant to the passed-in variables. diff --git a/www/api/tags_get.php b/www/api/tags_get.php index cee36ee..043b629 100644 --- a/www/api/tags_get.php +++ b/www/api/tags_get.php @@ -6,10 +6,10 @@ // Force HTTP authentication first! require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); +$b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); // Get the tags relevant to the passed-in variables. diff --git a/www/api/tags_rename.php b/www/api/tags_rename.php index dd16339..bf78b39 100644 --- a/www/api/tags_rename.php +++ b/www/api/tags_rename.php @@ -6,10 +6,10 @@ // Force HTTP authentication first! require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); +$b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); // Get the tag info. if (isset($_REQUEST['old']) && (trim($_REQUEST['old']) != '')) diff --git a/www/bookmarkcommondescriptionedit.php b/www/bookmarkcommondescriptionedit.php index ac1890e..8a46313 100644 --- a/www/bookmarkcommondescriptionedit.php +++ b/www/bookmarkcommondescriptionedit.php @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService'); -$cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService'); +$bookmarkservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark'); +$cdservice = SemanticScuttle_Service_Factory :: getServiceInstance('CommonDescription'); /* Managing all possible inputs */ isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', ''); diff --git a/www/bookmarks.php b/www/bookmarks.php index 91d0999..32bdba0 100644 --- a/www/bookmarks.php +++ b/www/bookmarks.php @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$cacheservice =& ServiceFactory::getServiceInstance('CacheService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); +$cacheservice =SemanticScuttle_Service_Factory::getServiceInstance('Cache'); /* Managing all possible inputs */ isset($_GET['action']) ? define('GET_ACTION', $_GET['action']): define('GET_ACTION', ''); diff --git a/www/edit.php b/www/edit.php index 005493d..6f30d3c 100644 --- a/www/edit.php +++ b/www/edit.php @@ -20,10 +20,10 @@ 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 '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService'); +$bookmarkservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark'); /* Managing all possible inputs */ isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', ''); diff --git a/www/gsearch/context.php b/www/gsearch/context.php index e4599ad..80c02cb 100644 --- a/www/gsearch/context.php +++ b/www/gsearch/context.php @@ -1,5 +1,5 @@ <?php -require_once('../header.inc.php'); +require_once '../../src/SemanticScuttle/header.php'; if($GLOBALS['enableGoogleCustomSearch'] == false) { echo "Google Custom Search disabled. You can enable it into the config.inc.php file."; diff --git a/www/gsearch/index.php b/www/gsearch/index.php index 47839f4..aabc56a 100644 --- a/www/gsearch/index.php +++ b/www/gsearch/index.php @@ -1,4 +1,4 @@ -<?php require_once('../header.inc.php'); +<?php require_once '../../src/SemanticScuttle/header.php'; if($GLOBALS['enableGoogleCustomSearch']==false) { echo "Google Custom Search disabled. You can enable it into the config.inc.php file."; diff --git a/www/history.php b/www/history.php index b676515..a7c2024 100644 --- a/www/history.php +++ b/www/history.php @@ -19,11 +19,11 @@ 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 '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$cacheservice =& ServiceFactory::getServiceInstance('CacheService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); +$cacheservice =SemanticScuttle_Service_Factory::getServiceInstance('Cache'); /* Managing all possible inputs */ isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0); diff --git a/www/import.php b/www/import.php index d9ea009..8f6e386 100644 --- a/www/import.php +++ b/www/import.php @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ // No specific services @@ -67,7 +67,7 @@ if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['si function startElement($parser, $name, $attrs) { global $depth, $status, $tplVars, $userservice; - $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); + $bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); if ($name == 'POST') { while(list($attrTitle, $attrVal) = each($attrs)) { diff --git a/www/importNetscape.php b/www/importNetscape.php index 4580429..ad5b414 100644 --- a/www/importNetscape.php +++ b/www/importNetscape.php @@ -19,10 +19,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); /* Managing all possible inputs */ diff --git a/www/importStructure.php b/www/importStructure.php index 89780f5..c5f5fa0 100644 --- a/www/importStructure.php +++ b/www/importStructure.php @@ -19,10 +19,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); +$tag2tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag2Tag'); /* Managing current logged user */ $currentUser = $userservice->getCurrentObjectUser(); diff --git a/www/index.php b/www/index.php index df55b05..28bf678 100644 --- a/www/index.php +++ b/www/index.php @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$cacheservice =& ServiceFactory::getServiceInstance('CacheService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); +$cacheservice =SemanticScuttle_Service_Factory::getServiceInstance('Cache'); /* Managing all possible inputs */ isset($_GET['action']) ? define('GET_ACTION', $_GET['action']): define('GET_ACTION', ''); diff --git a/www/jsScuttle.php b/www/jsScuttle.php index 0e8b96a..474d45f 100644 --- a/www/jsScuttle.php +++ b/www/jsScuttle.php @@ -1,6 +1,6 @@ <?php header('Content-Type: text/javascript'); -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; require_once('functions.inc.php'); $player_root = ROOT .'includes/player/'; ?> diff --git a/www/login.php b/www/login.php index 0fa820c..18d055f 100644 --- a/www/login.php +++ b/www/login.php @@ -19,7 +19,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 '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ diff --git a/www/password.php b/www/password.php index ba7be8d..3a822c4 100644 --- a/www/password.php +++ b/www/password.php @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ // No specific services diff --git a/www/populartags.php b/www/populartags.php index 6429bf7..2f501da 100644 --- a/www/populartags.php +++ b/www/populartags.php @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService'); -$cacheservice =& ServiceFactory::getServiceInstance('CacheService'); +$b2tservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark2Tag'); +$cacheservice =SemanticScuttle_Service_Factory::getServiceInstance('Cache'); @list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL; diff --git a/www/profile.php b/www/profile.php index 2d00101..0c2776e 100644 --- a/www/profile.php +++ b/www/profile.php @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ // No specific services diff --git a/www/register.php b/www/register.php index 3b64873..6a0e1be 100644 --- a/www/register.php +++ b/www/register.php @@ -19,7 +19,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 '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ // No specific services diff --git a/www/rss.php b/www/rss.php index 3a2b54a..672f4cd 100644 --- a/www/rss.php +++ b/www/rss.php @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$cacheservice =& ServiceFactory::getServiceInstance('CacheService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); +$cacheservice =SemanticScuttle_Service_Factory::getServiceInstance('Cache'); header('Content-Type: application/xml'); diff --git a/www/search.php b/www/search.php index ce47236..4a15053 100644 --- a/www/search.php +++ b/www/search.php @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Managing all possible inputs */ isset($_POST['terms']) ? define('POST_TERMS', $_POST['terms']): define('POST_TERMS', ''); @@ -36,8 +36,8 @@ if (POST_TERMS != '') { // GET } else { /* Service creation: only useful services are created */ - $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); - $searchhistoryservice =& ServiceFactory::getServiceInstance('SearchHistoryService'); + $bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); + $searchhistoryservice =SemanticScuttle_Service_Factory::getServiceInstance('SearchHistory'); /* Managing current logged user */ $currentUserId = $userservice->getCurrentUserId(); diff --git a/www/tag2tagadd.php b/www/tag2tagadd.php index 15ee6af..cc1ecb4 100644 --- a/www/tag2tagadd.php +++ b/www/tag2tagadd.php @@ -19,10 +19,10 @@ 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 '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService'); +$tag2tagservice = SemanticScuttle_Service_Factory :: getServiceInstance('Tag2Tag'); /* Managing all possible inputs */ isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', ''); diff --git a/www/tag2tagdelete.php b/www/tag2tagdelete.php index 78016e7..dd71a87 100644 --- a/www/tag2tagdelete.php +++ b/www/tag2tagdelete.php @@ -19,10 +19,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService'); +$tag2tagservice = SemanticScuttle_Service_Factory :: getServiceInstance('Tag2Tag'); /* Managing all possible inputs */ isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', ''); diff --git a/www/tag2tagedit.php b/www/tag2tagedit.php index c707253..750e550 100644 --- a/www/tag2tagedit.php +++ b/www/tag2tagedit.php @@ -19,10 +19,10 @@ 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 '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService'); +$tag2tagservice = SemanticScuttle_Service_Factory :: getServiceInstance('Tag2Tag'); /* Managing all possible inputs */ diff --git a/www/tagcommondescriptionedit.php b/www/tagcommondescriptionedit.php index aba7c43..84ca5e3 100644 --- a/www/tagcommondescriptionedit.php +++ b/www/tagcommondescriptionedit.php @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); -$cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService'); +$b2tservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark2Tag'); +$cdservice = SemanticScuttle_Service_Factory :: getServiceInstance('CommonDescription'); /* Managing all possible inputs */ isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', ''); diff --git a/www/tagdelete.php b/www/tagdelete.php index 61d2546..9ba18fd 100644 --- a/www/tagdelete.php +++ b/www/tagdelete.php @@ -19,10 +19,10 @@ 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 '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); +$b2tservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark2Tag'); /* Managing all possible inputs */ diff --git a/www/tagedit.php b/www/tagedit.php index e7b46a1..5a3fbb4 100644 --- a/www/tagedit.php +++ b/www/tagedit.php @@ -19,10 +19,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$tagservice = & ServiceFactory :: getServiceInstance('TagService'); +$tagservice = SemanticScuttle_Service_Factory :: getServiceInstance('Tag'); /* Managing all possible inputs */ isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', ''); diff --git a/www/tagrename.php b/www/tagrename.php index bead5e7..735e2e8 100644 --- a/www/tagrename.php +++ b/www/tagrename.php @@ -19,12 +19,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); -$tagservice = & ServiceFactory :: getServiceInstance('TagService'); -$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2tagService'); +$b2tservice = SemanticScuttle_Service_Factory :: getServiceInstance('Bookmark2Tag'); +$tagservice = SemanticScuttle_Service_Factory :: getServiceInstance('Tag'); +$tag2tagservice = SemanticScuttle_Service_Factory :: getServiceInstance('Tag2Tag'); /* Managing all possible inputs */ isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', ''); diff --git a/www/tags.php b/www/tags.php index 376d9fe..52bf289 100644 --- a/www/tags.php +++ b/www/tags.php @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$cacheservice =& ServiceFactory::getServiceInstance('CacheService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); +$cacheservice =SemanticScuttle_Service_Factory::getServiceInstance('Cache'); /* Managing all possible inputs */ isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0); diff --git a/www/upgrade.php b/www/upgrade.php index a2fb606..39b82db 100644 --- a/www/upgrade.php +++ b/www/upgrade.php @@ -34,8 +34,8 @@ exit(); ///////////////// // This part below will be executed once you comment the two lines above ///////////////// -require_once('header.inc.php'); -$tagstatservice = & ServiceFactory :: getServiceInstance('TagStatService'); +require_once '../src/SemanticScuttle/header.php'; +$tagstatservice = SemanticScuttle_Service_Factory :: getServiceInstance('TagStat'); ?> <h1>Upgrade</h1> diff --git a/www/users.php b/www/users.php index e2689e6..111e512 100644 --- a/www/users.php +++ b/www/users.php @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$cacheservice =& ServiceFactory::getServiceInstance('CacheService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); +$cacheservice =SemanticScuttle_Service_Factory::getServiceInstance('Cache'); /* Managing current logged user */ $currentUser = $userservice->getCurrentObjectUser(); diff --git a/www/watch.php b/www/watch.php index 01a6bcc..64dd316 100644 --- a/www/watch.php +++ b/www/watch.php @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -require_once('header.inc.php'); +require_once '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ //No specific services diff --git a/www/watchlist.php b/www/watchlist.php index 8780395..289a478 100644 --- a/www/watchlist.php +++ b/www/watchlist.php @@ -18,11 +18,11 @@ You should have received a copy of the GNU General Public License 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 '../src/SemanticScuttle/header.php'; /* Service creation: only useful services are created */ -$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$cacheservice =& ServiceFactory::getServiceInstance('CacheService'); +$bookmarkservice =SemanticScuttle_Service_Factory::getServiceInstance('Bookmark'); +$cacheservice =SemanticScuttle_Service_Factory::getServiceInstance('Cache'); /* Managing all possible inputs */ isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0); |