aboutsummaryrefslogtreecommitdiffstats
path: root/include/api.php
diff options
context:
space:
mode:
authorMax Weller <git@max-weller.de>2012-06-23 22:59:03 +0200
committerMax Weller <git@max-weller.de>2012-06-23 22:59:03 +0200
commitcbf1cab0da2b67c8a88f301ce9ce6b83db27ec0b (patch)
tree5e3d48daf6d83049d7961d8f4bdee87d47d2609d /include/api.php
parente3c36dfd1d1fea0b6d3ba6d6b58fcc8ed0c2dd36 (diff)
parentcd25c3b5dd61755791dcde8dfd09e0032bcfb197 (diff)
downloadvolse-hubzilla-cbf1cab0da2b67c8a88f301ce9ce6b83db27ec0b.tar.gz
volse-hubzilla-cbf1cab0da2b67c8a88f301ce9ce6b83db27ec0b.tar.bz2
volse-hubzilla-cbf1cab0da2b67c8a88f301ce9ce6b83db27ec0b.zip
Merge remote-tracking branch 'sebastian/master'
Diffstat (limited to 'include/api.php')
-rw-r--r--include/api.php45
1 files changed, 30 insertions, 15 deletions
diff --git a/include/api.php b/include/api.php
index 49286d262..1db9d020b 100644
--- a/include/api.php
+++ b/include/api.php
@@ -864,8 +864,13 @@
logger('API: api_statuses_show: '.$id);
//$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
- //$sql_extra = "";
- if ($_GET["conversation"] == "true") $sql_extra .= " AND `item`.`parent` = %d ORDER BY `received` ASC "; else $sql_extra .= " AND `item`.`id` = %d";
+ $conversation = (x($_REQUEST,'conversation')?1:0);
+
+ $sql_extra = '';
+ if ($conversation)
+ $sql_extra .= " AND `item`.`parent` = %d ORDER BY `received` ASC ";
+ else
+ $sql_extra .= " AND `item`.`id` = %d";
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
@@ -875,16 +880,15 @@
WHERE `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
AND `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- $sql_extra
- ",
+ $sql_extra",
intval($id)
);
-//var_dump($r);
+
$ret = api_format_items($r,$user_info);
-//var_dump($ret);
- if ($_GET["conversation"] == "true") {
+
+ if ($conversation) {
$data = array('$statuses' => $ret);
- return api_apply_template("timeline", $type, $data);
+ return api_apply_template("timeline", $type, $data);
} else {
$data = array('$status' => $ret[0]);
/*switch($type){
@@ -1509,21 +1513,32 @@
if (local_user()===false) return false;
if (!x($_POST, "text") || !x($_POST,"screen_name")) return;
-
+
$sender = api_get_user($a);
$r = q("SELECT `id` FROM `contact` WHERE `uid`=%d AND `nick`='%s'",
intval(local_user()),
dbesc($_POST['screen_name']));
+ require_once("include/message.php");
+
$recipient = api_get_user($a, $r[0]['id']);
-
+ $replyto = '';
+ if (x($_REQUEST,'replyto')) {
+ $r = q('SELECT `uri` FROM `mail` WHERE `uid`=%d AND `id`=%d',
+ intval(local_user()),
+ intval($_REQUEST['replyto']));
+ $replyto = $r[0]['uri'];
+ }
+
+ if (x($_REQUEST,'title')) {
+ $sub = $_REQUEST['title'];
+ }
+ else {
+ $sub = ((strlen($_POST['text'])>10)?substr($_POST['text'],0,10)."...":$_POST['text']);
+ }
+ $id = send_message($recipient['id'], $_POST['text'], $sub, $replyto);
- require_once("include/message.php");
- $sub = ( (strlen($_POST['text'])>10)?substr($_POST['text'],0,10)."...":$_POST['text']);
- $id = send_message($recipient['id'], $_POST['text'], $sub);
-
-
if ($id>-1) {
$r = q("SELECT * FROM `mail` WHERE id=%d", intval($id));
$item = $r[0];