From 2c8641c7416cc528cf06f9f1451a7da904b2a4c9 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Wed, 27 Apr 2005 07:48:18 +0000 Subject: [PATCH] entryproperties option: Hide from frontpage --- docs/NEWS | 3 +++ .../serendipity_event_entryproperties.php | 21 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index 360ed9b..2eaaaf9 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,9 @@ Version 0.9 () ------------------------------------------------------------------------ + * New entryproperties plugin option: Hide an entry from the frontpage + (garvinhicking) + * Fix importers when source database is not the same as the target database (garvinhicking) diff --git a/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php b/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php index 670d9f2..41d7317 100644 --- a/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php +++ b/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php @@ -26,6 +26,7 @@ switch ($serendipity['lang']) { @define('PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_ABORTED', 'Caching der Artikel ABGEBROCHEN.'); @define('PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_TOTAL', ' (insgesamt %d Artikel vorhanden)...'); @define('PLUGIN_EVENT_ENTRYPROPERTIES_NL2BR', 'Automatischen Zeilenumbruch deaktivieren'); + @define('PLUGIN_EVENT_ENTRYPROPERTIES_NO_FRONTPAGE', 'Nicht in Artikelübersicht zeigen'); break; case 'en': @@ -49,6 +50,7 @@ switch ($serendipity['lang']) { @define('PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_ABORTED', 'Entry caching ABORTED.'); @define('PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_TOTAL', ' (totalling %d entries)...'); @define('PLUGIN_EVENT_ENTRYPROPERTIES_NL2BR', 'Disable nl2br'); + @define('PLUGIN_EVENT_ENTRYPROPERTIES_NO_FRONTPAGE', 'Hide from article overview / frontpage'); break; } @@ -139,7 +141,7 @@ class serendipity_event_entryproperties extends serendipity_event } function getSupportedProperties() { - static $supported_properties = array('is_sticky', 'access', 'cache_body', 'cache_extended', 'no_nl2br'); + static $supported_properties = array('is_sticky', 'access', 'cache_body', 'cache_extended', 'no_nl2br', 'no_frontpage'); return $supported_properties; } @@ -196,6 +198,11 @@ class serendipity_event_entryproperties extends serendipity_event ? 'checked="checked"' : ''; + $no_frontpage = (isset($eventData['properties']['ep_no_frontpage']) && serendipity_db_bool($eventData['properties']['ep_no_frontpage'])) + || (isset($serendipity['POST']['properties']['no_frontpage']) && serendipity_db_bool($serendipity['POST']['properties']['no_frontpage'])) + ? 'checked="checked"' + : ''; + $access_values = array( PLUGIN_EVENT_ENTRYPROPERTIES_ACCESS_PRIVATE => 'private', PLUGIN_EVENT_ENTRYPROPERTIES_ACCESS_MEMBER => 'member', @@ -214,6 +221,8 @@ class serendipity_event_entryproperties extends serendipity_event />
+ /> +
/>
@@ -375,6 +384,7 @@ class serendipity_event_entryproperties extends serendipity_event case 'frontend_fetchentries': case 'frontend_fetchentry': + $joins = array(); $conds = array(); if ($_SESSION['serendipityAuthedUser'] === true) { $conds[] = " (ep_access.property IS NULL OR ep_access.value = 'member' OR ep_access.value = 'public' OR (ep_access.value = 'private' AND e.authorid = " . (int)$serendipity['authorid'] . ")) "; @@ -382,6 +392,12 @@ class serendipity_event_entryproperties extends serendipity_event $conds[] = " (ep_access.property IS NULL OR ep_access.value = 'public') "; } + if (!isset($serendipity['GET']['category']) && $event == 'frontend_fetchentries') { + $conds[] = " (ep_no_frontpage.property IS NULL OR ep_no_frontpage.value != 'true') "; + $joins[] = "LEFT OUTER JOIN {$serendipity['dbPrefix']}entryproperties ep_no_frontpage + ON (e.id = ep_no_frontpage.entryid AND ep_no_frontpage.property = 'ep_no_frontpage')"; + } + if (count($conds) > 0) { $cond = implode(' AND ', $conds); if (empty($eventData['and'])) { @@ -402,7 +418,7 @@ class serendipity_event_entryproperties extends serendipity_event $conds[] = 'ep_cache_extended.value AS ep_cache_extended,'; $conds[] = 'ep_cache_body.value AS ep_cache_body,'; } - + $cond = implode("\n", $conds); if (empty($eventData['addkey'])) { $eventData['addkey'] = $cond; @@ -417,7 +433,6 @@ class serendipity_event_entryproperties extends serendipity_event $eventData['orderby'] = $cond . ', ' . $eventData['orderby']; } - $joins = array(); if ($is_cache && (!isset($addData['noCache']) || !$addData['noCache'])) { $joins[] = "LEFT OUTER JOIN {$serendipity['dbPrefix']}entryproperties ep_cache_extended ON (e.id = ep_cache_extended.entryid AND ep_cache_extended.property = 'ep_cache_extended')"; -- 2.39.5