summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Gapczynski <GapczynskiM@gmail.com>2011-08-15 17:49:36 -0400
committerMichael Gapczynski <GapczynskiM@gmail.com>2011-08-15 17:49:36 -0400
commit1ec75330ecf342ef38092934294a6a444bbbdac7 (patch)
tree658555747f66b90b6547e7fe58ec8f3a9fb19417
parent801e4f86116c0ef9af4ad93a39b955deaa2f6ce8 (diff)
parent98997a51fa7883f9da7e9210732daf1a607ff861 (diff)
downloadnextcloud-server-1ec75330ecf342ef38092934294a6a444bbbdac7.tar.gz
nextcloud-server-1ec75330ecf342ef38092934294a6a444bbbdac7.zip
Merge branch 'master' into sharing
-rw-r--r--.gitignore1
-rw-r--r--apps/bookmarks/ajax/addBookmark.php70
-rw-r--r--apps/bookmarks/ajax/delBookmark.php52
-rw-r--r--apps/bookmarks/ajax/recordClick.php47
-rw-r--r--apps/bookmarks/ajax/updateList.php66
-rw-r--r--apps/bookmarks/appinfo/app.php27
-rw-r--r--apps/bookmarks/appinfo/database.xml127
-rw-r--r--apps/bookmarks/appinfo/info.xml10
-rw-r--r--apps/bookmarks/css/bookmarks.css63
-rw-r--r--apps/bookmarks/img/bookmarks.pngbin0 -> 496 bytes
-rw-r--r--apps/bookmarks/index.php39
-rw-r--r--apps/bookmarks/js/bookmarks.js94
-rw-r--r--apps/bookmarks/templates/list.php18
-rw-r--r--apps/contacts/css/styles.css3
-rw-r--r--apps/contacts/js/interface.js14
-rw-r--r--apps/contacts/lib/addressbook.php7
-rw-r--r--apps/contacts/templates/part.details.php46
-rw-r--r--apps/contacts/templates/part.property.php42
-rwxr-xr-xconfig/.gitignore2
-rw-r--r--core/ajax/grouplist.php45
-rw-r--r--core/ajax/userlist.php47
-rw-r--r--core/js/js.js4
-rw-r--r--core/templates/layout.guest.php2
-rw-r--r--files/ajax/upload.php10
-rw-r--r--lib/fileproxy.php111
-rw-r--r--lib/fileproxy/quota.php61
-rw-r--r--lib/files.php6
-rw-r--r--lib/filestorage.php3
-rw-r--r--lib/filestorage/local.php38
-rw-r--r--lib/filesystem.php278
-rw-r--r--lib/util.php2
-rw-r--r--settings/ajax/setquota.php22
-rw-r--r--settings/apps.php23
-rw-r--r--settings/js/apps.js8
-rw-r--r--settings/js/users.js39
-rw-r--r--settings/templates/users.php4
-rw-r--r--settings/users.php2
37 files changed, 1126 insertions, 307 deletions
diff --git a/.gitignore b/.gitignore
index e0ea724f1ae..33f8e0c524b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
# the default generated dir + db file
data
owncloud
+config/config.php
# just sane ignores
.*.sw[po]
diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php
new file mode 100644
index 00000000000..b0d1a730897
--- /dev/null
+++ b/apps/bookmarks/ajax/addBookmark.php
@@ -0,0 +1,70 @@
+<?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');
+
+// We send json data
+header( "Content-Type: application/jsonrequest" );
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
+ exit();
+}
+
+$query = OC_DB::prepare("
+ INSERT IGNORE INTO *PREFIX*bookmarks
+ (url, title, description, user_id, public, added, lastmodified)
+ VALUES (?, ?, ?, ?, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP())
+ ");
+
+$params=array(
+ urldecode($_GET["url"]),
+ urldecode($_GET["title"]),
+ urldecode($_GET["description"]),
+ OC_User::getUser()
+ );
+$query->execute($params);
+$b_id = OC_DB::insertid();
+
+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);
+ }
+}
+
diff --git a/apps/bookmarks/ajax/delBookmark.php b/apps/bookmarks/ajax/delBookmark.php
new file mode 100644
index 00000000000..a47bd2b9ea4
--- /dev/null
+++ b/apps/bookmarks/ajax/delBookmark.php
@@ -0,0 +1,52 @@
+<?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');
+
+// We send json data
+header( "Content-Type: application/jsonrequest" );
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
+ exit();
+}
+
+$query = OC_DB::prepare("
+ DELETE FROM *PREFIX*bookmarks
+ WHERE url LIKE ?
+ AND user_id = ?
+ ");
+
+$params=array(
+ urldecode($_GET["url"]),
+ OC_User::getUser()
+ );
+$result = $query->execute($params);
+
+// var_dump($params);
+
+echo json_encode( array( "status" => "success", "data" => array()));
diff --git a/apps/bookmarks/ajax/recordClick.php b/apps/bookmarks/ajax/recordClick.php
new file mode 100644
index 00000000000..4dcb0b4a0df
--- /dev/null
+++ b/apps/bookmarks/ajax/recordClick.php
@@ -0,0 +1,47 @@
+<?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
+if( !OC_User::isLoggedIn()){
+ header( "Content-Type: application/jsonrequest" );
+ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
+ exit();
+}
+
+$query = OC_DB::prepare("
+ UPDATE *PREFIX*bookmarks
+ SET clickcount = clickcount + 1
+ WHERE user_id = ?
+ AND url LIKE ?
+ ");
+
+$params=array(OC_User::getUser(), urldecode($_GET["url"]));
+$bookmarks = $query->execute($params);
+
+header( "HTTP/1.1 204 No Content" );
+
diff --git a/apps/bookmarks/ajax/updateList.php b/apps/bookmarks/ajax/updateList.php
new file mode 100644
index 00000000000..d7cf05b7a60
--- /dev/null
+++ b/apps/bookmarks/ajax/updateList.php
@@ -0,0 +1,66 @@
+<?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');
+
+// We send json data
+header( "Content-Type: application/jsonrequest" );
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
+ exit();
+}
+
+$params=array(OC_User::getUser());
+
+//Filter for tag?
+$filterTag = isset($_GET["tag"]) ? urldecode($_GET["tag"]) : false;
+if($filterTag){
+ $sqlFilterTag = "HAVING INSTR (tags, ?) > 0";
+ $params[] = $filterTag;
+} else {
+ $sqlFilterTag = '';
+}
+
+$offset = isset($_GET["page"]) ? intval($_GET["page"]) * 10 : 0;
+$params[] = $offset;
+
+//FIXME: bookmarks without tags are not being retrieved
+$query = OC_DB::prepare("
+ SELECT url, title, description, GROUP_CONCAT( tag SEPARATOR ' ' ) AS tags
+ FROM *PREFIX*bookmarks, *PREFIX*bookmarks_tags
+ WHERE *PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
+ AND *PREFIX*bookmarks.user_id = ?
+ GROUP BY url
+ $sqlFilterTag
+ ORDER BY *PREFIX*bookmarks.id DESC
+ LIMIT ?, 10");
+
+
+$bookmarks = $query->execute($params)->fetchAll();
+
+echo json_encode( array( "status" => "success", "data" => $bookmarks));
diff --git a/apps/bookmarks/appinfo/app.php b/apps/bookmarks/appinfo/app.php
new file mode 100644
index 00000000000..33b7ba61449
--- /dev/null
+++ b/apps/bookmarks/appinfo/app.php
@@ -0,0 +1,27 @@
+<?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/>.
+*
+*/
+
+OC_App::register( array( 'order' => 70, 'id' => 'bookmark', 'name' => 'Bookmarks' ));
+
+OC_App::addNavigationEntry( array( 'id' => 'bookmarks_index', 'order' => 70, 'href' => OC_Helper::linkTo( 'bookmarks', 'index.php' ), 'icon' => OC_Helper::imagePath( 'bookmarks', 'bookmarks.png' ), 'name' => 'Bookmarks' ));
+
diff --git a/apps/bookmarks/appinfo/database.xml b/apps/bookmarks/appinfo/database.xml
new file mode 100644
index 00000000000..8bfb861fc5d
--- /dev/null
+++ b/apps/bookmarks/appinfo/database.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<database>
+ <name>*dbname*</name>
+ <create>true</create>
+ <overwrite>false</overwrite>
+ <charset>latin1</charset>
+ <table>
+ <name>*dbprefix*bookmarks</name>
+ <declaration>
+ <field>
+ <name>id</name>
+ <type>integer</type>
+ <autoincrement>1</autoincrement>
+ <default>0</default>
+ <notnull>true</notnull>
+ <length>64</length>
+ </field>
+ <field>
+ <name>url</name>
+ <type>text</type>
+ <default></default>
+ <notnull>true</notnull>
+ <length>4096</length>
+ </field>
+ <field>
+ <name>title</name>
+ <type>text</type>
+ <default></default>
+ <notnull>true</notnull>
+ <length>140</length>
+ </field>
+ <field>
+ <name>description</name>
+ <type>text</type>
+ <default></default>
+ <notnull>true</notnull>
+ <length>255</length>
+ </field>
+ <field>
+ <name>user_id</name>
+ <type>text</type>
+ <default></default>
+ <notnull>true</notnull>
+ <length>64</length>
+ </field>
+ <field>
+ <name>public</name>
+ <type>integer</type>
+ <default>0</default>
+ <length>1</length>
+ </field>
+ <field>
+ <name>added</name>
+ <type>integer</type>
+ <default></default>
+ <notnull>false</notnull>
+ <unsigned>true</unsigned>
+ <length>4</length>
+ </field>
+ <field>
+ <name>lastmodified</name>
+ <type>integer</type>
+ <default></default>
+ <notnull>false</notnull>
+ <unsigned>true</unsigned>
+ <length>4</length>
+ </field>
+ <field>
+ <name>clickcount</name>
+ <type>integer</type>
+ <default>0</default>
+ <notnull>true</notnull>
+ <unsigned>true</unsigned>
+ <length>4</length>
+ </field>
+
+ <index>
+ <name>id</name>
+ <unique>true</unique>
+ <field>
+ <name>id</name>
+ <sorting>descending</sorting>
+ </field>
+ </index>
+<!-- <index>
+ <name>url</name>
+ <unique>true</unique>
+ <field>
+ <name>url</name>
+ <sorting>ascending</sorting>
+ </field>
+ </index>-->
+ </declaration>
+ </table>
+
+ <table>
+ <name>*dbprefix*bookmarks_tags</name>
+ <declaration>
+ <field>
+ <name>bookmark_id</name>
+ <type>integer</type>
+ <length>64</length>
+ </field>
+
+ <field>
+ <name>tag</name>
+ <type>text</type>
+ <default></default>
+ <notnull>true</notnull>
+ <length>255</length>
+ </field>
+ <index>
+ <name>bookmark_tag</name>
+ <unique>true</unique>
+ <field>
+ <name>bookmark_id</name>
+ <sorting>ascending</sorting>
+ </field>
+ <field>
+ <name>tag</name>
+ <sorting>ascending</sorting>
+ </field>
+ </index>
+ </declaration>
+ </table>
+</database>
+ \ No newline at end of file
diff --git a/apps/bookmarks/appinfo/info.xml b/apps/bookmarks/appinfo/info.xml
new file mode 100644
index 00000000000..23aa6c219a9
--- /dev/null
+++ b/apps/bookmarks/appinfo/info.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<info>
+ <id>bookmarks</id>
+ <name>Bookmarks</name>
+ <description>Bookmark manager for ownCloud</description>
+ <version>0.1</version>
+ <licence>AGPL</licence>
+ <author>Arthur Schiwon</author>
+ <require>2</require>
+</info> \ No newline at end of file
diff --git a/apps/bookmarks/css/bookmarks.css b/apps/bookmarks/css/bookmarks.css
new file mode 100644
index 00000000000..aa28424c0b2
--- /dev/null
+++ b/apps/bookmarks/css/bookmarks.css
@@ -0,0 +1,63 @@
+#content { overflow: auto; }
+
+.bookmarks_headline {
+ font-size: large;
+ font-weight: bold;
+ margin-left: 2em;
+ padding: 2.5ex 0.5ex;
+}
+
+.bookmarks_menu {
+ margin-left: 1.5em;
+ padding: 0.5ex;
+}
+
+.bookmark_actions {
+ font-size: smaller;
+ color: #ff44ff;
+ padding-left: 4em;
+}
+
+.bookmark_actions span:hover {
+ cursor: pointer;
+ text-decoration: underline;
+}
+
+.bookmarks_add {
+ display: none;
+}
+
+.bookmarks_label {
+ width: 7em;
+ display: inline-block;
+ text-align: right;
+}
+
+.bookmarks_input {
+ width: 20em;
+}
+
+.bookmark_single {
+ margin-left: 2em;
+ margin-top: 3ex;
+ padding: 0.5ex;
+/* border-bottom: 1px solid black; */
+}
+
+.bookmark_single:hover {
+ background-color: #ccccff;
+}
+
+.bookmark_title {
+ font-size: larger;
+ color: blue;
+ text-decoration: underline;
+}
+
+.bookmark_url {
+ color: green;
+}
+
+.bookmark_tags {
+ color: #ff3333;
+} \ No newline at end of file
diff --git a/apps/bookmarks/img/bookmarks.png b/apps/bookmarks/img/bookmarks.png
new file mode 100644
index 00000000000..b92e4f50a42
--- /dev/null
+++ b/apps/bookmarks/img/bookmarks.png
Binary files differ
diff --git a/apps/bookmarks/index.php b/apps/bookmarks/index.php
new file mode 100644
index 00000000000..ba9f7cc0c61
--- /dev/null
+++ b/apps/bookmarks/index.php
@@ -0,0 +1,39 @@
+<?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/>.
+*
+*/
+
+require_once('../../lib/base.php');
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ header( "Location: ".OC_Helper::linkTo( '', 'index.php' ));
+ exit();
+}
+
+OC_App::setActiveNavigationEntry( 'bookmarks_index' );
+
+OC_Util::addScript('bookmarks','bookmarks');
+OC_Util::addStyle('bookmarks', 'bookmarks');
+
+$tmpl = new OC_Template( 'bookmarks', 'list', 'user' );
+
+$tmpl->printPage(); \ No newline at end of file
diff --git a/apps/bookmarks/js/bookmarks.js b/apps/bookmarks/js/bookmarks.js
new file mode 100644
index 00000000000..7624ff5d394
--- /dev/null
+++ b/apps/bookmarks/js/bookmarks.js
@@ -0,0 +1,94 @@
+var bookmarks_page = 0;
+var bookmarks_loading = false;
+
+$(document).ready(function() {
+ $('.bookmarks_addBtn').click(function(event){
+ $('.bookmarks_add').slideToggle();
+ });
+
+ $('#bookmark_add_submit').click(addBookmark);
+ $(window).scroll(updateOnBottom);
+
+ $('.bookmarks_list').empty();
+ getBookmarks();
+});
+
+function getBookmarks() {
+ if(bookmarks_loading) {
+ //have patience :)
+ return;
+ }
+ $.ajax({
+ url: 'ajax/updateList.php',
+ data: "tag=" + encodeURI($('#bookmarkFilterTag').val()) + "&page=" + bookmarks_page,
+ success: function(bookmarks){
+ bookmarks_page += 1;
+ $('.bookmark_link').unbind('click', recordClick);
+ $('.bookmark_delete').unbind('click', delBookmark);
+
+ for(var i in bookmarks.data) {
+ updateBookmarksList(bookmarks.data[i]);
+ }
+ $('.bookmark_link').click(recordClick);
+ $('.bookmark_delete').click(delBookmark);
+ bookmarks_loading = false;
+ }
+ });
+}
+
+function addBookmark(event) {
+ $.ajax({
+ url: 'ajax/addBookmark.php',
+ data: "url=" + encodeURI($('#bookmark_add_url').val()) + "&title=" + encodeURI($('#bookmark_add_title').val()) + "&description=" + encodeURI($('#bookmark_add_description').val()) + "&tags=" + encodeURI($('#bookmark_add_tags').val()),
+ success: function(data){ $('.bookmarks_add').slideToggle(); $('.bookmarks_add').children('p').children('.bookmarks_input').val(''); }
+ });
+}
+
+function delBookmark(event) {
+ $.ajax({
+ url: 'ajax/delBookmark.php',
+ data: "url=" + encodeURI($(this).parent().parent().children('.bookmark_url:first').text()),
+ success: function(data){ alert('deleted!'); }
+ });
+}
+
+function updateBookmarksList(bookmark) {
+ var tags = encodeEntities(bookmark.tags).split(" ");
+ var taglist = "";
+ for ( var i=0, len=tags.length; i<len; ++i ){
+ taglist = taglist + "<a class=\"bookmark_tags\" href=\"?tag=" + encodeURI(tags[i]) + "\">" + tags[i] + "</a> ";
+ }
+ $('.bookmarks_list').append(
+ "<div class=\"bookmark_single\">" +
+ "<p class=\"bookmark_title\"><a href=\"" + encodeEntities(bookmark.url) + "\" target=\"_new\" class=\"bookmark_link\">" + encodeEntities(bookmark.title) + "</a></p>" +
+ "<p class=\"bookmark_url\">" + encodeEntities(bookmark.url) + "</p>" +
+ "<p class=\"bookmark_description\">" + encodeEntities(bookmark.description) + "</p>" +
+ "<p>" + taglist + "</p>" +
+ "<p class=\"bookmark_actions\"><span class=\"bookmark_delete\">Delete</span></p>" +
+ "</div>"
+ );
+}
+
+function updateOnBottom() {
+ //check wether user is on bottom of the page
+ if ($('body').height() <= ($(window).height() + $(window).scrollTop())) {
+ getBookmarks();
+ }
+}
+
+function recordClick(event) {
+ $.ajax({
+ url: 'ajax/recordClick.php',
+ data: "url=" + encodeURI($(this).attr('href')),
+ });
+ return false;
+}
+
+function encodeEntities(s){
+ try {
+ return $("<div/>").text(s).html();
+
+ } catch (ex) {
+ return "";
+ }
+}
diff --git a/apps/bookmarks/templates/list.php b/apps/bookmarks/templates/list.php
new file mode 100644
index 00000000000..278a0db5249
--- /dev/null
+++ b/apps/bookmarks/templates/list.php
@@ -0,0 +1,18 @@
+<input type="hidden" id="bookmarkFilterTag" value="<?php echo htmlentities($_GET['tag']); ?>" />
+<h2 class="bookmarks_headline"><?php echo isset($_GET["tag"]) ? 'Bookmarks with tag: ' . urldecode($_GET["tag"]) : 'All bookmarks'; ?></h2>
+<div class="bookmarks_menu">
+ <input type="button" class="bookmarks_addBtn" value="Add Bookmark" />
+</div>
+<div class="bookmarks_add">
+ <p><label class="bookmarks_label">URL: </label><input type="text" id="bookmark_add_url" class="bookmarks_input" /></p>
+ <p><label class="bookmarks_label">Title: </label><input type="text" id="bookmark_add_title" class="bookmarks_input" /></p>
+ <p><label class="bookmarks_label">Description: </label><input type="text" id="bookmark_add_description" class="bookmarks_input" /></p>
+ <p><label class="bookmarks_label">Tags:</label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
+ <p><label class="bookmarks_label"></label><input type="submit" id="bookmark_add_submit" /></p>
+</div>
+<div class="bookmarks_list">
+ <noscript>
+ JavaScript is needed to display your Bookmarks
+ </noscript>
+ You have no bookmarks
+</div> \ No newline at end of file
diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css
index c7680f4a716..1f95fdb2ad4 100644
--- a/apps/contacts/css/styles.css
+++ b/apps/contacts/css/styles.css
@@ -1 +1,2 @@
-.contacts_propertyname {float:left;}
+.contacts_details_left {text-align:right;vertical-align:top;padding:2px;}
+.contacts_details_right {text-align:left;vertical-align:top;padding:2px;}
diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js
index ef2179b372b..b8a66d51aab 100644
--- a/apps/contacts/js/interface.js
+++ b/apps/contacts/js/interface.js
@@ -102,12 +102,12 @@ $(document).ready(function(){
return false;
});
- $('.contacts_property [data-use="edit"]').live('click',function(){
+ $('.contacts_details_property [data-use="edit"]').live('click',function(){
var id = $('#rightcontent').data('id');
var checksum = $(this).parent().parent().data('checksum');
$.getJSON('ajax/showsetproperty.php',{'id': id, 'checksum': checksum },function(jsondata){
if(jsondata.status == 'success'){
- $('.contacts_property[data-checksum="'+checksum+'"] .contacts_propertyvalue').html(jsondata.data.page);
+ $('.contacts_details_property[data-checksum="'+checksum+'"] .contacts_details_right').html(jsondata.data.page);
}
else{
alert(jsondata.data.message);
@@ -119,7 +119,7 @@ $(document).ready(function(){
$('#contacts_setpropertyform input[type="submit"]').live('click',function(){
$.post('ajax/setproperty.php',$('#contacts_setpropertyform').serialize(),function(jsondata){
if(jsondata.status == 'success'){
- $('.contacts_property[data-checksum="'+jsondata.data.oldchecksum+'"]').replaceWith(jsondata.data.page);
+ $('.contacts_details_property[data-checksum="'+jsondata.data.oldchecksum+'"]').replaceWith(jsondata.data.page);
}
else{
alert(jsondata.data.message);
@@ -128,12 +128,12 @@ $(document).ready(function(){
return false;
});
- $('.contacts_property [data-use="delete"]').live('click',function(){
+ $('.contacts_details_property [data-use="delete"]').live('click',function(){
var id = $('#rightcontent').data('id');
var checksum = $(this).parent().parent().data('checksum');
$.getJSON('ajax/deleteproperty.php',{'id': id, 'checksum': checksum },function(jsondata){
if(jsondata.status == 'success'){
- $('.contacts_property[data-checksum="'+checksum+'"]').remove();
+ $('.contacts_details_property[data-checksum="'+checksum+'"]').remove();
}
else{
alert(jsondata.data.message);
@@ -143,11 +143,11 @@ $(document).ready(function(){
});
- $('.contacts_property').live('mouseenter',function(){
+ $('.contacts_details_property').live('mouseenter',function(){
$(this).find('span').show();
});
- $('.contacts_property').live('mouseleave',function(){
+ $('.contacts_details_property').live('mouseleave',function(){
$(this).find('span').hide();
});
});
diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php
index bab260840d9..9a5dea6f45f 100644
--- a/apps/contacts/lib/addressbook.php
+++ b/apps/contacts/lib/addressbook.php
@@ -167,7 +167,12 @@ class OC_Contacts_Addressbook{
$uri = $property->value.'.vcf';
}
}
- if(is_null($uri)) $uri = self::createUID().'.vcf';
+ if(is_null($uri)){
+ $uid = self::createUID();
+ $uri = $uid.'.vcf';
+ $card->add(new Sabre_VObject_Property('UID',$uid));
+ $data = $card->serialize();
+ };
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php
index 119c88486ac..5048349abc5 100644
--- a/apps/contacts/templates/part.details.php
+++ b/apps/contacts/templates/part.details.php
@@ -1,27 +1,33 @@
-<?php if(array_key_exists('PHOTO',$_['details'])): ?>
- <img src="photo.php?id=<?php echo $_['id']; ?>">
-<?php endif; ?>
-
<?php if(array_key_exists('FN',$_['details'])): ?>
- <?php echo $this->inc('part.property', array('property' => $_['details']['FN'][0])); ?>
-<?php endif; ?>
+ <table>
+ <?php if(isset($_['details']['PHOTO'])): // Emails first ?>
+ <tr class="contacts_details_property">
+ <td class="contacts_details_left">&nbsp;</td>
+ <td class="contacts_details_right">
+ <img src="photo.php?id=<?php echo $_['id']; ?>">
+ </td>
+ </tr>
+ <?php endif; ?>
+
+ <?php echo $this->inc('part.property', array('property' => $_['details']['FN'][0])); ?>
+
+ <?php if(isset($_['details']['BDAY'])): // Emails first ?>
+ <?php echo $this->inc('part.property', array('property' => $_['details']['BDAY'][0])); ?>
+ <?php endif; ?>
-<?php if(isset($_['details']['BDAY'])): // Emails first ?>
- <?php echo $this->inc('part.property', array('property' => $_['details']['BDAY'][0])); ?>
-<?php endif; ?>
+ <?php if(isset($_['details']['ORG'])): // Emails first ?>
+ <?php echo $this->inc('part.property', array('property' => $_['details']['ORG'][0])); ?>
+ <?php endif; ?>
-<?php if(isset($_['details']['ORG'])): // Emails first ?>
- <?php echo $this->inc('part.property', array('property' => $_['details']['ORG'][0])); ?>
-<?php endif; ?>
-
-<?php foreach(array('EMAIL','TEL','ADR') as $type): ?>
- <?php if(isset($_['details'][$type])): // Emails first ?>
- <br>
- <?php foreach($_['details'][$type] as $property): ?>
- <?php echo $this->inc('part.property',array('property' => $property )); ?>
+ <?php foreach(array('EMAIL','TEL','ADR') as $type): ?>
+ <?php if(isset($_['details'][$type])): // Emails first ?>
+ <?php foreach($_['details'][$type] as $property): ?>
+ <?php echo $this->inc('part.property',array('property' => $property )); ?>
+ <?php endforeach; ?>
+ <?php endif; ?>
<?php endforeach; ?>
- <?php endif; ?>
-<?php endforeach; ?>
+ </table>
+<?php endif; ?>
<div id="contacts_cardoptions">
<a id="contacts_deletecard"><img class="svg action" src="<?php echo image_path('', 'actions/delete.svg'); ?>" /></a>
diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php
index cdb03068128..9e2a5cabad4 100644
--- a/apps/contacts/templates/part.property.php
+++ b/apps/contacts/templates/part.property.php
@@ -1,49 +1,49 @@
-<div class="contacts_property" data-checksum="<?php echo $_['property']['checksum']; ?>">
+<tr class="contacts_details_property" data-checksum="<?php echo $_['property']['checksum']; ?>">
<?php if($_['property']['name'] == 'FN'): ?>
- <div class="contacts_propertyname"><?php echo $l->t('Name'); ?></div>
- <div class="contacts_propertyvalue">
+ <td class="contacts_details_left"><?php echo $l->t('Name'); ?></td>
+ <td class="contacts_details_right">
<?php echo $_['property']['value']; ?>
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
- </div>
+ </td>
<?php elseif($_['property']['name'] == 'BDAY'): ?>
- <div class="contacts_propertyname"><?php echo $l->t('Birthday'); ?></div>
- <div class="contacts_propertyvalue">
+ <td class="contacts_details_left"><?php echo $l->t('Birthday'); ?></td>
+ <td class="contacts_details_right">
<?php echo $l->l('date',new DateTime($_['property']['value'])); ?>
<span style="display:none;" data-use="delete"><img class="svg action" src="<?php echo image_path('', 'actions/delete.svg'); ?>" /></span>
- </div>
+ </td>
<?php elseif($_['property']['name'] == 'ORG'): ?>
- <div class="contacts_propertyname"><?php echo $l->t('Organisation'); ?></div>
- <div class="contacts_propertyvalue">
+ <td class="contacts_details_left"><?php echo $l->t('Organisation'); ?></td>
+ <td class="contacts_details_right">
<?php echo $_['property']['value']; ?>
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
<span style="display:none;" data-use="delete"><img class="svg action" src="<?php echo image_path('', 'actions/delete.svg'); ?>" /></span>
- </div>
+ </td>
<?php elseif($_['property']['name'] == 'EMAIL'): ?>
- <div class="contacts_propertyname"><?php echo $l->t('Email'); ?></div>
- <div class="contacts_propertyvalue">
+ <td class="contacts_details_left"><?php echo $l->t('Email'); ?></td>
+ <td class="contacts_details_right">
<?php echo $_['property']['value']; ?>
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
<span style="display:none;" data-use="delete"><img class="svg action" src="<?php echo image_path('', 'actions/delete.svg'); ?>" /></span>
- </div>
+ </td>
<?php elseif($_['property']['name'] == 'TEL'): ?>
- <div class="contacts_propertyname"><?php echo $l->t('Telephone'); ?></div>
- <div class="contacts_propertyvalue">
+ <td class="contacts_details_left"><?php echo $l->t('Telephone'); ?></td>
+ <td class="contacts_details_right">
<?php echo $_['property']['value']; ?>
<?php if(isset($_['property']['parameters']['TYPE'])): ?>
(<?php echo $l->t('tel_'.strtolower($_['property']['parameters']['TYPE'])); ?>)
<?php endif; ?>
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
<span style="display:none;" data-use="delete"><img class="svg action" src="<?php echo image_path('', 'actions/delete.svg'); ?>" /></span>
- </div>
+ </td>
<?php elseif($_['property']['name'] == 'ADR'): ?>
- <div class="contacts_propertyname">
+ <td class="contacts_details_left">
<?php echo $l->t('Address'); ?>
<?php if(isset($_['property']['parameters']['TYPE'])): ?>
<br>
(<?php echo $l->t('adr_'.strtolower($_['property']['parameters']['TYPE'])); ?>)
<?php endif; ?>
- </div>
- <div class="contacts_propertyvalue">
+ </td>
+ <td class="contacts_details_right">
<?php echo $l->t('PO Box'); ?> <?php echo $_['property']['value'][0]; ?><br>
<?php echo $l->t('Extended Address'); ?> <?php echo $_['property']['value'][1]; ?><br>
<?php echo $l->t('Street Name'); ?> <?php echo $_['property']['value'][2]; ?><br>
@@ -53,6 +53,6 @@
<?php echo $l->t('Country'); ?> <?php echo $_['property']['value'][6]; ?>
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
<span style="display:none;" data-use="delete"><img class="svg action" src="<?php echo image_path('', 'actions/delete.svg'); ?>" /></span>
- </div>
+ </td>
<?php endif; ?>
-</div>
+</tr>
diff --git a/config/.gitignore b/config/.gitignore
deleted file mode 100755
index d09f42a2389..00000000000
--- a/config/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-#autogenerated
-config.php
diff --git a/core/ajax/grouplist.php b/core/ajax/grouplist.php
new file mode 100644
index 00000000000..9b6c4bfa8a8
--- /dev/null
+++ b/core/ajax/grouplist.php
@@ -0,0 +1,45 @@
+<?php
+
+/**
+* ownCloud - ajax group list
+*
+* @author Hans Bakker
+* @copyright 2011 hansmbakker+kde@gmail.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/>.
+*
+*/
+
+
+// We send json data
+header( "Content-Type: application/jsonrequest" );
+
+$RUNTIME_NOAPPS = TRUE; //no apps, yet
+require_once('../../lib/base.php');
+
+if(isset($_GET["user"]) && isset($_GET["password"]))
+{
+ if(!OC_User::checkPassword($_GET["user"], $_GET["password"]))
+ exit();
+
+ $groups = array();
+
+ foreach( OC_Group::getGroups() as $i ){
+ // Do some more work here soon
+ $groups[] = array( "groupname" => $i );
+ }
+
+ echo json_encode($groups);
+}
+?>
diff --git a/core/ajax/userlist.php b/core/ajax/userlist.php
new file mode 100644
index 00000000000..16e89c2ee8f
--- /dev/null
+++ b/core/ajax/userlist.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+* ownCloud - ajax user list
+*
+* @author Hans Bakker
+* @copyright 2011 hansmbakker+kde@gmail.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/>.
+*
+*/
+
+
+// We send json data
+header( "Content-Type: application/jsonrequest" );
+
+$RUNTIME_NOAPPS = TRUE; //no apps, yet
+require_once('../../lib/base.php');
+
+if(isset($_GET["user"]) && isset($_GET["password"]))
+{
+ if(!OC_User::checkPassword($_GET["user"], $_GET["password"]))
+ exit();
+
+ $users = array();
+
+ foreach( OC_User::getUsers() as $i ){
+ $users[] = array( "username" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) ));
+ }
+
+ echo json_encode($users);
+
+
+}
+
+?>
diff --git a/core/js/js.js b/core/js/js.js
index 2f495321b86..3e53a8bbce2 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -302,9 +302,7 @@ $(document).ready(function(){
// all the tipsy stuff needs to be here (in reverse order) to work
$('.jp-controls .jp-previous').tipsy({gravity:'nw', fade:true, live:true});
$('.jp-controls .jp-next').tipsy({gravity:'n', fade:true, live:true});
- $('.remove .action').tipsy({gravity:'se', fade:true, live:true});
- $('.date .action').tipsy({gravity:'se', fade:true, live:true});
- $('.action').tipsy({gravity:'s', fade:true, live:true});
+ $('.password .action').tipsy({gravity:'se', fade:true, live:true});
$('.selectedActions a.delete').tipsy({gravity: 'ne', fade:true, live:true});
$('.selectedActions a').tipsy({gravity:'n', fade:true, live:true});
$('.file_upload_button_wrapper').tipsy({gravity:'e', fade:true});
diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php
index 42c2539af13..04bb21896f1 100644
--- a/core/templates/layout.guest.php
+++ b/core/templates/layout.guest.php
@@ -35,6 +35,6 @@
</div></header>
<?php echo $_['content']; ?>
</div>
- <footer><p class="info"><a href="http://owncloud.org/">ownCloud</a> <?php echo $l->t( 'is a personal cloud which runs on your own server' ); ?>.</p></footer>
+ <footer><p class="info"><a href="http://owncloud.org/">ownCloud</a> <?php echo $l->t( 'gives you the freedom to control your own data on the internet' ); ?></p></footer>
</body>
</html>
diff --git a/files/ajax/upload.php b/files/ajax/upload.php
index 5dcd2f2b6af..4247aeca283 100644
--- a/files/ajax/upload.php
+++ b/files/ajax/upload.php
@@ -19,6 +19,16 @@ $files=$_FILES['files'];
$dir = $_POST['dir'];
if(!empty($dir)) $dir .= '/';
$error='';
+
+$totalSize=0;
+foreach($files['size'] as $size){
+ $totalSize+=$size;
+}
+if($totalSize>OC_Filesystem::free_space('/')){
+ echo json_encode( array( "status" => "error", "data" => array( "message" => "Not enough space available" )));
+ exit();
+}
+
$result=array();
if(strpos($dir,'..') === false){
$fileCount=count($files['name']);
diff --git a/lib/fileproxy.php b/lib/fileproxy.php
new file mode 100644
index 00000000000..549b7015a6a
--- /dev/null
+++ b/lib/fileproxy.php
@@ -0,0 +1,111 @@
+<?php
+
+/**
+* ownCloud
+*
+* @author Robin Appelman
+* @copyright 2011 Robin Appelman icewind1991@gmail.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 for manipulating filesystem requests
+ *
+ * Manipulation happens by using 2 kind of proxy operations, pre and post proxies
+ * that manipulate the filesystem call and the result of the call respectively
+ *
+ * A pre-proxy recieves the filepath as arugments (or 2 filespaths in case of operations like copy or move) and return a boolean
+ * If a pre-proxy returnes false the file operation will be canceled
+ * All filesystem operations have a pre-proxy
+ *
+ * A post-proxy recieves 2 arguments, the filepath and the result of the operation.
+ * The return calue of the post-proxy will be used as the new result of the operation
+ * The operations that have a post-proxy are
+ * file_get_contents, is_file, is_dir, file_exists, stat, is_readable, is_writable, fileatime, filemtime, filectime, file_get_contents, getMimeType, hash, free_space and search
+ */
+
+class OC_FileProxy{
+ private static $proxies=array();
+
+ /**
+ * check if this proxy implments a specific proxy operation
+ * @param string #proxy name of the proxy operation
+ * @return bool
+ */
+ public function provides($operation){
+ return method_exists($this,$operation);
+ }
+
+ /**
+ * fallback function when a proxy operation is not implement
+ * @param string $function the name of the proxy operation
+ * @param mixed
+ *
+ * this implements a dummy proxy for all operations
+ */
+ public function __call($function,$arguments){
+ if(substr($function,0,3)=='pre'){
+ return true;
+ }else{
+ return $arguments[1];
+ }
+ }
+
+ /**
+ * register a proxy to be used
+ * @param OC_FileProxy $proxy
+ */
+ public static function register($proxy){
+ self::$proxies[]=$proxy;
+ }
+
+ public static function getProxies($operation,$post){
+ $operation=(($post)?'post':'pre').$operation;
+ $proxies=array();
+ foreach(self::$proxies as $proxy){
+ if($proxy->provides($operation)){
+ $proxies[]=$proxy;
+ }
+ }
+ return $proxies;
+ }
+
+ public static function runPreProxies($operation,$filepath,$filepath2=null){
+ $proxies=self::getProxies($operation,false);
+ $operation='pre'.$operation;
+ foreach($proxies as $proxy){
+ if($filepath2){
+ if(!$proxy->$operation($filepath,$filepath2)){
+ return false;
+ }
+ }else{
+ if(!$proxy->$operation($filepath)){
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ public static function runPostProxies($operation,$path,$result){
+ $proxies=self::getProxies($operation,true);
+ $operation='post'.$operation;
+ foreach($proxies as $proxy){
+ $result=$proxy->$operation($path,$result);
+ }
+ return $result;
+ }
+} \ No newline at end of file
diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php
new file mode 100644
index 00000000000..af8ddee1473
--- /dev/null
+++ b/lib/fileproxy/quota.php
@@ -0,0 +1,61 @@
+<?php
+
+/**
+* ownCloud
+*
+* @author Robin Appelman
+* @copyright 2011 Robin Appelman icewind1991@gmail.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/>.
+*
+*/
+
+/**
+ * user quota managment
+ */
+
+class OC_FileProxy_Quota extends OC_FileProxy{
+ private function getFreeSpace(){
+ $usedSpace=OC_Filesystem::filesize('');
+ $totalSpace=OC_Preferences::getValue(OC_User::getUser(),'files','quota',0);
+ if($totalSpace==0){
+ return 0;
+ }
+ return $totalSpace-$usedSpace;
+ }
+
+ public function postFree_space($path,$space){
+ $free=$this->getFreeSpace();
+ if($free==0){
+ return $space;
+ }
+ return min($free,$space);
+ }
+
+ public function preFile_put_contents($path,$data){
+ return (strlen($data)<$this->getFreeSpace() or $this->getFreeSpace()==0);
+ }
+
+ public function preCopy($path1,$path2){
+ return (OC_Filesystem::filesize($path1)<$this->getFreeSpace() or $this->getFreeSpace()==0);
+ }
+
+ public function preFromTmpFile($tmpfile,$path){
+ return (filesize($tmpfile)<$this->getFreeSpace() or $this->getFreeSpace()==0);
+ }
+
+ public function preFromUploadedFile($tmpfile,$path){
+ return (filesize($tmpfile)<$this->getFreeSpace() or $this->getFreeSpace()==0);
+ }
+} \ No newline at end of file
diff --git a/lib/files.php b/lib/files.php
index bdcae419189..dd74b086705 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -222,11 +222,7 @@ class OC_Files {
public static function delete($dir,$file){
if(OC_User::isLoggedIn()){
$file=$dir.'/'.$file;
- if(OC_Filesystem::is_file($file)){
- return OC_Filesystem::unlink($file);
- }elseif(OC_Filesystem::is_dir($file)){
- return OC_Filesystem::delTree($file);
- }
+ return OC_Filesystem::unlink($file);
}
}
diff --git a/lib/filestorage.php b/lib/filestorage.php
index b398285d340..34fa6457fd2 100644
--- a/lib/filestorage.php
+++ b/lib/filestorage.php
@@ -50,9 +50,6 @@ class OC_Filestorage{
public function fromTmpFile($tmpPath,$path){}//copy a file from a temporary file, used for cross-storage file actions
public function fromUploadedFile($tmpPath,$path){}//copy a file from a temporary file, used for cross-storage file actions
public function getMimeType($path){}
- public function delTree($path){}
- public function find($path){}
- public function getTree($path){}
public function hash($type,$path,$raw){}
public function free_space($path){}
public function search($query){}
diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php
index 3bbdd6b4137..07759b0e88c 100644
--- a/lib/filestorage/local.php
+++ b/lib/filestorage/local.php
@@ -79,9 +79,8 @@ class OC_Filestorage_Local extends OC_Filestorage{
}
}
public function unlink($path){
- if($return=unlink($this->datadir.$path)){
- $this->clearFolderSizeCache($path);
- }
+ $return=$this->delTree($path);
+ $this->clearFolderSizeCache($path);
return $return;
}
public function rename($path1,$path2){
@@ -195,7 +194,8 @@ class OC_Filestorage_Local extends OC_Filestorage{
}
}
- public function delTree($dir) {
+ private function delTree($dir) {
+ error_log('del'.$dir);
$dirRelative=$dir;
$dir=$this->datadir.$dir;
if (!file_exists($dir)) return true;
@@ -218,36 +218,6 @@ class OC_Filestorage_Local extends OC_Filestorage{
return $return;
}
- public function find($path){
- $return=System::find($this->datadir.$path);
- foreach($return as &$file){
- $file=str_replace($file,$this->datadir,'');
- }
- return $return;
- }
-
- public function getTree($dir) {
- if(substr($dir,-1,1)=='/'){
- $dir=substr($dir,0,-1);
- }
- $tree=array();
- $tree[]=$dir;
- $dirRelative=$dir;
- $dir=$this->datadir.$dir;
- if (!file_exists($dir)) return true;
- foreach (scandir($dir) as $item) {
- if ($item == '.' || $item == '..') continue;
- if(is_file($dir.'/'.$item)){
- $tree[]=$dirRelative.'/'.$item;
- }elseif(is_dir($dir.'/'.$item)){
- if ($subTree=$this->getTree($dirRelative. "/" . $item)){
- $tree=array_merge($tree,$subTree);
- }
- }
- }
- return $tree;
- }
-
public function hash($type,$path,$raw){
return hash_file($type,$this->datadir.$path,$raw);
}
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 829482c7fa5..76032fae204 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -229,150 +229,71 @@ class OC_Filesystem{
}
static public function mkdir($path){
- $parent=substr($path,0,strrpos($path,'/'));
- if(self::canWrite($parent) and $storage=self::getStorage($path)){
- $run=true;
- OC_Hook::emit( 'OC_Filesystem', 'create', array( 'path' => $path, 'run' => &$run));
- if($run){
- OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path, 'run' => &$run));
- }
- if($run){
- $result=$storage->mkdir(self::getInternalPath($path));
- OC_Hook::emit( 'OC_Filesystem', 'post_create', array( 'path' => $path));
- OC_Hook::emit( 'OC_Filesystem', 'post_write', array( 'path' => $path));
- return $result;
- }
- }
+ return self::basicOperation('mkdir',$path,array('create','write'));
}
static public function rmdir($path){
- if(self::canWrite($path) and $storage=self::getStorage($path)){
- $run=true;
- OC_Hook::emit( 'OC_Filesystem', 'delete', array( 'path' => $path, 'run' => &$run));
- if($run){
- $result=$storage->rmdir(self::getInternalPath($path));
- OC_Hook::emit( 'OC_Filesystem', 'post_delete', array( 'path' => $path));
- return $result;
- }
- }
+ return self::basicOperation('rmdir',$path,array('delete'));
}
static public function opendir($path){
- if(self::canRead($path) and $storage=self::getStorage($path)){
- OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path));
- return $storage->opendir(self::getInternalPath($path));
- }
+ return self::basicOperation('opendir',$path,array('read'));
}
static public function is_dir($path){
if($path=='/'){
return true;
}
- if(self::canRead($path) and $storage=self::getStorage($path)){
- return $storage->is_dir(self::getInternalPath($path));
- }
+ return self::basicOperation('is_dir',$path);
}
static public function is_file($path){
if($path=='/'){
return false;
}
- if(self::canRead($path) and $storage=self::getStorage($path)){
- return $storage->is_file(self::getInternalPath($path));
- }
+ return self::basicOperation('is_file',$path);
}
static public function stat($path){
- if(self::canRead($path) and $storage=self::getStorage($path)){
- return $storage->stat(self::getInternalPath($path));
- }
+ return self::basicOperation('stat',$path);
}
static public function filetype($path){
- if(self::canRead($path) and $storage=self::getStorage($path)){
- return $storage->filetype(self::getInternalPath($path));
- }
+ return self::basicOperation('filetype',$path);
}
static public function filesize($path){
- if(self::canRead($path) and $storage=self::getStorage($path)){
- return $storage->filesize(self::getInternalPath($path));
- }
+ return self::basicOperation('filesize',$path);
}
static public function readfile($path){
- if(self::canRead($path) and $storage=self::getStorage($path)){
- OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path));
- return $storage->readfile(self::getInternalPath($path));
- }
+ return self::basicOperation('readfile',$path,array('read'));
}
static public function is_readable($path){
- if(self::canRead($path) and $storage=self::getStorage($path)){
- return $storage->is_readable(self::getInternalPath($path));
- }
- return false;
+ return self::basicOperation('is_readable',$path);
}
static public function is_writeable($path){
- if(self::canWrite($path) and $storage=self::getStorage($path)){
- return $storage->is_writeable(self::getInternalPath($path));
- }
- return false;
+ return self::basicOperation('is_writeable',$path);
}
static public function file_exists($path){
if($path=='/'){
return true;
}
- if(self::canWrite($path) and $storage=self::getStorage($path)){
- return $storage->file_exists(self::getInternalPath($path));
- }
- return false;
+ return self::basicOperation('file_exists',$path);
}
static public function filectime($path){
- if($storage=self::getStorage($path)){
- return $storage->filectime(self::getInternalPath($path));
- }
+ return self::basicOperation('filectime',$path);
}
static public function filemtime($path){
- if($storage=self::getStorage($path)){
- return $storage->filemtime(self::getInternalPath($path));
- }
+ return self::basicOperation('filemtime',$path);
}
static public function fileatime($path){
- if($storage=self::getStorage($path)){
- return $storage->fileatime(self::getInternalPath($path));
- }
+ return self::basicOperation('fileatime',$path);
}
static public function file_get_contents($path){
- if(self::canRead($path) and $storage=self::getStorage($path)){
- OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path));
- return $storage->file_get_contents(self::getInternalPath($path));
- }
+ return self::basicOperation('file_get_contents',$path,array('read'));
}
static public function file_put_contents($path,$data){
- if(self::canWrite($path) and $storage=self::getStorage($path)){
- $run=true;
- $exists=self::file_exists($path);
- if(!$exists){
- OC_Hook::emit( 'OC_Filesystem', 'create', array( 'path' => $path, 'run' => &$run));
- }
- if($run){
- OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path, 'run' => &$run));
- }
- if($run){
- $result=$storage->file_put_contents(self::getInternalPath($path),$data);
- if(!$exists){
- OC_Hook::emit( 'OC_Filesystem', 'post_create', array( 'path' => $path));
- }
- OC_Hook::emit( 'OC_Filesystem', 'post_write', array( 'path' => $path));
- return $result;
- }
- }
+ error_log($data);
+ return self::basicOperation('file_put_contents',$path,array('create','write'),$data);
}
static public function unlink($path){
- if(self::canWrite($path) and $storage=self::getStorage($path)){
- $run=true;
- OC_Hook::emit( 'OC_Filesystem', 'delete', array( 'path' => $path, 'run' => &$run));
- if($run){
- $result=$storage->unlink(self::getInternalPath($path));
- OC_Hook::emit( 'OC_Filesystem', 'post_delete', array( 'path' => $path));
- return $result;
- }
- }
+ return self::basicOperation('unlink',$path,array('delete'));
}
static public function rename($path1,$path2){
- if(self::canWrite($path1) and self::canWrite($path2)){
+ if(OC_FileProxy::runPreProxies('rename',$path1,$path2) and self::canWrite($path1) and self::canWrite($path2)){
$run=true;
OC_Hook::emit( 'OC_Filesystem', 'rename', array( 'oldpath' => $path1 ,'newpath'=>$path2, 'run' => &$run));
if($run){
@@ -393,7 +314,7 @@ class OC_Filesystem{
}
}
static public function copy($path1,$path2){
- if(self::canRead($path1) and self::canWrite($path2)){
+ if(OC_FileProxy::runPreProxies('copy',$path1,$path2) and self::canRead($path1) and self::canWrite($path2)){
$run=true;
OC_Hook::emit( 'OC_Filesystem', 'copy', array( 'oldpath' => $path1 ,'newpath'=>$path2, 'run' => &$run));
$exists=self::file_exists($path2);
@@ -424,60 +345,35 @@ class OC_Filesystem{
}
}
static public function fopen($path,$mode){
- $allowed=((strpos($path,'r')===false and strpos($path,'r+')!==false and self::canRead) or self::canWrite($path));
- if($allowed){
- if($storage=self::getStorage($path)){
- $run=true;
- $exists=self::file_exists($path);
- $write=false;
- switch($mode){
- case 'r':
- OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path));
- break;
- case 'r+':
- case 'w+':
- case 'x+':
- case 'a+':
- OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path));
- $write=true;
- break;
- case 'w':
- case 'x':
- case 'a':
- $write=true;
- break;
- }
- if($write){
- if(!$exists){
- OC_Hook::emit( 'OC_Filesystem', 'create', array( 'path' => $path));
- }
- if($run){
- OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path, 'run' => &$run));
- }
- }
- if($run){
- $result=$storage->fopen(self::getInternalPath($path),$mode);
- if($write){
- if(!$exists){
- OC_Hook::emit( 'OC_Filesystem', 'post_create', array( 'path' => $path));
- }
- if($run){
- OC_Hook::emit( 'OC_Filesystem', 'post_write', array( 'path' => $path));
- }
- }
- return $result;
- }
- }
+ $hooks=array();
+ switch($mode){
+ case 'r':
+ $hooks[]='read';
+ break;
+ case 'r+':
+ case 'w+':
+ case 'x+':
+ case 'a+':
+ $hooks[]='read';
+ $hooks[]='write';
+ break;
+ case 'w':
+ case 'x':
+ case 'a':
+ $hooks[]='write';
+ break;
}
+
+ return self::basicOperation('fopen',$path,$hooks);
}
static public function toTmpFile($path){
- if(self::canRead($path) and $storage=self::getStorage($path)){
+ if(OC_FileProxy::runPreProxies('toTmpFile',$path) and self::canRead($path) and $storage=self::getStorage($path)){
OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path));
return $storage->toTmpFile(self::getInternalPath($path));
}
}
static public function fromTmpFile($tmpFile,$path){
- if(self::canWrite($path) and $storage=self::getStorage($path)){
+ if(OC_FileProxy::runPreProxies('copy',$tmpFile,$path) and self::canWrite($path) and $storage=self::getStorage($path)){
$run=true;
$exists=self::file_exists($path);
if(!$exists){
@@ -498,7 +394,7 @@ class OC_Filesystem{
}
static public function fromUploadedFile($tmpFile,$path){
error_log('upload');
- if(self::canWrite($path) and $storage=self::getStorage($path)){
+ if(OC_FileProxy::runPreProxies('fromUploadedFile',$tmpFile,$path) and self::canWrite($path) and $storage=self::getStorage($path)){
$run=true;
$exists=self::file_exists($path);
if(!$exists){
@@ -519,57 +415,14 @@ class OC_Filesystem{
}
}
static public function getMimeType($path){
- if(self::canRead($path) and $storage=self::getStorage($path)){
- return $storage->getMimeType(self::getInternalPath($path));
- }
+ return self::basicOperation('getMimeType',$path);
}
- static public function delTree($path){
- if(self::canWrite($path) and $storage=self::getStorage($path)){
- $run=true;
- OC_Hook::emit( 'OC_Filesystem', 'delete', array( 'path' => $path, 'run' => &$run));
- if($run){
- return $storage->delTree(self::getInternalPath($path));
- }
- }
- }
- static public function find($path){
- if($storage=self::getStorage($path)){
- $mp=self::getMountPoint($path);
- $return=$storage->find(self::getInternalPath($path));
- foreach($return as &$file){
- $file=$mp.$file;
- }
- }
- return $return;
- }
- static public function getTree($path){
- if(self::canRead($path) and $storage=self::getStorage($path)){
- $mp=self::getMountPoint($path);
- $return=$storage->getTree(self::getInternalPath($path));
- foreach($return as &$file){
- if(substr($file,0,1)=='/'){
- $file=substr($file,1);
- }
- $file=$mp.$file;
- $file=substr($file,strlen(self::$fakeRoot));
- if($file === '' || $file === false){
- $file = '/';
- }
- }
- return $return;
- }
- }
- static public function hash($type,$path,$raw=false){
- if(self::canRead($path) and $storage=self::getStorage($path)){
- OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path));
- return $storage->hash($type,self::getInternalPath($path),$raw);
- }
+ static public function hash($type,$path){
+ return self::basicOperation('hash',$path,array('read'));
}
static public function free_space($path='/'){
- if(self::canRead($path) and $storage=self::getStorage($path)){
- return $storage->free_space($path);
- }
+ return self::basicOperation('free_space',$path);
}
static public function search($query){
@@ -591,4 +444,41 @@ class OC_Filesystem{
return $files;
}
+
+ /**
+ * abstraction for running most basic operations
+ * @param string $operation
+ * @param string #path
+ * @param array (optional) hooks
+ * @param mixed (optional) $extraParam
+ * @return mixed
+ */
+ private static function basicOperation($operation,$path,$hooks=array(),$extraParam=null){
+ if(OC_FileProxy::runPreProxies($operation,$path) and self::canRead($path) and $storage=self::getStorage($path)){
+ $interalPath=self::getInternalPath($path);
+ $run=true;
+ foreach($hooks as $hook){
+ if($hook!='read'){
+ OC_Hook::emit( 'OC_Filesystem', $hook, array( 'path' => $path, 'run' => &$run));
+ }else{
+ OC_Hook::emit( 'OC_Filesystem', $hook, array( 'path' => $path));
+ }
+ }
+ if($run){
+ if($extraParam){
+ $result=$storage->$operation($interalPath,$extraParam);
+ }else{
+ $result=$storage->$operation($interalPath);
+ }
+ $result=OC_FileProxy::runPostProxies($operation,$path,$result);
+ foreach($hooks as $hook){
+ if($hook!='read'){
+ OC_Hook::emit( 'OC_Filesystem', 'post_'.$hook, array( 'path' => $path));
+ }
+ }
+ return $result;
+ }
+ }
+ return null;
+ }
}
diff --git a/lib/util.php b/lib/util.php
index 224b54335b8..53c4283be11 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -78,6 +78,8 @@ class OC_Util {
//jail the user into his "home" directory
OC_Filesystem::chroot("/$user/$root");
+ $quotaProxy=new OC_FileProxy_Quota();
+ OC_FileProxy::register($quotaProxy);
self::$fsSetup=true;
}
}
diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php
new file mode 100644
index 00000000000..244a85e3d9c
--- /dev/null
+++ b/settings/ajax/setquota.php
@@ -0,0 +1,22 @@
+<?php
+
+// Init owncloud
+require_once('../../lib/base.php');
+
+// We send json data
+header( "Content-Type: application/jsonrequest" );
+
+// Check if we are a user
+if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )){
+ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
+ exit();
+}
+
+$username = $_POST["username"];
+$quota= OC_Helper::computerFileSize($_POST["quota"]);
+
+// Return Success story
+OC_Preferences::setValue($username,'files','quota',$quota);
+echo json_encode( array( "status" => "success", "data" => array( "username" => $username ,'quota'=>$quota)));
+
+?>
diff --git a/settings/apps.php b/settings/apps.php
index e41a0cbf8dd..05da4259768 100644
--- a/settings/apps.php
+++ b/settings/apps.php
@@ -46,16 +46,19 @@ foreach($registeredApps as $app){
}
}
-$categories=array_keys(OC_OCSClient::getCategories());
-$externalApps=OC_OCSClient::getApplications($categories);
-foreach($externalApps as $app){
- $apps[]=array(
- 'name'=>$app['name'],
- 'id'=>$app['id'],
- 'active'=>false,
- 'description'=>$app['description'],
- 'author'=>$app['personid'],
- );
+$catagoryNames=OC_OCSClient::getCategories();
+if(is_array($catagoryNames)){
+ $categories=array_keys($catagoryNames);
+ $externalApps=OC_OCSClient::getApplications($categories);
+ foreach($externalApps as $app){
+ $apps[]=array(
+ 'name'=>$app['name'],
+ 'id'=>$app['id'],
+ 'active'=>false,
+ 'description'=>$app['description'],
+ 'author'=>$app['personid'],
+ );
+ }
}
diff --git a/settings/js/apps.js b/settings/js/apps.js
index 069681e1cd1..21b5d233f03 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -13,7 +13,7 @@ $(document).ready(function(){
$('#rightcontent span.licence').text(app.licence);
$('#rightcontent input.enable').show();
- $('#rightcontent input.enable').val((app.active)?t('admin','Disable'):t('admin','Enable'));
+ $('#rightcontent input.enable').val((app.active)?t('settings','Disable'):t('settings','Enable'));
$('#rightcontent input.enable').data('appid',app.id);
$('#rightcontent input.enable').data('active',app.active);
});
@@ -22,15 +22,15 @@ $(document).ready(function(){
var active=$(this).data('active');
if(app){
if(active){
- $.post(OC.filePath('admin','ajax','disableapp.php'),{appid:app});
+ $.post(OC.filePath('settings','ajax','disableapp.php'),{appid:app});
$('#leftcontent li[data-id="'+app+'"]').removeClass('active');
}else{
- $.post(OC.filePath('admin','ajax','enableapp.php'),{appid:app});
+ $.post(OC.filePath('settings','ajax','enableapp.php'),{appid:app});
$('#leftcontent li[data-id="'+app+'"]').addClass('active');
}
active=!active;
$(this).data('active',active);
- $(this).val((active)?t('admin','Disable'):t('admin','Enable'));
+ $(this).val((active)?t('settings','Disable'):t('settings','Enable'));
var appData=$('#leftcontent li[data-id="'+app+'"]');
appData.active=active;
}
diff --git a/settings/js/users.js b/settings/js/users.js
index bc1b8fc3ed0..3122f5614c7 100644
--- a/settings/js/users.js
+++ b/settings/js/users.js
@@ -75,6 +75,45 @@ $(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();
+ img
+ if(quota=='None'){
+ quota='';
+ }
+ 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){}
+ );
+ input.blur();
+ }else{
+ input.blur();
+ }
+ }
+ });
+ input.blur(function(){
+ var quota=$(this).parent().data('quota');
+ $(this).replaceWith($('<span>'+quota+'</span>'));
+ img.css('display','');
+ });
+ });
+ $('td.quota').live('click',function(event){
+ $(this).children('img').click();
+ });
$('#newuser').submit(function(event){
event.preventDefault();
diff --git a/settings/templates/users.php b/settings/templates/users.php
index 01e2adf4e97..9733c3e9a50 100644
--- a/settings/templates/users.php
+++ b/settings/templates/users.php
@@ -31,6 +31,10 @@ 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>
<td class="remove">
<?php if($user['name']!=OC_User::getUser()):?>
<img alt="Delete" title="<?php echo $l->t('Delete')?>" class="svg action" src="<?php echo image_path('core','actions/delete.svg') ?>" />
diff --git a/settings/users.php b/settings/users.php
index cd7d04a55e7..8bf64e16fff 100644
--- a/settings/users.php
+++ b/settings/users.php
@@ -38,7 +38,7 @@ $users = array();
$groups = array();
foreach( OC_User::getUsers() as $i ){
- $users[] = array( "name" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) ));
+ $users[] = array( "name" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) ),'quota'=>OC_Helper::humanFileSize(OC_Preferences::getValue($i,'files','quota',0)));
}
foreach( OC_Group::getGroups() as $i ){