2010-07-23 03:22:03 +00:00
|
|
|
<?php
|
|
|
|
|
2013-04-26 03:01:24 +00:00
|
|
|
require_once('include/photo/photo_driver.php');
|
2014-02-21 01:07:43 +00:00
|
|
|
require_once('include/identity.php');
|
2013-02-06 00:54:09 +00:00
|
|
|
require_once('include/photos.php');
|
2013-01-23 01:48:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2010-07-23 03:22:03 +00:00
|
|
|
function wall_upload_post(&$a) {
|
|
|
|
|
2014-11-18 23:13:37 +00:00
|
|
|
|
2013-01-23 01:48:42 +00:00
|
|
|
$using_api = ((x($_FILES,'media')) ? true : false);
|
|
|
|
|
|
|
|
if($using_api) {
|
|
|
|
require_once('include/api.php');
|
|
|
|
$user_info = api_get_user($a);
|
|
|
|
$nick = $user_info['screen_name'];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(argc() > 1)
|
2012-10-24 10:11:52 +00:00
|
|
|
$nick = argv(1);
|
2013-01-23 01:48:42 +00:00
|
|
|
}
|
|
|
|
|
2014-02-21 01:07:43 +00:00
|
|
|
$channel = (($nick) ? get_channel_by_nick($nick) : false);
|
2010-12-06 02:08:36 +00:00
|
|
|
|
2013-01-23 01:48:42 +00:00
|
|
|
if(! $channel) {
|
|
|
|
if($using_api)
|
|
|
|
return;
|
2013-02-06 00:54:09 +00:00
|
|
|
notice( t('Channel not found.') . EOL);
|
|
|
|
killme();
|
2013-01-23 01:48:42 +00:00
|
|
|
}
|
2012-04-08 23:19:45 +00:00
|
|
|
|
2013-01-23 01:48:42 +00:00
|
|
|
$observer = $a->get_observer();
|
|
|
|
|
2013-02-06 00:54:09 +00:00
|
|
|
$args = array( 'source' => 'editor', 'album' => t('Wall Photos'),
|
|
|
|
'not_visible' => 1, 'contact_allow' => array($channel['channel_hash']));
|
2012-06-25 23:03:46 +00:00
|
|
|
|
2013-02-06 00:54:09 +00:00
|
|
|
$ret = photo_upload($channel,$observer,$args);
|
2010-07-23 03:22:03 +00:00
|
|
|
|
2013-02-06 00:54:09 +00:00
|
|
|
if(! $ret['success']) {
|
2013-01-23 01:48:42 +00:00
|
|
|
if($using_api)
|
|
|
|
return;
|
2013-02-06 00:54:09 +00:00
|
|
|
notice($ret['message']);
|
|
|
|
killme();
|
2010-07-23 05:41:45 +00:00
|
|
|
}
|
2010-07-23 03:22:03 +00:00
|
|
|
|
2013-02-06 00:54:09 +00:00
|
|
|
if($using_api)
|
2014-03-09 03:08:12 +00:00
|
|
|
return("\n\n" . $ret['body'] . "\n\n");
|
2013-02-06 00:54:09 +00:00
|
|
|
else
|
|
|
|
echo "\n\n" . $ret['body'] . "\n\n";
|
2010-07-23 03:22:03 +00:00
|
|
|
killme();
|
2011-03-05 04:55:32 +00:00
|
|
|
}
|