diff options
Diffstat (limited to 'include')
-rwxr-xr-x | include/controls.php | 17 | ||||
-rw-r--r-- | include/functions.php | 8 | ||||
-rwxr-xr-x | include/sanity_check.php | 6 | ||||
-rw-r--r-- | include/sanity_config.php | 4 | ||||
-rw-r--r-- | include/sessions.php | 8 |
5 files changed, 30 insertions, 13 deletions
diff --git a/include/controls.php b/include/controls.php index e3349d31b..b65a166c2 100755 --- a/include/controls.php +++ b/include/controls.php @@ -5,6 +5,11 @@ $rv = ""; foreach ($attributes as $k => $v) { + + // special handling for "disabled" + if ($k === "disabled" && !sql_bool_to_bool($v)) + continue; + $rv .= "$k=\"" . htmlspecialchars($v) . "\""; } @@ -30,6 +35,18 @@ return "<button dojoType=\"dijit.form.Button\" ".attributes_to_string($attributes)." type=\"$type\">$value</button>"; } + function input_tag(string $name, string $value, string $type = "text", array $attributes = [], string $id = "") { + $attributes_str = attributes_to_string($attributes); + $dojo_type = strpos($attributes_str, "dojoType") === false ? "dojoType='dijit.form.TextBox'" : ""; + + return "<input name=\"".htmlspecialchars($name)."\" $dojo_type ".attributes_to_string($attributes)." id=\"".htmlspecialchars($id)."\" + type=\"$type\" value=\"".htmlspecialchars($value)."\">"; + } + + function number_spinner_tag(string $name, string $value, array $attributes = [], string $id = "") { + return input_tag($name, $value, "text", array_merge(["dojoType" => "dijit.form.NumberSpinner"], $attributes), $id); + } + function submit_tag(string $value, array $attributes = []) { return button_tag($value, "submit", array_merge(["class" => "alt-primary"], $attributes)); } diff --git a/include/functions.php b/include/functions.php index df8730aca..21459da9c 100644 --- a/include/functions.php +++ b/include/functions.php @@ -34,8 +34,8 @@ error_reporting(E_ALL & ~E_NOTICE); } - ini_set('display_errors', 0); - ini_set('display_startup_errors', 0); + ini_set('display_errors', "false"); + ini_set('display_startup_errors', "false"); require_once 'config.php'; @@ -283,7 +283,7 @@ } else if (is_string($param)) { return trim(strip_tags($param)); } else { - return trim($param); + return $param; } } @@ -432,7 +432,7 @@ } function uniqid_short() { - return uniqid(base_convert(rand(), 10, 36)); + return uniqid(base_convert((string)rand(), 10, 36)); } function T_sprintf() { diff --git a/include/sanity_check.php b/include/sanity_check.php index 9407b606f..2786f012f 100755 --- a/include/sanity_check.php +++ b/include/sanity_check.php @@ -40,8 +40,6 @@ array_push($errors, "Configuration file not found. Looks like you forgot to copy config.php-dist to config.php and edit it."); } else { - require_once "sanity_config.php"; - if (!file_exists("config.php")) { array_push($errors, "Please copy config.php-dist to config.php"); } @@ -78,12 +76,14 @@ array_push($errors, "Data export cache is not writable (chmod -R 777 ".CACHE_DIR."/export)"); } + require_once "sanity_config.php"; + if (GENERATED_CONFIG_CHECK != EXPECTED_CONFIG_VERSION) { array_push($errors, "Configuration option checker sanity_config.php is outdated, please recreate it using ./utils/regen_config_checks.sh"); } - foreach ($required_defines as $d) { + foreach (get_required_defines() as $d) { if (!defined($d)) { array_push($errors, "Required configuration file parameter $d is not defined in config.php. You might need to copy it from config.php-dist."); diff --git a/include/sanity_config.php b/include/sanity_config.php index 5059ee83b..b304adf54 100644 --- a/include/sanity_config.php +++ b/include/sanity_config.php @@ -1,3 +1,3 @@ -<?php # This file has been generated at: Fri Feb 12 21:33:46 MSK 2021 +<?php # This file has been generated at: Mon Feb 22 14:17:27 MSK 2021 define('GENERATED_CONFIG_CHECK', 26); -$required_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'SESSION_COOKIE_LIFETIME', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'CHECK_FOR_UPDATES', 'PLUGINS', 'LOG_DESTINATION', 'CONFIG_VERSION'); ?> +function get_required_defines() { return [ 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'SESSION_COOKIE_LIFETIME', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'CHECK_FOR_UPDATES', 'PLUGINS', 'LOG_DESTINATION', 'CONFIG_VERSION']; } diff --git a/include/sessions.php b/include/sessions.php index 16de53ab2..5b372612b 100644 --- a/include/sessions.php +++ b/include/sessions.php @@ -12,14 +12,14 @@ $session_name = (!defined('TTRSS_SESSION_NAME')) ? "ttrss_sid" : TTRSS_SESSION_NAME; if (is_server_https()) { - ini_set("session.cookie_secure", true); + ini_set("session.cookie_secure", "true"); } - ini_set("session.gc_probability", 75); + ini_set("session.gc_probability", "75"); ini_set("session.name", $session_name); - ini_set("session.use_only_cookies", true); + ini_set("session.use_only_cookies", "true"); ini_set("session.gc_maxlifetime", $session_expire); - ini_set("session.cookie_lifetime", 0); + ini_set("session.cookie_lifetime", "0"); function session_get_schema_version() { global $schema_version; |