diff options
author | Paolo Tacconi <p.tacconi@giunti.it> | 2014-09-26 14:40:22 +0200 |
---|---|---|
committer | Paolo Tacconi <p.tacconi@giunti.it> | 2014-09-26 14:40:22 +0200 |
commit | eaf96f987a5f22a54fdbb4cedef52b0159a37ad0 (patch) | |
tree | f1fce3898b757e3a29e928cc1afe724edb620471 /mod | |
parent | 6324a07dd8b17db5da0ce66c99fb69e2f3ec49e1 (diff) | |
parent | 574c4845b711c9ebf53efb2a0fe846f5aea46e87 (diff) | |
download | volse-hubzilla-eaf96f987a5f22a54fdbb4cedef52b0159a37ad0.tar.gz volse-hubzilla-eaf96f987a5f22a54fdbb4cedef52b0159a37ad0.tar.bz2 volse-hubzilla-eaf96f987a5f22a54fdbb4cedef52b0159a37ad0.zip |
Rebase from upstream
Diffstat (limited to 'mod')
-rw-r--r-- | mod/import.php | 57 | ||||
-rw-r--r-- | mod/photos.php | 21 |
2 files changed, 67 insertions, 11 deletions
diff --git a/mod/import.php b/mod/import.php index 2fbb71fc4..e5a22a26e 100644 --- a/mod/import.php +++ b/mod/import.php @@ -30,7 +30,7 @@ function import_post(&$a) { $data = null; $seize = ((x($_REQUEST,'make_primary')) ? intval($_REQUEST['make_primary']) : 0); - + $import_posts = ((x($_REQUEST,'import_posts')) ? intval($_REQUEST['import_posts']) : 0); $src = $_FILES['filename']['tmp_name']; $filename = basename($_FILES['filename']['name']); $filesize = intval($_FILES['filename']['size']); @@ -60,6 +60,8 @@ function import_post(&$a) { $scheme = 'https://'; $api_path = '/api/red/channel/export/basic?f=&channel=' . $channelname; + if($import_posts) + $api_path .= '&posts=1'; $binary = false; $redirects = 0; $opts = array('http_auth' => $email . ':' . $password); @@ -376,7 +378,57 @@ function import_post(&$a) { } } -//FIXME just a note here for when folks want to import content - be very careful to unset ITEM_ORIGIN on all imported content. Or you could end up with a nasty routing loop when somebody tries to reply to one of those posts. + if($import_posts && array_key_exists('item',$data) && $data['item']) { + foreach($data['item'] as $i) { + $item = get_item_elements($i); + + $r = q("select id, edited from item where mid = '%s' and uid = %d limit 1", + dbesc($item['mid']), + intval($channel['channel_id']) + ); + if($r) { + if($item['edited'] > $r[0]['edited']) { + $item['id'] = $r[0]['id']; + $item['uid'] = $channel['channel_id']; + item_store_update($item); + continue; + } + } + else { + $item['aid'] = $channel['channel_account_id']; + $item['uid'] = $channel['channel_id']; + $item_result = item_store($item); + } + + } + + } + + if(array_key_exists('item_id',$data) && $data['item_id']) { + foreach($data['item_id'] as $i) { + $r = q("select id from item where mid = '%s' and uid = %d limit 1", + dbesc($i['mid']), + intval($channel['channel_id']) + ); + if(! $r) + continue; + $z = q("select * from item_id where service = '%s' and sid = '%s' and iid = %d and uid = %d limit 1", + dbesc($i['service']), + dbesc($i['sid']), + intval($r[0]['id']), + intval($channel['channel_id']) + ); + if(! $z) { + q("insert into item_id (iid,uid,sid,service) values(%d,%d,'%s','%s')", + intval($r[0]['id']), + intval($channel['channel_id']), + dbesc($i['sid']), + dbesc($i['service']) + ); + } + } + } + // FIXME - ensure we have a self entry if somebody is trying to pull a fast one @@ -417,6 +469,7 @@ function import_content(&$a) { '$label_old_pass' => t('Your old login password'), '$common' => t('For either option, please choose whether to make this hub your new primary address, or whether your old location should continue this role. You will be able to post from either location, but only one can be marked as the primary location for files, photos, and media.'), '$label_import_primary' => t('Make this hub my primary location'), + '$label_import_posts' => t('Import existing posts if possible'), '$email' => '', '$pass' => '', '$submit' => t('Submit') diff --git a/mod/photos.php b/mod/photos.php index 44a7ce0f0..c2d90184e 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -652,9 +652,10 @@ function photos_content(&$a) { intval($a->pager['start']), intval($a->pager['itemspage']) ); - - $o .= '<h3>' . $album . '</h3>'; + $o .= '<div class="section-title-wrapper">'; + $o .= '<h3>' . $album . '</h3>'; + $o .= '<div class="section-title-submenu">'; if($cmd === 'edit') { if(($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { if($can_post) { @@ -680,22 +681,24 @@ function photos_content(&$a) { else { if(($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { if($can_post) { - $o .= '<div id="album-edit-link"><a href="'. $a->get_baseurl() . '/photos/' - . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '/edit' . '">' - . t('Edit Album') . '</a></div>'; + $o .= '<a href="'. $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '/edit' . '">' . t('Edit Album') . '</a>'; } } } if($_GET['order'] === 'posted') - $o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '" >' . t('Show Newest First') . '</a></div>'; + $o .= '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '" >' . t('Show Newest First') . '</a>'; else - $o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '?f=&order=posted" >' . t('Show Oldest First') . '</a></div>'; - + $o .= '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '?f=&order=posted" >' . t('Show Oldest First') . '</a>'; + /* if($can_post) { - $o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/upload/' . bin2hex($album) . '" >' . t('Upload New Photos') . '</a></div>'; + $o .= '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/upload/' . bin2hex($album) . '" >' . t('Upload New Photos') . '</<a>'; } + */ + + $o .= '</div>'; // section-title-submenu + $o .= '</div>'; // section-title-wrapper $ajaxout = ''; |