Merge branch 'master' into fullcalendar

This commit is contained in:
Georg Ehrke 2011-11-12 15:09:37 +01:00
commit e5a3ab8aad
70 changed files with 680 additions and 267 deletions

3
.gitignore vendored
View File

@ -40,3 +40,6 @@ nbproject
# Mac OS
.DS_Store
# WebFinger
.well-known

View File

@ -4,8 +4,6 @@ php_value upload_max_filesize 512M
php_value post_max_size 512M
SetEnv htaccessWorking true
</IfModule>
<IfModule !mod_php5.c>
RewriteEngine on
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last]
</IfModule>
Options -Indexes

View File

@ -71,6 +71,7 @@ include 'Sabre/DAV/IExtendedCollection.php';
/* Node abstract implementations */
include 'Sabre/DAV/Node.php';
include 'Sabre/DAV/File.php';
include 'Sabre/DAV/Collection.php';
include 'Sabre/DAV/Directory.php';
/* Utilities */
@ -124,4 +125,3 @@ include 'Sabre/DAV/Auth/Backend/PDO.php';
/* DavMount plugin */
include 'Sabre/DAV/Mount/Plugin.php';

View File

@ -1,7 +1,9 @@
<?php
/**
* UserAddressBook class
* The AddressBook class represents a CardDAV addressbook, owned by a specific user
*
* The AddressBook can contain multiple vcards
*
* @package Sabre
* @subpackage CardDAV
@ -9,12 +11,6 @@
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
/**
* The AddressBook class represents a CardDAV addressbook, owned by a specific user
*
* The AddressBook can contain multiple vcards
*/
class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_CardDAV_IAddressBook, Sabre_DAV_IProperties, Sabre_DAVACL_IACL {
/**

View File

@ -2,6 +2,12 @@
/**
* Abstract Backend class
*
* This class serves as a base-class for addressbook backends
*
* Note that there are references to 'addressBookId' scattered throughout the
* class. The value of the addressBookId is completely up to you, it can be any
* arbitrary value you can use as an unique identifier.
*
* @package Sabre
* @subpackage CardDAV
@ -9,14 +15,6 @@
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
/**
* This class serves as a base-class for addressbook backends
*
* Note that there are references to 'addressBookId' scattered throughout the
* class. The value of the addressBookId is completely up to you, it can be any
* arbitrary value you can use as an unique identifier.
*/
abstract class Sabre_CardDAV_Backend_Abstract {
/**

View File

@ -2,6 +2,8 @@
/**
* PDO CardDAV backend
*
* This CardDAV backend uses PDO to store addressbooks
*
* @package Sabre
* @subpackage CardDAV
@ -9,10 +11,6 @@
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
/**
* This CardDAV backend uses PDO to store addressbooks
*/
class Sabre_CardDAV_Backend_PDO extends Sabre_CardDAV_Backend_Abstract {
/**

View File

@ -1,18 +1,14 @@
<?php
/**
* Card class
* The Card object represents a single Card from an addressbook
*
* @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
*
/
/**
* The Card object represents a single Card from an addressbook
*/
*/
class Sabre_CardDAV_Card extends Sabre_DAV_File implements Sabre_CardDAV_ICard, Sabre_DAVACL_IACL {
/**

View File

@ -2,18 +2,16 @@
/**
* Card interface
*
* Extend the ICard interface to allow your custom nodes to be picked up as
* 'Cards'.
*
* @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
*
/
/**
* Extend the ICard interface to allow your custom nodes to be picked up as
* 'Cards'.
*/
*/
interface Sabre_CardDAV_ICard extends Sabre_DAV_IFile {
}

View File

@ -1,7 +1,9 @@
<?php
/**
* CardDAV plugin
* CardDAV plugin
*
* The CardDAV plugin adds CardDAV functionality to the WebDAV server
*
* @package Sabre
* @subpackage CardDAV
@ -9,11 +11,6 @@
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
/**
* The CardDAV plugin adds CardDAV functionality to the WebDAV server
*/
class Sabre_CardDAV_Plugin extends Sabre_DAV_ServerPlugin {
/**

View File

@ -2,17 +2,15 @@
/**
* UserAddressBooks class
*
*
* The UserAddressBooks collection contains a list of addressbooks associated with a user
*
* @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
*/
/**
* The UserAddressBooks collection contains a list of addressbooks associated with a user
*/
class Sabre_CardDAV_UserAddressBooks extends Sabre_DAV_Collection implements Sabre_DAV_IExtendedCollection, Sabre_DAVACL_IACL {
/**

View File

@ -2,6 +2,8 @@
/**
* Version Class
*
* This class contains the Sabre_CardDAV version information
*
* @package Sabre
* @subpackage CardDAV
@ -9,10 +11,6 @@
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
/**
* This class contains the Sabre_CardDAV version information
*/
class Sabre_CardDAV_Version {
/**

View File

@ -88,7 +88,7 @@ class Sabre_DAV_Browser_GuessContentType extends Sabre_DAV_ServerPlugin {
protected function getContentType($fileName) {
// Just grabbing the extension
$extension = substr($fileName,strrpos($fileName,'.')+1);
$extension = strtolower(substr($fileName,strrpos($fileName,'.')+1));
if (isset($this->extensionMap[$extension]))
return $this->extensionMap[$extension];

View File

@ -821,7 +821,7 @@ class Sabre_DAV_Server {
$node->put($body);
$this->httpResponse->setHeader('Content-Length','0');
$this->httpResponse->sendStatus(200);
$this->httpResponse->sendStatus(204);
} else {

View File

@ -14,7 +14,7 @@ class Sabre_DAV_Version {
/**
* Full version number
*/
const VERSION = '1.5.3';
const VERSION = '1.5.4';
/**
* Stability : alpha, beta, stable

View File

@ -2,6 +2,9 @@
/**
* NeedPrivileges
*
* The 403-need privileges is thrown when a user didn't have the appropriate
* permissions to perform an operation
*
* @package Sabre
* @subpackage DAVACL
@ -10,13 +13,6 @@
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
/**
* NeedPrivileges
*
* The 403-need privileges is thrown when a user didn't have the appropriate
* permissions to perform an operation
*/
class Sabre_DAVACL_Exception_NeedPrivileges extends Sabre_DAV_Exception_Forbidden {
/**

View File

@ -9,7 +9,7 @@
* The users are instances of Sabre_DAV_Auth_Principal
*
* @package Sabre
* @subpackage DAV
* @subpackage DAVACL
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License

View File

@ -83,13 +83,16 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
if (!is_null($itemValue)) {
throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject');
}
$item->parent = $this;
$this->children[] = $item;
} elseif(is_string($item)) {
if (!is_scalar($itemValue)) {
throw new InvalidArgumentException('The second argument must be scalar');
}
$this->children[] = new Sabre_VObject_Property($item,$itemValue);
$item = new Sabre_VObject_Property($item,$itemValue);
$item->parent = $this;
$this->children[] = $item;
} else {
@ -208,16 +211,19 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
$overWrite = count($matches)?key($matches):null;
if ($value instanceof Sabre_VObject_Component || $value instanceof Sabre_VObject_Property) {
$value->parent = $this;
if (!is_null($overWrite)) {
$this->children[$overWrite] = $value;
} else {
$this->children[] = $value;
}
} elseif (is_scalar($value)) {
$property = new Sabre_VObject_Property($name,$value);
$property->parent = $this;
if (!is_null($overWrite)) {
$this->children[$overWrite] = new Sabre_VObject_Property($name,$value);
$this->children[$overWrite] = $property;
} else {
$this->children[] = new Sabre_VObject_Property($name,$value);
$this->children[] = $property;
}
} else {
throw new InvalidArgumentException('You must pass a Sabre_VObject_Component, Sabre_VObject_Property or scalar type');
@ -237,6 +243,7 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
foreach($matches as $k=>$child) {
unset($this->children[$k]);
$child->parent = null;
}

View File

@ -70,7 +70,7 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
$this->setValue($dt->format('Ymd\\THis'));
$this->offsetUnset('VALUE');
$this->offsetUnset('TZID');
$this->offsetSet('VALUE','DATE-TIME');
$this->offsetSet('VALUE','DATE-TIME');
break;
case self::UTC :
$dt->setTimeZone(new DateTimeZone('UTC'));
@ -116,7 +116,7 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
list(
$this->dateType,
$this->dateTime
) = self::parseData($this->value, $this->offsetGet('TZID'));
) = self::parseData($this->value, $this);
return $this->dateTime;
}
@ -137,7 +137,7 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
list(
$this->dateType,
$this->dateTime,
) = self::parseData($this->value, $this->offsetGet('TZID'));
) = self::parseData($this->value, $this);
return $this->dateType;
}
@ -151,12 +151,12 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
* 2. A DateTime object (or null)
*
* @param string|null $propertyValue The string to parse (yymmdd or
* ymmddThhmmss, etc..)
* @param string|null $tzid The value of the 'TZID' property.
* ymmddThhmmss, etc..)
* @param Sabre_VObject_Property|null $property The instance of the
* property we're parsing.
* @return array
*/
static public function parseData($propertyValue, $tzid) {
static public function parseData($propertyValue, Sabre_VObject_Property $property = null) {
if (is_null($propertyValue)) {
return array(null, null);
@ -195,6 +195,8 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
);
}
// Finding the timezone.
$tzid = $property['TZID'];
if (!$tzid) {
return array(
self::LOCAL,
@ -202,7 +204,32 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
);
}
$tz = new DateTimeZone($tzid->value);
try {
$tz = new DateTimeZone($tzid->value);
} catch (Exception $e) {
// The id was invalid, we're going to try to find the information
// through the VTIMEZONE object.
// First we find the root object
$root = $property;
while($root->parent) {
$root = $root->parent;
}
if (isset($root->VTIMEZONE)) {
foreach($root->VTIMEZONE as $vtimezone) {
if (((string)$vtimezone->TZID) == $tzid) {
if (isset($vtimezone->{'X-LIC-LOCATION'})) {
$tzid = (string)$vtimezone->{'X-LIC-LOCATION'};
}
}
}
}
$tz = new DateTimeZone($tzid);
}
$dt = new DateTime($dateStr, $tz);
$dt->setTimeZone($tz);

View File

@ -60,7 +60,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
$val[] = $i->format('Ymd\\THis');
}
$this->setValue(implode(',',$val));
$this->offsetSet('VALUE','DATE-TIME');
$this->offsetSet('VALUE','DATE-TIME');
break;
case Sabre_VObject_Element_DateTime::UTC :
$val = array();
@ -121,7 +121,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
list(
$type,
$dt
) = Sabre_VObject_Element_DateTime::parseData($val, $this->offsetGet('TZID'));
) = Sabre_VObject_Element_DateTime::parseData($val, $this);
$dts[] = $dt;
$this->dateType = $type;
}
@ -154,7 +154,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
list(
$type,
$dt
) = Sabre_VObject_Element_DateTime::parseData($val, $this->offsetGet('TZID'));
) = Sabre_VObject_Element_DateTime::parseData($val, $this);
$dts[] = $dt;
$this->dateType = $type;
}

View File

@ -25,6 +25,13 @@ abstract class Sabre_VObject_Node implements IteratorAggregate, ArrayAccess, Cou
*/
protected $iterator = null;
/**
* A link to the parent node
*
* @var Sabre_VObject_Node
*/
protected $parent = null;
/* {{{ IteratorAggregator interface */
/**

View File

@ -149,13 +149,16 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
if (!is_null($itemValue)) {
throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject');
}
$item->parent = $this;
$this->parameters[] = $item;
} elseif(is_string($item)) {
if (!is_scalar($itemValue)) {
throw new InvalidArgumentException('The second argument must be scalar');
}
$this->parameters[] = new Sabre_VObject_Parameter($item,$itemValue);
$parameter = new Sabre_VObject_Parameter($item,$itemValue);
$parameter->parent = $this;
$this->parameters[] = $parameter;
} else {
@ -231,12 +234,15 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
throw new InvalidArgumentException('A parameter name must be specified. This means you cannot use the $array[]="string" to add parameters.');
$this->offsetUnset($name);
$this->parameters[] = new Sabre_VObject_Parameter($name, $value);
$parameter = new Sabre_VObject_Parameter($name, $value);
$parameter->parent = $this;
$this->parameters[] = $parameter;
} elseif ($value instanceof Sabre_VObject_Parameter) {
if (!is_null($name))
throw new InvalidArgumentException('Don\'t specify a parameter name if you\'re passing a Sabre_VObject_Parameter. Add using $array[]=$parameterObject.');
$value->parent = $this;
$this->parameters[] = $value;
} else {
throw new InvalidArgumentException('You can only add parameters to the property object');
@ -258,6 +264,7 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
$result = array();
foreach($this->parameters as $key=>$parameter) {
if ($parameter->name == $name) {
$parameter->parent = null;
unset($this->parameters[$key]);
}

View File

@ -95,7 +95,7 @@ class Sabre_VObject_Reader {
while(stripos($nextLine,"END:")!==0) {
$obj->children[] = self::readLine($lines);
$obj->add(self::readLine($lines));
$nextLine = current($lines);
if ($nextLine===false)
@ -140,7 +140,9 @@ class Sabre_VObject_Reader {
if ($matches['parameters']) {
$obj->parameters = self::readParameters($matches['parameters']);
foreach(self::readParameters($matches['parameters']) as $param) {
$obj->add($param);
}
}
return $obj;

View File

@ -14,7 +14,7 @@ class Sabre_VObject_Version {
/**
* Full version number
*/
const VERSION = '1.2.2';
const VERSION = '1.2.4';
/**
* Stability : alpha, beta, stable

View File

@ -0,0 +1,9 @@
<?php
$l=new OC_L10N('admin_dependencies_chk');
OC_App::register( array(
'order' => 14,
'id' => 'admin_dependencies_chk',
'name' => 'Owncloud Install Info' ));
OC_APP::registerAdmin('admin_dependencies_chk','settings');

View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<info>
<id>admin_dependencies_chk</id>
<name>Owncloud dependencies info</name>
<version>0.01</version>
<licence>AGPL</licence>
<author>Brice Maron (eMerzh)</author>
<require>2</require>
<description>Display OwnCloud's dependencies informations (missings modules, ...)</description>
<default_enable/>
</info>

View File

@ -0,0 +1,9 @@
#status_list legend { font-weight: bold; color: #888888; }
.state > li { margin-bottom: 3px; padding-left: 0.5em; list-style-type: circle; }
.state .state_module { font-weight:bold; text-shadow: 0 1px 0 #DDD; cursor:help;}
.state_used ul, .state_used li { display:inline; }
.state_ok .state_module { color: #009700; }
.state_warning .state_module { color: #FF9B29; }
.state_error .state_module { color: #FF3B3B; }

View File

@ -0,0 +1,96 @@
<?php
/**
* ownCloud - user_ldap
*
* @author Brice Maron
* @copyright 2011 Brice Maron brice __from__ bmaron _DOT_ net
*
* 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/>.
*
*/
$l=new OC_L10N('admin_dependencies_chk');
$tmpl = new OC_Template( 'admin_dependencies_chk', 'settings');
$modules = array();
//Possible status are : ok, error, warning
$modules[] =array(
'status' => function_exists('json_encode') ? 'ok' : 'error',
'part'=> 'php-json',
'modules'=> array('core'),
'message'=> $l->t('The php-json module is needed by the many applications for inter communications'));
$modules[] =array(
'status' => function_exists('curl_init') ? 'ok' : 'error',
'part'=> 'php-curl',
'modules'=> array('bookmarks'),
'message'=> $l->t('The php-curl modude is needed to fetch the page title when adding a bookmarks'));
$modules[] =array(
'status' => function_exists('imagepng') ? 'ok' : 'error',
'part'=> 'php-gd',
'modules'=> array('gallery'),
'message'=> $l->t('The php-gd module is needed to create thumbnails of your images'));
$modules[] =array(
'status' => OC_Helper::canExecute("mp3info") ? 'ok' : 'warning',
'part'=> 'mp3info',
'modules'=> array('media'),
'message'=> $l->t('The program mp3info is useful to discover ID3 tags of your music files'));
$modules[] =array(
'status' => OC_Helper::canExecute("ldap_bind") ? 'ok' : 'error',
'part'=> 'php-ldap',
'modules'=> array('user_ldap'),
'message'=> $l->t('The php-ldap module is needed connect to your ldap server'));
$modules[] =array(
'status' => class_exists('ZipArchive') ? 'ok' : 'warning',
'part'=> 'php-zip',
'modules'=> array('admin_export','core'),
'message'=> $l->t('The php-zip module is needed download multiple files at once'));
$modules[] =array(
'status' => function_exists('mb_detect_encoding') ? 'ok' : 'error',
'part'=> 'php-mb_multibyte ',
'modules'=> array('core'),
'message'=> $l->t('The php-mb_multibyte module is needed to manage correctly the encoding.'));
$modules[] =array(
'status' => function_exists('ctype_digit') ? 'ok' : 'error',
'part'=> 'php-ctype',
'modules'=> array('core'),
'message'=> $l->t('The php-ctype module is needed validate data.'));
$modules[] =array(
'status' => ini_get('allow_url_fopen') == '1' ? 'ok' : 'error',
'part'=> 'allow_url_fopen',
'modules'=> array('core'),
'message'=> $l->t('The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers'));
foreach($modules as $key => $module) {
$enabled = false ;
foreach($module['modules'] as $app) {
if(OC_App::isEnabled($app) || $app=='core'){
$enabled = true;
}
}
if($enabled == false) unset($modules[$key]);
}
OC_UTIL::addStyle('admin_dependencies_chk', 'style');
$tmpl->assign( 'items', $modules );
return $tmpl->fetchPage();

View File

@ -0,0 +1,16 @@
<fieldset id="status_list" class="personalblock">
<legend><?php echo $l->t('Dependencies status');?></legend>
<ul class="state">
<?php foreach($_['items'] as $item):?>
<li class="state_<?php echo $item['status'];?>">
<span class="state_module" title="<?php echo $item['message'];?>"><?php echo $item['part'];?></span>
<div class="state_used"><?php echo $l->t('Used by :');?>
<ul>
<?php foreach($item['modules'] as $module):?>
<li><?php echo $module;?></li>
<?php endforeach;?>
</ul>
</li>
<?php endforeach;?>
</ul>
</fieldset>

View File

@ -54,13 +54,7 @@ $params=array(
);
$query->execute($params);
if($CONFIG_DBTYPE == 'pgsql')
{
$query = OC_DB::prepare("SELECT currval('*PREFIX*bookmarks_id_seq')");
$b_id = $query->execute()->fetchOne();
} else {
$b_id = OC_DB::insertid();
}
$b_id = OC_DB::insertid('*PREFIX*bookmarks');
if($b_id !== false) {

View File

@ -8,6 +8,6 @@
$tmpl = new OC_Template( 'bookmarks', 'settings');
OC_Util::addScript('bookmarks','settings');
//OC_Util::addScript('bookmarks','settings');
return $tmpl->fetchPage();

View File

@ -111,7 +111,7 @@ class OC_Calendar_Calendar{
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*calendar_calendars (userid,displayname,uri,ctag,calendarorder,calendarcolor,timezone,components) VALUES(?,?,?,?,?,?,?,?)' );
$result = $stmt->execute(array($userid,$name,$uri,1,$order,$color,$timezone,$components));
return OC_DB::insertid();
return OC_DB::insertid('*PREFIX*calendar_calendar');
}
/**
@ -131,7 +131,7 @@ class OC_Calendar_Calendar{
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*calendar_calendars (userid,displayname,uri,ctag,calendarorder,calendarcolor,timezone,components) VALUES(?,?,?,?,?,?,?,?)' );
$result = $stmt->execute(array($userid,$name,$uri,1,$order,$color,$timezone,$components));
return OC_DB::insertid();
return OC_DB::insertid('*PREFIX*calendar_calendars');
}
/**

View File

@ -106,7 +106,7 @@ class OC_Calendar_Object{
OC_Calendar_Calendar::touchCalendar($id);
return OC_DB::insertid();
return OC_DB::insertid('*PREFIX*calendar_objects');
}
/**
@ -125,7 +125,7 @@ class OC_Calendar_Object{
OC_Calendar_Calendar::touchCalendar($id);
return OC_DB::insertid();
return OC_DB::insertid('*PREFIX*calendar_objects');
}
/**

View File

@ -13,9 +13,7 @@
<select id="category" name="categories[]" multiple="multiple" title="<?php echo $l->t("Select category") ?>">
<?php
if (!isset($_['categories'])) {$_['categories'] = array();}
foreach($_['category_options'] as $category){
echo '<option value="' . $category . '"' . (in_array($category, $_['categories']) ? ' selected="selected"' : '') . '>' . $category . '</option>';
}
echo html_select_options($_['category_options'], $_['categories'], array('combine'=>true));
?>
</select></td>
<th width="75px">&nbsp;&nbsp;&nbsp;<?php echo $l->t("Calendar");?>:</th>
@ -23,9 +21,7 @@
<select style="width:140px;" name="calendar">
<?php
if (!isset($_['calendar'])) {$_['calendar'] = false;}
foreach($_['calendar_options'] as $calendar){
echo '<option value="' . $calendar['id'] . '"' . ($_['calendar'] == $calendar['id'] ? ' selected="selected"' : '') . '>' . $calendar['displayname'] . '</option>';
}
echo html_select_options($_['calendar_options'], $_['calendar'], array('value'=>'id', 'label'=>'displayname'));
?>
</select></td>
</tr>
@ -66,9 +62,7 @@
<select name="repeat" style="width:350px;">
<?php
if (isset($_['repeat_options'])) {
foreach($_['repeat_options'] as $id => $label){
echo '<option value="' . $id . '"' . ($_['repeat'] == $id ? ' selected="selected"' : '') . '>' . $label . '</option>';
}
echo html_select_options($_['repeat_options'], $_['repeat']);
}
?>
</select></td>

View File

@ -51,10 +51,22 @@ if(is_null($vcard)){
exit();
}
$property_types = array(
'ADR' => $l10n->t('Address'),
'TEL' => $l10n->t('Telephone'),
'EMAIL' => $l10n->t('Email'),
'ORG' => $l10n->t('Organization'),
);
$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR');
$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL');
$details = OC_Contacts_VCard::structureContact($vcard);
$tmpl = new OC_Template('contacts','part.details');
$tmpl->assign('details',$details);
$tmpl->assign('id',$id);
$tmpl->assign('property_types',$property_types);
$tmpl->assign('adr_types',$adr_types);
$tmpl->assign('phone_types',$phone_types);
$page = $tmpl->fetchPage();
OC_JSON::success(array('data' => array( 'id' => $id, 'page' => $page )));

View File

@ -29,9 +29,14 @@ $l10n = new OC_L10N('contacts');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR');
$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL');
$addressbooks = OC_Contacts_Addressbook::all(OC_USER::getUser());
$tmpl = new OC_Template('contacts','part.addcardform');
$tmpl->assign('addressbooks',$addressbooks);
$tmpl->assign('adr_types',$adr_types);
$tmpl->assign('phone_types',$phone_types);
$page = $tmpl->fetchPage();
OC_JSON::success(array('data' => array( 'page' => $page )));

View File

@ -61,11 +61,13 @@ if(is_null($line)){
exit();
}
$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR');
$tmpl = new OC_Template('contacts','part.setpropertyform');
$tmpl->assign('id',$id);
$tmpl->assign('checksum',$checksum);
$tmpl->assign('property',OC_Contacts_VCard::structureProperty($vcard->children[$line]));
$tmpl->assign('adr_types',$adr_types);
$page = $tmpl->fetchPage();
OC_JSON::success(array('data' => array( 'page' => $page )));

View File

@ -4,9 +4,9 @@
#contacts_deletecard {position:absolute;top:15px;right:0;}
#contacts_details_list { list-style:none; }
#contacts_details_list li { overflow:hidden; }
#contacts_details_list li p.contacts_property_name { width:25%; float:left;text-align:right;padding-right:0.3em; }
#contacts_details_list li p.contacts_property_name { width:25%; float:left;text-align:right;padding-right:0.3em;color:#666; }
#contacts_details_list li p.contacts_property_data, #contacts_details_list li ul.contacts_property_data { width:72%; overflow:hidden; }
#contacts_addproperty, #contacts_addproperty_button { margin-left:25%; }
#contacts_addproperty_button, #contacts_setproperty_button { margin-left:25%; }
.contacts_property_data ul, .contacts_property_data ol { list-style:none; }
.contacts_property_data li { overflow: hidden; }

View File

@ -56,13 +56,13 @@ $(document).ready(function(){
$('#contacts_addpropertyform #contacts_fieldpart').remove();
$('#contacts_addpropertyform #contacts_generic').remove();
if($(this).val() == 'ADR'){
$('#contacts_addresspart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]'));
$('#contacts_addresspart').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name'));
}
else if($(this).val() == 'TEL'){
$('#contacts_phonepart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]'));
$('#contacts_phonepart').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name'));
}
else{
$('#contacts_generic').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]'));
$('#contacts_generic').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name'));
}
});

View File

@ -96,7 +96,7 @@ class OC_Contacts_Addressbook{
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)' );
$result = $stmt->execute(array($userid,$name,$uri,$description,1));
return OC_DB::insertid();
return OC_DB::insertid('*PREFIX*contacts_addressbooks');
}
/**
@ -113,7 +113,7 @@ class OC_Contacts_Addressbook{
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)' );
$result = $stmt->execute(array($userid,$name,$uri,$description,1));
return OC_DB::insertid();
return OC_DB::insertid('*PREFIX*contacts_addressbooks');
}
/**

View File

@ -95,10 +95,15 @@ class OC_Contacts_VCard{
$card = self::parse($data);
if(!is_null($card)){
// VCARD must have a version
$hasversion = false;
foreach($card->children as $property){
if($property->name == 'FN'){
$fn = $property->value;
}
elseif($property->name == 'VERSION'){
$hasversion = true;
}
elseif(is_null($uri) && $property->name == 'UID' ){
$uri = $property->value.'.vcf';
}
@ -109,6 +114,11 @@ class OC_Contacts_VCard{
$card->add(new Sabre_VObject_Property('UID',$uid));
$data = $card->serialize();
};
// Add version if needed
if(!$hasversion){
$card->add(new Sabre_VObject_Property('VERSION','3.0'));
$data = $card->serialize();
}
}
else{
// that's hard. Creating a UID and not saving it
@ -121,7 +131,7 @@ class OC_Contacts_VCard{
OC_Contacts_Addressbook::touch($id);
return OC_DB::insertid();
return OC_DB::insertid('*PREFIX*contacts_cards');
}
/**
@ -147,7 +157,7 @@ class OC_Contacts_VCard{
OC_Contacts_Addressbook::touch($id);
return OC_DB::insertid();
return OC_DB::insertid('*PREFIX*contacts_cards');
}
/**
@ -362,4 +372,24 @@ class OC_Contacts_VCard{
return null;
}
}
public static function getTypesOfProperty($l, $prop){
switch($prop){
case 'ADR':
return array(
'WORK' => $l->t('Work'),
'HOME' => $l->t('Home'),
);
case 'TEL':
return array(
'HOME' => $l->t('Home'),
'CELL' => $l->t('Mobile'),
'WORK' => $l->t('Work'),
'TEXT' => $l->t('Text'),
'VOICE' => $l->t('Voice'),
'FAX' => $l->t('Fax'),
'VIDEO' => $l->t('Video'),
'PAGER' => $l->t('Pager'),
);
}
}
}

View File

@ -7,9 +7,7 @@
<li class="input stringish">
<label class="label" for="id"><?php echo $l->t('Group'); ?></label>
<select name="id" size="1">
<?php foreach($_['addressbooks'] as $addressbook): ?>
<option value="<?php echo $addressbook['id']; ?>"><?php echo $addressbook['displayname']; ?></option>
<?php endforeach; ?>
<?php echo html_select_options($_['addressbooks'], null, array('value'=>'id', 'label'=>'displayname')); ?>
</select>
</li>
</ol>
@ -19,7 +17,7 @@
<ol>
<li class="input stringish">
<label class="label" for="fn"><?php echo $l->t('Name'); ?></label>
<input type="text" name="fn" value=""><br>
<input id="fn" type="text" name="fn" value=""><br>
</li>
<li class="input stringish">
<label class="label" for="org"><?php echo $l->t('Organization'); ?></label>
@ -46,14 +44,7 @@
<li class="fragment">
<label for="tel_type"><?php echo $l->t('Type'); ?></label>
<select id="TEL" name="parameters[TEL][TYPE]" size="1">
<option value="home"><?php echo $l->t('Home'); ?></option>
<option value="cell" selected="selected"><?php echo $l->t('Mobile'); ?></option>
<option value="work"><?php echo $l->t('Work'); ?></option>
<option value="text"><?php echo $l->t('Text'); ?></option>
<option value="voice"><?php echo $l->t('Voice'); ?></option>
<option value="fax"><?php echo $l->t('Fax'); ?></option>
<option value="video"><?php echo $l->t('Video'); ?></option>
<option value="pager"><?php echo $l->t('Pager'); ?></option>
<?php echo html_select_options($_['phone_types'], 'CELL') ?>
</select>
</li>
</ol>
@ -67,8 +58,7 @@
<li class="input">
<label class="label" for="adr_type"><?php echo $l->t('Type'); ?></label>
<select id="adr_type" name="parameters[ADR][TYPE]" size="1">
<option value="work"><?php echo $l->t('Work'); ?></option>
<option value="home" selected="selected"><?php echo $l->t('Home'); ?></option>
<?php echo html_select_options($_['adr_types'], 'HOME') ?>
</select>
</li>
<li class="input stringish">
@ -81,19 +71,19 @@
</li>
<li class="input stringish">
<label class="label" for="adr_street"><?php echo $l->t('Street'); ?></label>
<input type="text" for="adr_street" name="value[ADR][2]" value="">
<input type="text" id="adr_street" name="value[ADR][2]" value="">
</li>
<li class="input stringish">
<label class="label" for="adr_city"><?php echo $l->t('City'); ?></label>
<input type="text" for="adr_city" name="value[ADR][3]" value="">
<input type="text" id="adr_city" name="value[ADR][3]" value="">
</li>
<li class="input stringish">
<label class="label" for="adr_region"><?php echo $l->t('Region'); ?></label>
<input type="text" for="adr_region" name="value[ADR][4]" value="">
<input type="text" id="adr_region" name="value[ADR][4]" value="">
</li>
<li class="input stringish">
<label class="label" for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
<input type="text" for="adr_zipcode" name="value[ADR][5]" value="">
<input type="text" id="adr_zipcode" name="value[ADR][5]" value="">
</li>
<li class="input stringish">
<label class="label" for="adr_country"><?php echo $l->t('Country'); ?></label>

View File

@ -27,15 +27,13 @@
<input type="hidden" name="id" value="<?php echo $_['id']; ?>">
<p class="contacts_property_name">
<select name="name" size="1">
<option value="ADR"><?php echo $l->t('Address'); ?></option>
<option value="TEL"><?php echo $l->t('Telephone'); ?></option>
<option value="EMAIL" selected="selected"><?php echo $l->t('Email'); ?></option>
<option value="ORG"><?php echo $l->t('Organization'); ?></option>
<?php echo html_select_options($_['property_types'], 'EMAIL') ?>
</select>
</p>
<p class="contacts_property_data" id="contacts_generic">
<input type="text" name="value" value="">
</p><br>
</p>
<br>
<input id="contacts_addproperty_button" type="submit" value="<?php echo $l->t('Add'); ?>">
</form>
<div id="contacts_addcontactsparts" style="display:none;">
@ -43,8 +41,7 @@
<li>
<label for="adr_type"><?php echo $l->t('Type'); ?></label>
<select id="adr_type" name="parameters[TYPE]" size="1">
<option value="work"><?php echo $l->t('Work'); ?></option>
<option value="home" selected="selected"><?php echo $l->t('Home'); ?></option>
<?php echo html_select_options($_['adr_types'], 'HOME') ?>
</select>
</li>
<li>
@ -79,14 +76,7 @@
<p class="contacts_property_data" id="contacts_phonepart">
<input type="text" name="value" value="">
<select name="parameters[TYPE]" size="1">
<option value="home"><?php echo $l->t('Home'); ?></option>
<option value="cell" selected="selected"><?php echo $l->t('Mobile'); ?></option>
<option value="work"><?php echo $l->t('Work'); ?></option>
<option value="text"><?php echo $l->t('Text'); ?></option>
<option value="voice"><?php echo $l->t('Voice'); ?></option>
<option value="fax"><?php echo $l->t('Fax'); ?></option>
<option value="video"><?php echo $l->t('Video'); ?></option>
<option value="pager"><?php echo $l->t('Pager'); ?></option>
<?php echo html_select_options($_['phone_types'], 'CELL') ?>
</select>
</p>
<p class="contacts_property_data" id="contacts_generic">

View File

@ -5,42 +5,48 @@
<?php if($_['property']['name']=='ADR'): ?>
<p class="contacts_property_name"><label for="adr_pobox"><?php echo $l->t('Address'); ?></label></p>
<ol class="contacts_property_data" id="contacts_addresspart">
<li class="input">
<label class="label" for="adr_type"><?php echo $l->t('Type'); ?></label>
<select id="adr_type" name="parameters[TYPE]" size="1">
<?php echo html_select_options($_['adr_types'], strtoupper($_['property']['parameters']['TYPE'])) ?>
</select>
</li>
<li>
<label for="adr_pobox"><?php echo $l->t('PO Box'); ?></label>
<input id="adr_pobox" type="text" name="value[0]" value="">
<input id="adr_pobox" type="text" name="value[0]" value="<?php echo $_['property']['value'][0] ?>">
</li>
<li>
<label for="adr_extended"><?php echo $l->t('Extended'); ?></label>
<input id="adr_extended" type="text" name="value[1]" value="">
<input id="adr_extended" type="text" name="value[1]" value="<?php echo $_['property']['value'][1] ?>">
</li>
<li>
<label for="adr_street"><?php echo $l->t('Street'); ?></label>
<input id="adr_street" type="text" name="value[2]" value="">
<input id="adr_street" type="text" name="value[2]" value="<?php echo $_['property']['value'][2] ?>">
</li>
<li>
<label for="adr_city"><?php echo $l->t('City'); ?></label>
<input id="adr_city" type="text" name="value[3]" value="">
<input id="adr_city" type="text" name="value[3]" value="<?php echo $_['property']['value'][3] ?>">
</li>
<li>
<label for="adr_region"><?php echo $l->t('Region'); ?></label>
<input id="adr_region" type="text" name="value[4]" value="">
<input id="adr_region" type="text" name="value[4]" value="<?php echo $_['property']['value'][4] ?>">
</li>
<li>
<label for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
<input id="adr_zipcode" type="text" name="value[5]" value="">
<input id="adr_zipcode" type="text" name="value[5]" value="<?php echo $_['property']['value'][5] ?>">
</li>
<li>
<label for="adr_country"><?php echo $l->t('Country'); ?></label>
<input id="adr_country" type="text" name="value[6]" value="">
<input id="adr_country" type="text" name="value[6]" value="<?php echo $_['property']['value'][6] ?>">
</li>
</ol>
<?php elseif($_['property']['name']=='TEL'): ?>
<p class="contacts_property_name"><label for="tel"><?php echo $l->t('Address'); ?></label></p>
<p class="contacts_property_name"><label for="tel"><?php echo $l->t('Phone'); ?></label></p>
<p class="contacts_property_data"><input id="tel" type="phone" name="value" value="<?php echo $_['property']['value']; ?>"></p>
<?php elseif($_['property']['name']=='EMAIL'): ?>
<p class="contacts_property_name"><label for="email"><?php echo $l->t('Email'); ?></label></p>
<p class="contacts_property_data"><input id="email" type="text" name="value" value="<?php echo $_['property']['value']; ?>"></p>
<?php elseif($_['property']['name']=='EMAIL'): ?>
<?php elseif($_['property']['name']=='ORG'): ?>
<p class="contacts_property_name"><label for="org"><?php echo $l->t('Organization'); ?></label></p>
<p class="contacts_property_data"><input id="org" type="text" name="value" value="<?php echo $_['property']['value']; ?>"></p>
<?php endif; ?>

View File

@ -10,7 +10,7 @@ $(document).ready(function() {
type: 'GET',
url: OC.linkTo('files_sharing', 'ajax/getitem.php'),
dataType: 'json',
data: 'source='+file,
data: {source: file},
async: false,
success: function(users) {
if (users) {
@ -46,6 +46,7 @@ $(document).ready(function() {
$('.share').click(function(event) {
event.preventDefault();
event.stopPropagation();
var filenames = getSelectedFiles('name');
var length = filenames.length;
var files = '';
@ -184,8 +185,8 @@ function createDropdown(filename, files) {
html += '<input id="link" style="display:none; width:90%;" />';
html += '</div>';
if (filename) {
$('tr[data-file="'+filename+'"]').addClass('mouseOver');
$(html).appendTo($('tr[data-file="'+filename+'"] td.filename'));
$('tr').filterAttr('data-file',filename).addClass('mouseOver');
$(html).appendTo($('tr').filterAttr('data-file',filename).find('td.filename'));
} else {
$(html).appendTo($('thead .share'));
}

View File

@ -267,7 +267,7 @@ class OC_MEDIA_COLLECTION{
$query=self::$queries['addsong'];
}
$query->execute(array($name,$artist,$album,$path,$uid,$length,$track,$size));
$songId=OC_DB::insertid();
$songId=OC_DB::insertid('*PREFIX*media_songs');
// self::setLastUpdated();
return self::getSongId($name,$artist,$album);
}

View File

@ -4,12 +4,6 @@ class OC_remoteStorage {
public static function getValidTokens($ownCloudUser, $userAddress, $dataScope) {
$query=OC_DB::prepare("SELECT token,appUrl FROM *PREFIX*authtoken WHERE user=? AND userAddress=? AND dataScope=? LIMIT 100");
$result=$query->execute(array($ownCloudUser,$userAddress,$dataScope));
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
OC_Log::write('removeStorage',$entry,OC_Log::ERROR);
die( $entry );
}
$ret = array();
while($row=$result->fetchRow()){
$ret[$row['token']]=$userAddress;
@ -21,12 +15,6 @@ class OC_remoteStorage {
$user=OC_User::getUser();
$query=OC_DB::prepare("SELECT token,appUrl,userAddress,dataScope FROM *PREFIX*authtoken WHERE user=? LIMIT 100");
$result=$query->execute(array($user));
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
OC_Log::write('removeStorage',$entry,OC_Log::ERROR);
die( $entry );
}
$ret = array();
while($row=$result->fetchRow()){
$ret[$row['token']] = array(
@ -42,23 +30,11 @@ class OC_remoteStorage {
$user=OC_User::getUser();
$query=OC_DB::prepare("DELETE FROM *PREFIX*authtoken WHERE token=? AND user=?");
$result=$query->execute(array($token,$user));
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
OC_Log::write('removeStorage',$entry,OC_Log::ERROR);
die( $entry );
}
}
private static function addToken($token, $appUrl, $userAddress, $dataScope){
$user=OC_User::getUser();
$query=OC_DB::prepare("INSERT INTO *PREFIX*authtoken (`token`,`appUrl`,`user`,`userAddress`,`dataScope`) VALUES(?,?,?,?,?)");
$result=$query->execute(array($token,$appUrl,$user,$userAddress,$dataScope));
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
OC_Log::write('removeStorage',$entry,OC_Log::ERROR);
die( $entry );
}
}
public static function createDataScope($appUrl, $userAddress, $dataScope){
$token=uniqid();

View File

@ -4,7 +4,14 @@ if($_SERVER['SCRIPT_NAME'] == '/.well-known/webfinger.php') {
} else {
header('Please-first: activate');
}
header("Content-Type: application/xml+xrd");
// header("Content-Type: application/xml+xrd");
// calculate the documentroot
// modified version of the one in lib/base.php that takes the .well-known symlink into account
$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']);
$SERVERROOT=str_replace("\\",'/',dirname(dirname(dirname(dirname(__FILE__)))));
$SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT));
$WEBROOT=substr($SUBURI,0,-34);
if($_GET['q']) {
$bits = explode('@', $_GET['q']);
@ -20,5 +27,5 @@ echo "<";
?xml version="1.0" encoding="UTF-8"?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:hm="http://host-meta.net/xrd/1.0">
<hm:Host xmlns="http://host-meta.net/xrd/1.0"><?php echo $_SERVER['SERVER_NAME'] ?></hm:Host>
<Link rel="http://unhosted.org/spec/dav/0.1" href="http<?php echo ($_SERVER['HTTPS']?'s':''); ?>://<?php echo $_SERVER['SERVER_NAME'] ?>/apps/remoteStorage/compat.php/<?php echo $userName ?>/remoteStorage/" />
<Link rel="http://unhosted.org/spec/dav/0.1" href="http<?php echo ($_SERVER['HTTPS']?'s':''); ?>://<?php echo $_SERVER['SERVER_NAME'].$WEBROOT ?>/apps/remoteStorage/compat.php/<?php echo $userName ?>/remoteStorage/" />
</XRD>

View File

@ -32,14 +32,14 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#35537a', end
/* INPUTS */
input[type="text"], input[type="password"] { cursor:text; }
input, select, .button, #quota, div.jp-progress, .pager li a { font-size:1em; width:10em; margin:.3em; padding:.6em .5em .4em; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; }
input, select, button, .button, #quota, div.jp-progress, .pager li a { font-size:1em; width:10em; margin:.3em; padding:.6em .5em .4em; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; }
input[type="text"], input[type="password"], input[type="search"] { background:#f8f8f8; color:#555; cursor:text; }
input[type="text"], input[type="password"], input[type="search"] { -webkit-appearance:textfield; -moz-appearance:textfield; -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; }
input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active,
input[type="password"]:hover, input[type="password"]:focus, input[type="password"]:active,
.searchbox input[type="search"]:hover, .searchbox input[type="search"]:focus, .searchbox input[type="search"]:active { background-color:#fff; color:#333; opacity:1; }
input[type="submit"], input[type="button"], .button, #quota, div.jp-progress, .pager li a { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
input[type="submit"], input[type="button"], button, .button, #quota, div.jp-progress, .pager li a { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
input[type="submit"]:hover, input[type="submit"]:focus, input[type="button"]:hover, input[type="button"]:focus, .button:hover { background:#fff; color:#333; }
input[type="checkbox"] { width:auto; }
#quota { cursor:default; }

BIN
core/img/actions/upload.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
id="svg3875"
version="1.1"
inkscape:version="0.48.1 r9760"
sodipodi:docname="download.svg"
inkscape:export-filename="/home/jancborchardt/owncloud/core/img/actions/play.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs3877" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="17.921875"
inkscape:cx="-5.3403178"
inkscape:cy="10.148736"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1280"
inkscape:window-height="776"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid3883"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata3880">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1036.3622)">
<path
style="fill:#000000;fill-opacity:1;stroke:none"
d="m 10,1051.3622 -4,0 -1,-7 -4,0 7,-7 7,7 -4,0 z"
id="path3086"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -365,7 +365,7 @@ $(document).ready(function(){
$('.jp-controls .jp-previous').tipsy({gravity:'nw', fade:true, live:true});
$('.jp-controls .jp-next').tipsy({gravity:'n', fade:true, live:true});
$('.password .action').tipsy({gravity:'se', fade:true, live:true});
$('.file_upload_button_wrapper').tipsy({gravity:'e', fade:true});
$('.file_upload_button_wrapper').tipsy({gravity:'w', fade:true});
$('.selectedActions a.delete').tipsy({gravity: 'se', fade:true, live:true});
$('.selectedActions a').tipsy({gravity:'s', fade:true, live:true});
$('#headerSize').tipsy({gravity:'s', fade:true, live:true});
@ -401,3 +401,10 @@ if (!Array.prototype.map){
return res;
};
}
/**
* Filter Jquery selector by attribute value
**/
$.fn.filterAttr = function(attr_name, attr_value) {
return this.filter(function() { return $(this).attr(attr_name) === attr_value; });
};

27
files/ajax/newfile.php Normal file
View File

@ -0,0 +1,27 @@
<?php
// Init owncloud
require_once('../../lib/base.php');
OC_JSON::checkLoggedIn();
// Get the params
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
$filename = isset( $_GET['filename'] ) ? $_GET['filename'] : '';
$content = isset( $_GET['content'] ) ? $_GET['content'] : '';
if($filename == '') {
OC_JSON::error(array("data" => array( "message" => "Empty Filename" )));
exit();
}
if(OC_Files::newFile($dir, $filename, 'file')) {
if($content){
OC_Filesystem::file_put_contents($dir.'/'.$filename,$content);
}
OC_JSON::success(array("data" => array('content'=>$content)));
exit();
}
OC_JSON::error(array("data" => array( "message" => "Error when creating the file" )));

View File

@ -3,15 +3,22 @@
See the COPYING-README file. */
/* FILE MENU */
.actions { padding:.3em; float:left; }
.actions input { margin:0; }
.actions { padding:.3em; float:left; height:2em; }
.actions input, .actions button, .actions .button { margin:0; }
#file_menu { right:0; position:absolute; top:0; }
#file_menu a { display:block; float:left; background-image:none; text-decoration:none; }
.file_upload_form, #file_newfolder_form { display:inline; float: left; margin-left:.5em; }
.file_upload_form, #file_newfolder_form { display:inline; float: left; margin-left:0; }
#fileSelector, #file_upload_submit, #file_newfolder_submit { display:none; }
.file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .5em; padding-left:2em; }
.file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:.1em .1em .1em 0em;}
.file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:0;}
.file_upload_wrapper .file_upload_button_wrapper { position:absolute; top:0; left:0; width:100%; height:100%; cursor:pointer; z-index:1000; }
#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin:0 0 0 1em; border-right:none; z-index:1010; height:1.3em; }
#new.active { border-bottom-left-radius:0; border-bottom:none; background:#f8f8f8 }
#new>a{ padding-left:1em; padding-right:1em; }
#new>ul { display:none; position:fixed; text-align:left; padding:.5em; background:#f8f8f8; margin-top:0.075em; border:1px solid #ddd; min-width:7em; margin-left:-.5em; z-index:-1; }
#new>ul>li { margin:.3em; padding-left:2em; background-repeat:no-repeat; cursor:pointer; padding-bottom:0.1em }
#new>ul>li>p { cursor:pointer; }
#new>ul>li>input { padding:0.3em; margin:-0.3em; }
#file_newfolder_name { background-image:url('../../core/img/places/folder.svg'); font-weight:normal; width:7em; }
.file_upload_start, .file_upload_filename { font-size:1em; }
@ -19,7 +26,9 @@
.file_upload_target { display:none; }
.file_upload_start { opacity:0; filter:alpha(opacity=0); z-index:1; position:absolute; left:0; top:0; width:100%; cursor:pointer;}
.file_upload_filename { z-index:100; cursor:pointer;}
.file_upload_filename.active { border-bottom-right-radius:0 }
.file_upload_filename { z-index:100; cursor:pointer; border-top-left-radius:0; border-bottom-left-radius:0; padding:.3em; }
.file_upload_form, .file_upload_wrapper, .file_upload_start, .file_upload_filename, #file_upload_submit { cursor:pointer; }

View File

@ -89,6 +89,10 @@ $upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'
$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
$freeSpace=OC_Filesystem::free_space('/');
$freeSpace=max($freeSpace,0);
$maxUploadFilesize = min($maxUploadFilesize ,$freeSpace);
$tmpl = new OC_Template( "files", "index", "user" );
$tmpl->assign( "fileList", $list->fetchPage() );
$tmpl->assign( "breadcrumb", $breadcrumbNav->fetchPage() );

View File

@ -56,7 +56,7 @@ FileActions={
$('#fileList .action').remove();
var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType());
var file=FileActions.getCurrentFile();
if($('tr[data-file="'+file+'"]').data('renaming')){
if($('tr').filterAttr('data-file',file).data('renaming')){
return;
}
var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType());

View File

@ -4,7 +4,7 @@ FileList={
},
addFile:function(name,size,lastModified,loading){
var img=(loading)?OC.imagePath('core', 'loading.gif'):OC.imagePath('core', 'filetypes/file.png');
var html='<tr data-file="'+name+'" data-type="file" data-size="'+size+'">';
var html='<tr data-type="file" data-size="'+size+'">';
if(name.indexOf('.')!=-1){
var basename=name.substr(0,name.lastIndexOf('.'));
var extention=name.substr(name.lastIndexOf('.'));
@ -29,16 +29,21 @@ FileList={
html+='<td class="filesize" title="'+humanFileSize(size)+'" style="color:rgb('+sizeColor+','+sizeColor+','+sizeColor+')">'+simpleSize+'</td>';
html+='<td class="date"><span class="modified" title="'+formatDate(lastModified)+'" style="color:rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')">'+relative_modified_date(lastModified.getTime() / 1000)+'</span></td>';
html+='</tr>';
FileList.insertElement(name,'file',$(html));
FileList.insertElement(name,'file',$(html).attr('data-file',name));
if(loading){
$('tr[data-file="'+name+'"]').data('loading',true);
$('tr').filterAttr('data-file',name).data('loading',true);
}else{
$('tr[data-file="'+name+'"] td.filename').draggable(dragOptions);
$('tr').filterAttr('data-file',name).find('td.filename').draggable(dragOptions);
}
},
addDir:function(name,size,lastModified){
var html='<tr data-file="'+name+'" data-type="dir" data-size="'+size+'">';
html+='<td class="filename" style="background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')"><input type="checkbox" /><a class="name" href="index.php?dir='+$('#dir').val()+'/'+name+'">'+name+'</a></td>';
html = $('<tr></tr>').attr({ "data-type": "dir", "data-size": size, "data-file": name});
td = $('<td></td>').attr({"class": "filename", "style": 'background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')' });
td.append('<input type="checkbox" />');
var link_elem = $('<a></a>').attr({ "class": "name", "href": "index.php?dir="+ encodeURIComponent($('#dir').val()+'/'+name) });
link_elem.append($('<span></span>').addClass('nametext').text(name));
td.append(link_elem);
html.append(td);
if(size!='Pending'){
simpleSize=simpleFileSize(size);
}else{
@ -47,13 +52,15 @@ FileList={
sizeColor = Math.round(200-Math.pow((size/(1024*1024)),2));
lastModifiedTime=Math.round(lastModified.getTime() / 1000);
modifiedColor=Math.round((Math.round((new Date()).getTime() / 1000)-lastModifiedTime)/60/60/24*5);
html+='<td class="filesize" title="'+humanFileSize(size)+'" style="color:rgb('+sizeColor+','+sizeColor+','+sizeColor+')">'+simpleSize+'</td>';
html+='<td class="date"><span class="modified" title="'+formatDate(lastModified)+'" style="color:rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')">'+relative_modified_date(lastModified.getTime() / 1000)+'</span></td>';
html+='</tr>';
td = $('<td></td>').attr({ "class": "filesize", "title": humanFileSize(size), "style": 'color:rgb('+sizeColor+','+sizeColor+','+sizeColor+')'}).text(simpleSize);
html.append(td);
FileList.insertElement(name,'dir',$(html));
$('tr[data-file="'+name+'"] td.filename').draggable(dragOptions);
$('tr[data-file="'+name+'"] td.filename').droppable(folderDropOptions);
td = $('<td></td>').attr({ "class": "date" });
td.append($('<span></span>').attr({ "class": "modified", "title": formatDate(lastModified), "style": 'color:rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')' }).text( relative_modified_date(lastModified.getTime() / 1000) ));
html.append(td);
FileList.insertElement(name,'dir',html);
$('tr').filterAttr('data-file',name).find('td.filename').draggable(dragOptions);
$('tr').filterAttr('data-file',name).find('td.filename').droppable(folderDropOptions);
},
refresh:function(data) {
result = jQuery.parseJSON(data.responseText);
@ -64,8 +71,8 @@ FileList={
resetFileActionPanel();
},
remove:function(name){
$('tr[data-file="'+name+'"] td.filename').draggable('destroy');
$('tr[data-file="'+name+'"]').remove();
$('tr').filterAttr('data-file',name).find('td.filename').draggable('destroy');
$('tr').filterAttr('data-file',name).remove();
if($('tr[data-file]').length==0){
$('#emptyfolder').show();
$('.file_upload_filename').addClass('highlight');
@ -101,7 +108,7 @@ FileList={
$('.file_upload_filename').removeClass('highlight');
},
loadingDone:function(name){
var tr=$('tr[data-file="'+name+'"]');
var tr=$('tr').filterAttr('data-file',name);
tr.data('loading',false);
var mime=tr.data('mime');
tr.attr('data-mime',mime);
@ -111,13 +118,13 @@ FileList={
tr.find('td.filename').draggable(dragOptions);
},
isLoading:function(name){
return $('tr[data-file="'+name+'"]').data('loading');
return $('tr').filterAttr('data-file',name).data('loading');
},
rename:function(name){
var tr=$('tr[data-file="'+name+'"]');
var tr=$('tr').filterAttr('data-file',name);
tr.data('renaming',true);
var td=tr.children('td.filename');
var input=$('<input value="'+name+'" class="filename"></input>');
var input=$('<input class="filename"></input>').val(name);
var form=$('<form action="#"></form>')
form.append(input);
td.children('a.name').text('');
@ -143,7 +150,7 @@ FileList={
}
$.ajax({
url: 'ajax/rename.php',
data: "dir="+$('#dir').val()+"&newname="+encodeURIComponent(newname)+"&file="+encodeURIComponent(name)
data: { dir : $('#dir').val(), newname: newname, file: name }
});
});
form.click(function(event){
@ -165,9 +172,10 @@ FileList={
files=[files];
}
$.each(files,function(index,file){
$('tr[data-file="'+file+'"]').hide();
$('tr[data-file="'+file+'"]').find('input[type="checkbox"]').removeAttr('checked');
$('tr[data-file="'+file+'"]').removeClass('selected');
var files = $('tr').filterAttr('data-file',file);
files.hide();
files.find('input[type="checkbox"]').removeAttr('checked');
files.removeClass('selected');
});
procesSelection();
FileList.deleteCanceled=false;
@ -208,7 +216,7 @@ $(document).ready(function(){
if($('#notification').data('deletefile'))
{
$.each(FileList.deleteFiles,function(index,file){
$('tr[data-file="'+file+'"]').show();
$('tr').filterAttr('data-file',file).show();
// alert(file);
});
FileList.deleteCanceled=true;

View File

@ -1,4 +1,9 @@
$(document).ready(function() {
$('#fileList tr').each(function(){
//little hack to set unescape filenames in attribute
$(this).attr('data-file',decodeURIComponent($(this).attr('data-file')));
});
if($('tr[data-file]').length==0){
$('.file_upload_filename').addClass('highlight');
}
@ -64,7 +69,7 @@ $(document).ready(function() {
}
procesSelection();
} else {
var filename=$(this).parent().parent().data('file');
var filename=$(this).parent().parent().attr('data-file');
if(!FileList.isLoading(filename)){
var mime=$(this).parent().parent().data('mime');
var type=$(this).parent().parent().data('type');
@ -158,7 +163,7 @@ $(document).ready(function() {
});
$('.file_upload_start').live('change',function(){
var form=$(this).parent().parent();
var form=$(this).closest('form');
var uploadId=form.attr('data-upload-id');
var files=this.files;
var target=form.children('iframe');
@ -185,9 +190,9 @@ $(document).ready(function() {
if(response[0] != undefined && response[0].status == 'success'){
for(var i=0;i<response.length;i++){
var file=response[i];
$('tr[data-file="'+file.name+'"]').data('mime',file.mime);
$('tr').filterAttr('data-file',file.name).data('mime',file.mime);
if(size=='Pending'){
$('tr[data-file='+file.name+'] td.filesize').text(file.size);
$('tr').filterAttr('data-file',file.name).find('td.filesize').text(file.size);
}
FileList.loadingDone(file.name);
}
@ -255,32 +260,82 @@ $(document).ready(function() {
text=text.substr(0,text.length-6)+'...';
crumb.text(text);
}
$(window).click(function(){
$('#new>ul').hide();
$('#new').removeClass('active');
$('button.file_upload_filename').removeClass('active');
$('#new li').each(function(i,element){
if($(element).children('p').length==0){
$(element).children('input').remove();
$(element).append('<p>'+$(element).data('text')+'</p>');
}
});
});
$('#new').click(function(event){
event.stopPropagation();
});
$('#new>a').click(function(){
$('#new>ul').toggle();
$('#new').toggleClass('active');
$('button.file_upload_filename').toggleClass('active');
});
$('#new li').click(function(){
if($(this).children('p').length==0){
return;
}
$('#new li').each(function(i,element){
if($(element).children('p').length==0){
$(element).children('input').remove();
$(element).append('<p>'+$(element).data('text')+'</p>');
}
});
var type=$(this).data('type');
var text=$(this).children('p').text();
$(this).data('text',text);
$(this).children('p').remove();
var input=$('<input>');
$(this).append(input);
input.focus();
input.change(function(){
var name=$(this).val();
switch(type){
case 'file':
$.ajax({
url: OC.filePath('files','ajax','newfile.php'),
data: "dir="+encodeURIComponent($('#dir').val())+"&filename="+encodeURIComponent(name)+'&content=%20%0A',
complete: function(data){boolOperationFinished(data, function(){
var date=new Date();
FileList.addFile(name,0,date);
var tr=$('tr').filterAttr('data-file',name);
tr.data('mime','text/plain');
getMimeIcon('text/plain',function(path){
tr.find('td.filename').attr('style','background-image:url('+path+')');
});
});}
});
break;
case 'folder':
$.ajax({
url: OC.filePath('files','ajax','newfolder.php'),
data: "dir="+encodeURIComponent($('#dir').val())+"&foldername="+encodeURIComponent(name),
complete: function(data){boolOperationFinished(data, function(){
var date=new Date();
FileList.addDir(name,0,date);
});}
});
break;
}
var li=$(this).parent();
$(this).remove();
li.append('<p>'+li.data('text')+'</p>');
$('#new>a').click();
});
});
});
var adjustNewFolderSize = function() {
if($('#file_newfolder_name').val() != '') {
splitSize($('#file_newfolder_name'),$('#file_newfolder_submit'));
$('#file_newfolder_name').unbind('keyup', adjustNewFolderSize);
};
}
function splitSize(existingEl, appearingEl) {
nw = parseInt($(existingEl).css('width')) - parseInt($(appearingEl).css('width'));
$(existingEl).css('width', nw + 'px');
$(appearingEl).fadeIn(250);
}
function unsplitSize(stayingEl, vanishingEl) {
nw = parseInt($(stayingEl).css('width')) + parseInt($(vanishingEl).css('width'));
$(stayingEl).css('width', nw + 'px');
$(vanishingEl).fadeOut(250);
}
function resetFileActionPanel() {
$('#file_action_panel form').css({"display":"none"});
$('#file_action_panel').attr('activeAction', false);
}
function boolOperationFinished(data, callback) {
result = jQuery.parseJSON(data.responseText);
if(result.status == 'success'){
@ -343,7 +398,7 @@ var folderDropOptions={
url: 'ajax/move.php',
data: "dir="+dir+"&file="+file+'&target='+dir+'/'+target,
complete: function(data){boolOperationFinished(data, function(){
var el=$('#fileList tr[data-file="'+file+'"] td.filename');
var el = $('#fileList tr').filterAttr('data-file',file).find('td.filename');
el.draggable('destroy');
FileList.remove(file);
});}
@ -445,7 +500,7 @@ function getSelectedFiles(property){
var files=[];
elements.each(function(i,element){
var file={
name:$(element).data('file'),
name:$(element).attr('data-file'),
mime:$(element).data('mime'),
type:$(element).data('type'),
size:$(element).data('size'),

View File

@ -2,20 +2,27 @@
<?php echo($_['breadcrumb']); ?>
<?php if (!isset($_['readonly']) || !$_['readonly']) {?>
<div class="actions">
<form data-upload-id='1' class="file_upload_form" action="ajax/upload.php" method="post" enctype="multipart/form-data" target="file_upload_target_1">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload">
<input type="hidden" class="max_human_file_size" value="(max <?php echo $_['uploadMaxHumanFilesize']; ?>)">
<input type="hidden" name="dir" value="<?php echo $_['dir'] ?>" id="dir">
<div class="file_upload_wrapper svg">
<input type="submit" class="file_upload_filename" value="<?php echo $l->t('Upload'); ?>"/>
<div id='new' class='button'>
<a>
<?php echo $l->t('New');?>
</a>
<ul class="popup popupTop">
<li style="background-image:url('<?php echo mimetype_icon('text/plain') ?>')" data-type='file'><p><?php echo $l->t('Text file');?></p></li>
<li style="background-image:url('<?php echo mimetype_icon('dir') ?>')" data-type='folder'><p><?php echo $l->t('Folder');?></p></li>
<!-- <li style="background-image:url('<?php echo mimetype_icon('dir') ?>')" data-type='web'><p><?php echo $l->t('From the web');?></p></li> -->
</ul>
</div>
<div class="file_upload_wrapper svg">
<form data-upload-id='1' class="file_upload_form" action="ajax/upload.php" method="post" enctype="multipart/form-data" target="file_upload_target_1">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload">
<input type="hidden" class="max_human_file_size" value="(max <?php echo $_['uploadMaxHumanFilesize']; ?>)">
<input type="hidden" name="dir" value="<?php echo $_['dir'] ?>" id="dir">
<button class="file_upload_filename"><img class='svg action' alt="Upload" src="<?php echo image_path("core", "actions/upload.svg"); ?>" /></button>
<input class="file_upload_start" type="file" name='files[]'/>
<a href="#" class="file_upload_button_wrapper" onclick="return false;" title="<?php echo 'max. '.$_['uploadMaxHumanFilesize'] ?>"></a>
</div>
<iframe name="file_upload_target_1" class='file_upload_target' src=""></iframe>
</form>
<form id="file_newfolder_form">
<input class="svg" type="text" name="file_newfolder_name" id="file_newfolder_name" value="" placeholder="<?php echo $l->t('New Folder')?>" />
</form>
<a href="#" class="file_upload_button_wrapper" onclick="return false;" title="<?php echo $l->t('Upload'); echo ' max. '.$_['uploadMaxHumanFilesize'] ?>"></a>
<iframe name="file_upload_target_1" class='file_upload_target' src=""></iframe>
</form>
</div>
</div>
<div id="file_action_panel">
</div>

View File

@ -5,7 +5,7 @@
$relative_modified_date = relative_modified_date($file['mtime']);
$relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey; days*14
if($relative_date_color>200) $relative_date_color = 200; ?>
<tr data-file="<?php echo $file['name'];?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mime']?>" data-size='<?php echo $file['size'];?>'>
<tr data-file="<?php echo str_replace('+','%20',urlencode($file['name']));?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mime']?>" data-size='<?php echo $file['size'];?>'>
<td class="filename svg" style="background-image:url(<?php if($file['type'] == 'dir') echo mimetype_icon('dir'); else echo mimetype_icon($file['mime']); ?>)">
<?php if(!isset($_['readonly']) || !$_['readonly']) { ?><input type="checkbox" /><?php } ?>
<a class="name" href="<?php if($file['type'] == 'dir') echo $_['baseURL'].$file['directory'].'/'.$file['name']; else echo $_['downloadURL'].urlencode($file['directory']).'/'.urlencode($file['name']); ?>" title="">

View File

@ -100,11 +100,11 @@ class OC_App{
}
/**
* @brief enables an app
* @brief disables an app
* @param $app app
* @returns true/false
*
* This function set an app as enabled in appconfig.
* This function set an app as disabled in appconfig.
*/
public static function disable( $app ){
OC_Appconfig::setValue( $app, 'enabled', 'no' );

View File

@ -77,6 +77,9 @@ class OC{
// set some stuff
//ob_start();
error_reporting(E_ALL | E_STRICT);
if (defined('DEBUG') && DEBUG){
ini_set('display_errors', 1);
}
date_default_timezone_set('Europe/Berlin');
ini_set('arg_separator.output','&amp;');

View File

@ -29,7 +29,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
*/
public function get() {
return OC_Filesystem::file_get_contents($this->path);
return OC_Filesystem::fopen($this->path,'r');
}

View File

@ -224,6 +224,7 @@ class OC_DB {
/**
* @brief gets last value of autoincrement
* @param $table string The optional table name (will replace *PREFIX*) and add sequence suffix
* @returns id
*
* MDB2 lastInsertID()
@ -231,9 +232,14 @@ class OC_DB {
* Call this method right after the insert command or other functions may
* cause trouble!
*/
public static function insertid(){
public static function insertid($table=null){
self::connect();
return self::$connection->lastInsertId();
if($table !== null){
$prefix = OC_Config::getValue( "dbtableprefix", "oc_" );
$suffix = OC_Config::getValue( "dbsequencesuffix", "_id_seq" );
$table = str_replace( '*PREFIX*', $prefix, $table );
}
return self::$connection->lastInsertId($table.$suffix);
}
/**

View File

@ -84,6 +84,11 @@ class OC_Filestorage_Local extends OC_Filestorage{
return $return;
}
public function rename($path1,$path2){
if(! $this->file_exists($path1)){
OC_Log::write('core','unable to rename, file does not exists : '.$path1,OC_Log::ERROR);
return false;
}
if($return=rename($this->datadir.$path1,$this->datadir.$path2)){
$this->clearFolderSizeCache($path1);
$this->clearFolderSizeCache($path2);

View File

@ -20,7 +20,7 @@ class OC_Hook{
* TODO: write example
*/
static public function connect( $signalclass, $signalname, $slotclass, $slotname ){
// Cerate the data structure
// Create the data structure
if( !array_key_exists( $signalclass, self::$registered )){
self::$registered[$signalclass] = array();
}

View File

@ -59,6 +59,9 @@ class OC_Log{
return array();
}
$fh=fopen($logFile,'r');
if($fh === false){ // Unable to read log file!
return array();
}
while(!feof($fh)){
$line=fgets($fh);
if($line){

View File

@ -108,6 +108,7 @@ class OC_OCSClient{
$xml=@file_get_contents($url);
if($xml==FALSE){
OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL);
return NULL;
}
$data=simplexml_load_string($xml);
@ -143,6 +144,7 @@ class OC_OCSClient{
$kbe=array();
$xml=@file_get_contents($url);
if($xml==FALSE){
OC_Log::write('core','Unable to parse knowledgebase content',OC_Log::FATAL);
return NULL;
}
$data=simplexml_load_string($xml);

View File

@ -82,7 +82,7 @@ class OC_Setup {
$dbpass = $options['dbpass'];
$dbname = $options['dbname'];
$dbhost = $options['dbhost'];
$dbtableprefix = OC_Config::getValue('dbtableprefix','oc_');
$dbtableprefix = $options['dbtableprefix'];
OC_Config::setValue('dbname', $dbname);
OC_Config::setValue('dbhost', $dbhost);
OC_Config::setValue('dbtableprefix', $dbtableprefix);
@ -135,7 +135,7 @@ class OC_Setup {
$dbpass = $options['dbpass'];
$dbname = $options['dbname'];
$dbhost = $options['dbhost'];
$dbtableprefix = OC_Config::getValue('dbtableprefix','oc_');
$dbtableprefix = $options['dbtableprefix'];
OC_CONFIG::setValue('dbname', $dbname);
OC_CONFIG::setValue('dbhost', $dbhost);
OC_CONFIG::setValue('dbtableprefix', $dbtableprefix);

View File

@ -98,6 +98,33 @@ function relative_modified_date($timestamp) {
else { return $l->t('years ago'); }
}
function html_select_options($options, $selected, $params=array()) {
if (!is_array($selected)){
$selected=array($selected);
}
if (isset($params['combine']) && $params['combine']){
$options = array_combine($options, $options);
}
$value_name = $label_name = false;
if (isset($params['value'])){
$value_name = $params['value'];
}
if (isset($params['label'])){
$label_name = $params['label'];
}
$html = '';
foreach($options as $value => $label){
if ($value_name && is_array($label)){
$value = $label[$value_name];
}
if ($label_name && is_array($label)){
$label = $label[$label_name];
}
$select = in_array($value, $selected) ? ' selected="selected"' : '';
$html .= '<option value="' . $value . '"' . $select . '>' . $label . '</option>';
}
return $html;
}
/**
* This class provides the templates for owncloud.

View File

@ -9,7 +9,10 @@
<?php
$url=OC_Helper::linkTo( "settings", "help.php" ).'?page=';
$pageNavi=OC_Util::getPageNavi($_['pagecount'],$_['page'],$url);
$pageNavi->printPage();
if($pageNavi)
{
$pageNavi->printPage();
}
?>
</diV>
<?php if(is_null($_["kbe"])):?>