예제 #1
0
파일: index.php 프로젝트: TheShockTop/dirp
 /**
  * index
  *
  * @param \dirp\http\request $req
  * @param \dirp\http\response $res
  */
 public function index(\dirp\http\request $req, \dirp\http\response $res)
 {
     $path = file::safe_path($req->get('dir', '/'));
     $files = file::from_directory($path);
     $relative = file::to_relative_path($path);
     // most likely tried to list a file. a file is
     // not a directory, silly.
     if ($files === false) {
         $res->redirect($req->get_base_uri());
     }
     $ev = event::fire('indexlist', array('files' => $files, 'body' => null, 'relative' => $relative, 'path' => $path));
     // prepare the breadcrumb:
     $root = $req->get_base_uri() . '?dir=';
     $parts = explode('/', $relative);
     $crumbs = array();
     foreach ($parts as $i => $crumb) {
         $crumbs[$crumb] = $root . '/' . rawurlencode(implode('/', array_slice($parts, 0, $i + 1)));
     }
     $this->master()->title = 'viewing: /' . $relative;
     $this->master()->css[] = \dirp\app::asset('css/index/index.css');
     $this->master()->body = $this->view('list')->render(array('files' => $ev->files, 'relative' => $relative, 'crumbs' => $crumbs, 'root' => $req->get_base_uri() . '/', 'filesroot' => \dirp\app::cfg()->files_uri, 'body_override' => $ev->body, 'files_count' => 0));
 }
예제 #2
0
			</div>
		</div>
		</div>

		<div id="footer">
			powered by
			<a class="button" style="margin-right:0" href="http://github.com/filp/dirp">
				<img src="<?php 
echo \dirp\app::asset('img/folder_heart2.png');
?>
">
				dirp
			</a>
		</div>

		<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
		<!-- <script type="text/javascript" src="<?php 
echo \dirp\app::asset('js/dirp.js');
?>
"></script> -->
		<? if($js): ?>
			<? foreach($js as $script): ?>
				<script type="text/javascript" src="<?php 
echo $script;
?>
"></script>
			<? endforeach ?>
		<? endif ?>
	</body>
</html>
예제 #3
0
파일: list.php 프로젝트: TheShockTop/dirp
						<? endif ?>
						<? if($file->mtime): ?>
							<span class="filemodified"><?php 
echo date('g:i:s a', $file->mtime);
?>
</span>
						<? endif ?>
						<? if($file->sub): ?>
							<div class="sub">
								<div class="content">
									<?php 
echo $file->sub;
?>
								</div>
							</div>
						<? endif ?>
					</div>
				</a>
			<? $files_count++ //hackety hack ?>
		<? endforeach ?>
	</div>
<? endif ?>
<? if(!$files_count): ?>
	<div class="message">
		<img src="<?php 
echo \dirp\app::asset('img/page_look.png');
?>
" alt="uhhhh">
		There's not a single file in sight!
	</div>
<? endif ?>