Beispiel #1
0
 /**
  * delDir
  * 
  * @param string $d
  * @return string
  */
 public function delDir($d = '')
 {
     $err = '';
     self::$_instance->chmod($d, 0777);
     foreach (self::$_instance->iterator($d) as $f) {
         $realpath = self::$_instance->realpath($d . '/' . $f);
         $f = $realpath ? str_replace('\\', '/', $realpath) : str_replace('//', '/', $d . '/' . $f);
         self::$_instance->chmod($f, 0777);
         if (self::$_instance->is_dir($f)) {
             $this->delDir($f . '/');
         } elseif (self::$_instance->file_exists($f)) {
             if (!self::$_instance->unlink($f)) {
                 $err .= $f . '<br/>';
             }
         }
     }
     if (!self::$_instance->rmdir($d)) {
         $err .= Errors::get() . '<br/>';
     }
     if ($err) {
         return Helper_View::message(Language::get('del_dir_false') . '<br/>' . $err, Helper_View::MESSAGE_ERROR);
     }
     return Helper_View::message(Language::get('del_dir_true') . ' -&gt; ' . htmlspecialchars($d, ENT_NOQUOTES), Helper_View::MESSAGE_SUCCESS);
 }