categoryid enhancement

This commit is contained in:
Garvin Hicking 2010-03-03 10:46:12 +00:00
parent 0d24190193
commit 8694ec214c
2 changed files with 14 additions and 5 deletions

View File

@ -3,6 +3,9 @@
Version 1.6 () Version 1.6 ()
------------------------------------------------------------------------ ------------------------------------------------------------------------
* Recent entries plugin can now fetch the associated categoryid,
when a single entry is displayed. (Garvinhicking)
* Stricter check for sqlite3 extension, only functional interface * Stricter check for sqlite3 extension, only functional interface
instead of OOP currently supported (garvinhicking) instead of OOP currently supported (garvinhicking)

View File

@ -21,7 +21,7 @@ class serendipity_plugin_recententries extends serendipity_plugin {
$propbag->add('description', PLUGIN_RECENTENTRIES_BLAHBLAH); $propbag->add('description', PLUGIN_RECENTENTRIES_BLAHBLAH);
$propbag->add('stackable', true); $propbag->add('stackable', true);
$propbag->add('author', 'Christian Machmeier, Christian Brabandt, Judebert, Don Chambers'); $propbag->add('author', 'Christian Machmeier, Christian Brabandt, Judebert, Don Chambers');
$propbag->add('version', '2.1'); $propbag->add('version', '2.2');
$propbag->add('requirements', array( $propbag->add('requirements', array(
'serendipity' => '0.8', 'serendipity' => '0.8',
'smarty' => '2.6.7', 'smarty' => '2.6.7',
@ -139,6 +139,10 @@ class serendipity_plugin_recententries extends serendipity_plugin {
if ($category == '_cur') { if ($category == '_cur') {
$category = $serendipity['GET']['category']; $category = $serendipity['GET']['category'];
if (empty($category) && !empty($serendipity['GET']['id'])) {
$entry = serendipity_fetchEntry('id', $serendipity['GET']['id']);
$category = $entry['categories'][0]['categoryid'];
}
} }
$title = $this->get_config('title', $this->title); $title = $this->get_config('title', $this->title);
$number_from_sw = $this->get_config('number_from'); $number_from_sw = $this->get_config('number_from');
@ -147,10 +151,12 @@ class serendipity_plugin_recententries extends serendipity_plugin {
$sql_condition = array(); $sql_condition = array();
$sql_condition['joins'] = ''; $sql_condition['joins'] = '';
$sql_condition['and'] = ''; $sql_condition['and'] = '';
if ($category != 'none') {
$sql_condition['joins'] .= $sql_condition['joins'] .=
'LEFT OUTER JOIN ' . $serendipity['dbPrefix'] . 'entrycat AS ec ON id = ec.entryid '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'; LEFT OUTER JOIN ' . $serendipity['dbPrefix'] . 'category AS c ON ec.categoryid = c.categoryid';
if ($category != 'none' && !empty($category)) {
$sql_categories = array(); $sql_categories = array();
if (is_numeric($category)) { if (is_numeric($category)) {