Exemple #1
0
 function next()
 {
     if (!$this->handle) {
         return $this->first();
     }
     while (($file = readdir($this->handle)) !== false) {
         if ($file == '.' || $file == '..') {
             continue;
         }
         $this->stamp = filemtime($this->root . "/{$file}");
         return pieDecodeName($file);
     }
     closedir($this->handle);
     $this->handle = false;
     return false;
 }
Exemple #2
0
 function rename($oldname, $newname)
 {
     if (!file_exists($this->_filePath($oldname))) {
         return false;
     }
     rename($this->_filePath($oldname), $this->_filePath($newname));
     if (!($dh = opendir($GLOBALS['pie']['run_path'] . '/media'))) {
         return false;
     }
     while (($file = readdir($dh)) !== false) {
         if ($file == '.' || $file == '..') {
             continue;
         }
         $file = pieDecodeName($file);
         if (!preg_match('/^(.*) (\\d{1,10})$/', $file, $match)) {
             continue;
         }
         if ($match[1] == $oldname) {
             rename($this->_mediaPath($file), $this->_mediaPath("{$newname} {$match['2']}"));
         }
     }
     closedir($dh);
     return true;
 }