aboutsummaryrefslogtreecommitdiffstats
path: root/mod/import_items.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-04-18 20:38:38 -0700
committerredmatrix <git@macgirvin.com>2016-04-18 20:38:38 -0700
commit2a4e8972e0edfa3156d9ce54d68ce0e54c0ec289 (patch)
tree2376d950ba2bdc7753336a3e2b94865c95c238f2 /mod/import_items.php
parent2a61817bad96526994c0499f1fc0a843a9cc9405 (diff)
downloadvolse-hubzilla-2a4e8972e0edfa3156d9ce54d68ce0e54c0ec289.tar.gz
volse-hubzilla-2a4e8972e0edfa3156d9ce54d68ce0e54c0ec289.tar.bz2
volse-hubzilla-2a4e8972e0edfa3156d9ce54d68ce0e54c0ec289.zip
module updates
Diffstat (limited to 'mod/import_items.php')
-rw-r--r--mod/import_items.php123
1 files changed, 0 insertions, 123 deletions
diff --git a/mod/import_items.php b/mod/import_items.php
deleted file mode 100644
index df3afb3ea..000000000
--- a/mod/import_items.php
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-
-require_once('include/import.php');
-
-function import_items_post(&$a) {
-
- if(! local_channel())
- return;
-
- $data = null;
-
- $src = $_FILES['filename']['tmp_name'];
- $filename = basename($_FILES['filename']['name']);
- $filesize = intval($_FILES['filename']['size']);
- $filetype = $_FILES['filename']['type'];
-
- if($src) {
- // This is OS specific and could also fail if your tmpdir isn't very large
- // mostly used for Diaspora which exports gzipped files.
-
- if(strpos($filename,'.gz')){
- @rename($src,$src . '.gz');
- @system('gunzip ' . escapeshellarg($src . '.gz'));
- }
-
- if($filesize) {
- $data = @file_get_contents($src);
- }
- unlink($src);
- }
-
- if(! $src) {
-
- $old_address = ((x($_REQUEST,'old_address')) ? $_REQUEST['old_address'] : '');
-
- if(! $old_address) {
- logger('mod_import: nothing to import.');
- notice( t('Nothing to import.') . EOL);
- return;
- }
-
- $email = ((x($_REQUEST,'email')) ? $_REQUEST['email'] : '');
- $password = ((x($_REQUEST,'password')) ? $_REQUEST['password'] : '');
-
- $year = ((x($_REQUEST,'year')) ? $_REQUEST['year'] : '');
-
- $channelname = substr($old_address,0,strpos($old_address,'@'));
- $servername = substr($old_address,strpos($old_address,'@')+1);
-
- $scheme = 'https://';
- $api_path = '/api/red/channel/export/items?f=&channel=' . $channelname . '&year=' . intval($year);
- $binary = false;
- $redirects = 0;
- $opts = array('http_auth' => $email . ':' . $password);
- $url = $scheme . $servername . $api_path;
- $ret = z_fetch_url($url, $binary, $redirects, $opts);
- if(! $ret['success'])
- $ret = z_fetch_url('http://' . $servername . $api_path, $binary, $redirects, $opts);
- if($ret['success'])
- $data = $ret['body'];
- else
- notice( t('Unable to download data from old server') . EOL);
-
- }
-
- if(! $data) {
- logger('mod_import: empty file.');
- notice( t('Imported file is empty.') . EOL);
- return;
- }
-
- $data = json_decode($data,true);
-
-// logger('import: data: ' . print_r($data,true));
-// print_r($data);
-
-
- if(array_key_exists('compatibility',$data) && array_key_exists('database',$data['compatibility'])) {
- $v1 = substr($data['compatibility']['database'],-4);
- $v2 = substr(DB_UPDATE_VERSION,-4);
- if($v2 > $v1) {
- $t = sprintf( t('Warning: Database versions differ by %1$d updates.'), $v2 - $v1 );
- notice($t);
- }
- }
-
- $channel = App::get_channel();
-
-
- if(array_key_exists('item',$data) && $data['item']) {
- import_items($channel,$data['item']);
- }
-
- if(array_key_exists('item_id',$data) && $data['item_id']) {
- import_item_ids($channel,$data['item_id']);
- }
-
- info( t('Import completed') . EOL);
- return;
-}
-
-
-
-
-function import_items_content(&$a) {
-
- if(! local_channel()) {
- notice( t('Permission denied') . EOL);
- return login();
- }
-
- $o = replace_macros(get_markup_template('item_import.tpl'),array(
- '$title' => t('Import Items'),
- '$desc' => t('Use this form to import existing posts and content from an export file.'),
- '$label_filename' => t('File to Upload'),
- '$submit' => t('Submit')
- ));
-
- return $o;
-
-}
-
-