0
$posts_atom.= ' <id>tag:'.$tagged.'</id>'."\r";
0
$posts_atom.= ' <updated>'.when("c", $updated).'</updated>'."\r";
0
$posts_atom.= ' <published>'.when("c", $post->created_at).'</published>'."\r";
0
- $posts_atom.= ' <link href="'.fix($trigger->filter($url, "
feed_url"), false).'" />'."\r";
0
+ $posts_atom.= ' <link href="'.fix($trigger->filter($url, "
post_export_url", $post), false).'" />'."\r";
0
$posts_atom.= ' <author chyrp:user_id="'.$post->user_id.'">'."\r";
0
$posts_atom.= ' <name>'.fix(fallback($post->user()->full_name, $post->user()->login, true), false).'</name>'."\r";
0
$pages_atom.= ' <id>tag:'.$tagged.'</id>'."\r";
0
$pages_atom.= ' <updated>'.when("c", $updated).'</updated>'."\r";
0
$pages_atom.= ' <published>'.when("c", $page->created_at).'</published>'."\r";
0
- $pages_atom.= ' <link href="'.fix($trigger->filter($url, "
feed_url"), false).'" />'."\r";
0
+ $pages_atom.= ' <link href="'.fix($trigger->filter($url, "
page_export_url", $page), false).'" />'."\r";
0
$pages_atom.= ' <author chyrp:user_id="'.fix($page->user_id).'">'."\r";
0
$pages_atom.= ' <name>'.fix(fallback($page->user()->full_name, $page->user()->login, true), false).'</name>'."\r";
0
$zip_contents = $zip->file();
0
+ $filename = sanitize(camelize($config->name), false, true)."_Export_".now()->format("Y-m-d");
0
header("Content-type: application/octet-stream");
0
- header("Content-Disposition: attachment; filename=\"".
sanitize(camelize($config->name), false, true)."_Export_".now()->format("Y-m-d").".zip\"");
0
+ header("Content-Disposition: attachment; filename=\"".
$filename.".zip\"");
0
header("Content-length: ".strlen($zip_contents)."\n\n");
0
if (!Visitor::current()->group()->can("add_post"))
0
show_403(__("Access Denied"), __("You do not have sufficient privileges to import content."));
0
- foreach (array("success_wordpress", "invalid_wordpress") as $message)
0
+ foreach (array("success_wordpress",
0
+ "invalid_chyrp_posts",
0
+ "invalid_chyrp_pages") as $message)
0
$this->context[$message] = isset($_GET[$message]);
0
+ * Function: import_chyrp
0
+ public function import_chyrp() {
0
+ $trigger = Trigger::current();
0
+ if (isset($_FILES['posts_file']) and $_FILES['posts_file']['error'] == 0) {
0
+ $posts = simplexml_load_file($_FILES['posts_file']['tmp_name']);
0
+ if (!$posts or $posts->generator != "Chyrp")
0
+ redirect("/admin/?action=import&invalid_chyrp_posts");
0
+ if (isset($_FILES['pages_file']) and $_FILES['pages_file']['error'] == 0) {
0
+ $pages = simplexml_load_string(file_get_contents($_FILES['pages_file']['tmp_name']));
0
+ if (!$pages or $pages->generator != "Chyrp")
0
+ redirect("/admin/?action=import&invalid_chyrp_pages");
0
+ if (isset($_FILES['posts_file']) and $_FILES['posts_file']['error'] == 0)
0
+ foreach ($posts->entry as $entry) {
0
+ $chyrp = $entry->children("http://chyrp.net/export/1.0/");
0
+ $_POST['feather'] = $chyrp->feather;
0
+ $_POST['status'] = $chyrp->status;
0
+ $_POST['pinned'] = (bool) (int) $chyrp->pinned;
0
+ $_POST['created_at'] = $chyrp->created_at;
0
+ $_POST['updated_at'] = $chyrp->updated_at;
0
+ $data = Post::xml2arr($entry->content->post);
0
+ $post = Post::add($data, $chyrp->clean, Post::check_url($chyrp->url));
0
+ $trigger->call("import_chyrp_post", $entry, $post);
0
+ if (isset($_FILES['pages_file']) and $_FILES['pages_file']['error'] == 0)
0
+ foreach ($pages->entry as $entry) {
0
+ $chyrp = $entry->children("http://chyrp.net/export/1.0/");
0
+ $attr = $entry->attributes("http://chyrp.net/export/1.0/");
0
+ $page = Page::add($entry->title,
0
+ (bool) (int) $chyrp->show_in_list,
0
+ Page::check_url($chyrp->url));
0
+ $trigger->call("import_chyrp_page", $entry, $page);
0
+ redirect("/admin/?action=import&success_chyrp");
0
* Function: import_wordpress
0
public function import_wordpress() {
0
$trigger = Trigger::current();
0
+ $config = Config::current();
0
redirect("/admin/?action=import");
0
- if (!in_array("text",
Config::current()->enabled_feathers))
0
+ if (!in_array("text",
$config->enabled_feathers))
0
error(__("Missing Feather"), __("Importing from WordPress requires the Text feather to be installed and enabled."));
0
if (ini_get("memory_limit") < 20) # Some imports are relatively large.
Comments
No one has commented yet.