From 7e4397ed6b64fd95db1ac2a2efa46696177af36d Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Mon, 23 Jul 2012 09:02:47 +0000 Subject: [PATCH] Missing import files added. --- e107_plugins/import/import_links_class.php | 130 +++++++++++++++++++ e107_plugins/import/import_news_class.php | 141 +++++++++++++++++++++ e107_plugins/import/import_page_class.php | 133 +++++++++++++++++++ 3 files changed, 404 insertions(+) create mode 100644 e107_plugins/import/import_links_class.php create mode 100644 e107_plugins/import/import_news_class.php create mode 100644 e107_plugins/import/import_page_class.php diff --git a/e107_plugins/import/import_links_class.php b/e107_plugins/import/import_links_class.php new file mode 100644 index 000000000..020f32b52 --- /dev/null +++ b/e107_plugins/import/import_links_class.php @@ -0,0 +1,130 @@ + '', + 'link_name' => '', + 'link_url' => '', + 'link_description' => '', + 'link_button' => '', + 'link_category' => 4, + 'link_order' => '', + 'link_parent' => '0', + 'link_open' => '0', + 'link_class' => '0', + 'link_function' => '', + 'link_sefurl' => '' + + ); + + // Fields which must be set up by the caller. + var $mandatory = array( + 'link_name', 'link_url' + ); + + // Constructor + function __construct() + { + global $sql; + $this->pageDB = new db; // Have our own database object to write to the table + } + + + // Empty the DB - not necessary + function emptyTargetDB($inc_admin = FALSE) + { + // $this->pageDB->db_Delete('page'); + } + + + // Set a new default for a particular field + function overrideDefault($key, $value) + { +// echo "Override: {$key} => {$value}
"; + if (!isset($this->defaults[$key])) return FALSE; + $this->defaults[$key] = $value; + } + + + // Returns an array with all relevant fields set to the current default + function getDefaults() + { + return $this->defaults; + } + + /** + * Insert data into e107 DB + * @param row - array of table data + * @return integer, boolean - error code on failure, TRUE on success + */ + function saveData($row) + { + if(!$result = $this->pageDB->db_Insert('links',$row)) + { + return 4; + } + + //if ($result === FALSE) return 6; + + return TRUE; + } + + + + function getErrorText($errnum) // these errors are presumptuous and misleading. especially '4' . + { + $errorTexts = array( + 0 => 'No error', + 1 => 'Can\'t change main admin data', + 2 => 'invalid field passed', + 3 => 'Mandatory field not set', + 4 => 'Entry already exists', + 5 => 'Invalid characters in user or login name', + 6 => 'Error saving extended user fields' + ); + + if (isset($errorTexts[$errnum])) return $errorTexts[$errnum]; + + return 'Unknown: '.$errnum; + + } + + + +} + + +?> \ No newline at end of file diff --git a/e107_plugins/import/import_news_class.php b/e107_plugins/import/import_news_class.php new file mode 100644 index 000000000..c2fe74560 --- /dev/null +++ b/e107_plugins/import/import_news_class.php @@ -0,0 +1,141 @@ + '', // auto-increment + 'news_title' => '', + 'news_sef' => '', + 'news_body' => '', + 'news_extended' => '', + 'news_meta_keywords' => '', + 'news_meta_description' => '', + 'news_datestamp' => '', + 'news_author' => '1', + 'news_category' => '1', + 'news_allow_comments' => '0', + 'news_start' => '0', + 'news_end' => '0', + 'news_class' => '0', + 'news_render_type' => '0', + 'news_comment_total' => '0', + 'news_summary' => '', + 'news_thumbnail' => '', + 'news_sticky' => '0' + ); + + /* Fields which must be set up by the caller. */ + var $mandatory = array( + 'news_title', + 'news_datestamp', + 'news_author' + ); + + // Constructor + function __construct() + { + global $sql; + $this->newsDB = new db; // Have our own database object to write to the news table + } + + + // Empty the news DB + function emptyTargetDB($inc_admin = FALSE) + { + // leave existing + // $this->newsDB->db_Delete('news'); + } + + + // Set a new default for a particular field + function overrideDefault($key, $value) + { +// echo "Override: {$key} => {$value}
"; + if (!isset($this->default[$key])) return FALSE; + $this->default[$key] = $value; + } + + + // Returns an array with all relevant fields set to the current default + function getDefaults() + { + return $this->default; + } + + + + /** + * Insert data into e107 DB + * @param row - array of table data + * @return integer, boolean - error code on failure, TRUE on success + */ + function saveData($row) + { + if(!$result = $this->newsDB->db_Insert('news',$row)) + { + return 4; + } + + //if ($result === FALSE) return 6; + + return TRUE; + } + + + + function getErrorText($errnum) // these errors are presumptuous and misleading. especially '4' . + { + $errorTexts = array( + 0 => 'No error', + 1 => 'Can\'t change main admin data', + 2 => 'invalid field passed', + 3 => 'Mandatory field not set', + 4 => 'Entry already exists', + 5 => 'Invalid characters in user or login name', + 6 => 'Error saving extended user fields' + ); + + if (isset($errorTexts[$errnum])) return $errorTexts[$errnum]; + + return 'Unknown: '.$errnum; + + } + + + +} + + +?> \ No newline at end of file diff --git a/e107_plugins/import/import_page_class.php b/e107_plugins/import/import_page_class.php new file mode 100644 index 000000000..1cd708d59 --- /dev/null +++ b/e107_plugins/import/import_page_class.php @@ -0,0 +1,133 @@ + '', + 'page_title' => '', + 'page_sef' => '', + 'page_metakeys' => '', + 'page_metadscr' => '', + 'page_text' => '', + 'page_author' => 1, + 'page_datestamp' => '', + 'page_rating_flag' => '0', + 'page_comment_flag' => '0', + 'page_password' => '', + 'page_class' => '0', + 'page_ip_restrict' => '', + 'page_theme' => '', + 'page_template' => 'default' + + ); + + // Fields which must be set up by the caller. + var $mandatory = array( + 'page_title', 'page_datestamp', 'page_author', 'page_text' + ); + + // Constructor + function __construct() + { + global $sql; + $this->pageDB = new db; // Have our own database object to write to the table + } + + + // Empty the DB - not necessary + function emptyTargetDB($inc_admin = FALSE) + { + // $this->pageDB->db_Delete('page'); + } + + + // Set a new default for a particular field + function overrideDefault($key, $value) + { +// echo "Override: {$key} => {$value}
"; + if (!isset($this->defaults[$key])) return FALSE; + $this->defaults[$key] = $value; + } + + + // Returns an array with all relevant fields set to the current default + function getDefaults() + { + return $this->defaults; + } + + /** + * Insert data into e107 DB + * @param row - array of table data + * @return integer, boolean - error code on failure, TRUE on success + */ + function saveData($row) + { + if(!$result = $this->pageDB->db_Insert('page',$row)) + { + return 4; + } + + //if ($result === FALSE) return 6; + + return TRUE; + } + + + + function getErrorText($errnum) // these errors are presumptuous and misleading. especially '4' . + { + $errorTexts = array( + 0 => 'No error', + 1 => 'Can\'t change main admin data', + 2 => 'invalid field passed', + 3 => 'Mandatory field not set', + 4 => 'Entry already exists', + 5 => 'Invalid characters in user or login name', + 6 => 'Error saving extended user fields' + ); + + if (isset($errorTexts[$errnum])) return $errorTexts[$errnum]; + + return 'Unknown: '.$errnum; + + } + + + +} + + +?> \ No newline at end of file