From 48e00e8e18f9a80bb366921eab9b2cf7047e5954 Mon Sep 17 00:00:00 2001 From: cweiske Date: Fri, 20 Nov 2009 07:32:51 +0000 Subject: [PATCH] remove superfluous returns after die messages git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@562 b3834d28-1941-0410-a4f8-b48e95affb8f --- src/SemanticScuttle/Service/Bookmark.php | 25 +++++++++++------------- src/SemanticScuttle/Service/Vote.php | 4 ---- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php index 5842390..1975b22 100644 --- a/src/SemanticScuttle/Service/Bookmark.php +++ b/src/SemanticScuttle/Service/Bookmark.php @@ -66,7 +66,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService if (!($dbresult = & $this->db->sql_query_limit($query, 1, 0))) { message_die(GENERAL_ERROR, 'Could not get bookmark', '', __LINE__, __FILE__, $query, $this->db); - return false; } if ($row =& $this->db->sql_fetchrow($dbresult)) { @@ -353,7 +352,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService 'Could not insert bookmark', '', __LINE__, __FILE__, $sql, $this->db ); - return false; } // Get the resultant row ID for the bookmark. @@ -365,7 +363,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService 'Could not insert bookmark', '', __LINE__, __FILE__, $sql, $this->db ); - return false; } $uriparts = explode('.', $address); @@ -383,7 +380,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService 'Could not insert bookmark', '', __LINE__, __FILE__, $sql, $this->db ); - return false; } $this->db->sql_transaction('commit'); @@ -456,7 +452,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService if (!($dbresult = & $this->db->sql_query($sql))) { $this->db->sql_transaction('rollback'); message_die(GENERAL_ERROR, 'Could not update bookmark', '', __LINE__, __FILE__, $sql, $this->db); - return false; } $uriparts = explode('.', $address); @@ -467,7 +462,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService 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); - return false; } $this->db->sql_transaction('commit'); @@ -700,7 +694,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService if (!($dbresult = & $this->db->sql_query_limit($query, intval($perpage), intval($start)))) { message_die(GENERAL_ERROR, 'Could not get bookmarks', '', __LINE__, __FILE__, $query, $this->db); - return false; } if (SQL_LAYER == 'mysql4') { @@ -715,7 +708,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService if (!($totalresult = & $this->db->sql_query($totalquery)) || (!($row = & $this->db->sql_fetchrow($totalresult)))) { message_die(GENERAL_ERROR, 'Could not get total bookmarks', '', __LINE__, __FILE__, $totalquery, $this->db); - return false; } $total = $row['total']; @@ -755,7 +747,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService GENERAL_ERROR, 'Could not delete bookmark', '', __LINE__, __FILE__, $query, $this->db ); - return false; } $query = 'DELETE FROM ' . $GLOBALS['tableprefix'] . 'bookmarks2tags' @@ -767,7 +758,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService GENERAL_ERROR, 'Could not delete tags for bookmark', '', __LINE__, __FILE__, $query, $this->db ); - return false; } $query = 'DELETE FROM '. $GLOBALS['tableprefix'] .'votes' @@ -779,7 +769,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService GENERAL_ERROR, 'Could not delete votes for bookmark', '', __LINE__, __FILE__, $query, $this->db ); - return false; } $this->db->sql_transaction('commit'); @@ -795,7 +784,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService if (!($dbresult = & $this->db->sql_query($query))) { message_die(GENERAL_ERROR, 'Could not delete bookmarks', '', __LINE__, __FILE__, $query, $this->db); - return false; } return true; @@ -837,9 +825,18 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService - function normalize($address) + /** + * Normalizes a given address. + * Prepends http:// if there is no protocol specified, + * and removes the trailing slash + * + * @param string $address URL to check + * + * @return string Fixed URL + */ + public function normalize($address) { - // If bookmark address doesn't contain ":", add "http://" to the start as a default protocol + //you know, there is "callto:" and "mailto:" if (strpos($address, ':') === false) { $address = 'http://'. $address; } diff --git a/src/SemanticScuttle/Service/Vote.php b/src/SemanticScuttle/Service/Vote.php index 53bebdc..85380e7 100644 --- a/src/SemanticScuttle/Service/Vote.php +++ b/src/SemanticScuttle/Service/Vote.php @@ -89,7 +89,6 @@ class SemanticScuttle_Service_Vote extends SemanticScuttle_DbService '', __LINE__, __FILE__, $query, $this->db ); //FIXME: throw exception - return false; } $row = $this->db->sql_fetchrow($dbres); @@ -126,7 +125,6 @@ class SemanticScuttle_Service_Vote extends SemanticScuttle_DbService '', __LINE__, __FILE__, $query, $this->db ); //FIXME: throw exception - return false; } $row = $this->db->sql_fetchrow($dbres); @@ -160,7 +158,6 @@ class SemanticScuttle_Service_Vote extends SemanticScuttle_DbService '', __LINE__, __FILE__, $query, $this->db ); //FIXME: throw exception - return null; } $row = $this->db->sql_fetchrow($dbres); @@ -193,7 +190,6 @@ class SemanticScuttle_Service_Vote extends SemanticScuttle_DbService '', __LINE__, __FILE__, $query, $this->db ); //FIXME: throw exception - return false; } $row = $this->db->sql_fetchrow($dbres);