aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-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();
}