aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2009-02-14 02:24:10 +0000
committerrvelices <rv-github@modusoptimus.com>2009-02-14 02:24:10 +0000
commit6c92ade174238e18ed22f6f95234ab9604e3b445 (patch)
tree51f2748c50cee6e5ceb1198fbdfaf1545911b1fc /include/functions.inc.php
parent290f2c1d39d1c47d48ba4e6a6d347459975e8b0f (diff)
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
Diffstat (limited to '')
-rw-r--r--include/functions.inc.php34
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