page_footer($no_menu, $is_index);
}
+function css_files_ensure_init() {
+ global $css_files, $path_to_root;
+
+ if (!isset($css_files))
+ {
+ $theme = user_theme();
+ $css_files = array();
+ $css_files[] = $path_to_root . "/themes/$theme/default.css";
+ }
+}
+
+function add_css_file($filename)
+{
+ global $css_files;
+ css_files_ensure_init();
+ $css_files[] = $filename;
+}
+
function cache_js_file($fpath, $text)
{
global $SysPrefs;
return preg_replace('/[^a-zA-Z0-9.\-_]/', '_', $filename);
}
+/*
+ Simple random password generator.
+*/
+function generate_password()
+{
+ if (PHP_VERSION >= '5.3')
+ $bytes = openssl_random_pseudo_bytes(8, $cstrong);
+ else
+ $bytes = sprintf("08%x", mt_rand(0,0xffffffff));
+
+ return base64_encode($bytes);
+}
+
+if (!function_exists('array_fill_keys')) // since 5.2
+{
+ function array_fill_keys($keys, $value)
+ {
+ return array_combine($keys, array_fill(count($keys), $value));
+ }
+}
+