From: garvinhicking Date: Tue, 20 Dec 2005 11:33:23 +0000 (+0000) Subject: Fix merging entryproperties on preview X-Git-Tag: 1.0~221 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=652912a5fc08129fcbff95faca7ea8ea9b0bdaec;p=s9y.git Fix merging entryproperties on preview --- diff --git a/docs/INSTALL b/docs/INSTALL index 76239b3..1d4c3cc 100644 --- a/docs/INSTALL +++ b/docs/INSTALL @@ -1,3 +1,7 @@ +# +# FOR UP TO DATE INFORMATION PLEASE REFER TO http://www.s9y.org +# + ############################################################################### # INSTALLATION # ############################################################################### diff --git a/docs/UPGRADE b/docs/UPGRADE index 632d8b0..2105f80 100644 --- a/docs/UPGRADE +++ b/docs/UPGRADE @@ -1,3 +1,7 @@ +# +# FOR UP TO DATE INFORMATION PLEASE REFER TO http://www.s9y.org +# + ######################################################################## # UPDATING # ######################################################################## diff --git a/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php b/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php index 20b533e..d7204ae 100644 --- a/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php +++ b/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php @@ -21,7 +21,7 @@ class serendipity_event_entryproperties extends serendipity_event $propbag->add('description', PLUGIN_EVENT_ENTRYPROPERTIES_DESC); $propbag->add('stackable', false); $propbag->add('author', 'Garvin Hicking'); - $propbag->add('version', '1.6'); + $propbag->add('version', '1.7'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', @@ -117,7 +117,7 @@ class serendipity_event_entryproperties extends serendipity_event } else { $users = serendipity_fetchUsers($serendipity['authorid']); } - + return $users; } @@ -133,7 +133,7 @@ class serendipity_event_entryproperties extends serendipity_event function getSupportedProperties() { static $supported_properties = null; - + if ($supported_properties === null) { $supported_properties = array('is_sticky', 'access', 'access_groups', 'access_users', 'cache_body', 'cache_extended', 'no_nl2br', 'no_frontpage', 'hiderss'); @@ -156,7 +156,7 @@ class serendipity_event_entryproperties extends serendipity_event if (!$is_cache) { $and = " AND property NOT LIKE 'ep_cache_%' "; } - + return $and; } @@ -169,11 +169,11 @@ class serendipity_event_entryproperties extends serendipity_event foreach($supported_properties AS $prop_key) { $prop_val = (isset($properties[$prop_key]) ? $properties[$prop_key] : null); $prop_key = 'ep_' . $prop_key; - + if (is_array($prop_val)) { $prop_val = ";" . implode(';', $prop_val) . ";"; } - + $q = "DELETE FROM {$serendipity['dbPrefix']}entryproperties WHERE entryid = " . (int)$eventData['id'] . " AND property = '" . serendipity_db_escape_string($prop_key) . "'"; serendipity_db_query($q); @@ -232,7 +232,7 @@ class serendipity_event_entryproperties extends serendipity_event } else { $access = $this->get_config('default_read', 'public'); } - + if (isset($eventData['properties']['ep_access_groups'])) { $access_groups = explode(';', $eventData['properties']['ep_access_groups']); } elseif (isset($serendipity['POST']['properties']['access_groups'])) { @@ -273,7 +273,7 @@ class serendipity_event_entryproperties extends serendipity_event @@ -313,7 +313,7 @@ class serendipity_event_entryproperties extends serendipity_event } else { $selected_user = $serendipity['authorid']; } - + $avail_users =& $this->getValidAuthors(); foreach($avail_users AS $user) { @@ -337,7 +337,7 @@ class serendipity_event_entryproperties extends serendipity_event getValidAuthors(); @@ -481,7 +481,7 @@ class serendipity_event_entryproperties extends serendipity_event $serendipity['POST']['properties']['cache_body'] = $eventData['body']; $serendipity['POST']['properties']['cache_extended'] = $eventData['extended']; } - + if (is_array($serendipity['POST']['properties']['access_groups']) && $serendipity['POST']['properties']['access'] != 'member') { unset($serendipity['POST']['properties']['access_groups']); } @@ -519,9 +519,8 @@ class serendipity_event_entryproperties extends serendipity_event $supported_properties = serendipity_event_entryproperties::getSupportedProperties(); foreach($supported_properties AS $prop_key) { if (isset($serendipity['POST']['properties'][$prop_key])) - $parr['ep_' . $prop_key] = $serendipity['POST']['properties'][$prop_key]; + $eventData[0]['properties']['ep_' . $prop_key] = $serendipity['POST']['properties'][$prop_key]; } - $eventData[0]['properties'] = $parr; } break; @@ -542,7 +541,7 @@ class serendipity_event_entryproperties extends serendipity_event $conds[] = " (ep_access_groups.property IS NULL OR (ep_access.value = 'member' AND (" . implode(' OR ', $groupcond) . ")))"; } } - + if ($use_users) { $conds[] = " (ep_access_users.property IS NULL OR (ep_access.value = 'member' AND (ep_access_users.value LIKE '%;" . (int)$serendipity['authorid'] . ";%' OR e.authorid = " . (int)$serendipity['authorid'] . "))) "; } @@ -576,7 +575,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; @@ -585,9 +584,9 @@ class serendipity_event_entryproperties extends serendipity_event } if ($serendipity['dbType'] == 'postgres') { - // PostgreSQL is a bit weird here. Empty columns with NULL or "" content for - // orderkey would get sorted on top when using DESC, and only after those - // the "true" content would be inserted. Thus we order ASC in postgreSQL, + // PostgreSQL is a bit weird here. Empty columns with NULL or "" content for + // orderkey would get sorted on top when using DESC, and only after those + // the "true" content would be inserted. Thus we order ASC in postgreSQL, // and silently wonder. Thanks to Nate Johnston for working this out! $cond = 'orderkey ASC'; } else { @@ -658,7 +657,7 @@ class serendipity_event_entryproperties extends serendipity_event // Fetch current sort_order of current plugin. $q = "SELECT sort_order FROM {$serendipity['dbPrefix']}plugins WHERE name = '" . $this->instance . "'"; $cur = serendipity_db_query($q, true, 'num'); - + // Decrease sort_order of all plugins after current plugin by one. $q = "UPDATE {$serendipity['dbPrefix']}plugins SET sort_order = sort_order - 1 WHERE placement = '" . $addData['default_placement'] . "' AND sort_order > " . intval($cur[0]); serendipity_db_query($q);