1
0

The recent entries sidebar plugin shiped with s9y listed entries not accessable by the current user because of right restrictions.

This commit is contained in:
Grischa Brockhaus
2007-07-17 14:29:09 +00:00
parent 14f04bd485
commit d03898cd34
2 changed files with 19 additions and 9 deletions

View File

@ -3,6 +3,10 @@
Version 1.3 () Version 1.3 ()
------------------------------------------------------------------------ ------------------------------------------------------------------------
* The recent entries sidebar plugin shiped with s9y listed entries
not accessable by the current user because of right restrictions.
(brockhaus)
* The archive sidebar plugin shiped with s9y now displays numbers * The archive sidebar plugin shiped with s9y now displays numbers
of articles correctly for month, catergories and so on, even of articles correctly for month, catergories and so on, even
if multicategory articles are used. (brockhaus) if multicategory articles are used. (brockhaus)

View File

@ -32,6 +32,7 @@ class serendipity_plugin_recententries extends serendipity_plugin {
} }
function introspect_config_item($name, &$propbag) { function introspect_config_item($name, &$propbag) {
global $serendipity;
switch($name) { switch($name) {
case 'title': case 'title':
$propbag->add('type', 'string'); $propbag->add('type', 'string');
@ -122,11 +123,13 @@ class serendipity_plugin_recententries extends serendipity_plugin {
$number_from_sw = $this->get_config('number_from'); $number_from_sw = $this->get_config('number_from');
$randomize = ($this->get_config('randomize') == "yes") ? true : false ; $randomize = ($this->get_config('randomize') == "yes") ? true : false ;
$sql_join = ''; $sql_condition = array();
$sql_where = ''; $sql_condition['joins'] = '';
$sql_condition['and'] = '';
if ($category != 'none') { if ($category != 'none') {
$sql_join = 'LEFT OUTER JOIN ' . $serendipity['dbPrefix'] . 'entrycat AS ec ON id = ec.entryid $sql_condition['joins'] .=
LEFT OUTER JOIN ' . $serendipity['dbPrefix'] . 'category AS c ON ec.categoryid = c.categoryid'; 'LEFT OUTER JOIN ' . $serendipity['dbPrefix'] . 'entrycat AS ec ON id = ec.entryid
LEFT OUTER JOIN ' . $serendipity['dbPrefix'] . 'category AS c ON ec.categoryid = c.categoryid';
$sql_categories = array(); $sql_categories = array();
if (is_numeric($category)) { if (is_numeric($category)) {
@ -140,7 +143,7 @@ class serendipity_plugin_recententries extends serendipity_plugin {
$category_parts[] = "\n" . implode(' AND ', serendipity_fetchCategoryRange($sql_category)); $category_parts[] = "\n" . implode(' AND ', serendipity_fetchCategoryRange($sql_category));
} }
$sql_where = ' AND (c.category_left BETWEEN ' . implode(' OR c.category_left BETWEEN ', $category_parts) . ')'; $sql_condition['and'] .= ' AND (c.category_left BETWEEN ' . implode(' OR c.category_left BETWEEN ', $category_parts) . ')';
} }
if (!$number || !is_numeric($number) || $number < 1) { if (!$number || !is_numeric($number) || $number < 1) {
@ -170,15 +173,18 @@ class serendipity_plugin_recententries extends serendipity_plugin {
$sql_order = "ORDER BY timestamp DESC "; $sql_order = "ORDER BY timestamp DESC ";
} }
$sql_condition['and'] = "AND timestamp <= " . time();
serendipity_ACL_SQL($sql_condition, $category == 'none');
$entries_query = "SELECT DISTINCT id, $entries_query = "SELECT DISTINCT id,
title, title,
timestamp timestamp
FROM {$serendipity['dbPrefix']}entries FROM {$serendipity['dbPrefix']}entries AS e
$sql_join {$sql_condition['joins']}
WHERE isdraft = 'false' AND timestamp <= " . time() . " WHERE isdraft = 'false' {$sql_condition['and']}
$sql_where
$sql_order $sql_order
$sql_number"; $sql_number";
$entries = serendipity_db_query($entries_query); $entries = serendipity_db_query($entries_query);
if (isset($entries) && is_array($entries)) { if (isset($entries) && is_array($entries)) {