small fixes
authorDuck (Jakob Munih) <duck@obala.net>
Mon, 26 Jan 2009 00:00:16 +0000 (01:00 +0100)
committerDuck (Jakob Munih) <duck@obala.net>
Mon, 26 Jan 2009 00:00:16 +0000 (01:00 +0100)
folks/lib/Driver.php
folks/lib/Driver/sql.php
folks/lib/base.php
folks/login.php
folks/scripts/mail-filter.php
folks/templates/user/authenticated.php
folks/user.php

index 728b1cb..1ea5ca4 100644 (file)
@@ -249,7 +249,7 @@ class Folks_Driver {
      */
     public function getRecentVisitors($limit = 10)
     {
-        $recent = $GLOBALS['cache']->get('folksRecentVisitors', $GLOBALS['conf']['online']['ttl']);
+        $recent = $GLOBALS['cache']->get('folksRecentVisitors' . $limit, $GLOBALS['conf']['online']['ttl']);
         if ($recent) {
             $recent = unserialize($recent);
         } else {
@@ -257,7 +257,7 @@ class Folks_Driver {
             if ($recent instanceof PEAR_Error) {
                 return $recent;
             }
-            $GLOBALS['cache']->set('folksRecentVisitors', serialize($recent));
+            $GLOBALS['cache']->set('folksRecentVisitors' . $limit, serialize($recent));
         }
 
         return $recent;
index 4957896..481ca70 100644 (file)
@@ -20,9 +20,9 @@
  * The table structure can be created by the scripts/sql/folks_foo.sql
  * script.
  *
- * $Id: sql.php 984 2008-10-09 09:38:16Z duck $
+ * $Id: sql.php 1074 2008-11-29 09:04:26Z duck $
  *
- * Copyright 2007-2009 The Horde Project (http://www.horde.org/)
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
  * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
@@ -68,11 +68,16 @@ class Folks_Driver_sql extends Folks_Driver {
 
     /**
      * Get last visitors
+     *
+     * @param integer $limit   Username to check
+     *
+     * @return array  users
      */
     protected function _getRecentVisitors($limit = 10)
     {
         $sql = 'SELECT user_uid FROM ' . $this->_params['online']
-            . ' WHERE user_uid <> "" ORDER BY time_last_click DESC LIMIT 0, ' . (int)$limit;
+            . ' WHERE user_uid <> "" AND user_uid <> "0" '
+            . '  ORDER BY time_last_click DESC LIMIT 0, ' . (int)$limit;
 
         return $this->_db->getCol($sql);
     }
@@ -570,6 +575,7 @@ class Folks_Driver_sql extends Folks_Driver {
         }
 
         /* Connect to the SQL server using the supplied parameters. */
+        require_once 'DB.php';
         $this->_write_db = DB::connect($this->_params,
                                         array('persistent' => !empty($this->_params['persistent'])));
         if ($this->_write_db instanceof PEAR_Error) {
index 1872230..f98fd35 100644 (file)
@@ -16,7 +16,7 @@ if (!defined('HORDE_BASE')) {
 
 // Load the Horde Framework core, and set up inclusion paths and autoloading.
 require_once HORDE_BASE . '/lib/core.php';
-require_once 'Horde/Loader.php';
+require_once 'Horde/Autoloader.php';
 
 // Registry.
 $registry = &Registry::singleton();
index 45059a2..f1e8641 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * $Id: login.php 954 2008-09-30 19:09:25Z duck $
+ * $Id: login.php 1076 2008-11-29 09:33:19Z duck $
  *
  * Copyright Obala d.o.o. (www.obala.si)
  *
@@ -77,7 +77,7 @@ if (isset($_GET['logout_reason'])) {
 /*
  * Special login for apps (gollem, imp)?
  */
-if ($conf['login']['prelogin'] && 
+if ($conf['login']['prelogin'] &&
     Auth::getAuth() &&
    ($app = Util::getGet('app'))) {
     Horde::callHook('_folks_hook_prelogin', array($app), 'folks');
@@ -119,7 +119,7 @@ if (isset($_COOKIE['folks_login_code']) &&
 }
 
 /*
- * Form 
+ * Form
  */
 $title = sprintf(_("Login to %s"), $registry->get('name', 'horde'));
 $vars = Variables::getDefaultVariables();
@@ -128,7 +128,7 @@ $form = new Folks_Login_Form($vars, $title, 'folks_login');
 /*
  * Check time between one login and anther
  */
-$username = strtolower(Util::getPost('username'));
+$username = strtolower(trim(Util::getPost('username')));
 if ($username && $conf['login']['diff']) {
     $last_try = $cache->get('login_last_try_' . $username, $conf['cache']['default_lifetime']);
     if ($last_try && $_SERVER['REQUEST_TIME'] - $last_try <= $conf['login']['diff']) {
@@ -175,6 +175,7 @@ if ($form->isSubmitted()) {
         break;
 
     case 'unconfirmed':
+    case 'inactive':
         $notification->push(_("This account was still not activated. Check your inbox, we send you the activation code there."), 'horde.warning');
         header('Location: ' . Horde::selfUrl(true));
         exit;
index 2c7ce04..2b15abf 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * This script parses MIME messages and deactivates users with returned emails.
  *
- * $Id: mail-filter.php 1019 2008-10-31 08:18:10Z duck $
+ * $Id: mail-filter.php 1020 2008-10-31 09:25:56Z duck $
  *
  * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
@@ -162,7 +162,7 @@ if (empty($mails)) {
 // Get usernames
 $query = 'SELECT DISTINCT user_uid FROM folks_users WHERE user_email'
             . ' IN (' . implode(', ', array_unique($mails)) . ') ';
-$users = $db->getOne($query, $mail);
+$users = $db->getCol($query);
 if ($user_uid instanceof PEAR_Error) {
     $cli->fatal($user_uid);
     continue;
@@ -180,15 +180,16 @@ $auth = Auth::singleton('auto', array('username' => $opts_hash['--username']));
 $auth->setAuth($opts_hash['--username'], array('transparent' => 1));
 
 // Send messages
-$result = $registry->callByPackage(
-    'letter', 'sendMessage', array($users,
-                                array('title' => $title,
-                                        'content' => sprintf($body, $user_uid, $edit_url))));
-
-if ($result instanceof PEAR_Error) {
-    $cli->message($result, 'cli.error');
-} else {
-    $cli->message('', 'cli.sucess');
+foreach ($users as $user) {
+    $result = $registry->callByPackage(
+        'letter', 'sendMessage', array($user,
+                                    array('title' => $title,
+                                            'content' => sprintf($body, $user_uid, $edit_url))));
+    if ($result instanceof PEAR_Error) {
+        $cli->message($result, 'cli.error');
+    } else {
+        $cli->message($user, 'cli.sucess');
+    }
 }
 
 exit(0);
index ab999a4..785080b 100644 (file)
@@ -2,11 +2,10 @@
 
 <ul class="notices">
 <li><img src="<?php echo $registry->getImageDir('horde')?>/alerts/warning.png"><?php echo sprintf(_("User %s would like to his profile remains visible only to authenticated users."), $user) ?></li>
-<?php 
-    echo '<li><?php echo $registry->getImageDir('horde')?>/alerts/success.png">'
-                    . _("Click here to login.")
-                    . ' <a href="' . Auth::getLoginScreen('letter', Util::addParameter(Horde::applicationUrl('user.php'), 'user', $user))  . '">' . _("Click here to login.") . '</a>'
-                     . '</li>';
-}
+<?php
+echo '<li><img src="' . $registry->getImageDir('horde') . '/alerts/success.png">'
+                . _("Click here to login.")
+                . ' <a href="' . Auth::getLoginScreen('letter', Util::addParameter(Horde::applicationUrl('user.php'), 'user', $user))  . '">' . _("Click here to login.") . '</a>'
+                    . '</li>';
 ?>
 </ul>
index 76b525c..aca8779 100644 (file)
@@ -1,6 +1,6 @@
 <?php
  /**
- * $Id: user.php 987 2008-10-09 12:23:30Z duck $
+ * $Id: user.php 1076 2008-11-29 09:33:19Z duck $
  *
  * Copyright Obala d.o.o. (www.obala.si)
  *
@@ -71,6 +71,7 @@ case 'inactive':
 break;
 
 case 'deleted':
+case 'deactivated':
     require FOLKS_TEMPLATES . '/user/deleted.php';
 break;