1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +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,101 +41,116 @@ 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>";
$ns -> tablerender(ADLAN_ERR_1, $text);*/
$mes->addWarning($HANDLERS_DIRECTORY."htmlarea/<br />".$ADMIN_DIRECTORY."htmlarea/"); private $incompat = array(
}
// ------------- Compatibility Check -----------------------------
$installedPlugs = e107::getPref('plug_installed');
$incompat = array(
'banhelper' => 1.7, 'banhelper' => 1.7,
'slir_admin' => 1.0 'slir_admin' => 1.0,
); 'facebook_like' => 0.7,
'unanswered' => 1.4,
'lightwindow' => '1.0b',
'aa_jquery' => 1.2,
'who' => 1.0,
'ratings' => 4.2
);
$inCompatText = ""; private $allowed_types = null;
$incompatFolders = array_keys($incompat);
foreach($incompat as $folder => $version)
{
function __construct()
{
$this->checkHtmlarea();
$this->checkIncompatiblePlugins();
$this->checkFileTypes();
$this->checkSuspiciousFiles();
}
function checkHtmlarea()
{
$mes = e107::getMessage();
if (is_dir(e_ADMIN.'htmlarea') || is_dir(e_HANDLER.'htmlarea'))
{
$mes->addWarning($HANDLERS_DIRECTORY."htmlarea/<br />".$ADMIN_DIRECTORY."htmlarea/");
}
}
function checkIncompatiblePlugins()
{
$mes = e107::getMessage();
$installedPlugs = e107::getPref('plug_installed');
$inCompatText = "";
$incompatFolders = array_keys($this->incompat);
foreach($this->incompat as $folder => $version)
{
if(vartrue($installedPlugs[$folder]) && $version == $installedPlugs[$folder]) if(vartrue($installedPlugs[$folder]) && $version == $installedPlugs[$folder])
{ {
$inCompatText .= "<li>".$folder." v".$installedPlugs[$folder]."</li>"; $inCompatText .= "<li>".$folder." v".$installedPlugs[$folder]."</li>";
} }
} }
if($inCompatText) if($inCompatText)
{ {
$text = "<ul>".$inCompatText."</ul>"; $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>"); $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 function checkFileTypes()
// 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();
$this->allowed_types = get_filetypes(); // Get allowed types according to filetypes.xml or filetypes.php
if (count($this->allowed_types) == 0)
{ {
$mod_found[] = e_PLUGIN."{$mod}/module.php"; $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)));
} }
} }
if($mod_found)
function checkSuspiciousFiles()
{ {
$text = ADLAN_ERR_5." <b>".$thef."</b>:<br /><br /><ul>"; $mes = e107::getMessage();
foreach($mod_found as $val){ $public = array(e_UPLOAD, e_AVATAR_UPLOAD);
$text .= "<li>".str_replace("../","",$val)."</li>\n"; $exceptions = array(".","..","/","CVS","avatars","Thumbs.db",".ftpquota",".htaccess","php.ini",".cvsignore",'e107.htaccess');
}
$text .="</ul><br />
<form method='post' action='".e_ADMIN."db.php' id='upd'>
<a href='#' onclick=\"document.getElementById('upd').submit()\">".ADLAN_ERR_6."</a>
<input type='hidden' name='plugin_scan' value='1' />
</form>";
$ns -> tablerender(ADLAN_ERR_4,$text);
}
}
*/
// check for file-types; //TODO use $file-class to grab list and perform this check.
$allowed_types = get_filetypes(); // Get allowed types according to filetypes.xml or filetypes.php foreach ($public as $dir)
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 (is_dir($dir))
{ {
if ($dh = opendir($dir)) if ($dh = opendir($dir))
@@ -149,7 +160,7 @@ foreach ($public as $dir)
if (is_dir($dir."/".$file) == FALSE && !in_array($file,$exceptions)) if (is_dir($dir."/".$file) == FALSE && !in_array($file,$exceptions))
{ {
$fext = substr(strrchr($file, "."), 1); $fext = substr(strrchr($file, "."), 1);
if (!array_key_exists(strtolower($fext),$allowed_types) ) if (!array_key_exists(strtolower($fext),$this->allowed_types) )
{ {
if ($file == 'index.html' || $file == "null.txt") if ($file == 'index.html' || $file == "null.txt")
{ {
@@ -168,10 +179,10 @@ foreach ($public as $dir)
closedir($dh); closedir($dh);
} }
} }
} }
if (isset($potential)) if (isset($potential))
{ {
//$text = ADLAN_ERR_3."<br /><br />"; //$text = ADLAN_ERR_3."<br /><br />";
$mes->addWarning(ADLAN_ERR_3); $mes->addWarning(ADLAN_ERR_3);
$text = '<ul>'; $text = '<ul>';
@@ -181,9 +192,20 @@ if (isset($potential))
} }
$mes->addWarning($text); $mes->addWarning($text);
//$ns -> tablerender(ADLAN_ERR_1, $text); //$ns -> tablerender(ADLAN_ERR_1, $text);
}
}
} }
// --------------------------------------------------------- // ---------------------------------------------------------
e107::getScBatch('admin'); e107::getScBatch('admin');
echo $tp->parseTemplate('{ADMIN_COREUPDATE=alert}',true); echo $tp->parseTemplate('{ADMIN_COREUPDATE=alert}',true);