$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',
} else {
$users = serendipity_fetchUsers($serendipity['authorid']);
}
-
+
return $users;
}
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');
if (!$is_cache) {
$and = " AND property NOT LIKE 'ep_cache_%' ";
}
-
+
return $and;
}
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);
} 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'])) {
<label title="<?php echo $radio_title; ?>" for="properties_access_<?php echo $radio_value; ?>"> <?php echo $radio_title; ?> </label>
<?php
}
-
+
if ($use_groups) {
$my_groups = serendipity_getGroups($serendipity['authorid']);
?>
} else {
$selected_user = $serendipity['authorid'];
}
-
+
$avail_users =& $this->getValidAuthors();
foreach($avail_users AS $user) {
<?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])) {
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();
$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']);
}
$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;
$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'] . "))) ";
}
$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;
}
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 {
// 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);