aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-02-25 16:54:27 +0100
committerGeorg Ehrke <dev@georgswebsite.de>2012-02-25 16:54:27 +0100
commitbfb67286c85806fdd4293b60936d5cdedee2e702 (patch)
tree7136c53adb6c7196c84b2b2295a781e697fa42a9
parent9460c9e907f1dd80e4978e23911975bc775e7260 (diff)
parent3cf81cadd5535b0516d73fe3de8ee91f330b4a6f (diff)
downloadnextcloud-server-bfb67286c85806fdd4293b60936d5cdedee2e702.tar.gz
nextcloud-server-bfb67286c85806fdd4293b60936d5cdedee2e702.zip
fix merge conflicts
-rw-r--r--apps/bookmarks/addBm.php16
-rw-r--r--apps/bookmarks/ajax/addBookmark.php50
-rw-r--r--apps/bookmarks/ajax/getMeta.php39
-rw-r--r--apps/bookmarks/appinfo/app.php2
-rw-r--r--apps/bookmarks/appinfo/database.xml8
-rw-r--r--apps/bookmarks/appinfo/info.xml4
-rw-r--r--apps/bookmarks/bookmarksHelper.php52
-rw-r--r--apps/bookmarks/css/bookmarks.css15
-rw-r--r--apps/bookmarks/js/addBm.js5
-rw-r--r--apps/bookmarks/js/bookmarks.js84
-rw-r--r--apps/bookmarks/settings.php4
-rw-r--r--apps/bookmarks/templates/addBm.php18
-rw-r--r--apps/bookmarks/templates/bookmarklet.php8
-rw-r--r--apps/bookmarks/templates/list.php25
-rw-r--r--apps/bookmarks/templates/settings.php9
-rw-r--r--apps/calendar/ajax/changeview.php2
-rwxr-xr-xapps/calendar/ajax/events.php30
-rw-r--r--apps/calendar/appinfo/update.php17
-rw-r--r--apps/calendar/js/calendar.js7
-rw-r--r--apps/calendar/lib/app.php4
-rw-r--r--apps/calendar/lib/calendar.php25
-rw-r--r--apps/calendar/lib/object.php1
-rw-r--r--apps/calendar/lib/search.php2
-rwxr-xr-xapps/calendar/templates/calendar.php2
-rw-r--r--apps/calendar/templates/part.eventform.php7
-rw-r--r--apps/calendar/templates/settings.php2
-rw-r--r--apps/contacts/ajax/addproperty.php1
-rw-r--r--apps/contacts/ajax/createaddressbook.php8
-rw-r--r--apps/contacts/ajax/saveproperty.php3
-rw-r--r--apps/contacts/ajax/updateaddressbook.php9
-rw-r--r--apps/contacts/css/contacts.css4
-rw-r--r--apps/contacts/index.php2
-rw-r--r--apps/contacts/js/contacts.js95
-rw-r--r--apps/contacts/js/interface.js8
-rw-r--r--apps/contacts/js/jquery.inview.js52
-rw-r--r--apps/contacts/lib/app.php2
-rw-r--r--apps/contacts/lib/search.php2
-rw-r--r--apps/contacts/lib/vcard.php213
-rw-r--r--apps/contacts/photo.php12
-rw-r--r--apps/contacts/templates/index.php2
-rw-r--r--apps/contacts/templates/part.contact.php53
-rw-r--r--apps/contacts/templates/part.contactphoto.php2
-rw-r--r--apps/contacts/templates/part.cropphoto.php4
-rw-r--r--apps/contacts/templates/settings.php2
-rwxr-xr-xapps/files_pdfviewer/appinfo/info.xml3
-rw-r--r--apps/files_sharing/ajax/getitem.php2
-rw-r--r--apps/files_sharing/css/sharing.css3
-rw-r--r--apps/files_sharing/js/share.js2
-rw-r--r--apps/files_sharing/lib_share.php15
-rw-r--r--apps/files_texteditor/css/style.css6
-rw-r--r--apps/files_texteditor/js/editor.js5
-rw-r--r--apps/gallery/appinfo/app.php2
-rw-r--r--apps/gallery/css/styles.css6
-rw-r--r--apps/gallery/lib/photo.php1
-rw-r--r--apps/media/css/music.css4
-rw-r--r--apps/media/js/collection.js24
-rw-r--r--apps/media/js/loader.js4
-rw-r--r--apps/media/js/music.js12
-rw-r--r--apps/media/js/playlist.js8
-rw-r--r--apps/media/js/scanner.js8
-rw-r--r--apps/media/lib_ampache.php2
-rw-r--r--apps/media/lib_media.php6
-rw-r--r--apps/media/templates/settings.php2
-rw-r--r--apps/user_ldap/appinfo/app.php6
-rw-r--r--apps/user_ldap/templates/settings.php3
-rw-r--r--apps/user_ldap/user_ldap.php78
-rw-r--r--apps/user_openid/appinfo/app.php4
-rw-r--r--apps/user_openid/user.php2
-rwxr-xr-xconfig/config.sample.php2
-rw-r--r--core/css/styles.css13
-rw-r--r--core/img/filetypes/application-vnd.oasis.opendocument.formula.pngbin0 -> 580 bytes
-rw-r--r--core/img/filetypes/application-vnd.oasis.opendocument.graphics.pngbin0 -> 572 bytes
-rw-r--r--core/img/filetypes/application-vnd.oasis.opendocument.presentation.pngbin0 -> 441 bytes
-rw-r--r--core/img/filetypes/application-vnd.oasis.opendocument.spreadsheet.pngbin0 -> 436 bytes
-rw-r--r--core/img/filetypes/application-vnd.oasis.opendocument.text.pngbin0 -> 420 bytes
-rw-r--r--core/img/filetypes/application-x-7z-compressed.pngbin0 -> 652 bytes
-rw-r--r--core/img/filetypes/application-x-bzip-compressed-tar.pngbin0 -> 652 bytes
-rw-r--r--core/img/filetypes/application-x-bzip.pngbin0 -> 652 bytes
-rw-r--r--core/img/filetypes/application-x-compressed-tar.pngbin0 -> 652 bytes
-rw-r--r--core/img/filetypes/application-x-deb.pngbin0 -> 652 bytes
-rw-r--r--core/img/filetypes/application-x-debian-package.pngbin0 -> 570 bytes
-rw-r--r--core/img/filetypes/application-x-gzip.pngbin0 -> 652 bytes
-rw-r--r--core/img/filetypes/application-x-lzma-compressed-tar.pngbin0 -> 652 bytes
-rw-r--r--core/img/filetypes/application-x-rar.pngbin0 -> 652 bytes
-rw-r--r--core/img/filetypes/application-x-rpm.pngbin0 -> 652 bytes
-rw-r--r--core/img/filetypes/application-x-tar.pngbin0 -> 652 bytes
-rw-r--r--core/img/filetypes/application-x-tarz.pngbin0 -> 652 bytes
-rw-r--r--core/img/filetypes/application-zip.pngbin0 -> 652 bytes
-rw-r--r--core/img/filetypes/readme-2.txt28
-rw-r--r--core/js/js.js22
-rw-r--r--core/lostpassword/index.php2
-rw-r--r--core/templates/layout.user.php4
-rw-r--r--db_structure.xml12
-rw-r--r--files/index.php6
-rw-r--r--files/js/files.js7
-rw-r--r--index.php5
-rw-r--r--lib/app.php2
-rw-r--r--lib/base.php40
-rw-r--r--lib/config.php2
-rw-r--r--lib/db.php3
-rw-r--r--lib/filecache.php2
-rw-r--r--lib/fileproxy/quota.php30
-rw-r--r--lib/filestorage/google.php55
-rw-r--r--lib/group/database.php2
-rw-r--r--lib/helper.php29
-rw-r--r--lib/response.php44
-rw-r--r--lib/search/provider/file.php10
-rw-r--r--lib/setup.php5
-rw-r--r--lib/template.php22
-rw-r--r--lib/updater.php6
-rw-r--r--lib/user.php5
-rw-r--r--lib/util.php17
-rw-r--r--settings/ajax/setquota.php22
-rw-r--r--settings/css/settings.css10
-rw-r--r--settings/js/users.js116
-rw-r--r--settings/templates/personal.php2
-rw-r--r--settings/templates/users.php40
-rw-r--r--settings/users.php11
118 files changed, 1026 insertions, 670 deletions
diff --git a/apps/bookmarks/addBm.php b/apps/bookmarks/addBm.php
index 62ad5821dbf..861b677222d 100644
--- a/apps/bookmarks/addBm.php
+++ b/apps/bookmarks/addBm.php
@@ -28,18 +28,6 @@ OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('bookmarks');
require_once('bookmarksHelper.php');
+addBookmark($_GET['url'], '', 'Read-Later');
-OC_App::setActiveNavigationEntry( 'bookmarks_index' );
-
-OC_Util::addScript('bookmarks','addBm');
-OC_Util::addStyle('bookmarks', 'bookmarks');
-
-$tmpl = new OC_Template( 'bookmarks', 'addBm', 'user' );
-
-$url = isset($_GET['url']) ? urldecode($_GET['url']) : '';
-$metadata = getURLMetadata($url);
-
-$tmpl->assign('URL', htmlentities($metadata['url'],ENT_COMPAT,'utf-8'));
-$tmpl->assign('TITLE', htmlentities($metadata['title'],ENT_COMPAT,'utf-8'));
-
-$tmpl->printPage();
+include 'templates/addBm.php';
diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php
index 45b16ae5fa6..8cda7f0f060 100644
--- a/apps/bookmarks/ajax/addBookmark.php
+++ b/apps/bookmarks/ajax/addBookmark.php
@@ -30,50 +30,6 @@ require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('bookmarks');
-$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
-if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
- $_ut = "strftime('%s','now')";
-} elseif($CONFIG_DBTYPE == 'pgsql') {
- $_ut = 'date_part(\'epoch\',now())::integer';
-} else {
- $_ut = "UNIX_TIMESTAMP()";
-}
-
-//FIXME: Detect when user adds a known URL
-$query = OC_DB::prepare("
- INSERT INTO *PREFIX*bookmarks
- (url, title, user_id, public, added, lastmodified)
- VALUES (?, ?, ?, 0, $_ut, $_ut)
- ");
-
-
-$params=array(
- htmlspecialchars_decode($_GET["url"]),
- htmlspecialchars_decode($_GET["title"]),
- OC_User::getUser()
- );
-$query->execute($params);
-
-$b_id = OC_DB::insertid('*PREFIX*bookmarks');
-
-
-if($b_id !== false) {
- $query = OC_DB::prepare("
- INSERT INTO *PREFIX*bookmarks_tags
- (bookmark_id, tag)
- VALUES (?, ?)
- ");
-
- $tags = explode(' ', urldecode($_GET["tags"]));
- foreach ($tags as $tag) {
- if(empty($tag)) {
- //avoid saving blankspaces
- continue;
- }
- $params = array($b_id, trim($tag));
- $query->execute($params);
- }
-
- OC_JSON::success(array('data' => $b_id));
-}
-
+require_once('../bookmarksHelper.php');
+$id = addBookmark($_GET['url'], $_GET['title'], $_GET['tags']);
+OC_JSON::success(array('data' => $id)); \ No newline at end of file
diff --git a/apps/bookmarks/ajax/getMeta.php b/apps/bookmarks/ajax/getMeta.php
deleted file mode 100644
index ca797315ef4..00000000000
--- a/apps/bookmarks/ajax/getMeta.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-/**
-* ownCloud - bookmarks plugin
-*
-* @author Arthur Schiwon
-* @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-//no apps or filesystem
-$RUNTIME_NOSETUPFS=true;
-
-require_once('../../../lib/base.php');
-
-// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('bookmarks');
-
-// $metadata = array();
-
-require '../bookmarksHelper.php';
-$metadata = getURLMetadata(htmlspecialchars_decode($_GET["url"]));
-
-
-OC_JSON::success(array('data' => $metadata));
diff --git a/apps/bookmarks/appinfo/app.php b/apps/bookmarks/appinfo/app.php
index 479d8ed4767..a1f6139d89b 100644
--- a/apps/bookmarks/appinfo/app.php
+++ b/apps/bookmarks/appinfo/app.php
@@ -1,6 +1,6 @@
<?php
/**
-* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
+* Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de>
* Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de>
* This file is licensed under the Affero General Public License version 3 or
* later.
diff --git a/apps/bookmarks/appinfo/database.xml b/apps/bookmarks/appinfo/database.xml
index fca38ad84b2..f2fc68e4b58 100644
--- a/apps/bookmarks/appinfo/database.xml
+++ b/apps/bookmarks/appinfo/database.xml
@@ -75,14 +75,6 @@
<sorting>descending</sorting>
</field>
</index>
-<!-- <index>
- <name>url</name>
- <unique>true</unique>
- <field>
- <name>url</name>
- <sorting>ascending</sorting>
- </field>
- </index>-->
</declaration>
</table>
diff --git a/apps/bookmarks/appinfo/info.xml b/apps/bookmarks/appinfo/info.xml
index 23aa6c219a9..862ab805a60 100644
--- a/apps/bookmarks/appinfo/info.xml
+++ b/apps/bookmarks/appinfo/info.xml
@@ -3,8 +3,8 @@
<id>bookmarks</id>
<name>Bookmarks</name>
<description>Bookmark manager for ownCloud</description>
- <version>0.1</version>
+ <version>0.2</version>
<licence>AGPL</licence>
- <author>Arthur Schiwon</author>
+ <author>Arthur Schiwon, Marvin Thomas Rabe</author>
<require>2</require>
</info> \ No newline at end of file
diff --git a/apps/bookmarks/bookmarksHelper.php b/apps/bookmarks/bookmarksHelper.php
index ac512fbc241..8def7401e2f 100644
--- a/apps/bookmarks/bookmarksHelper.php
+++ b/apps/bookmarks/bookmarksHelper.php
@@ -70,3 +70,55 @@ function getURLMetadata($url) {
return $metadata;
}
+
+function addBookmark($url, $title='', $tags='') {
+ $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
+ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
+ $_ut = "strftime('%s','now')";
+ } elseif($CONFIG_DBTYPE == 'pgsql') {
+ $_ut = 'date_part(\'epoch\',now())::integer';
+ } else {
+ $_ut = "UNIX_TIMESTAMP()";
+ }
+
+ //FIXME: Detect when user adds a known URL
+ $query = OC_DB::prepare("
+ INSERT INTO *PREFIX*bookmarks
+ (url, title, user_id, public, added, lastmodified)
+ VALUES (?, ?, ?, 0, $_ut, $_ut)
+ ");
+
+ if(empty($title)) {
+ $metadata = getURLMetadata($url);
+ $title = $metadata['title'];
+ }
+
+ $params=array(
+ htmlspecialchars_decode($url),
+ htmlspecialchars_decode($title),
+ OC_User::getUser()
+ );
+ $query->execute($params);
+
+ $b_id = OC_DB::insertid('*PREFIX*bookmarks');
+
+ if($b_id !== false) {
+ $query = OC_DB::prepare("
+ INSERT INTO *PREFIX*bookmarks_tags
+ (bookmark_id, tag)
+ VALUES (?, ?)
+ ");
+
+ $tags = explode(' ', urldecode($tags));
+ foreach ($tags as $tag) {
+ if(empty($tag)) {
+ //avoid saving blankspaces
+ continue;
+ }
+ $params = array($b_id, trim($tag));
+ $query->execute($params);
+ }
+
+ return $b_id;
+ }
+} \ No newline at end of file
diff --git a/apps/bookmarks/css/bookmarks.css b/apps/bookmarks/css/bookmarks.css
index 48f0bede110..b1139f2c346 100644
--- a/apps/bookmarks/css/bookmarks.css
+++ b/apps/bookmarks/css/bookmarks.css
@@ -1,4 +1,8 @@
-#content { overflow: auto; }
+#content { overflow: auto; height: 100%; }
+#firstrun { width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777;}
+#firstrun small { display: block; font-weight: normal; font-size: 0.5em; margin-bottom: 1.5em; }
+#firstrun .button { font-size: 0.7em; }
+#firstrun #selections { font-size:0.8em; font-weight: normal; width: 100%; margin: 2em auto auto auto; clear: both; }
.bookmarks_headline {
font-size: large;
@@ -12,11 +16,6 @@
padding: 0.5ex;
}
-.bookmarks_add {
- display: none;
- margin-top: 45px;
-}
-
.bookmarks_list {
margin-top: 36px;
}
@@ -32,7 +31,7 @@
}
.bookmarks_input {
- width: 20em;
+ width: 8em;
}
.bookmark_actions {
@@ -83,4 +82,4 @@
.loading_meta {
display: none;
margin-left: 5px;
-} \ No newline at end of file
+}
diff --git a/apps/bookmarks/js/addBm.js b/apps/bookmarks/js/addBm.js
index 6e13b59bb2e..d64e55e8920 100644
--- a/apps/bookmarks/js/addBm.js
+++ b/apps/bookmarks/js/addBm.js
@@ -4,13 +4,12 @@ $(document).ready(function() {
function addBookmark(event) {
var url = $('#bookmark_add_url').val();
- var title = $('#bookmark_add_title').val();
var tags = $('#bookmark_add_tags').val();
$.ajax({
url: 'ajax/addBookmark.php',
- data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
+ data: 'url=' + encodeURI(url) + '&tags=' + encodeURI(tags),
success: function(data){
- location.href='index.php';
+ window.close();
}
});
} \ No newline at end of file
diff --git a/apps/bookmarks/js/bookmarks.js b/apps/bookmarks/js/bookmarks.js
index 77f767cdb81..7317a154a76 100644
--- a/apps/bookmarks/js/bookmarks.js
+++ b/apps/bookmarks/js/bookmarks.js
@@ -3,19 +3,12 @@ var bookmarks_loading = false;
var bookmarks_sorting = 'bookmarks_sorting_recent';
-$(document).ready(function() {
- $('.bookmarks_addBtn').click(function(event){
- $('.bookmarks_add').slideToggle();
- });
-
+$(document).ready(function() {
$('#bookmark_add_submit').click(addOrEditBookmark);
$(window).scroll(updateOnBottom);
- $('#bookmark_add_url').focusout(getMetadata);
-
$('.bookmarks_list').empty();
getBookmarks();
-
});
function getBookmarks() {
@@ -35,6 +28,10 @@ function getBookmarks() {
for(var i in bookmarks.data) {
updateBookmarksList(bookmarks.data[i]);
+ $("#firstrun").hide();
+ }
+ if($('.bookmarks_list').is(':empty')) {
+ $("#firstrun").show();
}
$('.bookmark_link').click(recordClick);
@@ -46,20 +43,6 @@ function getBookmarks() {
});
}
-function getMetadata() {
- var url = encodeEntities($('#bookmark_add_url').val());
- $('.loading_meta').css('display','inline');
- $.ajax({
- url: 'ajax/getMeta.php',
- data: 'url=' + encodeURIComponent(url),
- success: function(pageinfo){
- $('#bookmark_add_url').val(pageinfo.data.url);
- $('#bookmark_add_title').val(pageinfo.data.title);
- $('.loading_meta').css('display','none');
- }
- });
-}
-
// function addBookmark() {
// Instead of creating editBookmark() function, Converted the one above to
// addOrEditBookmark() to make .js file more compact.
@@ -69,28 +52,17 @@ function addOrEditBookmark(event) {
var url = encodeEntities($('#bookmark_add_url').val());
var title = encodeEntities($('#bookmark_add_title').val());
var tags = encodeEntities($('#bookmark_add_tags').val());
- var taglist = tags.split(' ');
- var tagshtml = '';
- for ( var i=0, len=taglist.length; i<len; ++i ){
- tagshtml += '<a class="bookmark_tag" href="?tag=' + encodeURI(taglist[i]) + '">' + taglist[i] + '</a> ';
- }
+ $("#firstrun").hide();
if (id == 0) {
$.ajax({
url: 'ajax/addBookmark.php',
data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
success: function(response){
- var bookmark_id = response.data;
- $('.bookmarks_add').slideToggle();
- $('.bookmarks_add').children('p').children('.bookmarks_input').val('');
- $('.bookmarks_list').prepend(
- '<div class="bookmark_single" data-id="' + bookmark_id + '" >' +
- '<p class="bookmark_actions"><span class="bookmark_delete"><img src="img/delete.png" title="Delete"></span>&nbsp;<span class="bookmark_edit"><img src="img/edit.png" title="Edit"></span></p>' +
- '<p class="bookmark_title"><a href="' + url + '" target="_blank" class="bookmark_link">' + title + '</a></p>' +
- '<p class="bookmark_tags">' + tagshtml + '</p>' +
- '<p class="bookmark_url">' + url + '</p>' +
- '</div>'
- );
+ $('.bookmarks_input').val('');
+ $('.bookmarks_list').empty();
+ bookmarks_page = 0;
+ getBookmarks();
}
});
}
@@ -99,18 +71,11 @@ function addOrEditBookmark(event) {
url: 'ajax/editBookmark.php',
data: 'id=' + id + '&url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
success: function(){
- $('.bookmarks_add').slideToggle();
- $('.bookmarks_add').children('p').children('.bookmarks_input').val('');
+ $('.bookmarks_input').val('');
$('#bookmark_add_id').val('0');
-
- var record = $('.bookmark_single[data-id = "' + id + '"]');
- record.children('.bookmark_url:first').text(url);
-
- var record_title = record.children('.bookmark_title:first').children('a:first');
- record_title.attr('href', url);
- record_title.text(title);
-
- record.children('.bookmark_tags:first').html(tagshtml);
+ $('.bookmarks_list').empty();
+ bookmarks_page = 0;
+ getBookmarks();
}
});
}
@@ -122,7 +87,12 @@ function delBookmark(event) {
$.ajax({
url: 'ajax/delBookmark.php',
data: 'url=' + encodeURI($(this).parent().parent().children('.bookmark_url:first').text()),
- success: function(data){ record.animate({ opacity: 'hide' }, 'fast'); }
+ success: function(data){
+ record.remove();
+ if($('.bookmarks_list').is(':empty')) {
+ $("#firstrun").show();
+ }
+ }
});
}
@@ -152,10 +122,20 @@ function updateBookmarksList(bookmark) {
if(!hasProtocol(bookmark.url)) {
bookmark.url = 'http://' + bookmark.url;
}
+ if(bookmark.title == '') bookmark.title = bookmark.url;
$('.bookmarks_list').append(
'<div class="bookmark_single" data-id="' + bookmark.id +'" >' +
- '<p class="bookmark_actions"><span class="bookmark_delete"><img src="img/delete.png" title="Delete"></span>&nbsp;<span class="bookmark_edit"><img src="img/edit.png" title="Edit"></span></p>' +
- '<p class="bookmark_title"><a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a></p>' +
+ '<p class="bookmark_actions">' +
+ '<span class="bookmark_edit">' +
+ '<img class="svg" src="'+OC.imagePath('core', 'actions/rename')+'" title="Edit">' +
+ '</span>' +
+ '<span class="bookmark_delete">' +
+ '<img class="svg" src="'+OC.imagePath('core', 'actions/delete')+'" title="Delete">' +
+ '</span>&nbsp;' +
+ '</p>' +
+ '<p class="bookmark_title">'+
+ '<a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a>' +
+ '</p>' +
'<p class="bookmark_url">' + encodeEntities(bookmark.url) + '</p>' +
'</div>'
);
diff --git a/apps/bookmarks/settings.php b/apps/bookmarks/settings.php
index 0ace04fa2c8..9d945f64dad 100644
--- a/apps/bookmarks/settings.php
+++ b/apps/bookmarks/settings.php
@@ -1,6 +1,6 @@
<?php
/**
- * Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
+ * Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
@@ -8,6 +8,4 @@
$tmpl = new OC_Template( 'bookmarks', 'settings');
-//OC_Util::addScript('bookmarks','settings');
-
return $tmpl->fetchPage();
diff --git a/apps/bookmarks/templates/addBm.php b/apps/bookmarks/templates/addBm.php
index c285c3579c5..dbe673f53a8 100644
--- a/apps/bookmarks/templates/addBm.php
+++ b/apps/bookmarks/templates/addBm.php
@@ -1,7 +1,11 @@
-<div class="bookmarks_addBm">
- <p><label class="bookmarks_label"><?php echo $l->t('Address'); ?></label><input type="text" id="bookmark_add_url" class="bookmarks_input" value="<?php echo $_['URL']; ?>"/></p>
- <p><label class="bookmarks_label"><?php echo $l->t('Title'); ?></label><input type="text" id="bookmark_add_title" class="bookmarks_input" value="<?php echo $_['TITLE']; ?>" /></p>
- <p><label class="bookmarks_label"><?php echo $l->t('Tags'); ?></label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
- <p><label class="bookmarks_label"> </label><label class="bookmarks_hint"><?php echo $l->t('Hint: Use space to separate tags.'); ?></label></p>
- <p><label class="bookmarks_label"></label><input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" /></p>
-</div>
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>Read later - ownCloud</title>
+ <link rel="stylesheet" href="css/readlater.css">
+ </head>
+ <body>
+ <div class="message"><h1>Saved!</h1></div>
+ </body>
+</html> \ No newline at end of file
diff --git a/apps/bookmarks/templates/bookmarklet.php b/apps/bookmarks/templates/bookmarklet.php
new file mode 100644
index 00000000000..3d8bbcc7b31
--- /dev/null
+++ b/apps/bookmarks/templates/bookmarklet.php
@@ -0,0 +1,8 @@
+<?php
+
+function createBookmarklet() {
+ $l = new OC_L10N('bookmarks');
+ echo '<small>' . $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage quickly:') . '</small>'
+ . '<a class="button" href="javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open(\'' . OC_Helper::linkToAbsolute('bookmarks', 'addBm.php') . '?output=popup&url=\'+c(b.location),\'bkmk_popup\',\'left=\'+((a.screenX||a.screenLeft)+10)+\',top=\'+((a.screenY||a.screenTop)+10)+\',height=230px,width=230px,resizable=1,alwaysRaised=1\');a.setTimeout(function(){d.focus()},300);})();">'
+ . $l->t('Read later') . '</a>';
+}
diff --git a/apps/bookmarks/templates/list.php b/apps/bookmarks/templates/list.php
index ccfe74f008f..1abdbb7f838 100644
--- a/apps/bookmarks/templates/list.php
+++ b/apps/bookmarks/templates/list.php
@@ -1,6 +1,6 @@
<?php
/**
- * Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
+ * Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de>
* Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de>
* This file is licensed under the Affero General Public License version 3 or
* later.
@@ -9,17 +9,18 @@
?>
<input type="hidden" id="bookmarkFilterTag" value="<?php if(isset($_GET['tag'])) echo htmlentities($_GET['tag']); ?>" />
<div id="controls">
- <input type="button" class="bookmarks_addBtn" value="<?php echo $l->t('Add bookmark'); ?>"/>
-</div>
-<div class="bookmarks_add">
<input type="hidden" id="bookmark_add_id" value="0" />
- <p><label class="bookmarks_label"><?php echo $l->t('Address'); ?></label><input type="text" id="bookmark_add_url" class="bookmarks_input" /></p>
- <p><label class="bookmarks_label"><?php echo $l->t('Title'); ?></label><input type="text" id="bookmark_add_title" class="bookmarks_input" />
- <img class="loading_meta" src="<?php echo OC_Helper::imagePath('core', 'loading.gif'); ?>" /></p>
- <p><label class="bookmarks_label"><?php echo $l->t('Tags'); ?></label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
- <p><label class="bookmarks_label"> </label><label class="bookmarks_hint"><?php echo $l->t('Hint: Use space to separate tags.'); ?></label></p>
- <p><label class="bookmarks_label"></label><input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" /></p>
+ <input type="text" id="bookmark_add_url" placeholder="<?php echo $l->t('Address'); ?>" class="bookmarks_input" />
+ <input type="text" id="bookmark_add_title" placeholder="<?php echo $l->t('Title'); ?>" class="bookmarks_input" />
+ <input type="text" id="bookmark_add_tags" placeholder="<?php echo $l->t('Tags'); ?>" class="bookmarks_input" />
+ <input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" />
</div>
<div class="bookmarks_list">
- <?php echo $l->t('You have no bookmarks'); ?>
-</div> \ No newline at end of file
+</div>
+<div id="firstrun" style="display: none;">
+ <?php
+ echo $l->t('You have no bookmarks');
+ require_once('bookmarklet.php');
+ createBookmarklet();
+ ?>
+</div>
diff --git a/apps/bookmarks/templates/settings.php b/apps/bookmarks/templates/settings.php
index 97b6b256c09..31edf7478bf 100644
--- a/apps/bookmarks/templates/settings.php
+++ b/apps/bookmarks/templates/settings.php
@@ -1,6 +1,6 @@
<?php
/**
- * Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
+ * Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
@@ -8,7 +8,10 @@
?>
<form id="bookmarks">
<fieldset class="personalblock">
- <span class="bold"><?php echo $l->t('Bookmarklet:');?></span>&nbsp;<a class="bookmarks_addBml" href="javascript:(function(){url=encodeURIComponent(location.href);window.open('<?php echo OC_Helper::linkTo('bookmarks', 'addBm.php', null, true); ?>?url='+url, 'owncloud-bookmarks') })()"><?php echo $l->t('Add page to ownCloud'); ?></a>
- <br/><em><?php echo $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.'); ?></em><br />
+ <span class="bold"><?php echo $l->t('Bookmarklet <br />');?></span>
+ <?php
+ require_once('bookmarklet.php');
+ createBookmarklet();
+ ?>
</fieldset>
</form>
diff --git a/apps/calendar/ajax/changeview.php b/apps/calendar/ajax/changeview.php
index 034c7129cab..76e29cbe265 100644
--- a/apps/calendar/ajax/changeview.php
+++ b/apps/calendar/ajax/changeview.php
@@ -21,4 +21,4 @@ switch($view){
}
OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'currentview', $view);
OC_JSON::success();
-?> \ No newline at end of file
+?>
diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php
index 1747b2ac1a8..687b8e38d44 100755
--- a/apps/calendar/ajax/events.php
+++ b/apps/calendar/ajax/events.php
@@ -1,10 +1,11 @@
<?php
/**
- * Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
+ * Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
+
require_once ('../../../lib/base.php');
require_once('../../../3rdparty/when/When.php');
@@ -13,6 +14,7 @@ OC_JSON::checkAppEnabled('calendar');
$start = DateTime::createFromFormat('U', $_GET['start']);
$end = DateTime::createFromFormat('U', $_GET['end']);
+
if($_GET['calendar_id'] == 'shared_rw' || $_GET['calendar_id'] == 'shared_r'){
$calendars = OC_Calendar_Share::allSharedwithuser(OC_USER::getUser(), OC_Calendar_Share::CALENDAR, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r');
$events = array();
@@ -27,17 +29,21 @@ if($_GET['calendar_id'] == 'shared_rw' || $_GET['calendar_id'] == 'shared_r'){
exit;
}
$events = OC_Calendar_Object::allInPeriod($_GET['calendar_id'], $start, $end);
+ OC_Response::enableCaching(0);
+ OC_Response::setETagHeader($calendar['ctag']);
}
-$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+$events = OC_Calendar_Object::allInPeriod($_GET['calendar_id'], $start, $end);
+$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$return = array();
-
foreach($events as $event){
$object = OC_VObject::parse($event['calendardata']);
$vevent = $object->VEVENT;
+
+ $return_event = OC_Calendar_App::prepareForOutput($event, $vevent);
+
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
- $return_event = array();
$start_dt = $dtstart->getDateTime();
$end_dt = $dtend->getDateTime();
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){
@@ -50,9 +56,12 @@ foreach($events as $event){
if($event['repeating'] == 1){
$duration = (double) $end_dt->format('U') - (double) $start_dt->format('U');
$r = new When();
- $r->recur((string) $start_dt->format('Ymd\THis'))->rrule((string) $vevent->RRULE);
+ $r->recur($start_dt)->rrule((string) $vevent->RRULE);
while($result = $r->next()){
- if($result->format('U') > $_GET['end']){
+ if($result < $start){
+ continue;
+ }
+ if($result > $end){
break;
}
if($return_event['allDay'] == true){
@@ -62,21 +71,18 @@ foreach($events as $event){
$return_event['start'] = $result->format('Y-m-d H:i:s');
$return_event['end'] = date('Y-m-d H:i:s', $result->format('U') + $duration);
}
- $return[] = OC_Calendar_App::prepareForOutput($event, $vevent, $return_event);
+ $return[] = $return_event;
}
}else{
- $return_event = array();
- if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){
- $return_event['allDay'] = true;
+ if($return_event['allDay'] == true){
$return_event['start'] = $start_dt->format('Y-m-d');
$end_dt->modify('-1 sec');
$return_event['end'] = $end_dt->format('Y-m-d');
}else{
$return_event['start'] = $start_dt->format('Y-m-d H:i:s');
$return_event['end'] = $end_dt->format('Y-m-d H:i:s');
- $return_event['allDay'] = false;
}
- $return[] = OC_Calendar_App::prepareForOutput($event, $vevent, $return_event);
+ $return[] = $return_event;
}
}
OC_JSON::encodedPrint($return);
diff --git a/apps/calendar/appinfo/update.php b/apps/calendar/appinfo/update.php
new file mode 100644
index 00000000000..375816a403e
--- /dev/null
+++ b/apps/calendar/appinfo/update.php
@@ -0,0 +1,17 @@
+<?php
+
+$installedVersion=OC_Appconfig::getValue('calendar', 'installed_version');
+if (version_compare($installedVersion, '0.2.1', '<')) {
+ $stmt = OC_DB::prepare( 'SELECT id, calendarcolor FROM *PREFIX*calendar_calendars WHERE calendarcolor IS NOT NULL' );
+ $result = $stmt->execute();
+ while( $row = $result->fetchRow()) {
+ $id = $row['id'];
+ $color = $row['calendarcolor'];
+ if ($color[0] == '#' || strlen($color) < 6) {
+ continue;
+ }
+ $color = '#' .$color;
+ $stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET calendarcolor=? WHERE id=?' );
+ $r = $stmt->execute(array($color,$id));
+ }
+}
diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js
index cd4a82a71b3..c6a66770747 100644
--- a/apps/calendar/js/calendar.js
+++ b/apps/calendar/js/calendar.js
@@ -479,7 +479,7 @@ Calendar={
colors[i].label = $(elm).text();
});
for (var i in colors) {
- picker.append('<span class="calendar-colorpicker-color ' + (colors[i].color == $(obj).children(":selected").val() ? ' active' : '') + '" rel="' + colors[i].label + '" style="background-color: #' + colors[i].color + ';"></span>');
+ picker.append('<span class="calendar-colorpicker-color ' + (colors[i].color == $(obj).children(":selected").val() ? ' active' : '') + '" rel="' + colors[i].label + '" style="background-color: ' + colors[i].color + ';"></span>');
}
picker.delegate(".calendar-colorpicker-color", "click", function() {
$(obj).val($(this).attr('rel'));
@@ -792,7 +792,10 @@ $(document).ready(function(){
allDayText: allDayText,
viewDisplay: function(view) {
$('#datecontrol_date').html(view.title);
- $.get(OC.filePath('calendar', 'ajax', 'changeview.php') + "?v="+view.name);
+ if (view.name != defaultView) {
+ $.get(OC.filePath('calendar', 'ajax', 'changeview.php') + "?v="+view.name);
+ defaultView = view.name;
+ }
Calendar.UI.setViewActive(view.name);
if (view.name == 'agendaWeek') {
$('#calendar_holder').fullCalendar('option', 'aspectRatio', 0.1);
diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php
index 27129e77e35..516c04f038a 100644
--- a/apps/calendar/lib/app.php
+++ b/apps/calendar/lib/app.php
@@ -115,7 +115,8 @@ class OC_Calendar_App{
return OC_Calendar_Object::getWeekofMonth(self::$l10n);
}
- public static function prepareForOutput($event, $vevent, $return_event){
+ public static function prepareForOutput($event, $vevent){
+ $return_event = array();
$return_event['id'] = (int)$event['id'];
$return_event['title'] = htmlspecialchars($event['summary']);
$return_event['description'] = isset($vevent->DESCRIPTION)?htmlspecialchars($vevent->DESCRIPTION->value):'';
@@ -127,6 +128,5 @@ class OC_Calendar_App{
}
$return_event['lastmodified'] = (int)$lastmodified;
return $return_event;
-
}
}
diff --git a/apps/calendar/lib/calendar.php b/apps/calendar/lib/calendar.php
index 5e272991f20..277539af97d 100644
--- a/apps/calendar/lib/calendar.php
+++ b/apps/calendar/lib/calendar.php
@@ -96,7 +96,7 @@ class OC_Calendar_Calendar{
* @param string $components Default: "VEVENT,VTODO,VJOURNAL"
* @param string $timezone Default: null
* @param integer $order Default: 1
- * @param string $color Default: null
+ * @param string $color Default: null, format: '#RRGGBB(AA)'
* @return insertid
*/
public static function addCalendar($userid,$name,$components='VEVENT,VTODO,VJOURNAL',$timezone=null,$order=0,$color=null){
@@ -122,7 +122,7 @@ class OC_Calendar_Calendar{
* @param string $components
* @param string $timezone
* @param integer $order
- * @param string $color
+ * @param string $color format: '#RRGGBB(AA)'
* @return insertid
*/
public static function addCalendarFromDAVData($principaluri,$uri,$name,$components,$timezone,$order,$color){
@@ -141,7 +141,7 @@ class OC_Calendar_Calendar{
* @param string $components Default: null
* @param string $timezone Default: null
* @param integer $order Default: null
- * @param string $color Default: null
+ * @param string $color Default: null, format: '#RRGGBB(AA)'
* @return boolean
*
* Values not null will be set
@@ -230,22 +230,23 @@ class OC_Calendar_Calendar{
}
public static function getCalendarColorOptions(){
return array(
- 'ff0000', // "Red"
- 'b3dc6c', // "Green"
- 'ffff00', // "Yellow"
- '808000', // "Olive"
- 'ffa500', // "Orange"
- 'ff7f50', // "Coral"
- 'ee82ee', // "Violet"
- '9fc6e7', // "light blue"
+ '#ff0000', // "Red"
+ '#b3dc6c', // "Green"
+ '#ffff00', // "Yellow"
+ '#808000', // "Olive"
+ '#ffa500', // "Orange"
+ '#ff7f50', // "Coral"
+ '#ee82ee', // "Violet"
+ '#9fc6e7', // "light blue"
);
}
public static function getEventSourceInfo($calendar){
return array(
'url' => 'ajax/events.php?calendar_id='.$calendar['id'],
- 'backgroundColor' => '#'.$calendar['calendarcolor'],
+ 'backgroundColor' => $calendar['calendarcolor'],
'borderColor' => '#888',
'textColor' => 'black',
+ 'cache' => true,
);
}
}
diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php
index a7ee5bd1081..5a3410ea5dc 100644
--- a/apps/calendar/lib/object.php
+++ b/apps/calendar/lib/object.php
@@ -194,6 +194,7 @@ class OC_Calendar_Object{
public static function deleteFromDAVData($cid,$uri){
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*calendar_objects WHERE calendarid = ? AND uri=?' );
$stmt->execute(array($cid,$uri));
+ OC_Calendar_Calendar::touchCalendar($cid);
return true;
}
diff --git a/apps/calendar/lib/search.php b/apps/calendar/lib/search.php
index 425c93c7338..0016751a66a 100644
--- a/apps/calendar/lib/search.php
+++ b/apps/calendar/lib/search.php
@@ -36,7 +36,7 @@ class OC_Search_Provider_Calendar extends OC_Search_Provider{
}else{
$info = $l->t('Date') . ': ' . $start_dt->format('d.m.y H:i') . ' - ' . $end_dt->format('d.m.y H:i');
}
- $link = OC_Helper::linkTo('apps/calendar', 'index.php?showevent='.urlencode($object['id']));
+ $link = OC_Helper::linkTo('calendar', 'index.php').'?showevent='.urlencode($object['id']);
$results[]=new OC_Search_Result($object['summary'],$info, $link,$l->t('Cal.'));//$name,$text,$link,$type
}
}
diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php
index 2d5cdea4d74..eb82d0d02ad 100755
--- a/apps/calendar/templates/calendar.php
+++ b/apps/calendar/templates/calendar.php
@@ -18,7 +18,7 @@
var missing_field_totime = '<?php echo addslashes($l->t('To Time')) ?>';
var missing_field_startsbeforeends = '<?php echo addslashes($l->t('The event ends before it starts')) ?>';
var missing_field_dberror = '<?php echo addslashes($l->t('There was a database fail')) ?>';
- var totalurl = '<?php echo OC_Helper::linkTo('apps/calendar', 'caldav.php', null, true); ?>/calendars';
+ var totalurl = '<?php echo OC_Helper::linkToAbsolute('calendar', 'caldav.php'); ?>/calendars';
$(document).ready(function() {
<?php
if(array_key_exists('showevent', $_)){
diff --git a/apps/calendar/templates/part.eventform.php b/apps/calendar/templates/part.eventform.php
index 2abfe94ba03..b67f8c02c39 100644
--- a/apps/calendar/templates/part.eventform.php
+++ b/apps/calendar/templates/part.eventform.php
@@ -25,6 +25,7 @@
?>
</select>
</td>
+ <?php if(count($_['calendar_options']) > 1) { ?>
<th width="75px">&nbsp;&nbsp;&nbsp;<?php echo $l->t("Calendar");?>:</th>
<td>
<select style="width:140px;" name="calendar">
@@ -34,6 +35,12 @@
?>
</select>
</td>
+ <?php } else { ?>
+ <th width="75px">&nbsp;</th>
+ <td>
+ <input type="hidden" name="calendar" value="<?php echo $_['calendar_options'][0]['id'] ?>">
+ </td>
+ <?php } ?>
</tr>
</table>
<hr>
diff --git a/apps/calendar/templates/settings.php b/apps/calendar/templates/settings.php
index e174378d02d..979634874e4 100644
--- a/apps/calendar/templates/settings.php
+++ b/apps/calendar/templates/settings.php
@@ -40,6 +40,6 @@
</table>
<?php echo $l->t('Calendar CalDAV syncing address:');?>
- <?php echo OC_Helper::linkTo('apps/calendar', 'caldav.php', null, true); ?><br />
+ <?php echo OC_Helper::linkToAbsolute('calendar', 'caldav.php'); ?><br />
</fieldset>
</form>
diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php
index 03a45532f9b..028974e1c66 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 fbd70bae583..28944fe864c 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 6c8132c1dbf..6f8366243fe 100644
--- a/apps/contacts/ajax/saveproperty.php
+++ b/apps/contacts/ajax/saveproperty.php
@@ -51,7 +51,8 @@ $checksum = isset($_POST['checksum'])?$_POST['checksum']:null;
// }
// }
-if(is_array($value)){ // FIXME: How to strip_tags for compound values?
+if(is_array($value)){
+ $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 b43b5b93a32..211df84b1d1 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/css/contacts.css b/apps/contacts/css/contacts.css
index 384541f3751..b24ec438f24 100644
--- a/apps/contacts/css/contacts.css
+++ b/apps/contacts/css/contacts.css
@@ -17,8 +17,8 @@
#contacts_propertymenu li a:hover { color: #fff }
#actionbar { height: 30px; width: 200px; position: fixed; right: 0px; top: 75px; margin: 0 0 0 0; padding: 0 0 0 0;}
#card { /*max-width: 70em; border: thin solid lightgray; display: block;*/ }
-#firstrun { /*border: thin solid lightgray;*/ width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777;}
-#firstrun #selections { /*border: thin solid lightgray;*/ font-size:0.8em; width: 100%; margin: 2em auto auto auto; clear: both; }
+#firstrun { width: 100%; position: absolute; top: 5em; left: 0; text-align: center; font-weight:bold; font-size:1.5em; color:#777; }
+#firstrun #selections { font-size:0.8em; margin: 2em auto auto auto; clear: both; }
#card input[type="text"].contacts_property,input[type="email"].contacts_property { width: 16em; }
#card input[type="text"],input[type="email"],input[type="tel"],input[type="date"], select { background-color: #f8f8f8; border: 0 !important; -webkit-appearance:none !important; -moz-appearance:none !important; -webkit-box-sizing:none !important; -moz-box-sizing:none !important; box-sizing:none !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; float: left; }
diff --git a/apps/contacts/index.php b/apps/contacts/index.php
index c5115d16074..0a21ddd04b6 100644
--- a/apps/contacts/index.php
+++ b/apps/contacts/index.php
@@ -10,6 +10,8 @@ require_once('../../lib/base.php');
// Check if we are a user
OC_Util::checkLoggedIn();
+OC_Util::checkAppEnabled('contacts');
+
// Get active address books. This creates a default one if none exists.
$ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser());
$contacts = OC_Contacts_VCard::all($ids);
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index 30793625746..d033e3f21cd 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -8,7 +8,7 @@ String.prototype.strip_tags = function(){
tags = this;
stripped = tags.replace(/[\<\>]/gi, "");
return stripped;
-}
+};
Contacts={
@@ -117,7 +117,7 @@ Contacts={
$('#carddav_url_close').show();
},
messageBox:function(title, msg) {
- if(msg.toLowerCase().indexOf('auth') > 0) {
+ if(msg.toLowerCase().indexOf('auth') != -1) {
// fugly hack, I know
alert(msg);
}
@@ -142,7 +142,7 @@ Contacts={
}
});
});
- }
+ };
},
loadListHandlers:function() {
//$('.add,.delete').hide();
@@ -323,7 +323,7 @@ Contacts={
}
});
},
- delete:function() {
+ delete: function() {
$('#contacts_deletecard').tipsy('hide');
$.getJSON('ajax/deletecard.php',{'id':this.id},function(jsondata){
if(jsondata.status == 'success'){
@@ -335,17 +335,6 @@ Contacts={
// Load first in list.
if($('#contacts li').length > 0) {
Contacts.UI.Card.update();
- /*
- var firstid = $('#contacts li:first-child').data('id');
- console.log('trying to load: ' + firstid);
- $.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':firstid},function(jsondata){
- if(jsondata.status == 'success'){
- Contacts.UI.Card.loadContact(jsondata.data);
- }
- else{
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
- }
- });*/
} else {
// load intro page
$.getJSON('ajax/loadintro.php',{},function(jsondata){
@@ -374,6 +363,7 @@ Contacts={
$('#rightcontent').data('id',this.id);
//console.log('loaded: ' + this.data.FN[0]['value']);
this.populateNameFields();
+ this.loadCategories();
this.loadPhoto();
this.loadMails();
this.loadPhones();
@@ -455,9 +445,6 @@ Contacts={
this.fullname += ', ' + this.honsuf;
}
$('#n').html(this.fullname);
- //$('.jecEditableOption').attr('title', 'Custom');
- //$('.jecEditableOption').text(this.fn);
- //$('.jecEditableOption').attr('value', 0);
$('#fn_select option').remove();
$('#fn_select').combobox('value', this.fn);
var names = [this.fullname, this.givname + ' ' + this.famname, this.famname + ' ' + this.givname, this.famname + ', ' + this.givname];
@@ -466,17 +453,16 @@ Contacts={
.append($('<option></option>')
.text(value));
});
- /*$('#full').text(this.fullname);
- $('#short').text(this.givname + ' ' + this.famname);
- $('#reverse').text(this.famname + ' ' + this.givname);
- $('#reverse_comma').text(this.famname + ', ' + this.givname);*/
$('#contact_identity').find('*[data-element="N"]').data('checksum', this.data.N[0]['checksum']);
$('#contact_identity').find('*[data-element="FN"]').data('checksum', this.data.FN[0]['checksum']);
$('#contact_identity').show();
},
+ loadCategories:function(){
+ if(this.data.CATEGORIES) {
+ //
+ }
+ },
editNew:function(){ // add a new contact
- //Contacts.UI.notImplemented();
- //return false;
this.id = ''; this.fn = ''; this.fullname = ''; this.givname = ''; this.famname = ''; this.addname = ''; this.honpre = ''; this.honsuf = '';
$.getJSON('ajax/newcontact.php',{},function(jsondata){
if(jsondata.status == 'success'){
@@ -713,12 +699,6 @@ Contacts={
.text(value));
});
- /*$('#short').text(n[1] + ' ' + n[0]);
- $('#full').text(this.fullname);
- $('#reverse').text(n[0] + ' ' + n[1]);
- $('#reverse_comma').text(n[0] + ', ' + n[1]);*/
- //$('#n').html(full);
- //$('#fn').val(0);
if(this.id == '') {
var aid = $(dlg).find('#aid').val();
Contacts.UI.Card.add(n.join(';'), $('#short').text(), aid);
@@ -835,7 +815,7 @@ Contacts={
checksum = Contacts.UI.checksumFor(obj);
container = Contacts.UI.propertyContainerFor(obj);
}
- var adr = new Array($(dlg).find('#adr_pobox').val(),$(dlg).find('#adr_extended').val(),$(dlg).find('#adr_street').val(),$(dlg).find('#adr_city').val(),$(dlg).find('#adr_region').val(),$(dlg).find('#adr_zipcode').val(),$(dlg).find('#adr_country').val());
+ var adr = new Array($(dlg).find('#adr_pobox').val().strip_tags(),$(dlg).find('#adr_extended').val().strip_tags(),$(dlg).find('#adr_street').val().strip_tags(),$(dlg).find('#adr_city').val().strip_tags(),$(dlg).find('#adr_region').val().strip_tags(),$(dlg).find('#adr_zipcode').val().strip_tags(),$(dlg).find('#adr_country').val().strip_tags());
$(container).find('.adr').val(adr.join(';'));
$(container).find('.adr_type').val($(dlg).find('#adr_type').val());
$(container).find('.adr_type_label').html(t('contacts',ucwords($(dlg).find('#adr_type').val().toLowerCase())));
@@ -889,21 +869,22 @@ Contacts={
},
loadPhoto:function(){
if(this.data.PHOTO) {
+ $.getJSON('ajax/loadphoto.php',{'id':this.id},function(jsondata){
+ if(jsondata.status == 'success'){
+ //alert(jsondata.data.page);
+ $('#contacts_details_photo_wrapper').html(jsondata.data.page);
+ }
+ else{
+ Contacts.UI.messageBox(jsondata.data.message);
+ }
+ });
$('#file_upload_form').show();
$('#contacts_propertymenu a[data-type="PHOTO"]').parent().hide();
} else {
+ $('#contacts_details_photo_wrapper').empty();
$('#file_upload_form').hide();
$('#contacts_propertymenu a[data-type="PHOTO"]').parent().show();
}
- $.getJSON('ajax/loadphoto.php',{'id':this.id},function(jsondata){
- if(jsondata.status == 'success'){
- //alert(jsondata.data.page);
- $('#contacts_details_photo_wrapper').html(jsondata.data.page);
- }
- else{
- Contacts.UI.messageBox(jsondata.data.message);
- }
- });
},
editPhoto:function(id, tmp_path){
//alert('editPhoto: ' + tmp_path);
@@ -1062,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);
}
});
@@ -1078,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');
@@ -1089,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'){
- $(button).closest('tr').prev().html(data.page).show().next().remove();
+ function(jsondata){
+ if(jsondata.status == 'success'){
+ $(button).closest('tr').prev().html(jsondata.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();
@@ -1143,13 +1130,6 @@ $(document).ready(function(){
return false;
});
- /**
- * Open blank form to add new contact.
- * FIXME: Load the same page but only show name data and popup the name edit dialog.
- * On save load the page again with an id and show all fields.
- * NOTE: Or: Load the full page and popup name dialog modal. On success set the newly aquired ID, on
- * Cancel or failure give appropriate message and show ... something else :-P
- */
$('#contacts_newcontact').click(function(){
Contacts.UI.Card.editNew();
});
@@ -1175,9 +1155,6 @@ $(document).ready(function(){
return false;
});
- /**
- * Delete currently selected contact TODO: and clear page
- */
$('#contacts_deletecard').live('click',function(){
Contacts.UI.Card.delete();
});
diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js
index fe58a46d247..5908dd767a2 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 a38ab164977..01900b0b4b4 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 (; i<elementsLength; i++) {
- // Ignore elements that are not in the DOM tree
- if (!$.contains(documentElement, $elements[i])) {
+
+ for (var i in $elements) {
+ if (isNaN(parseInt(i))) {
continue;
}
@@ -72,13 +87,14 @@
visiblePartX,
visiblePartY,
visiblePartsMerged;
-
+
// Don't ask me why because I haven't figured out yet:
// viewportOffset and viewportSize are sometimes suddenly null in Firefox 5.
// Even though it sounds weird:
// It seems that the execution of this function is interferred by the onresize/onscroll event
// where viewportOffset and viewportSize are unset
if (!viewportOffset || !viewportSize) {
+ isFiring = false;
return;
}
@@ -100,7 +116,7 @@
$element.data('inview', false).trigger('inview', [false]);
}
}
- }
+ isFiring = false;
}
$(w).bind("scroll resize", function() {
diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php
index 016bd2b791a..ff348403a9b 100644
--- a/apps/contacts/lib/app.php
+++ b/apps/contacts/lib/app.php
@@ -53,7 +53,7 @@ class OC_Contacts_App {
OC_Log::write('contacts', 'Addressbook not found: '. $id, OC_Log::ERROR);
}
else {
- OC_Log::write('contacts', 'Addressbook('.$id.') is not from '.$OC_User::getUser(), OC_Log::ERROR);
+ OC_Log::write('contacts', 'Addressbook('.$id.') is not from '.OC_User::getUser(), OC_Log::ERROR);
}
OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('This is not your addressbook.')))); // Same here (as with the contact error). Could this error be improved?
exit();
diff --git a/apps/contacts/lib/search.php b/apps/contacts/lib/search.php
index 97638821007..5aad6a25f09 100644
--- a/apps/contacts/lib/search.php
+++ b/apps/contacts/lib/search.php
@@ -18,7 +18,7 @@ class OC_Search_Provider_Contacts extends OC_Search_Provider{
$vcards = OC_Contacts_VCard::all($addressbook['id']);
foreach($vcards as $vcard){
if(substr_count(strtolower($vcard['fullname']), strtolower($query)) > 0){
- $link = OC_Helper::linkTo('apps/contacts', 'index.php?id='.urlencode($vcard['id']));
+ $link = OC_Helper::linkTo('contacts', 'index.php').'?id='.urlencode($vcard['id']);
$results[]=new OC_Search_Result($vcard['fullname'],'', $link,$l->t('Contact'));//$name,$text,$link,$type
}
}
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index ece203bd458..0b8d95a2d97 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -103,6 +103,118 @@ class OC_Contacts_VCard{
return $result->fetchRow();
}
+ /**
+ * @brief Format property TYPE parameters for upgrading from v. 2.1
+ * @param $property Reference to a Sabre_VObject_Property.
+ * In version 2.1 e.g. a phone can be formatted like: TEL;HOME;CELL:123456789
+ * This has to be changed to either TEL;TYPE=HOME,CELL:123456789 or TEL;TYPE=HOME;TYPE=CELL:123456789 - both are valid.
+ */
+ public static function formatPropertyTypes(&$property) {
+ foreach($property->parameters as $key=>&$parameter){
+ $types = OC_Contacts_App::getTypesOfProperty($property->name);
+ if(is_array($types) && in_array(strtoupper($parameter->name), array_keys($types)) || strtoupper($parameter->name) == 'PREF') {
+ $property->parameters[] = new Sabre_VObject_Parameter('TYPE', $parameter->name);
+ }
+ unset($property->parameters[$key]);
+ }
+ }
+
+ /**
+ * @brief Decode properties for upgrading from v. 2.1
+ * @param $property Reference to a Sabre_VObject_Property.
+ * The only encoding allowed in version 3.0 is 'b' for binary. All encoded strings
+ * must therefor be decoded and the parameters removed.
+ */
+ public static function decodeProperty(&$property) {
+ // Check out for encoded string and decode them :-[
+ foreach($property->parameters as $key=>&$parameter){
+ if(strtoupper($parameter->name) == 'ENCODING') {
+ if(strtoupper($parameter->value) == 'QUOTED-PRINTABLE') { // what kind of other encodings could be used?
+ $property->value = quoted_printable_decode($property->value);
+ unset($property->parameters[$key]);
+ }
+ } elseif(strtoupper($parameter->name) == 'CHARSET') {
+ unset($property->parameters[$key]);
+ }
+ }
+ }
+
+ /**
+ * @brief Tries to update imported VCards to adhere to rfc2426 (VERSION: 3.0)
+ * @param vcard An OC_VObject of type VCARD (passed by reference).
+ */
+ protected static function updateValuesFromAdd(&$vcard) { // any suggestions for a better method name? ;-)
+ $stringprops = array('N', 'FN', 'ORG', 'NICK', 'ADR', 'NOTE');
+ $typeprops = array('ADR', 'TEL', 'EMAIL');
+ $upgrade = false;
+ $fn = $n = $uid = $email = null;
+ $version = $vcard->getAsString('VERSION');
+ // Add version if needed
+ if($version && $version < '3.0') {
+ $upgrade = true;
+ OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. Updating from version: '.$version,OC_Log::DEBUG);
+ }
+ foreach($vcard->children as &$property){
+ // Decode string properties and remove obsolete properties.
+ if($upgrade && in_array($property->name, $stringprops)) {
+ self::decodeProperty($property);
+ }
+ // Fix format of type parameters.
+ if($upgrade && in_array($property->name, $typeprops)) {
+ OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. before: '.$property->serialize(),OC_Log::DEBUG);
+ self::formatPropertyTypes($property);
+ OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. after: '.$property->serialize(),OC_Log::DEBUG);
+ }
+ if($property->name == 'FN'){
+ $fn = $property->value;
+ }
+ if($property->name == 'N'){
+ $n = $property->value;
+ }
+ if($property->name == 'UID'){
+ $uid = $property->value;
+ }
+ if($property->name == 'EMAIL' && is_null($email)){ // only use the first email as substitute for missing N or FN.
+ $email = $property->value;
+ }
+ }
+ // Check for missing 'N', 'FN' and 'UID' properties
+ if(!$fn) {
+ if($n && $n != ';;;;'){
+ $fn = join(' ', array_reverse(array_slice(explode(';', $n), 0, 2)));
+ } elseif($email) {
+ $fn = $email;
+ } else {
+ $fn = 'Unknown Name';
+ }
+ $vcard->setString('FN', $fn);
+ OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. Added missing \'FN\' field: '.$fn,OC_Log::DEBUG);
+ }
+ if(!$n || $n = ';;;;'){ // Fix missing 'N' field. Ugly hack ahead ;-)
+ $slice = array_reverse(array_slice(explode(' ', $fn), 0, 2)); // Take 2 first name parts of 'FN' and reverse.
+ if(count($slice) < 2) { // If not enought, add one more...
+ $slice[] = "";
+ }
+ $n = implode(';', $slice).';;;';
+ $vcard->setString('N', $n);
+ OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. Added missing \'N\' field: '.$n,OC_Log::DEBUG);
+ }
+ if(!$uid) {
+ $vcard->setUID();
+ OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. Added missing \'UID\' field: '.$uid,OC_Log::DEBUG);
+ }
+ $vcard->setString('VERSION','3.0');
+ // Add product ID is missing.
+ $prodid = trim($vcard->getAsString('PRODID'));
+ if(!$prodid) {
+ $appinfo = OC_App::getAppInfo('contacts');
+ $prodid = '-//ownCloud//NONSGML '.$appinfo['name'].' '.$appinfo['version'].'//EN';
+ $vcard->setString('PRODID', $prodid);
+ }
+ $now = new DateTime;
+ $vcard->setString('REV', $now->format(DateTime::W3C));
+ }
+
/**
* @brief Adds a card
* @param integer $id Addressbook id
@@ -114,58 +226,17 @@ class OC_Contacts_VCard{
$card = OC_VObject::parse($data);
if(!is_null($card)){
- $fn = $card->getAsString('FN');
- if(!$fn){ // Fix missing 'FN' field.
- $n = $card->getAsString('N');
- if(!is_null($n)){
- $fn = join(' ', array_reverse(array_slice(explode(';', $n), 0, 2)));
- $card->setString('FN', $fn);
- OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'FN\' field: '.$fn,OC_Log::DEBUG);
- } else {
- $fn = 'Unknown Name';
- }
- }
- $n = $card->getAsString('N');
- if(!$n){ // Fix missing 'N' field.
- $n = implode(';', array_reverse(array_slice(explode(' ', $fn), 0, 2))).';;;';
- $card->setString('N', $n);
- OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'N\' field: '.$n,OC_Log::DEBUG);
- }
- $uid = $card->getAsString('UID');
- if(!$uid){
- $card->setUID();
- $uid = $card->getAsString('UID');
- };
- $uri = $uid.'.vcf';
-
- // Add product ID.
- $prodid = trim($card->getAsString('PRODID'));
- if(!$prodid) {
- $appinfo = OC_App::getAppInfo('contacts');
- $prodid = '//ownCloud//NONSGML '.$appinfo['name'].' '.$appinfo['version'].'//EN';
- $card->setString('PRODID', $prodid);
- }
- // VCARD must have a version
- $version = $card->getAsString('VERSION');
- // Add version if needed
- if(!$version){
- $card->add(new Sabre_VObject_Property('VERSION','3.0'));
- //$data = $card->serialize();
- }/* else {
- OC_Log::write('contacts','OC_Contacts_VCard::add. Version already set as: '.$version,OC_Log::DEBUG);
- }*/
- $now = new DateTime;
- $card->setString('REV', $now->format(DateTime::W3C));
+ self::updateValuesFromAdd($card);
$data = $card->serialize();
}
else{
- // that's hard. Creating a UID and not saving it
OC_Log::write('contacts','OC_Contacts_VCard::add. Error parsing VCard: '.$data,OC_Log::ERROR);
return null; // Ditch cards that can't be parsed by Sabre.
- //$uid = self::createUID();
- //$uri = $uid.'.vcf';
};
+ $fn = $card->getAsString('FN');
+ $uid = $card->getAsString('UID');
+ $uri = $uid.'.vcf';
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
$newid = OC_DB::insertid('*PREFIX*contacts_cards');
@@ -183,54 +254,23 @@ class OC_Contacts_VCard{
* @return insertid
*/
public static function addFromDAVData($id,$uri,$data){
- $fn = $n = $uid = null;
- $email = null;
$card = OC_VObject::parse($data);
if(!is_null($card)){
- foreach($card->children as $property){
- if($property->name == 'FN'){
- $fn = $property->value;
- }
- if($property->name == 'N'){
- $n = $property->value;
- }
- if($property->name == 'UID'){
- $uid = $property->value;
- }
- if($property->name == 'EMAIL' && is_null($email)){
- $email = $property->value;
- }
- }
- }
- if(!$fn) {
- if($n){
- $fn = join(' ', array_reverse(array_slice(explode(';', $n), 0, 2)));
- } elseif($email) {
- $fn = $email;
- } else {
- $fn = 'Unknown Name';
- }
- $card->addProperty('FN', $fn);
- $data = $card->serialize();
- OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'FN\' field: '.$n,OC_Log::DEBUG);
- }
- if(!$n){ // Fix missing 'N' field.
- $n = implode(';', array_reverse(array_slice(explode(' ', $fn), 0, 2))).';;;';
- $card->setString('N', $n);
- $data = $card->serialize();
- OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'N\' field: '.$n,OC_Log::DEBUG);
- }
- if(!$uid) {
- $card->setUID();
+ self::updateValuesFromAdd($card);
$data = $card->serialize();
- }
+ } else {
+ OC_Log::write('contacts','OC_Contacts_VCard::addFromDAVData. Error parsing VCard: '.$data, OC_Log::ERROR);
+ return null; // Ditch cards that can't be parsed by Sabre.
+ };
+ $fn = $card->getAsString('FN');
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
+ $newid = OC_DB::insertid('*PREFIX*contacts_cards');
OC_Contacts_Addressbook::touch($id);
- return OC_DB::insertid('*PREFIX*contacts_cards');
+ return $newid;
}
/**
@@ -329,6 +369,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;
}
@@ -380,10 +421,14 @@ class OC_Contacts_VCard{
'checksum' => md5($property->serialize()));
foreach($property->parameters as $parameter){
// Faulty entries by kaddressbook
+ // Actually TYPE=PREF is correct according to RFC 2426
+ // but this way is more handy in the UI. Tanghus.
if($parameter->name == 'TYPE' && $parameter->value == 'PREF'){
$parameter->name = 'PREF';
$parameter->value = '1';
}
+ // NOTE: Apparently Sabre_VObject_Reader can't always deal with value list parameters
+ // like TYPE=HOME,CELL,VOICE. Tanghus.
if ($property->name == 'TEL' && $parameter->name == 'TYPE'){
if (isset($temp['parameters'][$parameter->name])){
$temp['parameters'][$parameter->name][] = $parameter->value;
diff --git a/apps/contacts/photo.php b/apps/contacts/photo.php
index 8dfbcb6fb10..298f1215e3c 100644
--- a/apps/contacts/photo.php
+++ b/apps/contacts/photo.php
@@ -13,10 +13,19 @@ require_once('../../lib/base.php');
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('contacts');
+function getStandardImage(){
+ OC_Response::setExpiresHeader('P10D');
+ OC_Response::enableCaching();
+ OC_Response::redirect(OC_Helper::imagePath('contacts', 'person_large.png'));
+}
+
$id = $_GET['id'];
$contact = OC_Contacts_App::getContactVCard($id);
$image = new OC_Image();
+if(!$image) {
+ getStandardImage();
+}
// invalid vcard
if( is_null($contact)) {
OC_Log::write('contacts','photo.php. The VCard for ID '.$id.' is not RFC compatible',OC_Log::ERROR);
@@ -45,7 +54,8 @@ if( is_null($contact)) {
}
if (!$image->valid()) {
// Not found :-(
- $image->loadFromFile('img/person_large.png');
+ getStandardImage();
+ //$image->loadFromFile('img/person_large.png');
}
header('Content-Type: '.$image->mimeType());
$image->show();
diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php
index 4c0dfad6177..e81597f23d6 100644
--- a/apps/contacts/templates/index.php
+++ b/apps/contacts/templates/index.php
@@ -1,5 +1,5 @@
<script type='text/javascript'>
- var totalurl = '<?php echo OC_Helper::linkTo('contacts', 'carddav.php', null, true); ?>/addressbooks';
+ var totalurl = '<?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?>/addressbooks';
</script>
<div id="controls">
<form>
diff --git a/apps/contacts/templates/part.contact.php b/apps/contacts/templates/part.contact.php
index 408b595dc95..5be20964f4b 100644
--- a/apps/contacts/templates/part.contact.php
+++ b/apps/contacts/templates/part.contact.php
@@ -70,14 +70,6 @@ $id = isset($_['id']) ? $_['id'] : '';
<input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
<input type="email" required="required" class="nonempty contacts_property" style="width:15em;" name="value" value="" x-moz-errormessage="<?php echo $l->t('Please specify a valid email address.'); ?>" placeholder="<?php echo $l->t('Enter email address'); ?>" /><span class="listactions"><a onclick="Contacts.UI.mailTo(this)" class="mail" title="<?php echo $l->t('Mail to address'); ?>"></a>
<a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete email address'); ?>"></a></span></li>
- <?php
- if(0) { /*foreach($card['EMAIL'] as $email) {*/
- ?>
- <li class="propertycontainer" style="white-space: nowrap;" data-checksum="<?php echo $email['checksum'] ?>" data-element="EMAIL">
- <input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" <?php echo (isset($email['parameters']['PREF'])?'checked="checked"':''); ?> />
- <input type="email" required="required" class="nonempty contacts_property" style="width:15em;" name="value" value="<?php echo $email['value'] ?>" placeholder="<?php echo $l->t('Enter email address'); ?>" /><span class="listactions"><a onclick="Contacts.UI.mailTo(this)" class="mail" title="<?php echo $l->t('Mail to address'); ?>"></a>
- <a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete email address'); ?>"></a></span></li>
- <?php } ?>
</ul><!-- a id="add_email" class="add" title="<?php echo $l->t('Add email address'); ?>"></a -->
</div> <!-- email addresses-->
@@ -93,17 +85,6 @@ $id = isset($_['id']) ? $_['id'] : '';
<?php echo html_select_options($_['phone_types'], array()) ?>
</select>
<a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete phone number'); ?>"></a></li>
- <?php
- if(0) { /*foreach($card['TEL'] as $phone) {*/
- ?>
- <li class="propertycontainer" style="white-space: nowrap;" data-checksum="<?php echo $phone['checksum'] ?>" data-element="TEL">
- <input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" <?php echo (isset($phone['parameters']['PREF'])?'checked="checked"':''); ?> />
- <input type="text" required="required" class="nonempty contacts_property" style="width:8em; border: 0px;" name="value" value="<?php echo $phone['value'] ?>" placeholder="<?php echo $l->t('Enter phone number'); ?>" />
- <select class="contacts_property" multiple="multiple" name="parameters[TYPE][]">
- <?php echo html_select_options($_['phone_types'], isset($phone['parameters']['TYPE'])?$phone['parameters']['TYPE']:array()) ?>
- </select>
- <a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete phone number'); ?>"></a></li>
- <?php } ?>
</ul><!-- a id="add_phone" class="add" title="<?php echo $l->t('Add phone number'); ?>"></a -->
</div> <!-- Phone numbers -->
@@ -118,40 +99,6 @@ $id = isset($_['id']) ? $_['id'] : '';
<span class="adr_type_label"></span><a class="globe" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.searchOSM(this);" title="<?php echo $l->t('View on map'); ?>"></a><a class="edit" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.editAddress(this, false);" title="<?php echo $l->t('Edit address details'); ?>"></a><a class="delete" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="Delete address"></a>
</dt><dd><ul class="addresslist"></ul></dd></dl>
- <?php if(0) { /*foreach($card['ADR'] as $address) {*/ ?>
- <dl class="addresscard propertycontainer" data-checksum="<?php echo $address['checksum']; ?>" data-element="ADR">
- <dt>
- <input class="adr contacts_property" name="value" type="hidden" value="<?php echo implode(';',$address['value']); ?>" />
- <input type="hidden" class="adr_type contacts_property" name="parameters[TYPE][]" value="<?php echo strtoupper(implode(',',$address['parameters'])); ?>" />
- <span class="adr_type_label">
- <?php
- if(count($address['parameters']) > 0) {
- //array_walk($address['parameters'], ) Nah, this wont work...
- $translated = array();
- foreach($address['parameters'] as $type) {
- $translated[] = $l->t(ucwords(strtolower($type)));
- }
- echo implode('/', $translated);
- }
- ?></span><a class="globe" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.searchOSM(this);" title="<?php echo $l->t('View on map'); ?>"></a><a class="edit" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.editAddress(this, false);" title="<?php echo $l->t('Edit address details'); ?>"></a><a class="delete" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="Delete address"></a>
- </dt>
- <dd>
- <ul class="addresslist">
- <?php
- $adr = $address['value'];
- $tmp = ($adr[0]?'<li>'.$adr[0].'</li>':'');
- $tmp .= ($adr[1]?'<li>'.$adr[1].'</li>':'');
- $tmp .= ($adr[2]?'<li>'.$adr[2].'</li>':'');
- $tmp .= ($adr[3]||$adr[5]?'<li>'.$adr[5].' '.$adr[3].'</li>':'');
- $tmp .= ($adr[4]?'<li>'.$adr[4].'</li>':'');
- $tmp .= ($adr[6]?'<li>'.$adr[6].'</li>':'');
- echo $tmp;
-
- ?>
- </ul>
- </dd>
- </dl>
- <?php } ?>
</fieldset>
</div>
</div> <!-- Addresses -->
diff --git a/apps/contacts/templates/part.contactphoto.php b/apps/contacts/templates/part.contactphoto.php
index 7d7ab237561..9e3f5876cd1 100644
--- a/apps/contacts/templates/part.contactphoto.php
+++ b/apps/contacts/templates/part.contactphoto.php
@@ -3,7 +3,7 @@ $id = $_['id'];
$wattr = isset($_['width'])?'width="'.$_['width'].'"':'';
$hattr = isset($_['height'])?'height="'.$_['height'].'"':'';
?>
-<img class="loading" id="contacts_details_photo" <?php echo $wattr; ?> <?php echo $hattr; ?> src="<?php echo OC_Helper::linkTo('contacts', 'photo.php', null, true); ?>?id=<?php echo $id; ?>&amp;refresh=<?php echo rand(); ?>" />
+<img class="loading" id="contacts_details_photo" <?php echo $wattr; ?> <?php echo $hattr; ?> src="<?php echo OC_Helper::linkToAbsolute('contacts', 'photo.php'); ?>?id=<?php echo $id; ?>&amp;refresh=<?php echo rand(); ?>" />
<progress id="contacts_details_photo_progress" style="display:none;" value="0" max="100">0 %</progress>
diff --git a/apps/contacts/templates/part.cropphoto.php b/apps/contacts/templates/part.cropphoto.php
index cb416f0e415..5faa4aa6ac6 100644
--- a/apps/contacts/templates/part.cropphoto.php
+++ b/apps/contacts/templates/part.cropphoto.php
@@ -38,13 +38,13 @@ OC_Log::write('contacts','templates/part.cropphoto.php: tmp_path: '.$tmp_path.',
return true;
});*/
</script>
-<img id="cropbox" src="<?php echo OC_Helper::linkTo('contacts', 'dynphoto.php', null, true); ?>?tmp_path=<?php echo urlencode($tmp_path); ?>" />
+<img id="cropbox" src="<?php echo OC_Helper::linkToAbsolute('contacts', 'dynphoto.php'); ?>?tmp_path=<?php echo urlencode($tmp_path); ?>" />
<form id="cropform"
class="coords"
method="post"
enctype="multipart/form-data"
target="crop_target"
- action="<?php echo OC_Helper::linkTo('contacts', 'ajax/savecrop.php', null, true); ?>">
+ action="<?php echo OC_Helper::linkToAbsolute('contacts', 'ajax/savecrop.php'); ?>">
<input type="hidden" id="id" name="id" value="<?php echo $id; ?>" />
<input type="hidden" id="tmp_path" name="tmp_path" value="<?php echo $tmp_path; ?>" />
diff --git a/apps/contacts/templates/settings.php b/apps/contacts/templates/settings.php
index c647e44c25b..8673e4521d9 100644
--- a/apps/contacts/templates/settings.php
+++ b/apps/contacts/templates/settings.php
@@ -2,6 +2,6 @@
<fieldset class="personalblock">
<strong><?php echo $l->t('Contacts'); ?></strong><br />
<?php echo $l->t('CardDAV syncing address:'); ?>
- <?php echo OC_Helper::linkTo('apps/contacts', 'carddav.php', null, true); ?><br />
+ <?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?><br />
</fieldset>
</form>
diff --git a/apps/files_pdfviewer/appinfo/info.xml b/apps/files_pdfviewer/appinfo/info.xml
index 86a6c3f22f7..f133f1900d7 100755
--- a/apps/files_pdfviewer/appinfo/info.xml
+++ b/apps/files_pdfviewer/appinfo/info.xml
@@ -1,7 +1,8 @@
<?xml version="1.0"?>
<info>
<id>files_pdfviewer</id>
- <name>PDF viewer (pdfjs-based)</name>
+ <name>PDF Viewer</name>
+ <description>Inline PDF viewer (pdfjs-based)</description>
<version>0.1</version>
<licence>GPL</licence>
<author>Joan Creus</author>
diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php
index 51fda6aed40..ba01adffb9a 100644
--- a/apps/files_sharing/ajax/getitem.php
+++ b/apps/files_sharing/ajax/getitem.php
@@ -8,6 +8,7 @@ require_once('../lib_share.php');
$userDirectory = "/".OC_User::getUser()."/files";
$source = $userDirectory.$_GET['source'];
$path = $source;
+$users = array();
if ($users = OC_Share::getMySharedItem($source)) {
for ($i = 0; $i < count($users); $i++) {
if ($users[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
@@ -19,7 +20,6 @@ $source = dirname($source);
while ($source != "" && $source != "/" && $source != "." && $source != $userDirectory) {
if ($values = OC_Share::getMySharedItem($source)) {
$values = array_values($values);
- $users = array();
$parentUsers = array();
for ($i = 0; $i < count($values); $i++) {
if ($values[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
diff --git a/apps/files_sharing/css/sharing.css b/apps/files_sharing/css/sharing.css
index 0759af2c274..db59a3d340b 100644
--- a/apps/files_sharing/css/sharing.css
+++ b/apps/files_sharing/css/sharing.css
@@ -5,4 +5,5 @@
#shared_list { padding:0.5em; list-style-type: none; }
#public { border-top:1px solid #ddd; padding-top:0.5em; }
a.unshare { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; opacity:.5; }
-a.unshare:hover { opacity:1; } \ No newline at end of file
+a.unshare:hover { opacity:1; }
+#share_with { width: 16em; } \ No newline at end of file
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index d01a07447a6..fc9e17c25c7 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -174,7 +174,7 @@ $(document).ready(function() {
function createDropdown(filename, files) {
var html = '<div id="dropdown" class="drop" data-file="'+files+'">';
html += '<div id="private">';
- html += '<select data-placeholder="User or Group" style="width:220px;" id="share_with" class="chzen-select">';
+ html += '<select data-placeholder="User or Group" id="share_with" class="chzen-select">';
html += '<option value=""></option>';
html += '</select>';
html += '<ul id="shared_list"></ul>';
diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php
index 049a74278b3..42739bdfba9 100644
--- a/apps/files_sharing/lib_share.php
+++ b/apps/files_sharing/lib_share.php
@@ -88,12 +88,15 @@ class OC_Share {
$uid = $uid."@".$gid;
}
$query->execute(array($uid_owner, $uid, $source, $target, $permissions));
- // Clear the folder size cache for the 'Shared' folder
-// $clearFolderSize = OC_DB::prepare("DELETE FROM *PREFIX*foldersize WHERE path = ?");
-// $clearFolderSize->execute(array($sharedFolder));
- // Emit post_create and post_write hooks to notify of a new file in the user's filesystem
- OC_Hook::emit("OC_Filesystem", "post_create", array('path' => $target));
- OC_Hook::emit("OC_Filesystem", "post_write", array('path' => $target));
+ // Add file to filesystem cache
+ $userDirectory = "/".OC_User::getUser()."/files";
+ $data = OC_Filecache::get(substr($source, strlen($userDirectory)));
+ $parentQuery = OC_DB::prepare('SELECT id FROM *PREFIX*fscache WHERE path=?');
+ $parentResult = $parentQuery->execute(array($sharedFolder))->fetchRow();
+ $parent = $parentResult['id'];
+ $is_writeable = $permissions & OC_Share::WRITE;
+ $cacheQuery = OC_DB::prepare('INSERT INTO *PREFIX*fscache(parent, name, path, size, mtime, ctime, mimetype, mimepart, user, writable) VALUES(?,?,?,?,?,?,?,?,?,?)');
+ $cacheQuery->execute(array($parent, basename($target), $target, $data['size'], $data['mtime'], $data['ctime'], $data['mimetype'], dirname($data['mimetype']), $uid, $is_writeable));
}
}
}
diff --git a/apps/files_texteditor/css/style.css b/apps/files_texteditor/css/style.css
index cf24950232f..e260ab0dd46 100644
--- a/apps/files_texteditor/css/style.css
+++ b/apps/files_texteditor/css/style.css
@@ -1,8 +1,8 @@
#editor{
- position: absoloute;
+ position: fixed;
display: block;
- top: 80px;
- left: 160px;
+ top: 6.5em;
+ left: 12.5em;
}
#editorwrapper{
position: absoloute;
diff --git a/apps/files_texteditor/js/editor.js b/apps/files_texteditor/js/editor.js
index 7473d532304..e45652b6ef3 100644
--- a/apps/files_texteditor/js/editor.js
+++ b/apps/files_texteditor/js/editor.js
@@ -172,6 +172,7 @@ function giveEditorFocus(){
function showFileEditor(dir,filename){
if(!editorIsShown()){
// Loads the file editor and display it.
+ $('#content').append('<div id="editor"></div>');
var data = $.getJSON(
OC.filePath('files_texteditor','ajax','loadfile.php'),
{file:filename,dir:dir},
@@ -273,10 +274,10 @@ $(document).ready(function(){
var dir=text.substr(0,text.length-file.length-1);
showFileEditor(dir,file);
});
- }
+ };
// Binds the file save and close editor events, and gotoline button
bindControlEvents();
-
+ $('#editor').remove();
// Binds the save keyboard shortcut events
//$(document).unbind('keydown').bind('keydown',checkForSaveKeyPress);
});
diff --git a/apps/gallery/appinfo/app.php b/apps/gallery/appinfo/app.php
index da872274497..b8de32ea587 100644
--- a/apps/gallery/appinfo/app.php
+++ b/apps/gallery/appinfo/app.php
@@ -46,7 +46,7 @@ OC_App::addNavigationEntry( array(
$result = $stmt->execute(array(OC_User::getUser(),'%'.$query.'%'));
$results=array();
while($row=$result->fetchRow()){
- $results[]=new OC_Search_Result($row['album_name'],'',OC_Helper::linkTo('apps/gallery', 'index.php?view='.$row['album_name']),'Galleries');
+ $results[]=new OC_Search_Result($row['album_name'],'',OC_Helper::linkTo('gallery', 'index.php').'?view='.$row['album_name'],'Galleries');
}
return $results;
}
diff --git a/apps/gallery/css/styles.css b/apps/gallery/css/styles.css
index c039cd5ec02..da94f9ac9e5 100644
--- a/apps/gallery/css/styles.css
+++ b/apps/gallery/css/styles.css
@@ -1,8 +1,8 @@
-div#gallery_list { margin: 70pt 20pt 0 20pt; }
+div#gallery_list { margin: 4.5em 2em 0 2em; }
div#gallery_list.leftcontent { padding-top: 15pt; margin: 0; position: absolute; bottom:0px; text-align: center; overflow: auto; }
-div.gallery_album_box { width: 200px; position:relative; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 20px 5px 5px 5px; position: relative; -webkit-transition: color 0.5s ease-in-out; -o-transition: color 0.5s ease-in-out; -moz-transition: color 0.5s ease-in-out;color: #BBB;}
+div.gallery_album_box { width: 200px; position:relative; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 5px 5px 5px 5px; position: relative; -webkit-transition: color 0.5s ease-in-out; -o-transition: color 0.5s ease-in-out; -moz-transition: color 0.5s ease-in-out;color: #BBB;}
div.gallery_album_box h1 { font-size: 9pt; font-family: Verdana; }
-div.gallery_album_decoration { width: 200px; position: absolute; border: 0; height: 20px; top: 20px; text-align:right; vertical-align:middle; background-color: #eee; opacity: 0; -webkit-transition: opacity 0.5s ease-in-out; -moz-transition: opacity 0.5s ease-in-out; -o-transition: opacity 0.5s ease-in-out; border-bottom-right-radius: 7px; border-bottom-left-radius: 7px; -moz-border-radius-bottomright: 7px; -moz-border-radius-bottomleft:7px;}
+div.gallery_album_decoration { width: 200px; position: absolute; border: 0; height: 20px; top: 5px; text-align:right; vertical-align:middle; background-color: #eee; opacity: 0; -webkit-transition: opacity 0.5s ease-in-out; -moz-transition: opacity 0.5s ease-in-out; -o-transition: opacity 0.5s ease-in-out; border-bottom-right-radius: 7px; border-bottom-left-radius: 7px; -moz-border-radius-bottomright: 7px; -moz-border-radius-bottomleft:7px;}
div.gallery_album_box:hover { color: black; }
div.gallery_album_box:hover div.gallery_album_decoration { opacity: 0.7;}
div.gallery_album_decoration a {padding: 0 4pt; cursor: pointer;}
diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php
index 4eb313bfc33..872ecc9488a 100644
--- a/apps/gallery/lib/photo.php
+++ b/apps/gallery/lib/photo.php
@@ -69,7 +69,6 @@ class OC_Gallery_Photo {
public static function getThumbnail($image_name) {
$save_dir = OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery/';
$save_dir .= dirname($image_name). '/';
- $image_name = basename($image_name);
$thumb_file = $save_dir . $image_name;
if (file_exists($thumb_file)) {
$image = new OC_Image($thumb_file);
diff --git a/apps/media/css/music.css b/apps/media/css/music.css
index 91da9ec40e7..07173624018 100644
--- a/apps/media/css/music.css
+++ b/apps/media/css/music.css
@@ -17,7 +17,7 @@ a.jp-mute,a.jp-unmute { left:24em; }
div.jp-volume-bar { position:absolute; overflow:hidden; background:#eee; width:4em; height:0.4em; cursor:pointer; top:1.3em; left:27em; }
div.jp-volume-bar-value { background:#ccc; width:0; height:0.4em; }
-#collection { padding-top:1em; position:relative; width:100%; float:left; table-layout:fixed; }
+#collection { position:relative; width:100%; float:left; table-layout:fixed; }
#collection td { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#leftcontent img.remove { display:none; float:right; cursor:pointer; opacity: 0; }
#leftcontent li:hover img.remove { display:inline; opacity: .3; }
@@ -31,7 +31,7 @@ div.jp-volume-bar-value { background:#ccc; width:0; height:0.4em; }
#collection td.artist-expander, #collection td.album-expander { width:2em; text-align:center; }
td.artist a.expander, td.album a.expander { float:right; padding:0 1em; }
tr.active td { background-color:#eee; font-weight:bold; }
-tr td { border-top:1px solid #eee; height:2.2em; }
+tr td { border-bottom:1px solid #eee; height:2.2em; }
tr .artist img { vertical-align:middle; }
tr.album td.artist { padding-left:1em; }
tr.song td.artist { padding-left:2em; }
diff --git a/apps/media/js/collection.js b/apps/media/js/collection.js
index 2249acf3cc4..753785f77b0 100644
--- a/apps/media/js/collection.js
+++ b/apps/media/js/collection.js
@@ -1,3 +1,5 @@
+var initScanned = false;
+
Collection={
artists:[],
albums:[],
@@ -68,10 +70,10 @@ Collection={
for(var i=0;i<Collection.loadedListeners.length;i++){
Collection.loadedListeners[i]();
}
- if(data.songs.length==0){
+ if(data.songs.length==0 && initScanned == false){
$('#scan input.start').click();
+ initScanned = true;
}
-
}
});
}
@@ -81,13 +83,11 @@ Collection={
Collection.parent.show();
}
if(!Collection.loaded){
- Collection.load(Collection.display)
+ Collection.load(Collection.display);
}else{
if(Collection.parent){
Collection.parent.find('tr:not(.template)').remove();
var template=Collection.parent.find('tr.template');
- var lastArtist='';
- var lastAlbum='';
$.each(Collection.artists,function(i,artist){
if(artist.name && artist.songs.length>0){
var tr=template.clone().removeClass('template');
@@ -108,7 +108,7 @@ Collection={
$('tr[data-artist="'+artist.name+'"]').addClass('active');
});
if(artist.songs.length>1){
- var expander=$('<a class="expander">&gt;</a>');
+ expander=$('<a class="expander">&gt;</a>');
expander.data('expanded',false);
expander.click(function(event){
var tr=$(this).parent().parent();
@@ -136,10 +136,11 @@ Collection={
var first=true;
$.each(artist.albums,function(j,album){
$.each(album.songs,function(i,song){
+ var newRow;
if(first){
newRow=tr;
}else{
- var newRow=tr.clone();
+ newRow=tr.clone();
newRow.find('td.artist').text('');
newRow.find('.expander').remove();
}
@@ -221,13 +222,14 @@ Collection={
tr.find('td.album-expander a.expander').addClass('expanded');
tr.find('td.album-expander a.expander').text('v');
$.each(albumData.songs,function(i,song){
+ var newRow;
if(i>0){
- var newRow=tr.clone();
+ newRow=tr.clone();
newRow.find('a.expander').remove();
newRow.find('td.album a').text('');
newRow.find('td.artist a').text('');
}else{
- var newRow=tr;
+ newRow=tr;
}
newRow.find('td.title a').text(song.name);
newRow.find('td.title a').click(function(event){
@@ -339,11 +341,11 @@ Collection={
path:song.song_path,
playCount:song.song_playcount,
};
- album.songs.push(songData)
+ album.songs.push(songData);
artist.songs.push(songData);
Collection.songs.push(songData);
}
-}
+};
$(document).ready(function(){
Collection.parent=$('#collection');
diff --git a/apps/media/js/loader.js b/apps/media/js/loader.js
index 055f858ae16..a832180d1e3 100644
--- a/apps/media/js/loader.js
+++ b/apps/media/js/loader.js
@@ -1,7 +1,7 @@
function musicTypeFromFile(file){
var extention=file.substr(file.indexOf('.')+1);
if(extention=='ogg'){
- return 'oga'
+ return 'oga';
}
//TODO check for more specific cases
return extention;
@@ -39,7 +39,7 @@ function loadPlayer(type,ready){
}
$(document).ready(function() {
- loadPlayer.done=false
+ loadPlayer.done=false;
// FileActions.register('audio','Add to playlist','',addAudio);
// FileActions.register('application/ogg','Add to playlist','',addAudio);
diff --git a/apps/media/js/music.js b/apps/media/js/music.js
index 3373cbac257..1ffe4e10087 100644
--- a/apps/media/js/music.js
+++ b/apps/media/js/music.js
@@ -16,7 +16,7 @@ $(document).ready(function(){
PlayList.render();
});
var button=$('<input type="button" title="'+t('media','Add album to playlist')+'" class="add"></input>');
- button.css('background-image','url('+OC.imagePath('core','actions/play-add')+')')
+ button.css('background-image','url('+OC.imagePath('core','actions/play-add')+')');
button.click(function(event){
event.stopPropagation();
PlayList.add(media);
@@ -24,7 +24,7 @@ $(document).ready(function(){
});
row.find('div.name').append(button);
button.tipsy({gravity:'n', fade:true, delayIn: 400, live:true});
- }
+ };
Collection.display();
Collection.load(function(){
@@ -34,11 +34,9 @@ $(document).ready(function(){
PlayList.add(song);
PlayList.play(0);
}
- })
+ });
});
-
-
function getUrlVars(){
var vars = {}, hash;
var hashes = window.location.hash.substr(1).split('&');
@@ -52,8 +50,8 @@ function getUrlVars(){
function musicTypeFromFile(file){
var extention=file.split('.').pop();
if(extention=='ogg'){
- return 'oga'
+ return 'oga';
}
//TODO check for more specific cases
return extention;
-} \ No newline at end of file
+}
diff --git a/apps/media/js/playlist.js b/apps/media/js/playlist.js
index 089065989ae..8e9e2a91537 100644
--- a/apps/media/js/playlist.js
+++ b/apps/media/js/playlist.js
@@ -26,19 +26,19 @@ PlayList.render=function(){
li.click(function(event){
PlayList.play($(this).data('index'));
});
- li.append(img)
+ li.append(img);
li.data('index',i);
li.addClass('song');
PlayList.parent.append(li);
}
$(".jp-playlist-" + PlayList.current).addClass("collection_playing");
-}
+};
PlayList.getSelected=function(){
return $('tbody td.name input:checkbox:checked').parent().parent();
-}
+};
PlayList.hide=function(){
$('#playlist').hide();
-}
+};
$(document).ready(function(){
PlayList.parent=$('#leftcontent');
diff --git a/apps/media/js/scanner.js b/apps/media/js/scanner.js
index 0baa9db419a..6c991b60d52 100644
--- a/apps/media/js/scanner.js
+++ b/apps/media/js/scanner.js
@@ -6,7 +6,7 @@ Scanner={
$.getJSON(OC.linkTo('media','ajax/api.php')+'?action=find_music',function(songs){
Scanner.songsFound=songs.length;
if(ready){
- ready(songs)
+ ready(songs);
}
});
},
@@ -24,13 +24,13 @@ Scanner={
Scanner.songsScanned=data.count;
$('#scan span.songCount').text(Scanner.songsScanned);
var progress=(Scanner.songsScanned/Scanner.songsFound)*100;
- $('#scanprogressbar').progressbar('value',progress)
+ $('#scanprogressbar').progressbar('value',progress);
});
Scanner.eventSource.listen('done',function(count){
$('#scan input.start').show();
$('#scan input.stop').hide();
$('#scanprogressbar').hide();
- Collection.load(Collection.display)
+ Collection.load(Collection.display);
if(ready){
ready();
}
@@ -41,4 +41,4 @@ Scanner={
Scanner.close();
},
-}
+};
diff --git a/apps/media/lib_ampache.php b/apps/media/lib_ampache.php
index 138b65d1fd7..97c09308607 100644
--- a/apps/media/lib_ampache.php
+++ b/apps/media/lib_ampache.php
@@ -207,7 +207,7 @@ class OC_MEDIA_AMPACHE{
echo("\t\t<title>$name</title>\n");
echo("\t\t<artist id='$artist'>$artistName</artist>\n");
echo("\t\t<album id='$album'>$albumName</album>\n");
- $url=OC_Helper::linkTo('media', 'server/xml.server.php', null, true)."?action=play&song=$id&auth={$_GET['auth']}";
+ $url=OC_Helper::linkToAbsolute('media', 'server/xml.server.php')."?action=play&song=$id&auth={$_GET['auth']}";
$url=self::fixXmlString($url);
echo("\t\t<url>$url</url>\n");
echo("\t\t<time>{$song['song_length']}</time>\n");
diff --git a/apps/media/lib_media.php b/apps/media/lib_media.php
index 0ade0e593dc..1bcd0f08c80 100644
--- a/apps/media/lib_media.php
+++ b/apps/media/lib_media.php
@@ -89,18 +89,18 @@ class OC_MediaSearchProvider extends OC_Search_Provider{
$songs=OC_MEDIA_COLLECTION::getSongs(0,0,$query);
$results=array();
foreach($artists as $artist){
- $results[]=new OC_Search_Result($artist['artist_name'],'',OC_Helper::linkTo( 'apps/media', 'index.php#artist='.urlencode($artist['artist_name']) ),'Music');
+ $results[]=new OC_Search_Result($artist['artist_name'],'',OC_Helper::linkTo( 'media', 'index.php').'#artist='.urlencode($artist['artist_name']),'Music');
}
foreach($albums as $album){
$artist=OC_MEDIA_COLLECTION::getArtistName($album['album_artist']);
- $results[]=new OC_Search_Result($album['album_name'],'by '.$artist,OC_Helper::linkTo( 'apps/media', 'index.php#artist='.urlencode($artist).'&album='.urlencode($album['album_name']) ),'Music');
+ $results[]=new OC_Search_Result($album['album_name'],'by '.$artist,OC_Helper::linkTo( 'media', 'index.php').'#artist='.urlencode($artist).'&album='.urlencode($album['album_name']),'Music');
}
foreach($songs as $song){
$minutes=floor($song['song_length']/60);
$secconds=$song['song_length']%60;
$artist=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']);
$album=OC_MEDIA_COLLECTION::getalbumName($song['song_album']);
- $results[]=new OC_Search_Result($song['song_name'],"by $artist, in $album $minutes:$secconds",OC_Helper::linkTo( 'apps/media', 'index.php#artist='.urlencode($artist).'&album='.urlencode($album).'&song='.urlencode($song['song_name']) ),'Music');
+ $results[]=new OC_Search_Result($song['song_name'],"by $artist, in $album $minutes:$secconds",OC_Helper::linkTo( 'media', 'index.php').'#artist='.urlencode($artist).'&album='.urlencode($album).'&song='.urlencode($song['song_name']),'Music');
}
return $results;
}
diff --git a/apps/media/templates/settings.php b/apps/media/templates/settings.php
index ac813c20850..2907c616cf6 100644
--- a/apps/media/templates/settings.php
+++ b/apps/media/templates/settings.php
@@ -2,6 +2,6 @@
<fieldset class="personalblock">
<strong>Media</strong><br />
Ampache address:
- <?php echo OC_Helper::linkTo('apps/media', '', null, true); ?><br />
+ <?php echo OC_Helper::linkToAbsolute('media', ''); ?><br />
</fieldset>
</form>
diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php
index 3261708f590..5c56ca8191e 100644
--- a/apps/user_ldap/appinfo/app.php
+++ b/apps/user_ldap/appinfo/app.php
@@ -32,13 +32,13 @@ define('OC_USER_BACKEND_LDAP_DEFAULT_PORT', 389);
define('OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME', 'uid');
// register user backend
-OC_User::useBackend( "LDAP" );
+OC_User::useBackend( 'LDAP' );
// add settings page to navigation
$entry = array(
- 'id' => "user_ldap_settings",
+ 'id' => 'user_ldap_settings',
'order'=>1,
- 'href' => OC_Helper::linkTo( "user_ldap", "settings.php" ),
+ 'href' => OC_Helper::linkTo( 'user_ldap', 'settings.php' ),
'name' => 'LDAP'
);
// OC_App::addNavigationSubEntry( "core_users", $entry);
diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php
index 2abb0b47291..5bbd5d4008d 100644
--- a/apps/user_ldap/templates/settings.php
+++ b/apps/user_ldap/templates/settings.php
@@ -12,6 +12,9 @@
<small><?php echo $l->t('Currently the display name field needs to be the same you matched %%uid against in the filter above, because ownCloud doesn\'t distinguish between user id and user name.');?></small></p>
<p><input type="checkbox" id="ldap_tls" name="ldap_tls" value="1"<?php if ($_['ldap_tls']) echo ' checked'; ?>><label for="ldap_tls"><?php echo $l->t('Use TLS');?></label></p>
<p><input type="checkbox" id="ldap_nocase" name="ldap_nocase" value="1"<?php if ($_['ldap_nocase']) echo ' checked'; ?>><label for="ldap_nocase"><?php echo $l->t('Case insensitve LDAP server (Windows)');?></label></p>
+ <p><label for="ldap_quota">Quota Attribute</label><input type="text" id="ldap_quota" name="ldap_quota" value="<?php echo $_['ldap_quota']; ?>" />
+ <label for="ldap_quota_def">Quota Default</label><input type="text" id="ldap_quota_def" name="ldap_quota_def" value="<?php echo $_['ldap_quota_def']; ?>" />bytes</p>
+ <p><label for="ldap_email">Email Attribute</label><input type="text" id="ldap_email" name="ldap_email" value="<?php echo $_['ldap_email']; ?>" /></p>
<input type="submit" value="Save" />
</fieldset>
</form>
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 106240e74b8..670d938ea95 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -36,6 +36,12 @@ class OC_USER_LDAP extends OC_User_Backend {
protected $ldap_tls;
protected $ldap_nocase;
protected $ldap_display_name;
+ protected $ldap_quota;
+ protected $ldap_quota_def;
+ protected $ldap_email;
+
+ // will be retrieved from LDAP server
+ protected $ldap_dc = false;
function __construct() {
$this->ldap_host = OC_Appconfig::getValue('user_ldap', 'ldap_host','');
@@ -47,6 +53,9 @@ class OC_USER_LDAP extends OC_User_Backend {
$this->ldap_tls = OC_Appconfig::getValue('user_ldap', 'ldap_tls', 0);
$this->ldap_nocase = OC_Appconfig::getValue('user_ldap', 'ldap_nocase', 0);
$this->ldap_display_name = OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME);
+ $this->ldap_quota_attr = OC_Appconfig::getValue('user_ldap', 'ldap_quota_attr','');
+ $this->ldap_quota_def = OC_Appconfig::getValue('user_ldap', 'ldap_quota_def','');
+ $this->ldap_email_attr = OC_Appconfig::getValue('user_ldap', 'ldap_email_attr','');
if( !empty($this->ldap_host)
&& !empty($this->ldap_port)
@@ -66,6 +75,28 @@ class OC_USER_LDAP extends OC_User_Backend {
ldap_unbind($this->ds);
}
+ private function setQuota( $uid ) {
+ if( !$this->ldap_dc )
+ return false;
+
+ $quota = $this->ldap_dc[$this->ldap_quota_attr][0];
+ $quota = $quota != -1 ? $quota : $this->ldap_quota_def;
+ OC_Preferences::setValue($uid, 'files', 'quota', $quota);
+ }
+
+ private function setEmail( $uid ) {
+ if( !$this->ldap_dc )
+ return false;
+
+ $email = OC_Preferences::getValue($uid, 'settings', 'email', '');
+ if ( !empty( $email ) )
+ return false;
+
+ $email = $this->ldap_dc[$this->ldap_email_attr][0];
+ OC_Preferences::setValue($uid, 'settings', 'email', $email);
+ }
+
+ //Connect to LDAP and store the resource
private function getDs() {
if(!$this->ds) {
$this->ds = ldap_connect( $this->ldap_host, $this->ldap_port );
@@ -74,18 +105,19 @@ class OC_USER_LDAP extends OC_User_Backend {
if($this->ldap_tls)
ldap_start_tls($this->ds);
}
-
+ //TODO: Not necessary to perform a bind each time, is it?
// login
if(!empty($this->ldap_dn)) {
$ldap_login = @ldap_bind( $this->ds, $this->ldap_dn, $this->ldap_password );
- if(!$ldap_login)
+ if(!$ldap_login) {
return false;
+ }
}
return $this->ds;
}
- private function getDn( $uid ) {
+ private function getDc( $uid ) {
if(!$this->configured)
return false;
@@ -99,31 +131,43 @@ class OC_USER_LDAP extends OC_User_Backend {
$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
$entries = ldap_get_entries( $this->getDs(), $sr );
- if( $entries['count'] == 0 )
+ if( $entries['count'] == 0 ) {
return false;
+ }
+
+ $this->ldap_dc = $entries[0];
- return $entries[0]['dn'];
+ return $this->ldap_dc;
}
public function checkPassword( $uid, $password ) {
if(!$this->configured){
return false;
}
- $dn = $this->getDn( $uid );
- if( !$dn )
+ $dc = $this->getDc( $uid );
+ if( !$dc )
return false;
- if (!@ldap_bind( $this->getDs(), $dn, $password ))
+ if (!@ldap_bind( $this->getDs(), $dc['dn'], $password )) {
return false;
-
+ }
+
+ if(!empty($this->ldap_quota) && !empty($this->ldap_quota_def)) {
+ $this->setQuota($uid);
+ }
+
+ if(!empty($this->ldap_email_attr)) {
+ $this->setEmail($uid);
+ }
+
if($this->ldap_nocase) {
$filter = str_replace('%uid', $uid, $this->ldap_filter);
$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
$entries = ldap_get_entries( $this->getDs(), $sr );
if( $entries['count'] == 1 ) {
foreach($entries as $row) {
- $ldap_display_name = strtolower($this->ldap_display_name);
- if(isset($row[$ldap_display_name])) {
+ $ldap_display_name = strtolower($this->ldap_display_name);
+ if(isset($row[$ldap_display_name])) {
return $row[$ldap_display_name][0];
}
}
@@ -131,12 +175,12 @@ class OC_USER_LDAP extends OC_User_Backend {
else {
return $uid;
}
-
+
}
else {
return $uid;
}
-
+
}
public function userExists( $uid ) {
@@ -146,17 +190,17 @@ class OC_USER_LDAP extends OC_User_Backend {
$dn = $this->getDn($uid);
return !empty($dn);
}
-
+
public function getUsers()
{
if(!$this->configured)
return false;
-
+
// connect to server
$ds = $this->getDs();
if( !$ds )
return false;
-
+
// get users
$filter = 'objectClass=person';
$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
@@ -169,7 +213,7 @@ class OC_USER_LDAP extends OC_User_Backend {
// TODO ldap_get_entries() seems to lower all keys => needs review
$ldap_display_name = strtolower($this->ldap_display_name);
if(isset($row[$ldap_display_name])) {
- $users[] = $row[$ldap_display_name][0];
+ $users[] = $row[$ldap_display_name][0];
}
}
// TODO language specific sorting of user names
diff --git a/apps/user_openid/appinfo/app.php b/apps/user_openid/appinfo/app.php
index 912019a9700..cbcbe544221 100644
--- a/apps/user_openid/appinfo/app.php
+++ b/apps/user_openid/appinfo/app.php
@@ -14,8 +14,8 @@ if(strpos($_SERVER["REQUEST_URI"],'?') and !strpos($_SERVER["REQUEST_URI"],'='))
}
}
-OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$userName));
-OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$userName));
+OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$userName));
+OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$userName));
OC_APP::registerPersonal('user_openid','settings');
diff --git a/apps/user_openid/user.php b/apps/user_openid/user.php
index a267e020507..8fec713aa71 100644
--- a/apps/user_openid/user.php
+++ b/apps/user_openid/user.php
@@ -43,7 +43,7 @@ if(!OC_User::userExists($USERNAME)){
OC_Log::write('user_openid',$USERNAME.' doesn\'t exist',OC_Log::WARN);
$USERNAME='';
}
-$IDENTITY=OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$USERNAME;
+$IDENTITY=OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$USERNAME;
require_once 'phpmyid.php';
diff --git a/config/config.sample.php b/config/config.sample.php
index cd525358713..52067374555 100755
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -13,6 +13,8 @@ $CONFIG = array(
"forcessl" => false,
"enablebackup" => false,
"theme" => "",
+"3rdpartyroot" => "",
+"3rdpartyurl" => "",
// "datadirectory" => ""
);
?>
diff --git a/core/css/styles.css b/core/css/styles.css
index afab1fc4cdb..58c5765a9d3 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -3,6 +3,7 @@
See the COPYING-README file. */
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section { margin:0; padding:0; border:0; outline:0; font-weight:inherit; font-size:100%; font-family:inherit; vertical-align:baseline; cursor:default; }
+html, body { height: 100%; }
article, aside, dialog, figure, footer, header, hgroup, nav, section { display:block; }
body { line-height:1.5; }
table { border-collapse:separate; border-spacing:0; white-space:nowrap; }
@@ -39,8 +40,8 @@ input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active,
input[type="password"]:hover, input[type="password"]:focus, input[type="password"]:active,
.searchbox input[type="search"]:hover, .searchbox input[type="search"]:focus, .searchbox input[type="search"]:active { background-color:#fff; color:#333; opacity:1; }
-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="submit"], input[type="button"], button, .button, #quota, div.jp-progress, select, .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, select:hover, select:focus, select:active, input[type="button"]:focus, .button:hover { background:#fff; color:#333; }
input[type="checkbox"] { width:auto; }
#quota { cursor:default; }
@@ -55,11 +56,11 @@ input[type="submit"].highlight{ background:#ffc100; border:1px solid #db0; text-
/* CONTENT ------------------------------------------------------------------ */
#controls { padding: 0 0.5em; width:100%; top:3.5em; height:2.8em; margin:0; background:#f7f7f7; border-bottom:1px solid #eee; position:fixed; z-index:50; -moz-box-shadow:0 -3px 7px #000; -webkit-box-shadow:0 -3px 7px #000; box-shadow:0 -3px 7px #000; }
#controls .button { display:inline-block; }
-#content { margin:3.5em 0 0 12.5em; }
+#content { top: 3.5em; left: 12.5em; position: absolute; }
#leftcontent, .leftcontent { position:fixed; overflow: auto; top:6.4em; width:20em; background:#f8f8f8; border-right:1px solid #ddd; }
#leftcontent li, .leftcontent li { background:#f8f8f8; padding:.3em .8em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; -webkit-transition:background-color 500ms; -moz-transition:background-color 500ms; -o-transition:background-color 500ms; transition:background-color 500ms; }
#leftcontent li:hover, #leftcontent li:active, #leftcontent li.active, .leftcontent li:hover, .leftcontent li:active, .leftcontent li.active { background:#eee; }
-#rightcontent, .rightcontent { position:absolute; top:6.4em; left:33em; }
+#rightcontent, .rightcontent { position:fixed; top: 6.4em; left: 32.5em; }
/* LOG IN & INSTALLATION ------------------------------------------------------------ */
@@ -113,8 +114,8 @@ table:not(.nostyle) tr { -webkit-transition:background-color 500ms; -moz-transit
tbody tr:hover, tr:active { background-color:#f8f8f8; }
#body-settings .personalblock, #body-settings .helpblock { padding:.5em 1em; margin:1em; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
-#body-settings .personalblock#quota { position:relative; margin-top:4.5em; padding:0; }
-#body-settings #controls+.helpblock { position:relative; margin-top:7.3em; }
+#body-settings .personalblock#quota { position:relative; padding:0; }
+#body-settings #controls+.helpblock { position:relative; margin-top: 3em; }
.personalblock > legend { margin-top:2em; }
#quota div, div.jp-play-bar, div.jp-seek-bar { padding:0; background:#e6e6e6; font-weight:normal; white-space:nowrap; -moz-border-radius-bottomleft:.4em; -webkit-border-bottom-left-radius:.4em; border-bottom-left-radius:.4em; -moz-border-radius-topleft:.4em; -webkit-border-top-left-radius:.4em; border-top-left-radius:.4em; }
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 00000000000..4cefbb690d1
--- /dev/null
+++ b/core/img/filetypes/application-vnd.oasis.opendocument.formula.png
Binary files 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 00000000000..3d66cc97eb5
--- /dev/null
+++ b/core/img/filetypes/application-vnd.oasis.opendocument.graphics.png
Binary files 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 00000000000..46942cba285
--- /dev/null
+++ b/core/img/filetypes/application-vnd.oasis.opendocument.presentation.png
Binary files 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 00000000000..abc38d4310c
--- /dev/null
+++ b/core/img/filetypes/application-vnd.oasis.opendocument.spreadsheet.png
Binary files 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 00000000000..06c1f30c8fa
--- /dev/null
+++ b/core/img/filetypes/application-vnd.oasis.opendocument.text.png
Binary files 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 00000000000..55dd0f75366
--- /dev/null
+++ b/core/img/filetypes/application-x-7z-compressed.png
Binary files 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 00000000000..55dd0f75366
--- /dev/null
+++ b/core/img/filetypes/application-x-bzip-compressed-tar.png
Binary files differ
diff --git a/core/img/filetypes/application-x-bzip.png b/core/img/filetypes/application-x-bzip.png
new file mode 100644
index 00000000000..55dd0f75366
--- /dev/null
+++ b/core/img/filetypes/application-x-bzip.png
Binary files 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 00000000000..55dd0f75366
--- /dev/null
+++ b/core/img/filetypes/application-x-compressed-tar.png
Binary files differ
diff --git a/core/img/filetypes/application-x-deb.png b/core/img/filetypes/application-x-deb.png
new file mode 100644
index 00000000000..55dd0f75366
--- /dev/null
+++ b/core/img/filetypes/application-x-deb.png
Binary files 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 00000000000..eff1b7fc8c2
--- /dev/null
+++ b/core/img/filetypes/application-x-debian-package.png
Binary files differ
diff --git a/core/img/filetypes/application-x-gzip.png b/core/img/filetypes/application-x-gzip.png
new file mode 100644
index 00000000000..55dd0f75366
--- /dev/null
+++ b/core/img/filetypes/application-x-gzip.png
Binary files 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 00000000000..55dd0f75366
--- /dev/null
+++ b/core/img/filetypes/application-x-lzma-compressed-tar.png
Binary files differ
diff --git a/core/img/filetypes/application-x-rar.png b/core/img/filetypes/application-x-rar.png
new file mode 100644
index 00000000000..55dd0f75366
--- /dev/null
+++ b/core/img/filetypes/application-x-rar.png
Binary files differ
diff --git a/core/img/filetypes/application-x-rpm.png b/core/img/filetypes/application-x-rpm.png
new file mode 100644
index 00000000000..55dd0f75366
--- /dev/null
+++ b/core/img/filetypes/application-x-rpm.png
Binary files differ
diff --git a/core/img/filetypes/application-x-tar.png b/core/img/filetypes/application-x-tar.png
new file mode 100644
index 00000000000..55dd0f75366
--- /dev/null
+++ b/core/img/filetypes/application-x-tar.png
Binary files differ
diff --git a/core/img/filetypes/application-x-tarz.png b/core/img/filetypes/application-x-tarz.png
new file mode 100644
index 00000000000..55dd0f75366
--- /dev/null
+++ b/core/img/filetypes/application-x-tarz.png
Binary files differ
diff --git a/core/img/filetypes/application-zip.png b/core/img/filetypes/application-zip.png
new file mode 100644
index 00000000000..55dd0f75366
--- /dev/null
+++ b/core/img/filetypes/application-zip.png
Binary files differ
diff --git a/core/img/filetypes/readme-2.txt b/core/img/filetypes/readme-2.txt
new file mode 100644
index 00000000000..5a606f9a0bb
--- /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
+
diff --git a/core/js/js.js b/core/js/js.js
index c6cde3cea95..6da9c29e693 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -13,7 +13,7 @@ function t(app,text){
success:function(jsondata){
t.cache[app] = jsondata.data;
},
- })
+ });
// Bad answer ...
if( !( app in t.cache )){
@@ -58,7 +58,7 @@ OC={
}
link+=app;
if(type){
- link+=type+'/'
+ link+=type+'/';
}
link+=file;
return link;
@@ -73,7 +73,7 @@ OC={
*/
imagePath:function(app,file){
if(file.indexOf('.')==-1){//if no extention is given, use png or svg depending on browser support
- file+=(SVGSupport())?'.svg':'.png'
+ file+=(SVGSupport())?'.svg':'.png';
}
return OC.filePath(app,'img',file);
},
@@ -126,7 +126,7 @@ OC={
});
}
}
-}
+};
OC.search.customResults={};
OC.search.currentResult=-1;
OC.search.lastQuery='';
@@ -147,7 +147,7 @@ if(typeof localStorage !='undefined'){
getItem:function(name){
return JSON.parse(localStorage.getItem(OC.localStorage.namespace+name));
}
- }
+ };
}else{
//dummy localstorage
OC.localStorage={
@@ -160,7 +160,7 @@ if(typeof localStorage !='undefined'){
getItem:function(name){
return null;
}
- }
+ };
}
/**
@@ -182,7 +182,7 @@ if (!Array.prototype.filter) {
}
}
return res;
- }
+ };
}
/**
* implement Array.indexOf for browsers without native support
@@ -235,11 +235,11 @@ SVGSupport.checkMimeType=function(){
});
if(headers["Content-Type"]!='image/svg+xml'){
replaceSVG();
- SVGSupport.checkMimeType.correct=false
+ SVGSupport.checkMimeType.correct=false;
}
}
});
-}
+};
SVGSupport.checkMimeType.correct=true;
//replace all svg images with png for browser compatibility
@@ -305,11 +305,12 @@ $(document).ready(function(){
$(window).resize(function () {
fillHeight($('#leftcontent'));
+ fillWindow($('#content'));
fillWindow($('#rightcontent'));
});
$(window).trigger('resize');
- if(!SVGSupport()){//replace all svg images with png images for browser that dont support svg
+ if(!SVGSupport()){ //replace all svg images with png images for browser that dont support svg
replaceSVG();
}else{
SVGSupport.checkMimeType();
@@ -379,7 +380,6 @@ $(document).ready(function(){
}
});
- if($('body').attr("id")=="body-user") { $('#settings #expanddiv').hide(); }
$('#settings #expand').click(function(event) {
$('#settings #expanddiv').slideToggle();
event.stopPropagation();
diff --git a/core/lostpassword/index.php b/core/lostpassword/index.php
index ede94dab2d7..30caa2d23da 100644
--- a/core/lostpassword/index.php
+++ b/core/lostpassword/index.php
@@ -16,7 +16,7 @@ if (isset($_POST['user'])) {
OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token);
$email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
if (!empty($email)) {
- $link = OC_Helper::linkTo('core/lostpassword', 'resetpassword.php', null, true).'?user='.$_POST['user'].'&token='.$token;
+ $link = OC_Helper::linkToAbsolute('core/lostpassword', 'resetpassword.php').'?user='.$_POST['user'].'&token='.$token;
$tmpl = new OC_Template('core/lostpassword', 'email');
$tmpl->assign('link', $link);
$msg = $tmpl->fetchPage();
diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php
index 64353d4d4f4..c048653cce9 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -44,8 +44,8 @@
<ul id="settings" class="svg">
<img id="expand" class="svg" alt="<?php echo $l->t('Settings');?>" src="<?php echo image_path('', 'actions/settings.svg'); ?>" />
- <span style="display:none"><?php echo $l->t('Settings');?></span>
- <div id="expanddiv">
+ <span style="display:none;"><?php echo $l->t('Settings');?></span>
+ <div id="expanddiv" <?php if($_['bodyid'] == 'body-user') echo 'style="display:none;"'; ?>>
<?php foreach($_['settingsnavigation'] as $entry):?>
<li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a></li>
<?php endforeach; ?>
diff --git a/db_structure.xml b/db_structure.xml
index 8e59a59c6e5..1d459b75fda 100644
--- a/db_structure.xml
+++ b/db_structure.xml
@@ -31,12 +31,12 @@
<field>
<name>configvalue</name>
- <type>text</type>
- <default></default>
+ <type>clob</type>
<notnull>true</notnull>
- <length>255</length>
</field>
+
+
</declaration>
</table>
@@ -55,7 +55,7 @@
<notnull>true</notnull>
<length>4</length>
</field>
-
+
<field>
<name>path</name>
<type>text</type>
@@ -90,7 +90,7 @@
<notnull>true</notnull>
<length>64</length>
</field>
-
+
<field>
<name>size</name>
<type>integer</type>
@@ -522,7 +522,7 @@
</declaration>
</table>
-
+
<table>
<name>*dbprefix*properties</name>
diff --git a/files/index.php b/files/index.php
index f166790ba9c..a29d3fb7e1e 100644
--- a/files/index.php
+++ b/files/index.php
@@ -76,11 +76,11 @@ foreach( explode( "/", $dir ) as $i ){
// make breadcrumb und filelist markup
$list = new OC_Template( "files", "part.list", "" );
$list->assign( "files", $files );
-$list->assign( "baseURL", OC_Helper::linkTo("files", "index.php?dir="));
-$list->assign( "downloadURL", OC_Helper::linkTo("files", "download.php?file="));
+$list->assign( "baseURL", OC_Helper::linkTo("files", "index.php")."?dir=");
+$list->assign( "downloadURL", OC_Helper::linkTo("files", "download.php")."?file=");
$breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" );
$breadcrumbNav->assign( "breadcrumb", $breadcrumb );
-$breadcrumbNav->assign( "baseURL", OC_Helper::linkTo("files", "index.php?dir="));
+$breadcrumbNav->assign( "baseURL", OC_Helper::linkTo("files", "index.php")."?dir=");
$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
diff --git a/files/js/files.js b/files/js/files.js
index bebcf4e97a4..9f1f5368df0 100644
--- a/files/js/files.js
+++ b/files/js/files.js
@@ -166,6 +166,7 @@ $(document).ready(function() {
$('.file_upload_start').live('change',function(){
var form=$(this).closest('form');
+ var that=this;
var uploadId=form.attr('data-upload-id');
var files=this.files;
var target=form.children('iframe');
@@ -173,6 +174,12 @@ $(document).ready(function() {
if(files){
for(var i=0;i<files.length;i++){
totalSize+=files[i].size;
+ if(FileList.deleteFiles && FileList.deleteFiles.indexOf(files[i].name)!=-1){//finish delete if we are uploading a deleted file
+ FileList.finishDelete(function(){
+ $(that).change();
+ });
+ return;
+ }
}
}
if(totalSize>$('#max_upload').val()){
diff --git a/index.php b/index.php
index 9bd460be353..b4cac1879c6 100644
--- a/index.php
+++ b/index.php
@@ -44,13 +44,14 @@ if($not_installed) {
// Handle WebDAV
if($_SERVER['REQUEST_METHOD']=='PROPFIND'){
- header('location: '.OC_Helper::linkTo('files','webdav.php'));
+ header('location: '.OC_Helper::linkToAbsolute('files','webdav.php'));
exit();
}
// Someone is logged in :
elseif(OC_User::isLoggedIn()) {
if(isset($_GET["logout"]) and ($_GET["logout"])) {
+ OC_App::loadApps();
OC_User::logout();
header("Location: ".OC::$WEBROOT.'/');
exit();
@@ -80,7 +81,7 @@ else {
OC_User::unsetMagicInCookie();
}
}
-
+
// Someone wants to log in :
elseif(isset($_POST["user"]) && isset($_POST['password'])) {
if(OC_User::login($_POST["user"], $_POST["password"])) {
diff --git a/lib/app.php b/lib/app.php
index 22d18b17eec..1879a89cee3 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -230,7 +230,7 @@ class OC_App{
// admin users menu
$settings[] = array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "settings", "users.php" ), "name" => $l->t("Users"), "icon" => OC_Helper::imagePath( "settings", "users.svg" ));
// admin apps menu
- $settings[] = array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "settings", "apps.php?installed" ), "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" ));
+ $settings[] = array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "settings", "apps.php" ).'?installed', "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" ));
// admin log menu
$settings[] = array( "id" => "core_log", "order" => 4, "href" => OC_Helper::linkTo( "settings", "log.php" ), "name" => $l->t("Log"), "icon" => OC_Helper::imagePath( "settings", "log.svg" ));
diff --git a/lib/base.php b/lib/base.php
index 8f169a5732f..a95c9d2b21a 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -54,6 +54,14 @@ class OC{
* the folder that stores the data for the root filesystem (e.g. /srv/http/owncloud/data)
*/
public static $CONFIG_DATADIRECTORY_ROOT = '';
+ /**
+ * The installation path of the 3rdparty folder on the server (e.g. /srv/http/owncloud/3rdparty)
+ */
+ public static $THIRDPARTYROOT = '';
+ /**
+ * the root path of the 3rdparty folder for http requests (e.g. owncloud/3rdparty)
+ */
+ public static $THIRDPARTYWEBROOT = '';
/**
* SPL autoload
@@ -138,12 +146,35 @@ class OC{
}
OC::$WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen(OC::$SUBURI));
+
if(OC::$WEBROOT!='' and OC::$WEBROOT[0]!=='/'){
OC::$WEBROOT='/'.OC::$WEBROOT;
}
+ // search the 3rdparty folder
+ if(OC_Config::getValue('3rdpartyroot', '')<>'' and OC_Config::getValue('3rdpartyurl', '')<>''){
+ OC::$THIRDPARTYROOT=OC_Config::getValue('3rdpartyroot', '');
+ OC::$THIRDPARTYWEBROOT=OC_Config::getValue('3rdpartyurl', '');
+ }elseif(file_exists(OC::$SERVERROOT.'/3rdparty')){
+ OC::$THIRDPARTYROOT=OC::$SERVERROOT;
+ OC::$THIRDPARTYWEBROOT=OC::$WEBROOT;
+ }elseif(file_exists(OC::$SERVERROOT.'/../3rdparty')){
+ $url_tmp=explode('/',OC::$WEBROOT);
+ $length=count($url_tmp);
+ unset($url_tmp[$length-1]);
+ OC::$THIRDPARTYWEBROOT=implode('/',$url_tmp);
+ $root_tmp=explode('/',OC::$SERVERROOT);
+ $length=count($root_tmp);
+ unset($root_tmp[$length-1]);
+ OC::$THIRDPARTYROOT=implode('/',$root_tmp);
+ }else{
+ echo("3rdparty directory not found! Please put the ownCloud 3rdparty folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file.");
+ exit;
+ }
+
+
// set the right include path
- set_include_path(OC::$SERVERROOT.'/lib'.PATH_SEPARATOR.OC::$SERVERROOT.'/config'.PATH_SEPARATOR.OC::$SERVERROOT.'/3rdparty'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.OC::$SERVERROOT);
+ set_include_path(OC::$SERVERROOT.'/lib'.PATH_SEPARATOR.OC::$SERVERROOT.'/config'.PATH_SEPARATOR.OC::$THIRDPARTYROOT.'/3rdparty'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.OC::$SERVERROOT);
// Redirect to installer if not installed
if (!OC_Config::getValue('installed', false) && OC::$SUBURI != '/index.php') {
@@ -171,6 +202,13 @@ class OC{
echo 'Error while upgrading the database';
die();
}
+ if(file_exists(OC::$SERVERROOT."/config/config.php") and !is_writable(OC::$SERVERROOT."/config/config.php")) {
+ $tmpl = new OC_Template( '', 'error', 'guest' );
+ $tmpl->assign('errors',array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud")));
+ $tmpl->printPage();
+ exit;
+ }
+
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
}
diff --git a/lib/config.php b/lib/config.php
index 8d03271b3ea..ad1cd18fa15 100644
--- a/lib/config.php
+++ b/lib/config.php
@@ -174,7 +174,7 @@ class OC_Config{
$result=@file_put_contents( OC::$SERVERROOT."/config/config.php", $content );
if(!$result) {
$tmpl = new OC_Template( '', 'error', 'guest' );
- $tmpl->assign('errors',array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver use write access to the config directory in owncloud")));
+ $tmpl->assign('errors',array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud")));
$tmpl->printPage();
exit;
}
diff --git a/lib/db.php b/lib/db.php
index 9d3c20e0145..4c17cd0dbd1 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -318,6 +318,9 @@ class OC_DB {
// Make changes and save them to a temporary file
$file2 = tempnam( get_temp_dir(), 'oc_db_scheme_' );
+ if($file2 == ''){
+ die('could not create tempfile in get_temp_dir() - aborting');
+ }
$content = str_replace( '*dbname*', $CONFIG_DBNAME, $content );
$content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content );
if( $CONFIG_DBTYPE == 'pgsql' ){ //mysql support it too but sqlite doesn't
diff --git a/lib/filecache.php b/lib/filecache.php
index 6ae2f8253db..faadddfb37e 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -266,7 +266,7 @@ class OC_FileCache{
if(is_array($result)){
return $result['id'];
}else{
- OC_Log::write('getFieldId(): file not found in cache ('.$path.')','core',OC_Log::DEBUG);
+ OC_Log::write('getFileId(): file not found in cache ('.$path.')','core',OC_Log::DEBUG);
return -1;
}
}
diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php
index 94a49176ee6..9e4c2d0643e 100644
--- a/lib/fileproxy/quota.php
+++ b/lib/fileproxy/quota.php
@@ -26,11 +26,37 @@
*/
class OC_FileProxy_Quota extends OC_FileProxy{
+ private $userQuota=-1;
+
+ /**
+ * get the quota for the current user
+ * @return int
+ */
+ private function getQuota(){
+ if($this->userQuota!=-1){
+ return $this->userQuota;
+ }
+ $userQuota=OC_Preferences::getValue(OC_User::getUser(),'files','quota','default');
+ if($userQuota=='default'){
+ $userQuota=OC_AppConfig::getValue('files','default_quota','none');
+ }
+ if($userQuota=='none'){
+ $this->userQuota=0;
+ }else{
+ $this->userQuota=OC_Helper::computerFileSize($userQuota);
+ }
+ return $this->userQuota;
+
+ }
+
+ /**
+ * get the free space in the users home folder
+ * @return int
+ */
private function getFreeSpace(){
$rootInfo=OC_FileCache::get('');
$usedSpace=$rootInfo['size'];
- $totalSpace=OC_Preferences::getValue(OC_User::getUser(),'files','quota',0);
- $totalSpace=OC_Helper::computerFileSize($totalSpace);
+ $totalSpace=$this->getQuota();
if($totalSpace==0){
return 0;
}
diff --git a/lib/filestorage/google.php b/lib/filestorage/google.php
new file mode 100644
index 00000000000..fc271f4e4ba
--- /dev/null
+++ b/lib/filestorage/google.php
@@ -0,0 +1,55 @@
+<?php
+
+/**
+* ownCloud
+*
+* @author Michael Gapczynski
+* @copyright 2012 Michael Gapczynski mtgap@owncloud.com
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+class OC_Filestorage_Google extends OC_Filestorage_Common {
+
+ private $auth;
+
+ public function __construct($parameters) {
+
+ }
+
+ private function connect() {
+
+ }
+ public function mkdir($path){}
+ public function rmdir($path){}
+ public function opendir($path){}
+ public function is_dir($path){}
+ public function is_file($path){}
+ public function stat($path){}
+ public function filetype($path){}
+ public function is_readable($path){}
+ public function is_writable($path){}
+ public function file_exists($path){}
+ public function unlink($path){}
+ public function rename($path1,$path2){}
+ public function fopen($path,$mode){}
+ public function toTmpFile($path){}
+ public function fromTmpFile($tmpPath,$path){}
+ public function fromUploadedFile($tmpPath,$path){}
+ public function getMimeType($path){}
+ public function hash($type,$path,$raw){}
+ public function free_space($path){}
+ public function search($query){}
+ public function getLocalFile($path){}
+} \ No newline at end of file
diff --git a/lib/group/database.php b/lib/group/database.php
index f35f61434f0..1afd4b5fe4c 100644
--- a/lib/group/database.php
+++ b/lib/group/database.php
@@ -130,7 +130,7 @@ class OC_Group_Database extends OC_Group_Backend {
* removes the user from a group.
*/
public static function removeFromGroup( $uid, $gid ){
- $query = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE `uid` = ? AND `gid` = ?" );
+ $query = OC_DB::prepare( "DELETE FROM *PREFIX*group_user WHERE uid = ? AND gid = ?" );
$result = $query->execute( array( $uid, $gid ));
return true;
diff --git a/lib/helper.php b/lib/helper.php
index 6d3df6d97e7..2f71bdad2dc 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -29,12 +29,11 @@ class OC_Helper {
* @brief Creates an url
* @param $app app
* @param $file file
- * @param $redirect_url redirect_url variable is appended to the URL
* @returns the url
*
* Returns a url to the given app and file.
*/
- public static function linkTo( $app, $file, $redirect_url=NULL, $absolute=false ){
+ public static function linkTo( $app, $file ){
if( $app != '' ){
$app .= '/';
// Check if the app is in the app folder
@@ -54,17 +53,23 @@ class OC_Helper {
}
}
- if($absolute){
- // Checking if the request was made through HTTPS. The last in line is for IIS
- $protocol = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off');
- $urlLinkTo = ($protocol?'https':'http') . '://' . $_SERVER['HTTP_HOST'] . $urlLinkTo;
- }
-
- if($redirect_url)
- return $urlLinkTo.'?redirect_url='.urlencode($_SERVER["REQUEST_URI"]);
- else
- return $urlLinkTo;
+ return $urlLinkTo;
+ }
+ /**
+ * @brief Creates an absolute url
+ * @param $app app
+ * @param $file file
+ * @returns the url
+ *
+ * Returns a absolute url to the given app and file.
+ */
+ public static function linkToAbsolute( $app, $file ) {
+ $urlLinkTo = self::linkTo( $app, $file );
+ // Checking if the request was made through HTTPS. The last in line is for IIS
+ $protocol = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off');
+ $urlLinkTo = ($protocol?'https':'http') . '://' . $_SERVER['HTTP_HOST'] . $urlLinkTo;
+ return $urlLinkTo;
}
/**
diff --git a/lib/response.php b/lib/response.php
index 2fa0a5adcd3..a75135c0176 100644
--- a/lib/response.php
+++ b/lib/response.php
@@ -12,6 +12,13 @@ class OC_Response {
const STATUS_TEMPORARY_REDIRECT = 307;
const STATUS_NOT_FOUND = 404;
+ /**
+ * @brief Enable response caching by sending correct HTTP headers
+ * @param $cache_time time to cache the response
+ * >0 cache time in seconds
+ * 0 and <0 enable default browser caching
+ * null cache indefinitly
+ */
static public function enableCaching($cache_time = null) {
if (is_numeric($cache_time)) {
header('Pragma: public');// enable caching in IE
@@ -30,10 +37,19 @@ class OC_Response {
}
}
+
+ /**
+ * @brief disable browser caching
+ * @see enableCaching with cache_time = 0
+ */
static public function disableCaching() {
self::enableCaching(0);
}
+ /**
+ * @brief Set response status
+ * @param $status a HTTP status code, see also the STATUS constants
+ */
static public function setStatus($status) {
$protocol = $_SERVER['SERVER_PROTOCOL'];
switch($status) {
@@ -58,11 +74,21 @@ class OC_Response {
header($protocol.' '.$status);
}
+ /**
+ * @brief Send redirect response
+ * @param $location to redirect to
+ */
static public function redirect($location) {
self::setStatus(self::STATUS_TEMPORARY_REDIRECT);
header('Location: '.$location);
}
+ /**
+ * @brief Set reponse expire time
+ * @param $expires date-time when the response expires
+ * string for DateInterval from now
+ * DateTime object when to expire response
+ */
static public function setExpiresHeader($expires) {
if (is_string($expires) && $expires[0] == 'P') {
$interval = $expires;
@@ -76,6 +102,11 @@ class OC_Response {
header('Expires: '.$expires);
}
+ /**
+ * Checks and set ETag header, when the request matches sends a
+ * 'not modified' response
+ * @param $etag token to use for modification check
+ */
static public function setETagHeader($etag) {
if (empty($etag)) {
return;
@@ -85,9 +116,14 @@ class OC_Response {
self::setStatus(self::STATUS_NOT_MODIFIED);
exit;
}
- header('ETag: '.$etag);
+ header('ETag: "'.$etag.'"');
}
+ /**
+ * Checks and set Last-Modified header, when the request matches sends a
+ * 'not modified' response
+ * @param $lastModified time when the reponse was last modified
+ */
static public function setLastModifiedHeader($lastModified) {
if (empty($lastModified)) {
return;
@@ -106,7 +142,11 @@ class OC_Response {
header('Last-Modified: '.$lastModified);
}
- static public function sendFile($filepath=null) {
+ /**
+ * @brief Send file as response, checking and setting caching headers
+ * @param $filepath of file to send
+ */
+ static public function sendFile($filepath) {
$fp = fopen($filepath, 'rb');
if ($fp) {
self::setLastModifiedHeader(filemtime($filepath));
diff --git a/lib/search/provider/file.php b/lib/search/provider/file.php
index c3dc2942aef..34803c75aeb 100644
--- a/lib/search/provider/file.php
+++ b/lib/search/provider/file.php
@@ -7,7 +7,7 @@ class OC_Search_Provider_File extends OC_Search_Provider{
foreach($files as $fileData){
$file=$fileData['path'];
if($fileData['mime']=='httpd/unix-directory'){
- $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'index.php?dir='.$file ),'Files');
+ $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'index.php' ).'?dir='.$file,'Files');
}else{
$mime=$fileData['mime'];
$mimeBase=$fileData['mimepart'];
@@ -15,16 +15,16 @@ class OC_Search_Provider_File extends OC_Search_Provider{
case 'audio':
break;
case 'text':
- $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php?file='.$file ),'Text');
+ $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php' ).'?file='.$file,'Text');
break;
case 'image':
- $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php?file='.$file ),'Images');
+ $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php' ).'?file='.$file,'Images');
break;
default:
if($mime=='application/xml'){
- $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php?file='.$file ),'Text');
+ $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php' ).'?file='.$file,'Text');
}else{
- $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php?file='.$file ),'Files');
+ $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php' ).'?file='.$file,'Files');
}
}
}
diff --git a/lib/setup.php b/lib/setup.php
index eb32e84713f..3e46a3dcc9a 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -77,8 +77,6 @@ class OC_Setup {
OC_Config::setValue('datadirectory', $datadir);
OC_Config::setValue('dbtype', $dbtype);
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
- OC_Config::setValue('installedat',microtime(true));
- OC_Config::setValue('lastupdatedat',microtime(true));
if($dbtype == 'mysql') {
$dbuser = $options['dbuser'];
$dbpass = $options['dbpass'];
@@ -224,6 +222,9 @@ class OC_Setup {
}
if(count($error) == 0) {
+ OC_Appconfig::setValue('core', 'installedat',microtime(true));
+ OC_Appconfig::setValue('core', 'lastupdatedat',microtime(true));
+
//create the user and group
OC_User::createUser($username, $password);
OC_Group::createGroup('admin');
diff --git a/lib/template.php b/lib/template.php
index d991759fbcd..5fe2eb7d6c7 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -346,31 +346,41 @@ class OC_Template{
// Add the core js files or the js files provided by the selected theme
foreach(OC_Util::$scripts as $script){
- if(is_file(OC::$SERVERROOT."/themes/$theme/apps/$script$fext.js" )){
+ // Is it in 3rd party?
+ if(is_file(OC::$THIRDPARTYROOT."/$script.js" )){
+ $page->append( "jsfiles", OC::$THIRDPARTYWEBROOT."/$script.js" );
+
+ // Is it in apps and overwritten by the theme?
+ }elseif(is_file(OC::$SERVERROOT."/themes/$theme/apps/$script$fext.js" )){
$page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/apps/$script$fext.js" );
}elseif(is_file(OC::$SERVERROOT."/themes/$theme/apps/$script.js" )){
$page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/apps/$script.js" );
+ // Is it part of an app?
}elseif(is_file(OC::$SERVERROOT."/apps/$script$fext.js" )){
$page->append( "jsfiles", OC::$WEBROOT."/apps/$script$fext.js" );
}elseif(is_file(OC::$SERVERROOT."/apps/$script.js" )){
$page->append( "jsfiles", OC::$WEBROOT."/apps/$script.js" );
+ // Is it in the owncloud root but overwritten by the theme?
}elseif(is_file(OC::$SERVERROOT."/themes/$theme/$script$fext.js" )){
$page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/$script$fext.js" );
}elseif(is_file(OC::$SERVERROOT."/themes/$theme/$script.js" )){
$page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/$script.js" );
-
+
+ // Is it in the owncloud root ?
}elseif(is_file(OC::$SERVERROOT."/$script$fext.js" )){
$page->append( "jsfiles", OC::$WEBROOT."/$script$fext.js" );
}elseif(is_file(OC::$SERVERROOT."/$script.js" )){
$page->append( "jsfiles", OC::$WEBROOT."/$script.js" );
+ // Is in core but overwritten by a theme?
}elseif(is_file(OC::$SERVERROOT."/themes/$theme/core/$script$fext.js" )){
$page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/core/$script$fext.js" );
}elseif(is_file(OC::$SERVERROOT."/themes/$theme/core/$script.js" )){
$page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/core/$script.js" );
+ // Is it in core?
}elseif(is_file(OC::$SERVERROOT."/core/$script$fext.js" )){
$page->append( "jsfiles", OC::$WEBROOT."/core/$script$fext.js" );
}else{
@@ -380,14 +390,20 @@ class OC_Template{
}
// Add the css files
foreach(OC_Util::$styles as $style){
- if(is_file(OC::$SERVERROOT."/apps/$style$fext.css" )){
+ // is it in 3rdparty?
+ if(is_file(OC::$THIRDPARTYROOT."/$style.css" )){
+ $page->append( "cssfiles", OC::$THIRDPARTYWEBROOT."/$style.css" );
+ // or in apps?
+ }elseif(is_file(OC::$SERVERROOT."/apps/$style$fext.css" )){
$page->append( "cssfiles", OC::$WEBROOT."/apps/$style$fext.css" );
}elseif(is_file(OC::$SERVERROOT."/apps/$style.css" )){
$page->append( "cssfiles", OC::$WEBROOT."/apps/$style.css" );
+ // or in the owncloud root?
}elseif(is_file(OC::$SERVERROOT."/$style$fext.css" )){
$page->append( "cssfiles", OC::$WEBROOT."/$style$fext.css" );
}elseif(is_file(OC::$SERVERROOT."/$style.css" )){
$page->append( "cssfiles", OC::$WEBROOT."/$style.css" );
+ // or in core ?
}elseif(is_file(OC::$SERVERROOT."/core/$style$fext.css" )){
$page->append( "cssfiles", OC::$WEBROOT."/core/$style$fext.css" );
}else{
diff --git a/lib/updater.php b/lib/updater.php
index cc4a4602539..57623797ae5 100644
--- a/lib/updater.php
+++ b/lib/updater.php
@@ -29,12 +29,12 @@ class OC_Updater{
* Check if a new version is available
*/
public static function check(){
- OC_Config::setValue('lastupdatedat',microtime(true));
+ OC_Appconfig::setValue('core', 'lastupdatedat',microtime(true));
$updaterurl='http://apps.owncloud.com/updater.php';
$version=OC_Util::getVersion();
- $version['installed']=OC_Config::getValue( "installedat");
- $version['updated']=OC_Config::getValue( "lastupdatedat");
+ $version['installed']=OC_Config::getValue('installedat');
+ $version['updated']=OC_Appconfig::getValue('core', 'lastupdatedat', OC_Config::getValue( 'lastupdatedat'));
$version['updatechannel']='stable';
$versionstring=implode('x',$version);
diff --git a/lib/user.php b/lib/user.php
index 34f44f572e0..0746fcc6eb4 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -321,7 +321,10 @@ class OC_User {
$users=array();
foreach(self::$_usedBackends as $backend){
if($backend->implementsActions(OC_USER_BACKEND_GET_USERS)){
- $users=array_merge($users,$backend->getUsers());
+ $backendUsers=$backend->getUsers();
+ if(is_array($backendUsers)){
+ $users=array_merge($users,$backendUsers);
+ }
}
}
return $users;
diff --git a/lib/util.php b/lib/util.php
index 43fb4413f04..05caeca0e3e 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -62,7 +62,7 @@ class OC_Util {
* @return array
*/
public static function getVersion(){
- return array(3,00,1);
+ return array(3,00,2);
}
/**
@@ -226,10 +226,6 @@ class OC_Util {
$errors[]=array('error'=>'PHP module ctype is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
}
- if(file_exists(OC::$SERVERROOT."/config/config.php") and !is_writable(OC::$SERVERROOT."/config/config.php")){
- $errors[]=array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver use write access to the config directory in owncloud");
- }
-
return $errors;
}
@@ -244,22 +240,23 @@ class OC_Util {
/**
- * Check if the app is enabled, send json error msg if not
+ * Check if the app is enabled, redirects to home if not
*/
public static function checkAppEnabled($app){
if( !OC_App::isEnabled($app)){
- header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true));
+ header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' ));
exit();
}
}
/**
- * Check if the user is logged in, redirects to home if not
+ * Check if the user is logged in, redirects to home if not. With
+ * redirect URL parameter to the request URI.
*/
public static function checkLoggedIn(){
// Check if we are a user
if( !OC_User::isLoggedIn()){
- header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true));
+ header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' ).'?redirect_url='.urlencode($_SERVER["REQUEST_URI"]));
exit();
}
}
@@ -271,7 +268,7 @@ class OC_Util {
// Check if we are a user
self::checkLoggedIn();
if( !OC_Group::inGroup( OC_User::getUser(), 'admin' )){
- header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true));
+ header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' ));
exit();
}
}
diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php
index d4e3c58ac11..dc87625a05d 100644
--- a/settings/ajax/setquota.php
+++ b/settings/ajax/setquota.php
@@ -5,14 +5,28 @@ require_once('../../lib/base.php');
OC_JSON::checkAdminUser();
-$username = $_POST["username"];
+$username = isset($_POST["username"])?$_POST["username"]:'';
//make sure the quota is in the expected format
-$quota= OC_Helper::computerFileSize($_POST["quota"]);
-$quota=OC_Helper::humanFileSize($quota);
+$quota=$_POST["quota"];
+if($quota!='none' and $quota!='default'){
+ $quota= OC_Helper::computerFileSize($quota);
+ if($quota==0){
+ $quota='default';
+ }else{
+ $quota=OC_Helper::humanFileSize($quota);
+ }
+}
// Return Success story
-OC_Preferences::setValue($username,'files','quota',$quota);
+if($username){
+ OC_Preferences::setValue($username,'files','quota',$quota);
+}else{//set the default quota when no username is specified
+ if($quota=='default'){//'default' as default quota makes no sense
+ $quota='none';
+ }
+ OC_Appconfig::setValue('files','default_quota',$quota);
+}
OC_JSON::success(array("data" => array( "username" => $username ,'quota'=>$quota)));
?>
diff --git a/settings/css/settings.css b/settings/css/settings.css
index 8d89cee6ec0..7a5873bb4d2 100644
--- a/settings/css/settings.css
+++ b/settings/css/settings.css
@@ -26,9 +26,15 @@ tr:hover>td.password>span { margin:0; cursor:pointer; }
tr:hover>td.remove>img, tr:hover>td.password>img, tr:hover>td.quota>img { visibility:visible; cursor:pointer; }
tr:hover>td.remove>img { float:right; }
li.selected { background-color:#ddd; }
-#content>table:not(.nostyle) { margin-top:6.5em; }
+#content>table:not(.nostyle) { margin-top:3em; }
table:not(.nostyle) { width:100%; }
-
+#rightcontent { padding-left: 1em; }
+td.quota { position:relative }
+div.quota { float:right; display:block; position:absolute; right:25em; top:0; }
+select.quota { position:absolute; left:0; top:0; width:10em; }
+input.quota-other { display:none; position:absolute; left:0.1em; top:0.1em; width:7em; border:none; -webkit-box-shadow: none -mox-box-shadow:none ; box-shadow:none; }
+div.quota>span { position:absolute; right:0em; white-space:nowrap; top: 0.7em }
+select.quota.active { background: #fff; }
/* APPS */
li { color:#888; }
diff --git a/settings/js/users.js b/settings/js/users.js
index c9b1d855db0..eed93d3b303 100644
--- a/settings/js/users.js
+++ b/settings/js/users.js
@@ -5,6 +5,18 @@
*/
$(document).ready(function(){
+ function setQuota(uid,quota,ready){
+ $.post(
+ OC.filePath('settings','ajax','setquota.php'),
+ {username:uid,quota:quota},
+ function(result){
+ if(ready){
+ ready(result.data.quota);
+ }
+ }
+ );
+ }
+
function applyMultiplySelect(element){
var checked=[];
var user=element.data('username');
@@ -82,48 +94,66 @@ $(document).ready(function(){
$('td.password').live('click',function(event){
$(this).children('img').click();
});
-
- $('td.quota>img').live('click',function(event){
- event.stopPropagation();
- var img=$(this);
- var uid=img.parent().parent().data('uid');
- var input=$('<input>');
- var quota=img.parent().children('span').text();
- if(quota=='None'){
- quota='';
+
+ $('select.quota').live('change',function(){
+ var select=$(this);
+ var uid=$(this).parent().parent().data('uid');
+ var quota=$(this).val();
+ var other=$(this).next();
+ if(quota!='other'){
+ other.hide();
+ select.data('previous',quota);
+ setQuota(uid,quota);
+ }else{
+ other.show();
+ select.addClass('active');
+ other.focus();
}
- input.val(quota);
- img.css('display','none');
- img.parent().children('span').replaceWith(input);
- input.focus();
- input.keypress(function(event) {
- if(event.keyCode == 13) {
- $(this).parent().attr('data-quota',$(this).val());
- if($(this).val().length>0){
- $.post(
- OC.filePath('settings','ajax','setquota.php'),
- {username:uid,quota:$(this).val()},
- function(result){
- img.parent().children('span').text(result.data.quota)
- $(this).parent().attr('data-quota',result.data.quota);
- }
- );
- input.blur();
+ });
+ $('select.quota').each(function(i,select){
+ $(select).data('previous',$(select).val());
+ })
+
+ $('input.quota-other').live('change',function(){
+ var uid=$(this).parent().parent().data('uid');
+ var quota=$(this).val();
+ var select=$(this).prev();
+ var other=$(this);
+ if(quota){
+ setQuota(uid,quota,function(quota){
+ select.children().attr('selected',null);
+ var existingOption=select.children().filter(function(i,option){
+ return ($(option).val()==quota);
+ });
+ if(existingOption.length){
+ existingOption.attr('selected','selected');
}else{
- input.blur();
+ var option=$('<option/>');
+ option.attr('selected','selected').attr('value',quota).text(quota);
+ select.children().last().before(option);
}
- }
- });
- input.blur(function(){
- var quota=$(this).parent().attr('data-quota');
- $(this).replaceWith($('<span>'+quota+'</span>'));
- img.css('display','');
- });
- });
- $('td.quota').live('click',function(event){
- $(this).children('img').click();
+ select.val(quota);
+ select.removeClass('active');
+ other.val(null);
+ other.hide();
+ });
+ }else{
+ var previous=select.data('previous');
+ select.children().attr('selected',null);
+ select.children().each(function(i,option){
+ if($(option).val()==previous){
+ $(option).attr('selected','selected');
+ }
+ });
+ select.removeClass('active');
+ other.hide();
+ }
});
+ $('input.quota-other').live('blur',function(){
+ $(this).change();
+ })
+
$('#newuser').submit(function(event){
event.preventDefault();
var username=$('#newusername').val();
@@ -157,7 +187,13 @@ $(document).ready(function(){
select.data('username',username);
select.data('userGroups',groups.join(', '));
tr.find('td.groups').empty();
- $.each($('#content table').data('groups').split(', '),function(i,group){
+ var allGroups=$('#content table').data('groups').split(', ');
+ for(var i=0;i<groups.length;i++){
+ if(allGroups.indexOf(groups[i])==-1){
+ allGroups.push(groups[i]);
+ }
+ }
+ $.each(allGroups,function(i,group){
select.append($('<option value="'+group+'">'+group+'</option>'));
});
tr.find('td.groups').append(select);
@@ -166,5 +202,9 @@ $(document).ready(function(){
}
applyMultiplySelect(select);
$('#content table tbody').last().after(tr);
+
+ tr.find('select.quota option').attr('selected',null);
+ tr.find('select.quota option').first().attr('selected','selected');
+ tr.find('select.quota').data('previous','default');
});
});
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index 80d2cb0a86f..57731d979d9 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -41,7 +41,7 @@
<p class="personalblock">
<strong>WebDAV</strong>
- <?php echo OC_Helper::linkTo('files', 'webdav.php', null, true); ?><br />
+ <?php echo OC_Helper::linkToAbsolute('files', 'webdav.php'); ?><br />
<em><?php echo $l->t('use this address to connect to your ownCloud in your file manager');?></em>
</p>
diff --git a/settings/templates/users.php b/settings/templates/users.php
index bcc4d65fe43..a23a5bafe61 100644
--- a/settings/templates/users.php
+++ b/settings/templates/users.php
@@ -12,16 +12,30 @@ foreach($_["groups"] as $group) {
<div id="controls">
<form id="newuser">
- <th class="name"><input id="newusername" placeholder="<?php echo $l->t('Name')?>" /></th>
- <th class="password"><input type="password" id="newuserpassword" placeholder="<?php echo $l->t('Password')?>" /></th>
- <th class="groups"><select id="newusergroups" data-placeholder="groups" title="<?php echo $l->t('Groups')?>" multiple="multiple">
+ <input id="newusername" placeholder="<?php echo $l->t('Name')?>" />
+ <input type="password" id="newuserpassword" placeholder="<?php echo $l->t('Password')?>" />
+ <select id="newusergroups" data-placeholder="groups" title="<?php echo $l->t('Groups')?>" multiple="multiple">
<?php foreach($_["groups"] as $group): ?>
<option value="<?php echo $group['name'];?>"><?php echo $group['name'];?></option>
<?php endforeach;?>
- </select></th>
- <th class="quota"></th>
- <th><input type="submit" value="<?php echo $l->t('Create')?>" /></th>
+ </select>
+ <input type="submit" value="<?php echo $l->t('Create')?>" />
</form>
+ <div class="quota">
+ <span><?php echo $l->t('Default Quota');?>:</span>
+ <select class='quota'>
+ <?php foreach($_['quota_preset'] as $preset):?>
+ <?php if($preset!='default'):?>
+ <option <?php if($_['default_quota']==$preset) echo 'selected="selected"';?> value='<?php echo $preset;?>'><?php echo $preset;?></option>
+ <?php endif;?>
+ <?php endforeach;?>
+ <?php if(array_search($_['default_quota'],$_['quota_preset'])===false):?>
+ <option selected="selected" value='<?php echo $_['default_quota'];?>'><?php echo $_['default_quota'];?></option>
+ <?php endif;?>
+ <option value='other'><?php echo $l->t('Other');?>...</option>
+ </select>
+ <input class='quota-other'></input>
+ </div>
</div>
<table data-groups="<?php echo implode(', ',$allGroups);?>">
@@ -49,9 +63,17 @@ foreach($_["groups"] as $group) {
<?php endforeach;?>
</select>
</td>
- <td class="quota" data-quota="<?php echo $user['quota']?>">
- <span><?php echo ($user['quota']>0)?$user['quota']:'None';?></span>
- <img class="svg action" src="<?php echo image_path('core','actions/rename.svg')?>" alt="set new password" title="set quota" />
+ <td class="quota">
+ <select class='quota'>
+ <?php foreach($_['quota_preset'] as $preset):?>
+ <option <?php if($user['quota']==$preset) echo 'selected="selected"';?> value='<?php echo $preset;?>'><?php echo $preset;?></option>
+ <?php endforeach;?>
+ <?php if(array_search($user['quota'],$_['quota_preset'])===false):?>
+ <option selected="selected" value='<?php echo $user['quota'];?>'><?php echo $user['quota'];?></option>
+ <?php endif;?>
+ <option value='other'><?php echo $l->t('Other');?>...</option>
+ </select>
+ <input class='quota-other'></input>
</td>
<td class="remove">
<?php if($user['name']!=OC_User::getUser()):?>
diff --git a/settings/users.php b/settings/users.php
index e5dcc049481..96515a90ce4 100644
--- a/settings/users.php
+++ b/settings/users.php
@@ -18,17 +18,26 @@ $users = array();
$groups = array();
foreach( OC_User::getUsers() as $i ){
- $users[] = array( "name" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) ),'quota'=>OC_Preferences::getValue($i,'files','quota',0));
+ $users[] = array( "name" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) ),'quota'=>OC_Preferences::getValue($i,'files','quota','default'));
}
foreach( OC_Group::getGroups() as $i ){
// Do some more work here soon
$groups[] = array( "name" => $i );
}
+$quotaPreset=OC_Appconfig::getValue('files','quota_preset','default,none,1 GB, 5 GB, 10 GB');
+$quotaPreset=explode(',',$quotaPreset);
+foreach($quotaPreset as &$preset){
+ $preset=trim($preset);
+}
+
+$defaultQuota=OC_Appconfig::getValue('files','default_quota','none');
$tmpl = new OC_Template( "settings", "users", "user" );
$tmpl->assign( "users", $users );
$tmpl->assign( "groups", $groups );
+$tmpl->assign( 'quota_preset', $quotaPreset);
+$tmpl->assign( 'default_quota', $defaultQuota);
$tmpl->printPage();
?>