aboutsummaryrefslogtreecommitdiffstats
path: root/files/ajax
diff options
context:
space:
mode:
Diffstat (limited to 'files/ajax')
-rw-r--r--files/ajax/newfolder.php2
-rw-r--r--files/ajax/timezone.php4
-rw-r--r--files/ajax/upload.php18
3 files changed, 22 insertions, 2 deletions
diff --git a/files/ajax/newfolder.php b/files/ajax/newfolder.php
index 610418583bd..8eb05280e73 100644
--- a/files/ajax/newfolder.php
+++ b/files/ajax/newfolder.php
@@ -20,7 +20,7 @@ if($foldername == '') {
echo json_encode( array( "status" => "error", "data" => array( "message" => "Empty Foldername" )));
exit();
}
-error_log('try to create ' . $foldername . ' in ' . $dir);
+if(defined("DEBUG") && DEBUG) {error_log('try to create ' . $foldername . ' in ' . $dir);}
if(OC_Files::newFile($dir, $foldername, 'dir')) {
echo json_encode( array( "status" => "success", "data" => array()));
exit();
diff --git a/files/ajax/timezone.php b/files/ajax/timezone.php
index 93d06611a0d..8e1d2aa1ec1 100644
--- a/files/ajax/timezone.php
+++ b/files/ajax/timezone.php
@@ -1,4 +1,6 @@
<?php
+ // FIXME: this should start a secure session if forcessl is enabled
+ // see lib/base.php for an example
session_start();
$_SESSION['timezone'] = $_GET['time'];
-?> \ No newline at end of file
+?>
diff --git a/files/ajax/upload.php b/files/ajax/upload.php
index c642b0ded1c..f005a8af226 100644
--- a/files/ajax/upload.php
+++ b/files/ajax/upload.php
@@ -14,6 +14,24 @@ if( !OC_User::isLoggedIn()){
exit();
}
+if (!isset($_FILES['files'])) {
+ echo json_encode( array( "status" => "error", "data" => array( "message" => "No file was uploaded. Unknown error" )));
+ exit();
+}
+foreach ($_FILES['files']['error'] as $error) {
+ if ($error != 0) {
+ $errors = array(
+ 0=>$l->t("There is no error, the file uploaded with success"),
+ 1=>$l->t("The uploaded file exceeds the upload_max_filesize directive in php.ini"),
+ 2=>$l->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"),
+ 3=>$l->t("The uploaded file was only partially uploaded"),
+ 4=>$l->t("No file was uploaded"),
+ 6=>$l->t("Missing a temporary folder")
+ );
+ echo json_encode( array( "status" => "error", "data" => array( "message" => $errors[$error] )));
+ exit();
+ }
+}
$files=$_FILES['files'];
$dir = $_POST['dir'];