diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php index 03a45532f9..028974e1c6 100644 --- a/apps/contacts/ajax/addproperty.php +++ b/apps/contacts/ajax/addproperty.php @@ -66,6 +66,7 @@ foreach($current as $item) { if(is_array($value)) { ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form! + $value = array_map('strip_tags', $value); } else { $value = strip_tags($value); } diff --git a/apps/contacts/ajax/createaddressbook.php b/apps/contacts/ajax/createaddressbook.php index fbd70bae58..28944fe864 100644 --- a/apps/contacts/ajax/createaddressbook.php +++ b/apps/contacts/ajax/createaddressbook.php @@ -13,7 +13,13 @@ OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); $userid = OC_User::getUser(); -$bookid = OC_Contacts_Addressbook::add($userid, strip_tags($_POST['name']), null); +$name = trim(strip_tags($_POST['name'])); +if(!$name) { + OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot add addressbook with an empty name.')))); + OC_Log::write('contacts','ajax/createaddressbook.php: Cannot add addressbook with an empty name: '.strip_tags($_POST['name']), OC_Log::ERROR); + exit(); +} +$bookid = OC_Contacts_Addressbook::add($userid, $name, null); if(!$bookid) { OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error adding addressbook.')))); OC_Log::write('contacts','ajax/createaddressbook.php: Error adding addressbook: '.$_POST['name'], OC_Log::ERROR); diff --git a/apps/contacts/ajax/saveproperty.php b/apps/contacts/ajax/saveproperty.php index 6c8132c1db..0c9e0cc783 100644 --- a/apps/contacts/ajax/saveproperty.php +++ b/apps/contacts/ajax/saveproperty.php @@ -52,6 +52,7 @@ $checksum = isset($_POST['checksum'])?$_POST['checksum']:null; // } if(is_array($value)){ // FIXME: How to strip_tags for compound values? + $value = array_map('strip_tags', $value); ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form! $value = OC_VObject::escapeSemicolons($value); } else { diff --git a/apps/contacts/ajax/updateaddressbook.php b/apps/contacts/ajax/updateaddressbook.php index b43b5b93a3..211df84b1d 100644 --- a/apps/contacts/ajax/updateaddressbook.php +++ b/apps/contacts/ajax/updateaddressbook.php @@ -15,7 +15,14 @@ OC_JSON::checkAppEnabled('contacts'); $bookid = $_POST['id']; OC_Contacts_App::getAddressbook($bookid); // is owner access check -if(!OC_Contacts_Addressbook::edit($bookid, $_POST['name'], null)) { +$name = trim(strip_tags($_POST['name'])); +if(!$name) { + OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot update addressbook with an empty name.')))); + OC_Log::write('contacts','ajax/updateaddressbook.php: Cannot update addressbook with an empty name: '.strip_tags($_POST['name']), OC_Log::ERROR); + exit(); +} + +if(!OC_Contacts_Addressbook::edit($bookid, $name, null)) { OC_JSON::error(array('data' => array('message' => $l->t('Error updating addressbook.')))); OC_Log::write('contacts','ajax/updateaddressbook.php: Error adding addressbook: ', OC_Log::ERROR); //exit(); diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js index d33f983a42..0e06b650a1 100644 --- a/apps/contacts/js/contacts.js +++ b/apps/contacts/js/contacts.js @@ -1043,13 +1043,13 @@ Contacts={ return false; }else{ $.post(OC.filePath('contacts', 'ajax', 'deletebook.php'), { id: bookid}, - function(data) { - if (data.status == 'success'){ + function(jsondata) { + if (jsondata.status == 'success'){ $('#chooseaddressbook_dialog').dialog('destroy').remove(); Contacts.UI.Contacts.update(); Contacts.UI.Addressbooks.overview(); } else { - Contacts.UI.messageBox(t('contacts', 'Error'), data.message); + Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message); //alert('Error: ' + data.message); } }); @@ -1059,10 +1059,14 @@ Contacts={ Contacts.UI.notImplemented(); }, submit:function(button, bookid){ - var displayname = $("#displayname_"+bookid).val(); + var displayname = $("#displayname_"+bookid).val().trim(); var active = $("#edit_active_"+bookid+":checked").length; var description = $("#description_"+bookid).val(); - + + if(displayname.length == 0) { + Contacts.UI.messageBox(t('contacts', 'Error'), t('contacts', 'Displayname cannot be empty.')); + return false; + } var url; if (bookid == 'new'){ url = OC.filePath('contacts', 'ajax', 'createaddressbook.php'); @@ -1070,12 +1074,14 @@ Contacts={ url = OC.filePath('contacts', 'ajax', 'updateaddressbook.php'); } $.post(url, { id: bookid, name: displayname, active: active, description: description }, - function(data){ - if(data.status == 'success'){ + function(jsondata){ + if(jsondata.status == 'success'){ $(button).closest('tr').prev().html(data.page).show().next().remove(); + Contacts.UI.Contacts.update(); + } else { + Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message); } }); - Contacts.UI.Contacts.update(); }, cancel:function(button, bookid){ $(button).closest('tr').prev().show().next().remove(); diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index fe58a46d24..5908dd767a 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -124,12 +124,14 @@ Contacts={ url = OC.filePath('contacts', 'ajax', 'updateaddressbook.php'); } $.post(url, { id: bookid, name: displayname, active: active, description: description }, - function(data){ - if(data.status == 'success'){ + function(jsondata){ + if(jsondata.status == 'success'){ $(button).closest('tr').prev().html(data.page).show().next().remove(); + Contacts.UI.Contacts.update(); + } else { + Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message); } }); - Contacts.UI.Contacts.update(); }, cancel:function(button, bookid){ $(button).closest('tr').prev().show().next().remove(); diff --git a/apps/contacts/js/jquery.inview.js b/apps/contacts/js/jquery.inview.js index a38ab16497..01900b0b4b 100644 --- a/apps/contacts/js/jquery.inview.js +++ b/apps/contacts/js/jquery.inview.js @@ -5,18 +5,40 @@ */ (function ($) { var inviewObjects = {}, viewportSize, viewportOffset, - d = document, w = window, documentElement = d.documentElement, expando = $.expando; + d = document, w = window, documentElement = d.documentElement, expando = $.expando, isFiring = false, $elements = {}; $.event.special.inview = { add: function(data) { - inviewObjects[data.guid + "-" + this[expando]] = { data: data, $element: $(this) }; + var inviewObject = { data: data, $element: $(this) } + inviewObjects[data.guid + "-" + this[expando]] = inviewObject; + var selector = inviewObject.data.selector, + $element = inviewObject.$element; + var hash = parseInt(getHash( data.guid + this[expando])); + $elements[hash] = selector ? $element.find(selector) : $element; }, remove: function(data) { try { delete inviewObjects[data.guid + "-" + this[expando]]; } catch(e) {} + try { + var hash = parseInt(getHash(data.guid + this[expando])); + delete($elements[hash]); + } catch (e){} } }; + + function getHash(str){ + str = str+''; + var hash = 0; + if (str.length == 0) return hash; + for (i = 0; i < str.length; i++) { + char = str.charCodeAt(i); + hash = ((hash<<5)-hash)+char; + hash = hash & hash; // Convert to 32bit integer + } + return Math.abs(hash); + } + function getViewportSize() { var mode, domObject, size = { height: w.innerHeight, width: w.innerWidth }; @@ -46,22 +68,15 @@ } function checkInView() { - var $elements = $(), elementsLength, i = 0; - - $.each(inviewObjects, function(i, inviewObject) { - var selector = inviewObject.data.selector, - $element = inviewObject.$element; - $elements = $elements.add(selector ? $element.find(selector) : $element); - }); - - elementsLength = $elements.length; - if (elementsLength) { + if (isFiring){ + return; + } + isFiring = true; viewportSize = viewportSize || getViewportSize(); viewportOffset = viewportOffset || getViewportOffset(); - - for (; iexecute(array($id)); @@ -334,6 +334,7 @@ class OC_Contacts_VCard{ // FIXME: Add error checking. Deleting a card gives an Kontact/Akonadi error. $stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri=?' ); $stmt->execute(array($aid,$uri)); + OC_Contacts_Addressbook::touch($aid); return true; } diff --git a/core/img/filetypes/application-vnd.oasis.opendocument.formula.png b/core/img/filetypes/application-vnd.oasis.opendocument.formula.png new file mode 100644 index 0000000000..4cefbb690d Binary files /dev/null and b/core/img/filetypes/application-vnd.oasis.opendocument.formula.png differ diff --git a/core/img/filetypes/application-vnd.oasis.opendocument.graphics.png b/core/img/filetypes/application-vnd.oasis.opendocument.graphics.png new file mode 100644 index 0000000000..3d66cc97eb Binary files /dev/null and b/core/img/filetypes/application-vnd.oasis.opendocument.graphics.png differ diff --git a/core/img/filetypes/application-vnd.oasis.opendocument.presentation.png b/core/img/filetypes/application-vnd.oasis.opendocument.presentation.png new file mode 100644 index 0000000000..46942cba28 Binary files /dev/null and b/core/img/filetypes/application-vnd.oasis.opendocument.presentation.png differ diff --git a/core/img/filetypes/application-vnd.oasis.opendocument.spreadsheet.png b/core/img/filetypes/application-vnd.oasis.opendocument.spreadsheet.png new file mode 100644 index 0000000000..abc38d4310 Binary files /dev/null and b/core/img/filetypes/application-vnd.oasis.opendocument.spreadsheet.png differ diff --git a/core/img/filetypes/application-vnd.oasis.opendocument.text.png b/core/img/filetypes/application-vnd.oasis.opendocument.text.png new file mode 100644 index 0000000000..06c1f30c8f Binary files /dev/null and b/core/img/filetypes/application-vnd.oasis.opendocument.text.png differ diff --git a/core/img/filetypes/application-x-7z-compressed.png b/core/img/filetypes/application-x-7z-compressed.png new file mode 100644 index 0000000000..55dd0f7536 Binary files /dev/null and b/core/img/filetypes/application-x-7z-compressed.png differ diff --git a/core/img/filetypes/application-x-bzip-compressed-tar.png b/core/img/filetypes/application-x-bzip-compressed-tar.png new file mode 100644 index 0000000000..55dd0f7536 Binary files /dev/null and b/core/img/filetypes/application-x-bzip-compressed-tar.png differ diff --git a/core/img/filetypes/application-x-bzip.png b/core/img/filetypes/application-x-bzip.png new file mode 100644 index 0000000000..55dd0f7536 Binary files /dev/null and b/core/img/filetypes/application-x-bzip.png differ diff --git a/core/img/filetypes/application-x-compressed-tar.png b/core/img/filetypes/application-x-compressed-tar.png new file mode 100644 index 0000000000..55dd0f7536 Binary files /dev/null and b/core/img/filetypes/application-x-compressed-tar.png differ diff --git a/core/img/filetypes/application-x-deb.png b/core/img/filetypes/application-x-deb.png new file mode 100644 index 0000000000..55dd0f7536 Binary files /dev/null and b/core/img/filetypes/application-x-deb.png differ diff --git a/core/img/filetypes/application-x-debian-package.png b/core/img/filetypes/application-x-debian-package.png new file mode 100644 index 0000000000..eff1b7fc8c Binary files /dev/null and b/core/img/filetypes/application-x-debian-package.png differ diff --git a/core/img/filetypes/application-x-gzip.png b/core/img/filetypes/application-x-gzip.png new file mode 100644 index 0000000000..55dd0f7536 Binary files /dev/null and b/core/img/filetypes/application-x-gzip.png differ diff --git a/core/img/filetypes/application-x-lzma-compressed-tar.png b/core/img/filetypes/application-x-lzma-compressed-tar.png new file mode 100644 index 0000000000..55dd0f7536 Binary files /dev/null and b/core/img/filetypes/application-x-lzma-compressed-tar.png differ diff --git a/core/img/filetypes/application-x-rar.png b/core/img/filetypes/application-x-rar.png new file mode 100644 index 0000000000..55dd0f7536 Binary files /dev/null and b/core/img/filetypes/application-x-rar.png differ diff --git a/core/img/filetypes/application-x-rpm.png b/core/img/filetypes/application-x-rpm.png new file mode 100644 index 0000000000..55dd0f7536 Binary files /dev/null and b/core/img/filetypes/application-x-rpm.png differ diff --git a/core/img/filetypes/application-x-tar.png b/core/img/filetypes/application-x-tar.png new file mode 100644 index 0000000000..55dd0f7536 Binary files /dev/null and b/core/img/filetypes/application-x-tar.png differ diff --git a/core/img/filetypes/application-x-tarz.png b/core/img/filetypes/application-x-tarz.png new file mode 100644 index 0000000000..55dd0f7536 Binary files /dev/null and b/core/img/filetypes/application-x-tarz.png differ diff --git a/core/img/filetypes/application-zip.png b/core/img/filetypes/application-zip.png new file mode 100644 index 0000000000..55dd0f7536 Binary files /dev/null and b/core/img/filetypes/application-zip.png differ diff --git a/core/img/filetypes/readme-2.txt b/core/img/filetypes/readme-2.txt new file mode 100644 index 0000000000..5a606f9a0b --- /dev/null +++ b/core/img/filetypes/readme-2.txt @@ -0,0 +1,28 @@ +15.02.2012 + +Following new icons have been added: +core/img/filetypes/application-vnd.oasis.opendocument.formula.png +core/img/filetypes/application-vnd.oasis.opendocument.graphics.png +core/img/filetypes/application-vnd.oasis.opendocument.presentation.png +core/img/filetypes/application-vnd.oasis.opendocument.spreadsheet.png +core/img/filetypes/application-vnd.oasis.opendocument.text.png + Download: http://odftoolkit.org/ODF-Icons#ODF_Icons + License: Apache 2.0 + +core/img/filetypes/application-x-7z-compressed.png +core/img/filetypes/application-x-bzip-compressed-tar.png +core/img/filetypes/application-x-bzip.png +core/img/filetypes/application-x-compressed-tar.png +core/img/filetypes/application-x-deb.png +core/img/filetypes/application-x-debian-package.png +core/img/filetypes/application-x-gzip.png +core/img/filetypes/application-x-lzma-compressed-tar.png +core/img/filetypes/application-x-rar.png +core/img/filetypes/application-x-rpm.png +core/img/filetypes/application-x-tar.png +core/img/filetypes/application-x-tarz.png +core/img/filetypes/application-zip.png + Author: Gomez Hyuuga + License: Creative Commons Attribution-Share Alike 3.0 Unported License + Download: http://kde-look.org/content/show.php/?content=101767 +