122             $path = XOOPS_VAR_PATH . 
'/caches/xoops_cache';
 
  125             $this->mode = intval(
$mode, 8);
 
  127         if (!file_exists(
$path) && $create == 
true) {
 
  163             return $this->path = 
$path;
 
  180         $dir = opendir($this->path);
 
  181         if (
$dir !== 
false) {
 
  182             while (
false !== ($n = readdir(
$dir))) {
 
  184                 if (is_array($exceptions)) {
 
  185                     if (!in_array($n, $exceptions)) {
 
  188                 } 
else if ((!preg_match(
'/^\\.+$/', $n) && $exceptions == 
false) || ($exceptions == 
true && !preg_match(
'/^\\.(.*)$/', $n))) {
 
  191                 if ($item !== 
false) {
 
  199             if (
$sort || $this->sort) {
 
  220         if (!is_array($data)) {
 
  223         list ($dirs, 
$files) = $data;
 
  226             if (preg_match(
"/^{$regexp_pattern}$/i", $file)) {
 
  244         $this->
cd($startsOn);
 
  260             if (preg_match(
"/^{$pattern}$/i", $file)) {
 
  265         foreach ($dirs as 
$dir) {
 
  267             $found = array_merge($found, $this->
findRecursive($pattern));
 
  282         if (preg_match(
'/^[A-Z]:\\\\/i', 
$path)) {
 
  298         $match = preg_match(
'/^\\//', 
$path) || preg_match(
'/^[A-Z]:\\//i', 
$path);
 
  374         return $this->
inPath($newdir);
 
  388             $return = preg_match(
'/^(.*)' . preg_quote(
$dir, 
'/') . 
'(.*)/', $current);
 
  390             $return = preg_match(
'/^(.*)' . preg_quote($current, 
'/') . 
'(.*)/', 
$dir);
 
  414         if ($recursive === 
false && is_dir(
$path)) {
 
  425             foreach ($paths as $key => $fullpath) {
 
  426                 $check = explode(
'/', $fullpath);
 
  427                 $count = count($check);
 
  429                 if (in_array($check[$count - 1], $exceptions)) {
 
  434                     $this->
messages[] = sprintf(
'%s changed to %s', $fullpath, 
$mode);
 
  436                     $this->
errors[] = sprintf(
'%s NOT changed to %s', $fullpath, 
$mode);
 
  439             if (empty($this->
errors)) {
 
  458         $this->files = array();
 
  459         $this->directories = array(
 
  462         while (count($this->directories)) {
 
  463             $dir = array_pop($this->directories);
 
  467         if (
$type === null) {
 
  472         if (
$type === 
'dir') {
 
  488             $dirHandle = opendir(
$path);
 
  489             while (
false !== ($item = readdir($dirHandle))) {
 
  491                 if (($hidden === 
true && $item != 
'.' && $item != 
'..') || ($hidden === 
false && ! preg_match(
'/^\\.(.*)$/', $item))) {
 
  492                     $found = 
$path . 
'/' . $item;
 
  494                 if ($found !== 
false) {
 
  495                     if (is_dir($found)) {
 
  496                         array_push($this->directories, $found);
 
  498                         array_push($this->files, $found);
 
  502             closedir($dirHandle);
 
  516         if (is_dir($pathname) || empty($pathname)) {
 
  522         if (is_file($pathname)) {
 
  523             $this->
errors[] = sprintf(
'%s is a file', $pathname);
 
  526         $nextPathname = substr($pathname, 0, strrpos($pathname, 
'/'));
 
  528             if (!file_exists($pathname)) {
 
  529                 if (mkdir($pathname, intval(
$mode, 8))) {
 
  530                     $this->
messages[] = sprintf(
'%s created', $pathname);
 
  533                     $this->
errors[] = sprintf(
'%s NOT created', $pathname);
 
  550         $directory = $this->
slashTerm($this->path);
 
  551         $stack = array($directory);
 
  552         $count = count($stack);
 
  554             if (is_file($stack[
$i])) {
 
  555                 $size += filesize($stack[$i]);
 
  556             } 
else if (is_dir($stack[$i])) {
 
  557                 $dir = dir($stack[$i]);
 
  559                     while (
false !== ($entry = 
$dir->read())) {
 
  560                         if ($entry == 
'.' || $entry == 
'..') {
 
  563                         $add = $stack[
$i] . $entry;
 
  564                         if (is_dir($stack[$i] . $entry)) {
 
  587         if (is_dir(
$path) === 
true) {
 
  589             $normal_files = glob(
$path . 
'*');
 
  590             $hidden_files = glob(
$path . 
'\.?*');
 
  591             $files = array_merge($normal_files, $hidden_files);
 
  594                     if (preg_match(
"/(\.|\.\.)$/", $file)) {
 
  597                     if (is_file($file) === 
true) {
 
  601                             $this->
errors[] = sprintf(
'%s NOT removed', 
$path);
 
  603                     } 
else if (is_dir($file) === 
true) {
 
  604                         if ($this->
delete($file) === 
false) {
 
  611             if (rmdir(
$path) === 
false) {
 
  612                 $this->
errors[] = sprintf(
'%s NOT removed', 
$path);
 
  637             'from' => $this->path ,
 
  638             'mode' => $this->mode ,
 
  644         if (!$this->
cd($fromDir)) {
 
  645             $this->
errors[] = sprintf(
'%s not found', $fromDir);
 
  648         if (!is_dir($toDir)) {
 
  649             mkdir($toDir, 
$mode);
 
  651         if (!is_writable($toDir)) {
 
  652             $this->
errors[] = sprintf(
'%s not writable', $toDir);
 
  655         $exceptions = array_merge(array(
 
  661             while (
false !== ($item = readdir(
$handle))) {
 
  662                 if (!in_array($item, $exceptions)) {
 
  665                     if (is_file($from)) {
 
  666                         if (
copy($from, $to)) {
 
  668                             touch($to, filemtime($from));
 
  669                             $this->
messages[] = sprintf(
'%s copied to %s', $from, $to);
 
  671                             $this->
errors[] = sprintf(
'%s NOT copied to %s', $from, $to);
 
  674                     if (is_dir($from) && !file_exists($to)) {
 
  675                         if (mkdir($to, intval(
$mode, 8))) {
 
  677                             $this->
messages[] = sprintf(
'%s created', $to);
 
  683                             $this->
errors[] = sprintf(
'%s not created', $to);
 
  692         if (!empty($this->
errors)) {
 
  714             'from' => $this->path ,
 
  715             'mode' => $this->mode ,
 
  718             if ($this->
delete(
$options[
'from'])) {
 
  756         if (strpos(
$path, 
'..') === 
false) {
 
  762         $parts = explode(
'/', 
$path);
 
  764         $newpath = 
$path{0} == 
'/' ? 
'/' : 
'';
 
  765         while (($part = array_shift($parts)) !== null) {
 
  766             if ($part == 
'.' || $part == 
'') {
 
  770                 if (count($newparts) > 0) {
 
  771                     array_pop($newparts);
 
  779         $newpath .= implode(
'/', $newparts);
 
  796         if (preg_match(
'/[\/\\\]$/', 
$path)) {