From: Marcus Campbell Date: Tue, 21 Dec 2010 08:47:47 +0000 (-0800) Subject: - Enforce minimum elapsed time on registration form X-Git-Url: https://projects.mako.cc/source/scuttle/commitdiff_plain/6b106efb4f8497f1bd9dc334683751508caa176e?ds=inline - Enforce minimum elapsed time on registration form - Removed redirection after save - Show most recent page of results on index, rather than most recent day - Minor code style updates - Shameless self-aggrandising Signed-off-by: Marcus Campbell --- diff --git a/about.php b/about.php index c089cb9..d5b3572 100644 --- a/about.php +++ b/about.php @@ -1,7 +1,7 @@ bookmarkExists($url, $userservice->getCurrentUserId())) - $added = false; + $added = FALSE; else - $added = $bookmarkservice->addBookmark($url, $description, $extended, $status, $tags, $dt, true); + $added = $bookmarkservice->addBookmark($url, $description, $extended, $status, $tags, $dt, TRUE); } // Set up the XML file and output the result. header('Content-Type: text/xml'); echo '\r\n"; echo ''; -?> \ No newline at end of file diff --git a/api/posts_all.php b/api/posts_all.php index 03026c4..4f05d39 100644 --- a/api/posts_all.php +++ b/api/posts_all.php @@ -5,11 +5,11 @@ // - 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'); +require_once 'httpauth.inc.php'; +require_once '../header.inc.php'; $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); +$userservice =& ServiceFactory::getServiceInstance('UserService'); // Check to see if a tag was specified. if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) @@ -47,4 +47,3 @@ foreach($bookmarks['bookmarks'] as $row) { } echo ''; -?> \ No newline at end of file diff --git a/api/posts_dates.php b/api/posts_dates.php index 7098756..672a312 100644 --- a/api/posts_dates.php +++ b/api/posts_dates.php @@ -3,11 +3,11 @@ // by tag). // Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once 'httpauth.inc.php'; +require_once '../header.inc.php'; $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); +$userservice =& ServiceFactory::getServiceInstance('UserService'); // Check to see if a tag was specified. if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) @@ -26,17 +26,18 @@ header('Content-Type: text/xml'); echo '\r\n"; echo '\r\n"; +$count = 0; $lastdate = NULL; -foreach($bookmarks['bookmarks'] as $row) { +foreach ($bookmarks['bookmarks'] as $row) { $thisdate = gmdate('Y-m-d', strtotime($row['bDatetime'])); if ($thisdate != $lastdate && $lastdate != NULL) { echo "\t\r\n"; $count = 1; - } else { - $count = $count + 1; + } + else { + $count++; } $lastdate = $thisdate; } echo ""; -?> \ No newline at end of file diff --git a/api/posts_delete.php b/api/posts_delete.php index 737a4fb..9bf0ce3 100644 --- a/api/posts_delete.php +++ b/api/posts_delete.php @@ -7,27 +7,27 @@ // - doesn't set the Content-Type to text/xml (we do). // Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once 'httpauth.inc.php'; +require_once '../header.inc.php'; $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); +$userservice =& ServiceFactory::getServiceInstance('UserService'); // Note that del.icio.us only errors out if no URL was passed in; there's no error on attempting // to delete a bookmark you don't have. // Error out if there's no address if (is_null($_REQUEST['url'])) { - $deleted = false; -} else { + $deleted = FALSE; +} +else { $bookmark = $bookmarkservice->getBookmarkByAddress($_REQUEST['url']); $bid = $bookmark['bId']; $delete = $bookmarkservice->deleteBookmark($bid); - $deleted = true; + $deleted = TRUE; } // Set up the XML file and output the result. header('Content-Type: text/xml'); echo '\r\n"; echo ''; -?> \ No newline at end of file diff --git a/api/posts_get.php b/api/posts_get.php index 8be067b..d54f86a 100644 --- a/api/posts_get.php +++ b/api/posts_get.php @@ -10,11 +10,11 @@ // - Uses today, instead of the last bookmarked date, if no date is specified // Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once 'httpauth.inc.php'; +require_once '../header.inc.php'; $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); +$userservice =& ServiceFactory::getServiceInstance('UserService'); // Check to see if a tag was specified. if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) @@ -40,7 +40,7 @@ header('Content-Type: text/xml'); echo '\r\n"; echo '\r\n"; -foreach($bookmarks['bookmarks'] as $row) { +foreach ($bookmarks['bookmarks'] as $row) { if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) $description = ''; else @@ -59,4 +59,3 @@ foreach($bookmarks['bookmarks'] as $row) { } echo ''; -?> \ No newline at end of file diff --git a/api/posts_recent.php b/api/posts_recent.php index 22fc2bd..476eecb 100644 --- a/api/posts_recent.php +++ b/api/posts_recent.php @@ -4,14 +4,14 @@ // Set default and max number of posts $countDefault = 15; -$countMax = 100; +$countMax = 100; // Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once 'httpauth.inc.php'; +require_once '../header.inc.php'; $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); +$userservice =& ServiceFactory::getServiceInstance('UserService'); // Check to see if a tag was specified. if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != '')) @@ -41,7 +41,7 @@ header('Content-Type: text/xml'); echo '\r\n"; echo '\r\n"; -foreach($bookmarks['bookmarks'] as $row) { +foreach ($bookmarks['bookmarks'] as $row) { if (is_null($row['bDescription']) || (trim($row['bDescription']) == '')) $description = ''; else @@ -60,4 +60,3 @@ foreach($bookmarks['bookmarks'] as $row) { } echo ''; -?> \ No newline at end of file diff --git a/api/posts_update.php b/api/posts_update.php index de379d2..9e37e1f 100644 --- a/api/posts_update.php +++ b/api/posts_update.php @@ -5,22 +5,18 @@ // - doesn't set the Content-Type to text/xml (we do). // Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once 'httpauth.inc.php'; +require_once '../header.inc.php'; $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); -$userservice =& ServiceFactory::getServiceInstance('UserService'); +$userservice =& ServiceFactory::getServiceInstance('UserService'); // Get the posts relevant to the passed-in variables. $bookmarks =& $bookmarkservice->getBookmarks(0, 1, $userservice->getCurrentUserId()); -$currentuser = $userservice->getCurrentUser(); -$currentusername = $currentuser[$userservice->getFieldName('username')]; - // Set up the XML file and output all the tags. header('Content-Type: text/xml'); echo '\r\n"; -foreach($bookmarks['bookmarks'] as $row) { +foreach ($bookmarks['bookmarks'] as $row) { echo ''; } -?> \ No newline at end of file diff --git a/api/tags_get.php b/api/tags_get.php index 2584566..e731873 100644 --- a/api/tags_get.php +++ b/api/tags_get.php @@ -5,10 +5,10 @@ // - tags can't have spaces // Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once 'httpauth.inc.php'; +require_once '../header.inc.php'; -$tagservice =& ServiceFactory::getServiceInstance('TagService'); +$tagservice =& ServiceFactory::getServiceInstance('TagService'); $userservice =& ServiceFactory::getServiceInstance('UserService'); // Get the tags relevant to the passed-in variables. @@ -18,8 +18,7 @@ $tags =& $tagservice->getTags($userservice->getCurrentUserId()); header('Content-Type: text/xml'); echo '\r\n"; echo "\r\n"; -foreach($tags as $row) { - echo "\t\r\n"; +foreach ($tags as $row) { + echo "\t\r\n"; } echo ""; -?> \ No newline at end of file diff --git a/api/tags_rename.php b/api/tags_rename.php index 20831e7..191b362 100644 --- a/api/tags_rename.php +++ b/api/tags_rename.php @@ -5,33 +5,33 @@ // - oddly, returns an entirely different result () than the other API calls. // Force HTTP authentication first! -require_once('httpauth.inc.php'); -require_once('../header.inc.php'); +require_once 'httpauth.inc.php'; +require_once '../header.inc.php'; -$tagservice =& ServiceFactory::getServiceInstance('TagService'); +$tagservice =& ServiceFactory::getServiceInstance('TagService'); $userservice =& ServiceFactory::getServiceInstance('UserService'); // Get the tag info. if (isset($_REQUEST['old']) && (trim($_REQUEST['old']) != '')) - $old = trim($_REQUEST['old']); + $old = trim($_REQUEST['old']); else - $old = NULL; + $old = NULL; if (isset($_REQUEST['new']) && (trim($_REQUEST['new']) != '')) - $new = trim($_REQUEST['new']); + $new = trim($_REQUEST['new']); else - $new = NULL; + $new = NULL; if (is_null($old) || is_null($new)) { - $renamed = false; -} else { - // Rename the tag. - $result = $tagservice->renameTag($userservice->getCurrentUserId(), $old, $new, true); - $renamed = $result; + $renamed = FALSE; +} +else { + // Rename the tag. + $result = $tagservice->renameTag($userservice->getCurrentUserId(), $old, $new, TRUE); + $renamed = $result; } // Set up the XML file and output the result. header('Content-Type: text/xml'); echo '\r\n"; echo ''. ($renamed ? 'done' : 'something went wrong') .''; -?> diff --git a/bookmarks.php b/bookmarks.php index 7dd1f40..d264531 100644 --- a/bookmarks.php +++ b/bookmarks.php @@ -1,7 +1,6 @@ bookmarkExists($address, $currentUserID)) { $bookmark =& $bookmarkservice->getBookmarkByAddress($address); header('Location: '. createURL('edit', $bookmark['bId'])); exit(); + // If it's new, save it } else { $title = trim($_POST['title']); @@ -113,11 +114,6 @@ if ($loggedon && isset($_POST['submitted'])) { $tplVars['msg'] = ''; } else { $tplVars['msg'] = T_('Bookmark saved'); - // Redirection option - if ($GLOBALS['useredir']) { - $address = $GLOBALS['url_redir'] . $address; - } - header('Location: '. $address); } } else { $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.'); @@ -225,4 +221,3 @@ if ($usecache && $endcache) { // Cache output if existing copy has expired $cacheservice->End($hash); } -?> diff --git a/config.inc.php.example b/config.inc.php.example index a355bfa..a8c32c9 100644 --- a/config.inc.php.example +++ b/config.inc.php.example @@ -2,7 +2,7 @@ ###################################################################### # SCUTTLE: Online social bookmarks manager ###################################################################### -# Copyright (c) 2005 - 2010 Scuttle project +# Copyright (c) 2005 - 2010 Marcus Campbell # http://scuttle.org/ # # This module is to configure the main options for your site @@ -92,8 +92,6 @@ $adminemail = 'admin@example.org'; # filetypes : An array of bookmark extensions that Scuttle should # add system tags for. # reservedusers : An array of usernames that cannot be registered -# url_blacklist : Array of regex patterns. User is banned and existing -# bookmarks are hidden if a match is found. # email_whitelist : Array of regex patterns. Used to whitelist addresses that # may otherwise match the blacklist. # email_blacklist : Array of regex patterns. Registration is blocked if a @@ -104,7 +102,7 @@ $top_include = 'top.inc.php'; $bottom_include = 'bottom.inc.php'; $shortdate = 'd-m-Y'; $longdate = 'j F Y'; -$nofollow = true; +$nofollow = TRUE; $defaultPerPage = 10; $defaultRecentDays = 14; $defaultOrderBy = 'date_desc'; @@ -113,12 +111,12 @@ $root = NULL; $cookieprefix = 'SCUTTLE'; $tableprefix = 'sc_'; $adminemail = 'admin@example.org'; -$cleanurls = false; +$cleanurls = FALSE; -$usecache = false; +$usecache = FALSE; $dir_cache = dirname(__FILE__) .'/cache/'; -$useredir = false; +$useredir = FALSE; $url_redir = 'http://www.google.com/url?sa=D&q='; $filetypes = array( diff --git a/debug.inc.php b/debug.inc.php index 8bd7f33..346140a 100644 --- a/debug.inc.php +++ b/debug.inc.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/edit.php b/edit.php index cca8e47..bae38e4 100644 --- a/edit.php +++ b/edit.php @@ -1,7 +1,6 @@ logout($path); - $tplvars['msg'] = T_('You have now logged out'); - } +if (isset($_GET['action']) && 'logout' == $_GET['action']) { + $userservice->logout($path); + $tplvars['msg'] = T_('You have now logged out'); } // Header variables @@ -53,26 +50,16 @@ if ($usecache) { // Pagination $perpage = getPerPageCount(); -if (isset($_GET['page']) && intval($_GET['page']) > 1) { - $page = $_GET['page']; - $start = ($page - 1) * $perpage; -} else { - $page = 0; - $start = 0; -} - -$dtend = date('Y-m-d H:i:s', strtotime('tomorrow')); -$dtstart = date('Y-m-d H:i:s', strtotime($dtend .' -'. $defaultRecentDays .' days')); -$tplVars['page'] = $page; -$tplVars['start'] = $start; +$tplVars['page'] = 0; +$tplVars['start'] = 0; $tplVars['popCount'] = 30; $tplVars['sidebar_blocks'] = array('recent'); $tplVars['range'] = 'all'; $tplVars['pagetitle'] = T_('Store, share and tag your favourite links'); $tplVars['subtitle'] = T_('Recent Bookmarks'); -$tplVars['bookmarkCount'] = $start + 1; -$bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, NULL, NULL, NULL, getSortOrder(), NULL, $dtstart, $dtend); +$tplVars['bookmarkCount'] = 1; +$bookmarks =& $bookmarkservice->getBookmarks(0, $perpage, NULL, NULL, NULL, getSortOrder(), NULL); $tplVars['total'] = $bookmarks['total']; $tplVars['bookmarks'] =& $bookmarks['bookmarks']; $tplVars['cat_url'] = createURL('tags', '%2$s'); @@ -84,4 +71,3 @@ if ($usecache) { // Cache output if existing copy has expired $cacheservice->End($hash); } -?> \ No newline at end of file diff --git a/locales/de_DE/LC_MESSAGES/messages.po b/locales/de_DE/LC_MESSAGES/messages.po index 208f26f..1b98a13 100644 --- a/locales/de_DE/LC_MESSAGES/messages.po +++ b/locales/de_DE/LC_MESSAGES/messages.po @@ -1,5 +1,5 @@ # Scuttle de-DE Translation -# Copyright (C) 2005 - 2006 Scuttle project +# Copyright (C) 2005 - 2006 Marcus Campbell # This file is distributed under the same license as the Scuttle package. # Ogee # diff --git a/locales/dk_DK/LC_MESSAGES/messages.po b/locales/dk_DK/LC_MESSAGES/messages.po index 3d06851..db93765 100644 --- a/locales/dk_DK/LC_MESSAGES/messages.po +++ b/locales/dk_DK/LC_MESSAGES/messages.po @@ -1,5 +1,5 @@ # Scuttle dk-DK Translation -# Copyright (C) 2006 Scuttle project +# Copyright (C) 2006 Marcus Campbell # This file is distributed under the same license as the Scuttle package. # Nicki Brøchner # diff --git a/locales/en_GB/LC_MESSAGES/messages.po b/locales/en_GB/LC_MESSAGES/messages.po index 46ea298..446f034 100644 --- a/locales/en_GB/LC_MESSAGES/messages.po +++ b/locales/en_GB/LC_MESSAGES/messages.po @@ -1,5 +1,5 @@ # Scuttle en-GB Translation -# Copyright (C) 2005 - 2006 Scuttle project +# Copyright (C) 2005 - 2006 Marcus Campbell # This file is distributed under the same license as the Scuttle package. # Marcus Campbell # diff --git a/locales/es_ES/LC_MESSAGES/messages.po b/locales/es_ES/LC_MESSAGES/messages.po index 73567fb..35f6f3a 100644 --- a/locales/es_ES/LC_MESSAGES/messages.po +++ b/locales/es_ES/LC_MESSAGES/messages.po @@ -1,5 +1,5 @@ # Scuttle es-ES Translation -# Copyright (C) 2005 - 2006 Scuttle project +# Copyright (C) 2005 - 2006 Marcus Campbell # This file is distributed under the same license as the Scuttle package. # Francisco Portero # diff --git a/locales/fr_FR/LC_MESSAGES/messages.po b/locales/fr_FR/LC_MESSAGES/messages.po index 96572aa..b71e8b7 100644 --- a/locales/fr_FR/LC_MESSAGES/messages.po +++ b/locales/fr_FR/LC_MESSAGES/messages.po @@ -1,5 +1,5 @@ # Scuttle fr-FR Translation -# Copyright (C) 2005 - 2006 Scuttle project +# Copyright (C) 2005 - 2006 Marcus Campbell # This file is distributed under the same license as the Scuttle package. # # nitram diff --git a/locales/hi_IN/LC_MESSAGES/messages.po b/locales/hi_IN/LC_MESSAGES/messages.po index af6b412..f60296d 100644 --- a/locales/hi_IN/LC_MESSAGES/messages.po +++ b/locales/hi_IN/LC_MESSAGES/messages.po @@ -1,5 +1,5 @@ # Scuttle hi-IN Translation -# Copyright (C) 2005 - 2006 Scuttle project +# Copyright (C) 2005 - 2006 Marcus Campbell # This file is distributed under the same license as the Scuttle package. # Debashish Chakrabarty # Ravishankar Shrivastava diff --git a/locales/it_IT/LC_MESSAGES/messages.po b/locales/it_IT/LC_MESSAGES/messages.po index 46d86d3..fa77a56 100644 --- a/locales/it_IT/LC_MESSAGES/messages.po +++ b/locales/it_IT/LC_MESSAGES/messages.po @@ -1,5 +1,5 @@ # Scuttle it-IT Translation -# Copyright (C) 2005 - 2006 Scuttle project +# Copyright (C) 2005 - 2006 Marcus Campbell # This file is distributed under the same license as the Scuttle package. # # diff --git a/locales/ja_JP/LC_MESSAGES/messages.po b/locales/ja_JP/LC_MESSAGES/messages.po index e59c6aa..644784d 100644 --- a/locales/ja_JP/LC_MESSAGES/messages.po +++ b/locales/ja_JP/LC_MESSAGES/messages.po @@ -1,5 +1,5 @@ # Scuttle ja-JP Translation -# Copyright (C) 2005 - 2006 Scuttle project +# Copyright (C) 2005 - 2006 Marcus Campbell # This file is distributed under the same license as the Scuttle package. # Tadashi Jokagi , 2005-2006. # diff --git a/locales/lt_LT/LC_MESSAGES/messages.po b/locales/lt_LT/LC_MESSAGES/messages.po index 90cd169..0013c05 100644 --- a/locales/lt_LT/LC_MESSAGES/messages.po +++ b/locales/lt_LT/LC_MESSAGES/messages.po @@ -1,5 +1,5 @@ # Scuttle lt-LT Translation -# Copyright (C) 2005 - 2006 Scuttle project +# Copyright (C) 2005 - 2006 Marcus Campbell # This file is distributed under the same license as the Scuttle package. # Audrius Radzevičius # diff --git a/locales/nl_NL/LC_MESSAGES/messages.po b/locales/nl_NL/LC_MESSAGES/messages.po index 1dd6526..5782028 100644 --- a/locales/nl_NL/LC_MESSAGES/messages.po +++ b/locales/nl_NL/LC_MESSAGES/messages.po @@ -1,5 +1,5 @@ # Scuttle nl-NL Translation -# Copyright (C) 2005 - 2006 Scuttle project +# Copyright (C) 2005 - 2006 Marcus Campbell # This file is distributed under the same license as the Scuttle package. # # diff --git a/locales/pt_BR/LC_MESSAGES/messages.po b/locales/pt_BR/LC_MESSAGES/messages.po index 36df105..1c6f1ae 100644 --- a/locales/pt_BR/LC_MESSAGES/messages.po +++ b/locales/pt_BR/LC_MESSAGES/messages.po @@ -1,5 +1,5 @@ # Scuttle pt-BR Translation -# Copyright (C) 2006 Scuttle project +# Copyright (C) 2006 Marcus Campbell # This file is distributed under the same license as the Scuttle package. # Marcelo Jorge Vieira (metal) , 2006. # diff --git a/locales/zh_CN/LC_MESSAGES/messages.po b/locales/zh_CN/LC_MESSAGES/messages.po index b6aadcb..6c52851 100644 --- a/locales/zh_CN/LC_MESSAGES/messages.po +++ b/locales/zh_CN/LC_MESSAGES/messages.po @@ -1,5 +1,5 @@ # Scuttle zh-CN Translation -# Copyright (C) 2005 - 2006 Scuttle project +# Copyright (C) 2005 - 2006 Marcus Campbell # This file is distributed under the same license as the Scuttle package. # Yanni Zheng # diff --git a/login.php b/login.php index d361394..38ca360 100644 --- a/login.php +++ b/login.php @@ -1,7 +1,6 @@ must enter a username, password and e-mail address.'); } @@ -62,17 +68,17 @@ if ($_POST['submitted']) { } // Check if e-mail address is blocked - elseif ($userservice->isBlockedEmail($_POST['email'])) { + elseif ($userservice->isBlockedEmail($postedmail)) { $tplVars['error'] = T_('This e-mail address is not permitted.'); } // Check if e-mail address is valid - elseif (!$userservice->isValidEmail($_POST['email'])) { + elseif (!$userservice->isValidEmail($postedmail)) { $tplVars['error'] = T_('E-mail address is not valid. Please try again.'); } // Register details - elseif ($userservice->addUser($posteduser, $_POST['password'], $_POST['email'])) { + elseif ($userservice->addUser($posteduser, $_POST['password'], $postedmail)) { // Log in with new username $login = $userservice->login($posteduser, $_POST['password']); if ($login) { diff --git a/rss.php b/rss.php index 4db9773..cf10478 100644 --- a/rss.php +++ b/rss.php @@ -1,7 +1,6 @@ isLoggedOn()) { - $currentUser = $userservice->getCurrentUser(); - $currentUsername = $currentUser[$userservice->getFieldName('username')]; - $logged_on = true; + $currentUser = $userservice->getCurrentUser(); + $currentUsername = $currentUser[$userservice->getFieldName('username')]; + $logged_on = TRUE; } if ($logged_on || isset($user)) { ?>