Esempio n. 1
0
 public function setPath($path)
 {
     // Update
     if ($path == '*') {
         $path = $this->_path;
     }
     $path = _realpath($path);
     if (_file_exists($path) and _is_dir($path)) {
         if (_is_readable($path)) {
             $this->_path = $path;
             $this->_tree = _scandir($this->_path);
             $this->_size = count($this->_tree);
             return $this->_path;
         } else {
             throw new Exception("Can't read dir: {$path}");
         }
     } else {
         throw new Exception("Not a dir: {$path}");
     }
 }
Esempio n. 2
0
 public function __construct($path)
 {
     if (_file_exists($path)) {
         /*$name = basename($path);
         		if ($name == '.'
         		 or $name == '..') { // Les deux fichiers zarbis
         			throw new Exception("Le fichier est zarb: '$name'");
         		// Sinon on fait normalement
         		} else*/
         $this->_path = _realpath($path);
     } else {
         throw new Exception("Le fichier n'existe pas: {$path}");
     }
     $this->_write = $this->isWritable();
     $this->_read = $this->isReadable();
     if ($this->isFolder()) {
         $this->_type = 'folder';
     } elseif ($this->isFile()) {
         $this->_type = 'file';
     } else {
         $this->_type = 'unknown';
     }
 }
Esempio n. 3
0
        try {
            echo json_encode($MODULE[$action]());
        } catch (Exception $e) {
            echo json_encode(array('error' => true, 'data' => $e->getMessage()));
        }
        // Si on demande un module yolo
    } elseif ($init == 'n') {
        try {
            echo $MODULE[$action]();
        } catch (Exception $e) {
            $err = $e->getMessage();
            echo "<div class='php-error'>{$err}</div>";
        }
    }
} else {
    $APPNAME = basename(_realpath('.')) . ' as "' . get_current_user() . '"';
    include_once "views/home.php";
}
exit;
/* JS

function copy(files) {
	var sync = {"total": files.length, "count": 0};
	$.each(files, function(i, file) {
		sync.total += 1;
		$.post(caca, function(data) {
			// Ca marche
			//...
			sync.count += 1;
		}).fail(function(data) {
			// Ca marche pas
Esempio n. 4
0
function _file_put_contents($file, $data)
{
    global $TMP;
    $real = _realpath($file);
    $tmp = "{$TMP}/tmp";
    file_put_contents($tmp, $data);
    return trim_exec("cat \"{$tmp}\">\"{$real}\" && echo ok");
}