* More PHP 5.3.0 compat (split()).

This commit is contained in:
Garvin Hicking 2009-08-25 19:39:17 +00:00
parent 6407727fe6
commit 275589423a
7 changed files with 10 additions and 8 deletions

View File

@ -1432,7 +1432,7 @@ class XML_RPC_Message extends XML_RPC_Base
$r = new XML_RPC_Response($v); $r = new XML_RPC_Response($v);
} }
} }
$r->hdrs = split("\r?\n", $XML_RPC_xh[$parser]['ha'][1]); $r->hdrs = preg_split("@\r?\n@", $XML_RPC_xh[$parser]['ha'][1]);
return $r; return $r;
} }
} }

View File

@ -7,6 +7,8 @@ Version 1.5 ()
* Allow to define sort order for search-results (garvinhicking) * Allow to define sort order for search-results (garvinhicking)
* More PHP 5.3.0 compat (split()).
-- beta1 release -- beta1 release
* PHP 5.3.0 compatibility without E_WARNING triggers (garvinhicking) * PHP 5.3.0 compatibility without E_WARNING triggers (garvinhicking)

View File

@ -95,7 +95,7 @@ function serendipity_db_limit($start, $offset) {
* @return SQL string containing a full LIMIT statement * @return SQL string containing a full LIMIT statement
*/ */
function serendipity_db_limit_sql($limitstring) { function serendipity_db_limit_sql($limitstring) {
$limit_split = split(',', $limitstring); $limit_split = explode(',', $limitstring);
if (count($limit_split) > 1) { if (count($limit_split) > 1) {
$limit = ' LIMIT ' . $limit_split[0] . ' OFFSET ' . $limit_split[1]; $limit = ' LIMIT ' . $limit_split[0] . ' OFFSET ' . $limit_split[1];
} else { } else {

View File

@ -100,7 +100,7 @@ function serendipity_db_limit($start, $offset) {
* @return SQL string containing a full LIMIT statement * @return SQL string containing a full LIMIT statement
*/ */
function serendipity_db_limit_sql($limitstring) { function serendipity_db_limit_sql($limitstring) {
$limit_split = split(',', $limitstring); $limit_split = explode(',', $limitstring);
if (count($limit_split) > 1) { if (count($limit_split) > 1) {
$limit = ' LIMIT ' . $limit_split[0] . ' OFFSET ' . $limit_split[1]; $limit = ' LIMIT ' . $limit_split[0] . ' OFFSET ' . $limit_split[1];
} else { } else {

View File

@ -388,7 +388,7 @@ function serendipity_db_limit_sql($limitstring) {
return ' LIMIT ' . $limitstring; return ' LIMIT ' . $limitstring;
case "postgresql": case "postgresql":
$limit; $limit;
$limit_split = split(',', $limitstring); $limit_split = explode(',', $limitstring);
if (count($limit_split) > 1) { if (count($limit_split) > 1) {
$limit = ' LIMIT ' . $limit_split[0] . ' OFFSET ' . $limit_split[1]; $limit = ' LIMIT ' . $limit_split[0] . ' OFFSET ' . $limit_split[1];
} else { } else {

View File

@ -571,7 +571,7 @@ class serendipity_event_statistics extends serendipity_event
function updatestats($action) { function updatestats($action) {
global $serendipity; global $serendipity;
list($year, $month, $day) = split('-', date('Y-m-d')); list($year, $month, $day) = explode('-', date('Y-m-d'));
$sql = serendipity_db_query("SELECT COUNT(year) AS result FROM {$serendipity['dbPrefix']}visitors_count WHERE year='$year' AND month='$month' AND day='$day'", true); $sql = serendipity_db_query("SELECT COUNT(year) AS result FROM {$serendipity['dbPrefix']}visitors_count WHERE year='$year' AND month='$month' AND day='$day'", true);
$sql_hit_update = "UPDATE {$serendipity['dbPrefix']}visitors_count SET hits = hits+1 WHERE year='$year' AND month='$month' AND day='$day'"; $sql_hit_update = "UPDATE {$serendipity['dbPrefix']}visitors_count SET hits = hits+1 WHERE year='$year' AND month='$month' AND day='$day'";
@ -662,7 +662,7 @@ class serendipity_event_statistics extends serendipity_event
function statistics_getdailystats($day, $amount) { function statistics_getdailystats($day, $amount) {
global $serendipity; global $serendipity;
list($year, $month) = split('[-]', date("Y-m")); list($year, $month) = explode('-', date("Y-m"));
if ($day > 0 && $day <32) { if ($day > 0 && $day <32) {
$sql = "SELECT SUM(visits) AS dailyvisit FROM {$serendipity['dbPrefix']}visitors_count WHERE day"; $sql = "SELECT SUM(visits) AS dailyvisit FROM {$serendipity['dbPrefix']}visitors_count WHERE day";
for ($i=1; $i<32; $i++) { for ($i=1; $i<32; $i++) {
@ -720,7 +720,7 @@ class serendipity_event_statistics extends serendipity_event
// ---------------QUERIES for Viewing statistics ---------------------------------------------- // ---------------QUERIES for Viewing statistics ----------------------------------------------
$day = date('Y-m-d'); $day = date('Y-m-d');
list($year, $month, $day) = split('-', $day); list($year, $month, $day) = explode('-', $day);
$visitors_count_firstday = serendipity_db_query("SELECT day FROM {$serendipity['dbPrefix']}visitors ORDER BY counter_id ASC LIMIT 1", true); $visitors_count_firstday = serendipity_db_query("SELECT day FROM {$serendipity['dbPrefix']}visitors ORDER BY counter_id ASC LIMIT 1", true);
$visitors_count_today = serendipity_db_query("SELECT visits FROM {$serendipity['dbPrefix']}visitors_count WHERE year = '".$year."' AND month = '".$month."' AND day = '".$day."'", true); $visitors_count_today = serendipity_db_query("SELECT visits FROM {$serendipity['dbPrefix']}visitors_count WHERE year = '".$year."' AND month = '".$month."' AND day = '".$day."'", true);

View File

@ -190,7 +190,7 @@ class serendipity_plugin_statistics extends serendipity_plugin
if (!file_exists($cachef) || filesize($cachef) == 0 || filemtime($cachef) < (time() - $cachetime)) { if (!file_exists($cachef) || filesize($cachef) == 0 || filemtime($cachef) < (time() - $cachetime)) {
// Create statistics // Create statistics
list($year, $month, $day) = split('-', date('Y-m-d')); list($year, $month, $day) = explode('-', date('Y-m-d'));
$lastmonday = date('Ymd', strtotime('last monday')); $lastmonday = date('Ymd', strtotime('last monday'));
$nextsunday = date('Ymd', strtotime('next sunday')); $nextsunday = date('Ymd', strtotime('next sunday'));
if (date('w', strtotime('today') ) == "1" ) { // now it is monday if (date('w', strtotime('today') ) == "1" ) { // now it is monday