diff options
author | rvelices <rv-github@modusoptimus.com> | 2009-02-14 02:28:21 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2009-02-14 02:28:21 +0000 |
commit | 368059d5353209ddad495081bc9d5d9218a9de23 (patch) | |
tree | 18c0de692f0102d0275b254f82756a3fa00c4e7f /include/functions.inc.php | |
parent | 35e9af66be0b6da3055d032123bd38100b58bca9 (diff) |
merge 3145-3146 from trunk
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/branches/2.0@3147 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/functions.inc.php | 34 |
1 files changed, 22 insertions, 12 deletions
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 |