]> git.mjollnir.org Git - s9y.git/commitdiff
Fix merging entryproperties on preview
authorgarvinhicking <garvinhicking>
Tue, 20 Dec 2005 11:33:23 +0000 (11:33 +0000)
committergarvinhicking <garvinhicking>
Tue, 20 Dec 2005 11:33:23 +0000 (11:33 +0000)
docs/INSTALL
docs/UPGRADE
plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php

index 76239b3c39dcfbd49684d972b281f49b2109c83b..1d4c3ccc81263e9ddf47d324c386e898d880bf08 100644 (file)
@@ -1,3 +1,7 @@
+#
+# FOR UP TO DATE INFORMATION PLEASE REFER TO http://www.s9y.org
+#
+
 ###############################################################################
 # INSTALLATION                                                                #
 ###############################################################################
index 632d8b0fbee250b766d804262748c5b32e6351b1..2105f8014843e710301d83e4710ed85a62b5795c 100644 (file)
@@ -1,3 +1,7 @@
+#
+# FOR UP TO DATE INFORMATION PLEASE REFER TO http://www.s9y.org
+#
+
 ########################################################################
 # UPDATING                                                             #
 ########################################################################
index 20b533e423f3183f11dacf58a51613f442579f5c..d7204ae9f177eacef6737f3de7c0bdb165e49283 100644 (file)
@@ -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
                                 <label title="<?php echo $radio_title; ?>" for="properties_access_<?php echo $radio_value; ?>">&nbsp;<?php echo $radio_title; ?>&nbsp;&nbsp;</label>
 <?php
                     }
-                    
+
                     if ($use_groups) {
                         $my_groups = serendipity_getGroups($serendipity['authorid']);
 ?>
@@ -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
                             <?php
                                     foreach($fields AS $fieldname) {
                                         $fieldname = htmlspecialchars(trim($fieldname));
-    
+
                                         if (isset($serendipity['POST']['properties'][$fieldname])) {
                                             $value = $serendipity['POST']['properties'][$fieldname];
                                         } elseif (!empty($eventData['properties']['ep_' . $fieldname])) {
@@ -462,7 +462,7 @@ class serendipity_event_entryproperties extends serendipity_event
                     if (!isset($serendipity['POST']['properties']) || !is_array($serendipity['POST']['properties']) || !isset($eventData['id'])) {
                         return true;
                     }
-                    
+
                     if (!empty($serendipity['POST']['change_author']) && $serendipity['POST']['change_author'] != $eventData['id']) {
                         // Check again if the POSTed value is an author that the current user has "access" to.
                         $avail_users =& $this->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);