aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/dblayer/functions_pdo-sqlite.inc.php17
-rw-r--r--include/dblayer/functions_pgsql.inc.php15
-rw-r--r--include/dblayer/functions_sqlite.inc.php15
-rw-r--r--include/functions_user.inc.php2
4 files changed, 47 insertions, 2 deletions
diff --git a/include/dblayer/functions_pdo-sqlite.inc.php b/include/dblayer/functions_pdo-sqlite.inc.php
index bc782074a..d59e3b510 100644
--- a/include/dblayer/functions_pdo-sqlite.inc.php
+++ b/include/dblayer/functions_pdo-sqlite.inc.php
@@ -21,7 +21,7 @@
// | USA. |
// +-----------------------------------------------------------------------+
-define('REQUIRED_PDO-SQLITE_VERSION', '3.0.0');
+define('REQUIRED_PDO_SQLITE_VERSION', '3.0.0');
define('DB_ENGINE', 'SQLite');
define('DB_REGEX_OPERATOR', 'REGEXP');
@@ -55,6 +55,21 @@ function pwg_db_connect($host, $user, $password, $database)
return $link;
}
+function pwg_db_check_version()
+{
+ $current_version = pwg_get_db_version();
+ if (version_compare($current_version, REQUIRED_PDO_SQLITE_VERSION, '<'))
+ {
+ fatal_error(
+ sprintf(
+ 'your database version is too old, you have "%s" and you need at least "%s"',
+ $current_version,
+ REQUIRED_PDO_SQLITE_VERSION
+ )
+ );
+ }
+}
+
function pwg_db_check_charset()
{
return true;
diff --git a/include/dblayer/functions_pgsql.inc.php b/include/dblayer/functions_pgsql.inc.php
index df1ce2649..5e05fb16a 100644
--- a/include/dblayer/functions_pgsql.inc.php
+++ b/include/dblayer/functions_pgsql.inc.php
@@ -60,6 +60,21 @@ function pwg_db_connect($host, $user, $password, $database)
}
}
+function pwg_db_check_version()
+{
+ $current_version = pwg_get_db_version();
+ if (version_compare($current_version, REQUIRED_PGSQL_VERSION, '<'))
+ {
+ fatal_error(
+ sprintf(
+ 'your database version is too old, you have "%s" and you need at least "%s"',
+ $current_version,
+ REQUIRED_PGSQL_VERSION
+ )
+ );
+ }
+}
+
function pwg_db_check_charset()
{
return true;
diff --git a/include/dblayer/functions_sqlite.inc.php b/include/dblayer/functions_sqlite.inc.php
index 48bb5fd89..5c8f76a9c 100644
--- a/include/dblayer/functions_sqlite.inc.php
+++ b/include/dblayer/functions_sqlite.inc.php
@@ -64,6 +64,21 @@ function pwg_db_connect($host, $user, $password, $database)
return $link;
}
+function pwg_db_check_version()
+{
+ $current_version = pwg_get_db_version();
+ if (version_compare($current_version, REQUIRED_SQLITE_VERSION, '<'))
+ {
+ fatal_error(
+ sprintf(
+ 'your database version is too old, you have "%s" and you need at least "%s"',
+ $current_version,
+ REQUIRED_SQLITE_VERSION
+ )
+ );
+ }
+}
+
function pwg_db_check_charset()
{
return true;
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 41c97d0bb..4d755c445 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -298,7 +298,7 @@ SELECT ui.*, uc.*, t.name AS theme_name
LEFT JOIN '.THEMES_TABLE.' AS t ON t.id = ui.theme
WHERE ui.user_id = \''.$user_id.'\'';
$result = pwg_query($query);
- if (pwg_db_num_rows($result) > 0)
+ if ($result)
{
break;
}