php8 compat fixes to save entries again
This commit is contained in:
parent
20539b92d4
commit
25cfb97ece
@ -464,6 +464,7 @@ if (! isset($data['is_doDelete'])) { $data['is_doDelete'] = null; }
|
||||
if (! isset($data['is_doMultiDelete'])) { $data['is_doMultiDelete'] = null; }
|
||||
if (! isset($data['is_delete'])) { $data['is_delete'] = null; }
|
||||
if (! isset($data['is_multidelete'])) { $data['is_multidelete'] = null; }
|
||||
if (! isset($data['is_iframepreview'])) { $data['is_iframepreview'] = null; }
|
||||
|
||||
echo serendipity_smarty_show('admin/entries.inc.tpl', $data);
|
||||
|
||||
|
@ -709,14 +709,14 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
|
||||
static $old_references = array();
|
||||
static $saved_references = array();
|
||||
static $saved_urls = array();
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug("serendipity_handle_references");
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("serendipity_handle_references");
|
||||
|
||||
if ($dry_run) {
|
||||
// Store the current list of references. We might need to restore them for later user.
|
||||
$old_references = serendipity_db_query("SELECT * FROM {$serendipity['dbPrefix']}references WHERE (type = '' OR type IS NULL) AND entry_id = " . (int)$id, false, 'assoc');
|
||||
|
||||
if (is_string($old_references)) {
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug($old_references);
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug($old_references);
|
||||
}
|
||||
|
||||
if (is_array($old_references) && count($old_references) > 0) {
|
||||
@ -727,14 +727,14 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
|
||||
$saved_urls[$old_reference['link']] = true;
|
||||
}
|
||||
}
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug("Got references in dry run: " . print_r($current_references, true));
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("Got references in dry run: " . print_r($current_references, true));
|
||||
} else {
|
||||
// A dry-run was called previously and restorable references are found. Restore them now.
|
||||
$del = serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}references WHERE (type = '' OR type IS NULL) AND entry_id = " . (int)$id);
|
||||
if (is_string($del)) {
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug($del);
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug($del);
|
||||
}
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug("Deleted references");
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("Deleted references");
|
||||
|
||||
if (is_array($old_references) && count($old_references) > 0) {
|
||||
$current_references = array();
|
||||
@ -744,12 +744,12 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
|
||||
$q = serendipity_db_insert('references', $old_reference, 'show');
|
||||
$cr = serendipity_db_query($q);
|
||||
if (is_string($cr)) {
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug($cr);
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug($cr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug("Got references in final run:" . print_r($current_references, true));
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("Got references in final run:" . print_r($current_references, true));
|
||||
}
|
||||
|
||||
if (!preg_match_all('@<a[^>]+?href\s*=\s*["\']?([^\'" >]+?)[ \'"][^>]*>(.+?)</a>@i', $text, $matches)) {
|
||||
@ -796,18 +796,18 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
|
||||
|
||||
$row = serendipity_db_query($query, true, 'num');
|
||||
if (is_string($row)) {
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug($row);
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug($row);
|
||||
}
|
||||
|
||||
$names[$i] = strip_tags($names[$i]);
|
||||
if (empty($names[$i])) {
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug("Found reference $locations[$i] w/o name. Adding location as name");
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("Found reference $locations[$i] w/o name. Adding location as name");
|
||||
$names[$i] = $locations[$i];
|
||||
}
|
||||
|
||||
if (!isset($serendipity['skip_trackback_check']) || !$serendipity['skip_trackback_check']) {
|
||||
if ($row[0] > 0 && isset($saved_references[$locations[$i] . $names[$i]])) {
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug("Found references for $id, skipping rest");
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("Found references for $id, skipping rest");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -815,24 +815,24 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
|
||||
if (!isset($serendipity['noautodiscovery']) || !$serendipity['noautodiscovery']) {
|
||||
if (!$dry_run) {
|
||||
if (!isset($saved_urls[$locations[$i]]) || (isset($serendipity['skip_trackback_check']) && $serendipity['skip_trackback_check'])) {
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug("Enabling autodiscovery");
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("Enabling autodiscovery");
|
||||
serendipity_reference_autodiscover($locations[$i], $url, $author, $title, serendipity_trackback_excerpt($text));
|
||||
} else {
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug("This reference was already used before in $id and therefore will not be trackbacked again");
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("This reference was already used before in $id and therefore will not be trackbacked again");
|
||||
}
|
||||
} else {
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug("Dry run: Skipping autodiscovery");
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("Dry run: Skipping autodiscovery");
|
||||
}
|
||||
$checked_locations[$locations[$i]] = true; // Store trackbacked link so that no further trackbacks will be sent to the same link
|
||||
} else {
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug("Skipping full autodiscovery");
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("Skipping full autodiscovery");
|
||||
}
|
||||
}
|
||||
$del = serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}references WHERE entry_id=" . (int)$id . " AND (type = '' OR type IS NULL)");
|
||||
if (is_string($del)) {
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug($del);
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug($del);
|
||||
}
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug("Deleted references again");
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("Deleted references again");
|
||||
|
||||
if (!is_array($old_references)) {
|
||||
$old_references = array();
|
||||
@ -873,11 +873,11 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
|
||||
$duplicate_check[$i_location . $i_link] = true;
|
||||
}
|
||||
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug("Current lookup for {$locations[$i]}{$names[$i]} is" . print_r($current_references[$locations[$i] . $names[$i]], true));
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug($query);
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug("Current lookup for {$locations[$i]}{$names[$i]} is" . print_r($current_references[$locations[$i] . $names[$i]], true));
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug($query);
|
||||
}
|
||||
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug(print_r($old_references, true));
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug(print_r($old_references, true));
|
||||
|
||||
// Add citations
|
||||
preg_match_all('@<cite[^>]*>([^<]+)</cite>@i', $text, $matches);
|
||||
@ -888,7 +888,7 @@ function serendipity_handle_references($id, $author, $title, $text, $dry_run = f
|
||||
|
||||
$cite = serendipity_db_query($query);
|
||||
if (is_string($cite)) {
|
||||
if (is_object($serendipity['logger'])) $serendipity['logger']->debug($cite);
|
||||
if (is_object($serendipity['logger'] ?? null)) $serendipity['logger']->debug($cite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ function errorHandlerCreateDOM(htmlStr) {
|
||||
case 'backend_save':
|
||||
case 'backend_publish':
|
||||
// this is preview_iframe.tpl updertHooks [ NOT ONLY!! See freetags ]
|
||||
if ($serendipity['GET']['is_iframe'] == 'true' && $serendipity['GET']['iframe_mode'] == 'save') {
|
||||
if (($serendipity['GET']['is_iframe'] ?? false) == 'true' && ($serendipity['GET']['iframe_mode'] ?? '') == 'save') {
|
||||
echo "\n".'<script>document.addEventListener("DOMContentLoaded", function() { window.parent.serendipity.eraseEntryEditorCache(); });</script>'."\n";
|
||||
}
|
||||
break;
|
||||
|
@ -229,7 +229,7 @@ class serendipity_event_entryproperties extends serendipity_event
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
if (is_array($properties['disable_markups'])) {
|
||||
if (is_array($properties['disable_markups'] ?? null)) {
|
||||
foreach($properties['disable_markups'] AS $idx => $instance) {
|
||||
$properties['disable_markup_' . $instance] = $instance;
|
||||
}
|
||||
@ -249,7 +249,7 @@ class serendipity_event_entryproperties extends serendipity_event
|
||||
// is set (which will only happen if the form has been submitted) - not just in the foreach() below
|
||||
|
||||
// Cleanup properties first, if none disable_markups plugins were set, or a previous selected one was re-set
|
||||
if (isset($serendipity['POST']['propertyform']) && is_array($serendipity['POST']['properties']) && !is_array($serendipity['POST']['properties']['disable_markups'])) {
|
||||
if (isset($serendipity['POST']['propertyform']) && is_array($serendipity['POST']['properties']) && !is_array($serendipity['POST']['properties']['disable_markups'] ?? null)) {
|
||||
$q = "DELETE FROM {$serendipity['dbPrefix']}entryproperties WHERE entryid = " . (int)$eventData['id'] . " AND property LIKE 'ep_disable_markup_%'";
|
||||
serendipity_db_query($q);
|
||||
}
|
||||
@ -264,7 +264,7 @@ class serendipity_event_entryproperties extends serendipity_event
|
||||
}
|
||||
|
||||
// Special case for disable markups.
|
||||
if (isset($serendipity['POST']['propertyform']) && is_array($properties['disable_markups'])) {
|
||||
if (isset($serendipity['POST']['propertyform']) && is_array($properties['disable_markups'] ?? null)) {
|
||||
$q = "DELETE FROM {$serendipity['dbPrefix']}entryproperties WHERE entryid = " . (int)$eventData['id'] . " AND property LIKE 'ep_disable_markup_%'";
|
||||
serendipity_db_query($q);
|
||||
|
||||
@ -803,11 +803,11 @@ class serendipity_event_entryproperties extends serendipity_event
|
||||
$serendipity['POST']['properties']['cache_extended'] = $eventData['extended'];
|
||||
}
|
||||
|
||||
if (is_array($serendipity['POST']['properties']['access_groups']) && $serendipity['POST']['properties']['access'] != 'member') {
|
||||
if (is_array($serendipity['POST']['properties']['access_groups'] ?? null) && $serendipity['POST']['properties']['access'] != 'member') {
|
||||
unset($serendipity['POST']['properties']['access_groups']);
|
||||
}
|
||||
|
||||
if (is_array($serendipity['POST']['properties']['access_users']) && $serendipity['POST']['properties']['access'] != 'member') {
|
||||
if (is_array($serendipity['POST']['properties']['access_users'] ?? null) && $serendipity['POST']['properties']['access'] != 'member') {
|
||||
unset($serendipity['POST']['properties']['access_users']);
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
<div class="clearfix">
|
||||
<div style="float: left; height: 75px"></div>
|
||||
{$updertHooks}
|
||||
{if $res}
|
||||
{if isset($res) and $res}
|
||||
<div class="serendipity_msg_important">{$CONST.ERROR}: <b>{$res}</b></div>
|
||||
{else}
|
||||
{if $lastSavedEntry}
|
||||
@ -59,7 +59,9 @@
|
||||
<a href="{$entrylink}" target="_blank">{$CONST.VIEW}</a>
|
||||
{/if}
|
||||
{/if}
|
||||
{$preview}
|
||||
{if isset($preview)}
|
||||
{$preview}
|
||||
{/if}
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user