diff options
author | rvelices <rv-github@modusoptimus.com> | 2013-03-23 10:50:57 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2013-03-23 10:50:57 +0000 |
commit | 55275efb66cf6a2b0c874a1d05915fdc83d9cc48 (patch) | |
tree | 5c443dea4445b275712af02ddebaeb129f80f80c /include/functions_user.inc.php | |
parent | 19d831bfe1cf60e150bada8a98c10966862d2ecf (diff) |
feature 2557 recent photos/albums should never be empty
git-svn-id: http://piwigo.org/svn/trunk@21802 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/functions_user.inc.php | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index 439c91b3e..db9da568c 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -826,7 +826,7 @@ SELECT * if (pwg_db_num_rows($result) > 0) { $cache['default_user'] = pwg_db_fetch_assoc($result); - + unset($cache['default_user']['user_id']); unset($cache['default_user']['status']); unset($cache['default_user']['registration_date']); @@ -1125,13 +1125,13 @@ function pwg_password_hash($password) if (empty($pwg_hasher)) { require_once(PHPWG_ROOT_PATH.'include/passwordhash.class.php'); - + // We use the portable hash feature from phpass because we can't be sure // Piwigo runs on PHP 5.3+ (and won't run on an older version in the // future) $pwg_hasher = new PasswordHash(13, true); } - + return $pwg_hasher->HashPassword($password); } @@ -1160,7 +1160,7 @@ function pwg_password_verify($password, $hash, $user_id=null) { $check = ($hash == md5($password)); } - + if ($check and isset($user_id) and !$conf['external_authentification']) { // Rehash using new hash. @@ -1179,7 +1179,7 @@ function pwg_password_verify($password, $hash, $user_id=null) if (empty($pwg_hasher)) { require_once(PHPWG_ROOT_PATH.'include/passwordhash.class.php'); - + // We use the portable hash feature $pwg_hasher = new PasswordHash(13, true); } @@ -1200,11 +1200,11 @@ add_event_handler('try_log_user', 'pwg_login', EVENT_HANDLER_PRIORITY_NEUTRAL, 4 function pwg_login($success, $username, $password, $remember_me) { - if ($success===true) + if ($success===true) { return true; } - + // we force the session table to be clean pwg_session_gc(); @@ -1231,9 +1231,9 @@ SELECT '.$conf['user_fields']['id'].' AS id, function logout_user() { global $conf; - + trigger_action('user_logout', @$_SESSION['pwg_uid']); - + $_SESSION = array(); session_unset(); session_destroy(); @@ -1554,6 +1554,19 @@ function get_sql_condition_FandF( return $sql; } +/** @return the sql condition to show recent photos/albums based on user preferences and latest available photo.*/ +function get_recent_photos_sql($db_field) +{ + global $user; + if (!isset($user['last_photo_date'])) + { + return '0=1'; + } + return $db_field.'>=LEAST(' + .pwg_db_get_recent_period_expression($user['recent_period']) + .','.pwg_db_get_recent_period_expression(1,$user['last_photo_date']).')'; +} + /** * search an available activation_key * |