summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--backend.php5
-rwxr-xr-xclasses/handler/public.php3
-rwxr-xr-xclasses/rpc.php2
-rw-r--r--include/functions.php62
-rw-r--r--include/sessions.php1
-rw-r--r--include/version.php36
-rw-r--r--index.php5
-rw-r--r--locale/id/LC_MESSAGES/messages.mobin565 -> 502 bytes
-rw-r--r--locale/id/LC_MESSAGES/messages.po10
-rwxr-xr-xplugins/af_comics/init.php2
-rw-r--r--prefs.php10
-rwxr-xr-xupdate_daemon2.php1
13 files changed, 74 insertions, 65 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e842faf48..2708e38f9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,5 +1,7 @@
## Contributing code the right way
+*(or: how I learned to post merge requests without crying myself to sleep)*
+
New user accounts on Gogs are not allowed to fork repositories because of spam. To get
initial fork access, do the following:
diff --git a/backend.php b/backend.php
index cb158f705..e65ce1b94 100644
--- a/backend.php
+++ b/backend.php
@@ -98,10 +98,13 @@
if ($override) {
$handler = $override;
} else {
- $handler = new $op($_REQUEST);
+ $reflection = new ReflectionClass($op);
+ $handler = $reflection->newInstanceWithoutConstructor();
}
if ($handler && implements_interface($handler, 'IHandler')) {
+ $handler->__construct($_REQUEST);
+
if (validate_csrf($csrf_token) || $handler->csrf_ignore($method)) {
if ($handler->before($method)) {
if ($method && method_exists($handler, $method)) {
diff --git a/classes/handler/public.php b/classes/handler/public.php
index b81fb03b8..67c188142 100755
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -85,7 +85,7 @@ class Handler_Public extends Handler {
$tpl->readTemplateFromFile("templates/generated_feed.txt");
$tpl->setVariable('FEED_TITLE', $feed_title, true);
- $tpl->setVariable('VERSION', VERSION, true);
+ $tpl->setVariable('VERSION', get_version(), true);
$tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true);
$tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true);
@@ -180,7 +180,6 @@ class Handler_Public extends Handler {
$feed = array();
$feed['title'] = $feed_title;
- $feed['version'] = VERSION;
$feed['feed_url'] = $feed_self_url;
$feed['self_url'] = get_self_url_prefix();
diff --git a/classes/rpc.php b/classes/rpc.php
index af5bdf52c..208551075 100755
--- a/classes/rpc.php
+++ b/classes/rpc.php
@@ -595,7 +595,7 @@ class RPC extends Handler_Protected {
get_version($git_commit, $git_timestamp);
- if (CHECK_FOR_UPDATES && $_SESSION["access_level"] >= 10 && $git_timestamp) {
+ if (defined('CHECK_FOR_UPDATES') && CHECK_FOR_UPDATES && $_SESSION["access_level"] >= 10 && $git_timestamp) {
$content = @fetch_file_contents(["url" => "https://srv.tt-rss.org/version.json"]);
if ($content) {
diff --git a/include/functions.php b/include/functions.php
index 9cd352833..537139d18 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -27,6 +27,9 @@
error_reporting(E_ALL & ~E_NOTICE);
}
+ ini_set('display_errors', 0);
+ ini_set('display_startup_errors', 0);
+
require_once 'config.php';
/**
@@ -151,10 +154,9 @@
}
require_once 'db-prefs.php';
- require_once 'version.php';
require_once 'controls.php';
- define('SELF_USER_AGENT', 'Tiny Tiny RSS/' . VERSION . ' (http://tt-rss.org/)');
+ define('SELF_USER_AGENT', 'Tiny Tiny RSS/' . get_version() . ' (http://tt-rss.org/)');
ini_set('user_agent', SELF_USER_AGENT);
$schema_version = false;
@@ -1882,3 +1884,59 @@
return $ts;
}
+
+ /* for package maintainers who don't use git: if version_static.txt exists in tt-rss root
+ directory, its contents are displayed instead of git commit-based version, this could be generated
+ based on source git tree commit used when creating the package */
+
+ function get_version(&$git_commit = false, &$git_timestamp = false) {
+ global $ttrss_version;
+
+ if (is_array($ttrss_version) && isset($ttrss_version['version'])) {
+ $git_commit = $ttrss_version['commit'];
+ $git_timestamp = $ttrss_version['timestamp'];
+
+ return $ttrss_version['version'];
+ } else {
+ $ttrss_version = [];
+ }
+
+ $ttrss_version['version'] = "UNKNOWN (Unsupported)";
+
+ date_default_timezone_set('UTC');
+ $root_dir = dirname(dirname(__FILE__));
+
+ if ('\\' === DIRECTORY_SEPARATOR) {
+ $ttrss_version['version'] = "UNKNOWN (Unsupported, Windows)";
+ } else if (PHP_OS === "Darwin") {
+ $ttrss_version['version'] = "UNKNOWN (Unsupported, Darwin)";
+ } else if (file_exists("$root_dir/version_static.txt")) {
+ $ttrss_version['version'] = trim(file_get_contents("$root_dir/version_static.txt")) . " (Unsupported)";
+ } else if (is_dir("$root_dir/.git")) {
+ $rc = 0;
+ $output = [];
+
+ $cwd = getcwd();
+
+ chdir($root_dir);
+ exec('git log --pretty='.escapeshellarg('%ct %h').' -n1 HEAD 2>&1', $output, $rc);
+ chdir($cwd);
+
+ if ($rc == 0) {
+ if (is_array($output) && count($output) > 0) {
+ list ($timestamp, $commit) = explode(" ", $output[0], 2);
+
+ $git_commit = $commit;
+ $git_timestamp = $timestamp;
+
+ $ttrss_version['version'] = strftime("%y.%m", $timestamp) . "-$commit";
+ $ttrss_version['commit'] = $commit;
+ $ttrss_version['timestamp'] = $timestamp;
+ }
+ } else {
+ user_error("Unable to determine version (using $root_dir): " . implode("\n", $output), E_USER_WARNING);
+ }
+ }
+
+ return $ttrss_version['version'];
+ }
diff --git a/include/sessions.php b/include/sessions.php
index ca9f169d8..73be1e403 100644
--- a/include/sessions.php
+++ b/include/sessions.php
@@ -7,7 +7,6 @@
require_once "errorhandler.php";
require_once "lib/accept-to-gettext.php";
require_once "lib/gettext/gettext.inc";
- require_once "version.php";
$session_expire = min(2147483647 - time() - 1, max(SESSION_COOKIE_LIFETIME, 86400));
$session_name = (!defined('TTRSS_SESSION_NAME')) ? "ttrss_sid" : TTRSS_SESSION_NAME;
diff --git a/include/version.php b/include/version.php
deleted file mode 100644
index d1c5e03b5..000000000
--- a/include/version.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
- /* for package maintainers who don't use git: if version_static.txt exists in tt-rss root
- directory, its contents are displayed instead of git commit-based version, this could be generated
- based on source git tree commit used when creating the package */
-
- function get_version(&$git_commit = false, &$git_timestamp = false) {
- $version = "UNKNOWN (Unsupported)";
-
- date_default_timezone_set('UTC');
- $root_dir = dirname(dirname(__FILE__));
-
- if (file_exists("$root_dir/version_static.txt")) {
- $version = trim(file_get_contents("$root_dir/version_static.txt")) . " (Unsupported)";
- } else if (is_dir("$root_dir/.git")) {
- $rc = 0;
- $output = [];
-
- exec("git log --pretty='%ct %h' -n1 HEAD " . escapeshellarg($root_dir), $output, $rc);
-
- if ($rc == 0) {
- if (is_array($output) && count($output) > 0) {
- list ($timestamp, $commit) = explode(" ", $output[0], 2);
-
- $git_commit = $commit;
- $git_timestamp = $timestamp;
-
- $version = strftime("%y.%m", $timestamp) . "-$commit";
- }
- }
- }
-
- return $version;
- }
-
- define('VERSION', get_version());
diff --git a/index.php b/index.php
index f7ea6178a..6a22d5471 100644
--- a/index.php
+++ b/index.php
@@ -23,7 +23,6 @@
require_once "sessions.php";
require_once "functions.php";
require_once "sanity_check.php";
- require_once "version.php";
require_once "config.php";
require_once "db-prefs.php";
@@ -40,10 +39,6 @@
<title>Tiny Tiny RSS</title>
<meta name="viewport" content="initial-scale=1,width=device-width" />
- <script type="text/javascript">
- var __ttrss_version = "<?php echo VERSION ?>"
- </script>
-
<?php if ($_SESSION["uid"]) {
$theme = get_pref("USER_CSS_THEME", false, false);
if ($theme && theme_exists("$theme")) {
diff --git a/locale/id/LC_MESSAGES/messages.mo b/locale/id/LC_MESSAGES/messages.mo
index c051daeda..2b401a162 100644
--- a/locale/id/LC_MESSAGES/messages.mo
+++ b/locale/id/LC_MESSAGES/messages.mo
Binary files differ
diff --git a/locale/id/LC_MESSAGES/messages.po b/locale/id/LC_MESSAGES/messages.po
index bf7b41160..ce565c089 100644
--- a/locale/id/LC_MESSAGES/messages.po
+++ b/locale/id/LC_MESSAGES/messages.po
@@ -8,16 +8,14 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-17 15:00+0300\n"
-"PO-Revision-Date: 2019-12-20 04:36+0000\n"
-"Last-Translator: zmni <[email protected]>\n"
-"Language-Team: Indonesian <https://weblate.tt-rss.org/projects/tt-rss/"
-"messages/id/>\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
"Language: id\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Weblate 3.7.1\n"
#: backend.php:58
msgid "Use default"
@@ -1062,7 +1060,7 @@ msgstr ""
#: classes/feeds.php:1386
msgid "Special"
-msgstr "Pengembang bajingan, jangan dipakai!!!"
+msgstr ""
#: classes/feeds.php:1477
#, php-format
diff --git a/plugins/af_comics/init.php b/plugins/af_comics/init.php
index c0e97297d..47e5894a7 100755
--- a/plugins/af_comics/init.php
+++ b/plugins/af_comics/init.php
@@ -110,7 +110,7 @@ class Af_Comics extends Plugin {
$tpl->readTemplateFromFile('templates/generated_feed.txt');
$tpl->setVariable('FEED_TITLE', $feed_title, true);
- $tpl->setVariable('VERSION', VERSION, true);
+ $tpl->setVariable('VERSION', get_version(), true);
$tpl->setVariable('FEED_URL', htmlspecialchars($fetch_url), true);
$tpl->setVariable('SELF_URL', $site_url, true);
diff --git a/prefs.php b/prefs.php
index d75fc5553..7d6962004 100644
--- a/prefs.php
+++ b/prefs.php
@@ -16,7 +16,6 @@
require_once "sessions.php";
require_once "functions.php";
require_once "sanity_check.php";
- require_once "version.php";
require_once "config.php";
require_once "db-prefs.php";
@@ -32,10 +31,6 @@
<title>Tiny Tiny RSS : <?php echo __("Preferences") ?></title>
<meta name="viewport" content="initial-scale=1,width=device-width" />
- <script type="text/javascript">
- var __ttrss_version = "<?php echo VERSION ?>"
- </script>
-
<?php if ($_SESSION["uid"]) {
$theme = get_pref("USER_CSS_THEME", false, false);
if ($theme && theme_exists("$theme")) {
@@ -164,10 +159,7 @@
</div>
<div id="footer" dojoType="dijit.layout.ContentPane" region="bottom">
<a class="text-muted" target="_blank" href="http://tt-rss.org/">
- Tiny Tiny RSS</a>
- <?php if (!defined('HIDE_VERSION')) { ?>
- v<?php echo VERSION ?>
- <?php } ?>
+ Tiny Tiny RSS</a> v<?php echo get_version() ?>
&copy; 2005-<?php echo date('Y') ?>
<a class="text-muted" target="_blank"
href="http://fakecake.org/">Andrew Dolgov</a>
diff --git a/update_daemon2.php b/update_daemon2.php
index 64415964b..300247a17 100755
--- a/update_daemon2.php
+++ b/update_daemon2.php
@@ -8,7 +8,6 @@
define('DISABLE_SESSIONS', true);
- require_once "version.php";
require_once "autoload.php";
require_once "functions.php";
require_once "config.php";