mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
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
This commit is contained in:
+22
-12
@@ -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']
|
||||
)
|
||||
);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user