summaryrefslogtreecommitdiff
path: root/include/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions.php')
-rwxr-xr-xinclude/functions.php53
1 files changed, 32 insertions, 21 deletions
diff --git a/include/functions.php b/include/functions.php
index a1aeb7135..2ab43e0b6 100755
--- a/include/functions.php
+++ b/include/functions.php
@@ -1,6 +1,6 @@
<?php
define('EXPECTED_CONFIG_VERSION', 26);
- define('SCHEMA_VERSION', 135);
+ define('SCHEMA_VERSION', 136);
define('LABEL_BASE_INDEX', -1024);
define('PLUGIN_FEED_BASE_INDEX', -128);
@@ -141,7 +141,6 @@
}
_bindtextdomain("messages", "locale");
-
_textdomain("messages");
_bind_textdomain_codeset("messages", "UTF-8");
}
@@ -738,21 +737,28 @@
}
}
- function make_password($length = 8) {
-
+ function make_password($length = 12) {
$password = "";
- $possible = "0123456789abcdfghjkmnpqrstvwxyzABCDFGHJKMNPQRSTVWXYZ";
+ $possible = "0123456789abcdfghjkmnpqrstvwxyzABCDFGHJKMNPQRSTVWXYZ*%+^";
- $i = 0;
+ $i = 0;
while ($i < $length) {
- $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
+
+ try {
+ $idx = function_exists("random_int") ? random_int(0, strlen($possible) - 1) : mt_rand(0, strlen($possible) - 1);
+ } catch (Exception $e) {
+ $idx = mt_rand(0, strlen($possible) - 1);
+ }
+
+ $char = substr($possible, $idx, 1);
if (!strstr($password, $char)) {
$password .= $char;
$i++;
}
}
+
return $password;
}
@@ -1981,7 +1987,7 @@
return true;
}
- function add_feed_category($feed_cat, $parent_cat_id = false) {
+ function add_feed_category($feed_cat, $parent_cat_id = false, $order_id = 0) {
if (!$feed_cat) return false;
@@ -2004,9 +2010,9 @@
if (!$sth->fetch()) {
- $sth = $pdo->prepare("INSERT INTO ttrss_feed_categories (owner_uid,title,parent_cat)
- VALUES (?, ?, ?)");
- $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id]);
+ $sth = $pdo->prepare("INSERT INTO ttrss_feed_categories (owner_uid,title,parent_cat,order_id)
+ VALUES (?, ?, ?, ?)");
+ $sth->execute([$_SESSION['uid'], $feed_cat, $parent_cat_id, (int)$order_id]);
if (!$tr_in_progress) $pdo->commit();
@@ -2403,18 +2409,23 @@
return __((parseInt(n) > 1) ? msg2 : msg1);
}';
- $l10n = _get_reader();
+ global $text_domains;
- for ($i = 0; $i < $l10n->total; $i++) {
- $orig = $l10n->get_original_string($i);
- if(strpos($orig, "\000") !== FALSE) { // Plural forms
- $key = explode(chr(0), $orig);
- print T_js_decl($key[0], _ngettext($key[0], $key[1], 1)); // Singular
- print T_js_decl($key[1], _ngettext($key[0], $key[1], 2)); // Plural
- } else {
- $translation = __($orig);
- print T_js_decl($orig, $translation);
+ foreach (array_keys($text_domains) as $domain) {
+ $l10n = _get_reader($domain);
+
+ for ($i = 0; $i < $l10n->total; $i++) {
+ $orig = $l10n->get_original_string($i);
+ if(strpos($orig, "\000") !== FALSE) { // Plural forms
+ $key = explode(chr(0), $orig);
+ print T_js_decl($key[0], _ngettext($key[0], $key[1], 1)); // Singular
+ print T_js_decl($key[1], _ngettext($key[0], $key[1], 2)); // Plural
+ } else {
+ $translation = _dgettext($domain,$orig);
+ print T_js_decl($orig, $translation);
+ }
}
+
}
}