From 50913be7b7375411dfd454e9e6cf373493874b35 Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Tue, 12 Oct 2010 12:38:13 +0000 Subject: [PATCH] * PDO-SQLite patches by nth --- docs/NEWS | 2 ++ include/admin/category.inc.php | 2 +- include/db/db.inc.php | 1 + include/db/pdo-sqlite.inc.php | 15 +-------------- include/functions_entries.inc.php | 8 ++++---- include/functions_installer.inc.php | 2 +- .../serendipity_plugin_statistics.php | 2 +- 7 files changed, 11 insertions(+), 21 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index eb77d983..d18ef819 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,8 @@ Version 1.6 () ------------------------------------------------------------------------ + * PDO-SQLite patches by nth + * Fix newline before $v) { - $frow[$i] = $v; - $i++; - } - } - - return $frow; + return $newrow; } /** diff --git a/include/functions_entries.inc.php b/include/functions_entries.inc.php index 9de1d63d..425f7937 100644 --- a/include/functions_entries.inc.php +++ b/include/functions_entries.inc.php @@ -770,7 +770,7 @@ function &serendipity_searchEntries($term, $limit = '', $searchresults = '') { } else { $cond['find_part'] = "(title ILIKE '%$term%' OR body ILIKE '%$term%' OR extended ILIKE '%$term%')"; } - } elseif ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3') { + } elseif ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3' || $serendipity['dbType'] == 'pdo-sqlite') { // Very extensive SQLite search. There currently seems no other way to perform fulltext search in SQLite // But it's better than no search at all :-D $term = str_replace('*', '%', $term); @@ -867,7 +867,7 @@ function &serendipity_searchEntries($term, $limit = '', $searchresults = '') { //if * wasn't already appended and if there are none or not enough //results, search again for entries containing the searchterm as a part - if ($p == 1 && strpos($term, '*') === false && $serendipity['dbType'] != 'sqlite' && $serendipity['dbType'] != 'sqlite3') { + if ($p == 1 && strpos($term, '*') === false && $serendipity['dbType'] != 'sqlite' && $serendipity['dbType'] != 'sqlite3' && $serendipity['dbType'] != 'pdo-sqlite') { if (! is_array($search)) { return serendipity_searchEntries($term.'*', $orig_limit); }else if (count($search) < 4){ @@ -951,7 +951,7 @@ function serendipity_getTotalEntries() { global $serendipity; // The unique query condition was built previously in serendipity_fetchEntries() - if ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3') { + if ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3' || $serendipity['dbType'] == 'pdo-sqlite') { $querystring = "SELECT count(e.id) {$serendipity['fullCountQuery']} GROUP BY e.id"; } else { $querystring = "SELECT count(distinct e.id) {$serendipity['fullCountQuery']}"; @@ -960,7 +960,7 @@ function serendipity_getTotalEntries() { $query =& serendipity_db_query($querystring); if (is_array($query) && isset($query[0])) { - if ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3') { + if ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3' || $serendipity['dbType'] == 'pdo-sqlite') { return count($query); } else { return $query[0][0]; diff --git a/include/functions_installer.inc.php b/include/functions_installer.inc.php index 11f2cad1..d9f21ad6 100644 --- a/include/functions_installer.inc.php +++ b/include/functions_installer.inc.php @@ -742,7 +742,7 @@ function serendipity_checkInstallation() { $errs[] = sprintf(CANT_EXECUTE_BINARY, 'convert imagemagick'); } - if ($_POST['dbType'] == 'sqlite' || $_POST['dbType'] == 'sqlite3') { + if ($_POST['dbType'] == 'sqlite' || $_POST['dbType'] == 'sqlite3' || $_POST['dbType'] == 'pdo-sqlite') { // We don't want that our SQLite db file can be guessed from other applications on a server // and have access to our's. So we randomize the SQLite dbname. $_POST['sqlitedbName'] = $_POST['dbName'] . '_' . md5(time()); diff --git a/plugins/serendipity_event_statistics/serendipity_plugin_statistics.php b/plugins/serendipity_event_statistics/serendipity_plugin_statistics.php index 424dadde..2141e65f 100644 --- a/plugins/serendipity_event_statistics/serendipity_plugin_statistics.php +++ b/plugins/serendipity_event_statistics/serendipity_plugin_statistics.php @@ -236,7 +236,7 @@ class serendipity_plugin_statistics extends serendipity_plugin $max = time(); $min = $max - (15 * 60); - if ($serendipity['dbType'] == 'sqlite') { + if ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3' || $serendipity['dbType'] == 'pdo-sqlite') { $max_ts = date('H:i', $max); $min_ts = date('H:i', $min); $q = "SELECT count(counter_id) AS currentvisitors FROM {$serendipity['dbPrefix']}visitors WHERE day LIKE '" . date('Y-m-d') . "' AND (time BETWEEN '$min_ts' AND '$max_ts')";