예제 #1
0
<?php

include_once '../fns/request_strings.php';
include_once '../common.php';
list($path, $name) = request_strings('path', 'name');
header('Cache-Control: no-cache');
header('Content-Type: application/json');
try {
    $fileSystem->rename($path, $name);
    echo json_encode(['ok' => true]);
} catch (FileSystemException $e) {
    $e->echoClientJson();
}
예제 #2
0
<?php

include_once '../fns/request_strings.php';
include_once '../classes/BinaryContentException.php';
include_once '../classes/FileSystemException.php';
include_once '../common.php';
header('Cache-Control: no-cache');
header('Content-Type: application/json');
list($path) = request_strings('path');
try {
    $fileContent = $fileSystem->getFileContent($path);
    $json = json_encode($fileContent);
    if ($json === false) {
        throw new BinaryContentException();
    }
    echo $json;
} catch (FileSystemException $e) {
    $e->echoClientJson();
}
예제 #3
0
<?php

include_once '../fns/request_strings.php';
include_once '../classes/FileSystemException.php';
include_once '../common.php';
header('Cache-Control: no-cache');
header('Content-Type: application/json');
list($path, $overwrite, $mtime, $content) = request_strings('path', 'overwrite', 'mtime', 'content');
try {
    $fileSystem->putFileContent($path, $content, $overwrite, $mtime);
    echo json_encode(['ok' => true, 'mtime' => $mtime]);
} catch (FileSystemException $e) {
    $e->echoClientJson();
}
예제 #4
0
<?php

include_once '../fns/request_strings.php';
include_once '../classes/FileSystemException.php';
include_once '../common.php';
list($path, $name, $content) = request_strings('path', 'name', 'content');
header('Cache-Control: no-cache');
header('Content-Type: application/json');
try {
    echo json_encode($fileSystem->searchFiles($path, $name, $content));
} catch (FileSystemException $e) {
    $e->echoClientJson();
}
예제 #5
0
<?php

include_once '../fns/build_multipart.php';
include_once '../fns/mail_multipart.php';
include_once '../fns/request_strings.php';
include_once '../fns/sys_tempnam.php';
include_once '../common.php';
header('Cache-Control: no-cache');
header('Content-Type: application/json');
list($email) = request_strings('email');
$ok = false;
if (preg_match('/^.+?@.+?\\..+?$/', $email)) {
    $tempnam = sys_tempnam('exportZip');
    $fileSystem->exportZip($tempnam);
    $zipContent = file_get_contents($tempnam);
    unlink($tempnam);
    $date = date('Y-m-d');
    $subject = "Gvirila Session {$date}";
    $from = "exported-session@{$_SERVER['SERVER_NAME']}";
    $attachmentName = "gvirila-session-{$date}.zip";
    $ok = mail_multipart($email, $subject, [build_multipart('text/html; charset=UTF-8', $subject), build_multipart('application/zip', $zipContent, $attachmentName)], "From: {$from}");
}
echo json_encode(['ok' => $ok]);
<?php

include_once '../fns/request_strings.php';
include_once '../classes/FileSystemException.php';
include_once '../common.php';
header('Cache-Control: no-cache');
header('Content-Type: application/json');
list($path, $host, $username, $password) = request_strings('path', 'host', 'username', 'password');
try {
    $fileSystem->mountFtp($path, $host, $username, $password);
    echo json_encode(['ok' => true]);
} catch (FileSystemException $e) {
    $e->echoClientJson();
}
예제 #7
0
<?php

include_once __DIR__ . '/classes/FileSystem.php';
include_once __DIR__ . '/fns/request_strings.php';
session_name('gvirila_sid');
list($gvirila_sid) = request_strings('gvirila_sid');
if ($gvirila_sid !== '') {
    session_id($gvirila_sid);
}
session_start();
unset($gvirila_sid);
if (array_key_exists('fileSystem', $_SESSION)) {
    $fileSystem = $_SESSION['fileSystem'];
} else {
    $fileSystem = $_SESSION['fileSystem'] = new FileSystem();
}
//usleep(500000);
//if (rand(1, 100) < 30) {
//    throw new Exception;
//}