From 6c92ade174238e18ed22f6f95234ab9604e3b445 Mon Sep 17 00:00:00 2001 From: rvelices Date: Sat, 14 Feb 2009 02:24:10 +0000 Subject: Last (I hope) paranoic optims ... - move get_uysername and get_groupname from public to admin/functions.inc.php - optim in index.php - tags.tpl does not need smarty modifier included - move func get_comment_post_key from functions_comment to functions (avoid extra inclusion every time on picture page) git-svn-id: http://piwigo.org/svn/trunk@3145 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions.inc.php | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'include/functions.inc.php') diff --git a/include/functions.inc.php b/include/functions.inc.php index 1675dbce8..83c9980de 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -493,7 +493,6 @@ function get_languages($target_charset = null) } closedir($dir); @asort($languages); - @reset($languages); return $languages; } @@ -1373,17 +1372,6 @@ function load_language($filename, $dirname = '', $source_file = $f; break; } - - if ($target_charset=='utf-8') - { // we accept conversion from ISO-8859-1 to UTF-8 - $f = $dir.'.iso-8859-1/'.$filename; - if (file_exists($f)) - { - $source_charset = 'iso-8859-1'; - $source_file = $f; - break; - } - } } if ( !empty($source_file) ) @@ -1483,4 +1471,26 @@ function secure_directory($dir) @file_put_contents($file, 'Not allowed!'); } } + +/** + * returns a "secret key" that is to be sent back when a user enters a comment + * + * @param int image_id + */ +function get_comment_post_key($image_id) +{ + global $conf; + + $time = time(); + + return sprintf( + '%s:%s', + $time, + hash_hmac( + 'md5', + $time.':'.$image_id, + $conf['secret_key'] + ) + ); +} ?> \ No newline at end of file -- cgit v1.2.3