mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
merge master into database
This commit is contained in:
commit
9ba384b9a4
582 changed files with 26958 additions and 10820 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
|
@ -28,3 +28,11 @@ RCS/*
|
|||
# eclipse
|
||||
.project
|
||||
.settings
|
||||
|
||||
# netbeans
|
||||
nbproject
|
||||
|
||||
# geany
|
||||
*.geany
|
||||
|
||||
.DS_Store
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
ErrorDocument 404 //owncloud/core/templates/404.php
|
||||
ErrorDocument 404 /owncloud/core/templates/404.php
|
||||
<IfModule mod_php5.c>
|
||||
php_value upload_max_filesize 512M
|
||||
php_value post_max_size 512M
|
||||
SetEnv htaccessWorking true
|
||||
php_value upload_max_filesize 512M
|
||||
php_value post_max_size 512M
|
||||
php_value memory_limit 128M
|
||||
SetEnv htaccessWorking true
|
||||
</IfModule>
|
||||
Options -Indexes
|
||||
|
|
|
|||
79
.tx/config
79
.tx/config
|
|
@ -13,16 +13,21 @@ trans.da = l10n/da/core.po
|
|||
trans.de = l10n/de/core.po
|
||||
trans.el = l10n/el/core.po
|
||||
trans.es = l10n/es/core.po
|
||||
trans.et_EE = l10n/et_EE/core.po
|
||||
trans.fr = l10n/fr/core.po
|
||||
trans.id = l10n/id/core.po
|
||||
trans.it = l10n/it/core.po
|
||||
trans.lb = l10n/lb/core.po
|
||||
trans.ms_MY = l10n/ms_MY/core.po
|
||||
trans.nb_NO = l10n/nb_NO/core.po
|
||||
trans.nl = l10n/nl/core.po
|
||||
trans.pl = l10n/pl/core.po
|
||||
trans.pt_BR = l10n/pt_BR/core.po
|
||||
trans.pt_PT = l10n/pt_PT/core.po
|
||||
trans.ro = l10n/ro/core.po
|
||||
trans.ru = l10n/ru/core.po
|
||||
trans.sr = l10n/sr/core.po
|
||||
trans.sr@latin = l10n/sr@latin/core.po
|
||||
trans.sv = l10n/sv/core.po
|
||||
trans.zh_CN = l10n/zh_CN/core.po
|
||||
|
||||
|
|
@ -38,16 +43,21 @@ trans.da = l10n/da/settings.po
|
|||
trans.de = l10n/de/settings.po
|
||||
trans.el = l10n/el/settings.po
|
||||
trans.es = l10n/es/settings.po
|
||||
trans.et_EE = l10n/et_EE/settings.po
|
||||
trans.fr = l10n/fr/settings.po
|
||||
trans.id = l10n/id/settings.po
|
||||
trans.it = l10n/it/settings.po
|
||||
trans.lb = l10n/lb/settings.po
|
||||
trans.ms_MY = l10n/ms_MY/settings.po
|
||||
trans.nb_NO = l10n/nb_NO/settings.po
|
||||
trans.nl = l10n/nl/settings.po
|
||||
trans.pl = l10n/pl/settings.po
|
||||
trans.pt_BR = l10n/pt_BR/settings.po
|
||||
trans.pt_PT = l10n/pt_PT/settings.po
|
||||
trans.ro = l10n/ro/settings.po
|
||||
trans.ru = l10n/ru/settings.po
|
||||
trans.sr = l10n/sr/settings.po
|
||||
trans.sr@latin = l10n/sr@latin/settings.po
|
||||
trans.sv = l10n/sv/settings.po
|
||||
trans.zh_CN = l10n/zh_CN/settings.po
|
||||
|
||||
|
|
@ -63,16 +73,21 @@ trans.da = l10n/da/files.po
|
|||
trans.de = l10n/de/files.po
|
||||
trans.el = l10n/el/files.po
|
||||
trans.es = l10n/es/files.po
|
||||
trans.et_EE = l10n/et_EE/files.po
|
||||
trans.fr = l10n/fr/files.po
|
||||
trans.id = l10n/id/files.po
|
||||
trans.it = l10n/it/files.po
|
||||
trans.lb = l10n/lb/files.po
|
||||
trans.ms_MY = l10n/ms_MY/files.po
|
||||
trans.nb_NO = l10n/nb_NO/files.po
|
||||
trans.nl = l10n/nl/files.po
|
||||
trans.pl = l10n/pl/files.po
|
||||
trans.pt_BR = l10n/pt_BR/files.po
|
||||
trans.pt_PT = l10n/pt_PT/files.po
|
||||
trans.ro = l10n/ro/files.po
|
||||
trans.ru = l10n/ru/files.po
|
||||
trans.sr = l10n/sr/files.po
|
||||
trans.sr@latin = l10n/sr@latin/files.po
|
||||
trans.sv = l10n/sv/files.po
|
||||
trans.zh_CN = l10n/zh_CN/files.po
|
||||
|
||||
|
|
@ -88,16 +103,80 @@ trans.da = l10n/da/media.po
|
|||
trans.de = l10n/de/media.po
|
||||
trans.el = l10n/el/media.po
|
||||
trans.es = l10n/es/media.po
|
||||
trans.et_EE = l10n/et_EE/media.po
|
||||
trans.fr = l10n/fr/media.po
|
||||
trans.id = l10n/id/media.po
|
||||
trans.it = l10n/it/media.po
|
||||
trans.lb = l10n/lb/media.po
|
||||
trans.ms_MY = l10n/ms_MY/media.po
|
||||
trans.nb_NO = l10n/nb_NO/media.po
|
||||
trans.nl = l10n/nl/media.po
|
||||
trans.pl = l10n/pl/media.po
|
||||
trans.pt_BR = l10n/pt_BR/media.po
|
||||
trans.pt_PT = l10n/pt_PT/media.po
|
||||
trans.ro = l10n/ro/media.po
|
||||
trans.ru = l10n/ru/media.po
|
||||
trans.sr = l10n/sr/media.po
|
||||
trans.sr@latin = l10n/sr@latin/media.po
|
||||
trans.sv = l10n/sv/media.po
|
||||
trans.zh_CN = l10n/zh_CN/media.po
|
||||
|
||||
[owncloud.calendar]
|
||||
file_filter = l10n/<lang>/calendar.po
|
||||
host = http://www.transifex.net
|
||||
source_file = l10n/templates/calendar.pot
|
||||
source_lang = en
|
||||
trans.bg_BG = l10n/bg_BG/calendar.po
|
||||
trans.ca = l10n/ca/calendar.po
|
||||
trans.cs_CZ = l10n/cs_CZ/calendar.po
|
||||
trans.da = l10n/da/calendar.po
|
||||
trans.de = l10n/de/calendar.po
|
||||
trans.el = l10n/el/calendar.po
|
||||
trans.es = l10n/es/calendar.po
|
||||
trans.et_EE = l10n/et_EE/calendar.po
|
||||
trans.fr = l10n/fr/calendar.po
|
||||
trans.id = l10n/id/calendar.po
|
||||
trans.it = l10n/it/calendar.po
|
||||
trans.lb = l10n/lb/calendar.po
|
||||
trans.ms_MY = l10n/ms_MY/calendar.po
|
||||
trans.nb_NO = l10n/nb_NO/calendar.po
|
||||
trans.nl = l10n/nl/calendar.po
|
||||
trans.pl = l10n/pl/calendar.po
|
||||
trans.pt_BR = l10n/pt_BR/calendar.po
|
||||
trans.pt_PT = l10n/pt_PT/calendar.po
|
||||
trans.ro = l10n/ro/calendar.po
|
||||
trans.ru = l10n/ru/calendar.po
|
||||
trans.sr = l10n/sr/calendar.po
|
||||
trans.sr@latin = l10n/sr@latin/calendar.po
|
||||
trans.sv = l10n/sv/calendar.po
|
||||
trans.zh_CN = l10n/zh_CN/calendar.po
|
||||
|
||||
[owncloud.contacts]
|
||||
file_filter = translations/owncloud.contacts/<lang>.po
|
||||
host = http://www.transifex.net
|
||||
source_file = l10n/templates/contacts.pot
|
||||
source_lang = en
|
||||
trans.bg_BG = l10n/bg_BG/contacts.po
|
||||
trans.ca = l10n/ca/contacts.po
|
||||
trans.cs_CZ = l10n/cs_CZ/contacts.po
|
||||
trans.da = l10n/da/contacts.po
|
||||
trans.de = l10n/de/contacts.po
|
||||
trans.el = l10n/el/contacts.po
|
||||
trans.es = l10n/es/contacts.po
|
||||
trans.et_EE = l10n/et_EE/contacts.po
|
||||
trans.fr = l10n/fr/contacts.po
|
||||
trans.id = l10n/id/contacts.po
|
||||
trans.it = l10n/it/contacts.po
|
||||
trans.lb = l10n/lb/contacts.po
|
||||
trans.ms_MY = l10n/ms_MY/contacts.po
|
||||
trans.nb_NO = l10n/nb_NO/contacts.po
|
||||
trans.nl = l10n/nl/contacts.po
|
||||
trans.pl = l10n/pl/contacts.po
|
||||
trans.pt_BR = l10n/pt_BR/contacts.po
|
||||
trans.pt_PT = l10n/pt_PT/contacts.po
|
||||
trans.ro = l10n/ro/contacts.po
|
||||
trans.ru = l10n/ru/contacts.po
|
||||
trans.sr = l10n/sr/contacts.po
|
||||
trans.sr@latin = l10n/sr@latin/contacts.po
|
||||
trans.sv = l10n/sv/contacts.po
|
||||
trans.zh_CN = l10n/zh_CN/contacts.po
|
||||
|
|
|
|||
68
3rdparty/COPYING-PHP
vendored
68
3rdparty/COPYING-PHP
vendored
|
|
@ -1,68 +0,0 @@
|
|||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2010 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, is permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
3. The name "PHP" must not be used to endorse or promote products
|
||||
derived from this software without prior written permission. For
|
||||
written permission, please contact group@php.net.
|
||||
|
||||
4. Products derived from this software may not be called "PHP", nor
|
||||
may "PHP" appear in their name, without prior written permission
|
||||
from group@php.net. You may indicate that your software works in
|
||||
conjunction with PHP by saying "Foo for PHP" instead of calling
|
||||
it "PHP Foo" or "phpfoo"
|
||||
|
||||
5. The PHP Group may publish revised and/or new versions of the
|
||||
license from time to time. Each version will be given a
|
||||
distinguishing version number.
|
||||
Once covered code has been published under a particular version
|
||||
of the license, you may always continue to use it under the terms
|
||||
of that version. You may also choose to use such covered code
|
||||
under the terms of any subsequent version of the license
|
||||
published by the PHP Group. No one other than the PHP Group has
|
||||
the right to modify the terms applicable to covered code created
|
||||
under this License.
|
||||
|
||||
6. Redistributions of any form whatsoever must retain the following
|
||||
acknowledgment:
|
||||
"This product includes PHP software, freely available from
|
||||
<http://www.php.net/software/>".
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
|
||||
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
|
||||
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals on behalf of the PHP Group.
|
||||
|
||||
The PHP Group can be contacted via Email at group@php.net.
|
||||
|
||||
For more information on the PHP Group and the PHP project,
|
||||
please see <http://www.php.net>.
|
||||
|
||||
PHP includes the Zend Engine, freely available at
|
||||
<http://www.zend.com>.
|
||||
7
3rdparty/COPYING-README
vendored
7
3rdparty/COPYING-README
vendored
|
|
@ -1,7 +0,0 @@
|
|||
HTTP is three clause BSD licence
|
||||
MDB2 uses a custom licence in the BSD style
|
||||
User is AGPL
|
||||
XML/RPC is both MIT and PHP License
|
||||
|
||||
The rest all licenced under the PHP License see packages/ directory
|
||||
for details
|
||||
5
3rdparty/MDB2.php
vendored
5
3rdparty/MDB2.php
vendored
|
|
@ -969,11 +969,10 @@ class MDB2
|
|||
static function fileExists($file)
|
||||
{
|
||||
// safe_mode does notwork with is_readable()
|
||||
global $SERVERROOT;
|
||||
if (!@ini_get('safe_mode')) {
|
||||
$dirs = explode(PATH_SEPARATOR, ini_get('include_path'));
|
||||
array_unshift($dirs,$SERVERROOT);
|
||||
array_unshift($dirs,$SERVERROOT. DIRECTORY_SEPARATOR .'inc');
|
||||
array_unshift($dirs,OC::$SERVERROOT);
|
||||
array_unshift($dirs,OC::$SERVERROOT. DIRECTORY_SEPARATOR .'inc');
|
||||
// print_r($dirs);die();
|
||||
foreach ($dirs as $dir) {
|
||||
if (is_readable($dir . DIRECTORY_SEPARATOR . $file)) {
|
||||
|
|
|
|||
5
3rdparty/MDB2/Driver/Manager/sqlite.php
vendored
5
3rdparty/MDB2/Driver/Manager/sqlite.php
vendored
|
|
@ -71,8 +71,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
|
|||
*/
|
||||
function createDatabase($name, $options = array())
|
||||
{
|
||||
global $SERVERROOT;
|
||||
$datadir=OC_Config::getValue( "datadirectory", "$SERVERROOT/data" );
|
||||
$datadir=OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
|
||||
$db =$this->getDBInstance();
|
||||
if (PEAR::isError($db)) {
|
||||
return $db;
|
||||
|
|
@ -1362,4 +1361,4 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
|
|||
|
||||
// }}}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
5
3rdparty/MDB2/Driver/sqlite.php
vendored
5
3rdparty/MDB2/Driver/sqlite.php
vendored
|
|
@ -347,8 +347,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
|
|||
**/
|
||||
function connect()
|
||||
{
|
||||
global $SERVERROOT;
|
||||
$datadir=OC_Config::getValue( "datadirectory", "$SERVERROOT/data" );
|
||||
$datadir=OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
|
||||
$database_file = $this->_getDatabaseFile($this->database_name);
|
||||
if (is_resource($this->connection)) {
|
||||
//if (count(array_diff($this->connected_dsn, $this->dsn)) == 0
|
||||
|
|
@ -1086,4 +1085,4 @@ class MDB2_Statement_sqlite extends MDB2_Statement_Common
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
15
3rdparty/Sabre/CalDAV/Backend/Abstract.php
vendored
15
3rdparty/Sabre/CalDAV/Backend/Abstract.php
vendored
|
|
@ -36,20 +36,17 @@ abstract class Sabre_CalDAV_Backend_Abstract {
|
|||
* If the creation was a success, an id must be returned that can be used to reference
|
||||
* this calendar in other methods, such as updateCalendar.
|
||||
*
|
||||
* This function must return a server-wide unique id that can be used
|
||||
* later to reference the calendar.
|
||||
*
|
||||
* @param string $principalUri
|
||||
* @param string $calendarUri
|
||||
* @param array $properties
|
||||
* @return string|int
|
||||
* @return void
|
||||
*/
|
||||
abstract function createCalendar($principalUri,$calendarUri,array $properties);
|
||||
|
||||
/**
|
||||
* Updates properties on this node,
|
||||
* Updates properties for a calendar.
|
||||
*
|
||||
* The properties array uses the propertyName in clark-notation as key,
|
||||
* The mutations array uses the propertyName in clark-notation as key,
|
||||
* and the array value for the property value. In the case a property
|
||||
* should be deleted, the property value will be null.
|
||||
*
|
||||
|
|
@ -79,10 +76,10 @@ abstract class Sabre_CalDAV_Backend_Abstract {
|
|||
* (424 Failed Dependency) because the request needs to be atomic.
|
||||
*
|
||||
* @param string $calendarId
|
||||
* @param array $properties
|
||||
* @param array $mutations
|
||||
* @return bool|array
|
||||
*/
|
||||
public function updateCalendar($calendarId, array $properties) {
|
||||
public function updateCalendar($calendarId, array $mutations) {
|
||||
|
||||
return false;
|
||||
|
||||
|
|
@ -97,7 +94,7 @@ abstract class Sabre_CalDAV_Backend_Abstract {
|
|||
abstract function deleteCalendar($calendarId);
|
||||
|
||||
/**
|
||||
* Returns all calendar objects within a calendar object.
|
||||
* Returns all calendar objects within a calendar.
|
||||
*
|
||||
* Every item contains an array with the following keys:
|
||||
* * id - unique identifier which will be used for subsequent updates
|
||||
|
|
|
|||
17
3rdparty/Sabre/CalDAV/Backend/PDO.php
vendored
17
3rdparty/Sabre/CalDAV/Backend/PDO.php
vendored
|
|
@ -129,7 +129,6 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
|
|||
* @param string $principalUri
|
||||
* @param string $calendarUri
|
||||
* @param array $properties
|
||||
* @return mixed
|
||||
*/
|
||||
public function createCalendar($principalUri,$calendarUri, array $properties) {
|
||||
|
||||
|
|
@ -173,9 +172,9 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
|
|||
}
|
||||
|
||||
/**
|
||||
* Updates a calendars properties
|
||||
* Updates properties for a calendar.
|
||||
*
|
||||
* The properties array uses the propertyName in clark-notation as key,
|
||||
* The mutations array uses the propertyName in clark-notation as key,
|
||||
* and the array value for the property value. In the case a property
|
||||
* should be deleted, the property value will be null.
|
||||
*
|
||||
|
|
@ -205,10 +204,10 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
|
|||
* (424 Failed Dependency) because the request needs to be atomic.
|
||||
*
|
||||
* @param string $calendarId
|
||||
* @param array $properties
|
||||
* @param array $mutations
|
||||
* @return bool|array
|
||||
*/
|
||||
public function updateCalendar($calendarId, array $properties) {
|
||||
public function updateCalendar($calendarId, array $mutations) {
|
||||
|
||||
$newValues = array();
|
||||
$result = array(
|
||||
|
|
@ -219,13 +218,13 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
|
|||
|
||||
$hasError = false;
|
||||
|
||||
foreach($properties as $propertyName=>$propertyValue) {
|
||||
foreach($mutations as $propertyName=>$propertyValue) {
|
||||
|
||||
// We don't know about this property.
|
||||
if (!isset($this->propertyMap[$propertyName])) {
|
||||
$hasError = true;
|
||||
$result[403][$propertyName] = null;
|
||||
unset($properties[$propertyName]);
|
||||
unset($mutations[$propertyName]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -237,7 +236,7 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
|
|||
// If there were any errors we need to fail the request
|
||||
if ($hasError) {
|
||||
// Properties has the remaining properties
|
||||
foreach($properties as $propertyName=>$propertyValue) {
|
||||
foreach($mutations as $propertyName=>$propertyValue) {
|
||||
$result[424][$propertyName] = null;
|
||||
}
|
||||
|
||||
|
|
@ -284,7 +283,7 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns all calendar objects within a calendar object.
|
||||
* Returns all calendar objects within a calendar.
|
||||
*
|
||||
* Every item contains an array with the following keys:
|
||||
* * id - unique identifier which will be used for subsequent updates
|
||||
|
|
|
|||
4
3rdparty/Sabre/CalDAV/Calendar.php
vendored
4
3rdparty/Sabre/CalDAV/Calendar.php
vendored
|
|
@ -12,7 +12,7 @@
|
|||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_CalDAV_Calendar implements Sabre_DAV_ICollection, Sabre_DAV_IProperties, Sabre_DAVACL_IACL {
|
||||
class Sabre_CalDAV_Calendar implements Sabre_CalDAV_ICalendar, Sabre_DAV_IProperties, Sabre_DAVACL_IACL {
|
||||
|
||||
/**
|
||||
* This is an array with calendar information
|
||||
|
|
@ -178,6 +178,8 @@ class Sabre_CalDAV_Calendar implements Sabre_DAV_ICollection, Sabre_DAV_IPropert
|
|||
public function createFile($name,$calendarData = null) {
|
||||
|
||||
$calendarData = stream_get_contents($calendarData);
|
||||
// Converting to UTF-8, if needed
|
||||
$calendarData = Sabre_DAV_StringUtil::ensureUTF8($calendarData);
|
||||
|
||||
$supportedComponents = $this->calendarInfo['{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set'];
|
||||
if ($supportedComponents) {
|
||||
|
|
|
|||
5
3rdparty/Sabre/CalDAV/CalendarObject.php
vendored
5
3rdparty/Sabre/CalDAV/CalendarObject.php
vendored
|
|
@ -9,7 +9,7 @@
|
|||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_CalDAV_CalendarObject extends Sabre_DAV_File implements Sabre_DAVACL_IACL {
|
||||
class Sabre_CalDAV_CalendarObject extends Sabre_DAV_File implements Sabre_CalDAV_ICalendarObject, Sabre_DAVACL_IACL {
|
||||
|
||||
/**
|
||||
* Sabre_CalDAV_Backend_Abstract
|
||||
|
|
@ -93,6 +93,9 @@ class Sabre_CalDAV_CalendarObject extends Sabre_DAV_File implements Sabre_DAVACL
|
|||
if (is_resource($calendarData))
|
||||
$calendarData = stream_get_contents($calendarData);
|
||||
|
||||
// Converting to UTF-8, if needed
|
||||
$calendarData = Sabre_DAV_StringUtil::ensureUTF8($calendarData);
|
||||
|
||||
$supportedComponents = $this->calendarInfo['{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set'];
|
||||
if ($supportedComponents) {
|
||||
$supportedComponents = $supportedComponents->getValue();
|
||||
|
|
|
|||
18
3rdparty/Sabre/CalDAV/ICalendar.php
vendored
Normal file
18
3rdparty/Sabre/CalDAV/ICalendar.php
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Calendar interface
|
||||
*
|
||||
* Implement this interface to allow a node to be recognized as an calendar.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage CalDAV
|
||||
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
interface Sabre_CalDAV_ICalendar extends Sabre_DAV_ICollection {
|
||||
|
||||
|
||||
|
||||
}
|
||||
20
3rdparty/Sabre/CalDAV/ICalendarObject.php
vendored
Normal file
20
3rdparty/Sabre/CalDAV/ICalendarObject.php
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* CalendarObject interface
|
||||
/**
|
||||
* Extend the ICalendarObject interface to allow your custom nodes to be picked up as
|
||||
* CalendarObjects.
|
||||
*
|
||||
* Calendar objects are resources such as Events, Todo's or Journals.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage CalDAV
|
||||
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
interface Sabre_CalDAV_ICalendarObject extends Sabre_DAV_IFile {
|
||||
|
||||
}
|
||||
|
||||
6
3rdparty/Sabre/CalDAV/Plugin.php
vendored
6
3rdparty/Sabre/CalDAV/Plugin.php
vendored
|
|
@ -114,7 +114,7 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin {
|
|||
public function getSupportedReportSet($uri) {
|
||||
|
||||
$node = $this->server->tree->getNodeForPath($uri);
|
||||
if ($node instanceof Sabre_CalDAV_Calendar || $node instanceof Sabre_CalDAV_CalendarObject) {
|
||||
if ($node instanceof Sabre_CalDAV_ICalendar || $node instanceof Sabre_CalDAV_ICalendarObject) {
|
||||
return array(
|
||||
'{' . self::NS_CALDAV . '}calendar-multiget',
|
||||
'{' . self::NS_CALDAV . '}calendar-query',
|
||||
|
|
@ -143,7 +143,7 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin {
|
|||
|
||||
$server->propertyMap['{' . self::NS_CALDAV . '}supported-calendar-component-set'] = 'Sabre_CalDAV_Property_SupportedCalendarComponentSet';
|
||||
|
||||
$server->resourceTypeMapping['Sabre_CalDAV_Calendar'] = '{urn:ietf:params:xml:ns:caldav}calendar';
|
||||
$server->resourceTypeMapping['Sabre_CalDAV_ICalendar'] = '{urn:ietf:params:xml:ns:caldav}calendar';
|
||||
$server->resourceTypeMapping['Sabre_CalDAV_Principal_ProxyRead'] = '{http://calendarserver.org/ns/}calendar-proxy-read';
|
||||
$server->resourceTypeMapping['Sabre_CalDAV_Principal_ProxyWrite'] = '{http://calendarserver.org/ns/}calendar-proxy-write';
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin {
|
|||
} // instanceof IPrincipal
|
||||
|
||||
|
||||
if ($node instanceof Sabre_CalDAV_CalendarObject) {
|
||||
if ($node instanceof Sabre_CalDAV_ICalendarObject) {
|
||||
// The calendar-data property is not supposed to be a 'real'
|
||||
// property, but in large chunks of the spec it does act as such.
|
||||
// Therefore we simply expose it as a property.
|
||||
|
|
|
|||
2
3rdparty/Sabre/CalDAV/Version.php
vendored
2
3rdparty/Sabre/CalDAV/Version.php
vendored
|
|
@ -14,7 +14,7 @@ class Sabre_CalDAV_Version {
|
|||
/**
|
||||
* Full version number
|
||||
*/
|
||||
const VERSION = '1.5.0';
|
||||
const VERSION = '1.5.3';
|
||||
|
||||
/**
|
||||
* Stability : alpha, beta, stable
|
||||
|
|
|
|||
2
3rdparty/Sabre/CardDAV/AddressBook.php
vendored
2
3rdparty/Sabre/CardDAV/AddressBook.php
vendored
|
|
@ -112,6 +112,8 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca
|
|||
public function createFile($name,$vcardData = null) {
|
||||
|
||||
$vcardData = stream_get_contents($vcardData);
|
||||
// Converting to UTF-8, if needed
|
||||
$vcardData = Sabre_DAV_StringUtil::ensureUTF8($vcardData);
|
||||
|
||||
$this->carddavBackend->createCard($this->addressBookInfo['id'],$name,$vcardData);
|
||||
|
||||
|
|
|
|||
4
3rdparty/Sabre/CardDAV/Backend/PDO.php
vendored
4
3rdparty/Sabre/CardDAV/Backend/PDO.php
vendored
|
|
@ -66,7 +66,9 @@ class Sabre_CardDAV_Backend_PDO extends Sabre_CardDAV_Backend_Abstract {
|
|||
'principaluri' => $row['principaluri'],
|
||||
'{DAV:}displayname' => $row['displayname'],
|
||||
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
|
||||
'{http://calendarserver.org/ns/}getctag' => $row['ctag'],
|
||||
'{http://calendarserver.org/ns/}getctag' => $row['ctag'],
|
||||
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}supported-address-data' =>
|
||||
new Sabre_CardDAV_Property_SupportedAddressData(),
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
3
3rdparty/Sabre/CardDAV/Card.php
vendored
3
3rdparty/Sabre/CardDAV/Card.php
vendored
|
|
@ -88,6 +88,9 @@ class Sabre_CardDAV_Card extends Sabre_DAV_File implements Sabre_CardDAV_ICard,
|
|||
if (is_resource($cardData))
|
||||
$cardData = stream_get_contents($cardData);
|
||||
|
||||
// Converting to UTF-8, if needed
|
||||
$cardData = Sabre_DAV_StringUtil::ensureUTF8($cardData);
|
||||
|
||||
$this->carddavBackend->updateCard($this->addressBookInfo['id'],$this->cardData['uri'],$cardData);
|
||||
$this->cardData['carddata'] = $cardData;
|
||||
|
||||
|
|
|
|||
3
3rdparty/Sabre/CardDAV/Plugin.php
vendored
3
3rdparty/Sabre/CardDAV/Plugin.php
vendored
|
|
@ -95,9 +95,10 @@ class Sabre_CardDAV_Plugin extends Sabre_DAV_ServerPlugin {
|
|||
public function getSupportedReportSet($uri) {
|
||||
|
||||
$node = $this->server->tree->getNodeForPath($uri);
|
||||
if ($node instanceof Sabre_CardDAV_AddressBook || $node instanceof Sabre_CardDAV_ICard) {
|
||||
if ($node instanceof Sabre_CardDAV_IAddressBook || $node instanceof Sabre_CardDAV_ICard) {
|
||||
return array(
|
||||
'{' . self::NS_CARDDAV . '}addressbook-multiget',
|
||||
'{' . self::NS_CARDDAV . '}addressbook-query',
|
||||
);
|
||||
}
|
||||
return array();
|
||||
|
|
|
|||
69
3rdparty/Sabre/CardDAV/Property/SupportedAddressData.php
vendored
Normal file
69
3rdparty/Sabre/CardDAV/Property/SupportedAddressData.php
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Supported-address-data property
|
||||
*
|
||||
* This property is a representation of the supported-address-data property
|
||||
* in the CardDAV namespace.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage CardDAV
|
||||
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_CardDAV_Property_SupportedAddressData extends Sabre_DAV_Property {
|
||||
|
||||
/**
|
||||
* supported versions
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $supportedData = array();
|
||||
|
||||
/**
|
||||
* Creates the property
|
||||
*
|
||||
* @param array $components
|
||||
*/
|
||||
public function __construct(array $supportedData = null) {
|
||||
|
||||
if (is_null($supportedData)) {
|
||||
$supportedData = array(
|
||||
array('contentType' => 'text/vcard', 'version' => '3.0'),
|
||||
array('contentType' => 'text/vcard', 'version' => '4.0'),
|
||||
);
|
||||
}
|
||||
|
||||
$this->supportedData = $supportedData;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the property in a DOMDocument
|
||||
*
|
||||
* @param Sabre_DAV_Server $server
|
||||
* @param DOMElement $node
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
|
||||
|
||||
$doc = $node->ownerDocument;
|
||||
|
||||
$prefix =
|
||||
isset($server->xmlNamespaces[Sabre_CardDAV_Plugin::NS_CARDDAV]) ?
|
||||
$server->xmlNamespaces[Sabre_CardDAV_Plugin::NS_CARDDAV] :
|
||||
'card';
|
||||
|
||||
foreach($this->supportedData as $supported) {
|
||||
|
||||
$caldata = $doc->createElementNS(Sabre_CardDAV_Plugin::NS_CARDDAV, $prefix . ':address-data-type');
|
||||
$caldata->setAttribute('content-type',$supported['contentType']);
|
||||
$caldata->setAttribute('version',$supported['version']);
|
||||
$node->appendChild($caldata);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
4
3rdparty/Sabre/CardDAV/Version.php
vendored
4
3rdparty/Sabre/CardDAV/Version.php
vendored
|
|
@ -18,11 +18,11 @@ class Sabre_CardDAV_Version {
|
|||
/**
|
||||
* Full version number
|
||||
*/
|
||||
const VERSION = '0.2';
|
||||
const VERSION = '1.5.3';
|
||||
|
||||
/**
|
||||
* Stability : alpha, beta, stable
|
||||
*/
|
||||
const STABILITY = 'alpha';
|
||||
const STABILITY = 'stable';
|
||||
|
||||
}
|
||||
|
|
|
|||
18
3rdparty/Sabre/DAV/Browser/Plugin.php
vendored
18
3rdparty/Sabre/DAV/Browser/Plugin.php
vendored
|
|
@ -68,9 +68,16 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
|
|||
public function httpGetInterceptor($method, $uri) {
|
||||
|
||||
if ($method!='GET') return true;
|
||||
|
||||
$node = $this->server->tree->getNodeForPath($uri);
|
||||
if ($node instanceof Sabre_DAV_IFile) return true;
|
||||
|
||||
try {
|
||||
$node = $this->server->tree->getNodeForPath($uri);
|
||||
} catch (Sabre_DAV_Exception_FileNotFound $e) {
|
||||
// We're simply stopping when the file isn't found to not interfere
|
||||
// with other plugins.
|
||||
return;
|
||||
}
|
||||
if ($node instanceof Sabre_DAV_IFile)
|
||||
return;
|
||||
|
||||
$this->server->httpResponse->sendStatus(200);
|
||||
$this->server->httpResponse->setHeader('Content-Type','text/html; charset=utf-8');
|
||||
|
|
@ -165,6 +172,8 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
|
|||
'{DAV:}getlastmodified',
|
||||
),1);
|
||||
|
||||
$parent = $this->server->tree->getNodeForPath($path);
|
||||
|
||||
|
||||
if ($path) {
|
||||
|
||||
|
|
@ -189,6 +198,7 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
|
|||
|
||||
$type = null;
|
||||
|
||||
|
||||
if (isset($file[200]['{DAV:}resourcetype'])) {
|
||||
$type = $file[200]['{DAV:}resourcetype']->getValue();
|
||||
|
||||
|
|
@ -246,7 +256,7 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
|
|||
|
||||
$html.= "<tr><td colspan=\"4\"><hr /></td></tr>";
|
||||
|
||||
if ($this->enablePost) {
|
||||
if ($this->enablePost && $parent instanceof Sabre_DAV_ICollection) {
|
||||
$html.= '<tr><td><form method="post" action="">
|
||||
<h3>Create new folder</h3>
|
||||
<input type="hidden" name="sabreAction" value="mkcol" />
|
||||
|
|
|
|||
43
3rdparty/Sabre/DAV/Server.php
vendored
43
3rdparty/Sabre/DAV/Server.php
vendored
|
|
@ -738,6 +738,34 @@ class Sabre_DAV_Server {
|
|||
|
||||
$body = $this->httpRequest->getBody();
|
||||
|
||||
// Intercepting Content-Range
|
||||
if ($this->httpRequest->getHeader('Content-Range')) {
|
||||
/**
|
||||
Content-Range is dangerous for PUT requests: PUT per definition
|
||||
stores a full resource. draft-ietf-httpbis-p2-semantics-15 says
|
||||
in section 7.6:
|
||||
An origin server SHOULD reject any PUT request that contains a
|
||||
Content-Range header field, since it might be misinterpreted as
|
||||
partial content (or might be partial content that is being mistakenly
|
||||
PUT as a full representation). Partial content updates are possible
|
||||
by targeting a separately identified resource with state that
|
||||
overlaps a portion of the larger resource, or by using a different
|
||||
method that has been specifically defined for partial updates (for
|
||||
example, the PATCH method defined in [RFC5789]).
|
||||
This clarifies RFC2616 section 9.6:
|
||||
The recipient of the entity MUST NOT ignore any Content-*
|
||||
(e.g. Content-Range) headers that it does not understand or implement
|
||||
and MUST return a 501 (Not Implemented) response in such cases.
|
||||
OTOH is a PUT request with a Content-Range currently the only way to
|
||||
continue an aborted upload request and is supported by curl, mod_dav,
|
||||
Tomcat and others. Since some clients do use this feature which results
|
||||
in unexpected behaviour (cf PEAR::HTTP_WebDAV_Client 1.0.1), we reject
|
||||
all PUT requests with a Content-Range for now.
|
||||
*/
|
||||
|
||||
throw new Sabre_DAV_Exception_NotImplemented('PUT with Content-Range is not allowed.');
|
||||
}
|
||||
|
||||
// Intercepting the Finder problem
|
||||
if (($expected = $this->httpRequest->getHeader('X-Expected-Entity-Length')) && $expected > 0) {
|
||||
|
||||
|
|
@ -798,7 +826,10 @@ class Sabre_DAV_Server {
|
|||
} else {
|
||||
|
||||
// If we got here, the resource didn't exist yet.
|
||||
$this->createFile($this->getRequestUri(),$body);
|
||||
if (!$this->createFile($this->getRequestUri(),$body)) {
|
||||
// For one reason or another the file was not created.
|
||||
return;
|
||||
}
|
||||
$this->httpResponse->setHeader('Content-Length','0');
|
||||
$this->httpResponse->sendStatus(201);
|
||||
|
||||
|
|
@ -1377,23 +1408,27 @@ class Sabre_DAV_Server {
|
|||
* Currently this is done by HTTP PUT and HTTP LOCK (in the Locks_Plugin).
|
||||
* It was important to get this done through a centralized function,
|
||||
* allowing plugins to intercept this using the beforeCreateFile event.
|
||||
*
|
||||
* This method will return true if the file was actually created
|
||||
*
|
||||
* @param string $uri
|
||||
* @param resource $data
|
||||
* @return void
|
||||
* @return bool
|
||||
*/
|
||||
public function createFile($uri,$data) {
|
||||
|
||||
list($dir,$name) = Sabre_DAV_URLUtil::splitPath($uri);
|
||||
|
||||
if (!$this->broadcastEvent('beforeBind',array($uri))) return;
|
||||
if (!$this->broadcastEvent('beforeCreateFile',array($uri,$data))) return;
|
||||
if (!$this->broadcastEvent('beforeBind',array($uri))) return false;
|
||||
if (!$this->broadcastEvent('beforeCreateFile',array($uri,$data))) return false;
|
||||
|
||||
$parent = $this->tree->getNodeForPath($dir);
|
||||
$parent->createFile($name,$data);
|
||||
$this->tree->markDirty($dir);
|
||||
|
||||
$this->broadcastEvent('afterBind',array($uri));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
120
3rdparty/Sabre/DAV/SimpleFile.php
vendored
Normal file
120
3rdparty/Sabre/DAV/SimpleFile.php
vendored
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* SimpleFile
|
||||
*
|
||||
* The 'SimpleFile' class is used to easily add read-only immutable files to
|
||||
* the directory structure. One usecase would be to add a 'readme.txt' to a
|
||||
* root of a webserver with some standard content.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAV
|
||||
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAV_SimpleFile extends Sabre_DAV_File {
|
||||
|
||||
/**
|
||||
* File contents
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $contents = array();
|
||||
|
||||
/**
|
||||
* Name of this resource
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* A mimetype, such as 'text/plain' or 'text/html'
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $mimeType;
|
||||
|
||||
/**
|
||||
* Creates this node
|
||||
*
|
||||
* The name of the node must be passed, as well as the contents of the
|
||||
* file.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $contents
|
||||
*/
|
||||
public function __construct($name, $contents, $mimeType = null) {
|
||||
|
||||
$this->name = $name;
|
||||
$this->contents = $contents;
|
||||
$this->mimeType = $mimeType;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the node name for this file.
|
||||
*
|
||||
* This name is used to construct the url.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
|
||||
return $this->name;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data
|
||||
*
|
||||
* This method may either return a string or a readable stream resource
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get() {
|
||||
|
||||
return $this->contents;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the file, in bytes.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSize() {
|
||||
|
||||
return strlen($this->contents);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ETag for a file
|
||||
*
|
||||
* An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
|
||||
* The ETag is an arbritrary string, but MUST be surrounded by double-quotes.
|
||||
*
|
||||
* Return null if the ETag can not effectively be determined
|
||||
*/
|
||||
public function getETag() {
|
||||
|
||||
return '"' . md5($this->contents) . '"';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the mime-type for a file
|
||||
*
|
||||
* If null is returned, we'll assume application/octet-stream
|
||||
*/
|
||||
public function getContentType() {
|
||||
|
||||
return $this->mimeType;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
21
3rdparty/Sabre/DAV/StringUtil.php
vendored
21
3rdparty/Sabre/DAV/StringUtil.php
vendored
|
|
@ -64,6 +64,27 @@ class Sabre_DAV_StringUtil {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method takes an input string, checks if it's not valid UTF-8 and
|
||||
* attempts to convert it to UTF-8 if it's not.
|
||||
*
|
||||
* Note that currently this can only convert ISO-8559-1 to UTF-8 (latin-1),
|
||||
* anything else will likely fail.
|
||||
*
|
||||
* @param string $input
|
||||
* @return string
|
||||
*/
|
||||
static public function ensureUTF8($input) {
|
||||
|
||||
$encoding = mb_detect_encoding($input , array('UTF-8','ISO-8859-1'), true);
|
||||
|
||||
if ($encoding === 'ISO-8859-1') {
|
||||
return utf8_encode($input);
|
||||
} else {
|
||||
return $input;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
42
3rdparty/Sabre/DAV/URLUtil.php
vendored
42
3rdparty/Sabre/DAV/URLUtil.php
vendored
|
|
@ -30,9 +30,14 @@ class Sabre_DAV_URLUtil {
|
|||
*/
|
||||
static function encodePath($path) {
|
||||
|
||||
$path = explode('/',$path);
|
||||
return implode('/',array_map(array('Sabre_DAV_URLUtil','encodePathSegment'), $path));
|
||||
|
||||
$valid_chars = '/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.~()';
|
||||
$newStr = '';
|
||||
for( $i=0; isset($path[$i]); ++$i ) {
|
||||
if( strpos($valid_chars,($c=$path[$i]))===false ) $newStr .= '%'.sprintf('%02x',ord($c));
|
||||
else $newStr .= $c;
|
||||
}
|
||||
return $newStr;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -45,35 +50,13 @@ class Sabre_DAV_URLUtil {
|
|||
*/
|
||||
static function encodePathSegment($pathSegment) {
|
||||
|
||||
$valid_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.~()';
|
||||
$newStr = '';
|
||||
for($i=0;$i<strlen($pathSegment);$i++) {
|
||||
$c = ord($pathSegment[$i]);
|
||||
|
||||
if(
|
||||
|
||||
/* Unreserved chacaters */
|
||||
|
||||
($c>=0x41 /* A */ && $c<=0x5a /* Z */) ||
|
||||
($c>=0x61 /* a */ && $c<=0x7a /* z */) ||
|
||||
($c>=0x30 /* 0 */ && $c<=0x39 /* 9 */) ||
|
||||
$c===0x5f /* _ */ ||
|
||||
$c===0x2d /* - */ ||
|
||||
$c===0x2e /* . */ ||
|
||||
$c===0x7E /* ~ */ ||
|
||||
|
||||
/* Reserved, but no reserved purpose */
|
||||
$c===0x28 /* ( */ ||
|
||||
$c===0x29 /* ) */
|
||||
|
||||
) {
|
||||
$newStr.=$pathSegment[$i];
|
||||
} else {
|
||||
$newStr.='%' . str_pad(dechex($c), 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
for( $i=0; isset($pathSegment[$i]); ++$i ) {
|
||||
if( strpos($valid_chars,($c=$pathSegment[$i]))===false ) $newStr .= '%'.sprintf('%02x',ord($c));
|
||||
else $newStr .= $c;
|
||||
}
|
||||
return $newStr;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -103,6 +86,7 @@ class Sabre_DAV_URLUtil {
|
|||
|
||||
case 'ISO-8859-1' :
|
||||
$path = utf8_encode($path);
|
||||
|
||||
}
|
||||
|
||||
return $path;
|
||||
|
|
|
|||
4
3rdparty/Sabre/DAV/Version.php
vendored
4
3rdparty/Sabre/DAV/Version.php
vendored
|
|
@ -14,11 +14,11 @@ class Sabre_DAV_Version {
|
|||
/**
|
||||
* Full version number
|
||||
*/
|
||||
const VERSION = '1.5.0';
|
||||
const VERSION = '1.5.3';
|
||||
|
||||
/**
|
||||
* Stability : alpha, beta, stable
|
||||
*/
|
||||
const STABILITY = 'alpha';
|
||||
const STABILITY = 'stable';
|
||||
|
||||
}
|
||||
|
|
|
|||
15
3rdparty/Sabre/DAVACL/Principal.php
vendored
15
3rdparty/Sabre/DAVACL/Principal.php
vendored
|
|
@ -68,12 +68,19 @@ class Sabre_DAVACL_Principal extends Sabre_DAV_Node implements Sabre_DAVACL_IPri
|
|||
*/
|
||||
public function getAlternateUriSet() {
|
||||
|
||||
if (isset($this->principalProperties['{http://sabredav.org/ns}email-address'])) {
|
||||
return array('mailto:' . $this->principalProperties['{http://sabredav.org/ns}email-address']);
|
||||
} else {
|
||||
return array();
|
||||
$uris = array();
|
||||
if (isset($this->principalProperties['{DAV:}alternate-URI-set'])) {
|
||||
|
||||
$uris = $this->principalProperties['{DAV:}alternate-URI-set'];
|
||||
|
||||
}
|
||||
|
||||
if (isset($this->principalProperties['{http://sabredav.org/ns}email-address'])) {
|
||||
$uris[] = 'mailto:' . $this->principalProperties['{http://sabredav.org/ns}email-address'];
|
||||
}
|
||||
|
||||
return array_unique($uris);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
2
3rdparty/Sabre/DAVACL/Version.php
vendored
2
3rdparty/Sabre/DAVACL/Version.php
vendored
|
|
@ -14,7 +14,7 @@ class Sabre_DAVACL_Version {
|
|||
/**
|
||||
* Full version number
|
||||
*/
|
||||
const VERSION = '1.4.4';
|
||||
const VERSION = '1.5.2';
|
||||
|
||||
/**
|
||||
* Stability : alpha, beta, stable
|
||||
|
|
|
|||
2
3rdparty/Sabre/HTTP/Response.php
vendored
2
3rdparty/Sabre/HTTP/Response.php
vendored
|
|
@ -23,7 +23,7 @@ class Sabre_HTTP_Response {
|
|||
100 => 'Continue',
|
||||
101 => 'Switching Protocols',
|
||||
102 => 'Processing',
|
||||
200 => 'Ok',
|
||||
200 => 'OK',
|
||||
201 => 'Created',
|
||||
202 => 'Accepted',
|
||||
203 => 'Non-Authorative Information',
|
||||
|
|
|
|||
2
3rdparty/Sabre/HTTP/Version.php
vendored
2
3rdparty/Sabre/HTTP/Version.php
vendored
|
|
@ -14,7 +14,7 @@ class Sabre_HTTP_Version {
|
|||
/**
|
||||
* Full version number
|
||||
*/
|
||||
const VERSION = '1.4.1';
|
||||
const VERSION = '1.5.3';
|
||||
|
||||
/**
|
||||
* Stability : alpha, beta, stable
|
||||
|
|
|
|||
6
3rdparty/Sabre/VObject/Element/DateTime.php
vendored
6
3rdparty/Sabre/VObject/Element/DateTime.php
vendored
|
|
@ -70,20 +70,20 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
|
|||
$this->setValue($dt->format('Ymd\\THis'));
|
||||
$this->offsetUnset('VALUE');
|
||||
$this->offsetUnset('TZID');
|
||||
$this->offsetSet('VALUE','DATETIME');
|
||||
$this->offsetSet('VALUE','DATE-TIME');
|
||||
break;
|
||||
case self::UTC :
|
||||
$dt->setTimeZone(new DateTimeZone('UTC'));
|
||||
$this->setValue($dt->format('Ymd\\THis\\Z'));
|
||||
$this->offsetUnset('VALUE');
|
||||
$this->offsetUnset('TZID');
|
||||
$this->offsetSet('VALUE','DATETIME');
|
||||
$this->offsetSet('VALUE','DATE-TIME');
|
||||
break;
|
||||
case self::LOCALTZ :
|
||||
$this->setValue($dt->format('Ymd\\THis'));
|
||||
$this->offsetUnset('VALUE');
|
||||
$this->offsetUnset('TZID');
|
||||
$this->offsetSet('VALUE','DATETIME');
|
||||
$this->offsetSet('VALUE','DATE-TIME');
|
||||
$this->offsetSet('TZID', $dt->getTimeZone()->getName());
|
||||
break;
|
||||
case self::DATE :
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
|
|||
$val[] = $i->format('Ymd\\THis');
|
||||
}
|
||||
$this->setValue(implode(',',$val));
|
||||
$this->offsetSet('VALUE','DATETIME');
|
||||
$this->offsetSet('VALUE','DATE-TIME');
|
||||
break;
|
||||
case Sabre_VObject_Element_DateTime::UTC :
|
||||
$val = array();
|
||||
|
|
@ -69,7 +69,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
|
|||
$val[] = $i->format('Ymd\\THis\\Z');
|
||||
}
|
||||
$this->setValue(implode(',',$val));
|
||||
$this->offsetSet('VALUE','DATETIME');
|
||||
$this->offsetSet('VALUE','DATE-TIME');
|
||||
break;
|
||||
case Sabre_VObject_Element_DateTime::LOCALTZ :
|
||||
$val = array();
|
||||
|
|
@ -77,7 +77,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
|
|||
$val[] = $i->format('Ymd\\THis');
|
||||
}
|
||||
$this->setValue(implode(',',$val));
|
||||
$this->offsetSet('VALUE','DATETIME');
|
||||
$this->offsetSet('VALUE','DATE-TIME');
|
||||
$this->offsetSet('TZID', $dt[0]->getTimeZone()->getName());
|
||||
break;
|
||||
case Sabre_VObject_Element_DateTime::DATE :
|
||||
|
|
|
|||
38
3rdparty/Sabre/VObject/Property.php
vendored
38
3rdparty/Sabre/VObject/Property.php
vendored
|
|
@ -128,6 +128,44 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new componenten or element
|
||||
*
|
||||
* You can call this method with the following syntaxes:
|
||||
*
|
||||
* add(Sabre_VObject_Parameter $element)
|
||||
* add(string $name, $value)
|
||||
*
|
||||
* The first version adds an Parameter
|
||||
* The second adds a property as a string.
|
||||
*
|
||||
* @param mixed $item
|
||||
* @param mixed $itemValue
|
||||
* @return void
|
||||
*/
|
||||
public function add($item, $itemValue = null) {
|
||||
|
||||
if ($item instanceof Sabre_VObject_Parameter) {
|
||||
if (!is_null($itemValue)) {
|
||||
throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject');
|
||||
}
|
||||
$this->parameters[] = $item;
|
||||
} elseif(is_string($item)) {
|
||||
|
||||
if (!is_scalar($itemValue)) {
|
||||
throw new InvalidArgumentException('The second argument must be scalar');
|
||||
}
|
||||
$this->parameters[] = new Sabre_VObject_Parameter($item,$itemValue);
|
||||
|
||||
} else {
|
||||
|
||||
throw new InvalidArgumentException('The first argument must either be a Sabre_VObject_Element or a string');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* ArrayAccess interface {{{ */
|
||||
|
||||
/**
|
||||
|
|
|
|||
12
3rdparty/Sabre/VObject/Reader.php
vendored
12
3rdparty/Sabre/VObject/Reader.php
vendored
|
|
@ -42,16 +42,10 @@ class Sabre_VObject_Reader {
|
|||
*/
|
||||
static function read($data) {
|
||||
|
||||
// Detecting line endings
|
||||
if (strpos($data,"\r\n")!==false) {
|
||||
$newLine = "\r\n";
|
||||
} elseif (strpos($data,"\r")) {
|
||||
$newLine = "\r";
|
||||
} else {
|
||||
$newLine = "\n";
|
||||
}
|
||||
// Normalizing newlines
|
||||
$data = str_replace(array("\r","\n\n"), array("\n","\n"), $data);
|
||||
|
||||
$lines = explode($newLine, $data);
|
||||
$lines = explode("\n", $data);
|
||||
|
||||
// Unfolding lines
|
||||
$lines2 = array();
|
||||
|
|
|
|||
2
3rdparty/Sabre/VObject/Version.php
vendored
2
3rdparty/Sabre/VObject/Version.php
vendored
|
|
@ -14,7 +14,7 @@ class Sabre_VObject_Version {
|
|||
/**
|
||||
* Full version number
|
||||
*/
|
||||
const VERSION = '1.2.0';
|
||||
const VERSION = '1.2.2';
|
||||
|
||||
/**
|
||||
* Stability : alpha, beta, stable
|
||||
|
|
|
|||
4
3rdparty/XML/RPC.php
vendored
4
3rdparty/XML/RPC.php
vendored
|
|
@ -1365,7 +1365,7 @@ class XML_RPC_Message extends XML_RPC_Base
|
|||
!preg_match('@^HTTP/[0-9\.]+ 10[0-9]([A-Za-z ]+)?[\r\n]+HTTP/[0-9\.]+ 200@', $data))
|
||||
{
|
||||
$errstr = substr($data, 0, strpos($data, "\n") - 1);
|
||||
error_log('HTTP error, got response: ' . $errstr);
|
||||
if(defined("DEBUG") && DEBUG) {error_log('HTTP error, got response: ' . $errstr);}
|
||||
$r = new XML_RPC_Response(0, $XML_RPC_err['http_error'],
|
||||
$XML_RPC_str['http_error'] . ' (' .
|
||||
$errstr . ')');
|
||||
|
|
@ -1396,7 +1396,7 @@ class XML_RPC_Message extends XML_RPC_Base
|
|||
xml_error_string(xml_get_error_code($parser_resource)),
|
||||
xml_get_current_line_number($parser_resource));
|
||||
}
|
||||
error_log($errstr);
|
||||
if(defined("DEBUG") && DEBUG) {error_log($errstr);}
|
||||
$r = new XML_RPC_Response(0, $XML_RPC_err['invalid_return'],
|
||||
$XML_RPC_str['invalid_return']);
|
||||
xml_parser_free($parser_resource);
|
||||
|
|
|
|||
1
3rdparty/css/chosen.css
vendored
1
3rdparty/css/chosen.css
vendored
|
|
@ -10,6 +10,7 @@ select.chzn-select {
|
|||
display: inline-block;
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
.chzn-container .chzn-drop {
|
||||
background: #fff;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,14 @@ Files in ownCloud are licensed under the Affero General Public License version 3
|
|||
the text of which can be found in COPYING-AGPL, or any later version of the AGPL,
|
||||
unless otherwise noted.
|
||||
|
||||
Components of ownCloud, including jQuery, are licensed under the MIT/X11 license.
|
||||
Licensing of components:
|
||||
* jQuery: MIT / GPL
|
||||
* HTTP: 3 clause BSD
|
||||
* MDB2: BSD style custom
|
||||
* User: AGPL
|
||||
* XML/RPC: MIT / PHP
|
||||
* Silk icons: Creative Commons Attribution
|
||||
All unmodified files from these and other sources retain their original copyright
|
||||
and license notices: see the relevant individual files.
|
||||
|
||||
Attribution information for ownCloud is contained in the AUTHORS file.
|
||||
Attribution information for ownCloud is contained in the AUTHORS file.
|
||||
2
README
2
README
|
|
@ -4,7 +4,7 @@ It is alpha software in development and should be treated accordingly.
|
|||
|
||||
http://ownCloud.org
|
||||
|
||||
Installation instructions: http://owncloud.org/index.php/Installation
|
||||
Installation instructions: http://owncloud.org/install
|
||||
Source code: http://gitorious.org/owncloud
|
||||
|
||||
Mailing list: http://mail.kde.org/mailman/listinfo/owncloud
|
||||
|
|
|
|||
33
apps/admin_export/appinfo/app.php
Normal file
33
apps/admin_export/appinfo/app.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - user_ldap
|
||||
*
|
||||
* @author Dominik Schmidt
|
||||
* @copyright 2011 Dominik Schmidt dev@dominik-schmidt.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 Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
OC_APP::registerAdmin('admin_export','settings');
|
||||
|
||||
// add settings page to navigation
|
||||
$entry = array(
|
||||
'id' => "admin_export_settings",
|
||||
'order'=>1,
|
||||
'href' => OC_Helper::linkTo( "admin_export", "settings.php" ),
|
||||
'name' => 'Export'
|
||||
);
|
||||
10
apps/admin_export/appinfo/info.xml
Normal file
10
apps/admin_export/appinfo/info.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<info>
|
||||
<id>admin_export</id>
|
||||
<name>Import/Export</name>
|
||||
<description>Import/Export your owncloud data</description>
|
||||
<version>0.1</version>
|
||||
<licence>AGPL</licence>
|
||||
<author>Thomas Schmidt</author>
|
||||
<require>2</require>
|
||||
</info>
|
||||
96
apps/admin_export/settings.php
Normal file
96
apps/admin_export/settings.php
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - admin export
|
||||
*
|
||||
* @author Thomas Schmidt
|
||||
* @copyright 2011 Thomas Schmidt tom@opensuse.org
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
OC_Util::checkAdminUser();
|
||||
OC_Util::checkAppEnabled('admin_export');
|
||||
if (isset($_POST['admin_export'])) {
|
||||
$root = OC::$SERVERROOT . "/";
|
||||
$zip = new ZipArchive();
|
||||
$filename = sys_get_temp_dir() . "/owncloud_export_" . date("y-m-d_H-i-s") . ".zip";
|
||||
error_log("Creating export file at: " . $filename);
|
||||
if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) {
|
||||
exit("Cannot open <$filename>\n");
|
||||
}
|
||||
|
||||
if (isset($_POST['owncloud_system'])) {
|
||||
// adding owncloud system files
|
||||
error_log("Adding owncloud system files to export");
|
||||
zipAddDir($root, $zip, false);
|
||||
foreach (array(".git", "3rdparty", "apps", "core", "files", "l10n", "lib", "ocs", "search", "settings", "tests") as $dirname) {
|
||||
zipAddDir($root . $dirname, $zip, true, basename($root) . "/");
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['owncloud_config'])) {
|
||||
// adding owncloud config
|
||||
// todo: add database export
|
||||
error_log("Adding owncloud config to export");
|
||||
zipAddDir($root . "config/", $zip, true, basename($root) . "/");
|
||||
$zip->addFile($root . '/data/.htaccess', basename($root) . "/data/owncloud.db");
|
||||
}
|
||||
|
||||
if (isset($_POST['user_files'])) {
|
||||
// adding user files
|
||||
$zip->addFile($root . '/data/.htaccess', basename($root) . "/data/.htaccess");
|
||||
$zip->addFile($root . '/data/index.html', basename($root) . "/data/index.html");
|
||||
foreach (OC_User::getUsers() as $i) {
|
||||
error_log("Adding owncloud user files of $i to export");
|
||||
zipAddDir($root . "data/" . $i, $zip, true, basename($root) . "/data/");
|
||||
}
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
|
||||
header("Content-Type: application/zip");
|
||||
header("Content-Disposition: attachment; filename=" . basename($filename));
|
||||
header("Content-Length: " . filesize($filename));
|
||||
ob_end_clean();
|
||||
readfile($filename);
|
||||
unlink($filename);
|
||||
} else {
|
||||
// fill template
|
||||
$tmpl = new OC_Template('admin_export', 'settings');
|
||||
return $tmpl->fetchPage();
|
||||
}
|
||||
|
||||
function zipAddDir($dir, $zip, $recursive=true, $internalDir='') {
|
||||
$dirname = basename($dir);
|
||||
$zip->addEmptyDir($internalDir . $dirname);
|
||||
$internalDir.=$dirname.='/';
|
||||
|
||||
if ($dirhandle = opendir($dir)) {
|
||||
while (false !== ( $file = readdir($dirhandle))) {
|
||||
|
||||
if (( $file != '.' ) && ( $file != '..' )) {
|
||||
|
||||
if (is_dir($dir . '/' . $file) && $recursive) {
|
||||
zipAddDir($dir . '/' . $file, $zip, $recursive, $internalDir);
|
||||
} elseif (is_file($dir . '/' . $file)) {
|
||||
$zip->addFile($dir . '/' . $file, $internalDir . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dirhandle);
|
||||
} else {
|
||||
error_log("Was not able to open directory: " . $dir);
|
||||
}
|
||||
}
|
||||
13
apps/admin_export/templates/settings.php
Normal file
13
apps/admin_export/templates/settings.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<form id="export" action="#" method="post">
|
||||
<fieldset class="personalblock">
|
||||
<legend><strong><?php echo $l->t('Export this ownCloud instance');?></strong></legend>
|
||||
<p><?php echo $l->t('This will create a compressed file that contains the data of this owncloud instance.
|
||||
Please choose which components should be included:');?>
|
||||
</p>
|
||||
<p><input type="checkbox" id="user_files" name="user_files" value="true"><label for="user_files"><?php echo $l->t('User files');?></label><br/>
|
||||
<input type="checkbox" id="owncloud_system" name="owncloud_system" value="true"><label for="owncloud_system"><?php echo $l->t('ownCloud system files');?></label><br/>
|
||||
<input type="checkbox" id="owncloud_config" name="owncloud_config" value="true"><label for="owncloud_config"><?php echo $l->t('ownCloud configuration');?></label>
|
||||
</p>
|
||||
<input type="submit" name="admin_export" value="Export" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
@ -24,10 +24,8 @@
|
|||
require_once('../../lib/base.php');
|
||||
|
||||
// Check if we are a user
|
||||
if( !OC_User::isLoggedIn()){
|
||||
header( 'Location: '.OC_Helper::linkTo( '', 'index.php' ));
|
||||
exit();
|
||||
}
|
||||
OC_Util::checkLoggedIn();
|
||||
OC_Util::checkAppEnabled('bookmarks');
|
||||
|
||||
require_once('bookmarksHelper.php');
|
||||
|
||||
|
|
@ -43,6 +41,5 @@ $metadata = getURLMetadata($url);
|
|||
|
||||
$tmpl->assign('URL', htmlentities($metadata['url']));
|
||||
$tmpl->assign('TITLE', htmlentities($metadata['title']));
|
||||
$tmpl->assign('DESCRIPTION', htmlentities($metadata['description']));
|
||||
|
||||
$tmpl->printPage();
|
||||
$tmpl->printPage();
|
||||
|
|
|
|||
|
|
@ -26,14 +26,9 @@ $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();
|
||||
}
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('bookmarks');
|
||||
|
||||
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
|
||||
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
|
||||
|
|
@ -45,15 +40,14 @@ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
|
|||
//FIXME: Detect when user adds a known URL
|
||||
$query = OC_DB::prepare("
|
||||
INSERT INTO *PREFIX*bookmarks
|
||||
(url, title, description, user_id, public, added, lastmodified)
|
||||
VALUES (?, ?, ?, ?, 0, $_ut, $_ut)
|
||||
(url, title, user_id, public, added, lastmodified)
|
||||
VALUES (?, ?, ?, 0, $_ut, $_ut)
|
||||
");
|
||||
|
||||
|
||||
$params=array(
|
||||
htmlspecialchars_decode($_GET["url"]),
|
||||
htmlspecialchars_decode($_GET["title"]),
|
||||
htmlspecialchars_decode($_GET["description"]),
|
||||
OC_User::getUser()
|
||||
);
|
||||
$query->execute($params);
|
||||
|
|
@ -76,6 +70,6 @@ if($b_id !== false) {
|
|||
$query->execute($params);
|
||||
}
|
||||
|
||||
echo json_encode( array( 'status' => 'success', 'data' => $b_id));
|
||||
OC_JSON::success(array('data' => $b_id));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,14 +26,9 @@ $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();
|
||||
}
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('bookmarks');
|
||||
|
||||
$params=array(
|
||||
htmlspecialchars_decode($_GET["url"]),
|
||||
|
|
@ -64,4 +59,4 @@ $query = OC_DB::prepare("
|
|||
$result = $query->execute();
|
||||
// var_dump($params);
|
||||
|
||||
echo json_encode( array( "status" => "success", "data" => array()));
|
||||
OC_JSON::success(array('data' => array()));
|
||||
|
|
|
|||
|
|
@ -26,14 +26,9 @@ $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();
|
||||
}
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('bookmarks');
|
||||
|
||||
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
|
||||
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
|
||||
|
|
@ -46,14 +41,13 @@ $bookmark_id = (int)$_GET["id"];
|
|||
|
||||
$query = OC_DB::prepare("
|
||||
UPDATE *PREFIX*bookmarks
|
||||
SET url = ?, title =?, description = ?, lastmodified = $_ut
|
||||
SET url = ?, title =?, lastmodified = $_ut
|
||||
WHERE id = $bookmark_id
|
||||
");
|
||||
|
||||
$params=array(
|
||||
htmlspecialchars_decode($_GET["url"]),
|
||||
htmlspecialchars_decode($_GET["title"]),
|
||||
htmlspecialchars_decode($_GET["description"]),
|
||||
);
|
||||
$query->execute($params);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,14 +26,9 @@ $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();
|
||||
}
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('bookmarks');
|
||||
|
||||
// $metadata = array();
|
||||
|
||||
|
|
@ -41,4 +36,4 @@ require '../bookmarksHelper.php';
|
|||
$metadata = getURLMetadata(htmlspecialchars_decode($_GET["url"]));
|
||||
|
||||
|
||||
echo json_encode( array( 'status' => 'success', 'data' => $metadata));
|
||||
OC_JSON::success(array('data' => $metadata));
|
||||
|
|
|
|||
|
|
@ -27,11 +27,8 @@ $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();
|
||||
}
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('bookmarks');
|
||||
|
||||
$query = OC_DB::prepare("
|
||||
UPDATE *PREFIX*bookmarks
|
||||
|
|
|
|||
|
|
@ -26,14 +26,9 @@ $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();
|
||||
}
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('bookmarks');
|
||||
|
||||
$params=array(OC_User::getUser());
|
||||
$CONFIG_DBTYPE = OC_Config::getValue( 'dbtype', 'sqlite' );
|
||||
|
|
@ -64,13 +59,14 @@ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
|
|||
}
|
||||
|
||||
$query = OC_DB::prepare('
|
||||
SELECT id, url, title, description,
|
||||
SELECT id, url, title,
|
||||
CASE WHEN *PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
|
||||
THEN GROUP_CONCAT( tag ' .$_gc_separator. ' )
|
||||
ELSE \' \'
|
||||
END
|
||||
AS tags
|
||||
FROM *PREFIX*bookmarks, *PREFIX*bookmarks_tags
|
||||
FROM *PREFIX*bookmarks
|
||||
LEFT JOIN *PREFIX*bookmarks_tags ON 1=1
|
||||
WHERE (*PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id
|
||||
OR *PREFIX*bookmarks.id NOT IN (
|
||||
SELECT *PREFIX*bookmarks_tags.bookmark_id FROM *PREFIX*bookmarks_tags
|
||||
|
|
@ -84,4 +80,4 @@ $query = OC_DB::prepare('
|
|||
|
||||
$bookmarks = $query->execute($params)->fetchAll();
|
||||
|
||||
echo json_encode( array( 'status' => 'success', 'data' => $bookmarks));
|
||||
OC_JSON::success(array('data' => $bookmarks));
|
||||
|
|
|
|||
|
|
@ -1,27 +1,14 @@
|
|||
<?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/>.
|
||||
*
|
||||
* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
|
||||
* Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
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' ));
|
||||
|
||||
OC_App::registerPersonal('bookmarks', 'settings');
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@
|
|||
<notnull>true</notnull>
|
||||
<length>140</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>description</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>false</notnull>
|
||||
<length>255</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
<type>text</type>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,52 @@
|
|||
<?php
|
||||
|
||||
// Source: http://www.php.net/manual/de/function.curl-setopt.php#102121
|
||||
// This works around a safe_mode/open_basedir restriction
|
||||
function curl_exec_follow(/*resource*/ $ch, /*int*/ &$maxredirect = null) {
|
||||
$mr = $maxredirect === null ? 5 : intval($maxredirect);
|
||||
if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) {
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $mr > 0);
|
||||
curl_setopt($ch, CURLOPT_MAXREDIRS, $mr);
|
||||
} else {
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
|
||||
if ($mr > 0) {
|
||||
$newurl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
|
||||
|
||||
$rch = curl_copy_handle($ch);
|
||||
curl_setopt($rch, CURLOPT_HEADER, true);
|
||||
curl_setopt($rch, CURLOPT_NOBODY, true);
|
||||
curl_setopt($rch, CURLOPT_FORBID_REUSE, false);
|
||||
curl_setopt($rch, CURLOPT_RETURNTRANSFER, true);
|
||||
do {
|
||||
curl_setopt($rch, CURLOPT_URL, $newurl);
|
||||
$header = curl_exec($rch);
|
||||
if (curl_errno($rch)) {
|
||||
$code = 0;
|
||||
} else {
|
||||
$code = curl_getinfo($rch, CURLINFO_HTTP_CODE);
|
||||
if ($code == 301 || $code == 302) {
|
||||
preg_match('/Location:(.*?)\n/', $header, $matches);
|
||||
$newurl = trim(array_pop($matches));
|
||||
} else {
|
||||
$code = 0;
|
||||
}
|
||||
}
|
||||
} while ($code && --$mr);
|
||||
curl_close($rch);
|
||||
if (!$mr) {
|
||||
if ($maxredirect === null) {
|
||||
trigger_error('Too many redirects. When following redirects, libcurl hit the maximum amount.', E_USER_WARNING);
|
||||
} else {
|
||||
$maxredirect = 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_URL, $newurl);
|
||||
}
|
||||
}
|
||||
return curl_exec($ch);
|
||||
}
|
||||
|
||||
function getURLMetadata($url) {
|
||||
//allow only http(s) and (s)ftp
|
||||
$protocols = '/^[hs]{0,1}[tf]{0,1}tp[s]{0,1}\:\/\//i';
|
||||
|
|
@ -9,15 +56,14 @@ function getURLMetadata($url) {
|
|||
}
|
||||
$metadata['url'] = $url;
|
||||
|
||||
$page = file_get_contents($url);
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$page = curl_exec_follow($ch);
|
||||
curl_close($ch);
|
||||
|
||||
@preg_match( "/<title>(.*)<\/title>/si", $page, $match );
|
||||
$metadata['title'] = htmlspecialchars_decode(@$match[1]);
|
||||
|
||||
$meta = get_meta_tags($url);
|
||||
|
||||
if(array_key_exists('description', $meta)) {
|
||||
$metadata['description'] = $meta['description'];
|
||||
}
|
||||
|
||||
return $metadata;
|
||||
}
|
||||
|
|
@ -12,34 +12,13 @@
|
|||
padding: 0.5ex;
|
||||
}
|
||||
|
||||
.bookmark_actions {
|
||||
font-size: smaller;
|
||||
color: #ff44ff;
|
||||
padding-left: 4em;
|
||||
}
|
||||
|
||||
.bookmark_actions span:hover {
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.bookmarks_sorting {
|
||||
float: left;
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
.bookmarks_sorting li {
|
||||
padding: 1ex 1em;
|
||||
border: 1px solid gray;
|
||||
-moz-border-radius:1em; -webkit-border-radius:1em; border-radius:1em;
|
||||
}
|
||||
|
||||
.bookmarks_sorting_active {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.bookmarks_add {
|
||||
display: none;
|
||||
margin-top: 45px;
|
||||
}
|
||||
|
||||
.bookmarks_list {
|
||||
margin-top: 45px;
|
||||
}
|
||||
|
||||
.bookmarks_addBml {
|
||||
|
|
@ -56,15 +35,28 @@
|
|||
width: 20em;
|
||||
}
|
||||
|
||||
.bookmark_actions {
|
||||
display: none;
|
||||
font-size: smaller;
|
||||
color: #666;
|
||||
padding-left: 4em;
|
||||
}
|
||||
|
||||
.bookmark_actions span:hover {
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.bookmark_single {
|
||||
margin-left: 2em;
|
||||
margin-top: 3ex;
|
||||
padding: 0.5ex;
|
||||
/* border-bottom: 1px solid black; */
|
||||
padding: 0.5em 1em;
|
||||
}
|
||||
|
||||
.bookmark_single:hover {
|
||||
background-color: #ccccff;
|
||||
background-color: #EAEAEA;
|
||||
}
|
||||
|
||||
.bookmark_single:hover .bookmark_actions {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.bookmark_title {
|
||||
|
|
@ -77,14 +69,10 @@
|
|||
color: green;
|
||||
}
|
||||
|
||||
.bookmark_tags {
|
||||
.bookmark_tag {
|
||||
color: #ff3333;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear:both;
|
||||
}
|
||||
|
||||
.loading_meta {
|
||||
display: none;
|
||||
margin-left: 5px;
|
||||
|
|
|
|||
|
|
@ -24,10 +24,8 @@
|
|||
require_once('../../lib/base.php');
|
||||
|
||||
// Check if we are a user
|
||||
if( !OC_User::isLoggedIn()){
|
||||
header( "Location: ".OC_Helper::linkTo( '', 'index.php' ));
|
||||
exit();
|
||||
}
|
||||
OC_Util::checkLoggedIn();
|
||||
OC_Util::checkAppEnabled('bookmarks');
|
||||
|
||||
OC_App::setActiveNavigationEntry( 'bookmarks_index' );
|
||||
|
||||
|
|
@ -36,4 +34,4 @@ OC_Util::addStyle('bookmarks', 'bookmarks');
|
|||
|
||||
$tmpl = new OC_Template( 'bookmarks', 'list', 'user' );
|
||||
|
||||
$tmpl->printPage();
|
||||
$tmpl->printPage();
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@ $(document).ready(function() {
|
|||
function addBookmark(event) {
|
||||
var url = $('#bookmark_add_url').val();
|
||||
var title = $('#bookmark_add_title').val();
|
||||
var description = $('#bookmark_add_description').val();
|
||||
var tags = $('#bookmark_add_tags').val();
|
||||
$.ajax({
|
||||
url: 'ajax/addBookmark.php',
|
||||
data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&description=' + encodeURI(description) + '&tags=' + encodeURI(tags),
|
||||
data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
|
||||
success: function(data){
|
||||
location.href='index.php';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@ $(document).ready(function() {
|
|||
$(window).scroll(updateOnBottom);
|
||||
|
||||
$('#bookmark_add_url').focusout(getMetadata);
|
||||
$('.' + bookmarks_sorting).addClass('bookmarks_sorting_active');
|
||||
|
||||
$('.bookmarks_sorting li').click(function(event){changeSorting(this)});
|
||||
|
||||
$('.bookmarks_list').empty();
|
||||
getBookmarks();
|
||||
|
|
@ -39,6 +36,7 @@ function getBookmarks() {
|
|||
for(var i in bookmarks.data) {
|
||||
updateBookmarksList(bookmarks.data[i]);
|
||||
}
|
||||
|
||||
$('.bookmark_link').click(recordClick);
|
||||
$('.bookmark_delete').click(delBookmark);
|
||||
$('.bookmark_edit').click(showBookmark);
|
||||
|
|
@ -57,36 +55,21 @@ function getMetadata() {
|
|||
success: function(pageinfo){
|
||||
$('#bookmark_add_url').val(pageinfo.data.url);
|
||||
$('#bookmark_add_title').val(pageinfo.data.title);
|
||||
if (pageinfo.data.description !== undefined){
|
||||
$('#bookmark_add_description').val(pageinfo.data.description);
|
||||
}
|
||||
$('.loading_meta').css('display','none');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function changeSorting(sortEl) {
|
||||
$('.' + bookmarks_sorting).removeClass('bookmarks_sorting_active');
|
||||
bookmarks_sorting = sortEl.className;
|
||||
$('.' + bookmarks_sorting).addClass('bookmarks_sorting_active');
|
||||
|
||||
$('.bookmarks_list').empty();
|
||||
bookmarks_page = 0;
|
||||
bookmarks_loading = false;
|
||||
getBookmarks();
|
||||
}
|
||||
|
||||
// function addBookmark() {
|
||||
// Instead of creating editBookmark() function, Converted the one above to
|
||||
// addOrEditBookmark() to make .js file more compact.
|
||||
|
||||
function addOrEditBookmark(event) {
|
||||
var id = $('#bookmark_add_id').val();
|
||||
var url = encodeEntities($('#bookmark_add_url').val())
|
||||
var title = encodeEntities($('#bookmark_add_title').val())
|
||||
var description = encodeEntities($('#bookmark_add_description').val())
|
||||
var tags = encodeEntities($('#bookmark_add_tags').val())
|
||||
var taglist = tags.split(' ')
|
||||
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> ';
|
||||
|
|
@ -95,16 +78,15 @@ function addOrEditBookmark(event) {
|
|||
if (id == 0) {
|
||||
$.ajax({
|
||||
url: 'ajax/addBookmark.php',
|
||||
data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&description=' + encodeURI(description) + '&tags=' + encodeURI(tags),
|
||||
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_title"><a href="' + url + '" target="_new" class="bookmark_link">' + title + '</a></p>' +
|
||||
'<p class="bookmark_title"><a href="' + url + '" target="_blank" class="bookmark_link">' + title + '</a></p>' +
|
||||
'<p class="bookmark_url">' + url + '</p>' +
|
||||
'<p class="bookmark_description">' + description + '</p>' +
|
||||
'<p class="bookmark_tags">' + tagshtml + '</p>' +
|
||||
'<p class="bookmark_actions"><span class="bookmark_delete">Delete</span> <span class="bookmark_edit">Edit</span></p>' +
|
||||
'</div>'
|
||||
|
|
@ -115,8 +97,7 @@ function addOrEditBookmark(event) {
|
|||
else {
|
||||
$.ajax({
|
||||
url: 'ajax/editBookmark.php',
|
||||
data: 'id=' + id + '&url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&description=' +
|
||||
encodeURI(description) + '&tags=' + encodeURI(tags),
|
||||
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('');
|
||||
|
|
@ -124,7 +105,6 @@ function addOrEditBookmark(event) {
|
|||
|
||||
var record = $('.bookmark_single[data-id = "' + id + '"]');
|
||||
record.children('.bookmark_url:first').text(url);
|
||||
record.children('.bookmark_description:first').text(description);
|
||||
|
||||
var record_title = record.children('.bookmark_title:first').children('a:first');
|
||||
record_title.attr('href', url);
|
||||
|
|
@ -138,7 +118,7 @@ function addOrEditBookmark(event) {
|
|||
}
|
||||
|
||||
function delBookmark(event) {
|
||||
var record = $(this).parent().parent()
|
||||
var record = $(this).parent().parent();
|
||||
$.ajax({
|
||||
url: 'ajax/delBookmark.php',
|
||||
data: 'url=' + encodeURI($(this).parent().parent().children('.bookmark_url:first').text()),
|
||||
|
|
@ -151,7 +131,6 @@ function showBookmark(event) {
|
|||
$('#bookmark_add_id').val(record.attr('data-id'));
|
||||
$('#bookmark_add_url').val(record.children('.bookmark_url:first').text());
|
||||
$('#bookmark_add_title').val(record.children('.bookmark_title:first').text());
|
||||
$('#bookmark_add_description').val(record.children('.bookmark_description:first').text());
|
||||
$('#bookmark_add_tags').val(record.children('.bookmark_tags:first').text());
|
||||
|
||||
if ($('.bookmarks_add').css('display') == 'none') {
|
||||
|
|
@ -163,10 +142,6 @@ function showBookmark(event) {
|
|||
|
||||
}
|
||||
|
||||
function editBookmark(event) {
|
||||
|
||||
}
|
||||
|
||||
function updateBookmarksList(bookmark) {
|
||||
var tags = encodeEntities(bookmark.tags).split(' ');
|
||||
var taglist = '';
|
||||
|
|
@ -178,9 +153,8 @@ function updateBookmarksList(bookmark) {
|
|||
}
|
||||
$('.bookmarks_list').append(
|
||||
'<div class="bookmark_single" data-id="' + bookmark.id +'" >' +
|
||||
'<p class="bookmark_title"><a href="' + encodeEntities(bookmark.url) + '" target="_new" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a></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>' +
|
||||
'<p class="bookmark_description">' + encodeEntities(bookmark.description) + '</p>' +
|
||||
'<p class="bookmark_tags">' + taglist + '</p>' +
|
||||
'<p class="bookmark_actions"><span class="bookmark_delete">Delete</span> <span class="bookmark_edit">Edit</span></p>' +
|
||||
'</div>'
|
||||
|
|
|
|||
13
apps/bookmarks/settings.php
Normal file
13
apps/bookmarks/settings.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
$tmpl = new OC_Template( 'bookmarks', 'settings');
|
||||
|
||||
OC_Util::addScript('bookmarks','settings');
|
||||
|
||||
return $tmpl->fetchPage();
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
<div class="bookmarks_addBm">
|
||||
<p><label class="bookmarks_label">Address</label><input type="text" id="bookmark_add_url" class="bookmarks_input" value="<? echo $_['URL']; ?>"/></p>
|
||||
<p><label class="bookmarks_label">Title</label><input type="text" id="bookmark_add_title" class="bookmarks_input" value="<? echo $_['TITLE']; ?>" /></p>
|
||||
<p><label class="bookmarks_label">Description</label><input type="text" id="bookmark_add_description" class="bookmarks_input" value="<? echo $_['DESCRIPTION']; ?>" /></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><label class="bookmarks_hint">Hint: Use space to separate tags.</label></p>
|
||||
<p><label class="bookmarks_label"></label><input type="submit" id="bookmark_add_submit" /></p>
|
||||
</div>
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -1,30 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
|
||||
* Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
?>
|
||||
<input type="hidden" id="bookmarkFilterTag" value="<?php if(isset($_GET['tag'])) 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"/>
|
||||
<a class="bookmarks_addBml" href="javascript:var url = encodeURIComponent(location.href);window.open('<?php echo OC_Helper::linkTo('bookmarks', 'addBm.php', null, true); ?>?url='+url, 'owncloud-bookmarks');" title="Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.">Add page to ownCloud</a>
|
||||
<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">Address</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><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">Description</label><input type="text" id="bookmark_add_description" class="bookmarks_input" />
|
||||
<img class="loading_meta" src="<?php echo OC_Helper::imagePath('core', 'loading.gif'); ?>" /></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><label class="bookmarks_hint">Hint: Use space to separate tags.</label></p>
|
||||
<p><label class="bookmarks_label"></label><input type="submit" id="bookmark_add_submit" /></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>
|
||||
<div class="bookmarks_sorting pager">
|
||||
<ul>
|
||||
<li class="bookmarks_sorting_recent">Recent Bookmarks</li>
|
||||
<li class="bookmarks_sorting_clicks">Most clicks</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="bookmarks_list">
|
||||
<noscript>
|
||||
JavaScript is needed to display your Bookmarks
|
||||
</noscript>
|
||||
You have no bookmarks
|
||||
</div>
|
||||
<?php echo $l->t('You have no bookmarks'); ?>
|
||||
</div>
|
||||
14
apps/bookmarks/templates/settings.php
Normal file
14
apps/bookmarks/templates/settings.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
?>
|
||||
<form id="bookmarks">
|
||||
<fieldset class="personalblock">
|
||||
<span class="bold"><?php echo $l->t('Bookmarklet:');?></span> <a class="bookmarks_addBml" href="javascript:var 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 />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
@ -1,21 +1,16 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Bart Visscher *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
require_once ("../../../lib/base.php");
|
||||
if(!OC_USER::isLoggedIn()) {
|
||||
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
|
||||
}
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
$calendarid = $_POST['calendarid'];
|
||||
OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']);
|
||||
$cal = OC_Calendar_Calendar::findCalendar($calendarid);
|
||||
|
|
|
|||
|
|
@ -1,26 +1,16 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Georg Ehrke *
|
||||
* author: Georg Ehrke *
|
||||
* email: ownclouddev at georgswebsite dot de *
|
||||
* homepage: ownclouddev.georgswebsite.de *
|
||||
* manual: ownclouddev.georgswebsite.de/manual *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* <http://ownclouddev.georgswebsite.de/license/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* 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");
|
||||
if(!OC_USER::isLoggedIn()) {
|
||||
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
|
||||
}
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
$currentview = $_GET["v"];
|
||||
OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", $currentview);
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,27 +1,17 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Georg Ehrke *
|
||||
* author: Georg Ehrke *
|
||||
* email: ownclouddev at georgswebsite dot de *
|
||||
* homepage: ownclouddev.georgswebsite.de *
|
||||
* manual: ownclouddev.georgswebsite.de/manual *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* <http://ownclouddev.georgswebsite.de/license/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* 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');
|
||||
$l10n = new OC_L10N('calendar');
|
||||
if(!OC_USER::isLoggedIn()) {
|
||||
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
|
||||
}
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
$output = new OC_TEMPLATE("calendar", "part.choosecalendar");
|
||||
$output -> printpage();
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,34 +1,23 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Bart Visscher *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
require_once('../../../lib/base.php');
|
||||
|
||||
$l10n = new OC_L10N('calendar');
|
||||
|
||||
// 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" => $l->t("Authentication error") )));
|
||||
exit();
|
||||
}
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
|
||||
$userid = OC_User::getUser();
|
||||
$calendarid = OC_Calendar_Calendar::addCalendar($userid, $_POST['name'], $_POST['description'], 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']);
|
||||
$calendarid = OC_Calendar_Calendar::addCalendar($userid, $_POST['name'], 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']);
|
||||
OC_Calendar_Calendar::setCalendarActive($calendarid, 1);
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($calendarid);
|
||||
$tmpl = new OC_Template('calendar', 'part.choosecalendar.rowfields');
|
||||
$tmpl->assign('calendar', $calendar);
|
||||
echo json_encode( array( "status" => "error", "data" => $tmpl->fetchPage().'' ));
|
||||
OC_JSON::success(array('data' => $tmpl->fetchPage()));
|
||||
|
|
|
|||
11
apps/calendar/ajax/daysofweekend.php
Executable file
11
apps/calendar/ajax/daysofweekend.php
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* 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');
|
||||
OC_JSON::checkLoggedIn();
|
||||
echo OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'weekend', '{"Monday":"false","Tuesday":"false","Wednesday":"false","Thursday":"false","Friday":"false","Saturday":"true","Sunday":"true"}');
|
||||
?>
|
||||
29
apps/calendar/ajax/deletecalendar.php
Normal file
29
apps/calendar/ajax/deletecalendar.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
* 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');
|
||||
|
||||
$l10n = new OC_L10N('calendar');
|
||||
|
||||
if(!OC_USER::isLoggedIn()) {
|
||||
die('<script type="text/javascript">document.location = oc_webroot;</script>');
|
||||
}
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
|
||||
$cal = $_POST["calendarid"];
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($cal);
|
||||
if($calendar["userid"] != OC_User::getUser()){
|
||||
OC_JSON::error(array('error'=>'permission_denied'));
|
||||
exit;
|
||||
}
|
||||
$del = OC_Calendar_Calendar::deleteCalendar($cal);
|
||||
if($del == true){
|
||||
OC_JSON::success();
|
||||
}else{
|
||||
OC_JSON::error(array('error'=>'dberror'));
|
||||
}
|
||||
?>
|
||||
31
apps/calendar/ajax/deleteevent.php
Normal file
31
apps/calendar/ajax/deleteevent.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
require_once('../../../lib/base.php');
|
||||
|
||||
$l10n = new OC_L10N('calendar');
|
||||
|
||||
if(!OC_USER::isLoggedIn()) {
|
||||
die('<script type="text/javascript">document.location = oc_webroot;</script>');
|
||||
}
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
|
||||
$id = $_POST['id'];
|
||||
$data = OC_Calendar_Object::find($id);
|
||||
if (!$data)
|
||||
{
|
||||
OC_JSON::error();
|
||||
exit;
|
||||
}
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($data['calendarid']);
|
||||
if($calendar['userid'] != OC_User::getUser()){
|
||||
OC_JSON::error();
|
||||
exit;
|
||||
}
|
||||
$result = OC_Calendar_Object::delete($id);
|
||||
OC_JSON::success();
|
||||
?>
|
||||
12
apps/calendar/ajax/duration.php
Normal file
12
apps/calendar/ajax/duration.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* 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');
|
||||
OC_JSON::checkLoggedIn();
|
||||
$duration = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'duration', "60");
|
||||
OC_JSON::encodedPrint(array("duration" => $duration));
|
||||
?>
|
||||
|
|
@ -1,25 +1,31 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Bart Visscher *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
require_once('../../../lib/base.php');
|
||||
$l10n = new OC_L10N('calendar');
|
||||
if(!OC_USER::isLoggedIn()) {
|
||||
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
|
||||
}
|
||||
$calendarcolor_options = array(
|
||||
'ff0000', // "Red"
|
||||
'00ff00', // "Green"
|
||||
'ffff00', // "Yellow"
|
||||
'808000', // "Olive"
|
||||
'ffa500', // "Orange"
|
||||
'ff7f50', // "Coral"
|
||||
'ee82ee', // "Violet"
|
||||
'ecc255', // dark yellow
|
||||
);
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($_GET['calendarid']);
|
||||
$tmpl = new OC_Template("calendar", "part.editcalendar");
|
||||
$tmpl->assign('new', false);
|
||||
$tmpl->assign('calendarcolor_options', $calendarcolor_options);
|
||||
$tmpl->assign('calendar', $calendar);
|
||||
$tmpl->printPage();
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,11 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Bart Visscher *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
require_once('../../../lib/base.php');
|
||||
|
||||
$l10n = new OC_L10N('calendar');
|
||||
|
|
@ -20,12 +13,12 @@ $l10n = new OC_L10N('calendar');
|
|||
if(!OC_USER::isLoggedIn()) {
|
||||
die('<script type="text/javascript">document.location = oc_webroot;</script>');
|
||||
}
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
|
||||
$errarr = OC_Calendar_Object::validateRequest($_POST);
|
||||
if($errarr){
|
||||
//show validate errors
|
||||
$errarr['status'] = 'error';
|
||||
echo json_encode($errarr);
|
||||
OC_JSON::error($errarr);
|
||||
exit;
|
||||
}else{
|
||||
$id = $_POST['id'];
|
||||
|
|
@ -33,12 +26,12 @@ if($errarr){
|
|||
$data = OC_Calendar_Object::find($id);
|
||||
if (!$data)
|
||||
{
|
||||
echo json_encode(array("error"=>"true"));
|
||||
OC_JSON::error();
|
||||
exit;
|
||||
}
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($data['calendarid']);
|
||||
if($calendar['userid'] != OC_User::getUser()){
|
||||
echo json_encode(array("error"=>"true"));
|
||||
OC_JSON::error();
|
||||
exit;
|
||||
}
|
||||
$vcalendar = Sabre_VObject_Reader::read($data['calendardata']);
|
||||
|
|
@ -47,6 +40,6 @@ if($errarr){
|
|||
if ($data['calendarid'] != $cal) {
|
||||
OC_Calendar_Object::moveToCalendar($id, $cal);
|
||||
}
|
||||
echo json_encode(array('status' => 'success'));
|
||||
OC_JSON::success();
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,11 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Bart Visscher *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
require_once('../../../lib/base.php');
|
||||
|
||||
$l10n = new OC_L10N('calendar');
|
||||
|
|
@ -19,9 +13,10 @@ $l10n = new OC_L10N('calendar');
|
|||
if(!OC_USER::isLoggedIn()) {
|
||||
die('<script type="text/javascript">document.location = oc_webroot;</script>');
|
||||
}
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
||||
$categories = OC_Calendar_Object::getCategoryOptions($l10n);
|
||||
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
||||
$category_options = OC_Calendar_Object::getCategoryOptions($l10n);
|
||||
$repeat_options = OC_Calendar_Object::getRepeatOptions($l10n);
|
||||
|
||||
$id = $_GET['id'];
|
||||
|
|
@ -34,9 +29,10 @@ if($calendar['userid'] != OC_User::getUser()){
|
|||
$object = Sabre_VObject_Reader::read($data['calendardata']);
|
||||
$vevent = $object->VEVENT;
|
||||
$dtstart = $vevent->DTSTART;
|
||||
$dtend = $vevent->DTEND;
|
||||
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
|
||||
switch($dtstart->getDateType()) {
|
||||
case Sabre_VObject_Element_DateTime::LOCALTZ:
|
||||
case Sabre_VObject_Element_DateTime::LOCAL:
|
||||
$startdate = $dtstart->getDateTime()->format('d-m-Y');
|
||||
$starttime = $dtstart->getDateTime()->format('H:i');
|
||||
$enddate = $dtend->getDateTime()->format('d-m-Y');
|
||||
|
|
@ -55,19 +51,28 @@ switch($dtstart->getDateType()) {
|
|||
|
||||
$summary = isset($vevent->SUMMARY) ? $vevent->SUMMARY->value : '';
|
||||
$location = isset($vevent->LOCATION) ? $vevent->LOCATION->value : '';
|
||||
$category = isset($vevent->CATEGORIES) ? $vevent->CATEGORIES->value : '';
|
||||
$categories = array();
|
||||
if (isset($vevent->CATEGORIES)){
|
||||
$categories = explode(',', $vevent->CATEGORIES->value);
|
||||
$categories = array_map('trim', $categories);
|
||||
}
|
||||
foreach($categories as $category){
|
||||
if (!in_array($category, $category_options)){
|
||||
array_unshift($category_options, $category);
|
||||
}
|
||||
}
|
||||
$repeat = isset($vevent->CATEGORY) ? $vevent->CATEGORY->value : '';
|
||||
$description = isset($vevent->DESCRIPTION) ? $vevent->DESCRIPTION->value : '';
|
||||
|
||||
$tmpl = new OC_Template('calendar', 'part.editevent');
|
||||
$tmpl->assign('id', $id);
|
||||
$tmpl->assign('calendars', $calendars);
|
||||
$tmpl->assign('categories', $categories);
|
||||
$tmpl->assign('calendar_options', $calendar_options);
|
||||
$tmpl->assign('category_options', $category_options);
|
||||
$tmpl->assign('repeat_options', $repeat_options);
|
||||
|
||||
$tmpl->assign('title', $summary);
|
||||
$tmpl->assign('location', $location);
|
||||
$tmpl->assign('category', $category);
|
||||
$tmpl->assign('categories', $categories);
|
||||
$tmpl->assign('calendar', $data['calendarid']);
|
||||
$tmpl->assign('allday', $allday);
|
||||
$tmpl->assign('startdate', $startdate);
|
||||
|
|
|
|||
12
apps/calendar/ajax/firstdayofweek.php
Executable file
12
apps/calendar/ajax/firstdayofweek.php
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* 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');
|
||||
OC_JSON::checkLoggedIn();
|
||||
$firstdayofweek = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'firstdayofweek', "1");
|
||||
OC_JSON::encodedPrint(array("firstdayofweek" => $firstdayofweek));
|
||||
?>
|
||||
|
|
@ -1,26 +1,70 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Georg Ehrke *
|
||||
* author: Georg Ehrke *
|
||||
* email: ownclouddev at georgswebsite dot de *
|
||||
* homepage: ownclouddev.georgswebsite.de *
|
||||
* manual: ownclouddev.georgswebsite.de/manual *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* <http://ownclouddev.georgswebsite.de/license/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* 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");
|
||||
if(!OC_USER::isLoggedIn()) {
|
||||
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
|
||||
}
|
||||
$output = new OC_TEMPLATE("calendar", "part.getcal");
|
||||
$output -> printpage();
|
||||
?>
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
|
||||
$events = array();
|
||||
$return = array('calendars'=>array());
|
||||
foreach($calendars as $calendar) {
|
||||
$tmp = OC_Calendar_Object::all($calendar['id']);
|
||||
$events = array_merge($events, $tmp);
|
||||
$return['calendars'][$calendar['id']] = array(
|
||||
'displayname' => $calendar['displayname'],
|
||||
'color' => '#'.$calendar['calendarcolor']
|
||||
);
|
||||
}
|
||||
|
||||
$select_year = $_GET["year"];
|
||||
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
|
||||
foreach($events as $event)
|
||||
{
|
||||
if ($select_year != substr($event['startdate'], 0, 4))
|
||||
continue;
|
||||
$object = Sabre_VObject_Reader::read($event['calendardata']);
|
||||
$vevent = $object->VEVENT;
|
||||
$dtstart = $vevent->DTSTART;
|
||||
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
|
||||
$start_dt = $dtstart->getDateTime();
|
||||
$start_dt->setTimezone(new DateTimeZone($user_timezone));
|
||||
$end_dt = $dtend->getDateTime();
|
||||
$end_dt->setTimezone(new DateTimeZone($user_timezone));
|
||||
$year = $start_dt->format('Y');
|
||||
$month = $start_dt->format('n') - 1; // return is 0 based
|
||||
$day = $start_dt->format('j');
|
||||
$hour = $start_dt->format('G');
|
||||
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
|
||||
$hour = 'allday';
|
||||
}
|
||||
|
||||
$return_event = array();
|
||||
foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop)
|
||||
{
|
||||
$return_event[$prop] = $event[$prop];
|
||||
}
|
||||
$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
|
||||
$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
|
||||
$return_event['description'] = $event['summary'];
|
||||
if ($hour == 'allday')
|
||||
{
|
||||
$return_event['allday'] = true;
|
||||
}
|
||||
if (isset($return[$year][$month][$day][$hour]))
|
||||
{
|
||||
$return[$year][$month][$day][$hour][] = $return_event;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return[$year][$month][$day][$hour] = array(1 => $return_event);
|
||||
}
|
||||
}
|
||||
OC_JSON::encodedPrint($return);
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Georg Ehrke *
|
||||
* author: Georg Ehrke *
|
||||
* email: ownclouddev at georgswebsite dot de *
|
||||
* homepage: ownclouddev.georgswebsite.de *
|
||||
* manual: ownclouddev.georgswebsite.de/manual *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* <http://ownclouddev.georgswebsite.de/license/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
|
||||
?>
|
||||
20
apps/calendar/ajax/importdialog.php
Normal file
20
apps/calendar/ajax/importdialog.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* 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');
|
||||
|
||||
$l10n = new OC_L10N('calendar');
|
||||
|
||||
if(!OC_USER::isLoggedIn()) {
|
||||
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
|
||||
}
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
|
||||
$tmpl = new OC_Template('calendar', 'part.import');
|
||||
$tmpl->printpage();
|
||||
?>
|
||||
103
apps/calendar/ajax/moveevent.php
Normal file
103
apps/calendar/ajax/moveevent.php
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
error_reporting(E_ALL);
|
||||
require_once('../../../lib/base.php');
|
||||
OC_JSON::checkLoggedIn();
|
||||
$data = OC_Calendar_Object::find($_POST["id"]);
|
||||
$calendarid = $data["calendarid"];
|
||||
$cal = $calendarid;
|
||||
$id = $_POST["id"];
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($calendarid);
|
||||
if(OC_User::getUser() != $calendar["userid"]){
|
||||
OC_JSON::error();
|
||||
exit;
|
||||
}
|
||||
$newdate = $_POST["newdate"];
|
||||
$caldata = array();
|
||||
//modified part of editeventform.php
|
||||
$object = Sabre_VObject_Reader::read($data['calendardata']);
|
||||
$vevent = $object->VEVENT;
|
||||
$dtstart = $vevent->DTSTART;
|
||||
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
|
||||
switch($dtstart->getDateType()) {
|
||||
case Sabre_VObject_Element_DateTime::LOCALTZ:
|
||||
case Sabre_VObject_Element_DateTime::LOCAL:
|
||||
$startdate = $dtstart->getDateTime()->format('d-m-Y');
|
||||
$starttime = $dtstart->getDateTime()->format('H:i');
|
||||
$enddate = $dtend->getDateTime()->format('d-m-Y');
|
||||
$endtime = $dtend->getDateTime()->format('H:i');
|
||||
$allday = false;
|
||||
break;
|
||||
case Sabre_VObject_Element_DateTime::DATE:
|
||||
$startdate = $dtstart->getDateTime()->format('d-m-Y');
|
||||
$starttime = '00:00';
|
||||
$dtend->getDateTime()->modify('-1 day');
|
||||
$enddate = $dtend->getDateTime()->format('d-m-Y');
|
||||
$endtime = '23:59';
|
||||
$allday = true;
|
||||
break;
|
||||
}
|
||||
$caldata["title"] = isset($vevent->SUMMARY) ? $vevent->SUMMARY->value : '';
|
||||
$caldata["location"] = isset($vevent->LOCATION) ? $vevent->LOCATION->value : '';
|
||||
$caldata["categories"] = array();
|
||||
if (isset($vevent->CATEGORIES)){
|
||||
$caldata["categories"] = explode(',', $vevent->CATEGORIES->value);
|
||||
$caldata["categories"] = array_map('trim', $categories);
|
||||
}
|
||||
foreach($caldata["categories"] as $category){
|
||||
if (!in_array($category, $category_options)){
|
||||
array_unshift($category_options, $category);
|
||||
}
|
||||
}
|
||||
$caldata["repeat"] = isset($vevent->CATEGORY) ? $vevent->CATEGORY->value : '';
|
||||
$caldata["description"] = isset($vevent->DESCRIPTION) ? $vevent->DESCRIPTION->value : '';
|
||||
//end part of editeventform.php
|
||||
$startdatearray = explode("-", $startdate);
|
||||
$starttimearray = explode(":", $starttime);
|
||||
$startunix = mktime($starttimearray[0], $starttimearray[1], 0, $startdatearray[1], $startdatearray[0], $startdatearray[2]);
|
||||
$enddatearray = explode("-", $enddate);
|
||||
$endtimearray = explode(":", $endtime);
|
||||
$endunix = mktime($endtimearray[0], $endtimearray[1], 0, $enddatearray[1], $enddatearray[0], $enddatearray[2]);
|
||||
$difference = $endunix - $startunix;
|
||||
if(strlen($newdate) > 10){
|
||||
$newdatestringarray = explode("-", $newdate);
|
||||
if($newdatestringarray[1] == "allday"){
|
||||
$allday = true;
|
||||
$newdatestringarray[1] = "00:00";
|
||||
}else{
|
||||
if($allday == true){
|
||||
$difference = 3600;
|
||||
}
|
||||
$allday = false;
|
||||
}
|
||||
}else{
|
||||
$newdatestringarray = array();
|
||||
$newdatestringarray[0] = $newdate;
|
||||
$newdatestringarray[1] = $starttime;
|
||||
}
|
||||
$newdatearray = explode(".", $newdatestringarray[0]);
|
||||
$newtimearray = explode(":", $newdatestringarray[1]);
|
||||
$newstartunix = mktime($newtimearray[0], $newtimearray[1], 0, $newdatearray[1], $newdatearray[0], $newdatearray[2]);
|
||||
$newendunix = $newstartunix + $difference;
|
||||
if($allday == true){
|
||||
$caldata["allday"] = true;
|
||||
}else{
|
||||
unset($caldata["allday"]);
|
||||
}
|
||||
$caldata["from"] = date("d-m-Y", $newstartunix);
|
||||
$caldata["fromtime"] = date("H:i", $newstartunix);
|
||||
$caldata["to"] = date("d-m-Y", $newendunix);
|
||||
$caldata["totime"] = date("H:i", $newendunix);
|
||||
//modified part of editevent.php
|
||||
$vcalendar = Sabre_VObject_Reader::read($data["calendardata"]);
|
||||
OC_Calendar_Object::updateVCalendarFromRequest($caldata, $vcalendar);
|
||||
|
||||
$result = OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
||||
OC_JSON::success();
|
||||
//end part of editevent.php
|
||||
?>
|
||||
|
|
@ -1,27 +1,21 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Bart Visscher *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
require_once('../../../lib/base.php');
|
||||
$l10n = new OC_L10N('calendar');
|
||||
if(!OC_USER::isLoggedIn()) {
|
||||
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
|
||||
}
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
$calendar = array(
|
||||
'id' => 'new',
|
||||
'displayname' => 'Test',
|
||||
'description' => 'Test calendar',
|
||||
'calendarcolor' => 'black',
|
||||
'displayname' => '',
|
||||
'calendarcolor' => '',
|
||||
);
|
||||
$tmpl = new OC_Template('calendar', 'part.editcalendar');
|
||||
$tmpl->assign('new', true);
|
||||
|
|
|
|||
|
|
@ -1,23 +1,11 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Georg Ehrke *
|
||||
* author: Georg Ehrke *
|
||||
* email: ownclouddev at georgswebsite dot de *
|
||||
* homepage: ownclouddev.georgswebsite.de *
|
||||
* manual: ownclouddev.georgswebsite.de/manual *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* <http://ownclouddev.georgswebsite.de/license/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* 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');
|
||||
|
||||
$l10n = new OC_L10N('calendar');
|
||||
|
|
@ -25,17 +13,17 @@ $l10n = new OC_L10N('calendar');
|
|||
if(!OC_USER::isLoggedIn()) {
|
||||
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
|
||||
}
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
|
||||
$errarr = OC_Calendar_Object::validateRequest($_POST);
|
||||
if($errarr){
|
||||
//show validate errors
|
||||
$errarr["error"] = "true";
|
||||
echo json_encode($errarr);
|
||||
OC_JSON::error($errarr);
|
||||
exit;
|
||||
}else{
|
||||
$cal = $_POST['calendar'];
|
||||
$vcalendar = OC_Calendar_Object::createVCalendarFromRequest($_POST);
|
||||
$result = OC_Calendar_Object::add($cal, $vcalendar->serialize());
|
||||
echo json_encode(array("success"=>"true"));
|
||||
OC_JSON::success();
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,22 +1,11 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Georg Ehrke *
|
||||
* author: Georg Ehrke *
|
||||
* email: ownclouddev at georgswebsite dot de *
|
||||
* homepage: ownclouddev.georgswebsite.de *
|
||||
* manual: ownclouddev.georgswebsite.de/manual *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* <http://ownclouddev.georgswebsite.de/license/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* 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');
|
||||
|
||||
$l10n = new OC_L10N('calendar');
|
||||
|
|
@ -24,9 +13,10 @@ $l10n = new OC_L10N('calendar');
|
|||
if(!OC_USER::isLoggedIn()) {
|
||||
die('<script type="text/javascript">document.location = oc_webroot;</script>');
|
||||
}
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
||||
$categories = OC_Calendar_Object::getCategoryOptions($l10n);
|
||||
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
||||
$category_options = OC_Calendar_Object::getCategoryOptions($l10n);
|
||||
$repeat_options = OC_Calendar_Object::getRepeatOptions($l10n);
|
||||
$startday = substr($_GET['d'], 0, 2);
|
||||
$startmonth = substr($_GET['d'], 2, 2);
|
||||
|
|
@ -39,25 +29,25 @@ if($starttime != 'undefined' && !is_nan($starttime) && !$allday){
|
|||
$starttime = '0';
|
||||
$startminutes = '00';
|
||||
}else{
|
||||
$starttime = date('H');
|
||||
$starttime = date('G');
|
||||
|
||||
$startminutes = date('i');
|
||||
}
|
||||
|
||||
$endday = $startday;
|
||||
$endmonth = $startmonth;
|
||||
$endyear = $startyear;
|
||||
$endtime = $starttime;
|
||||
$endminutes = $startminutes;
|
||||
if($endtime == 23) {
|
||||
$endday++;
|
||||
$endtime = 0;
|
||||
} else {
|
||||
$endtime++;
|
||||
}
|
||||
$datetimestamp = mktime($starttime, $startminutes, 0, $startmonth, $startday, $startyear);
|
||||
$duration = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'duration', "60");
|
||||
$datetimestamp = $datetimestamp + ($duration * 60);
|
||||
$endmonth = date("m", $datetimestamp);
|
||||
$endday = date("d", $datetimestamp);
|
||||
$endyear = date("Y", $datetimestamp);
|
||||
$endtime = date("G", $datetimestamp);
|
||||
$endminutes = date("i", $datetimestamp);
|
||||
|
||||
|
||||
|
||||
$tmpl = new OC_Template('calendar', 'part.newevent');
|
||||
$tmpl->assign('calendars', $calendars);
|
||||
$tmpl->assign('categories', $categories);
|
||||
$tmpl->assign('calendar_options', $calendar_options);
|
||||
$tmpl->assign('category_options', $category_options);
|
||||
$tmpl->assign('startdate', $startday . '-' . $startmonth . '-' . $startyear);
|
||||
$tmpl->assign('starttime', ($starttime <= 9 ? '0' : '') . $starttime . ':' . $startminutes);
|
||||
$tmpl->assign('enddate', $endday . '-' . $endmonth . '-' . $endyear);
|
||||
|
|
|
|||
30
apps/calendar/ajax/setdaysofweekend.php
Executable file
30
apps/calendar/ajax/setdaysofweekend.php
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* 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');
|
||||
OC_JSON::checkLoggedIn();
|
||||
$weekenddays = array("Monday"=>"false", "Tuesday"=>"false", "Wednesday"=>"false", "Thursday"=>"false", "Friday"=>"false", "Saturday"=>"false", "Sunday"=>"false");
|
||||
for($i = 0;$i < count($_POST["weekend"]); $i++){
|
||||
switch ($_POST["weekend"][$i]){
|
||||
case "Monday":
|
||||
case "Tuesday":
|
||||
case "Wednesday":
|
||||
case "Thursday":
|
||||
case "Friday":
|
||||
case "Saturday":
|
||||
case "Sunday":
|
||||
break;
|
||||
default:
|
||||
OC_JSON::error();
|
||||
exit;
|
||||
}
|
||||
$weekenddays[$_POST["weekend"][$i]] = "true";
|
||||
}
|
||||
$setValue = json_encode($weekenddays);
|
||||
OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'weekend', $setValue);
|
||||
OC_JSON::success();
|
||||
?>
|
||||
17
apps/calendar/ajax/setduration.php
Normal file
17
apps/calendar/ajax/setduration.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* 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');
|
||||
OC_JSON::checkLoggedIn();
|
||||
if(isset($_POST["duration"])){
|
||||
OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'duration', $_POST["duration"]);
|
||||
OC_JSON::success();
|
||||
}else{
|
||||
OC_JSON::error();
|
||||
}
|
||||
?>
|
||||
|
||||
16
apps/calendar/ajax/setfirstdayofweek.php
Executable file
16
apps/calendar/ajax/setfirstdayofweek.php
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
/**
|
||||
* 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');
|
||||
OC_JSON::checkLoggedIn();
|
||||
if(isset($_POST["firstdayofweek"])){
|
||||
OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'firstdayofweek', $_POST["firstdayofweek"]);
|
||||
OC_JSON::success();
|
||||
}else{
|
||||
OC_JSON::error();
|
||||
}
|
||||
?>
|
||||
17
apps/calendar/ajax/settimeformat.php
Normal file
17
apps/calendar/ajax/settimeformat.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* 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');
|
||||
OC_JSON::checkLoggedIn();
|
||||
if(isset($_POST["timeformat"])){
|
||||
OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]);
|
||||
OC_JSON::success();
|
||||
}else{
|
||||
OC_JSON::error();
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
@ -1,39 +1,27 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Bart Visscher *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
// Init owncloud
|
||||
require_once('../../../lib/base.php');
|
||||
|
||||
$l=new OC_L10N('calendar');
|
||||
|
||||
// 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" => $l->t("Authentication error") )));
|
||||
exit();
|
||||
}
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
|
||||
// Get data
|
||||
if( isset( $_POST['timezone'] ) ){
|
||||
$timezone=$_POST['timezone'];
|
||||
OC_Preferences::setValue( OC_User::getUser(), 'calendar', 'timezone', $timezone );
|
||||
echo json_encode( array( "status" => "success", "data" => array( "message" => $l->t("Timezone changed") )));
|
||||
OC_JSON::success(array('data' => array( 'message' => $l->t('Timezone changed') )));
|
||||
}else{
|
||||
echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Invalid request") )));
|
||||
OC_JSON::error(array('data' => array( 'message' => $l->t('Invalid request') )));
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
12
apps/calendar/ajax/timeformat.php
Normal file
12
apps/calendar/ajax/timeformat.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* 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');
|
||||
OC_JSON::checkLoggedIn();
|
||||
$timeformat = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'timeformat', "24");
|
||||
OC_JSON::encodedPrint(array("timeformat" => $timeformat));
|
||||
?>
|
||||
|
|
@ -1,34 +1,23 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Bart Visscher *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
require_once('../../../lib/base.php');
|
||||
|
||||
$l10n = new OC_L10N('calendar');
|
||||
|
||||
// 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" => $l->t("Authentication error") )));
|
||||
exit();
|
||||
}
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('calendar');
|
||||
|
||||
$calendarid = $_POST['id'];
|
||||
OC_Calendar_Calendar::editCalendar($calendarid, $_POST['name'], $_POST['description'], null, null, null, $_POST['color']);
|
||||
OC_Calendar_Calendar::editCalendar($calendarid, $_POST['name'], null, null, null, $_POST['color']);
|
||||
OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']);
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($calendarid);
|
||||
$tmpl = new OC_Template('calendar', 'part.choosecalendar.rowfields');
|
||||
$tmpl->assign('calendar', $calendar);
|
||||
echo json_encode( array( "status" => "success", "data" => $tmpl->fetchPage() ));
|
||||
OC_JSON::success(array('data' => $tmpl->fetchPage()));
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ OC::$CLASSPATH['OC_Calendar_Hooks'] = 'apps/calendar/lib/hooks.php';
|
|||
OC::$CLASSPATH['OC_Connector_Sabre_CalDAV'] = 'apps/calendar/lib/connector_sabre.php';
|
||||
OC_HOOK::connect('OC_User', 'post_createUser', 'OC_Calendar_Hooks', 'deleteUser');
|
||||
|
||||
OC_Util::addScript('calendar','loader');
|
||||
|
||||
OC_App::register( array(
|
||||
'order' => 10,
|
||||
'id' => 'calendar',
|
||||
|
|
|
|||
|
|
@ -153,12 +153,6 @@
|
|||
<length>4</length>
|
||||
</field>
|
||||
|
||||
<field>
|
||||
<name>description</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
|
||||
<field>
|
||||
<name>calendarorder</name>
|
||||
<type>integer</type>
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
<author>Georg Ehrke (Userinterface), Jakob Sack</author>
|
||||
<require>2</require>
|
||||
<description>Calendar with CalDAV support</description>
|
||||
<default_enable/>
|
||||
</info>
|
||||
|
|
|
|||
|
|
@ -1,29 +1,16 @@
|
|||
<?php
|
||||
/**
|
||||
* ownCloud - Calendar
|
||||
*
|
||||
* @author Jakob Sack
|
||||
* @copyright 2011 Jakob Sack mail@jakobsack.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 Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright (c) 2011 Jakob Sack <mail@jakobsack.de>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
// Do not load FS ...
|
||||
$RUNTIME_NOSETUPFS = true;
|
||||
|
||||
require_once('../../lib/base.php');
|
||||
OC_Util::checkAppEnabled('calendar');
|
||||
|
||||
// Backends
|
||||
$authBackend = new OC_Connector_Sabre_Auth();
|
||||
|
|
@ -38,11 +25,12 @@ $nodes = array(
|
|||
|
||||
// Fire up server
|
||||
$server = new Sabre_DAV_Server($nodes);
|
||||
$server->setBaseUri($WEBROOT.'/apps/calendar/caldav.php');
|
||||
$server->setBaseUri(OC::$WEBROOT.'/apps/calendar/caldav.php');
|
||||
// Add plugins
|
||||
$server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud'));
|
||||
$server->addPlugin(new Sabre_CalDAV_Plugin());
|
||||
$server->addPlugin(new Sabre_DAVACL_Plugin());
|
||||
$server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload
|
||||
|
||||
// And off we go!
|
||||
$server->exec();
|
||||
|
|
|
|||
|
|
@ -1,24 +1,11 @@
|
|||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Georg Ehrke *
|
||||
* author: Georg Ehrke *
|
||||
* email: ownclouddev at georgswebsite dot de *
|
||||
* homepage: ownclouddev.georgswebsite.de *
|
||||
* manual: ownclouddev.georgswebsite.de/manual *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* <http://ownclouddev.georgswebsite.de/license/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#view {margin-left: 10px; float: left; font-size: 12px;}
|
||||
#view { float: left; font-size: 12px; height: 100%;}
|
||||
#datecontrol {text-align: center;}
|
||||
#datecontrol_left{font-size: 12px;}
|
||||
#datecontrol_right{font-size: 12px;}
|
||||
|
|
@ -30,7 +17,6 @@
|
|||
#editentry_dialog {display: none;}
|
||||
#parsingfail_dialog{display: none;}
|
||||
|
||||
#view {margin-left: 10px; float: left; font-size: 12px; height: 100%;}
|
||||
#calendar_holder {height: 100%; width: 100%;}
|
||||
#onedayview, #oneweekview, #fourweeksview, #onemonthview, #listview {display: none; position: absolute;bottom: 0; right: 0; left: 160px; top: 80px;}
|
||||
#onedayview table {margin: 0; padding: 0; width: 100%; height: 100%; border-spacing:1px; background: #EEEEEE;}
|
||||
|
|
@ -49,15 +35,16 @@
|
|||
.controls {min-width: 800px;}
|
||||
.center {text-align: center;}
|
||||
.dateinfo {height: 20px;width: 100%; overflow: hidden; margin-top: 0; padding: 0; font-size: 12px;background: #F7F7F7;}
|
||||
.events {width: 100%; margin: 0; padding: 0;}
|
||||
.events {width: 100%; margin: 0; padding: 0;min-height: 100px;}
|
||||
.calendar_row {height: 20px; text-align: center;background: #ffffff;}
|
||||
#oneweekview .calendar_row {width: 13.5%;}
|
||||
.calendar_time {height: 20px; width: 50px; text-align:right;background: #ffffff;}
|
||||
.day {text-align: center; background: #ffffff; margin: 0; padding: 0; vertical-align: top; width: 14%; height: 22%;}
|
||||
.weekend .events{text-align: center;margin: 0; padding: 0;vertical-align: top;background: #F3F3F3; width: 100%; }
|
||||
.weekend {background: #F3F3F3; }
|
||||
.weekend_thead, .weekend_row{height: 20px;text-align: center;text-align: center;background: #F3F3F3;}
|
||||
.thisday{background: #FFFABC;text-align: center;margin: 0;padding: 0;vertical-align: top;height: 20px;}
|
||||
.thisday{background: #FFFABC;}
|
||||
.event {position:relative;}
|
||||
.event.colored {border-bottom: 1px solid white;}
|
||||
.popup {display: none; position: absolute; z-index: 1000; background: #eeeeee; color: #000000; border: 1px solid #1a1a1a; font-size: 90%;}
|
||||
.event_popup {width: 280px; height: 40px; padding: 10px;}
|
||||
|
||||
|
|
@ -68,3 +55,8 @@ color:#333;
|
|||
#fromtime.disabled, #totime.disabled {
|
||||
color:#A9A9A9;
|
||||
}
|
||||
select#category{width:140px;}
|
||||
button.category{margin:0 3px;}
|
||||
|
||||
.calendar-colorpicker-color{display:inline-block;width:20px;height:20px;margin-right:2px;cursor:pointer;border:2px solid transparent;}
|
||||
.calendar-colorpicker-color.active{border:2px solid black;}
|
||||
|
|
|
|||
|
|
@ -1,37 +1,38 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Georg Ehrke *
|
||||
* author: Georg Ehrke *
|
||||
* email: ownclouddev at georgswebsite dot de *
|
||||
* homepage: ownclouddev.georgswebsite.de *
|
||||
* manual: ownclouddev.georgswebsite.de/manual *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* <http://ownclouddev.georgswebsite.de/license/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
/**
|
||||
* 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");
|
||||
if(!OC_USER::isLoggedIn()) {
|
||||
header("Location: " . OC_HELPER::linkTo("", "index.php"));
|
||||
exit;
|
||||
}
|
||||
OC_Util::checkLoggedIn();
|
||||
OC_Util::checkAppEnabled('calendar');
|
||||
$cal = $_GET["calid"];
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($cal);
|
||||
if($calendar["userid"] != OC_User::getUser()){
|
||||
header("Location: " . OC_HELPER::linkTo("", "index.php"));
|
||||
exit;
|
||||
}
|
||||
$calobjects = OC_Calendar_Object::all($cal);
|
||||
header("Content-Type: text/Calendar");
|
||||
header("Content-Disposition: inline; filename=calendar.ics");
|
||||
for($i = 0;$i <= count($calobjects); $i++){
|
||||
echo $calobjects[$i]["calendardata"] . "\n";
|
||||
$event = $_GET["eventid"];
|
||||
if(isset($cal)){
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($cal);
|
||||
if($calendar["userid"] != OC_User::getUser()){
|
||||
OC_JSON::error();
|
||||
exit;
|
||||
}
|
||||
$calobjects = OC_Calendar_Object::all($cal);
|
||||
header("Content-Type: text/Calendar");
|
||||
header("Content-Disposition: inline; filename=calendar.ics");
|
||||
for($i = 0;$i <= count($calobjects); $i++){
|
||||
echo $calobjects[$i]["calendardata"] . "\n";
|
||||
}
|
||||
}elseif(isset($event)){
|
||||
$data = OC_Calendar_Object::find($_GET["eventid"]);
|
||||
$calendarid = $data["calendarid"];
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($calendarid);
|
||||
if($calendar["userid"] != OC_User::getUser()){
|
||||
OC_JSON::error();
|
||||
exit;
|
||||
}
|
||||
header("Content-Type: text/Calendar");
|
||||
header("Content-Disposition: inline; filename=" . $data["summary"] . ".ics");
|
||||
echo $data["calendardata"];
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
50
apps/calendar/import.php
Normal file
50
apps/calendar/import.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* 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');
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_Util::checkAppEnabled('calendar');
|
||||
|
||||
if($_GET["import"] == "existing"){
|
||||
$calid = $_GET["calid"];
|
||||
$calendar = OC_Calendar_Calendar::findCalendar($calid);
|
||||
if($calendar['userid'] != OC_User::getUser()){
|
||||
OC_JSON::error();
|
||||
exit;
|
||||
}
|
||||
if($_GET["path"] != ""){
|
||||
$filename = $_GET["path"] . "/" . $_GET["file"];
|
||||
}else{
|
||||
$filename = "/" . $_GET["file"];
|
||||
}
|
||||
}else{
|
||||
$id = OC_Calendar_Calendar::addCalendar(OC_User::getUser(), $_POST['calname']);
|
||||
OC_Calendar_Calendar::setCalendarActive($id, 1);
|
||||
$calid = $id;
|
||||
if($_POST["path"] != ""){
|
||||
$filename = $_POST["path"] . "/" . $_POST["file"];
|
||||
}else{
|
||||
$filename = "/" . $_POST["file"];
|
||||
}
|
||||
}
|
||||
$vcalendar = OC_Filesystem::file_get_contents($filename);
|
||||
$vcalendar = explode("BEGIN:VEVENT", $vcalendar);
|
||||
for($i = 1;$i < count($vcalendar);$i++){
|
||||
$vcalendar[$i] = "BEGIN:VEVENT" . $vcalendar[$i];
|
||||
}
|
||||
for($i = 1;$i < count($vcalendar) - 1;$i++){
|
||||
$vcalendar[$i] = $vcalendar[$i] . "END:VCALENDAR";
|
||||
}
|
||||
for($i = 1;$i < count($vcalendar);$i++){
|
||||
$vcalendar[$i] = $vcalendar[0] . $vcalendar[$i];
|
||||
}
|
||||
for($i = 1;$i < count($vcalendar);$i++){
|
||||
OC_Calendar_Object::add($calid, $vcalendar[$i]);
|
||||
}
|
||||
OC_JSON::success();
|
||||
?>
|
||||
|
|
@ -1,35 +1,24 @@
|
|||
<?php
|
||||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Georg Ehrke *
|
||||
* author: Georg Ehrke *
|
||||
* email: ownclouddev at georgswebsite dot de *
|
||||
* homepage: ownclouddev.georgswebsite.de *
|
||||
* manual: ownclouddev.georgswebsite.de/manual *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* <http://ownclouddev.georgswebsite.de/license/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
require_once ("../../lib/base.php");
|
||||
if(!OC_USER::isLoggedIn()) {
|
||||
header("Location: " . OC_HELPER::linkTo("", "index.php"));
|
||||
exit;
|
||||
}
|
||||
/**
|
||||
* 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');
|
||||
OC_Util::checkLoggedIn();
|
||||
OC_Util::checkAppEnabled('calendar');
|
||||
// Create default calendar ...
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
||||
if( count($calendars) == 0){
|
||||
OC_Calendar_Calendar::addCalendar(OC_User::getUser(),'default','Default calendar');
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
||||
}
|
||||
OC_UTIL::addScript("calendar", "calendar");
|
||||
OC_UTIL::addStyle("calendar", "style");
|
||||
OC_APP::setActiveNavigationEntry("calendar_index");
|
||||
$output = new OC_TEMPLATE("calendar", "calendar", "user");
|
||||
OC_UTIL::addScript('calendar', 'calendar');
|
||||
OC_UTIL::addStyle('calendar', 'style');
|
||||
OC_UTIL::addScript('', 'jquery.multiselect');
|
||||
OC_UTIL::addStyle('', 'jquery.multiselect');
|
||||
OC_APP::setActiveNavigationEntry('calendar_index');
|
||||
$output = new OC_TEMPLATE('calendar', 'calendar', 'user');
|
||||
$output -> printPage();
|
||||
|
|
|
|||
|
|
@ -1,46 +1,15 @@
|
|||
/*************************************************
|
||||
* ownCloud - Calendar Plugin *
|
||||
* *
|
||||
* (c) Copyright 2011 Georg Ehrke *
|
||||
* (c) Copyright 2011 Bart Visscher *
|
||||
* author: Georg Ehrke *
|
||||
* email: ownclouddev at georgswebsite dot de *
|
||||
* homepage: ownclouddev.georgswebsite.de *
|
||||
* manual: ownclouddev.georgswebsite.de/manual *
|
||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
||||
* *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* If you are not able to view the License, *
|
||||
* <http://www.gnu.org/licenses/> *
|
||||
* <http://ownclouddev.georgswebsite.de/license/> *
|
||||
* please write to the Free Software Foundation. *
|
||||
* Address: *
|
||||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
**************************************************
|
||||
* list of all fx *
|
||||
* calw - Calendarweek *
|
||||
* doy - Day of the year *
|
||||
* checkforleapyear - check for a leap year *
|
||||
* forward_day - switching one day forward *
|
||||
* forward_week - switching one week forward *
|
||||
* forward_month - switching one month forward *
|
||||
* backward_day - switching one day backward *
|
||||
* backward_week - switching one week backward *
|
||||
* backward_month - switching one month backward *
|
||||
* update_view - update the view of the calendar *
|
||||
* onedayview - one day view *
|
||||
* oneweekview - one week view *
|
||||
* fourweekview - four Weeks view *
|
||||
* onemonthview - one Month view *
|
||||
* listview - listview *
|
||||
* generateDates - generate other days for view *
|
||||
* switch2today - switching to today *
|
||||
* removeEvents - remove old events in view *
|
||||
* loadEvents - load the events *
|
||||
*************************************************/
|
||||
/**
|
||||
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
|
||||
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
Calendar={
|
||||
space:' ',
|
||||
firstdayofweek: '',
|
||||
weekend: '',
|
||||
Date:{
|
||||
normal_year_cal: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
||||
leap_year_cal: [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
||||
|
|
@ -112,7 +81,7 @@ Calendar={
|
|||
|
||||
},
|
||||
UI:{
|
||||
weekdays: ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"],
|
||||
weekdays: '',
|
||||
formatDayShort:function(day){
|
||||
if (typeof(day) == 'undefined'){
|
||||
day = Calendar.Date.current.getDay();
|
||||
|
|
@ -157,7 +126,7 @@ Calendar={
|
|||
$('#'+this.currentview + "_radio").removeClass('active');
|
||||
this.currentview = view;
|
||||
//sending ajax request on every change view
|
||||
$("#sysbox").load(oc_webroot + "/apps/calendar/ajax/changeview.php?v="+view);
|
||||
$("#sysbox").load(OC.filePath('calendar', 'ajax', 'changeview.php') + "?v="+view);
|
||||
//not necessary to check whether the response is true or not
|
||||
switch(view) {
|
||||
case "onedayview":
|
||||
|
|
@ -186,6 +155,7 @@ Calendar={
|
|||
Calendar.UI.updateView()
|
||||
});
|
||||
},
|
||||
drageventid: '',
|
||||
updateDate:function(direction){
|
||||
if(direction == 'forward' && this.current.forward) {
|
||||
this.current.forward();
|
||||
|
|
@ -211,24 +181,26 @@ Calendar={
|
|||
if( typeof (this.events[year]) == "undefined") {
|
||||
this.events[year] = []
|
||||
}
|
||||
$.getJSON(oc_webroot + "/apps/calendar/ajax/getcal.php?year=" + year, function(newevents, status) {
|
||||
$.getJSON(OC.filePath('calendar', 'ajax', 'getcal.php') + "?year=" + year, function(jsondata, status) {
|
||||
if(status == "nosession") {
|
||||
alert("You are not logged in. That can happen if you don't use owncloud for a long time.");
|
||||
document.location(oc_webroot);
|
||||
}
|
||||
if(status == "parsingfail" || typeof (newevents) == "undefined") {
|
||||
if(status == "parsingfail" || typeof (jsondata) == "undefined") {
|
||||
$.ready(function() {
|
||||
$( "#parsingfail_dialog" ).dialog();
|
||||
});
|
||||
} else {
|
||||
if (typeof(newevents[year]) != 'undefined'){
|
||||
Calendar.UI.events[year] = newevents[year];
|
||||
if (typeof(jsondata[year]) != 'undefined'){
|
||||
Calendar.UI.calendars = jsondata['calendars'];
|
||||
Calendar.UI.events[year] = jsondata[year];
|
||||
}
|
||||
$(document).ready(function() {
|
||||
Calendar.UI.updateView();
|
||||
});
|
||||
}
|
||||
});
|
||||
window.setTimeout("Calendar.UI.loadEvents(" + year + ")", 120000);
|
||||
},
|
||||
getEventsForDate:function(date){
|
||||
var day = date.getDate();
|
||||
|
|
@ -251,7 +223,7 @@ Calendar={
|
|||
if (!events) {
|
||||
return;
|
||||
}
|
||||
var weekday = (date.getDay()+6)%7;
|
||||
var weekday = (date.getDay()+7-Calendar.firstdayofweek)%7;
|
||||
if( typeof (events["allday"]) != "undefined") {
|
||||
var eventnumber = 1;
|
||||
var eventcontainer = this.current.getEventContainer(week, weekday, "allday");
|
||||
|
|
@ -277,7 +249,17 @@ Calendar={
|
|||
.data('event_info', event)
|
||||
.hover(this.createEventPopup,
|
||||
this.hideEventPopup)
|
||||
.draggable({
|
||||
drag: function() {
|
||||
Calendar.UI.drageventid = event.id;
|
||||
}
|
||||
})
|
||||
.click(this.editEvent);
|
||||
var color = this.calendars[event['calendarid']]['color'];
|
||||
if (color){
|
||||
event_holder.css('background-color', color)
|
||||
.addClass('colored');
|
||||
}
|
||||
eventcontainer.append(event_holder);
|
||||
},
|
||||
startEventDialog:function(){
|
||||
|
|
@ -288,6 +270,13 @@ Calendar={
|
|||
$( "#to" ).datepicker({
|
||||
dateFormat : 'dd-mm-yy'
|
||||
});
|
||||
$('#category').multiselect({
|
||||
header: false,
|
||||
noneSelectedText: $('#category').attr('title'),
|
||||
selectedList: 2,
|
||||
minWidth:'auto',
|
||||
classes: 'category',
|
||||
});
|
||||
$('#event').dialog({
|
||||
width : 500,
|
||||
close : function(event, ui) {
|
||||
|
|
@ -312,7 +301,7 @@ Calendar={
|
|||
// TODO: save event
|
||||
$('#event').dialog('destroy').remove();
|
||||
}else{
|
||||
$('#dialog_holder').load(oc_webroot + '/apps/calendar/ajax/neweventform.php?d=' + date + '&t=' + time, Calendar.UI.startEventDialog);
|
||||
$('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'neweventform.php') + '?d=' + date + '&t=' + time, Calendar.UI.startEventDialog);
|
||||
}
|
||||
},
|
||||
editEvent:function(event){
|
||||
|
|
@ -323,12 +312,25 @@ Calendar={
|
|||
// TODO: save event
|
||||
$('#event').dialog('destroy').remove();
|
||||
}else{
|
||||
$('#dialog_holder').load(oc_webroot + '/apps/calendar/ajax/editeventform.php?id=' + id, Calendar.UI.startEventDialog);
|
||||
$('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'editeventform.php') + '?id=' + id, Calendar.UI.startEventDialog);
|
||||
}
|
||||
},
|
||||
submitDeleteEventForm:function(url){
|
||||
var post = $( "#event_form" ).serialize();
|
||||
$("#errorbox").empty();
|
||||
$.post(url, post, function(data){
|
||||
if(data.status == 'success'){
|
||||
$('#event').dialog('destroy').remove();
|
||||
Calendar.UI.loadEvents();
|
||||
} else {
|
||||
$("#errorbox").html("Deletion failed");
|
||||
}
|
||||
|
||||
}, "json");
|
||||
},
|
||||
validateEventForm:function(url){
|
||||
var post = $( "#event_form" ).serialize();
|
||||
$("#errorbox").html("");
|
||||
$("#errorbox").empty();
|
||||
$.post(url, post,
|
||||
function(data){
|
||||
if(data.status == "error"){
|
||||
|
|
@ -365,6 +367,16 @@ Calendar={
|
|||
}
|
||||
},"json");
|
||||
},
|
||||
moveevent:function(eventid, newstartdate){
|
||||
$.post(OC.filePath('calendar', 'ajax', 'moveevent.php'), { id: eventid, newdate: newstartdate},
|
||||
function(data) {
|
||||
console.log("Event moved successfully");
|
||||
});
|
||||
},
|
||||
showadvancedoptions:function(){
|
||||
$("#advanced_options").css("display", "block");
|
||||
$("#advanced_options_button").css("display", "none");
|
||||
},
|
||||
createEventPopup:function(e){
|
||||
var popup = $(this).data('popup');
|
||||
if (!popup){
|
||||
|
|
@ -429,12 +441,25 @@ Calendar={
|
|||
$('#caldav_url').show();
|
||||
$("#caldav_url_close").show();
|
||||
},
|
||||
deleteCalendar:function(calid){
|
||||
var check = confirm("Do you really want to delete this calendar?");
|
||||
if(check == false){
|
||||
return false;
|
||||
}else{
|
||||
$.post(OC.filePath('calendar', 'ajax', 'deletecalendar.php'), { calendarid: calid},
|
||||
function(data) {
|
||||
Calendar.UI.loadEvents();
|
||||
$('#choosecalendar_dialog').dialog('destroy').remove();
|
||||
Calendar.UI.Calendar.overview();
|
||||
});
|
||||
}
|
||||
},
|
||||
Calendar:{
|
||||
overview:function(){
|
||||
if($('#choosecalendar_dialog').dialog('isOpen') == true){
|
||||
$('#choosecalendar_dialog').dialog('moveToTop');
|
||||
}else{
|
||||
$('#dialog_holder').load(oc_webroot + '/apps/calendar/ajax/choosecalendar.php', function(){
|
||||
$('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'choosecalendar.php'), function(){
|
||||
$('#choosecalendar_dialog').dialog({
|
||||
width : 600,
|
||||
close : function(event, ui) {
|
||||
|
|
@ -446,25 +471,52 @@ Calendar={
|
|||
},
|
||||
activation:function(checkbox, calendarid)
|
||||
{
|
||||
$.post(oc_webroot + "/apps/calendar/ajax/activation.php", { calendarid: calendarid, active: checkbox.checked?1:0 },
|
||||
$.post(OC.filePath('calendar', 'ajax', 'activation.php'), { calendarid: calendarid, active: checkbox.checked?1:0 },
|
||||
function(data) {
|
||||
checkbox.checked = data == 1;
|
||||
Calendar.UI.loadEvents();
|
||||
});
|
||||
},
|
||||
new:function(object){
|
||||
newCalendar:function(object){
|
||||
var tr = $(document.createElement('tr'))
|
||||
.load(oc_webroot + "/apps/calendar/ajax/newcalendar.php");
|
||||
.load(OC.filePath('calendar', 'ajax', 'newcalendar.php'));
|
||||
$(object).closest('tr').after(tr).hide();
|
||||
},
|
||||
edit:function(object, calendarid){
|
||||
var tr = $(document.createElement('tr'))
|
||||
.load(oc_webroot + "/apps/calendar/ajax/editcalendar.php?calendarid="+calendarid);
|
||||
.load(OC.filePath('calendar', 'ajax', 'editcalendar.php') + "?calendarid="+calendarid,
|
||||
function(){Calendar.UI.Calendar.colorPicker(this)});
|
||||
$(object).closest('tr').after(tr).hide();
|
||||
},
|
||||
colorPicker:function(container){
|
||||
// based on jquery-colorpicker at jquery.webspirited.com
|
||||
var obj = $('.colorpicker', container);
|
||||
var picker = $('<div class="calendar-colorpicker"></div>');
|
||||
//build an array of colors
|
||||
var colors = {};
|
||||
$(obj).children('option').each(function(i, elm) {
|
||||
colors[i] = {};
|
||||
colors[i].color = $(elm).val();
|
||||
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.delegate(".calendar-colorpicker-color", "click", function() {
|
||||
$(obj).val($(this).attr('rel'));
|
||||
$(obj).change();
|
||||
picker.children('.calendar-colorpicker-color.active').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
});
|
||||
$(obj).after(picker);
|
||||
$(obj).css({
|
||||
position: 'absolute',
|
||||
left: -10000
|
||||
});
|
||||
},
|
||||
submit:function(button, calendarid){
|
||||
var displayname = $("#displayname_"+calendarid).val();
|
||||
var active = $("#active_"+calendarid+":checked").length;
|
||||
var active = $("#edit_active_"+calendarid+":checked").length;
|
||||
var description = $("#description_"+calendarid).val();
|
||||
var calendarcolor = $("#calendarcolor_"+calendarid).val();
|
||||
|
||||
|
|
@ -486,7 +538,7 @@ Calendar={
|
|||
cancel:function(button, calendarid){
|
||||
$(button).closest('tr').prev().show().next().remove();
|
||||
},
|
||||
},
|
||||
},/*
|
||||
OneDay:{
|
||||
forward:function(){
|
||||
Calendar.Date.forward_day();
|
||||
|
|
@ -495,7 +547,7 @@ Calendar={
|
|||
Calendar.Date.backward_day();
|
||||
},
|
||||
removeEvents:function(){
|
||||
$("#onedayview .calendar_row").html("");
|
||||
$("#onedayview .calendar_row").empty();
|
||||
},
|
||||
renderCal:function(){
|
||||
$("#datecontrol_date").val(Calendar.UI.formatDayShort() + Calendar.space + Calendar.Date.current.getDate() + Calendar.space + Calendar.UI.formatMonthShort() + Calendar.space + Calendar.Date.current.getFullYear());
|
||||
|
|
@ -516,7 +568,7 @@ Calendar={
|
|||
return $(document.createElement('p'))
|
||||
.html(time + event['description'])
|
||||
},
|
||||
},
|
||||
},*/
|
||||
OneWeek:{
|
||||
forward:function(){
|
||||
Calendar.Date.forward_week();
|
||||
|
|
@ -526,7 +578,7 @@ Calendar={
|
|||
},
|
||||
removeEvents:function(){
|
||||
for( i = 0; i <= 6; i++) {
|
||||
$("#oneweekview ." + Calendar.UI.weekdays[i]).html("");
|
||||
$("#oneweekview ." + Calendar.UI.weekdays[i]).empty();
|
||||
}
|
||||
$("#oneweekview .thisday").removeClass("thisday");
|
||||
},
|
||||
|
|
@ -535,7 +587,23 @@ Calendar={
|
|||
var dates = this.generateDates();
|
||||
var today = new Date();
|
||||
for(var i = 0; i <= 6; i++){
|
||||
$("#oneweekview th." + Calendar.UI.weekdays[i]).html(Calendar.UI.formatDayShort((i+1)%7) + Calendar.space + dates[i].getDate() + Calendar.space + Calendar.UI.formatMonthShort(dates[i].getMonth()));
|
||||
$("#oneweekview th." + Calendar.UI.weekdays[i]).html(Calendar.UI.formatDayShort((i+Calendar.firstdayofweek)%7) + Calendar.space + dates[i].getDate() + Calendar.space + Calendar.UI.formatMonthShort(dates[i].getMonth()));
|
||||
$("#oneweekview td." + Calendar.UI.weekdays[i] + ".allday").attr('title', dates[i].getDate() + "." + String(parseInt(dates[i].getMonth()) + 1) + "." + dates[i].getFullYear() + "-" + "allday");
|
||||
$("#oneweekview td." + Calendar.UI.weekdays[i] + ".allday").droppable({
|
||||
drop: function() {
|
||||
Calendar.UI.moveevent(Calendar.UI.drageventid, this.title);
|
||||
Calendar.UI.loadEvents();
|
||||
}
|
||||
});
|
||||
for(var ii = 0;ii <= 23; ii++){
|
||||
$("#oneweekview td." + Calendar.UI.weekdays[i] + "." + String(ii)).attr('title', dates[i].getDate() + "." + String(parseInt(dates[i].getMonth()) + 1) + "." + dates[i].getFullYear() + "-" + String(ii) + ":00");
|
||||
$("#oneweekview td." + Calendar.UI.weekdays[i] + "." + String(ii)).droppable({
|
||||
drop: function() {
|
||||
Calendar.UI.moveevent(Calendar.UI.drageventid, this.title);
|
||||
Calendar.UI.loadEvents();
|
||||
}
|
||||
});
|
||||
}
|
||||
if(dates[i].getDate() == today.getDate() && dates[i].getMonth() == today.getMonth() && dates[i].getFullYear() == today.getFullYear()){
|
||||
$("#oneweekview ." + Calendar.UI.weekdays[i]).addClass("thisday");
|
||||
}
|
||||
|
|
@ -566,14 +634,18 @@ Calendar={
|
|||
if(dayofweek == 0) {
|
||||
dayofweek = 7;
|
||||
}
|
||||
date.setDate(date.getDate() - dayofweek + 1);
|
||||
if(Calendar.firstdayofweek > dayofweek){
|
||||
date.setDate(date.getDate() - dayofweek + Calendar.firstdayofweek - 7);
|
||||
}else{
|
||||
date.setDate(date.getDate() - dayofweek + Calendar.firstdayofweek);
|
||||
}
|
||||
for(var i = 0; i <= 6; i++) {
|
||||
dates[i] = new Date(date)
|
||||
date.setDate(date.getDate() + 1);
|
||||
}
|
||||
return dates;
|
||||
},
|
||||
},
|
||||
},/*
|
||||
FourWeeks:{
|
||||
forward:function(){
|
||||
Calendar.Date.forward_week();
|
||||
|
|
@ -583,7 +655,7 @@ Calendar={
|
|||
},
|
||||
removeEvents:function(){
|
||||
$('#fourweeksview .day.thisday').removeClass('thisday');
|
||||
$('#fourweeksview .day .events').html('');
|
||||
$('#fourweeksview .day .events').empty();
|
||||
},
|
||||
renderCal:function(){
|
||||
var calw1 = Calendar.Date.calw();
|
||||
|
|
@ -670,7 +742,7 @@ Calendar={
|
|||
}
|
||||
return dates;
|
||||
},
|
||||
},
|
||||
},*/
|
||||
OneMonth:{
|
||||
forward:function(){
|
||||
Calendar.Date.forward_month();
|
||||
|
|
@ -680,7 +752,7 @@ Calendar={
|
|||
},
|
||||
removeEvents:function(){
|
||||
$('#onemonthview .day.thisday').removeClass('thisday');
|
||||
$('#onemonthview .day .events').html('');
|
||||
$('#onemonthview .day .events').empty();
|
||||
},
|
||||
renderCal:function(){
|
||||
$("#datecontrol_date").val(Calendar.UI.formatMonthLong() + Calendar.space + Calendar.Date.current.getFullYear());
|
||||
|
|
@ -708,6 +780,13 @@ Calendar={
|
|||
var month = dates[i].getMonth();
|
||||
var year = dates[i].getFullYear();
|
||||
$("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday] + " .dateinfo").html(dayofmonth + Calendar.space + Calendar.UI.formatMonthShort(month));
|
||||
$("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).attr('title', dayofmonth + "." + String(parseInt(month) + 1) + "." + year);
|
||||
$("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).droppable({
|
||||
drop: function() {
|
||||
Calendar.UI.moveevent(Calendar.UI.drageventid, this.title);
|
||||
Calendar.UI.loadEvents();
|
||||
}
|
||||
});
|
||||
if(dayofmonth == today.getDate() && month == today.getMonth() && year == today.getFullYear()){
|
||||
$("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).addClass('thisday');
|
||||
}
|
||||
|
|
@ -772,7 +851,11 @@ Calendar={
|
|||
dayofweek = 7;
|
||||
this.rows++;
|
||||
}
|
||||
date.setDate(date.getDate() - dayofweek + 1);
|
||||
if(Calendar.firstdayofweek > dayofweek){
|
||||
date.setDate(date.getDate() - dayofweek + Calendar.firstdayofweek - 7);
|
||||
}else{
|
||||
date.setDate(date.getDate() - dayofweek + Calendar.firstdayofweek);
|
||||
}
|
||||
for(var i = 0; i <= 41; i++) {
|
||||
dates[i] = new Date(date)
|
||||
date.setDate(date.getDate() + 1);
|
||||
|
|
@ -782,7 +865,7 @@ Calendar={
|
|||
},
|
||||
List:{
|
||||
removeEvents:function(){
|
||||
this.eventContainer = $('#listview #events').html('');
|
||||
this.eventContainer = $('#listview #events').empty();
|
||||
this.startdate = new Date();
|
||||
this.enddate = new Date();
|
||||
this.enddate.setDate(this.enddate.getDate());
|
||||
|
|
|
|||
16
apps/calendar/js/loader.js
Normal file
16
apps/calendar/js/loader.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
function importdialog(directory, filename){
|
||||
$("body").append("<div id=\"importdialogholder\"></div>");
|
||||
$("#importdialogholder").load(OC.filePath('calendar', 'ajax', 'importdialog.php?filename=' + filename + '&path=' + directory));
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$('tr[data-file$=".ics"]').attr("data-mime", "text/calendar");
|
||||
$('tr[data-file$=".vcs"]').attr("data-mime", "text/calendar");
|
||||
$('tr[data-file$=".ical"]').attr("data-mime", "text/calendar");
|
||||
if(typeof FileActions!=='undefined'){
|
||||
FileActions.register('text/calendar','Import to Calendar','',function(filename){
|
||||
importdialog($('#dir').val(),filename);
|
||||
});
|
||||
FileActions.setDefault('text/calendar','Import to Calendar');
|
||||
}
|
||||
});
|
||||
|
|
@ -3,9 +3,61 @@ $(document).ready(function(){
|
|||
OC.msg.startSaving('#calendar .msg')
|
||||
// Serialize the data
|
||||
var post = $( "#timezone" ).serialize();
|
||||
$.post( oc_webroot + '/apps/calendar/ajax/settimezone.php', post, function(data){
|
||||
OC.msg.finishedSaving('#calendar .msg', data);
|
||||
$.post( OC.filePath('calendar', 'ajax', 'settimezone.php'), post, function(data){
|
||||
//OC.msg.finishedSaving('#calendar .msg', data);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$("#timezone").chosen();
|
||||
$("#firstdayofweek").change( function(){
|
||||
var data = $("#firstdayofweek").serialize();
|
||||
$.post( OC.filePath('calendar', 'ajax', 'setfirstdayofweek.php'), data, function(data){
|
||||
if(data == "error"){
|
||||
console.log("saving first day of week failed");
|
||||
}
|
||||
});
|
||||
});
|
||||
$.getJSON(OC.filePath('calendar', 'ajax', 'firstdayofweek.php'), function(jsondata, status) {
|
||||
$("#select_" + jsondata.firstdayofweek).attr('selected',true);
|
||||
$("#firstdayofweek").chosen();
|
||||
});
|
||||
$.getJSON(OC.filePath('calendar', 'ajax', 'daysofweekend.php'), function(jsondata, status) {
|
||||
for(day in jsondata){
|
||||
if(jsondata[day] == "true"){
|
||||
$("#selectweekend_" + day).attr('selected',true);
|
||||
}
|
||||
}
|
||||
$("#weekend").chosen();
|
||||
});
|
||||
$("#timeformat").change( function(){
|
||||
var data = $("#timeformat").serialize();
|
||||
$.post( OC.filePath('calendar', 'ajax', 'settimeformat.php'), data, function(data){
|
||||
if(data == "error"){
|
||||
console.log("saving timeformat failed");
|
||||
}
|
||||
});
|
||||
});
|
||||
$.getJSON(OC.filePath('calendar', 'ajax', 'timeformat.php'), function(jsondata, status) {
|
||||
$("#" + jsondata.timeformat).attr('selected',true);
|
||||
$("#timeformat").chosen();
|
||||
});
|
||||
$("#duration").blur( function(){
|
||||
var data = $("#duration").val();
|
||||
$.post( OC.filePath('calendar', 'ajax', 'setduration.php'), {duration: data}, function(data){
|
||||
if(data == "error"){
|
||||
console.log("saving duration failed");
|
||||
}
|
||||
});
|
||||
});
|
||||
$.getJSON(OC.filePath('calendar', 'ajax', 'duration.php'), function(jsondata, status) {
|
||||
$("#duration").val(jsondata.duration);
|
||||
});
|
||||
$("#weekend").change( function(){
|
||||
var data = $("#weekend").serialize();
|
||||
$.post( OC.filePath('calendar', 'ajax', 'setdaysofweekend.php'), data, function(data){
|
||||
if(data == "error"){
|
||||
console.log("saving days of weekend failed");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue