geotag:
* removed xmlrpc_fetchEntry hook (not needed) * Never delete geo coords via xml-rpc (some clients misbehave)
This commit is contained in:
parent
27326c3971
commit
e3626e1cbd
|
@ -11,13 +11,14 @@ class GeoTagDb {
|
|||
}
|
||||
}
|
||||
|
||||
function addEntryProperties($entryId, $supported_properties, &$properties) {
|
||||
function addEntryProperties($entryId, $supported_properties, &$properties, $deleteMissing = true) {
|
||||
global $serendipity;
|
||||
// Get existing data
|
||||
$property = serendipity_fetchEntryProperties($entryId);
|
||||
|
||||
foreach($supported_properties AS $prop_key) {
|
||||
$prop_val = (isset($properties[$prop_key]) ? $properties[$prop_key] : null);
|
||||
if (!$deleteMissing && empty($prop_val)) continue; // Don't clear data if not allowed.
|
||||
if (!isset($property[$prop_key]) && !empty($prop_val)) {
|
||||
$q = "INSERT INTO {$serendipity['dbPrefix']}entryproperties (entryid, property, value) VALUES (" . (int)$entryId . ", '" . serendipity_db_escape_string($prop_key) . "', '" . serendipity_db_escape_string($prop_val) . "')";
|
||||
} elseif ($property[$prop_key] != $prop_val && !empty($prop_val)) {
|
||||
|
@ -25,7 +26,6 @@ class GeoTagDb {
|
|||
} else {
|
||||
$q = "DELETE FROM {$serendipity['dbPrefix']}entryproperties WHERE entryid = " . (int)$entryId . " AND property = '" . serendipity_db_escape_string($prop_key) . "'";
|
||||
}
|
||||
|
||||
serendipity_db_query($q);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ class serendipity_event_geotag extends serendipity_event
|
|||
'frontend_header' => true,
|
||||
'external_plugin' => true,
|
||||
'xmlrpc_updertEntry' => true,
|
||||
'xmlrpc_fetchEntry' => true,
|
||||
'xmlrpc_deleteEntry' => true,
|
||||
));
|
||||
|
||||
|
@ -481,6 +480,9 @@ class serendipity_event_geotag extends serendipity_event
|
|||
|
||||
case 'backend_publish':
|
||||
case 'backend_save':
|
||||
// Don't save when sent via xmlrpc. It is saved later.
|
||||
if (isset($eventData['via']) && $eventData['via']== "xmlrpc") return true;
|
||||
|
||||
GeoTagDb::addEntryProperties($eventData['id'], $this->supported_properties, $serendipity['POST']['properties']);
|
||||
return true;
|
||||
case 'backend_delete_entry':
|
||||
|
@ -585,7 +587,7 @@ class serendipity_event_geotag extends serendipity_event
|
|||
GeoTagDb::delete($eventData['id'], $this->supported_properties);
|
||||
return true;
|
||||
case 'xmlrpc_updertEntry':
|
||||
GeoTagDb::addEntryProperties($eventData['id'], $this->supported_properties, $eventData);
|
||||
GeoTagDb::addEntryProperties($eventData['id'], $this->supported_properties, $eventData, false);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue