From 2f11f56d323cc7a559ecc42f521083301479920e Mon Sep 17 00:00:00 2001 From: kondou Date: Thu, 18 Apr 2013 18:28:03 +0200 Subject: [PATCH] Use !== and === in files_trashbin-app --- apps/files_trashbin/ajax/delete.php | 2 +- apps/files_trashbin/ajax/undelete.php | 2 +- apps/files_trashbin/index.php | 12 +++++------ apps/files_trashbin/js/trash.js | 20 +++++++++---------- apps/files_trashbin/lib/trash.php | 4 ++-- apps/files_trashbin/templates/index.php | 2 +- .../templates/part.breadcrumb.php | 2 +- apps/files_trashbin/templates/part.list.php | 10 +++++----- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/apps/files_trashbin/ajax/delete.php b/apps/files_trashbin/ajax/delete.php index 16c39ab3853..92361b65f63 100644 --- a/apps/files_trashbin/ajax/delete.php +++ b/apps/files_trashbin/ajax/delete.php @@ -13,7 +13,7 @@ $success = array(); $i = 0; foreach ($list as $file) { - if ( $dirlisting=='0') { + if ( $dirlisting === '0') { $delimiter = strrpos($file, '.d'); $filename = substr($file, 0, $delimiter); $timestamp = substr($file, $delimiter+2); diff --git a/apps/files_trashbin/ajax/undelete.php b/apps/files_trashbin/ajax/undelete.php index 9d78f166765..e39004cc0d5 100644 --- a/apps/files_trashbin/ajax/undelete.php +++ b/apps/files_trashbin/ajax/undelete.php @@ -12,7 +12,7 @@ $success = array(); $i = 0; foreach ($list as $file) { - if ( $dirlisting=='0') { + if ( $dirlisting === '0') { $delimiter = strrpos($file, '.d'); $filename = substr($file, 0, $delimiter); $timestamp = substr($file, $delimiter+2); diff --git a/apps/files_trashbin/index.php b/apps/files_trashbin/index.php index 6f1c364737e..7cb2832c9fe 100644 --- a/apps/files_trashbin/index.php +++ b/apps/files_trashbin/index.php @@ -24,7 +24,7 @@ if ($dir) { $dirContent = $view->opendir($dir); $i = 0; while($entryName = readdir($dirContent)) { - if ( $entryName != '.' && $entryName != '..' ) { + if ( $entryName !== '.' && $entryName !== '..' ) { $pos = strpos($dir.'/', '/', 1); $tmp = substr($dir, 0, $pos); $pos = strrpos($tmp, '.d'); @@ -54,13 +54,13 @@ foreach ($result as $r) { $i['timestamp'] = $r['timestamp']; $i['mimetype'] = $r['mime']; $i['type'] = $r['type']; - if ($i['type'] == 'file') { + if ($i['type'] === 'file') { $fileinfo = pathinfo($r['id']); $i['basename'] = $fileinfo['filename']; $i['extension'] = isset($fileinfo['extension']) ? ('.'.$fileinfo['extension']) : ''; } $i['directory'] = $r['location']; - if ($i['directory'] == '/') { + if ($i['directory'] === '/') { $i['directory'] = ''; } $i['permissions'] = OCP\PERMISSION_READ; @@ -68,9 +68,9 @@ foreach ($result as $r) { } function fileCmp($a, $b) { - if ($a['type'] == 'dir' and $b['type'] != 'dir') { + if ($a['type'] === 'dir' and $b['type'] !== 'dir') { return -1; - } elseif ($a['type'] != 'dir' and $b['type'] == 'dir') { + } elseif ($a['type'] !== 'dir' and $b['type'] === 'dir') { return 1; } else { return strnatcasecmp($a['name'], $b['name']); @@ -83,7 +83,7 @@ usort($files, "fileCmp"); $pathtohere = ''; $breadcrumb = array(); foreach (explode('/', $dir) as $i) { - if ($i != '') { + if ($i !== '') { if ( preg_match('/^(.+)\.d[0-9]+$/', $i, $match) ) { $name = $match[1]; } else { diff --git a/apps/files_trashbin/js/trash.js b/apps/files_trashbin/js/trash.js index 87dfea491e7..295bc695117 100644 --- a/apps/files_trashbin/js/trash.js +++ b/apps/files_trashbin/js/trash.js @@ -15,7 +15,7 @@ $(document).ready(function() { var row = document.getElementById(result.data.success[i].filename); row.parentNode.removeChild(row); } - if (result.status != 'success') { + if (result.status !== 'success') { OC.dialogs.alert(result.data.message, t('core', 'Error')); } }); @@ -42,7 +42,7 @@ $(document).ready(function() { var row = document.getElementById(result.data.success[i].filename); row.parentNode.removeChild(row); } - if (result.status != 'success') { + if (result.status !== 'success') { OC.dialogs.alert(result.data.message, t('core', 'Error')); } }); @@ -72,7 +72,7 @@ $(document).ready(function() { var rows = $(this).parent().parent().parent().children('tr'); for (var i = start; i < end; i++) { $(rows).each(function(index) { - if (index == i) { + if (index === i) { var checkbox = $(this).children().children('input:checkbox'); $(checkbox).attr('checked', 'checked'); $(checkbox).parent().parent().addClass('selected'); @@ -111,7 +111,7 @@ $(document).ready(function() { var row = document.getElementById(result.data.success[i].filename); row.parentNode.removeChild(row); } - if (result.status != 'success') { + if (result.status !== 'success') { OC.dialogs.alert(result.data.message, t('core', 'Error')); } }); @@ -137,7 +137,7 @@ $(document).ready(function() { var row = document.getElementById(result.data.success[i].filename); row.parentNode.removeChild(row); } - if (result.status != 'success') { + if (result.status !== 'success') { OC.dialogs.alert(result.data.message, t('core', 'Error')); } }); @@ -170,9 +170,9 @@ $(document).ready(function() { function processSelection(){ var selected=getSelectedFiles(); - var selectedFiles=selected.filter(function(el){return el.type=='file'}); - var selectedFolders=selected.filter(function(el){return el.type=='dir'}); - if(selectedFiles.length==0 && selectedFolders.length==0) { + var selectedFiles=selected.filter(function(el){return el.type === 'file'}); + var selectedFolders=selected.filter(function(el){return el.type === 'dir'}); + if(selectedFiles.length === 0 && selectedFolders.length === 0) { $('#headerName>span.name').text(t('files','Name')); $('#modified').text(t('files','Deleted')); $('table').removeClass('multiselect'); @@ -182,7 +182,7 @@ function processSelection(){ $('.selectedActions').show(); var selection=''; if(selectedFolders.length>0){ - if(selectedFolders.length==1){ + if(selectedFolders.length === 1){ selection+=t('files','1 folder'); }else{ selection+=t('files','{count} folders',{count: selectedFolders.length}); @@ -192,7 +192,7 @@ function processSelection(){ } } if(selectedFiles.length>0){ - if(selectedFiles.length==1){ + if(selectedFiles.length === 1){ selection+=t('files','1 file'); }else{ selection+=t('files','{count} files',{count: selectedFiles.length}); diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index b9d900dfab4..a74d03ea4c5 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -262,14 +262,14 @@ class Trashbin { $query = \OC_DB::prepare('SELECT `location`,`type` FROM `*PREFIX*files_trash`' . ' WHERE `user`=? AND `id`=? AND `timestamp`=?'); $result = $query->execute(array($user, $filename, $timestamp))->fetchAll(); - if (count($result) != 1) { + if (count($result) !== 1) { \OC_Log::write('files_trashbin', 'trash bin database inconsistent!', \OC_Log::ERROR); return false; } // if location no longer exists, restore file in the root directory $location = $result[0]['location']; - if ($result[0]['location'] != '/' && + if ($result[0]['location'] !== '/' && (!$view->is_dir('files' . $result[0]['location']) || !$view->isUpdatable('files' . $result[0]['location']))) { $location = ''; diff --git a/apps/files_trashbin/templates/index.php b/apps/files_trashbin/templates/index.php index 66ec36df867..371765fa69a 100644 --- a/apps/files_trashbin/templates/index.php +++ b/apps/files_trashbin/templates/index.php @@ -5,7 +5,7 @@
- +
t('Nothing in here. Your trash bin is empty!'))?>
diff --git a/apps/files_trashbin/templates/part.breadcrumb.php b/apps/files_trashbin/templates/part.breadcrumb.php index 85bb16ffa2d..8ecab58e5c8 100644 --- a/apps/files_trashbin/templates/part.breadcrumb.php +++ b/apps/files_trashbin/templates/part.breadcrumb.php @@ -12,7 +12,7 @@ -
svg" +
svg" data-dir=''>
diff --git a/apps/files_trashbin/templates/part.list.php b/apps/files_trashbin/templates/part.list.php index 94a8eec9515..254b08dd36a 100644 --- a/apps/files_trashbin/templates/part.list.php +++ b/apps/files_trashbin/templates/part.list.php @@ -7,7 +7,7 @@ $name = \OCP\Util::encodePath($file['name']); $directory = \OCP\Util::encodePath($file['directory']); ?> ' @@ -22,14 +22,14 @@ data-dirlisting=0 > + style="background-image:url()" style="background-image:url()" > - + @@ -43,14 +43,14 @@ - + - + -- 2.39.5