From d46288b0abea28a4e0184f6720e990a05d5f19a9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 23 Oct 2011 11:40:40 +0200 Subject: [PATCH 01/36] 'New' button, needs some css work --- core/css/styles.css | 4 +- core/js/js.js | 2 +- files/ajax/newfile.php | 27 ++++++++++++ files/css/files.css | 13 ++++-- files/js/files.js | 93 +++++++++++++++++++++++++++++---------- files/templates/index.php | 33 ++++++++------ 6 files changed, 129 insertions(+), 43 deletions(-) create mode 100644 files/ajax/newfile.php diff --git a/core/css/styles.css b/core/css/styles.css index ea09a1f363..7d5ff185d4 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -32,12 +32,12 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#35537a', end /* INPUTS */ input[type="text"], input[type="password"] { cursor:text; } -input, select, .button, #quota, div.jp-progress, .pager li a { font-size:1em; width:10em; margin:.3em; padding:.6em .5em .4em; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; } +input, select, button, .button, #quota, div.jp-progress, .pager li a { font-size:1em; width:10em; margin:.3em; padding:.6em .5em .4em; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; } input[type="text"], input[type="password"], input[type="search"] { background:#f8f8f8; color:#555; cursor:text; } input[type="text"], input[type="password"], input[type="search"] { -webkit-appearance:textfield; -webkit-box-sizing:content-box; } input[type="text"]:hover, input[type="text"]:focus, input[type="password"]:hover, input[type="password"]:focus, input[type="search"]:hover, input[type="search"]:focus { background:#fff; color:#333; } -input[type="submit"], input[type="button"], .button, #quota, div.jp-progress, .pager li a { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; } +input[type="submit"], input[type="button"], button, .button, #quota, div.jp-progress, .pager li a { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; } input[type="submit"]:hover, input[type="submit"]:focus, input[type="button"]:hover, input[type="button"]:focus, .button:hover { background:#fff; color:#333; } input[type="checkbox"] { width:auto; } #quota { cursor:default; } diff --git a/core/js/js.js b/core/js/js.js index 9e814ca072..8cfb58982a 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -365,7 +365,7 @@ $(document).ready(function(){ $('.jp-controls .jp-previous').tipsy({gravity:'nw', fade:true, live:true}); $('.jp-controls .jp-next').tipsy({gravity:'n', fade:true, live:true}); $('.password .action').tipsy({gravity:'se', fade:true, live:true}); - $('.file_upload_button_wrapper').tipsy({gravity:'e', fade:true}); + $('.file_upload_button_wrapper').tipsy({gravity:'w', fade:true}); $('.selectedActions a.delete').tipsy({gravity: 'se', fade:true, live:true}); $('.selectedActions a').tipsy({gravity:'s', fade:true, live:true}); $('#headerSize').tipsy({gravity:'s', fade:true, live:true}); diff --git a/files/ajax/newfile.php b/files/ajax/newfile.php new file mode 100644 index 0000000000..5c4f49a367 --- /dev/null +++ b/files/ajax/newfile.php @@ -0,0 +1,27 @@ + array( "message" => "Empty Filename" ))); + exit(); +} + +if(OC_Files::newFile($dir, $filename, 'file')) { + if($content){ + OC_Filesystem::file_put_contents($dir.'/'.$filename,$content); + } + OC_JSON::success(array("data" => array('content'=>$content))); + exit(); +} + + +OC_JSON::error(array("data" => array( "message" => "Error when creating the file" ))); \ No newline at end of file diff --git a/files/css/files.css b/files/css/files.css index ac1f523f86..c6f7621515 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -7,11 +7,17 @@ .actions input { margin:0; } #file_menu { right:0; position:absolute; top:0; } #file_menu a { display:block; float:left; background-image:none; text-decoration:none; } -.file_upload_form, #file_newfolder_form { display:inline; float: left; margin-left:.5em; } +.file_upload_form, #file_newfolder_form { display:inline; float: left; margin-left:0; } #fileSelector, #file_upload_submit, #file_newfolder_submit { display:none; } .file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .5em; padding-left:2em; } -.file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:.1em .1em .1em 0em;} +.file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:0;} .file_upload_wrapper .file_upload_button_wrapper { position:absolute; top:0; left:0; width:100%; height:100%; cursor:pointer; z-index:1000; } +#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin-top:-0.075em; margin-right:0; border-right:none } +#new.active { border-bottom-left-radius:0; border-bottom:none; } +#new>a{ padding-left:1em; padding-right:1em; } +#new>ul { display:none; position:fixed; text-align:left; padding:0.5em; background:#f8f8f8; margin-top:0.4em; border:1px solid #ddd; min-width:7em; margin-left:-0.5em; } +#new>ul>li { margin:0.3em; padding-left:1.3em; background-repeat:no-repeat; cursor:pointer; } +#new>ul>li>p { cursor:pointer; } #file_newfolder_name { background-image:url('../../core/img/places/folder.svg'); font-weight:normal; width:7em; } .file_upload_start, .file_upload_filename { font-size:1em; } @@ -19,7 +25,8 @@ .file_upload_target { display:none; } .file_upload_start { opacity:0; filter:alpha(opacity=0); z-index:1; position:absolute; left:0; top:0; width:100%; cursor:pointer;} -.file_upload_filename { z-index:100; cursor:pointer;} +input.file_upload_filename.active { border-bottom-right-radius:0 } +input.file_upload_filename { z-index:100; cursor:pointer; border-top-left-radius:0; border-bottom-left-radius:0; } .file_upload_form, .file_upload_wrapper, .file_upload_start, .file_upload_filename, #file_upload_submit { cursor:pointer; } diff --git a/files/js/files.js b/files/js/files.js index 902c5e5493..db3f3135b9 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -255,32 +255,77 @@ $(document).ready(function() { text=text.substr(0,text.length-6)+'...'; crumb.text(text); } + + $(window).click(function(){ + $('#new>ul').hide(); + $('#new').removeClass('active'); + $('input.file_upload_filename').removeClass('active'); + $('#new li').each(function(i,element){ + if($(element).children('p').length==0){ + $(element).children('input').remove(); + $(element).append('

'+$(element).data('text')+'

'); + } + }); + }); + $('#new').click(function(event){ + event.stopPropagation(); + }); + $('#new>a').click(function(){ + $('#new>ul').toggle(); + $('#new').toggleClass('active'); + $('input.file_upload_filename').toggleClass('active'); + }); + $('#new li').click(function(){ + if($(this).children('p').length==0){ + return; + } + + $('#new li').each(function(i,element){ + if($(element).children('p').length==0){ + $(element).children('input').remove(); + $(element).append('

'+$(element).data('text')+'

'); + } + }); + + var type=$(this).data('type'); + var text=$(this).children('p').text(); + $(this).data('text',text); + $(this).children('p').remove(); + var input=$(''); + $(this).append(input); + input.focus(); + input.change(function(){ + var name=$(this).val(); + switch(type){ + case 'file': + $.ajax({ + url: OC.filePath('files','ajax','newfile.php'), + data: "dir="+encodeURIComponent($('#dir').val())+"&filename="+encodeURIComponent(name)+'&content=%20%0A', + complete: function(data){boolOperationFinished(data, function(){ + var date=new Date(); + FileList.addFile(name,0,date); + });} + }); + break; + case 'folder': + $.ajax({ + url: OC.filePath('files','ajax','newfolder.php'), + data: "dir="+encodeURIComponent($('#dir').val())+"&foldername="+encodeURIComponent(name), + complete: function(data){boolOperationFinished(data, function(){ + var date=new Date(); + FileList.addDir(name,0,date); + });} + }); + break; + } + var li=$(this).parent(); + $(this).remove(); + li.append('

'+li.data('text')+'

'); + $('#new>a').click(); + }); + }); }); -var adjustNewFolderSize = function() { - if($('#file_newfolder_name').val() != '') { - splitSize($('#file_newfolder_name'),$('#file_newfolder_submit')); - $('#file_newfolder_name').unbind('keyup', adjustNewFolderSize); - }; -} - -function splitSize(existingEl, appearingEl) { - nw = parseInt($(existingEl).css('width')) - parseInt($(appearingEl).css('width')); - $(existingEl).css('width', nw + 'px'); - $(appearingEl).fadeIn(250); -} - -function unsplitSize(stayingEl, vanishingEl) { - nw = parseInt($(stayingEl).css('width')) + parseInt($(vanishingEl).css('width')); - $(stayingEl).css('width', nw + 'px'); - $(vanishingEl).fadeOut(250); -} - -function resetFileActionPanel() { - $('#file_action_panel form').css({"display":"none"}); - $('#file_action_panel').attr('activeAction', false); -} - function boolOperationFinished(data, callback) { result = jQuery.parseJSON(data.responseText); if(result.status == 'success'){ diff --git a/files/templates/index.php b/files/templates/index.php index a63f6e62b6..902c5cfa14 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -2,20 +2,27 @@
-
- - - -
- + +
+ + + + + - -
- - -
- -
+ + + +
From 0c890a501cc7c24fb7eb5a4e4bff35dd2bb56b6d Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sun, 23 Oct 2011 21:51:56 +0200 Subject: [PATCH 02/36] upgraded the new new button. Didn't and doesn't work in Firefox though --- core/img/actions/upload.png | Bin 0 -> 236 bytes core/img/actions/upload.svg | 73 ++++++++++++++++++++++++++++++++++++ files/css/files.css | 13 ++++--- files/templates/index.php | 10 ++--- 4 files changed, 85 insertions(+), 11 deletions(-) create mode 100644 core/img/actions/upload.png create mode 100644 core/img/actions/upload.svg diff --git a/core/img/actions/upload.png b/core/img/actions/upload.png new file mode 100644 index 0000000000000000000000000000000000000000..5744aad75a8c64eb1494deaadfd6db17c529c479 GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR45I`QM^Y;f!YU6CD!xpX6Qg{BI Zn_r^NbZGurmvEq^44$rjF6*2UngGdGQ$hd$ literal 0 HcmV?d00001 diff --git a/core/img/actions/upload.svg b/core/img/actions/upload.svg new file mode 100644 index 0000000000..91333bb681 --- /dev/null +++ b/core/img/actions/upload.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/files/css/files.css b/files/css/files.css index c6f7621515..0f0a3a6c58 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -4,7 +4,7 @@ /* FILE MENU */ .actions { padding:.3em; float:left; } -.actions input { margin:0; } +.actions input, .actions button { margin:0; } #file_menu { right:0; position:absolute; top:0; } #file_menu a { display:block; float:left; background-image:none; text-decoration:none; } .file_upload_form, #file_newfolder_form { display:inline; float: left; margin-left:0; } @@ -12,11 +12,11 @@ .file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .5em; padding-left:2em; } .file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:0;} .file_upload_wrapper .file_upload_button_wrapper { position:absolute; top:0; left:0; width:100%; height:100%; cursor:pointer; z-index:1000; } -#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin-top:-0.075em; margin-right:0; border-right:none } +#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin:-.075em 0 0 1em; border-right:none; z-index:1010; } #new.active { border-bottom-left-radius:0; border-bottom:none; } #new>a{ padding-left:1em; padding-right:1em; } -#new>ul { display:none; position:fixed; text-align:left; padding:0.5em; background:#f8f8f8; margin-top:0.4em; border:1px solid #ddd; min-width:7em; margin-left:-0.5em; } -#new>ul>li { margin:0.3em; padding-left:1.3em; background-repeat:no-repeat; cursor:pointer; } +#new>ul { display:none; position:fixed; text-align:left; padding:.5em; background:#f8f8f8; margin-top:.4em; border:1px solid #ddd; min-width:7em; margin-left:-.5em; z-index:-1; } +#new>ul>li { margin:.3em; padding-left:2em; background-repeat:no-repeat; cursor:pointer; } #new>ul>li>p { cursor:pointer; } #file_newfolder_name { background-image:url('../../core/img/places/folder.svg'); font-weight:normal; width:7em; } @@ -25,8 +25,9 @@ .file_upload_target { display:none; } .file_upload_start { opacity:0; filter:alpha(opacity=0); z-index:1; position:absolute; left:0; top:0; width:100%; cursor:pointer;} -input.file_upload_filename.active { border-bottom-right-radius:0 } -input.file_upload_filename { z-index:100; cursor:pointer; border-top-left-radius:0; border-bottom-left-radius:0; } +.file_upload_filename.active { border-bottom-right-radius:0 } +.file_upload_filename { z-index:100; cursor:pointer; border-top-left-radius:0; border-bottom-left-radius:0; padding:.3em; } + .file_upload_form, .file_upload_wrapper, .file_upload_start, .file_upload_filename, #file_upload_submit { cursor:pointer; } diff --git a/files/templates/index.php b/files/templates/index.php index 902c5cfa14..cb1ab68808 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -7,9 +7,9 @@ t('New');?>
@@ -17,9 +17,9 @@ - + - +
From 715e376cd2cc6bb2a65be0720c6c1fff0acaa5b9 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Tue, 25 Oct 2011 20:01:40 +0200 Subject: [PATCH 03/36] Fix setproperty form --- .../templates/part.setpropertyform.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php index afdba2bd75..eb8a67a8aa 100644 --- a/apps/contacts/templates/part.setpropertyform.php +++ b/apps/contacts/templates/part.setpropertyform.php @@ -7,40 +7,40 @@
  1. - +
  2. - +
  3. - +
  4. - +
  5. - +
  6. - +
  7. - +
-

+

- +

From c0e9c805eceb24d25a57806684d9b5e3e5795e43 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 27 Oct 2011 22:46:52 +0200 Subject: [PATCH 04/36] Disable loading non-existing settings script in bookmark app --- apps/bookmarks/settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/bookmarks/settings.php b/apps/bookmarks/settings.php index 8186472dec..0ace04fa2c 100644 --- a/apps/bookmarks/settings.php +++ b/apps/bookmarks/settings.php @@ -8,6 +8,6 @@ $tmpl = new OC_Template( 'bookmarks', 'settings'); -OC_Util::addScript('bookmarks','settings'); +//OC_Util::addScript('bookmarks','settings'); return $tmpl->fetchPage(); From 6d4d15b221443e0cfb375f9870e34e825cc79c37 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 27 Oct 2011 22:47:56 +0200 Subject: [PATCH 05/36] Fix html id's in part.addcardform.php --- apps/contacts/templates/part.addcardform.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php index 8e482cc4eb..a596ad8163 100644 --- a/apps/contacts/templates/part.addcardform.php +++ b/apps/contacts/templates/part.addcardform.php @@ -19,7 +19,7 @@
  1. -
    +
  2. @@ -81,19 +81,19 @@
  3. - +
  4. - +
  5. - +
  6. - +
  7. From 7b01858c570f5d9d70946b257b66ecca144e2fbd Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 27 Oct 2011 22:48:50 +0200 Subject: [PATCH 06/36] Enable php display_errors setting --- lib/base.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/base.php b/lib/base.php index d5fff1e0a7..c52b4493e0 100644 --- a/lib/base.php +++ b/lib/base.php @@ -77,6 +77,9 @@ class OC{ // set some stuff //ob_start(); error_reporting(E_ALL | E_STRICT); + if (defined('DEBUG') && DEBUG){ + ini_set('display_errors', 1); + } date_default_timezone_set('Europe/Berlin'); ini_set('arg_separator.output','&'); From a809fe9a048d53c23bb962da5f1b133f4aac82b8 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sat, 29 Oct 2011 00:27:25 +0200 Subject: [PATCH 07/36] Add a dependencies check apps --- apps/dependencies_chk/appinfo/app.php | 9 ++ apps/dependencies_chk/appinfo/info.xml | 11 +++ apps/dependencies_chk/css/style.css | 9 ++ apps/dependencies_chk/settings.php | 91 ++++++++++++++++++++ apps/dependencies_chk/templates/settings.php | 16 ++++ 5 files changed, 136 insertions(+) create mode 100644 apps/dependencies_chk/appinfo/app.php create mode 100644 apps/dependencies_chk/appinfo/info.xml create mode 100644 apps/dependencies_chk/css/style.css create mode 100644 apps/dependencies_chk/settings.php create mode 100644 apps/dependencies_chk/templates/settings.php diff --git a/apps/dependencies_chk/appinfo/app.php b/apps/dependencies_chk/appinfo/app.php new file mode 100644 index 0000000000..dea2cd39f8 --- /dev/null +++ b/apps/dependencies_chk/appinfo/app.php @@ -0,0 +1,9 @@ + 14, + 'id' => 'dependencies_chk', + 'name' => 'Owncloud Install Info' )); + +OC_APP::registerAdmin('dependencies_chk','settings'); diff --git a/apps/dependencies_chk/appinfo/info.xml b/apps/dependencies_chk/appinfo/info.xml new file mode 100644 index 0000000000..38a6dee256 --- /dev/null +++ b/apps/dependencies_chk/appinfo/info.xml @@ -0,0 +1,11 @@ + + + dependencies_chk + Owncloud dependencies info + 0.01 + MIT + Brice Maron (eMerzh) + 2 + Display OwnCloud's dependencies informations (missings modules, ...) + + diff --git a/apps/dependencies_chk/css/style.css b/apps/dependencies_chk/css/style.css new file mode 100644 index 0000000000..30f204be7b --- /dev/null +++ b/apps/dependencies_chk/css/style.css @@ -0,0 +1,9 @@ +#status_list legend { font-weight: bold; color: #888888; } +.state > li { margin-bottom: 3px; padding-left: 0.5em; list-style-type: circle; } +.state .state_module { font-weight:bold; text-shadow: 0 1px 0 #DDD; cursor:help;} + +.state_used ul, .state_used li { display:inline; } + +.state_ok .state_module { color: #009700; } +.state_warning .state_module { color: #FF9B29; } +.state_error .state_module { color: #FF3B3B; } diff --git a/apps/dependencies_chk/settings.php b/apps/dependencies_chk/settings.php new file mode 100644 index 0000000000..ca60953215 --- /dev/null +++ b/apps/dependencies_chk/settings.php @@ -0,0 +1,91 @@ +. + * + */ +$l=new OC_L10N('dependencies_chk'); +$tmpl = new OC_Template( 'dependencies_chk', 'settings'); + +$modules = array(); + +//Possible status are : ok, error, warning +$modules[] =array( + 'status' => function_exists('json_encode') ? 'ok' : 'error', + 'part'=> 'php-json', + 'modules'=> array('core'), + 'message'=> $l->t('The php-json module is needed by the many application for inter communications')); + +$modules[] =array( + 'status' => function_exists('curl_init') ? 'ok' : 'error', + 'part'=> 'php-curl', + 'modules'=> array('bookmarks'), + 'message'=> $l->t('The php-curl modude is needed to fetch the page title when adding a bookmarks')); + +$modules[] =array( + 'status' => function_exists('imagepng') ? 'ok' : 'error', + 'part'=> 'php-gd', + 'modules'=> array('gallery'), + 'message'=> $l->t('The php-gd module is needed to create thumbnails of your images')); + +$modules[] =array( + 'status' => OC_Helper::canExecute("mp3info") ? 'ok' : 'warning', + 'part'=> 'mp3info', + 'modules'=> array('media'), + 'message'=> $l->t('The program mp3info is useful to discover ID3 tags of your music files')); + +$modules[] =array( + 'status' => OC_Helper::canExecute("ldap_bind") ? 'ok' : 'error', + 'part'=> 'php-ldap', + 'modules'=> array('user_ldap'), + 'message'=> $l->t('The php-ldap module is needed connect to your ldap server')); + +$modules[] =array( + 'status' => class_exists('ZipArchive') ? 'ok' : 'warning', + 'part'=> 'php-zip', + 'modules'=> array('admin_export','core'), + 'message'=> $l->t('The php-zip module is needed download multiple files at once')); + +$modules[] =array( + 'status' => function_exists('mb_detect_encoding') ? 'ok' : 'error', + 'part'=> 'php-mb_multibyte ', + 'modules'=> array('core'), + 'message'=> $l->t('The php-mb_multibyte module is needed to manage correctly the encoding.')); + +$modules[] =array( + 'status' => function_exists('ctype_digit') ? 'ok' : 'error', + 'part'=> 'php-ctype', + 'modules'=> array('core'), + 'message'=> $l->t('The php-ctype module is needed validate data.')); + + +foreach($modules as $key => $module) { + $enabled = false ; + foreach($module['modules'] as $app) { + if(OC_App::isEnabled($app) || $app=='core'){ + $enabled = true; + } + } + if($enabled == false) unset($modules[$key]); +} + +OC_UTIL::addStyle('dependencies_chk', 'style'); +$tmpl->assign( 'items', $modules ); + +return $tmpl->fetchPage(); diff --git a/apps/dependencies_chk/templates/settings.php b/apps/dependencies_chk/templates/settings.php new file mode 100644 index 0000000000..8ff27ebb18 --- /dev/null +++ b/apps/dependencies_chk/templates/settings.php @@ -0,0 +1,16 @@ +
    + t('Dependencies status');?> +
      + +
    • + +
      t('Used by :');?> +
        + +
      • + +
      +
    • + +
    +
    \ No newline at end of file From 5ffec927012a98cdcc409318dd1b2a264f071b83 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 29 Oct 2011 00:49:52 +0200 Subject: [PATCH 08/36] upgrade to Sabredav 1.5.4 --- 3rdparty/Sabre.includes.php | 2 +- 3rdparty/Sabre/CardDAV/AddressBook.php | 10 ++--- 3rdparty/Sabre/CardDAV/Backend/Abstract.php | 14 +++--- 3rdparty/Sabre/CardDAV/Backend/PDO.php | 6 +-- 3rdparty/Sabre/CardDAV/Card.php | 8 +--- 3rdparty/Sabre/CardDAV/ICard.php | 10 ++--- 3rdparty/Sabre/CardDAV/Plugin.php | 9 ++-- 3rdparty/Sabre/CardDAV/UserAddressBooks.php | 8 ++-- 3rdparty/Sabre/CardDAV/Version.php | 6 +-- .../Sabre/DAV/Browser/GuessContentType.php | 2 +- 3rdparty/Sabre/DAV/Server.php | 2 +- 3rdparty/Sabre/DAV/Version.php | 2 +- .../Sabre/DAVACL/Exception/NeedPrivileges.php | 10 ++--- 3rdparty/Sabre/DAVACL/PrincipalCollection.php | 2 +- 3rdparty/Sabre/VObject/Component.php | 13 ++++-- 3rdparty/Sabre/VObject/Element/DateTime.php | 43 +++++++++++++++---- .../Sabre/VObject/Element/MultiDateTime.php | 6 +-- 3rdparty/Sabre/VObject/Node.php | 7 +++ 3rdparty/Sabre/VObject/Property.php | 13 ++++-- 3rdparty/Sabre/VObject/Reader.php | 6 ++- 3rdparty/Sabre/VObject/Version.php | 2 +- 21 files changed, 103 insertions(+), 78 deletions(-) diff --git a/3rdparty/Sabre.includes.php b/3rdparty/Sabre.includes.php index 9d389288c7..d41b287b77 100644 --- a/3rdparty/Sabre.includes.php +++ b/3rdparty/Sabre.includes.php @@ -71,6 +71,7 @@ include 'Sabre/DAV/IExtendedCollection.php'; /* Node abstract implementations */ include 'Sabre/DAV/Node.php'; include 'Sabre/DAV/File.php'; +include 'Sabre/DAV/Collection.php'; include 'Sabre/DAV/Directory.php'; /* Utilities */ @@ -124,4 +125,3 @@ include 'Sabre/DAV/Auth/Backend/PDO.php'; /* DavMount plugin */ include 'Sabre/DAV/Mount/Plugin.php'; - diff --git a/3rdparty/Sabre/CardDAV/AddressBook.php b/3rdparty/Sabre/CardDAV/AddressBook.php index 3333480ea8..471ca7b338 100644 --- a/3rdparty/Sabre/CardDAV/AddressBook.php +++ b/3rdparty/Sabre/CardDAV/AddressBook.php @@ -1,7 +1,9 @@ extensionMap[$extension])) return $this->extensionMap[$extension]; diff --git a/3rdparty/Sabre/DAV/Server.php b/3rdparty/Sabre/DAV/Server.php index b99866dad5..3d76d4f191 100644 --- a/3rdparty/Sabre/DAV/Server.php +++ b/3rdparty/Sabre/DAV/Server.php @@ -821,7 +821,7 @@ class Sabre_DAV_Server { $node->put($body); $this->httpResponse->setHeader('Content-Length','0'); - $this->httpResponse->sendStatus(200); + $this->httpResponse->sendStatus(204); } else { diff --git a/3rdparty/Sabre/DAV/Version.php b/3rdparty/Sabre/DAV/Version.php index e7f7f83e6f..6bece1985e 100644 --- a/3rdparty/Sabre/DAV/Version.php +++ b/3rdparty/Sabre/DAV/Version.php @@ -14,7 +14,7 @@ class Sabre_DAV_Version { /** * Full version number */ - const VERSION = '1.5.3'; + const VERSION = '1.5.4'; /** * Stability : alpha, beta, stable diff --git a/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php b/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php index 640ab8efff..024ab6641f 100644 --- a/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php +++ b/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php @@ -2,6 +2,9 @@ /** * NeedPrivileges + * + * The 403-need privileges is thrown when a user didn't have the appropriate + * permissions to perform an operation * * @package Sabre * @subpackage DAVACL @@ -10,13 +13,6 @@ * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License */ - -/** - * NeedPrivileges - * - * The 403-need privileges is thrown when a user didn't have the appropriate - * permissions to perform an operation - */ class Sabre_DAVACL_Exception_NeedPrivileges extends Sabre_DAV_Exception_Forbidden { /** diff --git a/3rdparty/Sabre/DAVACL/PrincipalCollection.php b/3rdparty/Sabre/DAVACL/PrincipalCollection.php index 3cc0ae8462..4d22bf8aa7 100644 --- a/3rdparty/Sabre/DAVACL/PrincipalCollection.php +++ b/3rdparty/Sabre/DAVACL/PrincipalCollection.php @@ -9,7 +9,7 @@ * The users are instances of Sabre_DAV_Auth_Principal * * @package Sabre - * @subpackage DAV + * @subpackage DAVACL * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved. * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License diff --git a/3rdparty/Sabre/VObject/Component.php b/3rdparty/Sabre/VObject/Component.php index 3d5a3d7563..47cf9f3d81 100644 --- a/3rdparty/Sabre/VObject/Component.php +++ b/3rdparty/Sabre/VObject/Component.php @@ -83,13 +83,16 @@ class Sabre_VObject_Component extends Sabre_VObject_Element { if (!is_null($itemValue)) { throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject'); } + $item->parent = $this; $this->children[] = $item; } elseif(is_string($item)) { if (!is_scalar($itemValue)) { throw new InvalidArgumentException('The second argument must be scalar'); } - $this->children[] = new Sabre_VObject_Property($item,$itemValue); + $item = new Sabre_VObject_Property($item,$itemValue); + $item->parent = $this; + $this->children[] = $item; } else { @@ -208,16 +211,19 @@ class Sabre_VObject_Component extends Sabre_VObject_Element { $overWrite = count($matches)?key($matches):null; if ($value instanceof Sabre_VObject_Component || $value instanceof Sabre_VObject_Property) { + $value->parent = $this; if (!is_null($overWrite)) { $this->children[$overWrite] = $value; } else { $this->children[] = $value; } } elseif (is_scalar($value)) { + $property = new Sabre_VObject_Property($name,$value); + $property->parent = $this; if (!is_null($overWrite)) { - $this->children[$overWrite] = new Sabre_VObject_Property($name,$value); + $this->children[$overWrite] = $property; } else { - $this->children[] = new Sabre_VObject_Property($name,$value); + $this->children[] = $property; } } else { throw new InvalidArgumentException('You must pass a Sabre_VObject_Component, Sabre_VObject_Property or scalar type'); @@ -237,6 +243,7 @@ class Sabre_VObject_Component extends Sabre_VObject_Element { foreach($matches as $k=>$child) { unset($this->children[$k]); + $child->parent = null; } diff --git a/3rdparty/Sabre/VObject/Element/DateTime.php b/3rdparty/Sabre/VObject/Element/DateTime.php index 30e5c6ca86..3350ec02c8 100644 --- a/3rdparty/Sabre/VObject/Element/DateTime.php +++ b/3rdparty/Sabre/VObject/Element/DateTime.php @@ -70,7 +70,7 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property { $this->setValue($dt->format('Ymd\\THis')); $this->offsetUnset('VALUE'); $this->offsetUnset('TZID'); - $this->offsetSet('VALUE','DATE-TIME'); + $this->offsetSet('VALUE','DATE-TIME'); break; case self::UTC : $dt->setTimeZone(new DateTimeZone('UTC')); @@ -116,7 +116,7 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property { list( $this->dateType, $this->dateTime - ) = self::parseData($this->value, $this->offsetGet('TZID')); + ) = self::parseData($this->value, $this); return $this->dateTime; } @@ -137,7 +137,7 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property { list( $this->dateType, $this->dateTime, - ) = self::parseData($this->value, $this->offsetGet('TZID')); + ) = self::parseData($this->value, $this); return $this->dateType; } @@ -151,12 +151,12 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property { * 2. A DateTime object (or null) * * @param string|null $propertyValue The string to parse (yymmdd or - * ymmddThhmmss, etc..) - * @param string|null $tzid The value of the 'TZID' property. + * ymmddThhmmss, etc..) + * @param Sabre_VObject_Property|null $property The instance of the + * property we're parsing. * @return array */ - static public function parseData($propertyValue, $tzid) { - + static public function parseData($propertyValue, Sabre_VObject_Property $property = null) { if (is_null($propertyValue)) { return array(null, null); @@ -195,6 +195,8 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property { ); } + // Finding the timezone. + $tzid = $property['TZID']; if (!$tzid) { return array( self::LOCAL, @@ -202,7 +204,32 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property { ); } - $tz = new DateTimeZone($tzid->value); + try { + $tz = new DateTimeZone($tzid->value); + } catch (Exception $e) { + + // The id was invalid, we're going to try to find the information + // through the VTIMEZONE object. + + // First we find the root object + $root = $property; + while($root->parent) { + $root = $root->parent; + } + + if (isset($root->VTIMEZONE)) { + foreach($root->VTIMEZONE as $vtimezone) { + if (((string)$vtimezone->TZID) == $tzid) { + if (isset($vtimezone->{'X-LIC-LOCATION'})) { + $tzid = (string)$vtimezone->{'X-LIC-LOCATION'}; + } + } + } + } + + $tz = new DateTimeZone($tzid); + + } $dt = new DateTime($dateStr, $tz); $dt->setTimeZone($tz); diff --git a/3rdparty/Sabre/VObject/Element/MultiDateTime.php b/3rdparty/Sabre/VObject/Element/MultiDateTime.php index 5e677f5e5b..dc6ca5abb8 100644 --- a/3rdparty/Sabre/VObject/Element/MultiDateTime.php +++ b/3rdparty/Sabre/VObject/Element/MultiDateTime.php @@ -60,7 +60,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property { $val[] = $i->format('Ymd\\THis'); } $this->setValue(implode(',',$val)); - $this->offsetSet('VALUE','DATE-TIME'); + $this->offsetSet('VALUE','DATE-TIME'); break; case Sabre_VObject_Element_DateTime::UTC : $val = array(); @@ -121,7 +121,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property { list( $type, $dt - ) = Sabre_VObject_Element_DateTime::parseData($val, $this->offsetGet('TZID')); + ) = Sabre_VObject_Element_DateTime::parseData($val, $this); $dts[] = $dt; $this->dateType = $type; } @@ -154,7 +154,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property { list( $type, $dt - ) = Sabre_VObject_Element_DateTime::parseData($val, $this->offsetGet('TZID')); + ) = Sabre_VObject_Element_DateTime::parseData($val, $this); $dts[] = $dt; $this->dateType = $type; } diff --git a/3rdparty/Sabre/VObject/Node.php b/3rdparty/Sabre/VObject/Node.php index efc7f76da7..7100b62f1c 100644 --- a/3rdparty/Sabre/VObject/Node.php +++ b/3rdparty/Sabre/VObject/Node.php @@ -25,6 +25,13 @@ abstract class Sabre_VObject_Node implements IteratorAggregate, ArrayAccess, Cou */ protected $iterator = null; + /** + * A link to the parent node + * + * @var Sabre_VObject_Node + */ + protected $parent = null; + /* {{{ IteratorAggregator interface */ /** diff --git a/3rdparty/Sabre/VObject/Property.php b/3rdparty/Sabre/VObject/Property.php index 624dd4b8a5..0605822904 100644 --- a/3rdparty/Sabre/VObject/Property.php +++ b/3rdparty/Sabre/VObject/Property.php @@ -149,13 +149,16 @@ class Sabre_VObject_Property extends Sabre_VObject_Element { if (!is_null($itemValue)) { throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject'); } + $item->parent = $this; $this->parameters[] = $item; } elseif(is_string($item)) { if (!is_scalar($itemValue)) { throw new InvalidArgumentException('The second argument must be scalar'); } - $this->parameters[] = new Sabre_VObject_Parameter($item,$itemValue); + $parameter = new Sabre_VObject_Parameter($item,$itemValue); + $parameter->parent = $this; + $this->parameters[] = $parameter; } else { @@ -231,12 +234,15 @@ class Sabre_VObject_Property extends Sabre_VObject_Element { throw new InvalidArgumentException('A parameter name must be specified. This means you cannot use the $array[]="string" to add parameters.'); $this->offsetUnset($name); - $this->parameters[] = new Sabre_VObject_Parameter($name, $value); + $parameter = new Sabre_VObject_Parameter($name, $value); + $parameter->parent = $this; + $this->parameters[] = $parameter; } elseif ($value instanceof Sabre_VObject_Parameter) { if (!is_null($name)) throw new InvalidArgumentException('Don\'t specify a parameter name if you\'re passing a Sabre_VObject_Parameter. Add using $array[]=$parameterObject.'); - + + $value->parent = $this; $this->parameters[] = $value; } else { throw new InvalidArgumentException('You can only add parameters to the property object'); @@ -258,6 +264,7 @@ class Sabre_VObject_Property extends Sabre_VObject_Element { $result = array(); foreach($this->parameters as $key=>$parameter) { if ($parameter->name == $name) { + $parameter->parent = null; unset($this->parameters[$key]); } diff --git a/3rdparty/Sabre/VObject/Reader.php b/3rdparty/Sabre/VObject/Reader.php index c38afbfb63..5ed7882ac9 100644 --- a/3rdparty/Sabre/VObject/Reader.php +++ b/3rdparty/Sabre/VObject/Reader.php @@ -95,7 +95,7 @@ class Sabre_VObject_Reader { while(stripos($nextLine,"END:")!==0) { - $obj->children[] = self::readLine($lines); + $obj->add(self::readLine($lines)); $nextLine = current($lines); if ($nextLine===false) @@ -140,7 +140,9 @@ class Sabre_VObject_Reader { if ($matches['parameters']) { - $obj->parameters = self::readParameters($matches['parameters']); + foreach(self::readParameters($matches['parameters']) as $param) { + $obj->add($param); + } } return $obj; diff --git a/3rdparty/Sabre/VObject/Version.php b/3rdparty/Sabre/VObject/Version.php index 950c1c5110..937c367e22 100644 --- a/3rdparty/Sabre/VObject/Version.php +++ b/3rdparty/Sabre/VObject/Version.php @@ -14,7 +14,7 @@ class Sabre_VObject_Version { /** * Full version number */ - const VERSION = '1.2.2'; + const VERSION = '1.2.4'; /** * Stability : alpha, beta, stable From a21908cf18fe139976a4eec494c0dce037c08841 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sat, 29 Oct 2011 10:07:01 +0200 Subject: [PATCH 09/36] Change name and fix a typo --- apps/admin_dependencies_chk/appinfo/app.php | 9 +++++++++ .../appinfo/info.xml | 2 +- .../css/style.css | 0 .../settings.php | 8 ++++---- .../templates/settings.php | 0 apps/dependencies_chk/appinfo/app.php | 9 --------- 6 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 apps/admin_dependencies_chk/appinfo/app.php rename apps/{dependencies_chk => admin_dependencies_chk}/appinfo/info.xml (90%) rename apps/{dependencies_chk => admin_dependencies_chk}/css/style.css (100%) rename apps/{dependencies_chk => admin_dependencies_chk}/settings.php (93%) rename apps/{dependencies_chk => admin_dependencies_chk}/templates/settings.php (100%) delete mode 100644 apps/dependencies_chk/appinfo/app.php diff --git a/apps/admin_dependencies_chk/appinfo/app.php b/apps/admin_dependencies_chk/appinfo/app.php new file mode 100644 index 0000000000..e2169b5dd7 --- /dev/null +++ b/apps/admin_dependencies_chk/appinfo/app.php @@ -0,0 +1,9 @@ + 14, + 'id' => 'admin_dependencies_chk', + 'name' => 'Owncloud Install Info' )); + +OC_APP::registerAdmin('admin_dependencies_chk','settings'); diff --git a/apps/dependencies_chk/appinfo/info.xml b/apps/admin_dependencies_chk/appinfo/info.xml similarity index 90% rename from apps/dependencies_chk/appinfo/info.xml rename to apps/admin_dependencies_chk/appinfo/info.xml index 38a6dee256..7216a1ee86 100644 --- a/apps/dependencies_chk/appinfo/info.xml +++ b/apps/admin_dependencies_chk/appinfo/info.xml @@ -1,6 +1,6 @@ - dependencies_chk + admin_dependencies_chk Owncloud dependencies info 0.01 MIT diff --git a/apps/dependencies_chk/css/style.css b/apps/admin_dependencies_chk/css/style.css similarity index 100% rename from apps/dependencies_chk/css/style.css rename to apps/admin_dependencies_chk/css/style.css diff --git a/apps/dependencies_chk/settings.php b/apps/admin_dependencies_chk/settings.php similarity index 93% rename from apps/dependencies_chk/settings.php rename to apps/admin_dependencies_chk/settings.php index ca60953215..a3c9396497 100644 --- a/apps/dependencies_chk/settings.php +++ b/apps/admin_dependencies_chk/settings.php @@ -20,8 +20,8 @@ * License along with this library. If not, see . * */ -$l=new OC_L10N('dependencies_chk'); -$tmpl = new OC_Template( 'dependencies_chk', 'settings'); +$l=new OC_L10N('admin_dependencies_chk'); +$tmpl = new OC_Template( 'admin_dependencies_chk', 'settings'); $modules = array(); @@ -30,7 +30,7 @@ $modules[] =array( 'status' => function_exists('json_encode') ? 'ok' : 'error', 'part'=> 'php-json', 'modules'=> array('core'), - 'message'=> $l->t('The php-json module is needed by the many application for inter communications')); + 'message'=> $l->t('The php-json module is needed by the many applications for inter communications')); $modules[] =array( 'status' => function_exists('curl_init') ? 'ok' : 'error', @@ -85,7 +85,7 @@ foreach($modules as $key => $module) { if($enabled == false) unset($modules[$key]); } -OC_UTIL::addStyle('dependencies_chk', 'style'); +OC_UTIL::addStyle('admin_dependencies_chk', 'style'); $tmpl->assign( 'items', $modules ); return $tmpl->fetchPage(); diff --git a/apps/dependencies_chk/templates/settings.php b/apps/admin_dependencies_chk/templates/settings.php similarity index 100% rename from apps/dependencies_chk/templates/settings.php rename to apps/admin_dependencies_chk/templates/settings.php diff --git a/apps/dependencies_chk/appinfo/app.php b/apps/dependencies_chk/appinfo/app.php deleted file mode 100644 index dea2cd39f8..0000000000 --- a/apps/dependencies_chk/appinfo/app.php +++ /dev/null @@ -1,9 +0,0 @@ - 14, - 'id' => 'dependencies_chk', - 'name' => 'Owncloud Install Info' )); - -OC_APP::registerAdmin('dependencies_chk','settings'); From eaad3ab45fa8a1d33a24afd7147b674aa79434ee Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sat, 29 Oct 2011 10:15:29 +0200 Subject: [PATCH 10/36] Be consistent with licencing --- apps/admin_dependencies_chk/appinfo/info.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/admin_dependencies_chk/appinfo/info.xml b/apps/admin_dependencies_chk/appinfo/info.xml index 7216a1ee86..10721ece15 100644 --- a/apps/admin_dependencies_chk/appinfo/info.xml +++ b/apps/admin_dependencies_chk/appinfo/info.xml @@ -3,7 +3,7 @@ admin_dependencies_chk Owncloud dependencies info 0.01 - MIT + AGPL Brice Maron (eMerzh) 2 Display OwnCloud's dependencies informations (missings modules, ...) From e533e82bc9526ef9869b20e99b745c210348218f Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sat, 29 Oct 2011 11:40:48 +0200 Subject: [PATCH 11/36] Add sequence name in insertid to be more portable --- apps/bookmarks/ajax/addBookmark.php | 8 +------- apps/calendar/lib/calendar.php | 4 ++-- apps/calendar/lib/object.php | 4 ++-- apps/contacts/lib/addressbook.php | 4 ++-- apps/contacts/lib/vcard.php | 4 ++-- apps/media/lib_collection.php | 2 +- lib/db.php | 10 ++++++++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php index 3975fd15f8..45b16ae5fa 100644 --- a/apps/bookmarks/ajax/addBookmark.php +++ b/apps/bookmarks/ajax/addBookmark.php @@ -54,13 +54,7 @@ $params=array( ); $query->execute($params); -if($CONFIG_DBTYPE == 'pgsql') -{ - $query = OC_DB::prepare("SELECT currval('*PREFIX*bookmarks_id_seq')"); - $b_id = $query->execute()->fetchOne(); -} else { - $b_id = OC_DB::insertid(); -} +$b_id = OC_DB::insertid('*PREFIX*bookmarks'); if($b_id !== false) { diff --git a/apps/calendar/lib/calendar.php b/apps/calendar/lib/calendar.php index c19c0e73c0..f6d40aa534 100644 --- a/apps/calendar/lib/calendar.php +++ b/apps/calendar/lib/calendar.php @@ -111,7 +111,7 @@ class OC_Calendar_Calendar{ $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*calendar_calendars (userid,displayname,uri,ctag,calendarorder,calendarcolor,timezone,components) VALUES(?,?,?,?,?,?,?,?)' ); $result = $stmt->execute(array($userid,$name,$uri,1,$order,$color,$timezone,$components)); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*calendar_calendar'); } /** @@ -131,7 +131,7 @@ class OC_Calendar_Calendar{ $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*calendar_calendars (userid,displayname,uri,ctag,calendarorder,calendarcolor,timezone,components) VALUES(?,?,?,?,?,?,?,?)' ); $result = $stmt->execute(array($userid,$name,$uri,1,$order,$color,$timezone,$components)); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*calendar_calendars'); } /** diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index 0c3e497d4f..33871cd318 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -78,7 +78,7 @@ class OC_Calendar_Object{ OC_Calendar_Calendar::touchCalendar($id); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*calendar_objects'); } /** @@ -97,7 +97,7 @@ class OC_Calendar_Object{ OC_Calendar_Calendar::touchCalendar($id); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*calendar_objects'); } /** diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php index 2e869d7de3..87477ed7ed 100644 --- a/apps/contacts/lib/addressbook.php +++ b/apps/contacts/lib/addressbook.php @@ -96,7 +96,7 @@ class OC_Contacts_Addressbook{ $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)' ); $result = $stmt->execute(array($userid,$name,$uri,$description,1)); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*contacts_addressbooks'); } /** @@ -113,7 +113,7 @@ class OC_Contacts_Addressbook{ $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)' ); $result = $stmt->execute(array($userid,$name,$uri,$description,1)); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*contacts_addressbooks'); } /** diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index 74bc0f92f1..adfa32b6f5 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -121,7 +121,7 @@ class OC_Contacts_VCard{ OC_Contacts_Addressbook::touch($id); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*contacts_cards'); } /** @@ -147,7 +147,7 @@ class OC_Contacts_VCard{ OC_Contacts_Addressbook::touch($id); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*contacts_cards'); } /** diff --git a/apps/media/lib_collection.php b/apps/media/lib_collection.php index 571cb7e685..caa3ac3f47 100644 --- a/apps/media/lib_collection.php +++ b/apps/media/lib_collection.php @@ -267,7 +267,7 @@ class OC_MEDIA_COLLECTION{ $query=self::$queries['addsong']; } $query->execute(array($name,$artist,$album,$path,$uid,$length,$track,$size)); - $songId=OC_DB::insertid(); + $songId=OC_DB::insertid('*PREFIX*media_songs'); // self::setLastUpdated(); return self::getSongId($name,$artist,$album); } diff --git a/lib/db.php b/lib/db.php index 421b08c232..c059f5ab33 100644 --- a/lib/db.php +++ b/lib/db.php @@ -224,6 +224,7 @@ class OC_DB { /** * @brief gets last value of autoincrement + * @param $table string The optional table name (will replace *PREFIX*) and add sequence suffix * @returns id * * MDB2 lastInsertID() @@ -231,9 +232,14 @@ class OC_DB { * Call this method right after the insert command or other functions may * cause trouble! */ - public static function insertid(){ + public static function insertid($table=null){ self::connect(); - return self::$connection->lastInsertId(); + if($table !== null){ + $prefix = OC_Config::getValue( "dbtableprefix", "oc_" ); + $suffix = OC_Config::getValue( "dbsequencesuffix", "_id_seq" ); + $table = str_replace( '*PREFIX*', $prefix, $table ); + } + return self::$connection->lastInsertId($table.$suffix); } /** From c7d1737d47c1846beee5d145dd73dd7924a6eea9 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Tue, 1 Nov 2011 22:35:13 +0100 Subject: [PATCH 12/36] attempt to manage some special chars in file list Added a jquery function to filter by attributes. Add more logging in rename file Use the new function to avoid errors --- apps/files_sharing/js/share.js | 6 ++-- core/js/js.js | 7 +++++ files/js/fileactions.js | 2 +- files/js/filelist.js | 54 +++++++++++++++++++--------------- files/js/files.js | 11 +++++-- files/templates/part.list.php | 2 +- lib/filestorage/local.php | 5 ++++ 7 files changed, 56 insertions(+), 31 deletions(-) diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index c0fc91e92a..131571351c 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -10,7 +10,7 @@ $(document).ready(function() { type: 'GET', url: OC.linkTo('files_sharing', 'ajax/getitem.php'), dataType: 'json', - data: 'source='+file, + data: {source: file}, async: false, success: function(users) { if (users) { @@ -184,8 +184,8 @@ function createDropdown(filename, files) { html += ''; html += ''; if (filename) { - $('tr[data-file="'+filename+'"]').addClass('mouseOver'); - $(html).appendTo($('tr[data-file="'+filename+'"] td.filename')); + $('tr').filterAttr('data-file',filename).addClass('mouseOver'); + $(html).appendTo($('tr').filterAttr('data-file',filename).find('td.filename')); } else { $(html).appendTo($('thead .share')); } diff --git a/core/js/js.js b/core/js/js.js index 9e814ca072..440f504c8f 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -401,3 +401,10 @@ if (!Array.prototype.map){ return res; }; } + +/** + * Filter Jquery selector by attribute value + **/ +$.fn.filterAttr = function(attr_name, attr_value) { + return this.filter(function() { return $(this).attr(attr_name) === attr_value; }); +}; diff --git a/files/js/fileactions.js b/files/js/fileactions.js index f95c5e84dc..9e2688e82c 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -56,7 +56,7 @@ FileActions={ $('#fileList .action').remove(); var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); var file=FileActions.getCurrentFile(); - if($('tr[data-file="'+file+'"]').data('renaming')){ + if($('tr').filterAttr('data-file',file).data('renaming')){ return; } var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); diff --git a/files/js/filelist.js b/files/js/filelist.js index 863a3385d1..5740ece971 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -4,7 +4,7 @@ FileList={ }, addFile:function(name,size,lastModified,loading){ var img=(loading)?OC.imagePath('core', 'loading.gif'):OC.imagePath('core', 'filetypes/file.png'); - var html=''; + var html=''; if(name.indexOf('.')!=-1){ var basename=name.substr(0,name.lastIndexOf('.')); var extention=name.substr(name.lastIndexOf('.')); @@ -29,16 +29,21 @@ FileList={ html+=''+simpleSize+''; html+=''+relative_modified_date(lastModified.getTime() / 1000)+''; html+=''; - FileList.insertElement(name,'file',$(html)); + FileList.insertElement(name,'file',$(html).attr('data-file',name)); if(loading){ - $('tr[data-file="'+name+'"]').data('loading',true); + $('tr').filterAttr('data-file',name).data('loading',true); }else{ - $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); + $('tr').filterAttr('data-file',name).find('td.filename').draggable(dragOptions); } }, addDir:function(name,size,lastModified){ - var html=''; - html+=''+name+''; + html = $('').attr({ "data-type": "dir", "data-size": size, "data-file": name}); + td = $('').attr({"class": "filename", "style": 'background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')' }); + td.append(''); + var link_elem = $('').attr({ "class": "name", "href": "index.php?dir="+ encodeURIComponent($('#dir').val()+'/'+name) }); + link_elem.append($('').addClass('nametext').text(name)); + td.append(link_elem); + html.append(td); if(size!='Pending'){ simpleSize=simpleFileSize(size); }else{ @@ -47,13 +52,15 @@ FileList={ sizeColor = Math.round(200-Math.pow((size/(1024*1024)),2)); lastModifiedTime=Math.round(lastModified.getTime() / 1000); modifiedColor=Math.round((Math.round((new Date()).getTime() / 1000)-lastModifiedTime)/60/60/24*5); - html+=''+simpleSize+''; - html+=''+relative_modified_date(lastModified.getTime() / 1000)+''; - html+=''; + td = $('').attr({ "class": "filesize", "title": humanFileSize(size), "style": 'color:rgb('+sizeColor+','+sizeColor+','+sizeColor+')'}).text(simpleSize); + html.append(td); - FileList.insertElement(name,'dir',$(html)); - $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); - $('tr[data-file="'+name+'"] td.filename').droppable(folderDropOptions); + td = $('').attr({ "class": "date" }); + td.append($('').attr({ "class": "modified", "title": formatDate(lastModified), "style": 'color:rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')' }).text( relative_modified_date(lastModified.getTime() / 1000) )); + html.append(td); + FileList.insertElement(name,'dir',html); + $('tr').filterAttr('data-file',name).find('td.filename').draggable(dragOptions); + $('tr').filterAttr('data-file',name).find('td.filename').droppable(folderDropOptions); }, refresh:function(data) { result = jQuery.parseJSON(data.responseText); @@ -64,8 +71,8 @@ FileList={ resetFileActionPanel(); }, remove:function(name){ - $('tr[data-file="'+name+'"] td.filename').draggable('destroy'); - $('tr[data-file="'+name+'"]').remove(); + $('tr').filterAttr('data-file',name).find('td.filename').draggable('destroy'); + $('tr').filterAttr('data-file',name).remove(); if($('tr[data-file]').length==0){ $('#emptyfolder').show(); $('.file_upload_filename').addClass('highlight'); @@ -101,7 +108,7 @@ FileList={ $('.file_upload_filename').removeClass('highlight'); }, loadingDone:function(name){ - var tr=$('tr[data-file="'+name+'"]'); + var tr=$('tr').filterAttr('data-file',name); tr.data('loading',false); var mime=tr.data('mime'); tr.attr('data-mime',mime); @@ -111,13 +118,13 @@ FileList={ tr.find('td.filename').draggable(dragOptions); }, isLoading:function(name){ - return $('tr[data-file="'+name+'"]').data('loading'); + return $('tr').filterAttr('data-file',name).data('loading'); }, rename:function(name){ - var tr=$('tr[data-file="'+name+'"]'); + var tr=$('tr').filterAttr('data-file',name); tr.data('renaming',true); var td=tr.children('td.filename'); - var input=$(''); + var input=$('').val(name); var form=$('
    ') form.append(input); td.children('a.name').text(''); @@ -143,7 +150,7 @@ FileList={ } $.ajax({ url: 'ajax/rename.php', - data: "dir="+$('#dir').val()+"&newname="+encodeURIComponent(newname)+"&file="+encodeURIComponent(name) + data: { dir : $('#dir').val(), newname: newname, file: name } }); }); form.click(function(event){ @@ -165,9 +172,10 @@ FileList={ files=[files]; } $.each(files,function(index,file){ - $('tr[data-file="'+file+'"]').hide(); - $('tr[data-file="'+file+'"]').find('input[type="checkbox"]').removeAttr('checked'); - $('tr[data-file="'+file+'"]').removeClass('selected'); + var files = $('tr').filterAttr('data-file',file); + files.hide(); + files.find('input[type="checkbox"]').removeAttr('checked'); + files.removeClass('selected'); }); procesSelection(); FileList.deleteCanceled=false; @@ -208,7 +216,7 @@ $(document).ready(function(){ if($('#notification').data('deletefile')) { $.each(FileList.deleteFiles,function(index,file){ - $('tr[data-file="'+file+'"]').show(); + $('tr').filterAttr('data-file',file).show(); // alert(file); }); FileList.deleteCanceled=true; diff --git a/files/js/files.js b/files/js/files.js index 902c5e5493..593eeafde8 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -1,4 +1,9 @@ $(document).ready(function() { + $('#fileList tr').each(function(){ + //little hack to set unescape filenames in attribute + $(this).attr('data-file',unescape($(this).data('file'))); + }); + if($('tr[data-file]').length==0){ $('.file_upload_filename').addClass('highlight'); } @@ -185,9 +190,9 @@ $(document).ready(function() { if(response[0] != undefined && response[0].status == 'success'){ for(var i=0;i200) $relative_date_color = 200; ?> - '> + '> diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 01523b6b0b..9e29f85071 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -84,6 +84,11 @@ class OC_Filestorage_Local extends OC_Filestorage{ return $return; } public function rename($path1,$path2){ + if(! $this->file_exists($path1)){ + OC_Log::write('core','unable to rename, file does not exists : '.$path1,OC_Log::ERROR); + return false; + } + if($return=rename($this->datadir.$path1,$this->datadir.$path2)){ $this->clearFolderSizeCache($path1); $this->clearFolderSizeCache($path2); From 13d2c5e926e71a1ef2ef0bce96eb5a6f627cf88f Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Wed, 2 Nov 2011 20:26:17 +0100 Subject: [PATCH 13/36] Fix bug with spaces in file names. --- files/js/files.js | 3 ++- files/templates/part.list.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/files/js/files.js b/files/js/files.js index 593eeafde8..635266164c 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -2,6 +2,7 @@ $(document).ready(function() { $('#fileList tr').each(function(){ //little hack to set unescape filenames in attribute $(this).attr('data-file',unescape($(this).data('file'))); + $(this).data('file',unescape($(this).data('file'))); }); if($('tr[data-file]').length==0){ @@ -69,7 +70,7 @@ $(document).ready(function() { } procesSelection(); } else { - var filename=$(this).parent().parent().data('file'); + var filename=$(this).parent().parent().attr('data-file'); if(!FileList.isLoading(filename)){ var mime=$(this).parent().parent().data('mime'); var type=$(this).parent().parent().data('type'); diff --git a/files/templates/part.list.php b/files/templates/part.list.php index b0ef73c406..46830ba3a3 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -5,7 +5,7 @@ $relative_modified_date = 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 if($relative_date_color>200) $relative_date_color = 200; ?> - '> + '> From 7b3ae2edd405f31071f43f941615c9da6dd1536e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 30 Oct 2011 15:40:42 +0100 Subject: [PATCH 14/36] use database table prefix from installer, not the old configured value --- lib/setup.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index 2dcedb9b82..e2d56ddaf4 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -82,7 +82,7 @@ class OC_Setup { $dbpass = $options['dbpass']; $dbname = $options['dbname']; $dbhost = $options['dbhost']; - $dbtableprefix = OC_Config::getValue('dbtableprefix','oc_'); + $dbtableprefix = $options['dbtableprefix']; OC_Config::setValue('dbname', $dbname); OC_Config::setValue('dbhost', $dbhost); OC_Config::setValue('dbtableprefix', $dbtableprefix); @@ -135,7 +135,7 @@ class OC_Setup { $dbpass = $options['dbpass']; $dbname = $options['dbname']; $dbhost = $options['dbhost']; - $dbtableprefix = OC_Config::getValue('dbtableprefix','oc_'); + $dbtableprefix = $options['dbtableprefix']; OC_CONFIG::setValue('dbname', $dbname); OC_CONFIG::setValue('dbhost', $dbhost); OC_CONFIG::setValue('dbtableprefix', $dbtableprefix); From e2907eb99db54090ded8332bee5ebb7c94e08b2f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 3 Nov 2011 12:47:12 +0100 Subject: [PATCH 15/36] no longer rely on PEAR::isError since we can use PDO now --- apps/remoteStorage/lib_remoteStorage.php | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/apps/remoteStorage/lib_remoteStorage.php b/apps/remoteStorage/lib_remoteStorage.php index f10a72870a..4bbadafe7d 100644 --- a/apps/remoteStorage/lib_remoteStorage.php +++ b/apps/remoteStorage/lib_remoteStorage.php @@ -4,12 +4,6 @@ class OC_remoteStorage { public static function getValidTokens($ownCloudUser, $userAddress, $dataScope) { $query=OC_DB::prepare("SELECT token,appUrl FROM *PREFIX*authtoken WHERE user=? AND userAddress=? AND dataScope=? LIMIT 100"); $result=$query->execute(array($ownCloudUser,$userAddress,$dataScope)); - if( PEAR::isError($result)) { - $entry = 'DB Error: "'.$result->getMessage().'"
    '; - $entry .= 'Offending command was: '.$result->getDebugInfo().'
    '; - OC_Log::write('removeStorage',$entry,OC_Log::ERROR); - die( $entry ); - } $ret = array(); while($row=$result->fetchRow()){ $ret[$row['token']]=$userAddress; @@ -21,12 +15,6 @@ class OC_remoteStorage { $user=OC_User::getUser(); $query=OC_DB::prepare("SELECT token,appUrl,userAddress,dataScope FROM *PREFIX*authtoken WHERE user=? LIMIT 100"); $result=$query->execute(array($user)); - if( PEAR::isError($result)) { - $entry = 'DB Error: "'.$result->getMessage().'"
    '; - $entry .= 'Offending command was: '.$result->getDebugInfo().'
    '; - OC_Log::write('removeStorage',$entry,OC_Log::ERROR); - die( $entry ); - } $ret = array(); while($row=$result->fetchRow()){ $ret[$row['token']] = array( @@ -42,23 +30,11 @@ class OC_remoteStorage { $user=OC_User::getUser(); $query=OC_DB::prepare("DELETE FROM *PREFIX*authtoken WHERE token=? AND user=?"); $result=$query->execute(array($token,$user)); - if( PEAR::isError($result)) { - $entry = 'DB Error: "'.$result->getMessage().'"
    '; - $entry .= 'Offending command was: '.$result->getDebugInfo().'
    '; - OC_Log::write('removeStorage',$entry,OC_Log::ERROR); - die( $entry ); - } } private static function addToken($token, $appUrl, $userAddress, $dataScope){ $user=OC_User::getUser(); $query=OC_DB::prepare("INSERT INTO *PREFIX*authtoken (`token`,`appUrl`,`user`,`userAddress`,`dataScope`) VALUES(?,?,?,?,?)"); $result=$query->execute(array($token,$appUrl,$user,$userAddress,$dataScope)); - if( PEAR::isError($result)) { - $entry = 'DB Error: "'.$result->getMessage().'"
    '; - $entry .= 'Offending command was: '.$result->getDebugInfo().'
    '; - OC_Log::write('removeStorage',$entry,OC_Log::ERROR); - die( $entry ); - } } public static function createDataScope($appUrl, $userAddress, $dataScope){ $token=uniqid(); From 8eda6f8febcd8e7320d758e512d2d887d86debb0 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 3 Nov 2011 13:09:44 +0100 Subject: [PATCH 16/36] make webfinger work properly if owncloud is installed in a subdirectory --- apps/user_webfinger/webfinger.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/user_webfinger/webfinger.php b/apps/user_webfinger/webfinger.php index afb5368968..349afaba50 100644 --- a/apps/user_webfinger/webfinger.php +++ b/apps/user_webfinger/webfinger.php @@ -4,7 +4,14 @@ if($_SERVER['SCRIPT_NAME'] == '/.well-known/webfinger.php') { } else { header('Please-first: activate'); } -header("Content-Type: application/xml+xrd"); +// header("Content-Type: application/xml+xrd"); + +// calculate the documentroot +// modified version of the one in lib/base.php that takes the .well-known symlink into account +$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); +$SERVERROOT=str_replace("\\",'/',dirname(dirname(dirname(dirname(__FILE__))))); +$SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT)); +$WEBROOT=substr($SUBURI,0,-34); if($_GET['q']) { $bits = explode('@', $_GET['q']); @@ -20,5 +27,5 @@ echo "<"; ?xml version="1.0" encoding="UTF-8"?> - + From bf18568e176481f416b28be0e3ee663777031219 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 4 Nov 2011 03:02:51 +0100 Subject: [PATCH 17/36] small styling fix for New button --- files/css/files.css | 5 +++-- files/js/files.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/files/css/files.css b/files/css/files.css index 0f0a3a6c58..ecd9d9a790 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -3,7 +3,7 @@ See the COPYING-README file. */ /* FILE MENU */ -.actions { padding:.3em; float:left; } +.actions { padding:.3em; float:left; height:2em; } .actions input, .actions button { margin:0; } #file_menu { right:0; position:absolute; top:0; } #file_menu a { display:block; float:left; background-image:none; text-decoration:none; } @@ -16,8 +16,9 @@ #new.active { border-bottom-left-radius:0; border-bottom:none; } #new>a{ padding-left:1em; padding-right:1em; } #new>ul { display:none; position:fixed; text-align:left; padding:.5em; background:#f8f8f8; margin-top:.4em; border:1px solid #ddd; min-width:7em; margin-left:-.5em; z-index:-1; } -#new>ul>li { margin:.3em; padding-left:2em; background-repeat:no-repeat; cursor:pointer; } +#new>ul>li { margin:.3em; padding-left:2em; background-repeat:no-repeat; cursor:pointer; padding-bottom:0.1em } #new>ul>li>p { cursor:pointer; } +#new>ul>li>input { padding:0.3em; margin:-0.3em; } #file_newfolder_name { background-image:url('../../core/img/places/folder.svg'); font-weight:normal; width:7em; } .file_upload_start, .file_upload_filename { font-size:1em; } diff --git a/files/js/files.js b/files/js/files.js index 4f9cde49aa..4ff1e931c0 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -265,7 +265,7 @@ $(document).ready(function() { $(window).click(function(){ $('#new>ul').hide(); $('#new').removeClass('active'); - $('input.file_upload_filename').removeClass('active'); + $('button.file_upload_filename').removeClass('active'); $('#new li').each(function(i,element){ if($(element).children('p').length==0){ $(element).children('input').remove(); @@ -279,7 +279,7 @@ $(document).ready(function() { $('#new>a').click(function(){ $('#new>ul').toggle(); $('#new').toggleClass('active'); - $('input.file_upload_filename').toggleClass('active'); + $('button.file_upload_filename').toggleClass('active'); }); $('#new li').click(function(){ if($(this).children('p').length==0){ From 9a049de85fa7858efaee8f8f2649dc99340233d4 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 4 Nov 2011 03:11:29 +0100 Subject: [PATCH 18/36] fix mimeicon for new files --- files/js/files.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/js/files.js b/files/js/files.js index 4ff1e931c0..bbc0bd31c3 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -310,6 +310,11 @@ $(document).ready(function() { complete: function(data){boolOperationFinished(data, function(){ var date=new Date(); FileList.addFile(name,0,date); + var tr=$('tr').filterAttr('data-file',name); + tr.data('mime','text/plain'); + getMimeIcon('text/plain',function(path){ + tr.find('td.filename').attr('style','background-image:url('+path+')'); + }); });} }); break; From e55c5c590eb47ff10f8166c943470e30584d5b0f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 4 Nov 2011 16:16:54 +0100 Subject: [PATCH 19/36] make 'New' button work with firefox --- files/css/files.css | 8 ++++---- files/templates/index.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/files/css/files.css b/files/css/files.css index ecd9d9a790..22f4810d0a 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -4,7 +4,7 @@ /* FILE MENU */ .actions { padding:.3em; float:left; height:2em; } -.actions input, .actions button { margin:0; } +.actions input, .actions button, .actions .button { margin:0; } #file_menu { right:0; position:absolute; top:0; } #file_menu a { display:block; float:left; background-image:none; text-decoration:none; } .file_upload_form, #file_newfolder_form { display:inline; float: left; margin-left:0; } @@ -12,10 +12,10 @@ .file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .5em; padding-left:2em; } .file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:0;} .file_upload_wrapper .file_upload_button_wrapper { position:absolute; top:0; left:0; width:100%; height:100%; cursor:pointer; z-index:1000; } -#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin:-.075em 0 0 1em; border-right:none; z-index:1010; } -#new.active { border-bottom-left-radius:0; border-bottom:none; } +#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin:0 0 0 1em; border-right:none; z-index:1010; height:1.3em; } +#new.active { border-bottom-left-radius:0; border-bottom:none; background:#f8f8f8 } #new>a{ padding-left:1em; padding-right:1em; } -#new>ul { display:none; position:fixed; text-align:left; padding:.5em; background:#f8f8f8; margin-top:.4em; border:1px solid #ddd; min-width:7em; margin-left:-.5em; z-index:-1; } +#new>ul { display:none; position:fixed; text-align:left; padding:.5em; background:#f8f8f8; margin-top:0.075em; border:1px solid #ddd; min-width:7em; margin-left:-.5em; z-index:-1; } #new>ul>li { margin:.3em; padding-left:2em; background-repeat:no-repeat; cursor:pointer; padding-bottom:0.1em } #new>ul>li>p { cursor:pointer; } #new>ul>li>input { padding:0.3em; margin:-0.3em; } diff --git a/files/templates/index.php b/files/templates/index.php index cb1ab68808..722c38e477 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -2,7 +2,7 @@
    - +
    From b3bb83cf58c70f71cee43405e6e15fdd7ba456fa Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Fri, 4 Nov 2011 23:44:41 +0100 Subject: [PATCH 20/36] Do not use mix data/attr to retrieve filename ... data() will try to convert filename to int --- files/js/files.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/files/js/files.js b/files/js/files.js index bbc0bd31c3..5adf67010b 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -1,8 +1,7 @@ $(document).ready(function() { $('#fileList tr').each(function(){ //little hack to set unescape filenames in attribute - $(this).attr('data-file',unescape($(this).data('file'))); - $(this).data('file',unescape($(this).data('file'))); + $(this).attr('data-file',unescape($(this).attr('data-file'))); }); if($('tr[data-file]').length==0){ @@ -501,7 +500,7 @@ function getSelectedFiles(property){ var files=[]; elements.each(function(i,element){ var file={ - name:$(element).data('file'), + name:$(element).attr('data-file'), mime:$(element).data('mime'), type:$(element).data('type'), size:$(element).data('size'), From 095d0aa74325e078b80861b62af11f1de2a7830e Mon Sep 17 00:00:00 2001 From: Sean Leonard Date: Fri, 4 Nov 2011 17:08:03 -0700 Subject: [PATCH 21/36] Add WebFinger's .well-known file to .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index cc4d3bf03b..a84615cf13 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,6 @@ nbproject # Mac OS .DS_Store + +# WebFinger +.well-known From 70014c4fd02f3bda7c92f68ffee8b787b223022f Mon Sep 17 00:00:00 2001 From: Sean Leonard Date: Fri, 4 Nov 2011 17:16:01 -0700 Subject: [PATCH 22/36] Removed if !mod_php5.c around RewriteRule Made things work on Dreamhost shared hosting --- .htaccess | 2 -- 1 file changed, 2 deletions(-) diff --git a/.htaccess b/.htaccess index 34d4c719c8..0d334503d0 100644 --- a/.htaccess +++ b/.htaccess @@ -4,8 +4,6 @@ php_value upload_max_filesize 512M php_value post_max_size 512M SetEnv htaccessWorking true - RewriteEngine on RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last] - Options -Indexes From 75ff9abaca2f1a067be3fce10794835b857e5cba Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 00:39:11 +0100 Subject: [PATCH 23/36] Fix another problem of the so-called 'fix-special chars' commit. --- files/js/files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/js/files.js b/files/js/files.js index 5adf67010b..0af2b9285b 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -1,7 +1,7 @@ $(document).ready(function() { $('#fileList tr').each(function(){ //little hack to set unescape filenames in attribute - $(this).attr('data-file',unescape($(this).attr('data-file'))); + $(this).attr('data-file',decodeURI($(this).attr('data-file'))); }); if($('tr[data-file]').length==0){ From 8de7c36b4cbb3ef02ad4ca0023cbb06f9f2481d8 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 13:34:22 +0100 Subject: [PATCH 24/36] Fix broken upload since merge of new button branch --- files/js/files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/js/files.js b/files/js/files.js index 0af2b9285b..469a4b81d2 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -163,7 +163,7 @@ $(document).ready(function() { }); $('.file_upload_start').live('change',function(){ - var form=$(this).parent().parent(); + var form=$(this).closest('form'); var uploadId=form.attr('data-upload-id'); var files=this.files; var target=form.children('iframe'); From 2fa9e3279cd305c9ca6eef01918fb6fa418db7db Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 13:50:05 +0100 Subject: [PATCH 25/36] Manage More special chars in file listings. ';' is still problematic --- files/js/files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/js/files.js b/files/js/files.js index 469a4b81d2..4eaa098241 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -1,7 +1,7 @@ $(document).ready(function() { $('#fileList tr').each(function(){ //little hack to set unescape filenames in attribute - $(this).attr('data-file',decodeURI($(this).attr('data-file'))); + $(this).attr('data-file',decodeURIComponent($(this).attr('data-file'))); }); if($('tr[data-file]').length==0){ From 7de591f5cc1cfadc5c2b0f88cded25578cd58350 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 14:37:22 +0100 Subject: [PATCH 26/36] Avoid Huge error message when unable to read log file --- lib/log.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/log.php b/lib/log.php index 98333be54f..446ddd4884 100644 --- a/lib/log.php +++ b/lib/log.php @@ -59,6 +59,9 @@ class OC_Log{ return array(); } $fh=fopen($logFile,'r'); + if($fh === false){ // Unable to read log file! + return array(); + } while(!feof($fh)){ $line=fgets($fh); if($line){ From cc35cb74e191040169100021c906cc8267b3508e Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 15:29:51 +0100 Subject: [PATCH 27/36] Try to avoid closing the share box too soon on multiple selections --- apps/files_sharing/js/share.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 131571351c..4056d693bf 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -46,6 +46,7 @@ $(document).ready(function() { $('.share').click(function(event) { event.preventDefault(); + event.stopPropagation(); var filenames = getSelectedFiles('name'); var length = filenames.length; var files = ''; From 3940ca3df1a87a242b70f68b5f89f92cf3251526 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 16:48:26 +0100 Subject: [PATCH 28/36] Display correctly the error message when nothing is retrieved from OCS servers --- lib/ocsclient.php | 2 ++ settings/templates/help.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ocsclient.php b/lib/ocsclient.php index 654c5e0527..072fd236fe 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -108,6 +108,7 @@ class OC_OCSClient{ $xml=@file_get_contents($url); if($xml==FALSE){ + OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL); return NULL; } $data=simplexml_load_string($xml); @@ -143,6 +144,7 @@ class OC_OCSClient{ $kbe=array(); $xml=@file_get_contents($url); if($xml==FALSE){ + OC_Log::write('core','Unable to parse knowledgebase content',OC_Log::FATAL); return NULL; } $data=simplexml_load_string($xml); diff --git a/settings/templates/help.php b/settings/templates/help.php index 4e3cdd7b90..754bf8b637 100644 --- a/settings/templates/help.php +++ b/settings/templates/help.php @@ -9,7 +9,10 @@ printPage(); + if($pageNavi) + { + $pageNavi->printPage(); + } ?>
    From 97291fda5829fd56a22e39b6a62681aaa239bef5 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 16:54:05 +0100 Subject: [PATCH 29/36] Add allow_url_fopen directive to admin_dependencies_chk --- apps/admin_dependencies_chk/settings.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/admin_dependencies_chk/settings.php b/apps/admin_dependencies_chk/settings.php index a3c9396497..de2f97aa79 100644 --- a/apps/admin_dependencies_chk/settings.php +++ b/apps/admin_dependencies_chk/settings.php @@ -74,6 +74,11 @@ $modules[] =array( 'modules'=> array('core'), 'message'=> $l->t('The php-ctype module is needed validate data.')); +$modules[] =array( + 'status' => ini_get('allow_url_fopen') == '1' ? 'ok' : 'error', + 'part'=> 'allow_url_fopen', + 'modules'=> array('core'), + 'message'=> $l->t('The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers')); foreach($modules as $key => $module) { $enabled = false ; From 452a4637647d6dbd54b275aead765d3a2329813e Mon Sep 17 00:00:00 2001 From: Florian Vichot Date: Sun, 6 Nov 2011 16:43:00 +0100 Subject: [PATCH 30/36] Make OC_Connector_Sabre_File::get() return a PHP stream instead of the file content, as is recommended by SabreDAV to handle large files. --- lib/connector/sabre/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php index b049f39c17..98661dbb18 100644 --- a/lib/connector/sabre/file.php +++ b/lib/connector/sabre/file.php @@ -29,7 +29,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D */ public function get() { - return OC_Filesystem::file_get_contents($this->path); + return OC_Filesystem::fopen($this->path,'r'); } From 2bd28acdc6a1cb4aacd76790705895f20dc05533 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 8 Nov 2011 22:48:29 +0100 Subject: [PATCH 31/36] take free disk space (and user quota) into account for max upload size --- files/index.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/files/index.php b/files/index.php index 8bb5b618d8..4b3bbd1bfd 100644 --- a/files/index.php +++ b/files/index.php @@ -89,6 +89,10 @@ $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); +$freeSpace=OC_Filesystem::free_space('/'); +$freeSpace=max($freeSpace,0); +$maxUploadFilesize = min($maxUploadFilesize ,$freeSpace); + $tmpl = new OC_Template( "files", "index", "user" ); $tmpl->assign( "fileList", $list->fetchPage() ); $tmpl->assign( "breadcrumb", $breadcrumbNav->fetchPage() ); From 841be90939a74048b0cba9e2085d4853a8a7c5bf Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Sun, 23 Oct 2011 11:35:47 +0200 Subject: [PATCH 32/36] Improve style in contacts --- apps/contacts/css/styles.css | 2 +- apps/contacts/js/interface.js | 6 +++--- apps/contacts/templates/part.details.php | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css index 68f843b7aa..e2e673346c 100644 --- a/apps/contacts/css/styles.css +++ b/apps/contacts/css/styles.css @@ -6,7 +6,7 @@ #contacts_details_list li { overflow:hidden; } #contacts_details_list li p.contacts_property_name { width:25%; float:left;text-align:right;padding-right:0.3em; } #contacts_details_list li p.contacts_property_data, #contacts_details_list li ul.contacts_property_data { width:72%; overflow:hidden; } -#contacts_addproperty, #contacts_addproperty_button { margin-left:25%; } +#contacts_addproperty_button, #contacts_setproperty_button { margin-left:25%; } .contacts_property_data ul, .contacts_property_data ol { list-style:none; } .contacts_property_data li { overflow: hidden; } diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index 9270297f32..1cc3a5dfd6 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -56,13 +56,13 @@ $(document).ready(function(){ $('#contacts_addpropertyform #contacts_fieldpart').remove(); $('#contacts_addpropertyform #contacts_generic').remove(); if($(this).val() == 'ADR'){ - $('#contacts_addresspart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]')); + $('#contacts_addresspart').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name')); } else if($(this).val() == 'TEL'){ - $('#contacts_phonepart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]')); + $('#contacts_phonepart').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name')); } else{ - $('#contacts_generic').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]')); + $('#contacts_generic').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name')); } }); diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php index e9fa8356e8..212be283d8 100644 --- a/apps/contacts/templates/part.details.php +++ b/apps/contacts/templates/part.details.php @@ -35,7 +35,8 @@

    -


    +

    +
@@ -46,14 +44,7 @@
  • @@ -67,8 +58,7 @@
  • diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php index 212be283d8..f5bd75809b 100644 --- a/apps/contacts/templates/part.details.php +++ b/apps/contacts/templates/part.details.php @@ -27,10 +27,7 @@

    @@ -44,8 +41,7 @@

  • @@ -80,14 +76,7 @@

    diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php index eb8a67a8aa..811b9626ce 100644 --- a/apps/contacts/templates/part.setpropertyform.php +++ b/apps/contacts/templates/part.setpropertyform.php @@ -5,6 +5,12 @@

      +
    1. + + +
    2. diff --git a/lib/template.php b/lib/template.php index 440b62003e..d1439199e1 100644 --- a/lib/template.php +++ b/lib/template.php @@ -98,6 +98,33 @@ function relative_modified_date($timestamp) { else { return $l->t('years ago'); } } +function html_select_options($options, $selected, $params=array()) { + if (!is_array($selected)){ + $selected=array($selected); + } + if (isset($params['combine']) && $params['combine']){ + $options = array_combine($options, $options); + } + $value_name = $label_name = false; + if (isset($params['value'])){ + $value_name = $params['value']; + } + if (isset($params['label'])){ + $label_name = $params['label']; + } + $html = ''; + foreach($options as $value => $label){ + if ($value_name && is_array($label)){ + $value = $label[$value_name]; + } + if ($label_name && is_array($label)){ + $label = $label[$label_name]; + } + $select = in_array($value, $selected) ? ' selected="selected"' : ''; + $html .= ''; + } + return $html; +} /** * This class provides the templates for owncloud.