Update of /cvsroot/php-blog/serendipity/include/admin/importers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30846/include/admin/importers
Modified Files:
Tag: branch-smarty
generic.inc.php movabletype.inc.php wordpress.inc.php
Log Message:
* fix language strings
* generic import fix for 'draft' setting
Index: generic.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/importers/Attic/generic.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- generic.inc.php 15 Nov 2004 21:06:49 -0000 1.1.2.1
+++ generic.inc.php 16 Nov 2004 11:39:00 -0000 1.1.2.2
@@ -2,37 +2,33 @@
require_once 'bundled-libs/Onyx/RSS.php';
-
-@define('STATUS', 'Status after import');
-@define('RSS_IMPORT_DESC', 'The RSS import will fetch an RSS feed and insert all the entries contained there inside your article base. You can choose if you want to import the items in DRAFT or PUBLISHED state. Categories in the foreign feed need to contain the exact same name like you entered the names in Serendipity. Via the other input box you can choose the category you want to have entries associated which do not match the imported feed.');
-@define('RSS_IMPORT_CATEGORY', 'Use this default category for entries without a matching category');
-
-
class Serendipity_Import_Generic extends Serendipity_Import {
- var $info = array('software' => 'Generic RSS import');
+ var $info = array('software' => IMPORT_GENERIC_RSS);
var $data = array();
var $inputFields = array();
function Serendipity_Import_Generic($data) {
$this->data = $data;
- $this->inputFields = array(array('text' => (RSS .' '. URL),
- 'type' => 'input',
- 'name' => 'url'),
- array('text' => STATUS,
- 'type' => 'list',
- 'name' => 'type',
- 'value' => 'publish',
- 'default' => array('draft' => DRAFT,
- 'publish' => PUBLISH)),
- array('text' => RSS_IMPORT_CATEGORY,
- 'type' => 'list',
- 'name' => 'category',
- 'value' => 0,
- 'default' => $this->_fuckCategoryList()),
- array('text' => RSS_IMPORT_BODYONLY,
- 'type' => 'bool',
- 'name' => 'bodyonly',
- 'value' => 'false'));
+ $this->inputFields = array(array('text' => RSS . ' ' . URL,
+ 'type' => 'input',
+ 'name' => 'url'),
+
+ array('text' => STATUS,
+ 'type' => 'list',
+ 'name' => 'type',
+ 'value' => 'publish',
+ 'default' => array('draft' => DRAFT, 'publish' => PUBLISH)),
+
+ array('text' => RSS_IMPORT_CATEGORY,
+ 'type' => 'list',
+ 'name' => 'category',
+ 'value' => 0,
+ 'default' => $this->_getCategoryList()),
+
+ array('text' => RSS_IMPORT_BODYONLY,
+ 'type' => 'bool',
+ 'name' => 'bodyonly',
+ 'value' => 'false'));
}
function validateData() {
@@ -43,10 +39,10 @@
return $this->inputFields;
}
- function _fuckCategoryList() {
+ function _getCategoryList() {
$res = serendipity_fetchCategories('all');
$ret = array(0 => NO_CATEGORY);
- foreach ( $res as $v ) {
+ foreach ($res as $v) {
$ret[$v['categoryid']] = $v['category_name'];
}
return $ret;
@@ -57,7 +53,6 @@
$entry = array();
$bodyonly = serendipity_get_bool($this->data['bodyonly']);
- $bodyonly = false;
if ($item['description']) {
$entry['body'] = utf8_decode($item['description']);
@@ -88,7 +83,7 @@
$entry['timestamp'] = time();
}
- if ($serendipity['POST']['type'] == 'draft') {
+ if ($this->data['type'] == 'draft') {
$entry['isdraft'] = 'true';
} else {
$entry['isdraft'] = 'false';
@@ -134,4 +129,4 @@
return 'Serendipity_Import_Generic';
/* vim: set sts=4 ts=4 expandtab : */
-?>
+?>
\ No newline at end of file
Index: wordpress.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/importers/Attic/wordpress.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- wordpress.inc.php 15 Nov 2004 21:06:49 -0000 1.1.2.1
+++ wordpress.inc.php 16 Nov 2004 11:39:00 -0000 1.1.2.2
@@ -1,22 +1,9 @@
<?php # $Id$
/*****************************************************************
- * WordPress Importer, by Even *
+ * WordPress Importer, by Evan Nemerson *
*****************************************************************/
-@define('WORDPRESS_DATA', 'WordPress data');
-@define('CREATE_AUTHOR', 'Create author \'%s\'.');
-@define('CREATE_CATEGORY', 'Create category \'%s\'.');
-@define('MYSQL_REQUIRED', 'You must have the MySQL extension in order to perform this action.');
-@define('COULDNT_CONNECT', 'Could not connect to MySQL database: %s.');
-@define('COULDNT_SELECT_DB', 'Could not select database: %s.');
-@define('COULDNT_SELECT_USER_INFO', 'Could not select user information: %s.');
-@define('COULDNT_SELECT_CATEGORY_INFO', 'Could not select category information: %s.');
-@define('COULDNT_SELECT_ENTRY_INFO', 'Could not select entry information: %s.');
-@define('COULDNT_SELECT_COMMENT_INFO', 'Could not select comment information: %s.');
-
-
-
class Serendipity_Import_WordPress extends Serendipity_Import {
var $info = array('software' => 'WordPress');
var $data = array();
@@ -28,15 +15,19 @@
$this->inputFields = array(array('text' => INSTALL_DBHOST,
'type' => 'input',
'name' => 'host'),
+
array('text' => INSTALL_DBUSER,
'type' => 'input',
'name' => 'user'),
+
array('text' => INSTALL_DBPASS,
'type' => 'protected',
'name' => 'pass'),
+
array('text' => INSTALL_DBNAME,
'type' => 'input',
'name' => 'name'),
+
array('text' => INSTALL_DBPREFIX,
'type' => 'input',
'name' => 'prefix'));
@@ -199,13 +190,13 @@
$comment = array('entry_id ' => $entry['entryid'],
'parent_id' => 0,
'timestamp' => strtotime($a['comment_date']),
- 'author' => $a['comment_author'],
- 'email' => $a['comment_author_email'],
- 'url' => $a['comment_author_url'],
- 'ip' => $a['comment_author_IP'],
- 'status' => 'approved',
- 'body' => $a['comment_content'],
- 'type' => 'NORMAL');
+ 'author' => $a['comment_author'],
+ 'email' => $a['comment_author_email'],
+ 'url' => $a['comment_author_url'],
+ 'ip' => $a['comment_author_IP'],
+ 'status' => 'approved',
+ 'body' => $a['comment_content'],
+ 'type' => 'NORMAL');
serendipity_db_insert('comments', $comment);
serendipity_approveComment($cid, $id, true);
@@ -221,4 +212,4 @@
return 'Serendipity_Import_WordPress';
/* vim: set sts=4 ts=4 expandtab : */
-?>
+?>
\ No newline at end of file
Index: movabletype.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/importers/Attic/movabletype.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- movabletype.inc.php 15 Nov 2004 21:06:49 -0000 1.1.2.1
+++ movabletype.inc.php 16 Nov 2004 11:39:00 -0000 1.1.2.2
@@ -1,13 +1,9 @@
<?php # $Id$
/*****************************************************************
- * MovableType Importer, by Even *
+ * MovableType Importer, by Evan Nemerson *
*****************************************************************/
-@define('MAX_COMPAT_OLD_BLOG', 'To enable maximum compatibility with your old blog, please...');
-@define('MT_DATA_FILE', 'Movable Type data file');
-@define('FORCE', 'Force');
-
class Serendipity_Import_MovableType extends Serendipity_Import {
var $info = array('software' => 'MovableType');
var $data = array();
@@ -15,12 +11,13 @@
function Serendipity_Import_MovableType($data) {
$this->data = $data;
- $this->inputFields = array(array('text' => MT_DATA_FILE,
- 'type' => 'file',
- 'name' => 'mt_dat'),
- array('text' => FORCE,
- 'type' => 'bool',
- 'name' => 'mt_force',
+ $this->inputFields = array(array('text' => MT_DATA_FILE,
+ 'type' => 'file',
+ 'name' => 'mt_dat'),
+
+ array('text' => FORCE,
+ 'type' => 'bool',
+ 'name' => 'mt_force',
'default' => 'true'));
}
@@ -32,16 +29,15 @@
return $this->inputFields;
}
-
function import() {
global $serendipity;
- $force = ($this->data['force'] == 'true');
+ $force = ($this->data['force'] == 'true');
$contents = file_get_contents($serendipity['FILES']['tmp_name']['mt_dat']);
- $authors = array();
+ $authors = array();
$categories = serendipity_fetchCategories();
- $tasks = array();
+ $tasks = array();
$entries = array();
$n = 0;
|