1.7, 'slir_admin' => 1.0, 'facebook_like' => 0.7, 'unanswered' => 1.4, 'lightwindow' => '1.0b', 'aa_jquery' => 1.2, 'who' => 1.0, 'ratings' => 4.2, 'lightbox' => 1.5, 'e107slider' => 0.1 ); private $allowed_types = null; function __construct() { $this->checkWritable(); $this->checkHtmlarea(); $this->checkIncompatiblePlugins(); $this->checkFileTypes(); $this->checkSuspiciousFiles(); $this->checkDeprecated(); } function checkWritable() { $mes = e107::getMessage(); if(deftrue('e_MEDIA') && is_dir(e_MEDIA) && !is_writable(e_MEDIA)) { $mes->addWarning("The folder ".e_MEDIA." is not writable. Please correct before proceeding."); } if(deftrue('e_SYSTEM') && is_dir(e_SYSTEM) && !is_writable(e_SYSTEM)) { $mes->addWarning("The folder ".e_SYSTEM." is not writable. Please correct before proceeding."); } } function checkHtmlarea() { $mes = e107::getMessage(); if (is_dir(e_ADMIN.'htmlarea') || is_dir(e_HANDLER.'htmlarea')) { $mes->addWarning($HANDLERS_DIRECTORY."htmlarea/
".$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]) { $inCompatText .= "
  • ".$folder." v".$installedPlugs[$folder]."
  • "; } } if($inCompatText) { $text = ""; $mes->addWarning("The following plugins are not compatible with this version of e107 and should be uninstalled: ".$text."uninstall"); } } function checkDeprecated() { $deprecated = array( e_ADMIN."ad_links.php", e_PLUGIN."tinymce4/e_meta.php", e_THEME."bootstrap3/css/bootstrap_dark.css", e_PLUGIN."search_menu/languages/English.php", e_LANGUAGEDIR."English/lan_parser_functions.php", e_HANDLER."np_class.php", e_CORE."shortcodes/single/user_extended.sc", e_ADMIN."download.php" ); $found = array(); foreach($deprecated as $path) { if(file_exists($path)) { $found[] = $path; } } if(!empty($found)) { $text = "The following old files can be safely deleted from your system: "; $text .= ""; e107::getMessage()->addWarning($text); } } 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); $tp = e107::getParser(); $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 (is_dir($dir."/".$file) == FALSE && !in_array($file,$exceptions)) { $fext = substr(strrchr($file, "."), 1); if (!array_key_exists(strtolower($fext),$this->allowed_types) ) { if ($file == 'index.html' || $file == "null.txt") { if (filesize($dir.'/'.$file)) { $potential[] = str_replace('../', '', $dir).'/'.$file; } } else { $potential[] = str_replace('../', '', $dir).'/'.$file; } } } } closedir($dh); } } } if (isset($potential)) { //$text = ADLAN_ERR_3."

    "; $mes->addWarning($tp->toHtml(ADLAN_ERR_3, true)); $text = '