From 7af86452ff241a589bc9077c33c05e05d4d06637 Mon Sep 17 00:00:00 2001
From: Jeena
Date: Sun, 5 Apr 2020 15:29:07 +0200
Subject: [PATCH 1/8] Update setup to run under PHP7
Mostly mysql_ to mysqli_ changes.
---
scripts/database.class.php | 22 ++++++++++++----------
setup.php | 24 +++++++++++++-----------
2 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/scripts/database.class.php b/scripts/database.class.php
index bf804da..2052efa 100644
--- a/scripts/database.class.php
+++ b/scripts/database.class.php
@@ -8,15 +8,16 @@
var $_error = "";
//Konstruktor
- function Query($sql)
+ function __construct($sql)
{
- // Query in der Klasse speichern
- $this->_sql = trim($sql);
- $this->_result = mysql_query($this->_sql);
+ global $mysql;
+ // Query in der Klasse speichern
+ $this->_sql = trim($sql);
+ $this->_result = mysqli_query($mysql, $this->_sql);
if(!$this->_result) {
- $this->_errno = mysql_errno();
- $this->_error = mysql_error();
- }
+ $this->_errno = mysqli_errno($mysql);
+ $this->_error = mysqli_error($mysql);
+ }
}
//Methoden
@@ -46,11 +47,12 @@
}
function fetch() {
+ global $mysql;
if($this->error()) {
echo "An Error has occurred, please check your MySQL-Query.";
$return = null;
}
- else $return = mysql_fetch_assoc($this->_result);
+ else $return = mysqli_fetch_assoc($this->_result);
return $return;
}
@@ -58,13 +60,13 @@
if($this->error()) {
$return = -1;
}
- else $return = mysql_num_rows($this->_result);
+ else $return = mysqli_num_rows($this->_result);
return $return;
}
function free() {
// Speicher freimachen
- mysql_free_result($this->_result);
+ mysqli_free_result($this->_result);
}
}
diff --git a/setup.php b/setup.php
index 4aedf19..e65c58b 100644
--- a/setup.php
+++ b/setup.php
@@ -12,7 +12,7 @@
header("Content-Type: text/html; charset=UTF-8");
- define("JLOG_NEW_VERSION", '1.1.0');
+ define("JLOG_NEW_VERSION", '1.4.0');
define("JLOG_SETUP", true);
define("JLOG_ADMIN", false);
$basepath = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
@@ -50,6 +50,7 @@
define("JLOG_MYSQLV", JLOG_SOFTWARE_MYSQLV);
$errors = array();
+ $mysql = null;
$l['admin']['submit'] = $l['admin']['s_install'];
$setup = new Settings($l);
@@ -111,6 +112,7 @@
function create_mysql_tables($data) {
# returns false if all tables were created, if not returns the $errors array
+ $errors = array();
$sql['content'] = '
CREATE TABLE `'.$data['jlog_db_prefix'].'content` (
@@ -128,7 +130,7 @@
section varchar(10) default \'weblog\',
UNIQUE KEY id (id),
FULLTEXT KEY content_index (content, topic, teaser, keywords)
- ) TYPE=MyISAM CHARACTER SET utf8;';
+ ) CHARACTER SET utf8;';
$sql['comments'] = '
CREATE TABLE `'.$data["jlog_db_prefix"].'comments` (
@@ -146,7 +148,7 @@
PRIMARY KEY (id),
UNIQUE KEY sid (sid),
FULLTEXT KEY comments_index ( name, city, email, homepage, content )
- ) TYPE=MyISAM CHARACTER SET utf8;';
+ ) CHARACTER SET utf8;';
$sql['categories'] = '
CREATE TABLE `'.$data["jlog_db_prefix"].'categories` (
@@ -156,13 +158,13 @@
description text,
UNIQUE KEY id (id),
UNIQUE KEY url (url)
- ) TYPE=MyISAM CHARACTER SET utf8;';
+ ) CHARACTER SET utf8;';
$sql['catassign'] = '
CREATE TABLE `'.$data["jlog_db_prefix"].'catassign` (
content_id int(11),
cat_id tinyint(4)
- ) TYPE=MyISAM CHARACTER SET utf8;';
+ ) CHARACTER SET utf8;';
$sql['attributes'] = '
CREATE TABLE `'.$data["jlog_db_prefix"].'attributes` (
@@ -172,13 +174,13 @@
value varchar(250) NOT NULL default \'\',
PRIMARY KEY (id),
KEY entry_id (entry_id)
- ) TYPE=MyISAM CHARACTER SET utf8;';
+ ) CHARACTER SET utf8;';
global $l;
-
- if(!@mysql_connect($data['jlog_db_url'], $data['jlog_db_user'], $data['jlog_db_pwd'])) $errors[] = "Falsche Zugangsdaten | ".mysql_error();
- elseif(!@mysql_select_db($data['jlog_db'])) $errors[] = "Datenbank ".$data['jlog_db']." extistiert nicht".mysql_error();
- elseif(!version_compare(mysql_get_server_info(), JLOG_MYSQLV, ">=") == 1) $errors[] = $l['admin']['s_mysqlv_tolow'];
+ global $mysql;
+ if(!($mysql = @mysqli_connect($data['jlog_db_url'], $data['jlog_db_user'], $data['jlog_db_pwd'], $data['jlog_db']))) $errors[] = "Falsche Zugangsdaten | ".mysqli_error($mysql);
+ elseif(!@mysqli_select_db($mysql, $data['jlog_db'])) $errors[] = "Datenbank ".$data['jlog_db']." extistiert nicht".mysqli_error($connect);
+ elseif(!version_compare(mysqli_get_server_info($mysql), JLOG_MYSQLV, ">=") == 1) $errors[] = $l['admin']['s_mysqlv_tolow'];
else {
new Query("SET NAMES utf8");
$create['content'] = new Query($sql['content']);
@@ -265,7 +267,7 @@
-
SETUP
+
SETUP
'.$content.'
From 23c3d3b65bdb2c48e7f50351a14026685319dd0c Mon Sep 17 00:00:00 2001
From: Jeena
Date: Sun, 5 Apr 2020 17:42:46 +0200
Subject: [PATCH 2/8] Update log and admin to work with PHP v 7.2
Mostly changing mysql_ to mysqli_ but also some OOP fixes it classes,
especially the bbcode parser which doesn't have a new version working
with PHP 7.
---
admin/blog.func.php | 3 ++-
log.php | 3 ++-
scripts/general.func.php | 3 ++-
scripts/mail.class.php | 2 +-
scripts/prepend.inc.php | 21 +++++++++------------
scripts/stringparser.class.php | 10 +++++-----
scripts/update.php | 2 +-
7 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/admin/blog.func.php b/admin/blog.func.php
index 052d518..abf6019 100644
--- a/admin/blog.func.php
+++ b/admin/blog.func.php
@@ -179,7 +179,8 @@ global $l, $plugins;
'".$form_input['allowpingback']."' );";
$writeblog = new Query($sql);
- $id = mysql_insert_id();
+global $mysql;
+ $id = mysqli_insert_id($mysql);
if($writeblog->error()) {
echo "\n";
echo $writeblog->getError();
diff --git a/log.php b/log.php
index b0b48f5..f085659 100644
--- a/log.php
+++ b/log.php
@@ -149,7 +149,8 @@ elseif(isset($com_form['form_submitted']) AND $com_form['form_submitted'] == $l[
)";
$newcomment = new Query($sql);
- $cid = mysql_insert_id();
+global $mysql;
+ $cid = mysqli_insert_id($mysql);
if($newcomment->error()) {
if($newcomment->getErrno() == 1062) {
$errors[] = $l['comments_duplicate'];
diff --git a/scripts/general.func.php b/scripts/general.func.php
index 406ece1..7efd4f0 100644
--- a/scripts/general.func.php
+++ b/scripts/general.func.php
@@ -88,10 +88,11 @@ function strip($_data) {
}
// escape input for mysql
function escape_for_mysql($_data) {
+global $mysql;
if (is_array($_data))
foreach($_data as $key => $val) $_data[$key] = escape_for_mysql($val);
else
- $_data = mysql_real_escape_string($_data);
+ $_data = mysqli_real_escape_string($mysql, $_data);
// uses last opened MySQL link implicitly
// assumption is valid because this function is never called
// before mysql_connect
diff --git a/scripts/mail.class.php b/scripts/mail.class.php
index 6bada54..8743bb3 100644
--- a/scripts/mail.class.php
+++ b/scripts/mail.class.php
@@ -63,7 +63,7 @@ class Jlog_Mail
* Jlog_Mail() - constructor
*
*/
- function Jlog_Mail()
+ function __construct()
{
# XXX don't know if needed
mb_internal_encoding('UTF-8');
diff --git a/scripts/prepend.inc.php b/scripts/prepend.inc.php
index dcf0280..7a3b532 100644
--- a/scripts/prepend.inc.php
+++ b/scripts/prepend.inc.php
@@ -25,6 +25,8 @@
// load settings and version information
error_reporting(E_ALL ^ E_NOTICE);
+ini_set('display_errors', 1);
+
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR."personal".DIRECTORY_SEPARATOR."settings.inc.php");
require_once(JLOG_BASEPATH."scripts".DIRECTORY_SEPARATOR."version.inc.php");
@@ -62,20 +64,15 @@ require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'comments.php');
if(defined('JLOG_ADMIN')) require_once(JLOG_BASEPATH.'lang'.DIRECTORY_SEPARATOR.'lang-admin.'.JLOG_LANGUAGE.'.inc.php');
// connect to database
-$connect = @mysql_connect(JLOG_DB_URL, JLOG_DB_USER, JLOG_DB_PWD);
-if ($connect == FALSE) {
- mail(JLOG_EMAIL, $l['admin']['e_db'], $l['admin']['e_db_is']."\n".mysql_error());
- die("".$l['db_error']." ".$l['plz_try_again'].".");
-}
-// select our database
-$select = @mysql_select_db(JLOG_DB);
-if ($connect == FALSE) {
- mail(JLOG_EMAIL, $l['admin']['e_db'], $l['admin']['e_db_is']."\n".mysql_error());
+$mysql = @mysqli_connect(JLOG_DB_URL, JLOG_DB_USER, JLOG_DB_PWD, JLOG_DB);
+if ($mysql == FALSE) {
+ mail(JLOG_EMAIL, $l['admin']['e_db'], $l['admin']['e_db_is']."\n".mysqli_error($mysql));
die("".$l['db_error']." ".$l['plz_try_again'].".");
}
+
// do some settings
-@mysql_query("SET NAMES utf8");
-@mysql_query("SET sql_mode=''");
+@mysqli_query($mysql, "SET NAMES utf8");
+@mysqli_query($mysql, "SET sql_mode=''");
// some more code that needs to run for every page - however, this
// code requires an established connection to the database
@@ -88,4 +85,4 @@ $plugins = new JlogPluginManager(JLOG_BASEPATH.'plugins'.DIRECTORY_SEPARATOR);
$bbcode = $plugins->callHook('bbcode', $bbcode);
$bbcomments = $plugins->callHook('bbcomments', $bbcomments);
-// eof
\ No newline at end of file
+// eof
diff --git a/scripts/stringparser.class.php b/scripts/stringparser.class.php
index 46f78f3..939bed8 100644
--- a/scripts/stringparser.class.php
+++ b/scripts/stringparser.class.php
@@ -199,7 +199,7 @@ class StringParser {
*
* @access public
*/
- function StringParser () {
+ function __construct () {
}
/**
@@ -910,7 +910,7 @@ class StringParser_Node {
* occurred at. If not determinable, it is -1.
* @global __STRINGPARSER_NODE_ID
*/
- function StringParser_Node ($occurredAt = -1) {
+ function __constructor ($occurredAt = -1) {
$this->_id = $GLOBALS['__STRINGPARSER_NODE_ID']++;
$this->occurredAt = $occurredAt;
}
@@ -1248,7 +1248,7 @@ class StringParser_Node {
* @param object $node The node to destroy
* @return bool True on success, else false.
*/
- function destroyNode (&$node) {
+ static function destroyNode (&$node) {
if ($node === null) {
return false;
}
@@ -1486,8 +1486,8 @@ class StringParser_Node_Text extends StringParser_Node {
* occurred at. If not determinable, it is -1.
* @see StringParser_Node_Text::content
*/
- function StringParser_Node_Text ($content, $occurredAt = -1) {
- parent::StringParser_Node ($occurredAt);
+ function __construct ($content, $occurredAt = -1) {
+# parent::__construct ($occurredAt);
$this->content = $content;
}
diff --git a/scripts/update.php b/scripts/update.php
index 3b86e05..25c62f8 100644
--- a/scripts/update.php
+++ b/scripts/update.php
@@ -1,6 +1,6 @@
Date: Sun, 5 Apr 2020 18:04:00 +0200
Subject: [PATCH 3/8] Change version number to 1.2.0
---
scripts/version.inc.php | 6 +++---
setup.php | 1 -
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/scripts/version.inc.php b/scripts/version.inc.php
index 23677aa..b5df26c 100644
--- a/scripts/version.inc.php
+++ b/scripts/version.inc.php
@@ -23,9 +23,9 @@
* $Date: 2009-01-13 21:58:12 +0100 (Tis, 13 Jan 2009) $
*/
-define('JLOG_SOFTWARE_VERSION', '1.1.3');
-define('JLOG_SOFTWARE_URL', 'http://jeenaparadies.net/projects/jlog');
+define('JLOG_SOFTWARE_VERSION', '1.2.0');
+define('JLOG_SOFTWARE_URL', 'https://github.com/jeena/jlog/');
define('JLOG_SOFTWARE_PHPV', '4.1.1');
define('JLOG_SOFTWARE_MYSQLV', '4.1.0');
-// eof
\ No newline at end of file
+// eof
diff --git a/setup.php b/setup.php
index e65c58b..08a4d2d 100644
--- a/setup.php
+++ b/setup.php
@@ -12,7 +12,6 @@
header("Content-Type: text/html; charset=UTF-8");
- define("JLOG_NEW_VERSION", '1.4.0');
define("JLOG_SETUP", true);
define("JLOG_ADMIN", false);
$basepath = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
From 2ce42038de0f24cf4c258ba4f43c3cec3f0c7f67 Mon Sep 17 00:00:00 2001
From: Jeena
Date: Sun, 5 Apr 2020 20:28:24 +0200
Subject: [PATCH 4/8] Create a update precedure from 1.1.3 to 1.2.0
---
scripts/JlogUpdater.php | 3 +-
scripts/categories.class.php | 2 +-
scripts/general.func.php | 4 +--
scripts/jlogPlugins.class.php | 54 +++++++++++++++++------------------
scripts/prepend.inc.php | 2 +-
scripts/update/113To120.php | 15 ++++++++++
setup.php | 2 +-
7 files changed, 49 insertions(+), 33 deletions(-)
create mode 100644 scripts/update/113To120.php
diff --git a/scripts/JlogUpdater.php b/scripts/JlogUpdater.php
index cfd878b..545bb1e 100644
--- a/scripts/JlogUpdater.php
+++ b/scripts/JlogUpdater.php
@@ -13,7 +13,8 @@ class JlogUpdater
'1.0.2' => '1.1.0',
'1.1.0' => '1.1.1',
'1.1.1' => '1.1.2',
- '1.1.2' => '1.1.3'
+ '1.1.2' => '1.1.3',
+ '1.1.3' => '1.2.0'
);
function JlogUpdater()
diff --git a/scripts/categories.class.php b/scripts/categories.class.php
index 0adf1e6..421713d 100644
--- a/scripts/categories.class.php
+++ b/scripts/categories.class.php
@@ -6,7 +6,7 @@ class Categories {
var $categories = array();
var $l = array();
- function Categories($l) {
+ function __construct($l) {
$this->l = $l;
diff --git a/scripts/general.func.php b/scripts/general.func.php
index 7efd4f0..fd6a4ce 100644
--- a/scripts/general.func.php
+++ b/scripts/general.func.php
@@ -27,7 +27,7 @@ function archive() {
// get year links
class Year_Links {
- function Year_Links($get, $start, $page, $l, $cat="") {
+ function __construct($get, $start, $page, $l, $cat="") {
$date = getdate();
$this->_now = $date['year'];
$this->_start = $start;
@@ -296,7 +296,7 @@ function my_serialize_cfg($arg) {
class JLOG_Tags {
var $tree = array();
- function JLOG_Tags($body) {
+ function __construct($body) {
preg_match_all('/]*)\/?>(<\/(\1):(\2)>)?/ims', $body, $this->tree);
}
diff --git a/scripts/jlogPlugins.class.php b/scripts/jlogPlugins.class.php
index 578f87c..e5d8201 100644
--- a/scripts/jlogPlugins.class.php
+++ b/scripts/jlogPlugins.class.php
@@ -4,38 +4,38 @@
class JlogPlugin {
/* Hooks */
- function hook_body ($t) { return $t; } // string body
- function hook_commentForm ($t) { return $t; } // string with comment form output + array with form data
- function hook_adminContent ($t) { return $t; } // string content
- function hook_newComment ($t) { return $t; } // array form data
- function hook_updateComment ($t) { return $t; } // array form data
- function hook_deleteComment ($t) { return $t; } // string comment id
- function hook_showComment ($t) { return $t; } // string comment output
- function hook_onUpdate ($t) { return $t; } // array with all rss feeds and sub
- function hook_doEntry ($t) { return $t; } // string with entry + array with data from database + string count comments + string section
- function hook_doTeaser ($t) { return $t; } // string with entry + array with data from database + string count comments + string pre + string post
- function hook_bbcode ($t) { return $t; } // bbcode object
- function hook_bbcomments ($t) { return $t; } // bbcomments object
- function hook_adminForm ($t) { return $t; } // admin formular
- function hook_insertEntry ($t) { return $t; } // int id + array with form data
- function hook_updateEntry ($t) { return $t; } // int id + array with form data
- function hook_permalink ($t) { return $t; } // string permalink + string date + string url + string section
- function hook_xmlrpcPermalink ($t) { return $t; } // string url
- function hook_countComments ($t) { return $t; } // array with id and count
- function hook_adminMail ($t) { return $t; } // array with mail + array blogentry
- function hook_commentorMail ($t) { return $t; } // array with mail + array blogentry
- function hook_commentAdminList($t) { return $t; } // string with actual tr + array with comment data
- function hook_previewComment ($t) { return $t; } // same as newComment
- function hook_dispatchLogin ($t) { return $t; } //
- function hook_loginForm ($t) { return $t; } //
- function hook_adminMenu ($t) { return $t; } // string with the admin menu html
- function hook_adminList ($t) { return $t; } //
+ function hook_body ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // string body
+ function hook_commentForm ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // string with comment form output + array with form data
+ function hook_adminContent ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // string content
+ function hook_newComment ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // array form data
+ function hook_updateComment ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // array form data
+ function hook_deleteComment ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // string comment id
+ function hook_showComment ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // string comment output
+ function hook_onUpdate ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // array with all rss feeds and sub
+ function hook_doEntry ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // string with entry + array with data from database + string count comments + string section
+ function hook_doTeaser ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // string with entry + array with data from database + string count comments + string pre + string post
+ function hook_bbcode ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // bbcode object
+ function hook_bbcomments ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // bbcomments object
+ function hook_adminForm ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // admin formular
+ function hook_insertEntry ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // int id + array with form data
+ function hook_updateEntry ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // int id + array with form data
+ function hook_permalink ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // string permalink + string date + string url + string section
+ function hook_xmlrpcPermalink ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // string url
+ function hook_countComments ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // array with id and count
+ function hook_adminMail ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // array with mail + array blogentry
+ function hook_commentorMail ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // array with mail + array blogentry
+ function hook_commentAdminList($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // string with actual tr + array with comment data
+ function hook_previewComment ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // same as newComment
+ function hook_dispatchLogin ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } //
+ function hook_loginForm ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } //
+ function hook_adminMenu ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } // string with the admin menu html
+ function hook_adminList ($t, $a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { return $t; } //
}
class JlogPluginManager {
var $plugins = array();
- function JlogPluginManager($plugindirectory) {
+ function __construct($plugindirectory) {
$handle = "";
$file = "";
$this->get = strip($_GET);
diff --git a/scripts/prepend.inc.php b/scripts/prepend.inc.php
index 7a3b532..8d2b6e0 100644
--- a/scripts/prepend.inc.php
+++ b/scripts/prepend.inc.php
@@ -66,7 +66,7 @@ if(defined('JLOG_ADMIN')) require_once(JLOG_BASEPATH.'lang'.DIRECTORY_SEPARATOR.
// connect to database
$mysql = @mysqli_connect(JLOG_DB_URL, JLOG_DB_USER, JLOG_DB_PWD, JLOG_DB);
if ($mysql == FALSE) {
- mail(JLOG_EMAIL, $l['admin']['e_db'], $l['admin']['e_db_is']."\n".mysqli_error($mysql));
+ mail(JLOG_EMAIL, $l['admin']['e_db'], $l['admin']['e_db_is']."\n".mysqli_connect_error());
die("".$l['db_error']." ".$l['plz_try_again'].".");
}
diff --git a/scripts/update/113To120.php b/scripts/update/113To120.php
new file mode 100644
index 0000000..0372d7b
--- /dev/null
+++ b/scripts/update/113To120.php
@@ -0,0 +1,15 @@
+Bitte beachten Sie, dass nach Durchführung dieses Updates eventuell einzelne Plugins nicht mehr funktionieren. '
+ . 'Kontaktieren Sie in einem solchen Fall den Plugin-Autor bzzgl. eines Updates für das Plugin.
';
+ }
+
+ function performUpdate($l, $settings)
+ {
+ return true;
+ }
+}
diff --git a/setup.php b/setup.php
index 08a4d2d..2f1cf57 100644
--- a/setup.php
+++ b/setup.php
@@ -177,7 +177,7 @@
global $l;
global $mysql;
- if(!($mysql = @mysqli_connect($data['jlog_db_url'], $data['jlog_db_user'], $data['jlog_db_pwd'], $data['jlog_db']))) $errors[] = "Falsche Zugangsdaten | ".mysqli_error($mysql);
+ if(!($mysql = @mysqli_connect($data['jlog_db_url'], $data['jlog_db_user'], $data['jlog_db_pwd'], $data['jlog_db']))) $errors[] = "Falsche Zugangsdaten | ".mysqli_connect_error();
elseif(!@mysqli_select_db($mysql, $data['jlog_db'])) $errors[] = "Datenbank ".$data['jlog_db']." extistiert nicht".mysqli_error($connect);
elseif(!version_compare(mysqli_get_server_info($mysql), JLOG_MYSQLV, ">=") == 1) $errors[] = $l['admin']['s_mysqlv_tolow'];
else {
From ca31135c3604550cf0000d109952ece5037fad9d Mon Sep 17 00:00:00 2001
From: Heiko August
Date: Mon, 27 Apr 2020 08:37:48 +0200
Subject: [PATCH 5/8] Change: add lang attribute to the main template, to the
language files and to the processing scripts
---
index.php | 7 ++++---
lang/lang.de.inc.php | 1 +
lang/lang.en.inc.php | 1 +
lang/lang.it.inc.php | 1 +
lang/lang.pl.inc.php | 1 +
lang/lang.sv.inc.php | 3 ++-
personal/template.tpl | 2 +-
scripts/do_template.php | 2 ++
8 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/index.php b/index.php
index d2453e8..c31e40c 100644
--- a/index.php
+++ b/index.php
@@ -29,9 +29,10 @@
}
require_once('.'.DIRECTORY_SEPARATOR.'scripts'.DIRECTORY_SEPARATOR.'prepend.inc.php');
- $c['meta']['robots'] = "noindex, follow";
- $c['meta']['description'] = htmlspecialchars(strip_tags(str_replace("\n", '', JLOG_DESCRIPTION)), ENT_QUOTES);
- $c['meta']['title'] = $l['index_topic'];
+ $c['meta']['robots'] = "noindex, follow";
+ $c['meta']['description'] = htmlspecialchars(strip_tags(str_replace("\n", '', JLOG_DESCRIPTION)), ENT_QUOTES);
+ $c['meta']['title'] = $l['index_topic'];
+ $c['meta']['html_language'] = $l['html_language'];
$c['main'] = "";
$cc = array();
diff --git a/lang/lang.de.inc.php b/lang/lang.de.inc.php
index b614caa..efb2805 100644
--- a/lang/lang.de.inc.php
+++ b/lang/lang.de.inc.php
@@ -86,6 +86,7 @@
"err404_message" => "Diese Seite existiert leider nicht. Versuchen Sie sie über die Suchfunktion zu finden.",
"language" => "de-de",
+"html_language" => "de",
"locale" => array('de_DE.UTF-8', 'de_DE.UTF-8@euro', 'de_DE'),
"date_format" => "%d. %B %Y um %H:%M Uhr",
"date_format_comment" => "%d.%m.%Y",
diff --git a/lang/lang.en.inc.php b/lang/lang.en.inc.php
index 49ce8d6..9b6abf2 100644
--- a/lang/lang.en.inc.php
+++ b/lang/lang.en.inc.php
@@ -86,6 +86,7 @@
"err404_message" => "There is no such page. Please try the search engine on this page.",
"language" => "en-gb",
+"html_language" => "en",
"locale" => array( "en_US", "us", "verUS" ),
"date_format" => "%d. %B %Y um %H:%M Uhr",
"date_format_comment" => "%d.%m.%Y",
diff --git a/lang/lang.it.inc.php b/lang/lang.it.inc.php
index 692aea7..0e84224 100644
--- a/lang/lang.it.inc.php
+++ b/lang/lang.it.inc.php
@@ -86,6 +86,7 @@
"err404_message" => "Non ci sono file riguardanti la ricerca in questa pagina. Perfavore prova a usare il motore di ricerca di questa pagina.",
"language" => "it-it",
+"html_language" => "it",
"locale" => array( "it_IT", "it" ),
"date_format" => "%d. %B %Y alle %H:%M",
"date_format_comment" => "%d.%m.%Y",
diff --git a/lang/lang.pl.inc.php b/lang/lang.pl.inc.php
index 94f5ef6..b5aefef 100644
--- a/lang/lang.pl.inc.php
+++ b/lang/lang.pl.inc.php
@@ -85,6 +85,7 @@
"err404_message" => "Nie ma takiej strony. Prosze użyć przeglądarki na tej stronie.",
"language" => "en-gb",
+"html_language" => "pl",
"locale" => array( "en_US", "us", "verUS" ),
"date_format" => "%d. %B %Y um %H:%M Uhr",
"date_format_comment" => "%d.%m.%Y",
diff --git a/lang/lang.sv.inc.php b/lang/lang.sv.inc.php
index 2213030..8f07b46 100644
--- a/lang/lang.sv.inc.php
+++ b/lang/lang.sv.inc.php
@@ -85,7 +85,8 @@
"err404_topic" => "Error 404 - Sidan hittades inte",
"err404_message" => "Denna sida existerar tyvärr inte. Försök hitta den genom sökfunktionen.",
-"language" => "sv-se",
+"language" => "sv-se",
+"html_language" => "sv",
"locale" => array('sv_SE', 'sve_sve'),
"date_format" => "%Y-%B-%d kl %H:%M",
"date_format_comment" => "%Y-%m-%d",
diff --git a/personal/template.tpl b/personal/template.tpl
index d07b1c4..a20f4eb 100644
--- a/personal/template.tpl
+++ b/personal/template.tpl
@@ -1,5 +1,4 @@
-
-
@@ -33,6 +32,7 @@
+
diff --git a/scripts/do_template.php b/scripts/do_template.php
index b61bea6..0c86fe1 100644
--- a/scripts/do_template.php
+++ b/scripts/do_template.php
@@ -54,6 +54,7 @@ if(defined('JLOG_ADMIN')) {
$_search = array (
" ",
+ " ",
" ",
" ",
" ",
@@ -81,6 +82,7 @@ $_search = array (
$_replace = array (
$l['language'],
+ $l['html_language'],
htmlspecialchars(JLOG_WEBSITE, ENT_QUOTES),
htmlspecialchars($c['meta']['title']),
$c['meta']['aditionalheader'],
From b13bfd52bb39c4c6da53143848faa7e0ec10855f Mon Sep 17 00:00:00 2001
From: Heiko August
Date: Mon, 27 Apr 2020 11:16:16 +0200
Subject: [PATCH 6/8] Change: change main template to HTML5
- semantic HTML5-elements in the main template
- matching selectors for screen.css and print.css (no change of rules)
---
personal/css/print.css | 6 ++--
personal/css/screen.css | 16 ++++-----
personal/template.tpl | 79 ++++++++++++++++++++++-------------------
3 files changed, 53 insertions(+), 48 deletions(-)
diff --git a/personal/css/print.css b/personal/css/print.css
index ec681cd..63de6f4 100644
--- a/personal/css/print.css
+++ b/personal/css/print.css
@@ -3,7 +3,7 @@
*/
/* -- hide -- */
- #subnav, .skip, .entryform, .hidecomments, #entryform, hr { display: none; }
+ aside, #subnav, .skip, .entryform, .hidecomments, #entryform, hr { display: none; }
/* -- main settings -- */
body { font-family: Georgia, "Times New Roman", Times, serif; }
@@ -12,8 +12,8 @@
/* -- links -- */
a { text-decoration: none; }
- #main a:after { font-size: 70%; content:" <"attr(href)">"; }
- #main .meta a:after, #main h2 a:after { content:""; }
+ main a:after { font-size: 70%; content:" <"attr(href)">"; }
+ main .meta a:after, main h2 a:after { content:""; }
/* -- comments -- */
ul#commentslist { list-style-type: none; }
diff --git a/personal/css/screen.css b/personal/css/screen.css
index 4b9600e..4bd6e8c 100644
--- a/personal/css/screen.css
+++ b/personal/css/screen.css
@@ -26,7 +26,7 @@
border-top: 0;
position: relative;
}
- #main {
+ main {
margin: 0 0 0 25px;
padding: 190px 0 2em 0;
width: 64.5%;
@@ -34,7 +34,7 @@
}
/* Clearfix-Hack */
- #main:after {
+ main:after {
content: ".";
display: block;
height: 0;
@@ -42,11 +42,11 @@
visibility: hidden;
}
- #main {display: inline-table;}
+ main {display: inline-table;}
/* Hides from IE-mac \*/
- * html #main {height: 1%;}
- #main {display: block;}
+ * html main {height: 1%;}
+ main {display: block;}
/* End hide from IE-mac */
/* -- logo -- */
@@ -98,7 +98,7 @@
.rss img { vertical-align: middle; border: 0; width: 94px; height: 15px; }
/* -- footer -- */
- #footer {
+ footer {
clear: both;
height: 60px;
background: url(img/footer.png) no-repeat top center;
@@ -132,13 +132,13 @@
/* -- pictures -- */
.fl { float: left; margin: 0 1em 1em 0; }
.fr { float: right; margin: 0 0 1em 1em; }
- #main img, dl.img {
+ main img, dl.img {
border: 1px solid #aaa;
padding: 2px;
max-width: 95%;
}
dl.img dt { padding: 0; margin: 0;}
- #main dl.img dt img { margin: 0; padding: 0; max-width: 100%; border: none; }
+ main dl.img dt img { margin: 0; padding: 0; max-width: 100%; border: none; }
dl.img dd { margin: 0; padding: 0 0.3em; font-size: 90%; }
.teaser { clear: both; }
diff --git a/personal/template.tpl b/personal/template.tpl
index a20f4eb..6096758 100644
--- a/personal/template.tpl
+++ b/personal/template.tpl
@@ -1,40 +1,45 @@
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- .
-
-
-
-
-
-
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ .
+
+
+
+
+
+
+
+
+
+
-
-
-
+
From f9d6025a756352e2c1e461adcb2b7dc606eb02c1 Mon Sep 17 00:00:00 2001
From: Heiko August
Date: Mon, 27 Apr 2020 11:23:48 +0200
Subject: [PATCH 7/8] Change: replace inputs of type submit with button
elements
Attributes 'type="submit"' got removed because it's the default type.
Therefore the attribute can be omitted.
---
admin/login.php | 2 +-
admin/media/select-picture.php | 2 +-
admin/media/upload-picture.php | 4 ++--
admin/media/upload-teaser.php | 2 +-
error404.php | 2 +-
personal/template.tpl | 2 +-
plugins/CommentCloser.jplug.php | 2 +-
scripts/JlogUpdater.php | 2 +-
search.php | 2 +-
9 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/admin/login.php b/admin/login.php
index f288259..deeb7b5 100644
--- a/admin/login.php
+++ b/admin/login.php
@@ -63,7 +63,7 @@ $c['main'] = '
-
+ ' . htmlspecialchars($l['admin']['login_send']) . '
';
diff --git a/admin/media/select-picture.php b/admin/media/select-picture.php
index a0ef43f..a2b42e2 100644
--- a/admin/media/select-picture.php
+++ b/admin/media/select-picture.php
@@ -25,7 +25,7 @@ if($_GET['p']) { ?>
-
+
-
+
">
-
+
">
-
+
".$l['err404_topic']."\n".$l['err404_message']."
";
$c['main'] .= ' ';
require(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'do_template.php');
diff --git a/personal/template.tpl b/personal/template.tpl
index 6096758..21033e6 100644
--- a/personal/template.tpl
+++ b/personal/template.tpl
@@ -22,7 +22,7 @@
diff --git a/plugins/CommentCloser.jplug.php b/plugins/CommentCloser.jplug.php
index a443d7b..6994dea 100644
--- a/plugins/CommentCloser.jplug.php
+++ b/plugins/CommentCloser.jplug.php
@@ -91,7 +91,7 @@ EOT;
$output .= <<
- .
+schließen
Nach der angegeben Zeit können Beiträge nicht mehr kommentiert werden.
EOT;
diff --git a/scripts/JlogUpdater.php b/scripts/JlogUpdater.php
index cfd878b..9194840 100644
--- a/scripts/JlogUpdater.php
+++ b/scripts/JlogUpdater.php
@@ -52,7 +52,7 @@ class JlogUpdater
$html .= $class->getForm($l);
$version = $this->versions[$version];
}
- $html .= '
';
+ $html .= '' . htmlspecialchars($l['admin']['update_start']) . '
';
$html .= '';
return $html;
}
diff --git a/search.php b/search.php
index 0f95136..9a2d10a 100644
--- a/search.php
+++ b/search.php
@@ -9,7 +9,7 @@
$c['main'] .= '
';
From 1c4ab9ba44e9d8adef6930d4303a0b3733889449 Mon Sep 17 00:00:00 2001
From: Heiko August
Date: Mon, 27 Apr 2020 13:34:40 +0200
Subject: [PATCH 8/8] Fix: provide an array where the code expects one
The function output_form in categories.class.php expects an array in $form_input. When the function get called to create the form for a new category, the function call provided an emptry string. This led to a warning since PHP 5.4 because of type mismatch. Providing an array prevents this error. This is the only pace, I found the error.
---
admin/categories.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/admin/categories.php b/admin/categories.php
index 504579b..d7f485a 100644
--- a/admin/categories.php
+++ b/admin/categories.php
@@ -25,7 +25,7 @@
$c['main'] .= $categories->output_form($form_input, 'new', $l['admin']['cat_new']);
}
}
- else $c['main'] .= $categories->output_form('', 'new', $l['admin']['cat_new']);
+ else $c['main'] .= $categories->output_form(array('id' => NULL, 'name' => NULL, 'url' => NULL, 'description' => NULL), 'new', $l['admin']['cat_new']);
break;
case 'change':