* Fixed REG_BADRPT error in isValidEmail() that prevented registration
authorMarcus Campbell <marcus.campbell@gmail.com>
Sun, 13 Jul 2008 01:09:50 +0000 (01:09 +0000)
committerMarcus Campbell <marcus.campbell@gmail.com>
Sun, 13 Jul 2008 01:09:50 +0000 (01:09 +0000)
* Merged cookie fix from trunk
* Set body background to white
* Removed poor seed from _randompassword()
* Minor fix to updateBookmark()

.htaccess
header.inc.php
index.php
login.php
readme.txt
register.php
scuttle.css
services/bookmarkservice.php
services/userservice.php

index af3cae928ef4301806388e4c6425cbda69afb59f..89f6dfdd03ee09661875aca782801090bb38dfd1 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -1,3 +1,5 @@
+# Rewrite clean URLs onto real files
+<IfModule mod_rewrite.c>
 Options +FollowSymlinks
 <IfDefine APACHE2>
     AcceptPathInfo On
@@ -8,3 +10,4 @@ RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME}.php -f
 RewriteRule ^([^/]+)/?(.*)      $1.php/$2   [L]
+</IfModule>
index 751e4e81ca8622a054ad71bc1eb781f818174bba..de56c846196626b5bac800fd2a512689f1740a6c 100644 (file)
@@ -23,6 +23,7 @@ if (!isset($root)) {
     if (($root != '/') && (substr($root, -1, 1) != '/')) {
         $root .= '/';
     }
+    $path = $root;
     $root = 'http://'. $_SERVER['HTTP_HOST'] . $root;
 }
 
index b760bd7a785554c7f844f264067fa7fd9c800a54..ad6f1ccfebc711e039ac8953bf670553df849be5 100644 (file)
--- a/index.php
+++ b/index.php
@@ -28,7 +28,7 @@ $cacheservice =& ServiceFactory::getServiceInstance('CacheService');
 $tplvars = array();
 if (isset($_GET['action'])){
     if ($_GET['action'] == "logout") {
-        $userservice->logout();
+        $userservice->logout($path);
         $tplvars['msg'] = T_('You have now logged out');
     }
 }
index 4d212a94def47199bce52884d4b2a74a706e82cf..41913f08dc90d53241d6b76e6f9634c2e75140c5 100644 (file)
--- a/login.php
+++ b/login.php
@@ -28,7 +28,7 @@ $tplVars = array();
 $login = false;
 if (isset($_POST['submitted']) && isset($_POST['username']) && isset($_POST['password'])) {
     $posteduser = trim(utf8_strtolower($_POST['username']));
-    $login = $userservice->login($posteduser, $_POST['password'], ($_POST['keeppass'] == "yes")); 
+    $login      = $userservice->login($posteduser, $_POST['password'], ($_POST['keeppass'] == 'yes'), $path); 
     if ($login) {
         if ($_POST['query'])
             header('Location: '. createURL('bookmarks', $posteduser .'?'. $_POST['query']));
index 64b186b2fdb66861d186ca8276eb7c07ab8d3c89..44abd6b5de7a0f57e3b33a2ff0aa56a6f0760411 100644 (file)
@@ -1,4 +1,4 @@
-Scuttle 0.7.3
+Scuttle 0.7.4
 http://sourceforge.net/projects/scuttle/
 http://scuttle.org/
 
@@ -13,11 +13,4 @@ INSTALLATION
 
 * Edit config.inc.php.example and save the changes as a new config.inc.php file in the same directory.
 
-* Set the CHMOD permissions on the /cache/ subdirectory to 777
-
-=============
-PROJECT LINKS
-=============
-
-Scuttle Project:
-http://sourceforge.net/projects/scuttle/
\ No newline at end of file
+* Set the CHMOD permissions on the /cache/ subdirectory to 777
\ No newline at end of file
index 8549d05c2e6d0495bbb6f88f67dc733f69ca4675..bca4de2f42cbc229ff431f700c32efe7ffe37a34 100644 (file)
@@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ***************************************************************************/
 
 require_once('header.inc.php');
-$userservice =& ServiceFactory::getServiceInstance('UserService');
-$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
+$userservice        =& ServiceFactory::getServiceInstance('UserService');
+$templateservice    =& ServiceFactory::getServiceInstance('TemplateService');
 
 $tplVars = array();
 
index 0d7ab2b0252819c57065c09145fe6fa1375a7e67..ecd2ab7d8b8de6f85f07c0ba877e3379d4f75edb 100644 (file)
@@ -15,6 +15,7 @@ a img {
     border: 0;
 }
 body {
+    background-color: #FFF;
     margin: 0;
     padding: 0;
 }
index afc717973c664e67b917f3286109d3fbce049217..9159f975ffb289a8a3c427ecd359e102234b0311 100644 (file)
@@ -180,8 +180,7 @@ class BookmarkService {
         $updates = array('bModified' => $moddatetime, 'bTitle' => $title, 'bAddress' => $address, 'bDescription' => $description, 'bStatus' => $status, 'bHash' => md5($address));
 
         if (!is_null($date)) {
-            $datetime = gmdate('Y-m-d H:i:s', strtotime($date));
-            $updates[] = array('bDateTime' => $datetime);
+            $updates['bDateTime'] = gmdate('Y-m-d H:i:s', strtotime($date));
         }
 
         $sql = 'UPDATE '. $GLOBALS['tableprefix'] .'bookmarks SET '. $this->db->sql_build_array('UPDATE', $updates) .' WHERE bId = '. intval($bId);
index 82abaf085fc1fdce8b59f12768793812c3fbb28f..e0b7ba9320c02ee79b4edff6c3cbd4969f9a9d9d 100644 (file)
@@ -63,8 +63,6 @@ class UserService {
     }
 
     function _randompassword() {
-        $seed = (integer) md5(microtime());
-        mt_srand($seed);
         $password = mt_rand(1, 99999999);
         $password = substr(md5($password), mt_rand(0, 19), mt_rand(6, 12));
         return $password;
@@ -145,7 +143,7 @@ class UserService {
         return false;
     }
 
-    function login($username, $password, $remember = FALSE) {
+    function login($username, $password, $remember = FALSE, $path = '/') {
         $password = $this->sanitisePassword($password);
         $query = 'SELECT '. $this->getFieldName('primary') .' FROM '. $this->getTableName() .' WHERE '. $this->getFieldName('username') .' = "'. $this->db->sql_escape($username) .'" AND '. $this->getFieldName('password') .' = "'. $this->db->sql_escape($password) .'"';
 
@@ -158,7 +156,7 @@ class UserService {
             $id = $_SESSION[$this->getSessionKey()] = $row[$this->getFieldName('primary')];
             if ($remember) {
                 $cookie = $id .':'. md5($username.$password);
-                setcookie($this->cookiekey, $cookie, time() + $this->cookietime);
+                setcookie($this->cookiekey, $cookie, time() + $this->cookietime, $path);
             }
             return true;
         } else {
@@ -166,8 +164,8 @@ class UserService {
         }
     }
 
-    function logout() {
-        @setcookie($this->cookiekey, NULL, time() - 1);
+    function logout($path = '/') {
+        @setcookie($this->cookiekey, NULL, time() - 1, $path);
         unset($_COOKIE[$this->cookiekey]);
         session_unset();
         $this->getCurrentUser(TRUE, false);
@@ -335,7 +333,7 @@ class UserService {
     }
 
     function isValidEmail($email) {
-        if (eregi("^((?:(?:(?:\w[\.\-\+_]?)*)\w)+)\@((?:(?:(?:\w[\.\-_]?){0,62})\w)+)\.(\w{2,6})$", $email)) {
+        if (preg_match("/^((?:(?:(?:\w[\.\-\+_]?)*)\w)+)\@((?:(?:(?:\w[\.\-_]?){0,62})\w)+)\.(\w{2,6})$/i", $email) > 0) {
             list($emailUser, $emailDomain) = split("@", $email);
 
             // Check if the email domain has a DNS record

Benjamin Mako Hill || Want to submit a patch?