diff --git a/e107_admin/db.php b/e107_admin/db.php
index 9389dbe18..3b457d772 100644
--- a/e107_admin/db.php
+++ b/e107_admin/db.php
@@ -1470,6 +1470,8 @@ class system_tools
);
}
+
+
/**
* Plugin Folder Scanner
* @return none
@@ -1479,7 +1481,6 @@ class system_tools
$error_messages = array(0 => DBLAN_31, 1 => LAN_ERROR, 2 => DBLAN_33, 3 => DBLAN_34);
// $error_image = array("integrity_pass.png", "integrity_fail.png", "warning.png", "blank.png");
$error_glyph = array(ADMIN_TRUE_ICON,ADMIN_FALSE_ICON,ADMIN_WARNING_ICON," ");
-
$error_type = array('warning'=>2, 'error'=>1);
@@ -1489,16 +1490,10 @@ class system_tools
$frm = e107::getForm();
$mes = e107::getMessage();
- require_once (e_HANDLER."plugin_class.php");
- $ep = new e107plugin();
- $ep->update_plugins_table($mode); // scan for e_xxx changes and save to plugin table.
- $ep->save_addon_prefs($mode); // generate global e_xxx_list prefs from plugin table.
-
- /* we all are awaiting for PHP5 only support - method chaining...
- $mes->add(DBLAN_22.' - '.DBLAN_23, E_MESSAGE_SUCCESS)
- ->add("".LAN_BACK."", E_MESSAGE_SUCCESS)
- ->add(DBLAN_30);
- */
+ // require_once (e_HANDLER."plugin_class.php");
+ // $ep = new e107plugin();
+ // $ep->update_plugins_table($mode); // scan for e_xxx changes and save to plugin table.
+ // $ep->save_addon_prefs($mode); // generate global e_xxx_list prefs from plugin table.
$mes->add(DBLAN_23, E_MESSAGE_SUCCESS);
$mes->add("".LAN_BACK."", E_MESSAGE_SUCCESS);
@@ -1526,13 +1521,80 @@ class system_tools
";
+
+ $plg = e107::getPlug()->clearCache();
+
+ $plg->buildAddonPrefLists();
+
+ foreach($plg->getDetected() as $folder)
+ {
+ $plg->load($folder);
+
+ $name = $plg->getName();
+ $addons = $plg->getAddons();
+
+ $text .= "
+
+ ".$name." |
+ ".$folder." |
+ ";
+
+ if(!empty($addons))
+ {
+
+ foreach(explode(',', $addons) as $this_addon)
+ {
+ $ret_code = 3; // Default to 'not checked
+ if((strpos($this_addon, 'e_') === 0) || (substr($this_addon, - 4, 4) == '_sql'))
+ {
+ $ret_code = $plg->getAddonErrors($this_addon); // See whether spaces before opening tag or after closing tag
+ }
+ elseif(strpos($this_addon, 'sc_') === 0)
+ {
+ $this_addon = substr($this_addon, 3). ' (sc)';
+ }
+
+ if(!is_numeric($ret_code))
+ {
+ $errorMessage = $ret_code['msg'];
+ $ret_code = $error_type[$ret_code['type']];
+ }
+ else
+ {
+ $errorMessage = $error_messages[$ret_code];
+ }
+
+ $text .= "";
+ $text .= $error_glyph[$ret_code]." ";
+
+ $text .= trim($this_addon); // $ret_code - 0=OK, 1=content error, 2=access error
+ $text .= " ";
+ }
+ }
+
+
+ $text .= " |
+ ";
+
+ $text .= ($plg->isInstalled() === true) ? "".DBLAN_27."" : " ";
+
+
+ $text .= " |
+
+ ";
+
+
+ }
+
+/*
+
$sql->select("plugin", "*", "plugin_id !='' order by plugin_path ASC"); // Must order by path to pick up duplicates. (plugin names may change).
$previous = '';
while($row = $sql->fetch())
{
e107::loadLanFiles($row['plugin_path'],'admin');
- e107::plugLan($row['plugin_path'],'global',true);
-
+ e107::plugLan($row['plugin_path'],'global',true);
+
$text .= "
".$tp->toHtml($row['plugin_name'], FALSE, "defs,emotes_off")." |
@@ -1596,7 +1658,7 @@ class system_tools
";
$previous = $row['plugin_path'];
- }
+ }*/
$text .= "
@@ -1607,6 +1669,10 @@ class system_tools
e107::getRender()->tablerender(DBLAN_10.SEP.DBLAN_22, $mes->render().$text);
}
+
+
+
+
}
//XXX - what is this for (backup core)?
diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php
index 0cbe9bd9f..bc9d81dee 100644
--- a/e107_handlers/plugin_class.php
+++ b/e107_handlers/plugin_class.php
@@ -311,6 +311,82 @@ class e_plugin
}
+ /**
+ * Check if the currently loaded plugin is installed
+ * @return mixed
+ */
+ public function isInstalled()
+ {
+ if(empty($this->_plugdir))
+ {
+ e107::getDebug()->log("\$this->_plugdir is empty ".__FILE__." ". __CLASS__ ."::".__METHOD__);
+ }
+
+
+ return in_array($this->_plugdir, array_keys($this->_installed));
+ }
+
+
+ /**
+ * Check if the currently loaded plugin's addon has errors.
+ * @return mixed
+ */
+ public function getAddonErrors($e_xxx)
+ {
+ if (is_readable(e_PLUGIN.$this->_plugdir."/".$e_xxx.".php"))
+ {
+ $content = file_get_contents(e_PLUGIN.$this->_plugdir."/".$e_xxx.".php");
+ }
+ else
+ {
+ return 2;
+ }
+
+ if(substr($e_xxx, - 4, 4) == '_sql')
+ {
+
+ if(strpos($content,'INSERT INTO')!==false)
+ {
+ return array('type'=> 'error', 'msg'=>"INSERT sql commands are not permitted here. Use a ".$this->_plugdir."_setup.php file instead.");
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ // Generic markup check
+ if ((substr($content, 0, 5) != '<'.'?php') || ((substr($content, -2, 2) != '?'.'>') && (strrpos($content, '?'.'>') !== FALSE)))
+ {
+ return 1;
+ }
+
+
+ if($e_xxx == 'e_meta' && strpos($content,'