aboutsummaryrefslogtreecommitdiffstats
path: root/include/api.php
diff options
context:
space:
mode:
authorSebastian Egbers <sebastian@egbers.info>2012-06-22 13:35:36 +0200
committerSebastian Egbers <sebastian@egbers.info>2012-06-22 13:35:36 +0200
commitc14270ac648391660c989d9b5d28fd2d1070c4db (patch)
tree5fa462dffdcc0063535fe78b8452473f560b9bef /include/api.php
parent99000382cd6cf13a2a4d5eb23c63490700bd7d4c (diff)
downloadvolse-hubzilla-c14270ac648391660c989d9b5d28fd2d1070c4db.tar.gz
volse-hubzilla-c14270ac648391660c989d9b5d28fd2d1070c4db.tar.bz2
volse-hubzilla-c14270ac648391660c989d9b5d28fd2d1070c4db.zip
modified conversion to use x function for parameter checking.
Diffstat (limited to 'include/api.php')
-rw-r--r--include/api.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/include/api.php b/include/api.php
index b77156dfa..730e1fa2f 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){