aboutsummaryrefslogtreecommitdiffstats
path: root/files
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2011-09-24 18:43:02 +0200
committerFlorian Pritz <bluewind@xinu.at>2011-09-24 18:43:02 +0200
commit793e29e1245d079f89505294bef47f01c9111e8b (patch)
tree70c66381ebb5221547e881c99dc2b435e26e97e4 /files
parentf65d0e4f80eba0d24ee48f16a22d290fb1f334b3 (diff)
parent842ce24d2b17685c27eabdd2d0bb01899efdbc6f (diff)
downloadnextcloud-server-793e29e1245d079f89505294bef47f01c9111e8b.tar.gz
nextcloud-server-793e29e1245d079f89505294bef47f01c9111e8b.zip
Merge branch 'working'
Diffstat (limited to 'files')
-rw-r--r--files/admin.php4
-rw-r--r--files/ajax/newfolder.php2
-rw-r--r--files/ajax/timezone.php4
-rw-r--r--files/ajax/upload.php18
-rw-r--r--files/index.php4
-rw-r--r--files/templates/index.php18
-rw-r--r--files/templates/part.list.php2
7 files changed, 42 insertions, 10 deletions
diff --git a/files/admin.php b/files/admin.php
index 09237dfc1d5..861b6037f3c 100644
--- a/files/admin.php
+++ b/files/admin.php
@@ -32,7 +32,9 @@ if(isset($_POST['maxUploadSize'])){
$maxUploadFilesize=$_POST['maxUploadSize'];
OC_Files::setUploadLimit(OC_Helper::computerFileSize($maxUploadFilesize));
}else{
- $maxUploadFilesize = ini_get('upload_max_filesize').'B';
+ $upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
+ $post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
+ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
}
OC_App::setActiveNavigationEntry( "files_administration" );
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'];
diff --git a/files/index.php b/files/index.php
index bba8dc4951e..aa081d48804 100644
--- a/files/index.php
+++ b/files/index.php
@@ -78,7 +78,9 @@ $breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" );
$breadcrumbNav->assign( "breadcrumb", $breadcrumb );
$breadcrumbNav->assign( "baseURL", OC_Helper::linkTo("files", "index.php?dir="));
-$maxUploadFilesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
+$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
+$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
+$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
$tmpl = new OC_Template( "files", "index", "user" );
$tmpl->assign( "fileList", $list->fetchPage() );
diff --git a/files/templates/index.php b/files/templates/index.php
index 4e105811f05..e2e9dc03001 100644
--- a/files/templates/index.php
+++ b/files/templates/index.php
@@ -1,5 +1,6 @@
<div id="controls">
<?php echo($_['breadcrumb']); ?>
+ <?php if (!isset($_['readonly']) || !$_['readonly']) {?>
<div class="actions">
<form data-upload-id='1' class="file_upload_form" action="ajax/upload.php" method="post" enctype="multipart/form-data" target="file_upload_target_1">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload">
@@ -19,23 +20,30 @@
<div id="file_action_panel">
</div>
</div>
+<?php
+}
+?>
<div id='notification'></div>
-<div id="emptyfolder" <?php if(count($_['files'])) echo 'style="display:none;"';?>><?php echo $l->t('Nothing in here. Upload something!')?></div>
+<?php
+if (isset($_['files'])) {
+ if (!count($_['files'])) { ?>
+<div id="emptyfolder"><?php echo $l->t('Nothing in here. Upload something!')?></div>
+<?php }}?>
<table>
<thead>
<tr>
<th id='headerName'>
- <input type="checkbox" id="select_all" />
+ <?php if(!isset($_['readonly']) || !$_['readonly']) { ?><input type="checkbox" id="select_all" /><?php } ?>
<span class='name'><?php echo $l->t( 'Name' ); ?></span>
<span class='selectedActions'>
- <a href="" title="<?php echo $l->t('Download')?>" class="download"><img class='svg' alt="Download" src="../core/img/actions/download.svg" /></a>
- <a href="" title="Share" class="share"><img class='svg' alt="Share" src="../core/img/actions/share.svg" /></a>
+ <a href="" title="<?php echo $l->t('Download')?>" class="download"><img class='svg' alt="Download" src="<?php echo image_path("core", "actions/download.svg"); ?>" /></a>
+ <a href="" title="Share" class="share"><img class='svg' alt="Share" src="<?php echo image_path("core", "actions/share.svg"); ?>" /></a>
</span>
</th>
<th id="headerSize"><?php echo $l->t( 'Size' ); ?></th>
- <th id="headerDate"><span id="modified"><?php echo $l->t( 'Modified' ); ?></span><span class="selectedActions"><a href="" title="Delete" class="delete"><img class="svg" alt="<?php echo $l->t('Delete')?>" src="../core/img/actions/delete.svg" /></a></span></th>
+ <th id="headerDate"><span id="modified"><?php echo $l->t( 'Modified' ); ?></span><span class="selectedActions"><a href="" title="Delete" class="delete"><img class="svg" alt="<?php echo $l->t('Delete')?>" src="<?php echo image_path("core", "actions/delete.svg"); ?>" /></a></span></th>
</tr>
</thead>
<tbody id="fileList">
diff --git a/files/templates/part.list.php b/files/templates/part.list.php
index 5995976f73a..398094f56d0 100644
--- a/files/templates/part.list.php
+++ b/files/templates/part.list.php
@@ -7,7 +7,7 @@
if($relative_date_color>200) $relative_date_color = 200; ?>
<tr data-file="<?php echo $file['name'];?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mime']?>" data-size='<?php echo $file['size'];?>'>
<td class="filename svg" style="background-image:url(<?php if($file['type'] == 'dir') echo mimetype_icon('dir'); else echo mimetype_icon($file['mime']); ?>)">
- <input type="checkbox" />
+ <?php if(!isset($_['readonly']) || !$_['readonly']) { ?><input type="checkbox" /><?php } ?>
<a class="name" href="<?php if($file['type'] == 'dir') echo $_['baseURL'].$file['directory'].'/'.$file['name']; else echo $_['downloadURL'].$file['directory'].'/'.$file['name']; ?>" title="">
<span class="nametext">
<?php if($file['type'] == 'dir'):?>