From 77dcf4db3d57d28d7aafd95f992330f998ec7c63 Mon Sep 17 00:00:00 2001 From: e107steved Date: Wed, 14 Feb 2007 21:17:42 +0000 Subject: [PATCH] Plugin scanner checks e_xxx addons for no space round start/end tags - should help RSS problems --- e107_admin/db.php | 35 ++++++++++++++++++++----- e107_handlers/plugin_class.php | 15 ++++++++--- e107_languages/English/admin/lan_db.php | 13 +++++---- 3 files changed, 49 insertions(+), 14 deletions(-) diff --git a/e107_admin/db.php b/e107_admin/db.php index c8e7bf869..a2d02fd7a 100644 --- a/e107_admin/db.php +++ b/e107_admin/db.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $ -| $Revision: 1.1.1.1 $ -| $Date: 2006-12-02 04:33:19 $ -| $Author: mcfly_e107 $ +| $Revision: 1.2 $ +| $Date: 2007-02-14 21:17:03 $ +| $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -153,8 +153,11 @@ function optimizesql($mySQLdefaultdb) { } + function plugin_viewscan() { + $error_messages = array(0 => DBLAN_31, 1 =>"".DBLAN_32."", 2 =>"".DBLAN_33."", 3 => DBLAN_34); + global $sql, $pref, $ns, $tp; require_once(e_HANDLER."plugin_class.php"); $ep = new e107plugin; @@ -167,15 +170,34 @@ function plugin_viewscan()
- + "; $sql -> db_Select("plugin", "*", "plugin_id !='' order by plugin_path ASC"); // Must order by path to pick up duplicates. (plugin names may change). - while($row = $sql-> db_Fetch()){ + while($row = $sql-> db_Fetch()) + { $text .= " - + "; $previous = $row['plugin_path']; } +// $text .= ""; $text .= "
".DBLAN_24." ".DBLAN_25."".DBLAN_26."".DBLAN_26."
".DBLAN_30."
".DBLAN_27."
".$tp->toHtml($row['plugin_name'],FALSE,"defs")." ".$row['plugin_path']."".str_replace(",","
",$row['plugin_addons'])."
"; + + if (trim($row['plugin_addons'])) + { + $nl_code = ''; + foreach(explode(',',$row['plugin_addons']) as $this_addon) + { + $ret_code = 3; // Default to 'not checked + if (strpos($this_addon,'e_') === 0) + { +// echo "Checking: ".$row['plugin_path'].":".$this_addon."
"; + $ret_code = $ep->checkAddon($row['plugin_path'],$this_addon); // See whether spaces before opening tag or after closing tag + } + $text .= $nl_code.$this_addon." - ".$error_messages[$ret_code]; // $ret_code - 0=OK, 1=content error, 2=access error + $nl_code = "
"; + } + } + + $text .= "
"; if($previous == $row['plugin_path']) { @@ -191,6 +213,7 @@ function plugin_viewscan()
".DBLAN_30."
"; $ns -> tablerender(ADLAN_CL_7, $text); diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index f65566a17..ea85a2e31 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $ -| $Revision: 1.4 $ -| $Date: 2007-02-11 20:16:25 $ +| $Revision: 1.5 $ +| $Date: 2007-02-14 21:17:03 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -656,7 +656,16 @@ class e107plugin return implode(",",$p_addons); } - + function checkAddon($plugin_path,$e_xxx) + { // Return 0 = OK, 1 = Fail, 2 = inaccessible + if(is_readable(e_PLUGIN.$plugin_path."/".$e_xxx.".php")) + { + $file_text = file_get_contents(e_PLUGIN.$plugin_path."/".$e_xxx.".php"); + if ((substr($file_text,0,5) != '<'.'?php') || (substr($file_text,-2,2) !='?>')) return 1; + return 0; + } + return 2; + } } ?> diff --git a/e107_languages/English/admin/lan_db.php b/e107_languages/English/admin/lan_db.php index 42bc275b7..12d30678e 100644 --- a/e107_languages/English/admin/lan_db.php +++ b/e107_languages/English/admin/lan_db.php @@ -4,9 +4,9 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_db.php,v $ -| $Revision: 1.1.1.1 $ -| $Date: 2006-12-02 04:34:40 $ -| $Author: mcfly_e107 $ +| $Revision: 1.2 $ +| $Date: 2007-02-14 21:17:15 $ +| $Author: e107steved $ +----------------------------------------------------------------------------+ */ define("DBLAN_1", "Core settings backed up in database."); @@ -38,8 +38,11 @@ define("DBLAN_26", "Included add-ons"); define("DBLAN_27", "Installed"); define("DBLAN_28", "Click button to scan plugin directories for changes"); define("DBLAN_29", "Scan plugin directories"); - - +define("DBLAN_30", " (If an addon shows an error, check for characters outside the PHP opening/closing tags)"); +define("DBLAN_31", "Pass"); +define("DBLAN_32", "Error"); +define("DBLAN_33", "Inaccessible"); +define("DBLAN_34", "Not checked"); ?>