Exemplo n.º 1
0
 /**
  * Remove directory and all its content recursively.
  *
  * @param string $filepath
  * @return boolean
  */
 function recursiveRemoveDir($filepath)
 {
     if (is_dir($filepath) && !is_link($filepath)) {
         if ($dh = opendir($filepath)) {
             while (($sf = readdir($dh)) !== false) {
                 if ($sf == '.' || $sf == '..') {
                     continue;
                 }
                 if (!PhotoQHelper::recursiveRemoveDir($filepath . '/' . $sf)) {
                     $rmError = new PhotoQErrorMessage($filepath . '/' . $sf . ' could not be deleted.');
                     $rmError->show();
                 }
             }
             closedir($dh);
         }
         return rmdir($filepath);
     }
     if (file_exists($filepath)) {
         return unlink($filepath);
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
 function showFtpFileList()
 {
     $ftpDir = $this->_oc->getFtpDir();
     echo '<p>' . sprintf(__('Import the following photos from: %s', 'PhotoQ'), "<code> {$ftpDir} </code>") . '</p>';
     if (!is_dir($ftpDir)) {
         $errMsg = new PhotoQErrorMessage("The directory <code>" . $ftpDir . "</code> does not exist on your server.");
         $errMsg->show();
     } else {
         $ftpDirContent = PhotoQHelper::getMatchingDirContent($ftpDir, '#.*\\.(jpg|jpeg|png|gif)$#i');
         foreach ($ftpDirContent as $file) {
             echo '<input type="checkbox" name="ftpFiles[]" value="' . $file . '" checked="checked" /> ' . basename($file) . '<br/>';
         }
     }
 }