aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/ItemObject.php6
-rw-r--r--include/conversation.php6
-rw-r--r--js/main.js2
-rw-r--r--mod/starred.php10
4 files changed, 12 insertions, 12 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php
index e85461682..3035203f8 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -173,14 +173,14 @@ class Item extends BaseObject {
if($this->is_toplevel()) {
if($conv->get_profile_owner() == local_user()) {
- $isstarred = (($item['starred']) ? "starred" : "unstarred");
+ $isstarred = (($item['item_flags'] & ITEM_STARRED) ? "starred" : "unstarred");
$star = array(
'do' => t("add star"),
'undo' => t("remove star"),
'toggle' => t("toggle star status"),
- 'classdo' => (($item['starred']) ? "hidden" : ""),
- 'classundo' => (($item['starred']) ? "" : "hidden"),
+ 'classdo' => (($item['item_flags'] & ITEM_STARRED) ? "hidden" : ""),
+ 'classundo' => (($item['item_flags'] & ITEM_STARRED) ? "" : "hidden"),
'starred' => t('starred'),
'tagger' => t("add tag"),
'classtagger' => "",
diff --git a/include/conversation.php b/include/conversation.php
index 332171e03..4238ff586 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -513,14 +513,14 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
}
}
if($profile_owner == local_user()) {
- $isstarred = (($item['starred']) ? "starred" : "unstarred");
+ $isstarred = (($item['item_flags'] & ITEM_STARRED) ? "starred" : "unstarred");
$star = array(
'do' => t("add star"),
'undo' => t("remove star"),
'toggle' => t("toggle star status"),
- 'classdo' => (($item['starred']) ? "hidden" : ""),
- 'classundo' => (($item['starred']) ? "" : "hidden"),
+ 'classdo' => (($item['item_flags'] & ITEM_STARRED) ? "hidden" : ""),
+ 'classundo' => (($item['item_flags'] & ITEM_STARRED) ? "" : "hidden"),
'starred' => t('starred'),
'tagger' => t("add tag"),
'classtagger' => "",
diff --git a/js/main.js b/js/main.js
index 330780e86..cda011c2e 100644
--- a/js/main.js
+++ b/js/main.js
@@ -548,7 +548,7 @@ function updateConvItems(mode,data) {
ident = ident.toString();
$('#like-rotator-' + ident).show();
$.get('starred/' + ident, function(data) {
- if(data.match(/1/)) {
+ if(data.result == 1) {
$('#starred-' + ident).addClass('starred');
$('#starred-' + ident).removeClass('unstarred');
$('#star-' + ident).addClass('hidden');
diff --git a/mod/starred.php b/mod/starred.php
index af11acfb5..530c5c7e0 100644
--- a/mod/starred.php
+++ b/mod/starred.php
@@ -7,8 +7,8 @@ function starred_init(&$a) {
if(! local_user())
killme();
- if($a->argc > 1)
- $message_id = intval($a->argv[1]);
+ if(argc() > 1)
+ $message_id = intval(argv(1));
if(! $message_id)
killme();
@@ -24,7 +24,7 @@ function starred_init(&$a) {
if($item_flags & ITEM_STARRED)
$item_flags -= ITEM_STARRED;
else
- $item_flags = $item_flags | ITEM_STARRED;
+ $item_flags += ITEM_STARRED;
$r = q("UPDATE item SET item_flags = %d WHERE uid = %d and id = %d LIMIT 1",
@@ -32,8 +32,8 @@ function starred_init(&$a) {
intval(local_user()),
intval($message_id)
);
-
+
header('Content-type: application/json');
- echo json_encode(array('result' => intval($item_flags & ITEM_STARRED)));
+ echo json_encode(array('result' => (($item_flags & ITEM_STARRED) ? 1 : 0)));
killme();
}