[geeklog-cvs] geeklog: Template staticpages were notifying plugins when they c...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Fri Apr 22 17:46:13 EDT 2011
changeset 8249:5d70b2f5264f
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/5d70b2f5264f
user: Tom <websitemaster at cogeco.net>
date: Fri Apr 22 17:34:32 2011 -0400
description:
Template staticpages were notifying plugins when they changed. This is incorrect.
The pages that use this template should be the ones to send the notification (PLG_itemSaved)
since they are the pages that are displayed.
diffstat:
plugins/staticpages/services.inc.php | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
diffs (36 lines):
diff -r c09043b55466 -r 5d70b2f5264f plugins/staticpages/services.inc.php
--- a/plugins/staticpages/services.inc.php Fri Apr 22 13:47:05 2011 -0400
+++ b/plugins/staticpages/services.inc.php Fri Apr 22 17:34:32 2011 -0400
@@ -475,12 +475,30 @@
}
if (empty($sp_old_id) || ($sp_id == $sp_old_id)) {
- PLG_itemSaved($sp_id, 'staticpages');
+ if (!$template_flag) {
+ PLG_itemSaved($sp_id, 'staticpages');
+ } else {
+ // If template then have to notify of all pages that use this template that a change to the page happened
+ $sql = "SELECT sp_id FROM {$_TABLES['staticpage']} WHERE template_id = '{$sp_id}'";
+ $result = DB_query($sql);
+ while ($A = DB_fetchArray($result)) {
+ PLG_itemSaved($A['sp_id'], 'staticpages');
+ }
+ }
} else {
DB_change($_TABLES['comments'], 'sid', addslashes($sp_id),
array('sid', 'type'),
array(addslashes($sp_old_id), 'staticpages'));
- PLG_itemSaved($sp_id, 'staticpages', $sp_old_id);
+ if (!$template_flag) {
+ PLG_itemSaved($sp_id, 'staticpages', $sp_old_id);
+ } else {
+ // If template then have to notify of all pages that use this template that a change to the page happened
+ $sql = "SELECT sp_id FROM {$_TABLES['staticpage']} WHERE template_id = '{$sp_id}'";
+ $result = DB_query($sql);
+ while ($A = DB_fetchArray($result)) {
+ PLG_itemSaved($A['sp_id'], 'staticpages');
+ }
+ }
}
$url = COM_buildURL($_CONF['site_url'] . '/staticpages/index.php?page='
More information about the geeklog-cvs
mailing list