File: commands/ls.php

Recommend this page to a friend!
  Classes of Andoitz Jordan Marmolejo   JavaScript Query Terminal   commands/ls.php   Download  
File: commands/ls.php
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: JavaScript Query Terminal
Online console to run server commands using AJAX
Author: By
Last change: Update of commands/ls.php
Date: 2 years ago
Size: 763 bytes


Class file image Download
<?php Class ls extends Command{ private $home = "home/"; public function __construct(){ parent::__construct(); } public function init($params){ if(count($params)>0){ $this->listFiles($params); } else{ $r = $this->home.$_SESSION["user"]["username"]; if($d=opendir($r)){ $this->data.="\n"; while(false!==($e=readdir($d))){ if($e!='.'&&($e!='..')){ if(is_dir($r.'/'.$e)){ $this->data.=" d [[b;#88F;]".$e."]\n"; } else{ $this->data.=" f ".$e."\n"; } } } closedir($d); } } } private function listFiles($params){ $result = null; $pError = $this->syntaxError($params,1); if(!$pError) $result .= ""; else $result = $pError."\n"; $this->data = $result; } } ?>