Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function directoryScan($dir) {
- $result = array();
- $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir,FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST);
- foreach($objects as $path => $object){
- $result[dirname($object->getPathname())][]=array(
- 'type'=>$object->getExtension(),
- 'path'=>$object->getPathname(),
- 'file'=>$object->getFilename(),
- 'size'=>$object->getSize(),
- 'changed'=>$object->getMTime(),
- 'permission'=>substr(sprintf('%o', fileperms($path)), -4)
- );
- }
- return $result;
- }
- $allowed = array('pdf','png','jpeg','jpg','gif');
- $result = '';
- $directory = './';
- foreach(directoryScan($directory) as $path => $dir){
- $result .= '<div class="info"><h2 class="short">'.$path.'</h2><ul class="long">'."\n";
- foreach($dir as $file){
- if(in_array($file['type'],$allowed))
- $result .= '<li><a href="'.urlencode($file['path']).'">'.$file['path'].'</a></li>'."\n";
- }
- $result .= '</ul></div>'."\n";
- }
- header("Content-type:text/html;charset=utf-8");
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <head>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
- <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
- <title>Grambow & Widmer</title>
- <style type="text/css">
- @charset "utf-8";
- .info {
- background-image: url('');
- background-position: 0px 2px;
- background-repeat: no-repeat;
- padding: 0px 0px 0px 17px;
- cursor: pointer;
- list-style:none;
- }
- .info ul {
- display: none;
- list-style:none;
- }
- body {
- width:600px;
- height:100%;
- margin:0 auto;
- text-align:center;
- color:#6C6C6C;
- font-family:Arial;
- }
- li a {
- list-style:none;
- width:600px;
- float:left;
- border-bottom:1px solid #000;
- padding-top:10px;
- padding-bottom:15px;
- font-weight:bold;
- font-size:20px;
- text-align:left;
- }
- ul li a{
- color: #6C6C6C;
- font-size: 18px;
- text-decoration: none;
- text-transform: uppercase;
- font-weight:normal;
- list-style:none;
- }
- h1 {
- color: #6C6C6C;
- }
- .short {
- border-bottom:1px solid #000;
- padding-bottom:10px;
- text-align:left;
- padding-left:20px;
- }
- img {
- margin-top:10px;
- }
- </style>
- </head>
- <body>
- <img src="logo.png"/>
- <h1>Kunden Akten</h1>
- <?php echo $result ?>
- <script type="text/javascript">
- $('.short').toggle(function() {
- $('.long', $(this).parent()).show();
- $(this).parent().css( '');
- }, function() {
- $('.long', $(this).parent()).hide();
- $(this).parent().css( '');
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment