fix importers to use new mysqli API extension

References http://board.s9y.org/viewtopic.php?f=10&t=20421

Is somwone able to test this here and there?
This commit is contained in:
Ian 2015-07-03 17:14:29 +02:00
parent c94d8fa93b
commit 4a0c591657
20 changed files with 267 additions and 269 deletions

View File

@ -168,7 +168,7 @@ class Serendipity_Import {
function &nativeQuery($query, $db = false) {
global $serendipity;
mysql_select_db($this->data['name'], $db);
mysqli_select_db($this->data['name'], $db);
$dbn = false;
$target = $this->data['charset'];
@ -188,11 +188,11 @@ class Serendipity_Import {
}
if ($dbn && $serendipity['dbNames']) {
mysql_query("SET NAMES " . $dbn, $db);
mysqli_query("SET NAMES " . $dbn, $db);
}
$return = &mysql_query($query, $db);
mysql_select_db($serendipity['dbName'], $serendipity['dbConn']);
$return = &mysqli_query($query, $db);
mysqli_select_db($serendipity['dbName'], $serendipity['dbConn']);
serendipity_db_reconnect();
return $return;
}

View File

@ -1,4 +1,4 @@
<?php # $Id$
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
@ -75,17 +75,17 @@ class Serendipity_Import_b2evolution extends Serendipity_Import {
$users = array();
$entries = array();
if (!extension_loaded('mysql')) {
if (!extension_loaded('mysqli')) {
return MYSQL_REQUIRED;
}
$b2db = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$b2db = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$b2db) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysql_error($b2db));
if (!@mysqli_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($b2db));
}
/* Users */
@ -97,11 +97,11 @@ class Serendipity_Import_b2evolution extends Serendipity_Import {
user_url AS user_url
FROM evo_users", $b2db);
if (!$res) {
return sprintf(COULDNT_SELECT_USER_INFO, mysql_error($b2db));
return sprintf(COULDNT_SELECT_USER_INFO, mysqli_error($b2db));
}
for ($x=0, $max_x = mysql_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysqli_fetch_assoc($res);
$data = array('right_publish' => ($users[$x]['user_level'] >= 2) ? 1 : 0,
'realname' => $users[$x]['user_login'],
@ -127,18 +127,18 @@ class Serendipity_Import_b2evolution extends Serendipity_Import {
/* Categories */
if (!$this->importCategories(null, 0, $b2db)) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($b2db));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($b2db));
}
serendipity_rebuildCategoryTree();
/* Entries */
$res = @$this->nativeQuery("SELECT * FROM evo_posts ORDER BY ID;", $b2db);
if (!$res) {
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($b2db));
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($b2db));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysqli_fetch_assoc($res);
$entry = array('title' => $this->decode($entries[$x]['post_title']),
'isdraft' => ($entries[$x]['post_status'] == 'published') ? 'false' : 'true',
@ -174,11 +174,11 @@ class Serendipity_Import_b2evolution extends Serendipity_Import {
/* Even more category stuff */
$res = @$this->nativeQuery("SELECT * FROM evo_postcats;", $b2db);
if (!$res) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($b2db));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($b2db));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entrycat = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entrycat = mysqli_fetch_assoc($res);
$entryid = 0;
$categoryid = 0;
@ -205,10 +205,10 @@ class Serendipity_Import_b2evolution extends Serendipity_Import {
/* Comments */
$res = @$this->nativeQuery("SELECT * FROM evo_comments;", $b2db);
if (!$res) {
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($b2db));
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($b2db));
}
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
foreach ($entries as $entry) {
if ($entry['ID'] == $a['comment_post_ID'] ) {
$author = '';
@ -262,19 +262,19 @@ class Serendipity_Import_b2evolution extends Serendipity_Import {
if (is_null($parentid)) {
$where = 'WHERE ISNULL(cat_parent_ID)';
} else {
$where = "WHERE cat_parent_ID = '" . mysql_escape_string($parentid) . "'";
$where = "WHERE cat_parent_ID = '" . mysqli_escape_string($parentid) . "'";
}
$res = $this->nativeQuery("SELECT * FROM evo_categories
" . $where, $b2db);
if (!$res) {
echo mysql_error();
echo mysqli_error();
return false;
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$row = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$row = mysqli_fetch_assoc($res);
$cat = array('category_name' => $row['cat_name'],
'category_description' => $row['cat_description'],
'parentid' => (int)$new_parentid,

View File

@ -1,4 +1,4 @@
<?php # $Id$
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
@ -77,17 +77,17 @@ class Serendipity_Import_bblog extends Serendipity_Import {
$users = array();
$entries = array();
if (!extension_loaded('mysql')) {
if (!extension_loaded('mysqli')) {
return MYSQL_REQUIRED;
}
$bblogdb = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$bblogdb = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$bblogdb) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysql_error($bblogdb));
if (!@mysqli_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($bblogdb));
}
/* Users */
@ -98,11 +98,11 @@ class Serendipity_Import_bblog extends Serendipity_Import {
url AS user_url
FROM {$this->data['prefix']}authors", $bblogdb);
if (!$res) {
return sprintf(COULDNT_SELECT_USER_INFO, mysql_error($bblogdb));
return sprintf(COULDNT_SELECT_USER_INFO, mysqli_error($bblogdb));
}
for ($x=0, $max_x = mysql_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysqli_fetch_assoc($res);
$data = array('right_publish' => 1,
'username' => $users[$x]['user_login'],
@ -115,19 +115,19 @@ class Serendipity_Import_bblog extends Serendipity_Import {
}
serendipity_db_insert('authors', $this->strtrRecursive($data));
echo mysql_error();
echo mysqli_error();
$users[$x]['authorid'] = serendipity_db_insert_id('authors', 'authorid');
}
/* Categories */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}sections", $bblogdb);
if (!$res) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($bblogdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($bblogdb));
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$row = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$row = mysqli_fetch_assoc($res);
$cat = array('category_name' => $row['nicename'],
'category_description' => $row['nicename'],
'parentid' => 0,
@ -144,11 +144,11 @@ class Serendipity_Import_bblog extends Serendipity_Import {
/* Entries */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}posts ORDER BY postid;", $bblogdb);
if (!$res) {
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($bblogdb));
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($bblogdb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysqli_fetch_assoc($res);
$entry = array('title' => $this->decode($entries[$x]['title']),
'isdraft' => ($entries[$x]['status'] == 'live') ? 'false' : 'true',
@ -195,10 +195,10 @@ class Serendipity_Import_bblog extends Serendipity_Import {
/* Comments */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}comments WHERE type = 'comment';", $bblogdb);
if (!$res) {
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($bblogdb));
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($bblogdb));
}
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
foreach ($entries as $entry) {
if ($entry['postid'] == $a['postid'] ) {
$comment = array('entry_id ' => $entry['entryid'],
@ -223,10 +223,10 @@ class Serendipity_Import_bblog extends Serendipity_Import {
/* Trackbacks */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}comments WHERE type = 'trackback';", $bblogdb);
if (!$res) {
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($bblogdb));
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($bblogdb));
}
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
foreach ($entries as $entry) {
if ($entry['postid'] == $a['postid'] ) {
$trackback = array('entry_id ' => $entry['entryid'],

View File

@ -1,4 +1,4 @@
<?php # $Id$
<?ph
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
@ -75,17 +75,17 @@ class Serendipity_Import_bmachine extends Serendipity_Import {
$users = array();
$entries = array();
if (!extension_loaded('mysql')) {
if (!extension_loaded('mysqli')) {
return MYSQL_REQUIRED;
}
$txpdb = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$txpdb = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$txpdb) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysql_error($txpdb));
if (!@mysqli_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($txpdb));
}
/* Users */
@ -97,11 +97,11 @@ class Serendipity_Import_bmachine extends Serendipity_Import {
user_url AS user_url
FROM bmc_users", $txpdb);
if (!$res) {
return sprintf(COULDNT_SELECT_USER_INFO, mysql_error($txpdb));
return sprintf(COULDNT_SELECT_USER_INFO, mysqli_error($txpdb));
}
for ($x=0, $max_x = mysql_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysqli_fetch_assoc($res);
$data = array('right_publish' => ($users[$x]['user_level'] >= 2) ? 1 : 0,
'realname' => $users[$x]['user_login'],
@ -131,12 +131,12 @@ class Serendipity_Import_bmachine extends Serendipity_Import {
cat_info AS category_description
FROM bmc_cats ORDER BY id;", $txpdb);
if (!$res) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($txpdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($txpdb));
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$categories[] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$categories[] = mysqli_fetch_assoc($res);
}
// Insert all categories as top level (we need to know everyone's ID before we can represent the hierarchy).
@ -156,11 +156,11 @@ class Serendipity_Import_bmachine extends Serendipity_Import {
/* Entries */
$res = @$this->nativeQuery("SELECT * FROM bmc_posts ORDER BY id;", $txpdb);
if (!$res) {
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($txpdb));
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($txpdb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysqli_fetch_assoc($res);
$entry = array('title' => $this->decode($entries[$x]['title']),
'isdraft' => ($entries[$x]['status'] == '1') ? 'false' : 'true',
@ -197,10 +197,10 @@ class Serendipity_Import_bmachine extends Serendipity_Import {
/* Comments */
$res = @$this->nativeQuery("SELECT * FROM bmc_comments;", $txpdb);
if (!$res) {
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($txpdb));
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($txpdb));
}
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
foreach ($entries as $entry) {
if ($entry['id'] == $a['post'] ) {
$author = '';

View File

@ -1,4 +1,4 @@
<?php # $Id$
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
@ -81,17 +81,17 @@ class Serendipity_Import_geeklog extends Serendipity_Import {
$users = array();
$entries = array();
if (!extension_loaded('mysql')) {
if (!extension_loaded('mysqli')) {
return MYSQL_REQUIRED;
}
$gdb = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$gdb = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$gdb) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysql_error($gdb));
if (!@mysqli_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($gdb));
}
/* Users */
@ -102,11 +102,11 @@ class Serendipity_Import_geeklog extends Serendipity_Import {
homepage AS user_url
FROM {$this->data['prefix']}users", $gdb);
if (!$res) {
return sprintf(COULDNT_SELECT_USER_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_USER_INFO, mysqli_error($gdb));
}
for ($x=0, $max_x = mysql_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysqli_fetch_assoc($res);
$data = array('right_publish' => 1,
'realname' => $users[$x]['user_login'],
@ -120,19 +120,19 @@ class Serendipity_Import_geeklog extends Serendipity_Import {
}
serendipity_db_insert('authors', $this->strtrRecursive($data));
echo mysql_error();
echo mysqli_error();
$users[$x]['authorid'] = serendipity_db_insert_id('authors', 'authorid');
}
/* Categories */
$res = @$this->nativeQuery("SELECT tid AS cat_ID, topic AS cat_name, topic AS category_description FROM {$this->data['prefix']}topics ORDER BY tid;", $gdb);
if (!$res) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($gdb));
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$categories[] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$categories[] = mysqli_fetch_assoc($res);
}
// Insert all categories as top level (we need to know everyone's ID before we can represent the hierarchy).
@ -152,11 +152,11 @@ class Serendipity_Import_geeklog extends Serendipity_Import {
/* Entries */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}stories ORDER BY sid;", $gdb);
if (!$res) {
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($gdb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysqli_fetch_assoc($res);
$entry = array('title' => $this->decode($entries[$x]['title']),
'isdraft' => ($entries[$x]['draft_flag'] == '0') ? 'false' : 'true',
@ -194,10 +194,10 @@ class Serendipity_Import_geeklog extends Serendipity_Import {
/* Comments */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}comments;", $gdb);
if (!$res) {
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($gdb));
}
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
foreach ($entries as $entry) {
if ($entry['sid'] == $a['sid'] ) {
$author = '';

View File

@ -1,4 +1,4 @@
<?php # $Id: b2evolution.inc.php 1093 2006-04-13 10:49:52Z garvinhicking $
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
@ -75,17 +75,17 @@ class Serendipity_Import_lifetype extends Serendipity_Import {
$users = array();
$entries = array();
if (!extension_loaded('mysql')) {
if (!extension_loaded('mysqli')) {
return MYSQL_REQUIRED;
}
$ltdb = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$ltdb = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$ltdb) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysql_error($ltdb));
if (!@mysqli_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($ltdb));
}
/* Users */
@ -98,11 +98,11 @@ class Serendipity_Import_lifetype extends Serendipity_Import {
id AS ID
FROM lt_users", $ltdb);
if (!$res) {
return sprintf(COULDNT_SELECT_USER_INFO, mysql_error($ltdb));
return sprintf(COULDNT_SELECT_USER_INFO, mysqli_error($ltdb));
}
for ($x=0, $max_x = mysql_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysqli_fetch_assoc($res);
$data = array('right_publish' => true,
'realname' => $users[$x]['user_name'],
@ -121,7 +121,7 @@ class Serendipity_Import_lifetype extends Serendipity_Import {
/* Categories */
if (!$this->importCategories(null, 0, $ltdb)) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($ltdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($ltdb));
}
serendipity_rebuildCategoryTree();
@ -138,11 +138,11 @@ class Serendipity_Import_lifetype extends Serendipity_Import {
ON lt_articles_text.article_id = lt_articles.id
ORDER BY ID;", $ltdb);
if (!$res) {
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($ltdb));
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($ltdb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysqli_fetch_assoc($res);
$entry = array('title' => $this->decode($entries[$x]['post_title']),
'isdraft' => ($entries[$x]['post_status'] == '1') ? 'false' : 'true',
@ -170,11 +170,11 @@ class Serendipity_Import_lifetype extends Serendipity_Import {
category_id AS postcat_cat_ID
FROM lt_article_categories_link", $ltdb);
if (!$res) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($ltdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($ltdb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entrycat = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entrycat = mysqli_fetch_assoc($res);
$entryid = 0;
$categoryid = 0;
@ -211,10 +211,10 @@ class Serendipity_Import_lifetype extends Serendipity_Import {
status AS comment_status
FROM lt_articles_comments;", $ltdb);
if (!$res) {
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($ltdb));
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($ltdb));
}
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
foreach ($entries as $entry) {
if ($entry['ID'] == $a['comment_post_ID'] ) {
$author = '';
@ -269,7 +269,7 @@ class Serendipity_Import_lifetype extends Serendipity_Import {
if (is_null($parentid)) {
$where = 'WHERE parent_id = 0';
} else {
$where = "WHERE parent_id = '" . mysql_escape_string($parentid) . "'";
$where = "WHERE parent_id = '" . mysqli_escape_string($parentid) . "'";
}
$res = $this->nativeQuery("SELECT name AS cat_name,
@ -278,13 +278,13 @@ class Serendipity_Import_lifetype extends Serendipity_Import {
FROM lt_articles_categories
" . $where, $ltdb);
if (!$res) {
echo mysql_error();
echo mysqli_error();
return false;
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$row = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$row = mysqli_fetch_assoc($res);
$cat = array('category_name' => $row['cat_name'],
'category_description' => $row['cat_description'],
'parentid' => (int)$new_parentid,

View File

@ -1,5 +1,4 @@
<?php
# $Id: generic.inc.php 717 2005-11-21 09:56:25Z garvinhicking $
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# Copyright (c) 2009, Matthew Weigel
# All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,4 @@
<?php # $Id$
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details

View File

@ -78,27 +78,27 @@ class Serendipity_Import_Nucleus extends Serendipity_Import {
$categories = array();
$entries = array();
if (!extension_loaded('mysql')) {
if (!extension_loaded('mysqli')) {
return MYSQL_REQUIRED;;
}
$nucdb = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$nucdb = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$nucdb) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysql_error($nucdb));
if (!@mysqli_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($nucdb));
}
/* Users */
$res = @$this->nativeQuery("SELECT mnumber AS ID, mname AS user_login, mpassword AS user_pass, memail AS user_email, madmin AS user_level FROM {$this->data['prefix']}member;", $nucdb);
if (!$res) {
return sprintf(COULDNT_SELECT_USER_INFO, mysql_error($nucdb));
return sprintf(COULDNT_SELECT_USER_INFO, mysqli_error($nucdb));
}
for ($x=0, $max_x = mysql_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysqli_fetch_assoc($res);
$data = array('right_publish' => ($users[$x]['user_level'] >= 1) ? 1 : 0,
'realname' => $users[$x]['user_login'],
@ -123,12 +123,12 @@ class Serendipity_Import_Nucleus extends Serendipity_Import {
/* Categories */
$res = @$this->nativeQuery("SELECT catid AS cat_ID, cname AS cat_name, cdesc AS category_description FROM {$this->data['prefix']}category ORDER BY catid;", $nucdb);
if (!$res) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($nucdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($nucdb));
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$categories[] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$categories[] = mysqli_fetch_assoc($res);
}
// Insert all categories as top level (we need to know everyone's ID before we can represent the hierarchy).
@ -148,11 +148,11 @@ class Serendipity_Import_Nucleus extends Serendipity_Import {
/* Entries */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}item ORDER BY itime;", $nucdb);
if (!$res) {
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($nucdb));
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($nucdb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysqli_fetch_assoc($res);
$entry = array('title' => $this->decode($entries[$x]['ititle']),
'isdraft' => ($entries[$x]['idraft'] != '1') ? 'false' : 'true',
@ -189,10 +189,10 @@ class Serendipity_Import_Nucleus extends Serendipity_Import {
/* Comments */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}comment;", $nucdb);
if (!$res) {
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($nucdb));
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($nucdb));
}
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
foreach ($entries as $entry) {
if ($entry['inumber'] == $a['citem'] ) {
$author = '';

View File

@ -1,4 +1,4 @@
<?php # $Id: b2evolution.inc.php 1093 2006-04-13 10:49:52Z garvinhicking $
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
@ -75,17 +75,17 @@ class Serendipity_Import_nuke extends Serendipity_Import {
$users = array();
$entries = array();
if (!extension_loaded('mysql')) {
if (!extension_loaded('mysqli')) {
return MYSQL_REQUIRED;
}
$nukedb = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$nukedb = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$nukedb) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysql_error($nukedb));
if (!@mysqli_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($nukedb));
}
/* Users: Authors */
@ -98,11 +98,11 @@ class Serendipity_Import_nuke extends Serendipity_Import {
aid AS ID
FROM nuke_authors", $nukedb);
if (!$res) {
return sprintf(COULDNT_SELECT_USER_INFO, mysql_error($nukedb));
return sprintf(COULDNT_SELECT_USER_INFO, mysqli_error($nukedb));
}
for ($x=0, $max_x = mysql_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysqli_fetch_assoc($res);
$data = array('right_publish' => true,
'realname' => $users[$x]['user_name'],
@ -132,11 +132,11 @@ class Serendipity_Import_nuke extends Serendipity_Import {
ON u.uid = s.user_id
", $nukedb);
if (!$res) {
return sprintf(COULDNT_SELECT_USER_INFO, mysql_error($nukedb));
return sprintf(COULDNT_SELECT_USER_INFO, mysqli_error($nukedb));
}
for ($x=$x, $max_x = $x + mysql_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=$x, $max_x = $x + mysqli_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysqli_fetch_assoc($res);
if (empty($users[$x]['user_name'])) {
$users[$x]['user_name'] = $users[$x]['user_login'];
}
@ -158,7 +158,7 @@ class Serendipity_Import_nuke extends Serendipity_Import {
/* Categories */
if (!$this->importCategories($nukedb)) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($nukedb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($nukedb));
}
serendipity_rebuildCategoryTree();
@ -174,11 +174,11 @@ class Serendipity_Import_nuke extends Serendipity_Import {
bodytext AS extended
FROM nuke_stories", $nukedb);
if (!$res) {
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($nukedb));
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($nukedb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysqli_fetch_assoc($res);
if (!empty($entries[$x]['informant'])) {
$entries[$x]['post_author'] = $entries[$x]['informant'];
@ -212,11 +212,11 @@ class Serendipity_Import_nuke extends Serendipity_Import {
topic AS postcat_cat_ID
FROM nuke_stories", $nukedb);
if (!$res) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($nukedb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($nukedb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entrycat = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entrycat = mysqli_fetch_assoc($res);
$entryid = 0;
$categoryid = 0;
@ -250,10 +250,10 @@ class Serendipity_Import_nuke extends Serendipity_Import {
UNIX_TIMESTAMP(`date`) AS tstamp
FROM nuke_comments", $nukedb);
if (!$res) {
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($nukedb));
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($nukedb));
}
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
foreach ($entries as $entry) {
if ($entry['ID'] == $a['comment_post_ID'] ) {
$author = $a['comment_author'];
@ -292,13 +292,13 @@ class Serendipity_Import_nuke extends Serendipity_Import {
topicid AS cat_ID
FROM nuke_topics", $nukedb);
if (!$res) {
echo mysql_error();
echo mysqli_error();
return false;
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$row = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$row = mysqli_fetch_assoc($res);
$cat = array('category_name' => $row['cat_name'],
'category_description' => $row['cat_description'],
'parentid' => 0,

View File

@ -1,4 +1,4 @@
<?php # $Id$
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details

View File

@ -77,17 +77,17 @@ class Serendipity_Import_phpbb extends Serendipity_Import {
$users = array();
$entries = array();
if (!extension_loaded('mysql')) {
if (!extension_loaded('mysqli')) {
return MYSQL_REQUIRED;
}
$gdb = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$gdb = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$gdb) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysql_error($gdb));
if (!@mysqli_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($gdb));
}
/* Users */
@ -100,11 +100,11 @@ class Serendipity_Import_phpbb extends Serendipity_Import {
FROM {$this->data['prefix']}users
WHERE user_active = 1", $gdb);
if (!$res) {
return sprintf(COULDNT_SELECT_USER_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_USER_INFO, mysqli_error($gdb));
}
for ($x=0, $max_x = mysql_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysqli_fetch_assoc($res);
$data = array('right_publish' => 1,
'realname' => $users[$x]['user_login'],
@ -118,7 +118,7 @@ class Serendipity_Import_phpbb extends Serendipity_Import {
}
serendipity_db_insert('authors', $this->strtrRecursive($data));
echo mysql_error();
echo mysqli_error();
$users[$x]['authorid'] = serendipity_db_insert_id('authors', 'authorid');
}
@ -127,12 +127,12 @@ class Serendipity_Import_phpbb extends Serendipity_Import {
cat_title AS cat_name
FROM {$this->data['prefix']}categories", $gdb);
if (!$res) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($gdb));
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$parent_categories[] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$parent_categories[] = mysqli_fetch_assoc($res);
}
for ($x=0, $max_x = sizeof($parent_categories) ; $x < $max_x ; $x++ ) {
@ -153,12 +153,12 @@ class Serendipity_Import_phpbb extends Serendipity_Import {
forum_desc AS category_description
FROM {$this->data['prefix']}forums ORDER BY forum_order;", $gdb);
if (!$res) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($gdb));
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$categories[] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$categories[] = mysqli_fetch_assoc($res);
}
// Insert all categories as top level (we need to know everyone's ID before we can represent the hierarchy).
@ -201,11 +201,11 @@ class Serendipity_Import_phpbb extends Serendipity_Import {
GROUP BY p.topic_id
", $gdb);
if (!$res) {
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($gdb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysqli_fetch_assoc($res);
$entry = array('title' => $this->decode($entries[$x]['post_subject']),
'isdraft' => 'false',
@ -257,10 +257,10 @@ class Serendipity_Import_phpbb extends Serendipity_Import {
WHERE p.topic_id = {$topic_id}
", $gdb);
if (!$c_res) {
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($gdb));
}
while ($a = mysql_fetch_assoc($c_res)) {
while ($a = mysqli_fetch_assoc($c_res)) {
if ($a['post_id'] == $entries[$x]['post_id']) {
continue;
}

View File

@ -1,4 +1,4 @@
<?php # $Id: generic.inc.php 717 2005-11-21 09:56:25Z garvinhicking $
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,4 @@
<?php # $Id$
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
@ -78,17 +78,17 @@ class Serendipity_Import_pMachine extends Serendipity_Import {
$categories = array();
$entries = array();
if (!extension_loaded('mysql')) {
if (!extension_loaded('mysqli')) {
return MYSQL_REQUIRED;
}
$pmdb = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$pmdb = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$pmdb) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysql_error($pmdb));
if (!@mysqli_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($pmdb));
}
/* Users */
@ -100,11 +100,11 @@ class Serendipity_Import_pMachine extends Serendipity_Import {
url AS url
FROM {$this->data['prefix']}members", $pmdb);
if (!$res) {
return sprintf(COULDNT_SELECT_USER_INFO, mysql_error($pmdb));
return sprintf(COULDNT_SELECT_USER_INFO, mysqli_error($pmdb));
}
for ($x=0, $max_x = mysql_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysqli_fetch_assoc($res);
$data = array('right_publish' => ($users[$x]['user_level'] >= 3) ? 1 : 0,
'realname' => $users[$x]['user_login'],
@ -132,12 +132,12 @@ class Serendipity_Import_pMachine extends Serendipity_Import {
category AS category_description
FROM {$this->data['prefix']}categories ORDER BY id", $pmdb);
if (!$res) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($pmdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($pmdb));
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$categories[] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$categories[] = mysqli_fetch_assoc($res);
}
// Insert all categories as top level (we need to know everyone's ID before we can represent the hierarchy).
@ -157,11 +157,11 @@ class Serendipity_Import_pMachine extends Serendipity_Import {
/* Entries */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}weblog ORDER BY t_stamp;", $pmdb);
if (!$res) {
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($pmdb));
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($pmdb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysqli_fetch_assoc($res);
$entry = array('title' => $this->decode($entries[$x]['title']),
'isdraft' => ($entries[$x]['status'] == 'open') ? 'false' : 'true',
@ -198,10 +198,10 @@ class Serendipity_Import_pMachine extends Serendipity_Import {
/* Comments */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}comments;", $pmdb);
if (!$res) {
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($pmdb));
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($pmdb));
}
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
foreach ($entries as $entry) {
if ($entry['post_id'] == $a['post_id'] ) {
$author = '';

View File

@ -1,5 +1,4 @@
<?php
# $Id: b2evolution.inc.php 1093 2006-04-13 10:49:52Z garvinhicking $
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
@ -107,14 +106,14 @@ class Serendipity_Import_Serendipity extends Serendipity_Import {
}
$res = $this->nativeQuery("SELECT * FROM {$this->data['prefix']}" . $table . " " . $where, $s9ydb);
echo mysql_error($s9ydb);
echo mysqli_error($s9ydb);
if (!$res || mysql_num_rows($res) < 1) {
if (!$res || mysqli_num_rows($res) < 1) {
return false;
}
$this->counter = 100;
while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) {
while ($row = mysqli_fetch_array($res, MYSQLI_ASSOC)) {
$this->counter++;
if (is_array($primary_keys)) {
foreach($primary_keys AS $primary_key) {
@ -443,17 +442,17 @@ class Serendipity_Import_Serendipity extends Serendipity_Import {
$users = array();
$entries = array();
if (!extension_loaded('mysql')) {
if (!extension_loaded('mysqli')) {
return MYSQL_REQUIRED;
}
$s9ydb = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$s9ydb = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$s9ydb) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'], $s9ydb)) {
return sprintf(COULDNT_SELECT_DB, mysql_error($s9ydb));
if (!@mysqli_select_db($this->data['name'], $s9ydb)) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($s9ydb));
}
if (!is_array($this->data['targets'])) {

View File

@ -1,4 +1,4 @@
<?php # $Id: phpbb.inc.php 50 2005-04-25 16:50:43Z garvinhicking $
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
@ -81,17 +81,17 @@ class Serendipity_Import_smf extends Serendipity_Import {
$users = array();
$entries = array();
if (!extension_loaded('mysql')) {
if (!extension_loaded('mysqli')) {
return MYSQL_REQUIRED;
}
$gdb = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$gdb = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$gdb) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysql_error($gdb));
if (!@mysqli_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($gdb));
}
/* Users */
@ -103,11 +103,11 @@ class Serendipity_Import_smf extends Serendipity_Import {
FROM {$this->data['prefix']}members
WHERE is_activated = 1", $gdb);
if (!$res) {
return sprintf(COULDNT_SELECT_USER_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_USER_INFO, mysqli_error($gdb));
}
for ($x=0, $max_x = mysql_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysqli_fetch_assoc($res);
$data = array('right_publish' => 1,
'realname' => $users[$x]['user_login'],
@ -121,7 +121,7 @@ class Serendipity_Import_smf extends Serendipity_Import {
}
serendipity_db_insert('authors', $this->strtrRecursive($data));
echo mysql_error();
echo mysqli_error();
$users[$x]['authorid'] = serendipity_db_insert_id('authors', 'authorid');
}
@ -130,12 +130,12 @@ class Serendipity_Import_smf extends Serendipity_Import {
name AS cat_name
FROM {$this->data['prefix']}categories", $gdb);
if (!$res) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($gdb));
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$parent_categories[] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$parent_categories[] = mysqli_fetch_assoc($res);
}
for ($x=0, $max_x = sizeof($parent_categories) ; $x < $max_x ; $x++ ) {
@ -156,12 +156,12 @@ class Serendipity_Import_smf extends Serendipity_Import {
description AS category_description
FROM {$this->data['prefix']}boards ORDER BY boardOrder;", $gdb);
if (!$res) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($gdb));
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$categories[] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$categories[] = mysqli_fetch_assoc($res);
}
// Insert all categories as top level (we need to know everyone's ID before we can represent the hierarchy).
@ -204,11 +204,11 @@ class Serendipity_Import_smf extends Serendipity_Import {
GROUP BY t.ID_TOPIC", $gdb);
if (!$res) {
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($gdb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysqli_fetch_assoc($res);
$entry = array('title' => $this->decode($entries[$x]['post_subject']),
'isdraft' => 'false',
@ -254,8 +254,8 @@ class Serendipity_Import_smf extends Serendipity_Import {
ON tl.ID_TAG = t.ID_TAG
WHERE tl.ID_TOPIC = {$topic_id}
AND t.approved = 1");
if (mysql_num_rows($t_res) > 0) {
while ($a = mysql_fetch_assoc($t_res)) {
if (mysqli_num_rows($t_res) > 0) {
while ($a = mysqli_fetch_assoc($t_res)) {
serendipity_db_insert('entrytags', array('entryid' => $entries[$x]['entryid'], 'tag' => $t_res['tag']));
}
}
@ -277,10 +277,10 @@ class Serendipity_Import_smf extends Serendipity_Import {
", $gdb);
if (!$c_res) {
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($gdb));
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($gdb));
}
while ($a = mysql_fetch_assoc($c_res)) {
while ($a = mysqli_fetch_assoc($c_res)) {
if ($a['post_id'] == $entries[$x]['post_id']) {
continue;
}

View File

@ -1,4 +1,4 @@
<?php # $Id$
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
@ -82,17 +82,17 @@ class Serendipity_Import_sunlog extends Serendipity_Import {
$users = array();
$entries = array();
if (!extension_loaded('mysql')) {
if (!extension_loaded('mysqli')) {
return MYSQL_REQUIRED;
}
$sunlogdb = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$sunlogdb = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$sunlogdb) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysql_error($sunlogdb));
if (!@mysqli_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($sunlogdb));
}
/* Users */
@ -102,11 +102,11 @@ class Serendipity_Import_sunlog extends Serendipity_Import {
homepage AS user_url
FROM {$this->data['prefix']}users", $sunlogdb);
if (!$res) {
return sprintf(COULDNT_SELECT_USER_INFO, mysql_error($sunlogdb));
return sprintf(COULDNT_SELECT_USER_INFO, mysqli_error($sunlogdb));
}
for ($x=0, $max_x = mysql_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysqli_fetch_assoc($res);
$data = array('right_publish' => 1,
'realname' => $users[$x]['user_login'],
@ -120,24 +120,24 @@ class Serendipity_Import_sunlog extends Serendipity_Import {
}
serendipity_db_insert('authors', $this->strtrRecursive($data));
echo mysql_error();
echo mysqli_error();
$users[$x]['authorid'] = serendipity_db_insert_id('authors', 'authorid');
}
/* Categories */
if (!$this->importCategories(null, 0, $sunlogdb)) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($sunlogdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($sunlogdb));
}
serendipity_rebuildCategoryTree();
/* Entries */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}articles ORDER BY id;", $sunlogdb);
if (!$res) {
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($sunlogdb));
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($sunlogdb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysqli_fetch_assoc($res);
$entry = array('title' => $this->decode($entries[$x]['title']),
'isdraft' => ($entries[$x]['draft'] == '0') ? 'false' : 'true',
@ -165,11 +165,11 @@ class Serendipity_Import_sunlog extends Serendipity_Import {
/* Even more category stuff */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}transfer_c;", $sunlogdb);
if (!$res) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($sunlogdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($sunlogdb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entrycat = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entrycat = mysqli_fetch_assoc($res);
$entryid = 0;
$categoryid = 0;
@ -196,10 +196,10 @@ class Serendipity_Import_sunlog extends Serendipity_Import {
/* Comments */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}c_comments;", $sunlogdb);
if (!$res) {
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($sunlogdb));
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($sunlogdb));
}
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
foreach ($entries as $entry) {
if ($entry['id'] == $a['for_entry'] ) {
$author = '';
@ -241,18 +241,18 @@ class Serendipity_Import_sunlog extends Serendipity_Import {
}
function importCategories($parentid = 0, $new_parentid = 0, $sunlogdb) {
$where = "WHERE parent = '" . mysql_escape_string($parentid) . "'";
$where = "WHERE parent = '" . mysqli_escape_string($parentid) . "'";
$res = $this->nativeQuery("SELECT * FROM {$this->data['prefix']}categories
" . $where, $sunlogdb);
if (!$res) {
echo mysql_error();
echo mysqli_error();
return false;
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$row = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$row = mysqli_fetch_assoc($res);
$cat = array('category_name' => $row['title'],
'category_description' => $row['optional_1'] . ' ' . $row['optional_2'] . ' ' . $row['optional_3'],
'parentid' => (int)$new_parentid,

View File

@ -1,4 +1,4 @@
<?php # $Id$
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
@ -81,17 +81,17 @@ class Serendipity_Import_textpattern extends Serendipity_Import {
$users = array();
$entries = array();
if (!extension_loaded('mysql')) {
if (!extension_loaded('mysqli')) {
return MYSQL_REQUIRED;
}
$txpdb = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$txpdb = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$txpdb) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysql_error($txpdb));
if (!@mysqli_select_db($this->data['name'])) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($txpdb));
}
/* Users */
@ -102,11 +102,11 @@ class Serendipity_Import_textpattern extends Serendipity_Import {
privs AS user_level
FROM {$this->data['prefix']}txp_users", $txpdb);
if (!$res) {
return sprintf(COULDNT_SELECT_USER_INFO, mysql_error($txpdb));
return sprintf(COULDNT_SELECT_USER_INFO, mysqli_error($txpdb));
}
for ($x=0, $max_x = mysql_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res); $x < $max_x ; $x++ ) {
$users[$x] = mysqli_fetch_assoc($res);
$data = array('right_publish' => ($users[$x]['user_level'] <= 4) ? 1 : 0,
'realname' => $users[$x]['user_login'],
@ -132,7 +132,7 @@ class Serendipity_Import_textpattern extends Serendipity_Import {
/* Categories */
if (!$this->importCategories('root', 0, $txpdb)) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($txpdb));
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysqli_error($txpdb));
}
serendipity_rebuildCategoryTree();
@ -140,11 +140,11 @@ class Serendipity_Import_textpattern extends Serendipity_Import {
// Notice: Textpattern doesn't honor the prefix for this table. Wicked system.
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}textpattern ORDER BY Posted;", $txpdb);
if (!$res) {
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($txpdb));
return sprintf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($txpdb));
}
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++ ) {
$entries[$x] = mysqli_fetch_assoc($res);
$entry = array('title' => $this->decode($entries[$x]['Title']),
'isdraft' => ($entries[$x]['Status'] == '4') ? 'false' : 'true',
@ -181,10 +181,10 @@ class Serendipity_Import_textpattern extends Serendipity_Import {
/* Comments */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}txp_discuss;", $txpdb);
if (!$res) {
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($txpdb));
return sprintf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($txpdb));
}
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
foreach ($entries as $entry) {
if ($entry['ID'] == $a['parentid'] ) {
$author = $a['name'];
@ -220,15 +220,15 @@ class Serendipity_Import_textpattern extends Serendipity_Import {
function importCategories($parentname = 'root', $parentid = 0, $txpdb) {
$res = $this->nativeQuery("SELECT * FROM {$this->data['prefix']}txp_category
WHERE parent = '" . mysql_escape_string($parentname) . "' AND type = 'article'", $txpdb);
WHERE parent = '" . mysqli_escape_string($parentname) . "' AND type = 'article'", $txpdb);
if (!$res) {
echo mysql_error();
echo mysqli_error();
return false;
}
// Get all the info we need
for ($x=0, $max_x = mysql_num_rows($res) ; $x < $max_x ; $x++) {
$row = mysql_fetch_assoc($res);
for ($x=0, $max_x = mysqli_num_rows($res) ; $x < $max_x ; $x++) {
$row = mysqli_fetch_assoc($res);
$cat = array('category_name' => $row['name'],
'category_description' => $row['name'],
'parentid' => $parentid,

View File

@ -1,4 +1,4 @@
<?php # $Id: wordpress.inc.php,v 1.16 2005/05/17 11:34:48 garvinhicking Exp $
<?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details

View File

@ -84,7 +84,7 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
$categories = array();
$entries = array();
if ( !extension_loaded('mysql') ) {
if ( !extension_loaded('mysqli') ) {
return MYSQL_REQUIRED;
}
@ -92,13 +92,13 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
@set_time_limit(300);
}
$wpdb = @mysql_connect($this->data['host'], $this->data['user'], $this->data['pass']);
$wpdb = @mysqli_connect($this->data['host'], $this->data['user'], $this->data['pass']);
if (!$wpdb) {
return sprintf(COULDNT_CONNECT, serendipity_specialchars($this->data['host']));
}
if (!@mysql_select_db($this->data['name'], $wpdb)) {
return sprintf(COULDNT_SELECT_DB, mysql_error($wpdb));
if (!@mysqli_select_db($this->data['name'], $wpdb)) {
return sprintf(COULDNT_SELECT_DB, mysqli_error($wpdb));
}
// This will hold the s9y <-> WP ID associations.
@ -108,11 +108,11 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
// Fields: ID, user_login, user_pass, user_email, user_level
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}users;", $wpdb);
if (!$res) {
printf(COULDNT_SELECT_USER_INFO, mysql_error($wpdb));
printf(COULDNT_SELECT_USER_INFO, mysqli_error($wpdb));
} else {
if ($debug) echo "<span class='block_level'>Importing users...</span>";
for ($x=0, $c = mysql_num_rows($res) ; $x < $c ; $x++) {
$users[$x] = mysql_fetch_assoc($res);
for ($x=0, $c = mysqli_num_rows($res) ; $x < $c ; $x++) {
$users[$x] = mysqli_fetch_assoc($res);
$data = array('right_publish' => (!isset($users[$x]['user_level']) || $users[$x]['user_level'] >= 1) ? 1 : 0,
'realname' => $users[$x]['user_login'],
@ -150,13 +150,13 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
FROM {$this->data['prefix']}categories
ORDER BY category_parent, cat_ID;", $wpdb);
if (!$res) {
$no_cat = mysql_error($wpdb);
$no_cat = mysqli_error($wpdb);
} else {
if ($debug) echo "<span class='block_level'>Importing categories (WP 2.2 style)...</span>";
// Get all the info we need
for ($x=0 ; $x<mysql_num_rows($res) ; $x++) {
$categories[] = mysql_fetch_assoc($res);
for ($x=0 ; $x<mysqli_num_rows($res) ; $x++) {
$categories[] = mysqli_fetch_assoc($res);
}
// Insert all categories as top level (we need to know everyone's ID before we can represent the hierarchy).
@ -216,14 +216,14 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
WHERE taxonomy.taxonomy = 'category'
ORDER BY taxonomy.parent, taxonomy.term_taxonomy_id", $wpdb);
if (!$res && !$no_cat) {
$no_cat = mysql_error($wpdb);
$no_cat = mysqli_error($wpdb);
} elseif ($res) {
$no_cat = false;
if ($debug) echo "<span class='block_level'>Importing categories (WP 2.3 style)...</span>";
// Get all the info we need
for ($x=0 ; $x<mysql_num_rows($res) ; $x++) {
$categories[] = mysql_fetch_assoc($res);
for ($x=0 ; $x<mysqli_num_rows($res) ; $x++) {
$categories[] = mysqli_fetch_assoc($res);
}
// Insert all categories as top level (we need to know everyone's ID before we can represent the hierarchy).
@ -280,11 +280,11 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
}
if (!$res) {
printf(COULDNT_SELECT_ENTRY_INFO, mysql_error($wpdb));
printf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($wpdb));
} else {
if ($debug) echo "<span class='block_level'>Importing entries...</span>";
for ($x=0, $c = mysql_num_rows($res) ; $x < $c ; $x++ ) {
$entries[$x] = mysql_fetch_assoc($res);
for ($x=0, $c = mysqli_num_rows($res) ; $x < $c ; $x++ ) {
$entries[$x] = mysqli_fetch_assoc($res);
$content = explode('<!--more-->', $entries[$x]['post_content'], 2);
$body = $content[0];
@ -299,7 +299,7 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
'authorid' => $assoc['users'][$entries[$x]['post_author']]);
if (!is_int($entries[$x]['entryid'] = serendipity_updertEntry($entry))) {
printf(COULDNT_SELECT_ENTRY_INFO, mysql_error($wpdb));
printf(COULDNT_SELECT_ENTRY_INFO, mysqli_error($wpdb));
echo "<span class='block_level'>ID: {$entries[$x]['ID']} - {$entry['title']}</span>";
return $entries[$x]['entryid'];
}
@ -316,10 +316,10 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
$no_entrycat = false;
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}post2cat;", $wpdb);
if (!$res) {
$no_entrycat = mysql_error($wpdb);
$no_entrycat = mysqli_error($wpdb);
} else {
if ($debug) echo "<span class='block_level'>Importing category associations (WP 2.2 style)...</span>";
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
$data = array('entryid' => $assoc['entries'][$a['post_id']],
'categoryid' => $assoc['categories'][$a['category_id']]);
serendipity_db_insert('entrycat', $this->strtrRecursive($data));
@ -332,11 +332,11 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
rel.term_taxonomy_id AS category_id
FROM {$this->data['prefix']}term_relationships AS rel;", $wpdb);
if (!$res && !$no_entrycat) {
$no_entrycat = mysql_error($wpdb);
$no_entrycat = mysqli_error($wpdb);
} elseif ($res) {
$no_entrycat = false;
if ($debug) echo "<span class='block_level'>Importing category associations (WP 2.3 style)...</span>";
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
$data = array('entryid' => $assoc['entries'][$a['post_id']],
'categoryid' => $assoc['categories'][$a['category_id']]);
serendipity_db_insert('entrycat', $this->strtrRecursive($data));
@ -351,11 +351,11 @@ class Serendipity_Import_WordPress extends Serendipity_Import {
/* Comments */
$res = @$this->nativeQuery("SELECT * FROM {$this->data['prefix']}comments;", $wpdb);
if (!$res) {
printf(COULDNT_SELECT_COMMENT_INFO, mysql_error($wpdb));
printf(COULDNT_SELECT_COMMENT_INFO, mysqli_error($wpdb));
} else {
$serendipity['allowSubscriptions'] = false;
if ($debug) echo "<span class='block_level'>Importing comments...</span>";
while ($a = mysql_fetch_assoc($res)) {
while ($a = mysqli_fetch_assoc($res)) {
$comment = array('entry_id ' => $assoc['entries'][$a['comment_post_ID']],
'parent_id' => 0,
'timestamp' => strtotime($a['comment_date']),