From 72387435426b6dd1c9cae49f5ec1ee9dbab76769 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 18 Dec 2020 13:07:45 -0800 Subject: [PATCH] Regex fixes and path fix for TinyMce. --- e107_admin/admin_log.php | 4 ++-- e107_admin/lancheck.php | 2 +- e107_handlers/date_handler.php | 2 +- e107_handlers/menumanager_class.php | 2 +- e107_handlers/model_class.php | 2 +- e107_handlers/mysql_class.php | 2 +- e107_languages/English/admin/help/newspost.php | 2 +- e107_plugins/_blank/e_dashboard.php | 1 - e107_plugins/tinymce4/wysiwyg.php | 6 +++++- 9 files changed, 13 insertions(+), 10 deletions(-) diff --git a/e107_admin/admin_log.php b/e107_admin/admin_log.php index 2c571a536..5e1cb2d61 100644 --- a/e107_admin/admin_log.php +++ b/e107_admin/admin_log.php @@ -628,7 +628,7 @@ class admin_log_form_ui extends e_admin_form_ui { case 'read': // List Page - $text = preg_replace_callback("#\[!(\w+?)(=.+?){0,1}!]#", 'log_process', $curVal); + $text = preg_replace_callback("#\[!(\w+?)(=.+?)?!]#", 'log_process', $curVal); $text = $tp->toHTML($text,false,'E_BODY'); if(strpos($text,'Array')!==false || strlen($text)>300) @@ -1763,7 +1763,7 @@ if(isset($page_title[$action])) break; case 'dblog_remarks': // Look for pseudo-code for newlines, link insertion - $val = preg_replace_callback("#\[!(\w+?)(=.+?){0,1}!]#", 'log_process', $row['dblog_remarks']); + $val = preg_replace_callback("#\[!(\w+?)(=.+?)?!]#", 'log_process', $row['dblog_remarks']); break; case 'dblog_ip': $val = e107::getIPHandler()->ipDecode($row['dblog_ip']); diff --git a/e107_admin/lancheck.php b/e107_admin/lancheck.php index c4aa76578..5318d3d61 100644 --- a/e107_admin/lancheck.php +++ b/e107_admin/lancheck.php @@ -1930,7 +1930,7 @@ class lancheck return TRUE; } - return (preg_match('/^.{1}/us',$str,$ar) == 1); + return (preg_match('/^./us',$str,$ar) == 1); } diff --git a/e107_handlers/date_handler.php b/e107_handlers/date_handler.php index 0999e4d21..e18c83e40 100644 --- a/e107_handlers/date_handler.php +++ b/e107_handlers/date_handler.php @@ -552,7 +552,7 @@ class e_date } else { - preg_match('#(\d{1,2})(?:\D(\d{1,2}))?(?:\D(\d{1,2})){0,1}#', $timeString, $timeVals); + preg_match('#(\d{1,2})(?:\D(\d{1,2}))?(?:\D(\d{1,2}))?#', $timeString, $timeVals); } } elseif ($endDay) diff --git a/e107_handlers/menumanager_class.php b/e107_handlers/menumanager_class.php index e8c9afa65..efc6e7814 100644 --- a/e107_handlers/menumanager_class.php +++ b/e107_handlers/menumanager_class.php @@ -260,7 +260,7 @@ class e_menuManager { $FOOTER = ($CUSTOMFOOTER) ? $CUSTOMFOOTER : $FOOTER; } } - elseif($this->curLayout && $this->curLayout != "legacyCustom" && (isset($CUSTOMHEADER[$this->curLayout]) || isset($CUSTOMFOOTER[$this->curLayout]))) // 0.7 themes + elseif($this->curLayout && $this->curLayout !== "legacyCustom" && (isset($CUSTOMHEADER[$this->curLayout]) || isset($CUSTOMFOOTER[$this->curLayout]))) // 0.7 themes { // echo " MODE 0.7 ".$this->curLayout; $HEADER = isset($CUSTOMHEADER[$this->curLayout]) ? $CUSTOMHEADER[$this->curLayout] : $HEADER; diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php index 3e331e13d..597aea96e 100755 --- a/e107_handlers/model_class.php +++ b/e107_handlers/model_class.php @@ -3600,7 +3600,7 @@ class e_tree_model extends e_front_model protected function prepareSimulatedPagination() { $db_query = $this->getParam('db_query'); - $db_query = preg_replace_callback("/LIMIT ([\d]+)[ ]*(?:,|OFFSET){0,1}[ ]*([\d]*)/i", function($matches) + $db_query = preg_replace_callback("/LIMIT ([\d]+)[ ]*(?:,|OFFSET)?[ ]*([\d]*)/i", function($matches) { // Count only if (empty($matches[2])) diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php index e912ca72d..230fbc062 100644 --- a/e107_handlers/mysql_class.php +++ b/e107_handlers/mysql_class.php @@ -2285,7 +2285,7 @@ class e_db_mysql implements e_db $row = $this->fetch('num'); $qry = $row[1]; // $qry = str_replace($old, $new, $qry); - $qry = preg_replace("#CREATE\sTABLE\s`{0,1}".$old."`{0,1}\s#", "CREATE TABLE {$new} ", $qry, 1); // More selective search + $qry = preg_replace("#CREATE\sTABLE\s`?".$old."`?\s#", "CREATE TABLE {$new} ", $qry, 1); // More selective search } else { diff --git a/e107_languages/English/admin/help/newspost.php b/e107_languages/English/admin/help/newspost.php index 8c5965861..ef0a506c2 100644 --- a/e107_languages/English/admin/help/newspost.php +++ b/e107_languages/English/admin/help/newspost.php @@ -52,6 +52,6 @@ If you set a start and/or end date your news item will only be displayed between case 'list' : default : $text = 'List of all news items. To edit or delete, click on one of the icons in the \'options\' column. To view the item, click - on the title.'; + on the ID.'; } $ns -> tablerender($caption, $text); diff --git a/e107_plugins/_blank/e_dashboard.php b/e107_plugins/_blank/e_dashboard.php index 0cefb3d0d..5ff9c3f53 100644 --- a/e107_plugins/_blank/e_dashboard.php +++ b/e107_plugins/_blank/e_dashboard.php @@ -125,7 +125,6 @@ class _blank_dashboard // include plugin-folder in the name. function status() // Status Panel in the admin area { - $var[0]['icon'] = ""; $var[0]['title'] = "My Title"; $var[0]['url'] = e_PLUGIN_ABS."_blank/_blank.php"; diff --git a/e107_plugins/tinymce4/wysiwyg.php b/e107_plugins/tinymce4/wysiwyg.php index 47880c4de..887f918dc 100644 --- a/e107_plugins/tinymce4/wysiwyg.php +++ b/e107_plugins/tinymce4/wysiwyg.php @@ -858,6 +858,10 @@ class wysiwyg $pathAn .= '/'; $pathAn .= e107::getLibrary()->getProperty('animate.css', 'path'); // sub-folder + $pathAn = $tp->replaceConstants($pathAn, 'abs'); + $pathFA = $tp->replaceConstants($pathFA, 'abs'); + $pathBS = $tp->replaceConstants($pathBS, 'abs'); + $editorCSS = array( 0 => $pathBS . '/css/bootstrap.min.css', 1 => $pathFA . '/css/font-awesome.min.css', @@ -868,7 +872,7 @@ class wysiwyg // file_put_contents(e_LOG."wysiwyg.log", print_r($editorCSS,true)); -// $editorCSS = $tp->replaceConstants($editorCSS, 'abs'); + // $editorCSS = $tp->replaceConstants($editorCSS, 'abs'); $ret['content_css'] = json_encode($editorCSS); $ret['content_style'] = "div.clearfix { border-top:1px solid red } ";