aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-08-20 17:15:13 -0700
committerfriendica <info@friendica.com>2014-08-20 17:15:13 -0700
commita6829f7dcb6735ee0b2f003647cc168e55002a5f (patch)
treee85d0ddd4c516092f9a7da5ef779a8b35e1da3a4 /mod
parente842359e9b3c02ad2bbfe8f6bb9b702d1502f1c5 (diff)
downloadvolse-hubzilla-a6829f7dcb6735ee0b2f003647cc168e55002a5f.tar.gz
volse-hubzilla-a6829f7dcb6735ee0b2f003647cc168e55002a5f.tar.bz2
volse-hubzilla-a6829f7dcb6735ee0b2f003647cc168e55002a5f.zip
move Friendica photo migrator to addons, bring back a few XML scraping functions that we're going to require (unfortunately)
Diffstat (limited to 'mod')
-rw-r--r--mod/frphotos.php87
1 files changed, 0 insertions, 87 deletions
diff --git a/mod/frphotos.php b/mod/frphotos.php
deleted file mode 100644
index 8d6197fa3..000000000
--- a/mod/frphotos.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-
-
-
-function frphotos_init(&$a) {
-
- if(! local_user())
- return;
-
- if(intval(get_pconfig(local_user(),'frphotos','complete')))
- return;
-
- $channel = $a->get_channel();
-
- $fr_server = $_REQUEST['fr_server'];
- $fr_username = $_REQUEST['fr_username'];
- $fr_password = $_REQUEST['fr_password'];
-
- $cookies = 'store/[data]/frphoto_cookie_' . $channel['channel_address'];
-
- if($fr_server && $fr_username && $fr_password) {
-
- $ch = curl_init($fr_server . '/api/friendica/photos/list');
-
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookies);
- curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookies);
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
- curl_setopt($ch, CURLOPT_USERPWD, $fr_username . ':' . $fr_password);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_USERAGENT, 'RedMatrix');
-
- $output = curl_exec($ch);
- curl_close($ch);
-
- $j = json_decode($output,true);
-
-// echo print_r($j,true);
-
- $total = 0;
- if(count($j)) {
- foreach($j as $jj) {
-
- $r = q("select uid from photo where resource_id = '%s' and uid = %d limit 1",
- dbesc($jj),
- intval($channel['channel_id'])
- );
- if($r)
- continue;
-
- $total ++;
- proc_run('php','util/frphotohelper.php',$jj, $channel['channel_address'], urlencode($fr_server));
- sleep(3);
- }
- }
- if($total) {
- set_pconfig(local_user(),'frphotos','complete','1');
- }
- @unlink($cookies);
- goaway(z_root() . '/photos/' . $channel['channel_address']);
- }
-}
-
-
-function frphotos_content(&$a) {
-
- if(! local_user()) {
- notice( t('Permission denied') . EOL);
- return;
- }
-
- if(intval(get_pconfig(local_user(),'frphotos','complete'))) {
- info('Friendica photos have already been imported into this channel.');
- return;
- }
-
- $o = replace_macros(get_markup_template('frphotos.tpl'),array(
- '$header' => t('Friendica Photo Album Import'),
- '$desc' => t('This will import all your Friendica photo albums to this Red channel.'),
- '$fr_server' => array('fr_server', t('Friendica Server base URL'),'',''),
- '$fr_username' => array('fr_username', t('Friendica Login Username'),'',''),
- '$fr_password' => array('fr_password', t('Friendica Login Password'),'',''),
- '$submit' => t('Submit'),
- ));
- return $o;
-}