aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormike <mike@zeus.(none)>2012-10-22 19:18:50 +1100
committermike <mike@zeus.(none)>2012-10-22 19:18:50 +1100
commit56b95d50edb93f7e1f0aa5a5c6e5cd3c7ee6619c (patch)
tree9c8be8086db1a71a62e896d305ebd27e2df05559
parent8f9ddcb536ae46f1c6b3d3c19db1598dc4a51616 (diff)
downloadvolse-hubzilla-56b95d50edb93f7e1f0aa5a5c6e5cd3c7ee6619c.tar.gz
volse-hubzilla-56b95d50edb93f7e1f0aa5a5c6e5cd3c7ee6619c.tar.bz2
volse-hubzilla-56b95d50edb93f7e1f0aa5a5c6e5cd3c7ee6619c.zip
more mod cleanups
-rw-r--r--mod/pretheme.php2
-rw-r--r--mod/starred.php20
2 files changed, 13 insertions, 9 deletions
diff --git a/mod/pretheme.php b/mod/pretheme.php
index 4584cb29e..1974f5f00 100644
--- a/mod/pretheme.php
+++ b/mod/pretheme.php
@@ -7,7 +7,7 @@ function pretheme_init(&$a) {
$info = get_theme_info($theme);
if($info) {
// unfortunately there will be no translation for this string
- $desc = $info['description'];
+ $desc = $info['description'];
$version = $info['version'];
$credits = $info['credits'];
}
diff --git a/mod/starred.php b/mod/starred.php
index 035b81e76..af11acfb5 100644
--- a/mod/starred.php
+++ b/mod/starred.php
@@ -12,24 +12,28 @@ function starred_init(&$a) {
if(! $message_id)
killme();
- $r = q("SELECT starred FROM item WHERE uid = %d AND id = %d LIMIT 1",
+ $r = q("SELECT item_flags FROM item WHERE uid = %d AND id = %d LIMIT 1",
intval(local_user()),
intval($message_id)
);
if(! count($r))
killme();
- if(! intval($r[0]['starred']))
- $starred = 1;
+ $item_flags = $r[0]['item_flags'];
- $r = q("UPDATE item SET starred = %d WHERE uid = %d and id = %d LIMIT 1",
- intval($starred),
+ if($item_flags & ITEM_STARRED)
+ $item_flags -= ITEM_STARRED;
+ else
+ $item_flags = $item_flags | ITEM_STARRED;
+
+
+ $r = q("UPDATE item SET item_flags = %d WHERE uid = %d and id = %d LIMIT 1",
+ intval($item_flags),
intval(local_user()),
intval($message_id)
);
- // the json doesn't really matter, it will either be 0 or 1
-
- echo json_encode($starred);
+ header('Content-type: application/json');
+ echo json_encode(array('result' => intval($item_flags & ITEM_STARRED)));
killme();
}