aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/api.php48
-rwxr-xr-xinclude/items.php4
-rw-r--r--mod/item.php2
3 files changed, 51 insertions, 3 deletions
diff --git a/include/api.php b/include/api.php
index dc270167b..47c78113a 100644
--- a/include/api.php
+++ b/include/api.php
@@ -533,6 +533,12 @@ require_once('include/items.php');
api_register_func('api/red/channel/export/basic','api_export_basic', true);
+
+
+
+
+
+
function api_channel_stream(&$a, $type) {
if(api_user() === false) {
logger('api_channel_stream: no user');
@@ -691,6 +697,48 @@ require_once('include/items.php');
api_register_func('api/statuses/update','api_statuses_update', true);
+ function red_item_new(&$a, $type) {
+
+ if (api_user() === false) {
+ logger('api_statuses_update: no user');
+ return false;
+ }
+
+ logger('api_statuses_update: REQUEST ' . print_r($_REQUEST,true));
+ logger('api_statuses_update: FILES ' . print_r($_FILES,true));
+
+
+ // set this so that the item_post() function is quiet and doesn't redirect or emit json
+
+ $_REQUEST['api_source'] = true;
+ $_REQUEST['profile_uid'] = api_user();
+
+ if(x($_FILES,'media')) {
+ $_FILES['userfile'] = $_FILES['media'];
+ // upload the image if we have one
+ $_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo
+ require_once('mod/wall_upload.php');
+ $media = wall_upload_post($a);
+ if(strlen($media)>0)
+ $_REQUEST['body'] .= "\n\n".$media;
+ }
+
+ require_once('mod/item.php');
+ $x = item_post($a);
+ json_return_and_die($x);
+ }
+
+ api_register_func('api/red/item/new','red_item_new', true);
+
+
+
+
+
+
+
+
+
+
function api_status_show(&$a, $type){
$user_info = api_get_user($a);
diff --git a/include/items.php b/include/items.php
index 6ff984370..70e098415 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1548,7 +1548,7 @@ function item_store($arr,$allow_exec = false) {
$allow_exec = $d['allow_exec'];
- $ret = array('result' => false, 'item_id' => 0);
+ $ret = array('success' => false, 'item_id' => 0);
if(! $arr['uid']) {
logger('item_store: no uid');
@@ -1933,7 +1933,7 @@ function item_store_update($arr,$allow_exec = false) {
- $ret = array('result' => false, 'item_id' => 0);
+ $ret = array('success' => false, 'item_id' => 0);
if(! intval($arr['uid'])) {
logger('item_store_update: no uid');
$ret['message'] = 'no uid.';
diff --git a/mod/item.php b/mod/item.php
index 2feb64a37..6ea434542 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -862,7 +862,7 @@ function item_post(&$a) {
// figure out how to return, depending on from whence we came
if($api_source)
- return;
+ return $post;
if($return_path) {
goaway($a->get_baseurl() . "/" . $return_path);