Skip to content
Snippets Groups Projects
Commit 8aba5874 authored by Bart Visscher's avatar Bart Visscher
Browse files

Merge pull request #644 from butonic/checkstyle_fixes

fix checkstyle for files app
parents f8205968 3b83fe15
No related branches found
No related tags found
No related merge requests found
...@@ -49,7 +49,8 @@ if($_POST && OC_Util::isCallRegistered()) { ...@@ -49,7 +49,8 @@ if($_POST && OC_Util::isCallRegistered()) {
OCP\Config::setSystemValue('allowZipDownload', isset($_POST['allowZipDownload'])); OCP\Config::setSystemValue('allowZipDownload', isset($_POST['allowZipDownload']));
} }
} }
$maxZipInputSize = OCP\Util::humanFileSize(OCP\Config::getSystemValue('maxZipInputSize', OCP\Util::computerFileSize('800 MB'))); $maxZipInputSizeDefault = OCP\Util::computerFileSize('800 MB');
$maxZipInputSize = OCP\Util::humanFileSize(OCP\Config::getSystemValue('maxZipInputSize', $maxZipInputSizeDefault));
$allowZipDownload = intval(OCP\Config::getSystemValue('allowZipDownload', true)); $allowZipDownload = intval(OCP\Config::getSystemValue('allowZipDownload', true));
OCP\App::setActiveNavigationEntry( "files_administration" ); OCP\App::setActiveNavigationEntry( "files_administration" );
......
...@@ -10,22 +10,24 @@ OCP\JSON::checkLoggedIn(); ...@@ -10,22 +10,24 @@ OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck(); OCP\JSON::callCheck();
if (!isset($_FILES['files'])) { if (!isset($_FILES['files'])) {
OCP\JSON::error(array("data" => array( "message" => "No file was uploaded. Unknown error" ))); OCP\JSON::error(array('data' => array( 'message' => 'No file was uploaded. Unknown error' )));
exit(); exit();
} }
foreach ($_FILES['files']['error'] as $error) { foreach ($_FILES['files']['error'] as $error) {
if ($error != 0) { if ($error != 0) {
$l=OC_L10N::get('files'); $l=OC_L10N::get('files');
$errors = array( $errors = array(
UPLOAD_ERR_OK=>$l->t("There is no error, the file uploaded with success"), UPLOAD_ERR_OK=>$l->t('There is no error, the file uploaded with success'),
UPLOAD_ERR_INI_SIZE=>$l->t("The uploaded file exceeds the upload_max_filesize directive in php.ini").ini_get('upload_max_filesize'), UPLOAD_ERR_INI_SIZE=>$l->t('The uploaded file exceeds the upload_max_filesize directive in php.ini: ')
UPLOAD_ERR_FORM_SIZE=>$l->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"), .ini_get('upload_max_filesize'),
UPLOAD_ERR_PARTIAL=>$l->t("The uploaded file was only partially uploaded"), UPLOAD_ERR_FORM_SIZE=>$l->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified'
UPLOAD_ERR_NO_FILE=>$l->t("No file was uploaded"), .' in the HTML form'),
UPLOAD_ERR_NO_TMP_DIR=>$l->t("Missing a temporary folder"), UPLOAD_ERR_PARTIAL=>$l->t('The uploaded file was only partially uploaded'),
UPLOAD_ERR_NO_FILE=>$l->t('No file was uploaded'),
UPLOAD_ERR_NO_TMP_DIR=>$l->t('Missing a temporary folder'),
UPLOAD_ERR_CANT_WRITE=>$l->t('Failed to write to disk'), UPLOAD_ERR_CANT_WRITE=>$l->t('Failed to write to disk'),
); );
OCP\JSON::error(array("data" => array( "message" => $errors[$error] ))); OCP\JSON::error(array('data' => array( 'message' => $errors[$error] )));
exit(); exit();
} }
} }
...@@ -39,7 +41,7 @@ foreach($files['size'] as $size) { ...@@ -39,7 +41,7 @@ foreach($files['size'] as $size) {
$totalSize+=$size; $totalSize+=$size;
} }
if($totalSize>OC_Filesystem::free_space($dir)) { if($totalSize>OC_Filesystem::free_space($dir)) {
OCP\JSON::error(array("data" => array( "message" => "Not enough space available" ))); OCP\JSON::error(array('data' => array( 'message' => 'Not enough space available' )));
exit(); exit();
} }
...@@ -47,13 +49,17 @@ $result=array(); ...@@ -47,13 +49,17 @@ $result=array();
if(strpos($dir, '..') === false) { if(strpos($dir, '..') === false) {
$fileCount=count($files['name']); $fileCount=count($files['name']);
for($i=0;$i<$fileCount;$i++) { for($i=0;$i<$fileCount;$i++) {
$target = OCP\Files::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]); $target = OCP\Files::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]);
// $path needs to be normalized - this failed within drag'n'drop upload to a sub-folder // $path needs to be normalized - this failed within drag'n'drop upload to a sub-folder
$target = OC_Filesystem::normalizePath($target); $target = OC_Filesystem::normalizePath($target);
if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) { if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) {
$meta = OC_FileCache::get($target); $meta = OC_FileCache::get($target);
$id = OC_FileCache::getId($target); $id = OC_FileCache::getId($target);
$result[]=array( "status" => "success", 'mime'=>$meta['mimetype'], 'size'=>$meta['size'], 'id'=>$id, 'name'=>basename($target)); $result[]=array( 'status' => 'success',
'mime'=>$meta['mimetype'],
'size'=>$meta['size'],
'id'=>$id,
'name'=>basename($target));
} }
} }
OCP\JSON::encodedPrint($result); OCP\JSON::encodedPrint($result);
...@@ -62,4 +68,4 @@ if(strpos($dir, '..') === false) { ...@@ -62,4 +68,4 @@ if(strpos($dir, '..') === false) {
$error='invalid dir'; $error='invalid dir';
} }
OCP\JSON::error(array('data' => array('error' => $error, "file" => $fileName))); OCP\JSON::error(array('data' => array('error' => $error, 'file' => $fileName)));
...@@ -3,6 +3,10 @@ $l=OC_L10N::get('files'); ...@@ -3,6 +3,10 @@ $l=OC_L10N::get('files');
OCP\App::registerAdmin('files', 'admin'); OCP\App::registerAdmin('files', 'admin');
OCP\App::addNavigationEntry( array( "id" => "files_index", "order" => 0, "href" => OCP\Util::linkTo( "files", "index.php" ), "icon" => OCP\Util::imagePath( "core", "places/home.svg" ), "name" => $l->t("Files") )); OCP\App::addNavigationEntry( array( "id" => "files_index",
"order" => 0,
"href" => OCP\Util::linkTo( "files", "index.php" ),
"icon" => OCP\Util::imagePath( "core", "places/home.svg" ),
"name" => $l->t("Files") ));
OC_Search::registerProvider('OC_Search_Provider_File'); OC_Search::registerProvider('OC_Search_Provider_File');
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
$RUNTIME_APPTYPES=array('filesystem', 'authentication', 'logging'); $RUNTIME_APPTYPES=array('filesystem', 'authentication', 'logging');
OC_App::loadApps($RUNTIME_APPTYPES); OC_App::loadApps($RUNTIME_APPTYPES);
if(!OC_User::isLoggedIn()) { if(!OC_User::isLoggedIn()) {
if(!isset($_SERVER['PHP_AUTH_USER'])) { if(!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="ownCloud Server"'); header('WWW-Authenticate: Basic realm="ownCloud Server"');
header('HTTP/1.0 401 Unauthorized'); header('HTTP/1.0 401 Unauthorized');
echo 'Valid credentials must be supplied'; echo 'Valid credentials must be supplied';
exit(); exit();
} else { } else {
if(!OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { if(!OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) {
exit(); exit();
} }
} }
} }
list($type, $file) = explode('/', substr($path_info, 1+strlen($service)+1), 2); list($type, $file) = explode('/', substr($path_info, 1+strlen($service)+1), 2);
......
...@@ -8,5 +8,4 @@ ...@@ -8,5 +8,4 @@
$this->create('download', 'download{file}') $this->create('download', 'download{file}')
->requirements(array('file' => '.*')) ->requirements(array('file' => '.*'))
->actionInclude('files/download.php'); ->actionInclude('files/download.php');
\ No newline at end of file
...@@ -3,12 +3,15 @@ ...@@ -3,12 +3,15 @@
// fix webdav properties,add namespace in front of the property, update for OC4.5 // fix webdav properties,add namespace in front of the property, update for OC4.5
$installedVersion=OCP\Config::getAppValue('files', 'installed_version'); $installedVersion=OCP\Config::getAppValue('files', 'installed_version');
if (version_compare($installedVersion, '1.1.6', '<')) { if (version_compare($installedVersion, '1.1.6', '<')) {
$query = OC_DB::prepare( "SELECT `propertyname`, `propertypath`, `userid` FROM `*PREFIX*properties`" ); $query = OC_DB::prepare( 'SELECT `propertyname`, `propertypath`, `userid` FROM `*PREFIX*properties`' );
$result = $query->execute(); $result = $query->execute();
$updateQuery = OC_DB::prepare('UPDATE `*PREFIX*properties` SET `propertyname` = ? WHERE `userid` = ? AND `propertypath` = ?'); $updateQuery = OC_DB::prepare('UPDATE `*PREFIX*properties`'
.' SET `propertyname` = ?'
.' WHERE `userid` = ?'
.' AND `propertypath` = ?');
while( $row = $result->fetchRow()) { while( $row = $result->fetchRow()) {
if ( $row["propertyname"][0] != '{' ) { if ( $row['propertyname'][0] != '{' ) {
$updateQuery->execute(array('{DAV:}' + $row["propertyname"], $row["userid"], $row["propertypath"])); $updateQuery->execute(array('{DAV:}' + $row['propertyname'], $row['userid'], $row['propertypath']));
} }
} }
} }
...@@ -36,10 +39,11 @@ foreach($filesToRemove as $file) { ...@@ -36,10 +39,11 @@ foreach($filesToRemove as $file) {
if(!file_exists($filepath)) { if(!file_exists($filepath)) {
continue; continue;
} }
$success = OCP\Files::rmdirr($filepath); $success = OCP\Files::rmdirr($filepath);
if($success === false) { if($success === false) {
//probably not sufficient privileges, give up and give a message. //probably not sufficient privileges, give up and give a message.
OCP\Util::writeLog('files', 'Could not clean /files/ directory. Please remove everything except webdav.php from ' . OC::$SERVERROOT . '/files/', OCP\Util::ERROR); OCP\Util::writeLog('files', 'Could not clean /files/ directory.'
.' Please remove everything except webdav.php from ' . OC::$SERVERROOT . '/files/', OCP\Util::ERROR);
break; break;
} }
} }
...@@ -4,14 +4,22 @@ ...@@ -4,14 +4,22 @@
<fieldset class="personalblock"> <fieldset class="personalblock">
<legend><strong><?php echo $l->t('File handling');?></strong></legend> <legend><strong><?php echo $l->t('File handling');?></strong></legend>
<?php if($_['uploadChangable']):?> <?php if($_['uploadChangable']):?>
<label for="maxUploadSize"><?php echo $l->t( 'Maximum upload size' ); ?> </label><input name='maxUploadSize' id="maxUploadSize" value='<?php echo $_['uploadMaxFilesize'] ?>'/>(<?php echo $l->t('max. possible: '); echo $_['maxPossibleUploadSize'] ?>)<br/> <label for="maxUploadSize"><?php echo $l->t( 'Maximum upload size' ); ?> </label>
<input name='maxUploadSize' id="maxUploadSize" value='<?php echo $_['uploadMaxFilesize'] ?>'/>
(<?php echo $l->t('max. possible: '); echo $_['maxPossibleUploadSize'] ?>)<br/>
<?php endif;?> <?php endif;?>
<input type="checkbox" name="allowZipDownload" id="allowZipDownload" value="1" title="<?php echo $l->t( 'Needed for multi-file and folder downloads.' ); ?>"<?php if ($_['allowZipDownload']) echo ' checked="checked"'; ?> /> <label for="allowZipDownload"><?php echo $l->t( 'Enable ZIP-download' ); ?></label> <br/> <input type="checkbox" name="allowZipDownload" id="allowZipDownload" value="1"
title="<?php echo $l->t( 'Needed for multi-file and folder downloads.' ); ?>"
<?php if ($_['allowZipDownload']): ?> checked="checked"<?php endif; ?> />
<label for="allowZipDownload"><?php echo $l->t( 'Enable ZIP-download' ); ?></label><br/>
<input name="maxZipInputSize" id="maxZipInputSize" style="width:180px;" value='<?php echo $_['maxZipInputSize'] ?>' title="<?php echo $l->t( '0 is unlimited' ); ?>"<?php if (!$_['allowZipDownload']) echo ' disabled="disabled"'; ?> /> <input name="maxZipInputSize" id="maxZipInputSize" style="width:180px;" value='<?php echo $_['maxZipInputSize'] ?>'
<label for="maxZipInputSize"><?php echo $l->t( 'Maximum input size for ZIP files' ); ?> </label><br /> title="<?php echo $l->t( '0 is unlimited' ); ?>"
<?php if (!$_['allowZipDownload']): ?> disabled="disabled"<?php endif; ?> />
<label for="maxZipInputSize"><?php echo $l->t( 'Maximum input size for ZIP files' ); ?> </label><br />
<input type="hidden" value="<?php echo $_['requesttoken']; ?>" name="requesttoken" /> <input type="hidden" value="<?php echo $_['requesttoken']; ?>" name="requesttoken" />
<input type="submit" name="submitFilesAdminSettings" id="submitFilesAdminSettings" value="<?php echo $l->t( 'Save' ); ?>"/> <input type="submit" name="submitFilesAdminSettings" id="submitFilesAdminSettings"
value="<?php echo $l->t( 'Save' ); ?>"/>
</fieldset> </fieldset>
</form> </form>
\ No newline at end of file
...@@ -6,27 +6,42 @@ ...@@ -6,27 +6,42 @@
<div id='new' class='button'> <div id='new' class='button'>
<a><?php echo $l->t('New');?></a> <a><?php echo $l->t('New');?></a>
<ul class="popup popupTop"> <ul class="popup popupTop">
<li style="background-image:url('<?php echo OCP\mimetype_icon('text/plain') ?>')" data-type='file'><p><?php echo $l->t('Text file');?></p></li> <li style="background-image:url('<?php echo OCP\mimetype_icon('text/plain') ?>')"
<li style="background-image:url('<?php echo OCP\mimetype_icon('dir') ?>')" data-type='folder'><p><?php echo $l->t('Folder');?></p></li> data-type='file'><p><?php echo $l->t('Text file');?></p></li>
<li style="background-image:url('<?php echo OCP\image_path('core', 'actions/public.png') ?>')" data-type='web'><p><?php echo $l->t('From link');?></p></li> <li style="background-image:url('<?php echo OCP\mimetype_icon('dir') ?>')"
data-type='folder'><p><?php echo $l->t('Folder');?></p></li>
<li style="background-image:url('<?php echo OCP\image_path('core', 'actions/public.png') ?>')"
data-type='web'><p><?php echo $l->t('From link');?></p></li>
</ul> </ul>
</div> </div>
<div class="file_upload_wrapper svg"> <div class="file_upload_wrapper svg">
<form data-upload-id='1' id="data-upload-form" class="file_upload_form" action="<?php echo OCP\Util::linkTo('files', 'ajax/upload.php'); ?>" method="post" enctype="multipart/form-data" target="file_upload_target_1"> <form data-upload-id='1'
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload"> id="data-upload-form"
<!-- Send the requesttoken, this is needed for older IE versions because they don't send the CSRF token via HTTP header in this case --> class="file_upload_form"
action="<?php echo OCP\Util::linkTo('files', 'ajax/upload.php'); ?>"
method="post"
enctype="multipart/form-data"
target="file_upload_target_1">
<input type="hidden" name="MAX_FILE_SIZE" id="max_upload"
value="<?php echo $_['uploadMaxFilesize'] ?>">
<!-- Send the requesttoken, this is needed for older IE versions
because they don't send the CSRF token via HTTP header in this case -->
<input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="requesttoken"> <input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="requesttoken">
<input type="hidden" class="max_human_file_size" value="(max <?php echo $_['uploadMaxHumanFilesize']; ?>)"> <input type="hidden" class="max_human_file_size"
value="(max <?php echo $_['uploadMaxHumanFilesize']; ?>)">
<input type="hidden" name="dir" value="<?php echo $_['dir'] ?>" id="dir"> <input type="hidden" name="dir" value="<?php echo $_['dir'] ?>" id="dir">
<input class="file_upload_start" type="file" name='files[]'/> <input class="file_upload_start" type="file" name='files[]'/>
<a href="#" class="file_upload_button_wrapper" onclick="return false;" title="<?php echo $l->t('Upload'); echo ' max. '.$_['uploadMaxHumanFilesize'] ?>"></a> <a href="#" class="file_upload_button_wrapper" onclick="return false;"
title="<?php echo $l->t('Upload'); echo ' max. '.$_['uploadMaxHumanFilesize'] ?>"></a>
<button class="file_upload_filename"></button> <button class="file_upload_filename"></button>
<iframe name="file_upload_target_1" class='file_upload_target' src=""></iframe> <iframe name="file_upload_target_1" class='file_upload_target' src=""></iframe>
</form> </form>
</div> </div>
<div id="upload"> <div id="upload">
<div id="uploadprogressbar"></div> <div id="uploadprogressbar"></div>
<input type="button" class="stop" style="display:none" value="<?php echo $l->t('Cancel upload');?>" onclick="javascript:Files.cancelUploads();" /> <input type="button" class="stop" style="display:none"
value="<?php echo $l->t('Cancel upload');?>"
onclick="javascript:Files.cancelUploads();" />
</div> </div>
</div> </div>
...@@ -49,9 +64,12 @@ ...@@ -49,9 +64,12 @@
<input type="checkbox" id="select_all" /> <input type="checkbox" id="select_all" />
<span class='name'><?php echo $l->t( 'Name' ); ?></span> <span class='name'><?php echo $l->t( 'Name' ); ?></span>
<span class='selectedActions'> <span class='selectedActions'>
<!-- <a href="" class="share"><img class='svg' alt="Share" src="<?php echo OCP\image_path("core", "actions/share.svg"); ?>" /> <?php echo $l->t('Share')?></a> -->
<?php if($_['allowZipDownload']) : ?> <?php if($_['allowZipDownload']) : ?>
<a href="" class="download"><img class='svg' alt="Download" src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>" /> <?php echo $l->t('Download')?></a> <a href="" class="download">
<img class="svg" alt="Download"
src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>" />
<?php echo $l->t('Download')?>
</a>
<?php endif; ?> <?php endif; ?>
</span> </span>
</th> </th>
...@@ -61,9 +79,17 @@ ...@@ -61,9 +79,17 @@
<?php if ($_['permissions'] & OCP\PERMISSION_DELETE): ?> <?php if ($_['permissions'] & OCP\PERMISSION_DELETE): ?>
<!-- NOTE: Temporary fix to allow unsharing of files in root of Shared folder --> <!-- NOTE: Temporary fix to allow unsharing of files in root of Shared folder -->
<?php if ($_['dir'] == '/Shared'): ?> <?php if ($_['dir'] == '/Shared'): ?>
<span class="selectedActions"><a href="" class="delete"><?php echo $l->t('Unshare')?> <img class="svg" alt="<?php echo $l->t('Unshare')?>" src="<?php echo OCP\image_path("core", "actions/delete.svg"); ?>" /></a></span> <span class="selectedActions"><a href="" class="delete">
<?php echo $l->t('Unshare')?>
<img class="svg" alt="<?php echo $l->t('Unshare')?>"
src="<?php echo OCP\image_path("core", "actions/delete.svg"); ?>" />
</a></span>
<?php else: ?> <?php else: ?>
<span class="selectedActions"><a href="" class="delete"><?php echo $l->t('Delete')?> <img class="svg" alt="<?php echo $l->t('Delete')?>" src="<?php echo OCP\image_path("core", "actions/delete.svg"); ?>" /></a></span> <span class="selectedActions"><a href="" class="delete">
<?php echo $l->t('Delete')?>
<img class="svg" alt="<?php echo $l->t('Delete')?>"
src="<?php echo OCP\image_path("core", "actions/delete.svg"); ?>" />
</a></span>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
</th> </th>
...@@ -76,7 +102,7 @@ ...@@ -76,7 +102,7 @@
<div id="editor"></div> <div id="editor"></div>
<div id="uploadsize-message" title="<?php echo $l->t('Upload too large')?>"> <div id="uploadsize-message" title="<?php echo $l->t('Upload too large')?>">
<p> <p>
<?php echo $l->t('The files you are trying to upload exceed the maximum size for file uploads on this server.');?> <?php echo $l->t('The files you are trying to upload exceed the maximum size for file uploads on this server.');?>
</p> </p>
</div> </div>
<div id="scanning-message"> <div id="scanning-message">
......
<?php for($i=0; $i<count($_["breadcrumb"]); $i++): <?php for($i=0; $i<count($_["breadcrumb"]); $i++):
$crumb = $_["breadcrumb"][$i]; $crumb = $_["breadcrumb"][$i];
$dir = str_replace('+','%20', urlencode($crumb["dir"])); ?> $dir = str_replace('+', '%20', urlencode($crumb["dir"])); ?>
<div class="crumb <?php if($i == count($_["breadcrumb"])-1) echo 'last';?> svg" data-dir='<?php echo $dir;?>' style='background-image:url("<?php echo OCP\image_path('core', 'breadcrumb.png');?>")'> <div class="crumb <?php if($i == count($_["breadcrumb"])-1) echo 'last';?> svg"
data-dir='<?php echo $dir;?>'
style='background-image:url("<?php echo OCP\image_path('core', 'breadcrumb.png');?>")'>
<a href="<?php echo $_['baseURL'].$dir; ?>"><?php echo OCP\Util::sanitizeHTML($crumb["name"]); ?></a> <a href="<?php echo $_['baseURL'].$dir; ?>"><?php echo OCP\Util::sanitizeHTML($crumb["name"]); ?></a>
</div> </div>
<?php endfor;?> <?php endfor;
\ No newline at end of file
<script type="text/javascript"> <script type="text/javascript">
<?php if ( array_key_exists('publicListView', $_) && $_['publicListView'] == true ) { <?php if ( array_key_exists('publicListView', $_) && $_['publicListView'] == true ) :?>
echo "var publicListView = true;"; var publicListView = true;
} else { <?php else: ?>
echo "var publicListView = false;"; var publicListView = false;
} <?php endif; ?>
?>
</script> </script>
<?php foreach($_['files'] as $file): <?php foreach($_['files'] as $file):
$simple_file_size = OCP\simple_file_size($file['size']); $simple_file_size = OCP\simple_file_size($file['size']);
$simple_size_color = intval(200-$file['size']/(1024*1024)*2); // the bigger the file, the darker the shade of grey; megabytes*2 // the bigger the file, the darker the shade of grey; megabytes*2
$simple_size_color = intval(200-$file['size']/(1024*1024)*2);
if($simple_size_color<0) $simple_size_color = 0; if($simple_size_color<0) $simple_size_color = 0;
$relative_modified_date = OCP\relative_modified_date($file['mtime']); $relative_modified_date = OCP\relative_modified_date($file['mtime']);
$relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey; days*14 // the older the file, the brighter the shade of grey; days*14
$relative_date_color = round((time()-$file['mtime'])/60/60/24*14);
if($relative_date_color>200) $relative_date_color = 200; if($relative_date_color>200) $relative_date_color = 200;
$name = str_replace('+', '%20', urlencode($file['name'])); $name = str_replace('+', '%20', urlencode($file['name']));
$name = str_replace('%2F', '/', $name); $name = str_replace('%2F', '/', $name);
$directory = str_replace('+', '%20', urlencode($file['directory'])); $directory = str_replace('+', '%20', urlencode($file['directory']));
$directory = str_replace('%2F', '/', $directory); ?> $directory = str_replace('%2F', '/', $directory); ?>
<tr data-id="<?php echo $file['id']; ?>" data-file="<?php echo $name;?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mimetype']?>" data-size='<?php echo $file['size'];?>' data-permissions='<?php echo $file['permissions']; ?>'> <tr data-id="<?php echo $file['id']; ?>"
<td class="filename svg" style="background-image:url(<?php if($file['type'] == 'dir') echo OCP\mimetype_icon('dir'); else echo OCP\mimetype_icon($file['mimetype']); ?>)"> data-file="<?php echo $name;?>"
<?php if(!isset($_['readonly']) || !$_['readonly']) { ?><input type="checkbox" /><?php } ?> data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>"
<a class="name" href="<?php if($file['type'] == 'dir') echo $_['baseURL'].$directory.'/'.$name; else echo $_['downloadURL'].$directory.'/'.$name; ?>" title=""> data-mime="<?php echo $file['mimetype']?>"
data-size='<?php echo $file['size'];?>'
data-permissions='<?php echo $file['permissions']; ?>'>
<td class="filename svg"
<?php if($file['type'] == 'dir'): ?>
style="background-image:url(<?php echo OCP\mimetype_icon('dir'); ?>)"
<?php else: ?>
style="background-image:url(<?php echo OCP\mimetype_icon($file['mimetype']); ?>)"
<?php endif; ?>
>
<?php if(!isset($_['readonly']) || !$_['readonly']): ?><input type="checkbox" /><?php endif; ?>
<?php if($file['type'] == 'dir'): ?>
<a class="name" href="<?php $_['baseURL'].$directory.'/'.$name; ?>)" title="">
<?php else: ?>
<a class="name" href="<?php echo $_['downloadURL'].$directory.'/'.$name; ?>" title="">
<?php endif; ?>
<span class="nametext"> <span class="nametext">
<?php if($file['type'] == 'dir'):?> <?php if($file['type'] == 'dir'):?>
<?php echo htmlspecialchars($file['name']);?> <?php echo htmlspecialchars($file['name']);?>
<?php else:?> <?php else:?>
<?php echo htmlspecialchars($file['basename']);?><span class='extension'><?php echo $file['extension'];?></span> <?php echo htmlspecialchars($file['basename']);?><span
class='extension'><?php echo $file['extension'];?></span>
<?php endif;?> <?php endif;?>
</span> </span>
<?php if($file['type'] == 'dir'):?> <?php if($file['type'] == 'dir'):?>
...@@ -35,7 +52,19 @@ ...@@ -35,7 +52,19 @@
<?php endif;?> <?php endif;?>
</a> </a>
</td> </td>
<td class="filesize" title="<?php echo OCP\human_file_size($file['size']); ?>" style="color:rgb(<?php echo $simple_size_color.','.$simple_size_color.','.$simple_size_color ?>)"><?php echo $simple_file_size; ?></td> <td class="filesize"
<td class="date"><span class="modified" title="<?php echo $file['date']; ?>" style="color:rgb(<?php echo $relative_date_color.','.$relative_date_color.','.$relative_date_color ?>)"><?php echo $relative_modified_date; ?></span></td> title="<?php echo OCP\human_file_size($file['size']); ?>"
style="color:rgb(<?php echo $simple_size_color.','.$simple_size_color.','.$simple_size_color ?>)">
<?php echo $simple_file_size; ?>
</td>
<td class="date">
<span class="modified"
title="<?php echo $file['date']; ?>"
style="color:rgb(<?php echo $relative_date_color.','
.$relative_date_color.','
.$relative_date_color ?>)">
<?php echo $relative_modified_date; ?>
</span>
</td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment