streams/mod/wall_upload.php

52 lines
967 B
PHP
Raw Normal View History

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');
require_once('include/photos.php');
2010-07-23 03:22:03 +00:00
function wall_upload_post(&$a) {
2014-11-18 23:13:37 +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);
}
2014-02-21 01:07:43 +00:00
$channel = (($nick) ? get_channel_by_nick($nick) : false);
if(! $channel) {
if($using_api)
return;
notice( t('Channel not found.') . EOL);
killme();
}
$observer = $a->get_observer();
$args = array( 'source' => 'editor', 'visible' => 0, 'contact_allow' => array($channel['channel_hash']));
$ret = photo_upload($channel,$observer,$args);
2010-07-23 03:22:03 +00:00
if(! $ret['success']) {
if($using_api)
return;
notice($ret['message']);
killme();
2010-07-23 05:41:45 +00:00
}
2010-07-23 03:22:03 +00:00
if($using_api)
return("\n\n" . $ret['body'] . "\n\n");
else
echo "\n\n" . $ret['body'] . "\n\n";
2010-07-23 03:22:03 +00:00
killme();
}