Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/www/core/model/modx/processors/system/filesys/folder/ |
<?php /** * @package modx * @subpackage processors.system.filesys.folder */ if (!$modx->hasPermission('file_manager')) return $modx->error->failure($modx->lexicon('permission_denied')); $dir = $scriptProperties['path'].$scriptProperties['folder']; if (!file_exists($dir)) return $modx->error->failure($modx->lexicon('file_folder_err_nf')); if (!@rmdirr($dir)) return $modx->error->failure($modx->lexicon('file_folder_err_remove')); function rmdirr($dirname) { ob_start(); if (!is_dir($dirname)) return false; $dscan = array(realpath($dirname)); $darr = array(); while (!empty($dscan)) { $dcur = array_pop($dscan); $darr[] = $dcur; if ($d=opendir($dcur)) { while ($f=readdir($d)) { if ($f=='.' || $f=='..') continue; $f=$dcur.'/'.$f; if (is_dir($f)) $dscan[] = $f; else unlink($f); } closedir($d); } } for ($i=count($darr)-1; $i>=0; $i--) { @rmdir($darr[$i]); } ob_flush(); return !is_dir($dirname); } return $modx->error->success();