function full_remove($target) { if (is_dir($target)) { $dirList = opendir($target); while ($file = readdir($dirList)) { if ($file != '.' and $file != '..') { $fullPath = $target . '/' . $file; if (!full_remove($fullPath)) { closedir($dirList); return false; } } } rmdir($target); return true; } return unlink($target); }
<?php if (!defined('SECURITY_CONSTANT')) { exit; } if (isset($_POST['restore'])) { if (full_remove('../filter/wiris') and copy('../lib/weblib.php.old', '../lib/weblib.php') and unlink('./install.php')) { echo translate('System restored. Please, delete pluginwiris directory manually now.'), ' <a href="..">', translate('Go to my moodle'), '</a>.<br /><br />'; echo errorMessage(); } else { echo translate("Plugin WIRIS Installer hasn't write permisions on"), ' ../filter/wiris or ../lib/weblib.php or ./install.php<br /><br />'; echo errorMessage(); } }