Beispiel #1
0
 public function loadAll()
 {
     $pluginpath = Settings::getInstance()->get("root") . "system/plugins";
     $oDir = openDir($pluginpath);
     while ($item = readDir($oDir)) {
         $this->AddInfo($item);
     }
     closeDir($oDir);
 }
Beispiel #2
0
/**
 * This function returns a list of teaser - images contained in the $teaser - directory
 */
function get_teaser_array($teaser_directory)
{
    $teaser_array = array();
    $directory = openDir($teaser_directory);
    while ($file = readDir($directory)) {
        if ($file != "." && $file != "..") {
            array_push($teaser_array, $teaser_directory . $file);
        }
    }
    closeDir($directory);
    return $teaser_array;
}
Beispiel #3
0
 /**
  *
  * @param string $dir
  * @return array
  */
 public static function getFolders($dir)
 {
     $res = array();
     $oDir = openDir($dir);
     while ($item = readDir($oDir)) {
         if (is_dir($dir . "/" . $item)) {
             if ($item != "." && $item != "..") {
                 $res[] = $item;
             }
         }
     }
     closeDir($oDir);
     return $res;
 }
Beispiel #4
0
 private function get_filelist()
 {
     $filelist = array();
     $contentfolderpath = 'content/';
     $contentfolder = openDir($contentfolderpath);
     while ($file = readDir($contentfolder)) {
         if ($file != "." && $file != ".." && !is_dir($contentfolderpath . "/" . $file)) {
             $pathparts = pathinfo($file);
             $filelist[$pathparts['filename']] = $file;
         }
     }
     closeDir($contentfolder);
     return $filelist;
 }
Beispiel #5
0
 /**
  * Copies all files from one directory to another directory.
  * @param string $sourceDirectory The source directory.
  * @param string $targetDirectory The target directory.
  */
 public function copyFiles($sourceDirectory, $targetDirectory)
 {
     $dir = openDir($sourceDirectory);
     @mkDir($targetDirectory);
     while (false !== ($file = readDir($dir))) {
         if ($file == '.' || $file == '..') {
             continue;
         }
         if (is_dir($sourceDirectory . '/' . $file)) {
             $this->copyFiles($sourceDirectory . '/' . $file, $targetDirectory . '/' . $file);
         } else {
             copy($sourceDirectory . '/' . $file, $targetDirectory . '/' . $file);
         }
     }
     closeDir($dir);
 }
Beispiel #6
0
    if (is_dir("images/{$sDir}")) {
        $hFile = opendir("images/{$sDir}");
        if (!$hFile) {
            continue;
        }
        print "<h1>{$sDir}</h1>";
        while (false !== ($sFile = readdir($hFile))) {
            if ($sFile == "." || $sFile == "..") {
                continue;
            }
            $sFullFile = "images/{$sDir}/{$sFile}";
            if (!is_file($sFullFile)) {
                continue;
            }
            $aSize = getimagesize($sFullFile);
            if ($aSize == false) {
                continue;
            }
            # var_dump($aSize);
            print "<h2>##image {$sDir}/{$sFile}</h2>";
            print "<p>Gr&ouml;&szlig;e: " . $aSize[0] . "x" . $aSize[1] . "<br>";
            print "<br>";
            print "<img src=\"{$sFullFile}\" " . $aSize[3] . "><br>";
            print "<br>";
            print "</p>";
        }
        closeDir($hFile);
    }
    #echo "$sFile\n";
}
closedir($hDir);
Beispiel #7
0
            if (substr($file, 0, 1) != ".") {
                echo "<a href='javascript:anzeigen(\"../graph/{$topfile}/{$file}\")' id=\"{$zaehler}\">{$file}</a><br>\n";
                $zaehler = $zaehler + 1;
                //Datei mit der Höchsten änderungszeit wird gesucht
                if (filemtime("../graph/{$topfile}/{$file}") > $zeit) {
                    $zeit = fileatime("../graph/{$topfile}/{$file}");
                }
            }
        }
        //Zeiten werden formatiert
        $zeit_monat = $monate[date("n", $zeit) - 1];
        $zeit_tag = $tage[date("N", $zeit) - 1];
        $zeit_datum = date("d.", $zeit);
        $zeit_uhrzeit = date("H:i:s", $zeit);
        echo "<h6>Dieser Ordner wurde am {$zeit_tag}, den {$zeit_datum} {$zeit_monat} um {$zeit_uhrzeit} zuletzt ge&auml;ndert.</h6>";
        echo "</div><br>";
        closeDir($categorydir);
        //Zeit wird zurückgesetzt für nächsten Ordner
        $zeit = 0;
    }
}
closeDir($topdir);
//Hier ein versteckter Tag, der die Information erhält, wieviele Bilder es gibt.
echo "<b id=\"zaehlertag\">{$zaehler}</b>";
?>

</div>

</body>
</html>
 /**
 * Title
 *
 * Description
 *
 * @access public
 */
  function getCover($path) {
   $common_covers=array('cover.jpg');
   foreach($common_covers as $file) {
    if (file_exists($path.$file)) {
     return $file;
    }
   }

   //search for images
  @$d=openDir($path);
  if ($d) {
   $files=array();
   $biggest_size=0;
   $biggest_file='';
   while ($file=readDir($d)) {
   if (preg_match('/\.jpg$/is', $file) 
      || preg_match('/\.jpeg$/is', $file) 
      || preg_match('/\.gif$/is', $file)
      || preg_match('/\.png$/is', $file)
   ) {
    $file_size=filesize($path.$file);
    if ($file_size>$biggest_size) {
     $biggest_size=$file_size;
     $biggest_file=$file;
    }
    //$files=array('FILENAME'=>$file);
   }
   }
   closeDir($d);
   if ($biggest_file) {
    return $biggest_file;
   }
  }



  }
Beispiel #9
0
function loadDir($dirName)
{
    if ($handle = openDir($dirName)) {
        echo "<tr class='trTitle'><td>类型</td><td>文件名</td><td>大小</td><td>最后修改时间</td><td>操作</td></tr>";
        while (false !== ($files = readDir($handle))) {
            if ($files != "." && $files != "..") {
                $urlStrs = $dirName . "/" . $files;
                if (!is_dir($dirName . "/" . $files)) {
                    $types = "文件";
                    $cons = "<a href=\"loaddir.php?action=edit&urlstr={$urlStrs}\">编辑</a>";
                    $className = "file";
                    $fileSize = getSize($dirName . "/" . $files);
                    $fileaTime = date("Y-m-d H:i:s", getEditTime($dirName . "/" . $files));
                    $arrayfile[] = "<tr class='{$className}'><td>{$types}</td><td>{$files}</td><td>" . $fileSize . " bytes</td><td>{$fileaTime}</td><td>{$cons}</td></tr>";
                }
                //echo "<tr class='$className'><td>$types</td><td>$files</td><td>".$fileSize." bytes</td><td>$fileaTime</td><td>$cons</td></tr>";
            }
        }
        //$arraydirLen=count($arraydir);
        //for($i=0;$i<$arraydirLen;$i++) echo $arraydir[$i];
        $arrayfileLen = count($arrayfile);
        for ($i = 0; $i < $arrayfileLen; $i++) {
            echo $arrayfile[$i];
        }
        //echo $arraydir;
        closeDir($handle);
    }
}
Beispiel #10
0
 function getNotYetInstalledPlugins()
 {
     $col = array();
     $paths = array($this->_getCustomPluginsRoot(), $this->_getOfficialPluginsRoot());
     $exclude = array('.', '..', 'CVS', '.svn');
     foreach ($paths as $path) {
         $dir = openDir($path);
         while ($file = readDir($dir)) {
             if (!in_array($file, $exclude) && is_dir($path . '/' . $file)) {
                 if (!$this->isPluginInstalled($file) && !in_array($file, $col)) {
                     $col[] = $file;
                 }
             }
         }
         closeDir($dir);
     }
     return $col;
 }
 public function GetPluginClasses($classType)
 {
     // array to build the list in
     $classlist = array();
     // Attempt to open the folder
     $path = WP_PLUGIN_DIR . '/autochimp/plugins';
     if (($p = opendir($path)) !== FALSE) {
         // Read the directory for items inside it.
         while (($item = readdir($p)) !== FALSE) {
             // First check if the filter succeeds for the class type
             $filter = TRUE;
             // For a blank classType, get everything.  Otherwise, only get matches.
             if (0 !== strlen($classType)) {
                 $filter = 0 === strpos($item, $classType);
             }
             // Make sure the file is a PHP file as well passes the filter test
             if ($filter && 0 < strpos($item, '.php')) {
                 $class = basename($item, '.php');
                 array_push($classlist, $class);
             }
         }
         closeDir($p);
     }
     return $classlist;
 }
<?php

$verzeichnis = openDir("./");
// Verzeichnis lesen
while ($file = readDir($verzeichnis)) {
    // Höhere Verzeichnisse nicht anzeigen!
    $file_extension = substr($file, strlen($file) - 4);
    if ($file != "." && $file != ".." && ($file_extension == ".html" || $file_extension == ".HTML")) {
        // Link erstellen
        echo "<a href=\"{$file}\">{$file}</a><br>\n";
    }
    if (is_dir($file)) {
        // Link zu HQ und HD Bildern erstellen
        echo "<a href=\"{$file}\"/hq/list_images.php>HQ {$file}</a><br>\n";
        echo "<a href=\"{$file}\"/fullhd/list_images.php>HD {$file}</a><br>\n";
    }
}
// Verzeichnis schließen
closeDir($verzeichnis);
Beispiel #13
0
 /**
  *  カテゴリを全て取得する
  *  @return array   全てのカテゴリのカテゴリ名とファイルサイズ
  */
 private function _getCategories()
 {
     $h = openDir(Todo::DATA_DIR);
     if (!$h) {
         exit('data directory is not found.');
     }
     $cats = array();
     $limit = date('YmdHis', strToTime(Todo::BACKUP_TIME));
     while (false !== ($file = readDir($h))) {
         if (is_dir($file)) {
             continue;
         }
         $arr = explode('.', $file);
         $path = Todo::DATA_DIR . '/' . $file;
         if (count($arr) == 3) {
             //バックアップの場合
             if ($arr[2] < $limit) {
                 //期限切れは削除
                 unlink($path);
             }
         } else {
             //最新版の場合
             $cat = mb_convert_encoding($arr[0], Todo::ENCODING, Todo::FILE_NAME_ENCODING);
             $cats[$cat] = fileSize($path);
         }
     }
     closeDir($h);
     ksort($cats);
     return $cats;
 }
        if (strstr($datei, ".jpeg") || strstr($datei, ".png") || strstr($datei, ".jpg") || strstr($datei, ".JPEG") || strstr($datei, ".PNG") || strstr($datei, ".JPG")) {
            $verzeichnis_datei = $verzeichnis . $datei;
            $info = getImageSize($verzeichnis_datei);
            if ($info[0] >= $info[1]) {
                $quot = $info[0] / 200;
                $info[0] = 200;
                $info[1] /= $quot;
            } else {
                $quot = $info[1] / 200;
                $info[1] = 200;
                $info[0] /= $quot;
            }
            $c1++;
            $html .= "<td class=\"galerie_table\"><a href=\"erase_pic.php?pic={$verzeichnis_datei}\"><img src=\"bilder/teams/Thumbnails/1516/" . $team . "/TN" . $datei . "\"></a></td>";
            if ($c1 > 4) {
                $html .= '</tr><tr>';
                $c1 = 0;
            }
        }
    }
}
$html .= '</tr></table>';
closeDir($handle);
// Verzeichnis schließen
echo $html;
?>
	</form>
	<br />
	<b>Zum löschen einfach auf das Bild klicken</b>
</body>
</html>
Beispiel #15
0
 function files($parameters="") {
  global $REQUEST_URI;
  global $out;
  global $mode;

  $dir=str_replace('\\\'', "'", $_SERVER['REQUEST_URI']);
  $dir=preg_replace("/^\/.*?\//", "./", $dir);
  $dir=preg_replace("/\?.*?$/", "", $dir);
  $dir=urldecode($dir);

  //echo utf2win($dir);
  //exit;

  $paths=split("/", $dir);
  $old="";
  $history=array();
  foreach($paths as $v) {
   if ($v=="") continue;
   if ($v==".") continue;
   $rec=array();
   $rec['TITLE']=$v;
   $rec['PATH']=$old."$v/";
   $old.="$v/";
   $history[]=$rec;
  }
  $out['HISTORY']=$history;
  $out['CURRENT_DIR_TITLE']=($dir);
  $out['CURRENT_DIR']=urlencode($dir);

  $act_dir=INIT_DIR."$dir";

  if (@$mode=="descr") {
   global $file;
   global $new_descr;
   global $REMOTE_ADDR;
   global $can_edit;
   if (strpos($can_edit, $REMOTE_ADDR)>0) setDescription($act_dir, $file, $new_descr);
   $mode="";
   header("Location:?\n\n");
   exit;
  }

  $descriptions=getDescriptions($act_dir);

  $d=openDir($act_dir);
  $dirs=array();
  while ($file=readDir($d)) {
   if (($file==".") || ($file=="..")) {
    continue;
   }
   if (Is_Dir($act_dir.$file)) {
    $rec=array();
    $rec['TITLE']=$file;
    $rec['TITLE_SHORT']=$rec['TITLE'];
    if (strlen($rec['TITLE_SHORT'])>30) {
     $rec['TITLE_SHORT']=substr($rec['TITLE_SHORT'], 0, 30).'...';
    }
    if (IsSet($descriptions[$file])) {
     $rec['DESCR']=$descriptions[$file];
    }
    $rec['PATH']=urlencode("$file").'/';
    $rec['REAL_PATH']=$dir.$file;
    $dirs[]=$rec;
   }
  }
  closeDir($d);

  $dirs=mysort_array($dirs, "TITLE");

  if (count($dirs)>0) $out['DIRS']=$dirs;

  $d=openDir($act_dir);
  $files=array();
  while ($file=readDir($d)) {
   if (($file==".") || ($file=="..") || ($file=="Descript.ion")) {
    continue;
   }
   if (Is_File($act_dir.$file)) {
    $rec=array();
    $rec['TITLE']=$file;
    if (IsSet($descriptions[$file])) {
     $rec['DESCR']=$descriptions[$file];
    }
    if (strlen($rec['TITLE'])>30) {
     $rec['TITLE_SHORT']=substr($rec['TITLE'], 0, 30)."...";
    } else {
     $rec['TITLE_SHORT']=$rec['TITLE'];
    }
    $rec['PATH']="$file";
    $size=filesize($act_dir.$file);
    $total_size+=$size;
    if ($size>1024) {
     if ($size>1024*1024) {
      $size=(((int)(($size/1024/1024)*10))/10)." Mb";
     } else {
      $size=(int)($size/1024)." Kb";
     }
    } else {
     $size.=" b";
    }
    $rec['SIZE']=$size;
    $files[]=$rec;
   }
  }
  closeDir($d);

  $files=mysort_array($files, "TITLE");

  if (count($files)>0) $out['FILES']=$files;
  $out['TOTAL_FILES']=count($files);
  $out['TOTAL_DIRS']=count($dirs);

    if ($total_size>1024) {
     if ($total_size>1024*1024) {
      $total_size=(((int)(($total_size/1024/1024)*10))/10)." Mb";
     } else {
      $total_size=(int)($total_size/1024)." Kb";
     }
    } else {
     $total_size.=" b";
    }
    $out['TOTAL_SIZE']=$total_size;
 }
 /**
  * Function that will doest the sum of files in the directory
  *
  * @param string sFolder, required. the path to check
  * @param bool bSubfolders, optional, default value TRUE; do you wants the list of the subfolders too?
  * @private
  * @type int
  **/
 function _SIZE_get($sFolder, $bSubfolders)
 {
     $sum = -1;
     $dir = openDir(realpath($sFolder));
     while ($oObj = readDir($dir)) {
         if (is_file(realpath($sFolder) . $this->cSep . $oObj)) {
             $sum += filesize(realpath($sFolder) . $this->cSep . $oObj);
         }
         if ($bSubfolders && is_dir(realpath($sFolder) . $this->cSep . $oObj) && $oObj != '.' && $oObj != '..') {
             $sum += $this->_SIZE_get(realpath($sFolder) . $this->cSep . $oObj, TRUE);
         }
     }
     //while
     closeDir($dir);
     return $sum;
 }