Issue 106: Invalid HTML output fixed

This commit is contained in:
azett 2022-05-07 20:02:41 +02:00
parent 96934bf2aa
commit becd504aae
11 changed files with 454 additions and 405 deletions

View File

@ -1,4 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd"> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>{$flatpress.title}{$pagetitle}</title> <title>{$flatpress.title}{$pagetitle}</title>

View File

@ -1,10 +1,9 @@
<?php <?php
//require_once('../init.php'); // require_once('../init.php');
//utils_redirect('../admin.php'); // utils_redirect('../admin.php');
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>FlatPress</title> <title>FlatPress</title>

View File

@ -13,7 +13,7 @@
{html_form} {html_form}
<script type="text/javascript"> <script>
{literal} {literal}
function admin_entry_comment_delete() { return confirm({/literal}'{$plang.act_del_confirm}'{literal}); } function admin_entry_comment_delete() { return confirm({/literal}'{$plang.act_del_confirm}'{literal}); }

View File

@ -16,7 +16,7 @@
/* /*
* function admin_plugin_adminheader() { * function admin_plugin_adminheader() {
* $f = ADMIN_DIR . '/panels/plugin/admin.plugin.js'; * $f = ADMIN_DIR . '/panels/plugin/admin.plugin.js';
* echo '<script src="$f" type="text/javascript"></script> * echo '<script src="$f"></script>
* '; * ';
* *
* } * }

View File

@ -1,124 +1,107 @@
<?php <?php
function admin_widgets_head() {
echo '<script type="text/javascript" src="'.BLOG_BASEURL.ADMIN_DIR.'panels/widgets/admin.widgets.js"></script>';
}
add_action('wp_footer', 'admin_widgets_head');
class admin_widgets_default extends AdminPanelAction {
//var $validators = array(array('content', 'content', 'notEmpty', false, false));
var $events = array('save');
function get_widget_lists($wlist, $wpos, &$widget_list, $registered_w, $add_empties) {
if (!isset($wlist[$wpos]))
return;
$widget_list[$wpos] = array();
foreach($wlist[$wpos] as $idx => $wdg) {
$widget_list[$wpos][$idx] = array();
$newid = $wdg; # @list($newid, $params) = explode(":", $wdg);
$widget_list[$wpos][$idx]['id'] = $newid;
if (isset($registered_w[$newid])){
$thiswdg = $registered_w[$newid];
$widget_list[$wpos][$idx]['name'] = $thiswdg['name'];
if ($thiswdg['nparams'] > 0) {
$widget_list[$wpos][$idx]['params'] = $params;
}
/*
* here should go the check for
* limited parameters: parameters limited to a
* particular set would mean using a <select> control
* in the template
*
*/
} else {
global $lang; function admin_widgets_head() {
echo '<script src="' . BLOG_BASEURL . ADMIN_DIR . 'panels/widgets/admin.widgets.js"></script>';
$widget_list[$wpos][$idx]['name'] = $newid; }
$widget_list[$wpos][$idx]['class'] = 'errors'; add_action('wp_footer', 'admin_widgets_head');
$errs = sprintf($lang['admin']['widgets']['errors']['generic'], $newid); class admin_widgets_default extends AdminPanelAction {
$this->smarty->append('warnings', $errs);
// var $validators = array(array('content', 'content', 'notEmpty', false, false));
} var $events = array(
'save'
);
function get_widget_lists($wlist, $wpos, &$widget_list, $registered_w, $add_empties) {
if (!isset($wlist [$wpos]))
return;
$widget_list [$wpos] = array();
foreach ($wlist [$wpos] as $idx => $wdg) {
$widget_list [$wpos] [$idx] = array();
$newid = $wdg; // @list($newid, $params) = explode(":", $wdg);
$widget_list [$wpos] [$idx] ['id'] = $newid;
if (isset($registered_w [$newid])) {
$thiswdg = $registered_w [$newid];
$widget_list [$wpos] [$idx] ['name'] = $thiswdg ['name'];
if ($thiswdg ['nparams'] > 0) {
$widget_list [$wpos] [$idx] ['params'] = $params;
} }
/*
if (!$widget_list[$wpos] && !$add_empties) * here should go the check for
unset($widget_list[$wpos]); * limited parameters: parameters limited to a
* particular set would mean using a <select> control
* in the template
} *
*/
function main() { } else {
global $lang;
lang_load('admin.widgets');
# $this->smarty->assign('warnings', admin_widgets_checkall()); $widget_list [$wpos] [$idx] ['name'] = $newid;
global $fp_widgets; $widget_list [$wpos] [$idx] ['class'] = 'errors';
$errs = sprintf($lang ['admin'] ['widgets'] ['errors'] ['generic'], $newid);
$registered_w = get_registered_widgets(); $this->smarty->append('warnings', $errs);
$registered_ws = get_registered_widgetsets(null);
$this->smarty->assign('fp_registered_widgets', $registered_w);
$wlist = $fp_widgets->getList();
$widget_list = array();
foreach($registered_ws as $wpos) {
$widget_list[$wpos] = array();
$this->get_widget_lists($wlist, $wpos, $widget_list, $registered_w, true);
unset($wlist[$wpos]);
} }
$oldwidget_list = array();
foreach($wlist as $wpos => $c){
$this->get_widget_lists($wlist, $wpos, $oldwidget_list, $registered_w, false);
}
$this->smarty->assign('widgetlist', $widget_list);
$this->smarty->assign('oldwidgetlist', $oldwidget_list);
$conf = io_load_file(CONFIG_DIR . 'widgets.conf.php');
$this->smarty->assign('pluginconf', $conf);
return 0;
} }
function onsave() { if (!$widget_list [$wpos] && !$add_empties)
unset($widget_list [$wpos]);
$fp_widgets = isset($_POST['widgets'])? $_POST['widgets'] : array();
$success = system_save(CONFIG_DIR . 'widgets.conf.php', compact('fp_widgets'));
$this->smarty->assign('success', ( $success )? 1 : -1 );
return PANEL_REDIRECT_CURRENT;
}
} }
function main() {
lang_load('admin.widgets');
// $this->smarty->assign('warnings', admin_widgets_checkall());
global $fp_widgets;
$registered_w = get_registered_widgets();
$registered_ws = get_registered_widgetsets(null);
$this->smarty->assign('fp_registered_widgets', $registered_w);
$wlist = $fp_widgets->getList();
$widget_list = array();
foreach ($registered_ws as $wpos) {
$widget_list [$wpos] = array();
$this->get_widget_lists($wlist, $wpos, $widget_list, $registered_w, true);
unset($wlist [$wpos]);
}
$oldwidget_list = array();
foreach ($wlist as $wpos => $c) {
$this->get_widget_lists($wlist, $wpos, $oldwidget_list, $registered_w, false);
}
$this->smarty->assign('widgetlist', $widget_list);
$this->smarty->assign('oldwidgetlist', $oldwidget_list);
$conf = io_load_file(CONFIG_DIR . 'widgets.conf.php');
$this->smarty->assign('pluginconf', $conf);
return 0;
}
function onsave() {
$fp_widgets = isset($_POST ['widgets']) ? $_POST ['widgets'] : array();
$success = system_save(CONFIG_DIR . 'widgets.conf.php', compact('fp_widgets'));
$this->smarty->assign('success', ($success) ? 1 : -1);
return PANEL_REDIRECT_CURRENT;
}
}
?> ?>

View File

@ -1,4 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd"> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>{$flatpress.title}{$pagetitle}</title> <title>{$flatpress.title}{$pagetitle}</title>

View File

@ -12,9 +12,9 @@
</h3> </h3>
{include file=shared:entryadminctrls.tpl} {include file=shared:entryadminctrls.tpl}
<span itemprop="articleBody"> <div itemprop="articleBody">
{$content|tag:the_content} {$content|tag:the_content}
</span> </div>
<ul class="entry-footer"> <ul class="entry-footer">

View File

@ -780,7 +780,7 @@ function plugin_bbcode_toolbar() {
// $bblang = lang_load('plugin:bbcode'); // $bblang = lang_load('plugin:bbcode');
// $_FP_SMARTY->assign('bblang', $bblang); // $_FP_SMARTY->assign('bblang', $bblang);
echo "<!-- bbcode plugin -->\n"; echo "<!-- bbcode plugin -->\n";
echo '<script type="text/javascript" src="' . plugin_geturl('bbcode') . 'res/editor.js"></script>' . "\n"; echo '<script src="' . plugin_geturl('bbcode') . 'res/editor.js"></script>' . "\n";
echo $_FP_SMARTY->fetch('plugin:bbcode/toolbar'); echo $_FP_SMARTY->fetch('plugin:bbcode/toolbar');
echo "<!-- end of bbcode plugin -->\n"; echo "<!-- end of bbcode plugin -->\n";
} }

File diff suppressed because it is too large Load Diff

View File

@ -13,8 +13,8 @@ function plugin_jquery_head() {
$pdir = plugin_geturl('jquery'); $pdir = plugin_geturl('jquery');
echo ' echo '
<!-- start of jsUtils --> <!-- start of jsUtils -->
<script type="text/javascript" src="' . $pdir . 'res/jquery/3.6/jquery-3.6.0.min.js"></script> <script src="' . $pdir . 'res/jquery/3.6/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="' . $pdir . 'res/jqueryui/1.13.0/jquery-ui.min.js"></script> <script src="' . $pdir . 'res/jqueryui/1.13.0/jquery-ui.min.js"></script>
<!-- end of jsUtils -->'; <!-- end of jsUtils -->';
} }

View File

@ -29,7 +29,7 @@ function plugin_lightbox2_footer() {
$pdir = plugin_geturl('lightbox2'); $pdir = plugin_geturl('lightbox2');
echo ' echo '
<!-- start of lightbox --> <!-- start of lightbox -->
<script type="text/javascript" src="' . $pdir . 'res/slimbox2.js"></script> <script src="' . $pdir . 'res/slimbox2.js"></script>
<!-- end of lightbox -->'; <!-- end of lightbox -->';
} }
add_action('wp_footer', 'plugin_lightbox2_footer'); add_action('wp_footer', 'plugin_lightbox2_footer');