diff options
author | mrjive <mrjive@mrjive.it> | 2016-02-01 11:25:07 +0100 |
---|---|---|
committer | mrjive <mrjive@mrjive.it> | 2016-02-01 11:25:07 +0100 |
commit | 337735094b944fd31ed96e36c869227a0d63e5d1 (patch) | |
tree | 763577a8373b26426dc131c58f6a7f8c9c9213bf /include/widgets.php | |
parent | 28943af494eae225b256b9771a5699a1b05d7a2f (diff) | |
parent | 01b5b1347521951ca78b1718b03c45897800bf5e (diff) | |
download | volse-hubzilla-337735094b944fd31ed96e36c869227a0d63e5d1.tar.gz volse-hubzilla-337735094b944fd31ed96e36c869227a0d63e5d1.tar.bz2 volse-hubzilla-337735094b944fd31ed96e36c869227a0d63e5d1.zip |
Merge pull request #20 from redmatrix/master
updating from original codebase
Diffstat (limited to 'include/widgets.php')
-rw-r--r-- | include/widgets.php | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/include/widgets.php b/include/widgets.php index 891e9c018..7e502e4c2 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -817,7 +817,7 @@ function widget_item($arr) { return ''; - if(! $arr['mid']) + if((! $arr['mid']) && (! $arr['title'])) return ''; if(! perm_is_allowed($channel_id, get_observer_hash(), 'view_pages')) @@ -826,10 +826,20 @@ function widget_item($arr) { require_once('include/security.php'); $sql_extra = item_permissions_sql($channel_id); - $r = q("select * from item where mid = '%s' and uid = %d and item_type = " . intval(ITEM_TYPE_WEBPAGE) . " $sql_extra limit 1", - dbesc($arr['mid']), - intval($channel_id) - ); + if($arr['title']) { + $r = q("select item.* from item left join item_id on item.id = item_id.iid + where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and item_type = %d $sql_options $revision limit 1", + intval($channel_id), + dbesc($arr['title']), + intval(ITEM_TYPE_WEBPAGE) + ); + } + else { + $r = q("select * from item where mid = '%s' and uid = %d and item_type = " . intval(ITEM_TYPE_WEBPAGE) . " $sql_extra limit 1", + dbesc($arr['mid']), + intval($channel_id) + ); + } if(! $r) return ''; |