diff --git a/include/admin/importers/b2evolution.inc.php b/include/admin/importers/b2evolution.inc.php index bb261bc6..c58e73a5 100644 --- a/include/admin/importers/b2evolution.inc.php +++ b/include/admin/importers/b2evolution.inc.php @@ -16,7 +16,7 @@ class Serendipity_Import_b2evolution extends Serendipity_Import { return ''; } - function Serendipity_Import_b2evolution($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input', diff --git a/include/admin/importers/bblog.inc.php b/include/admin/importers/bblog.inc.php index f660c56a..7e2d802f 100644 --- a/include/admin/importers/bblog.inc.php +++ b/include/admin/importers/bblog.inc.php @@ -12,7 +12,7 @@ class Serendipity_Import_bblog extends Serendipity_Import { var $inputFields = array(); var $categories = array(); - function Serendipity_Import_bblog($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input', diff --git a/include/admin/importers/blogger.inc.php b/include/admin/importers/blogger.inc.php index 18b3d8a3..e01936d9 100644 --- a/include/admin/importers/blogger.inc.php +++ b/include/admin/importers/blogger.inc.php @@ -6,14 +6,14 @@ * Blogger Importer v0.2, by Jawish Hameed (jawish.org) * ****************************************************************/ -require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; +require_once S9Y_PEAR_PATH . 'HTTP/Request2.php'; class Serendipity_Import_Blogger extends Serendipity_Import { var $info = array('software' => 'Blogger.com [using API]'); var $data = array(); var $inputFields = array(); - function Serendipity_Import_Blogger($data) { + function __construct($data) { global $serendipity; $this->data = $data; @@ -56,17 +56,17 @@ class Serendipity_Import_Blogger extends Serendipity_Import { if (!empty($_REQUEST['token'])) { // Prepare session token request - $req = new HTTP_Request('https://www.google.com/accounts/AuthSubSessionToken'); - $req->addHeader('Authorization', 'AuthSub token="'. $_REQUEST['token'] .'"'); + $req = new HTTP_Request2('https://www.google.com/accounts/AuthSubSessionToken'); + $req->setHeader('Authorization', 'AuthSub token="'. $_REQUEST['token'] .'"'); // Request token - $req->sendRequest(); + $response = $req->send(); // Handle token reponse - if ($req->getResponseCode() != '200') return; + if ($response->getStatus() != '200') return; // Extract Auth token - preg_match_all('/^(.+)=(.+)$/m', $req->getResponseBody(), $matches); + preg_match_all('/^(.+)=(.+)$/m', $response->getBody(), $matches); $tokens = array_combine($matches[1], $matches[2]); unset($matches); @@ -77,18 +77,18 @@ class Serendipity_Import_Blogger extends Serendipity_Import { 'default' => $tokens['Token'])); // Prepare blog list request - $req = new HTTP_Request('http://www.blogger.com/feeds/default/blogs'); - $req->addHeader('GData-Version', 2); - $req->addHeader('Authorization', 'AuthSub token="'. $tokens['Token'] .'"'); + $req = new HTTP_Request2('http://www.blogger.com/feeds/default/blogs'); + $req->setHeader('GData-Version', 2); + $req->setHeader('Authorization', 'AuthSub token="'. $tokens['Token'] .'"'); // Fetch blog list - $req->sendRequest(); + $response = $req->send(); // Handle errors - if ($req->getResponseCode() != '200') return false; + if ($response->getStatus() != '200') return false; // Load list - $bXml = simplexml_load_string($req->getResponseBody()); + $bXml = simplexml_load_string($response->getBody()); // Generate list of the blogs under the authenticated account $bList = array(); @@ -139,15 +139,15 @@ class Serendipity_Import_Blogger extends Serendipity_Import { $this->getTransTable(); // Prepare export request - $req = new HTTP_Request('http://www.blogger.com/feeds/'. $this->data['bId'] .'/archive'); - $req->addHeader('GData-Version', 2); - $req->addHeader('Authorization', 'AuthSub token="'. $this->data['bAuthToken'] .'"'); + $req = new HTTP_Request2('http://www.blogger.com/feeds/'. $this->data['bId'] .'/archive'); + $req->setHeader('GData-Version', 2); + $req->setHeader('Authorization', 'AuthSub token="'. $this->data['bAuthToken'] .'"'); // Attempt fetch blog export - $req->sendRequest(); + $response = $req->send(); // Handle errors - if ($req->getResponseCode() != '200') { + if ($response->getStatus() != '200') { echo "Error occured while trying to export the blog."; return false; } @@ -164,7 +164,7 @@ class Serendipity_Import_Blogger extends Serendipity_Import { unset($s9y_users); // Load export - $bXml = simplexml_load_string($req->getResponseBody()); + $bXml = simplexml_load_string($response->getBody()); // Process entries $entryList = $entryFailList = array(); diff --git a/include/admin/importers/bmachine.inc.php b/include/admin/importers/bmachine.inc.php index 2aed03da..4e3d61be 100644 --- a/include/admin/importers/bmachine.inc.php +++ b/include/admin/importers/bmachine.inc.php @@ -16,7 +16,7 @@ class Serendipity_Import_bmachine extends Serendipity_Import { return ''; } - function Serendipity_Import_bmachine($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input', diff --git a/include/admin/importers/geeklog.inc.php b/include/admin/importers/geeklog.inc.php index bd21bb93..cbb144df 100644 --- a/include/admin/importers/geeklog.inc.php +++ b/include/admin/importers/geeklog.inc.php @@ -16,7 +16,7 @@ class Serendipity_Import_geeklog extends Serendipity_Import { return 'GeekLog has a granular control over access privileges which cannot be migrated to Serendipity. All Users will be migrated as Superusers, you may need to set them to editor or chief users manually after import.'; } - function Serendipity_Import_geeklog($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input', diff --git a/include/admin/importers/generic.inc.php b/include/admin/importers/generic.inc.php index 27aeaedd..2dbc0f30 100644 --- a/include/admin/importers/generic.inc.php +++ b/include/admin/importers/generic.inc.php @@ -10,7 +10,7 @@ class Serendipity_Import_Generic extends Serendipity_Import { var $inputFields = array(); var $force_recode = false; - function Serendipity_Import_Generic($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => RSS . ' ' . URL, 'type' => 'input', @@ -139,18 +139,21 @@ class Serendipity_Import_Generic extends Serendipity_Import { $serendipity['noautodiscovery'] = 1; $uri = $this->data['url']; - require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; + require_once S9Y_PEAR_PATH . 'HTTP/Request2.php'; serendipity_request_start(); - $req = new HTTP_Request($uri, array('allowRedirects' => true, 'maxRedirects' => 5)); - $res = $req->sendRequest(); - - if (PEAR::isError($res) || $req->getResponseCode() != '200') { + $req = new HTTP_Request2($uri, HTTP_Request2::METHOD_GET, array('follow_redirects' => true, 'max_redirects' => 5)); + try { + $res = $req->send(); + if ($res->getStatus() != '200') { + throw new HTTP_Request2_Exception('could not fetch url: status != 200'); + } + } catch (HTTP_Request2_Exception $e) { serendipity_request_end(); echo '' . IMPORT_FAILED . ': ' . serendipity_specialchars($this->data['url']) . ''; return false; } - $fContent = $req->getResponseBody(); + $fContent = $res->getBody(); serendipity_request_end(); echo '' . strlen($fContent) . " Bytes"; diff --git a/include/admin/importers/lifetype.inc.php b/include/admin/importers/lifetype.inc.php index 2ea1cef4..10a4c85c 100644 --- a/include/admin/importers/lifetype.inc.php +++ b/include/admin/importers/lifetype.inc.php @@ -16,7 +16,7 @@ class Serendipity_Import_lifetype extends Serendipity_Import { return ''; } - function Serendipity_Import_lifetype($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input', diff --git a/include/admin/importers/livejournal.inc.php b/include/admin/importers/livejournal.inc.php index a2fd6468..a8b7e088 100644 --- a/include/admin/importers/livejournal.inc.php +++ b/include/admin/importers/livejournal.inc.php @@ -11,7 +11,7 @@ class Serendipity_Import_LiveJournalXML extends Serendipity_Import { var $inputFields = array(); var $force_recode = false; - function Serendipity_Import_LiveJournalXML($data) { + function __construct($data) { global $serendipity; $this->data = $data; $this->inputFields = array(array('text' => 'LiveJournal XML', diff --git a/include/admin/importers/movabletype.inc.php b/include/admin/importers/movabletype.inc.php index 6cad6633..f79ce0c3 100644 --- a/include/admin/importers/movabletype.inc.php +++ b/include/admin/importers/movabletype.inc.php @@ -24,7 +24,7 @@ class Serendipity_Import_MovableType extends Serendipity_Import { var $data = array(); var $inputFields = array(); - function Serendipity_Import_MovableType($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => MT_DATA_FILE, 'type' => 'file', diff --git a/include/admin/importers/nucleus.inc.php b/include/admin/importers/nucleus.inc.php index aefff762..2598e058 100644 --- a/include/admin/importers/nucleus.inc.php +++ b/include/admin/importers/nucleus.inc.php @@ -12,7 +12,7 @@ class Serendipity_Import_Nucleus extends Serendipity_Import { var $inputFields = array(); - function Serendipity_Import_Nucleus($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input', diff --git a/include/admin/importers/nuke.inc.php b/include/admin/importers/nuke.inc.php index 47648f3e..c34058ad 100644 --- a/include/admin/importers/nuke.inc.php +++ b/include/admin/importers/nuke.inc.php @@ -16,7 +16,7 @@ class Serendipity_Import_nuke extends Serendipity_Import { return ''; } - function Serendipity_Import_nuke($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input', diff --git a/include/admin/importers/old_blogger.inc.php b/include/admin/importers/old_blogger.inc.php index b0099a54..d8f59e98 100644 --- a/include/admin/importers/old_blogger.inc.php +++ b/include/admin/importers/old_blogger.inc.php @@ -7,7 +7,7 @@ class Serendipity_Import_OldBlogger extends Serendipity_Import { var $data = array(); var $inputFields = array(); - function Serendipity_Import_OldBlogger($data) { + function __construct($data) { global $serendipity; $this->data = $data; diff --git a/include/admin/importers/phpbb.inc.php b/include/admin/importers/phpbb.inc.php index 5c8a35b4..0505930b 100644 --- a/include/admin/importers/phpbb.inc.php +++ b/include/admin/importers/phpbb.inc.php @@ -12,7 +12,7 @@ class Serendipity_Import_phpbb extends Serendipity_Import { var $inputFields = array(); var $categories = array(); - function Serendipity_Import_phpbb($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input', diff --git a/include/admin/importers/pivot.inc.php b/include/admin/importers/pivot.inc.php index cb6a6166..b087062b 100644 --- a/include/admin/importers/pivot.inc.php +++ b/include/admin/importers/pivot.inc.php @@ -10,7 +10,7 @@ class Serendipity_Import_Pivot extends Serendipity_Import { var $data = array(); var $inputFields = array(); - function Serendipity_Import_Pivot($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => PARENT_DIRECTORY, 'type' => 'input', diff --git a/include/admin/importers/pmachine.inc.php b/include/admin/importers/pmachine.inc.php index 751dbcc1..692a9d01 100644 --- a/include/admin/importers/pmachine.inc.php +++ b/include/admin/importers/pmachine.inc.php @@ -12,7 +12,7 @@ class Serendipity_Import_pMachine extends Serendipity_Import { var $inputFields = array(); - function Serendipity_Import_pMachine($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input', diff --git a/include/admin/importers/serendipity.inc.php b/include/admin/importers/serendipity.inc.php index 871b48b2..1be32319 100644 --- a/include/admin/importers/serendipity.inc.php +++ b/include/admin/importers/serendipity.inc.php @@ -24,7 +24,7 @@ class Serendipity_Import_Serendipity extends Serendipity_Import {

After these precautions: The importer code generally works very well for me and my purposes. Your mileage may vary.

'; } - function Serendipity_Import_Serendipity ($data) { + function __construct($data) { global $serendipity; $this->data = $data; diff --git a/include/admin/importers/smf.inc.php b/include/admin/importers/smf.inc.php index e2690467..28afcede 100644 --- a/include/admin/importers/smf.inc.php +++ b/include/admin/importers/smf.inc.php @@ -16,7 +16,7 @@ class Serendipity_Import_smf extends Serendipity_Import { return '

SMF uses salted MD5 passwords that Serendipity cannot import. Thus, those passwords are incompatible with the MD5 hashing of Serendipity. The passwords for all users have been set to a random string. You need to modify the passwords manually for each user, we are sorry for that inconvenience.

'; } - function Serendipity_Import_smf($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input', diff --git a/include/admin/importers/sunlog.inc.php b/include/admin/importers/sunlog.inc.php index 8a843128..03309d3c 100644 --- a/include/admin/importers/sunlog.inc.php +++ b/include/admin/importers/sunlog.inc.php @@ -17,7 +17,7 @@ class Serendipity_Import_sunlog extends Serendipity_Import { . '

Sunlog has a granular control over access privileges which cannot be migrated to Serendipity. All Users will be migrated as Superusers, you may need to set them to editor or chief users manually after import.

'; } - function Serendipity_Import_sunlog($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input', diff --git a/include/admin/importers/textpattern.inc.php b/include/admin/importers/textpattern.inc.php index cf7f9dfe..73220eec 100644 --- a/include/admin/importers/textpattern.inc.php +++ b/include/admin/importers/textpattern.inc.php @@ -16,7 +16,7 @@ class Serendipity_Import_textpattern extends Serendipity_Import { return '

Textpattern uses MySQLs native PASSWORD() function to save passwords. Thus, those passwords are incompatible with the MD5 hashing of Serendipity. The passwords for all users have been set to "txp". You need to modify the passwords manually for each user, we are sorry for that inconvenience.

'; } - function Serendipity_Import_textpattern($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input', diff --git a/include/admin/importers/voodoopad.inc.php b/include/admin/importers/voodoopad.inc.php index c5cf82d0..919be871 100755 --- a/include/admin/importers/voodoopad.inc.php +++ b/include/admin/importers/voodoopad.inc.php @@ -41,7 +41,7 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import { var $inputFields = array(); var $force_recode = false; - function Serendipity_Import_VoodooPad($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array( array('text' => IMPORTER_VOODOO_FILEPROMPT, diff --git a/include/admin/importers/wordpress-pg.inc.php b/include/admin/importers/wordpress-pg.inc.php index 5610b8e9..8aa6d368 100644 --- a/include/admin/importers/wordpress-pg.inc.php +++ b/include/admin/importers/wordpress-pg.inc.php @@ -12,7 +12,7 @@ class Serendipity_Import_WordPress_PG extends Serendipity_Import { var $inputFields = array(); - function Serendipity_Import_WordPress_PG($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input', diff --git a/include/admin/importers/wordpress.inc.php b/include/admin/importers/wordpress.inc.php index bd1b663c..dfcd32c2 100644 --- a/include/admin/importers/wordpress.inc.php +++ b/include/admin/importers/wordpress.inc.php @@ -12,7 +12,7 @@ class Serendipity_Import_WordPress extends Serendipity_Import { var $inputFields = array(); - function Serendipity_Import_WordPress($data) { + function __construct($data) { $this->data = $data; $this->inputFields = array(array('text' => INSTALL_DBHOST, 'type' => 'input',