summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/admin_export/appinfo/info.xml11
-rw-r--r--apps/admin_export/settings.php96
-rw-r--r--apps/admin_export/templates/settings.php13
-rw-r--r--apps/admin_migrate/appinfo/app.php (renamed from apps/admin_export/appinfo/app.php)12
-rw-r--r--apps/admin_migrate/appinfo/info.xml11
-rw-r--r--apps/admin_migrate/settings.php55
-rw-r--r--apps/admin_migrate/templates/settings.php31
-rw-r--r--apps/bookmarks/appinfo/app.php1
-rw-r--r--apps/bookmarks/appinfo/migrate.php69
-rw-r--r--apps/user_migrate/admin.php87
-rw-r--r--apps/user_migrate/ajax/export.php61
-rw-r--r--apps/user_migrate/appinfo/app.php35
-rw-r--r--apps/user_migrate/appinfo/info.xml11
-rw-r--r--apps/user_migrate/js/export.js27
-rw-r--r--apps/user_migrate/settings.php29
-rw-r--r--apps/user_migrate/templates/admin.php13
-rw-r--r--apps/user_migrate/templates/settings.php6
17 files changed, 442 insertions, 126 deletions
diff --git a/apps/admin_export/appinfo/info.xml b/apps/admin_export/appinfo/info.xml
deleted file mode 100644
index df8a07c2f5b..00000000000
--- a/apps/admin_export/appinfo/info.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<info>
- <id>admin_export</id>
- <name>Import/Export</name>
- <description>Import/Export your owncloud data</description>
- <version>0.1</version>
- <licence>AGPL</licence>
- <author>Thomas Schmidt</author>
- <require>2</require>
- <default_enable/>
-</info>
diff --git a/apps/admin_export/settings.php b/apps/admin_export/settings.php
deleted file mode 100644
index a33c872ccf4..00000000000
--- a/apps/admin_export/settings.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-
-/**
- * ownCloud - admin export
- *
- * @author Thomas Schmidt
- * @copyright 2011 Thomas Schmidt tom@opensuse.org
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-OC_Util::checkAdminUser();
-OC_Util::checkAppEnabled('admin_export');
-if (isset($_POST['admin_export'])) {
- $root = OC::$SERVERROOT . "/";
- $zip = new ZipArchive();
- $filename = get_temp_dir() . "/owncloud_export_" . date("y-m-d_H-i-s") . ".zip";
- OC_Log::write('admin_export',"Creating export file at: " . $filename,OC_Log::INFO);
- if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) {
- exit("Cannot open <$filename>\n");
- }
-
- if (isset($_POST['owncloud_system'])) {
- // adding owncloud system files
- OC_Log::write('admin_export',"Adding owncloud system files to export",OC_Log::INFO);
- zipAddDir($root, $zip, false);
- foreach (array(".git", "3rdparty", "apps", "core", "files", "l10n", "lib", "ocs", "search", "settings", "tests") as $dirname) {
- zipAddDir($root . $dirname, $zip, true, basename($root) . "/");
- }
- }
-
- if (isset($_POST['owncloud_config'])) {
- // adding owncloud config
- // todo: add database export
- OC_Log::write('admin_export',"Adding owncloud config to export",OC_Log::INFO);
- zipAddDir($root . "config/", $zip, true, basename($root) . "/");
- $zip->addFile($root . '/data/.htaccess', basename($root) . "/data/owncloud.db");
- }
-
- if (isset($_POST['user_files'])) {
- // adding user files
- $zip->addFile($root . '/data/.htaccess', basename($root) . "/data/.htaccess");
- $zip->addFile($root . '/data/index.html', basename($root) . "/data/index.html");
- foreach (OC_User::getUsers() as $i) {
- OC_Log::write('admin_export',"Adding owncloud user files of $i to export",OC_Log::INFO);
- zipAddDir($root . "data/" . $i, $zip, true, basename($root) . "/data/");
- }
- }
-
- $zip->close();
-
- header("Content-Type: application/zip");
- header("Content-Disposition: attachment; filename=" . basename($filename));
- header("Content-Length: " . filesize($filename));
- @ob_end_clean();
- readfile($filename);
- unlink($filename);
-} else {
-// fill template
- $tmpl = new OC_Template('admin_export', 'settings');
- return $tmpl->fetchPage();
-}
-
-function zipAddDir($dir, $zip, $recursive=true, $internalDir='') {
- $dirname = basename($dir);
- $zip->addEmptyDir($internalDir . $dirname);
- $internalDir.=$dirname.='/';
-
- if ($dirhandle = opendir($dir)) {
- while (false !== ( $file = readdir($dirhandle))) {
-
- if (( $file != '.' ) && ( $file != '..' )) {
-
- if (is_dir($dir . '/' . $file) && $recursive) {
- zipAddDir($dir . '/' . $file, $zip, $recursive, $internalDir);
- } elseif (is_file($dir . '/' . $file)) {
- $zip->addFile($dir . '/' . $file, $internalDir . $file);
- }
- }
- }
- closedir($dirhandle);
- } else {
- OC_Log::write('admin_export',"Was not able to open directory: " . $dir,OC_Log::ERROR);
- }
-}
diff --git a/apps/admin_export/templates/settings.php b/apps/admin_export/templates/settings.php
deleted file mode 100644
index 47689facbbc..00000000000
--- a/apps/admin_export/templates/settings.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<form id="export" action="#" method="post">
- <fieldset class="personalblock">
- <legend><strong><?php echo $l->t('Export this ownCloud instance');?></strong></legend>
- <p><?php echo $l->t('This will create a compressed file that contains the data of this owncloud instance.
- Please choose which components should be included:');?>
- </p>
- <p><input type="checkbox" id="user_files" name="user_files" value="true"><label for="user_files"><?php echo $l->t('User files');?></label><br/>
- <input type="checkbox" id="owncloud_system" name="owncloud_system" value="true"><label for="owncloud_system"><?php echo $l->t('ownCloud system files');?></label><br/>
- <input type="checkbox" id="owncloud_config" name="owncloud_config" value="true"><label for="owncloud_config"><?php echo $l->t('ownCloud configuration');?></label>
- </p>
- <input type="submit" name="admin_export" value="Export" />
- </fieldset>
-</form>
diff --git a/apps/admin_export/appinfo/app.php b/apps/admin_migrate/appinfo/app.php
index beebb4864e9..e45d3f6a529 100644
--- a/apps/admin_export/appinfo/app.php
+++ b/apps/admin_migrate/appinfo/app.php
@@ -1,10 +1,10 @@
<?php
/**
-* ownCloud - user_ldap
+* ownCloud - admin_migrate
*
-* @author Dominik Schmidt
-* @copyright 2011 Dominik Schmidt dev@dominik-schmidt.de
+* @author Tom Needham
+* @copyright 2012 Tom Needham tom@owncloud.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -22,12 +22,12 @@
*/
-OC_APP::registerAdmin('admin_export','settings');
+OC_APP::registerAdmin('admin_migrate','settings');
// add settings page to navigation
$entry = array(
- 'id' => "admin_export_settings",
+ 'id' => "admin_migrate_settings",
'order'=>1,
- 'href' => OC_Helper::linkTo( "admin_export", "settings.php" ),
+ 'href' => OC_Helper::linkTo( "admin_migrate", "settings.php" ),
'name' => 'Export'
);
diff --git a/apps/admin_migrate/appinfo/info.xml b/apps/admin_migrate/appinfo/info.xml
new file mode 100644
index 00000000000..67fc3f9c5a0
--- /dev/null
+++ b/apps/admin_migrate/appinfo/info.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<info>
+ <id>admin_migrate</id>
+ <name>ownCloud Instance Migration</name>
+ <description>Import/Export your owncloud instance</description>
+ <version>0.1</version>
+ <licence>AGPL</licence>
+ <author>Thomas Schmidt and Tom Needham</author>
+ <require>2</require>
+ <default_enable/>
+</info>
diff --git a/apps/admin_migrate/settings.php b/apps/admin_migrate/settings.php
new file mode 100644
index 00000000000..981d5f4ca63
--- /dev/null
+++ b/apps/admin_migrate/settings.php
@@ -0,0 +1,55 @@
+<?php
+
+/**
+ * ownCloud - admin_migrate
+ *
+ * @author Thomas Schmidt
+ * @copyright 2011 Thomas Schmidt tom@opensuse.org
+ * @author Tom Needham
+ * @copyright 2012 Tom Needham tom@owncloud.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+OC_Util::checkAdminUser();
+OC_Util::checkAppEnabled('admin_migrate');
+
+// Export?
+if (isset($_POST['admin_export'])) {
+ // Create the export zip
+ if( !$path = OC_Migrate::export( null, $_POST['export_type'] ) ){
+ // Error
+ die('error');
+ } else {
+ // Download it
+ header("Content-Type: application/zip");
+ header("Content-Disposition: attachment; filename=" . basename($path));
+ header("Content-Length: " . filesize($path));
+ @ob_end_clean();
+ readfile( $path );
+ unlink( $path );
+ }
+// Import?
+} else if( isset($_POST['admin_import']) ){
+ $from = $_FILES['owncloud_import']['tmp_name'];
+
+ if( !OC_Migrate::import( $from, 'instance' ) ){
+ die('failed');
+ }
+
+} else {
+// fill template
+ $tmpl = new OC_Template('admin_migrate', 'settings');
+ return $tmpl->fetchPage();
+} \ No newline at end of file
diff --git a/apps/admin_migrate/templates/settings.php b/apps/admin_migrate/templates/settings.php
new file mode 100644
index 00000000000..91e305074e4
--- /dev/null
+++ b/apps/admin_migrate/templates/settings.php
@@ -0,0 +1,31 @@
+<form id="export" action="#" method="post">
+ <fieldset class="personalblock">
+ <legend><strong><?php echo $l->t('Export this ownCloud instance');?></strong></legend>
+ <p><?php echo $l->t('This will create a compressed file that contains the data of this owncloud instance.
+ Please choose the export type:');?>
+ </p>
+ <h3>What would you like to export?</h3>
+ <p>
+ <input type="radio" name="export_type" value="instance" /> ownCloud instance (suitable for import )<br />
+ <input type="radio" name="export_type" value="system" /> ownCloud system files<br />
+ <input type="radio" name="export_type" value="userfiles" /> Just user files<br />
+ <input type="submit" name="admin_export" value="<?php echo $l->t('Export'); ?>" />
+ </fieldset>
+</form>
+<?php
+/*
+ * EXPERIMENTAL
+?>
+<form id="import" action="#" method="post" enctype="multipart/form-data">
+ <fieldset class="personalblock">
+ <legend><strong><?php echo $l->t('Import an ownCloud instance. THIS WILL DELETE ALL CURRENT OWNCLOUD DATA');?></strong></legend>
+ <p><?php echo $l->t('All current ownCloud data will be replaced by the ownCloud instance that is uploaded.');?>
+ </p>
+ <p><input type="file" id="owncloud_import" name="owncloud_import"><label for="owncloud_import"><?php echo $l->t('ownCloud Export Zip File');?></label>
+ </p>
+ <input type="submit" name="admin_import" value="<?php echo $l->t('Import'); ?>" />
+ </fieldset>
+</form>
+<?php
+*/
+?>
diff --git a/apps/bookmarks/appinfo/app.php b/apps/bookmarks/appinfo/app.php
index 09d7b5df525..b9c308ca053 100644
--- a/apps/bookmarks/appinfo/app.php
+++ b/apps/bookmarks/appinfo/app.php
@@ -17,4 +17,5 @@ OC_App::addNavigationEntry( array( 'id' => 'bookmarks_index', 'order' => 70, 'hr
OC_App::registerPersonal('bookmarks', 'settings');
OC_Util::addScript('bookmarks','bookmarksearch');
+
OC_Search::registerProvider('OC_Search_Provider_Bookmarks');
diff --git a/apps/bookmarks/appinfo/migrate.php b/apps/bookmarks/appinfo/migrate.php
new file mode 100644
index 00000000000..603a8b72d3c
--- /dev/null
+++ b/apps/bookmarks/appinfo/migrate.php
@@ -0,0 +1,69 @@
+<?php
+class OC_Migration_Provider_Bookmarks extends OC_Migration_Provider{
+
+ // Create the xml for the user supplied
+ function export( ){
+ OC_Log::write('migration','starting export for bookmarks',OC_Log::INFO);
+ $options = array(
+ 'table'=>'bookmarks',
+ 'matchcol'=>'user_id',
+ 'matchval'=>$this->uid,
+ 'idcol'=>'id'
+ );
+ $ids = $this->content->copyRows( $options );
+
+ $options = array(
+ 'table'=>'bookmarks_tags',
+ 'matchcol'=>'bookmark_id',
+ 'matchval'=>$ids
+ );
+
+ // Export tags
+ $ids2 = $this->content->copyRows( $options );
+
+ // If both returned some ids then they worked
+ if( is_array( $ids ) && is_array( $ids2 ) )
+ {
+ return true;
+ } else {
+ return false;
+ }
+
+ }
+
+ // Import function for bookmarks
+ function import( ){
+ switch( $this->appinfo->version ){
+ default:
+ // All versions of the app have had the same db structure, so all can use the same import function
+ $query = $this->content->prepare( "SELECT * FROM bookmarks WHERE user_id LIKE ?" );
+ $results = $query->execute( array( $this->olduid ) );
+ $idmap = array();
+ while( $row = $results->fetchRow() ){
+ // Import each bookmark, saving its id into the map
+ $query = OC_DB::prepare( "INSERT INTO *PREFIX*bookmarks(url, title, user_id, public, added, lastmodified) VALUES (?, ?, ?, ?, ?, ?)" );
+ $query->execute( array( $row['url'], $row['title'], $this->uid, $row['public'], $row['added'], $row['lastmodified'] ) );
+ // Map the id
+ $idmap[$row['id']] = OC_DB::insertid();
+ }
+ // Now tags
+ foreach($idmap as $oldid => $newid){
+ $query = $this->content->prepare( "SELECT * FROM bookmarks_tags WHERE bookmark_id LIKE ?" );
+ $results = $query->execute( array( $oldid ) );
+ while( $row = $results->fetchRow() ){
+ // Import the tags for this bookmark, using the new bookmark id
+ $query = OC_DB::prepare( "INSERT INTO *PREFIX*bookmarks_tags(bookmark_id, tag) VALUES (?, ?)" );
+ $query->execute( array( $newid, $row['tag'] ) );
+ }
+ }
+ // All done!
+ break;
+ }
+
+ return true;
+ }
+
+}
+
+// Load the provider
+new OC_Migration_Provider_Bookmarks( 'bookmarks' ); \ No newline at end of file
diff --git a/apps/user_migrate/admin.php b/apps/user_migrate/admin.php
new file mode 100644
index 00000000000..510c54abe3d
--- /dev/null
+++ b/apps/user_migrate/admin.php
@@ -0,0 +1,87 @@
+<?php
+
+/**
+ * ownCloud - user_migrate
+ *
+ * @author Tom Needham
+ * @copyright 2012 Tom Needham tom@owncloud.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+OC_Util::checkAdminUser();
+OC_Util::checkAppEnabled('user_migrate');
+
+// Import?
+if (isset($_POST['user_import'])) {
+
+ $root = OC::$SERVERROOT . "/";
+ $importname = "owncloud_import_" . date("y-m-d_H-i-s");
+
+ // Save data dir for later
+ $datadir = OC_Config::getValue( 'datadirectory' );
+
+ // Copy the uploaded file
+ $from = $_FILES['owncloud_import']['tmp_name'];
+ $to = get_temp_dir().'/'.$importname.'.zip';
+ if( !move_uploaded_file( $from, $to ) ){
+ $error = array('error'=>'Failed to move the uploaded file','hint'=>'Try checking the permissions of the '.get_temp_dir().' dir.');
+ OC_Log::write( 'user_migrate', "Failed to copy the uploaded file", OC_Log::ERROR );
+ $tmpl = new OC_Template('user_migrate', 'admin');
+ $tmpl->assign('error',$error);
+ return $tmpl->fetchPage();
+ }
+
+ if( !$appsstatus = OC_Migrate::import( $to, 'user' ) ){
+ $error = array('error'=>'There was an error while importing the user!','hint'=>'Please check the logs for a more detailed explaination');
+ $tmpl = new OC_Template('user_migrate', 'admin');
+ $tmpl->assign('error',$error);
+ return $tmpl->fetchPage();
+ } else {
+ // Check import status
+ foreach( $appsstatus as $app => $status ){
+ if( $status != 'true' ){
+ // It failed for some reason
+ if( $status == 'notsupported' ){
+ $notsupported[] = $app;
+ } else if( !$status ){
+ $failed[] = $app;
+ }
+ }
+ }
+ // Any problems?
+ if( isset( $notsupported ) || isset( $failed ) ){
+ if( count( $failed ) > 0 ){
+ $error = array('error'=>'Some app data failed to import','hint'=>'App data for: '.implode(', ', $failed).' failed to import.');
+ $tmpl = new OC_Template('user_migrate', 'admin');
+ $tmpl->assign('error',$error);
+ return $tmpl->fetchPage();
+ } else if( count( $notsupported ) > 0 ){
+ $error = array('error'=>'Some app data could not be imported, as the apps are not installed on this instance','hint'=>'App data for: '.implode(', ', $notsupported).' failed to import as they were not found. Please install the apps and try again');
+ $tmpl = new OC_Template('user_migrate', 'admin');
+ $tmpl->assign('error',$error);
+ return $tmpl->fetchPage();
+ }
+ } else {
+ // Went swimmingly!
+ $tmpl = new OC_Template('user_migrate', 'admin');
+ return $tmpl->fetchPage();
+ }
+ }
+
+} else {
+// fill template
+ $tmpl = new OC_Template('user_migrate', 'admin');
+ return $tmpl->fetchPage();
+} \ No newline at end of file
diff --git a/apps/user_migrate/ajax/export.php b/apps/user_migrate/ajax/export.php
new file mode 100644
index 00000000000..fac96577fa2
--- /dev/null
+++ b/apps/user_migrate/ajax/export.php
@@ -0,0 +1,61 @@
+<?php
+
+/**
+ * ownCloud - user_migrate
+ *
+ * @author Tom Needham
+ * @copyright 2012 Tom Needham tom@owncloud.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+// Init owncloud
+require_once('../../../lib/base.php');
+
+// Check if we are a user
+OC_JSON::checkLoggedIn();
+OC_Util::checkAppEnabled('user_migrate');
+// Which operation
+if( $_GET['operation']=='create' ){
+$uid = !empty( $_POST['uid'] ) ? $_POST['uid'] : OC_User::getUser();
+if( $uid != OC_User::getUser() ){
+ // Needs to be admin to export someone elses account
+ OC_JSON::error();
+ die();
+}
+// Create the export zip
+if( !$path = OC_Migrate::export( $uid ) ){
+ // Error
+ OC_JSON::error();
+ die();
+} else {
+ // Save path in session
+ $_SESSION['ocuserexportpath'] = $path;
+}
+OC_JSON::success();
+die();
+} else if( $_GET['operation']=='download' ){
+ // Download the export
+ $path = isset( $_SESSION['ocuserexportpath'] ) ? $_SESSION['ocuserexportpath'] : false;
+ if( !$path ){
+ die();
+ }
+ header("Content-Type: application/zip");
+ header("Content-Disposition: attachment; filename=" . basename($path));
+ header("Content-Length: " . filesize($path));
+ @ob_end_clean();
+ readfile($path);
+ unlink( $path );
+ $_SESSION['ocuserexportpath'] = '';
+}
diff --git a/apps/user_migrate/appinfo/app.php b/apps/user_migrate/appinfo/app.php
new file mode 100644
index 00000000000..a59b6dd705c
--- /dev/null
+++ b/apps/user_migrate/appinfo/app.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+* ownCloud - user_migrate
+*
+* @author Tom Needham
+* @copyright 2012 Tom Needham tom@owncloud.com
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+OC_APP::registerPersonal( 'user_migrate', 'settings' );
+OC_APP::registerAdmin( 'user_migrate', 'admin' );
+OC_Util::addScript( 'user_migrate', 'export');
+
+// add settings page to navigation
+$entry = array(
+ 'id' => "user_migrate_settings",
+ 'order'=>1,
+ 'href' => OC_Helper::linkTo( "user_migrate", "admin.php" ),
+ 'name' => 'Import'
+);
+?> \ No newline at end of file
diff --git a/apps/user_migrate/appinfo/info.xml b/apps/user_migrate/appinfo/info.xml
new file mode 100644
index 00000000000..6abcb4af92c
--- /dev/null
+++ b/apps/user_migrate/appinfo/info.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<info>
+ <id>user_migrate</id>
+ <name>User Account Migration</name>
+ <description>Migrate your user accounts</description>
+ <version>0.1</version>
+ <licence>AGPL</licence>
+ <author>Tom Needham</author>
+ <require>2</require>
+ <default_enable/>
+</info>
diff --git a/apps/user_migrate/js/export.js b/apps/user_migrate/js/export.js
new file mode 100644
index 00000000000..2d660b2de6b
--- /dev/null
+++ b/apps/user_migrate/js/export.js
@@ -0,0 +1,27 @@
+$(document).ready(function(){
+ // Do the export
+ $('#exportbtn').click(function(){
+ // Show loader
+ $('.loading').show();
+ $.getJSON(
+ OC.filePath('user_migrate','ajax','export.php'),
+ {operation:'create'},
+ function(result){
+ if(result.status == 'success'){
+ // Download the file
+ window.location = OC.filePath('user_migrate','ajax','export.php?operation=download') ;
+ $('.loading').hide();
+ $('#exportbtn').val(t('user_migrate', 'Export'));
+ } else {
+ // Cancel loading
+ $('#exportbtn').html('Failed');
+ // Show Dialog
+ OC.dialogs.alert(t('user_migrate', 'Something went wrong while the export file was being generated'), t('user_migrate', 'An error has occurred'), function(){
+ $('#exportbtn').html(t('user_migrate', 'Export')+'<img style="display: none;" class="loading" src="'+OC.filePath('core','img','loading.gif')+'" />');
+ });
+ }
+ }
+ // End ajax
+ );
+ });
+}); \ No newline at end of file
diff --git a/apps/user_migrate/settings.php b/apps/user_migrate/settings.php
new file mode 100644
index 00000000000..62f347b3557
--- /dev/null
+++ b/apps/user_migrate/settings.php
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * ownCloud - user_migrate
+ *
+ * @author Thomas Schmidt
+ * @copyright 2011 Thomas Schmidt tom@opensuse.org
+ * @author Tom Needham
+ * @copyright 2012 Tom Needham tom@owncloud.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+OC_Util::checkAppEnabled('user_migrate');
+
+// fill template
+$tmpl = new OC_Template('user_migrate', 'settings');
+return $tmpl->fetchPage(); \ No newline at end of file
diff --git a/apps/user_migrate/templates/admin.php b/apps/user_migrate/templates/admin.php
new file mode 100644
index 00000000000..b01e5c7579a
--- /dev/null
+++ b/apps/user_migrate/templates/admin.php
@@ -0,0 +1,13 @@
+<form id="import" action="#" method="post" enctype="multipart/form-data">
+ <fieldset class="personalblock">
+ <?php if(isset($_['error'])){ ?>
+ <h3><?php echo $_['error']['error']; ?></h3>
+ <p><?php echo $_['error']['hint']; ?></p>
+ <?php } ?>
+ <legend><strong><?php echo $l->t('Import user account');?></strong></legend>
+ </p>
+ <p><input type="file" id="owncloud_import" name="owncloud_import"><label for="owncloud_import"><?php echo $l->t('ownCloud User Zip');?></label>
+ </p>
+ <input type="submit" name="user_import" value="<?php echo $l->t('Import'); ?>" />
+ </fieldset>
+</form>
diff --git a/apps/user_migrate/templates/settings.php b/apps/user_migrate/templates/settings.php
new file mode 100644
index 00000000000..5f4857de5fa
--- /dev/null
+++ b/apps/user_migrate/templates/settings.php
@@ -0,0 +1,6 @@
+<fieldset class="personalblock">
+ <legend><strong><?php echo $l->t('Export your user account');?></strong></legend>
+ <p><?php echo $l->t('This will create a compressed file that contains your ownCloud account.');?>
+ </p>
+ <button id="exportbtn">Export<img style="display: none;" class="loading" src="<?php echo OC_Helper::linkTo('core', 'img/loading.gif'); ?>" /></button>
+</fieldset>