1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Issue #195 - Incompatible plugin list updated.

This commit is contained in:
Cameron
2013-05-18 01:31:56 -07:00
parent 393fbc5007
commit 8b9d1bb322

View File

@@ -17,17 +17,13 @@
require_once('../class2.php'); require_once('../class2.php');
include_once(e107::coreTemplatePath('admin_icons')); // Needs to be loaded before infopanel AND in boot.php include_once(e107::coreTemplatePath('admin_icons')); // Needs to be loaded before infopanel AND in boot.php
if(vartrue($_GET['iframe']) == 1) if(vartrue($_GET['iframe']) == 1)
{ {
define('e_IFRAME', true); define('e_IFRAME', true);
} }
$e_sub_cat = 'main'; $e_sub_cat = 'main';
if (varset($pref['adminstyle'])=='cascade' || varset($pref['adminstyle'])=='beginner') // Deprecated Admin-include. if (varset($pref['adminstyle'])=='cascade' || varset($pref['adminstyle'])=='beginner') // Deprecated Admin-include.
{ {
$pref['adminstyle'] = 'infopanel'; $pref['adminstyle'] = 'infopanel';
@@ -45,143 +41,169 @@ if(strpos($pref['adminstyle'], 'infopanel') === 0)
} }
require_once(e_ADMIN.'boot.php'); require_once(e_ADMIN.'boot.php');
require_once(e_ADMIN.'auth.php'); require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER.'upload_handler.php'); require_once(e_HANDLER.'upload_handler.php');
new admin_start;
$mes = e107::getMessage(); $mes = e107::getMessage();
if (!isset($pref['adminstyle'])) $pref['adminstyle'] = 'infopanel'; // Shouldn't be needed - but just in case if (!isset($pref['adminstyle'])) $pref['adminstyle'] = 'infopanel'; // Shouldn't be needed - but just in case
// --- check for htmlarea.
if (is_dir(e_ADMIN.'htmlarea') || is_dir(e_HANDLER.'htmlarea'))
class admin_start
{ {
/*$text = ADLAN_ERR_2."<br /><br />
<div style='text-align:center'>".$HANDLERS_DIRECTORY."htmlarea/<br />".$ADMIN_DIRECTORY."htmlarea/</div>"; private $incompat = array(
$ns -> tablerender(ADLAN_ERR_1, $text);*/ 'banhelper' => 1.7,
'slir_admin' => 1.0,
$mes->addWarning($HANDLERS_DIRECTORY."htmlarea/<br />".$ADMIN_DIRECTORY."htmlarea/"); 'facebook_like' => 0.7,
} 'unanswered' => 1.4,
'lightwindow' => '1.0b',
'aa_jquery' => 1.2,
'who' => 1.0,
'ratings' => 4.2
);
// ------------- Compatibility Check ----------------------------- private $allowed_types = null;
$installedPlugs = e107::getPref('plug_installed');
$incompat = array(
'banhelper' => 1.7, function __construct()
'slir_admin' => 1.0
);
$inCompatText = "";
$incompatFolders = array_keys($incompat);
foreach($incompat as $folder => $version)
{
if(vartrue($installedPlugs[$folder]) && $version == $installedPlugs[$folder])
{ {
$inCompatText .= "<li>".$folder." v".$installedPlugs[$folder]."</li>";
$this->checkHtmlarea();
$this->checkIncompatiblePlugins();
$this->checkFileTypes();
$this->checkSuspiciousFiles();
} }
}
if($inCompatText)
{
$text = "<ul>".$inCompatText."</ul>"; function checkHtmlarea()
$mes->addWarning("The following plugins are not compatible with this version of e107 and should be uninstalled: ".$text."<a class='btn' href='".e_ADMIN."plugin.php'>uninstall</a>");
}
/* Not used in 0.8
// check for old modules.
if(getperms('0') && isset($pref['modules']) && $pref['modules'] && $sql->db_Field("plugin",5) == "plugin_addons")
{
$mods=explode(",", $pref['modules']);
$thef = "e_module.php";
foreach ($mods as $mod)
{ {
if (is_readable(e_PLUGIN."{$mod}/module.php")) $mes = e107::getMessage();
if (is_dir(e_ADMIN.'htmlarea') || is_dir(e_HANDLER.'htmlarea'))
{ {
$mod_found[] = e_PLUGIN."{$mod}/module.php"; $mes->addWarning($HANDLERS_DIRECTORY."htmlarea/<br />".$ADMIN_DIRECTORY."htmlarea/");
} }
} }
if($mod_found)
function checkIncompatiblePlugins()
{ {
$text = ADLAN_ERR_5." <b>".$thef."</b>:<br /><br /><ul>"; $mes = e107::getMessage();
foreach($mod_found as $val){
$text .= "<li>".str_replace("../","",$val)."</li>\n"; $installedPlugs = e107::getPref('plug_installed');
}
$text .="</ul><br /> $inCompatText = "";
<form method='post' action='".e_ADMIN."db.php' id='upd'> $incompatFolders = array_keys($this->incompat);
<a href='#' onclick=\"document.getElementById('upd').submit()\">".ADLAN_ERR_6."</a>
<input type='hidden' name='plugin_scan' value='1' /> foreach($this->incompat as $folder => $version)
</form>";
$ns -> tablerender(ADLAN_ERR_4,$text);
}
}
*/
// check for file-types;
$allowed_types = get_filetypes(); // Get allowed types according to filetypes.xml or filetypes.php
if (count($allowed_types) == 0)
{
$allowed_types = array('zip' => 1, 'gz' => 1, 'jpg' => 1, 'png' => 1, 'gif' => 1);
$mes->addInfo("Setting default filetypes: ".implode(', ',array_keys($allowed_types)));
}
//echo "Allowed filetypes = ".implode(', ',array_keys($allowed_types)).'<br />';
// avatar check.
$public = array(e_UPLOAD, e_AVATAR_UPLOAD);
$exceptions = array(".","..","/","CVS","avatars","Thumbs.db",".ftpquota",".htaccess","php.ini",".cvsignore",'e107.htaccess');
//TODO use $file-class to grab list and perform this check.
foreach ($public as $dir)
{
if (is_dir($dir))
{
if ($dh = opendir($dir))
{ {
while (($file = readdir($dh)) !== false) if(vartrue($installedPlugs[$folder]) && $version == $installedPlugs[$folder])
{ {
if (is_dir($dir."/".$file) == FALSE && !in_array($file,$exceptions)) $inCompatText .= "<li>".$folder." v".$installedPlugs[$folder]."</li>";
}
}
if($inCompatText)
{
$text = "<ul>".$inCompatText."</ul>";
$mes->addWarning("The following plugins are not compatible with this version of e107 and should be uninstalled: ".$text."<a class='btn' href='".e_ADMIN."plugin.php'>uninstall</a>");
}
}
function checkFileTypes()
{
$mes = e107::getMessage();
$this->allowed_types = get_filetypes(); // Get allowed types according to filetypes.xml or filetypes.php
if (count($this->allowed_types) == 0)
{
$this->allowed_types = array('zip' => 1, 'gz' => 1, 'jpg' => 1, 'png' => 1, 'gif' => 1);
$mes->addInfo("Setting default filetypes: ".implode(', ',array_keys($this->allowed_types)));
}
}
function checkSuspiciousFiles()
{
$mes = e107::getMessage();
$public = array(e_UPLOAD, e_AVATAR_UPLOAD);
$exceptions = array(".","..","/","CVS","avatars","Thumbs.db",".ftpquota",".htaccess","php.ini",".cvsignore",'e107.htaccess');
//TODO use $file-class to grab list and perform this check.
foreach ($public as $dir)
{
if (is_dir($dir))
{
if ($dh = opendir($dir))
{ {
$fext = substr(strrchr($file, "."), 1); while (($file = readdir($dh)) !== false)
if (!array_key_exists(strtolower($fext),$allowed_types) )
{ {
if ($file == 'index.html' || $file == "null.txt") if (is_dir($dir."/".$file) == FALSE && !in_array($file,$exceptions))
{ {
if (filesize($dir.'/'.$file)) $fext = substr(strrchr($file, "."), 1);
if (!array_key_exists(strtolower($fext),$this->allowed_types) )
{ {
$potential[] = str_replace('../', '', $dir).'/'.$file; if ($file == 'index.html' || $file == "null.txt")
{
if (filesize($dir.'/'.$file))
{
$potential[] = str_replace('../', '', $dir).'/'.$file;
}
}
else
{
$potential[] = str_replace('../', '', $dir).'/'.$file;
}
} }
} }
else
{
$potential[] = str_replace('../', '', $dir).'/'.$file;
}
} }
closedir($dh);
} }
} }
closedir($dh);
} }
if (isset($potential))
{
//$text = ADLAN_ERR_3."<br /><br />";
$mes->addWarning(ADLAN_ERR_3);
$text = '<ul>';
foreach ($potential as $p_file)
{
$text .= '<li>'.$p_file.'</li>';
}
$mes->addWarning($text);
//$ns -> tablerender(ADLAN_ERR_1, $text);
}
} }
} }
if (isset($potential))
{
//$text = ADLAN_ERR_3."<br /><br />";
$mes->addWarning(ADLAN_ERR_3);
$text = '<ul>';
foreach ($potential as $p_file)
{
$text .= '<li>'.$p_file.'</li>';
}
$mes->addWarning($text);
//$ns -> tablerender(ADLAN_ERR_1, $text);
}
// --------------------------------------------------------- // ---------------------------------------------------------
@@ -309,4 +331,4 @@ function log_request()
require_once("footer.php"); require_once("footer.php");
?> ?>