From: Duck (Jakob Munih) Date: Mon, 26 Jan 2009 00:00:16 +0000 (+0100) Subject: small fixes X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=dbf541a875d394249f1a477ec748cb015e480f64;p=horde.git small fixes --- diff --git a/folks/lib/Driver.php b/folks/lib/Driver.php index 728b1cb43..1ea5ca400 100644 --- a/folks/lib/Driver.php +++ b/folks/lib/Driver.php @@ -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; diff --git a/folks/lib/Driver/sql.php b/folks/lib/Driver/sql.php index 4957896bb..481ca703a 100644 --- a/folks/lib/Driver/sql.php +++ b/folks/lib/Driver/sql.php @@ -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) { diff --git a/folks/lib/base.php b/folks/lib/base.php index 1872230f9..f98fd357a 100644 --- a/folks/lib/base.php +++ b/folks/lib/base.php @@ -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(); diff --git a/folks/login.php b/folks/login.php index 45059a289..f1e8641d6 100644 --- a/folks/login.php +++ b/folks/login.php @@ -1,6 +1,6 @@ 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; diff --git a/folks/scripts/mail-filter.php b/folks/scripts/mail-filter.php index 2c7ce0418..2b15abfb4 100644 --- a/folks/scripts/mail-filter.php +++ b/folks/scripts/mail-filter.php @@ -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); diff --git a/folks/templates/user/authenticated.php b/folks/templates/user/authenticated.php index ab999a40e..785080b87 100644 --- a/folks/templates/user/authenticated.php +++ b/folks/templates/user/authenticated.php @@ -2,11 +2,10 @@ diff --git a/folks/user.php b/folks/user.php index 76b525c3c..aca877961 100644 --- a/folks/user.php +++ b/folks/user.php @@ -1,6 +1,6 @@