diff --git a/.gitignore b/.gitignore index cc4d3bf03b..a84615cf13 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,6 @@ nbproject # Mac OS .DS_Store + +# WebFinger +.well-known diff --git a/.htaccess b/.htaccess index 34d4c719c8..0d334503d0 100644 --- a/.htaccess +++ b/.htaccess @@ -4,8 +4,6 @@ php_value upload_max_filesize 512M php_value post_max_size 512M SetEnv htaccessWorking true - RewriteEngine on RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last] - Options -Indexes diff --git a/3rdparty/Sabre.includes.php b/3rdparty/Sabre.includes.php index 9d389288c7..d41b287b77 100644 --- a/3rdparty/Sabre.includes.php +++ b/3rdparty/Sabre.includes.php @@ -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'; - diff --git a/3rdparty/Sabre/CardDAV/AddressBook.php b/3rdparty/Sabre/CardDAV/AddressBook.php index 3333480ea8..471ca7b338 100644 --- a/3rdparty/Sabre/CardDAV/AddressBook.php +++ b/3rdparty/Sabre/CardDAV/AddressBook.php @@ -1,7 +1,9 @@ extensionMap[$extension])) return $this->extensionMap[$extension]; diff --git a/3rdparty/Sabre/DAV/Server.php b/3rdparty/Sabre/DAV/Server.php index b99866dad5..3d76d4f191 100644 --- a/3rdparty/Sabre/DAV/Server.php +++ b/3rdparty/Sabre/DAV/Server.php @@ -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 { diff --git a/3rdparty/Sabre/DAV/Version.php b/3rdparty/Sabre/DAV/Version.php index e7f7f83e6f..6bece1985e 100644 --- a/3rdparty/Sabre/DAV/Version.php +++ b/3rdparty/Sabre/DAV/Version.php @@ -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 diff --git a/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php b/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php index 640ab8efff..024ab6641f 100644 --- a/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php +++ b/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php @@ -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 { /** diff --git a/3rdparty/Sabre/DAVACL/PrincipalCollection.php b/3rdparty/Sabre/DAVACL/PrincipalCollection.php index 3cc0ae8462..4d22bf8aa7 100644 --- a/3rdparty/Sabre/DAVACL/PrincipalCollection.php +++ b/3rdparty/Sabre/DAVACL/PrincipalCollection.php @@ -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 diff --git a/3rdparty/Sabre/VObject/Component.php b/3rdparty/Sabre/VObject/Component.php index 3d5a3d7563..47cf9f3d81 100644 --- a/3rdparty/Sabre/VObject/Component.php +++ b/3rdparty/Sabre/VObject/Component.php @@ -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; } diff --git a/3rdparty/Sabre/VObject/Element/DateTime.php b/3rdparty/Sabre/VObject/Element/DateTime.php index 30e5c6ca86..3350ec02c8 100644 --- a/3rdparty/Sabre/VObject/Element/DateTime.php +++ b/3rdparty/Sabre/VObject/Element/DateTime.php @@ -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); diff --git a/3rdparty/Sabre/VObject/Element/MultiDateTime.php b/3rdparty/Sabre/VObject/Element/MultiDateTime.php index 5e677f5e5b..dc6ca5abb8 100644 --- a/3rdparty/Sabre/VObject/Element/MultiDateTime.php +++ b/3rdparty/Sabre/VObject/Element/MultiDateTime.php @@ -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; } diff --git a/3rdparty/Sabre/VObject/Node.php b/3rdparty/Sabre/VObject/Node.php index efc7f76da7..7100b62f1c 100644 --- a/3rdparty/Sabre/VObject/Node.php +++ b/3rdparty/Sabre/VObject/Node.php @@ -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 */ /** diff --git a/3rdparty/Sabre/VObject/Property.php b/3rdparty/Sabre/VObject/Property.php index 624dd4b8a5..0605822904 100644 --- a/3rdparty/Sabre/VObject/Property.php +++ b/3rdparty/Sabre/VObject/Property.php @@ -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]); } diff --git a/3rdparty/Sabre/VObject/Reader.php b/3rdparty/Sabre/VObject/Reader.php index c38afbfb63..5ed7882ac9 100644 --- a/3rdparty/Sabre/VObject/Reader.php +++ b/3rdparty/Sabre/VObject/Reader.php @@ -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; diff --git a/3rdparty/Sabre/VObject/Version.php b/3rdparty/Sabre/VObject/Version.php index 950c1c5110..937c367e22 100644 --- a/3rdparty/Sabre/VObject/Version.php +++ b/3rdparty/Sabre/VObject/Version.php @@ -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 diff --git a/apps/admin_dependencies_chk/appinfo/app.php b/apps/admin_dependencies_chk/appinfo/app.php new file mode 100644 index 0000000000..e2169b5dd7 --- /dev/null +++ b/apps/admin_dependencies_chk/appinfo/app.php @@ -0,0 +1,9 @@ + 14, + 'id' => 'admin_dependencies_chk', + 'name' => 'Owncloud Install Info' )); + +OC_APP::registerAdmin('admin_dependencies_chk','settings'); diff --git a/apps/admin_dependencies_chk/appinfo/info.xml b/apps/admin_dependencies_chk/appinfo/info.xml new file mode 100644 index 0000000000..10721ece15 --- /dev/null +++ b/apps/admin_dependencies_chk/appinfo/info.xml @@ -0,0 +1,11 @@ + + + admin_dependencies_chk + Owncloud dependencies info + 0.01 + AGPL + Brice Maron (eMerzh) + 2 + Display OwnCloud's dependencies informations (missings modules, ...) + + diff --git a/apps/admin_dependencies_chk/css/style.css b/apps/admin_dependencies_chk/css/style.css new file mode 100644 index 0000000000..30f204be7b --- /dev/null +++ b/apps/admin_dependencies_chk/css/style.css @@ -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; } diff --git a/apps/admin_dependencies_chk/settings.php b/apps/admin_dependencies_chk/settings.php new file mode 100644 index 0000000000..de2f97aa79 --- /dev/null +++ b/apps/admin_dependencies_chk/settings.php @@ -0,0 +1,96 @@ +. + * + */ +$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(); diff --git a/apps/admin_dependencies_chk/templates/settings.php b/apps/admin_dependencies_chk/templates/settings.php new file mode 100644 index 0000000000..8ff27ebb18 --- /dev/null +++ b/apps/admin_dependencies_chk/templates/settings.php @@ -0,0 +1,16 @@ +
+ t('Dependencies status');?> + +
\ No newline at end of file diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php index 3975fd15f8..45b16ae5fa 100644 --- a/apps/bookmarks/ajax/addBookmark.php +++ b/apps/bookmarks/ajax/addBookmark.php @@ -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) { diff --git a/apps/bookmarks/settings.php b/apps/bookmarks/settings.php index 8186472dec..0ace04fa2c 100644 --- a/apps/bookmarks/settings.php +++ b/apps/bookmarks/settings.php @@ -8,6 +8,6 @@ $tmpl = new OC_Template( 'bookmarks', 'settings'); -OC_Util::addScript('bookmarks','settings'); +//OC_Util::addScript('bookmarks','settings'); return $tmpl->fetchPage(); diff --git a/apps/calendar/lib/calendar.php b/apps/calendar/lib/calendar.php index 252ea66555..3db4398096 100644 --- a/apps/calendar/lib/calendar.php +++ b/apps/calendar/lib/calendar.php @@ -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'); } /** diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index 221df2b3af..ccc62d565e 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -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'); } /** diff --git a/apps/calendar/templates/part.eventform.php b/apps/calendar/templates/part.eventform.php index 8588b9168f..dfa5fb8c78 100644 --- a/apps/calendar/templates/part.eventform.php +++ b/apps/calendar/templates/part.eventform.php @@ -13,9 +13,7 @@    t("Calendar");?>: @@ -23,9 +21,7 @@ @@ -66,9 +62,7 @@ diff --git a/apps/contacts/ajax/getdetails.php b/apps/contacts/ajax/getdetails.php index 0e76de61af..260fb53a68 100644 --- a/apps/contacts/ajax/getdetails.php +++ b/apps/contacts/ajax/getdetails.php @@ -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 ))); diff --git a/apps/contacts/ajax/showaddcard.php b/apps/contacts/ajax/showaddcard.php index 2f534f0fe2..98367758fd 100644 --- a/apps/contacts/ajax/showaddcard.php +++ b/apps/contacts/ajax/showaddcard.php @@ -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 ))); diff --git a/apps/contacts/ajax/showsetproperty.php b/apps/contacts/ajax/showsetproperty.php index 6188f4773c..4ec3dd7d8e 100644 --- a/apps/contacts/ajax/showsetproperty.php +++ b/apps/contacts/ajax/showsetproperty.php @@ -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 ))); diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css index 68f843b7aa..ad64c777ee 100644 --- a/apps/contacts/css/styles.css +++ b/apps/contacts/css/styles.css @@ -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; } diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index 9270297f32..1cc3a5dfd6 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -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')); } }); diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php index 2e869d7de3..87477ed7ed 100644 --- a/apps/contacts/lib/addressbook.php +++ b/apps/contacts/lib/addressbook.php @@ -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'); } /** diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index 74bc0f92f1..56602f25c0 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -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'), + ); + } + } } diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php index 8e482cc4eb..037e3629bb 100644 --- a/apps/contacts/templates/part.addcardform.php +++ b/apps/contacts/templates/part.addcardform.php @@ -7,9 +7,7 @@
  • @@ -19,7 +17,7 @@
    1. -
      +
    2. @@ -46,14 +44,7 @@
    @@ -67,8 +58,7 @@
  • @@ -81,19 +71,19 @@
  • - +
  • - +
  • - +
  • - +
  • diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php index e9fa8356e8..f5bd75809b 100644 --- a/apps/contacts/templates/part.details.php +++ b/apps/contacts/templates/part.details.php @@ -27,15 +27,13 @@

    -


    +

    +
  • @@ -79,14 +76,7 @@

    diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php index afdba2bd75..811b9626ce 100644 --- a/apps/contacts/templates/part.setpropertyform.php +++ b/apps/contacts/templates/part.setpropertyform.php @@ -5,42 +5,48 @@

      +
    1. + + +
    2. - +
    3. - +
    4. - +
    5. - +
    6. - +
    7. - +
    8. - +
    -

    +

    - +

    diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index c0fc91e92a..4056d693bf 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -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 += ''; html += ''; 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')); } diff --git a/apps/media/lib_collection.php b/apps/media/lib_collection.php index 571cb7e685..caa3ac3f47 100644 --- a/apps/media/lib_collection.php +++ b/apps/media/lib_collection.php @@ -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); } diff --git a/apps/remoteStorage/lib_remoteStorage.php b/apps/remoteStorage/lib_remoteStorage.php index f10a72870a..4bbadafe7d 100644 --- a/apps/remoteStorage/lib_remoteStorage.php +++ b/apps/remoteStorage/lib_remoteStorage.php @@ -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().'"
    '; - $entry .= 'Offending command was: '.$result->getDebugInfo().'
    '; - 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().'"
    '; - $entry .= 'Offending command was: '.$result->getDebugInfo().'
    '; - 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().'"
    '; - $entry .= 'Offending command was: '.$result->getDebugInfo().'
    '; - 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().'"
    '; - $entry .= 'Offending command was: '.$result->getDebugInfo().'
    '; - OC_Log::write('removeStorage',$entry,OC_Log::ERROR); - die( $entry ); - } } public static function createDataScope($appUrl, $userAddress, $dataScope){ $token=uniqid(); diff --git a/apps/user_webfinger/webfinger.php b/apps/user_webfinger/webfinger.php index afb5368968..349afaba50 100644 --- a/apps/user_webfinger/webfinger.php +++ b/apps/user_webfinger/webfinger.php @@ -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"?> - + diff --git a/core/css/styles.css b/core/css/styles.css index 0f591859f3..d1c648383c 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -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; } diff --git a/core/img/actions/upload.png b/core/img/actions/upload.png new file mode 100644 index 0000000000..5744aad75a Binary files /dev/null and b/core/img/actions/upload.png differ diff --git a/core/img/actions/upload.svg b/core/img/actions/upload.svg new file mode 100644 index 0000000000..91333bb681 --- /dev/null +++ b/core/img/actions/upload.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/core/js/js.js b/core/js/js.js index 9e814ca072..5846d28988 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -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; }); +}; diff --git a/files/ajax/newfile.php b/files/ajax/newfile.php new file mode 100644 index 0000000000..5c4f49a367 --- /dev/null +++ b/files/ajax/newfile.php @@ -0,0 +1,27 @@ + 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" ))); \ No newline at end of file diff --git a/files/css/files.css b/files/css/files.css index ac1f523f86..22f4810d0a 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -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; } diff --git a/files/index.php b/files/index.php index 8bb5b618d8..4b3bbd1bfd 100644 --- a/files/index.php +++ b/files/index.php @@ -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() ); diff --git a/files/js/fileactions.js b/files/js/fileactions.js index f95c5e84dc..9e2688e82c 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -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()); diff --git a/files/js/filelist.js b/files/js/filelist.js index 863a3385d1..5740ece971 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -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=''; + var html=''; if(name.indexOf('.')!=-1){ var basename=name.substr(0,name.lastIndexOf('.')); var extention=name.substr(name.lastIndexOf('.')); @@ -29,16 +29,21 @@ FileList={ html+=''+simpleSize+''; html+=''+relative_modified_date(lastModified.getTime() / 1000)+''; html+=''; - 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=''; - html+=''+name+''; + html = $('').attr({ "data-type": "dir", "data-size": size, "data-file": name}); + td = $('').attr({"class": "filename", "style": 'background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')' }); + td.append(''); + var link_elem = $('').attr({ "class": "name", "href": "index.php?dir="+ encodeURIComponent($('#dir').val()+'/'+name) }); + link_elem.append($('').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+=''+simpleSize+''; - html+=''+relative_modified_date(lastModified.getTime() / 1000)+''; - html+=''; + 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 = $('').attr({ "class": "date" }); + td.append($('').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=$(''); + var input=$('').val(name); var 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; diff --git a/files/js/files.js b/files/js/files.js index 902c5e5493..4eaa098241 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -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;iul').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('

    '+$(element).data('text')+'

    '); + } + }); + }); + $('#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('

    '+$(element).data('text')+'

    '); + } + }); + + var type=$(this).data('type'); + var text=$(this).children('p').text(); + $(this).data('text',text); + $(this).children('p').remove(); + var 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('

    '+li.data('text')+'

    '); + $('#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'), diff --git a/files/templates/index.php b/files/templates/index.php index a63f6e62b6..722c38e477 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -2,20 +2,27 @@
    -
    - - - -
    - +
    + + t('New');?> + + +
    +
    + + + + + - -
    - - -
    - -
    + + + +
    diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 6bf5efe2fb..46830ba3a3 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -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; ?> - '> + '> diff --git a/lib/app.php b/lib/app.php index 30ebcf032b..d3d9986576 100644 --- a/lib/app.php +++ b/lib/app.php @@ -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' ); diff --git a/lib/base.php b/lib/base.php index d5fff1e0a7..c52b4493e0 100644 --- a/lib/base.php +++ b/lib/base.php @@ -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','&'); diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php index b049f39c17..98661dbb18 100644 --- a/lib/connector/sabre/file.php +++ b/lib/connector/sabre/file.php @@ -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'); } diff --git a/lib/db.php b/lib/db.php index 421b08c232..c059f5ab33 100644 --- a/lib/db.php +++ b/lib/db.php @@ -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); } /** diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 01523b6b0b..9e29f85071 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -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); diff --git a/lib/hook.php b/lib/hook.php index b069a7da6c..83a16106bf 100644 --- a/lib/hook.php +++ b/lib/hook.php @@ -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(); } diff --git a/lib/log.php b/lib/log.php index 98333be54f..446ddd4884 100644 --- a/lib/log.php +++ b/lib/log.php @@ -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){ diff --git a/lib/ocsclient.php b/lib/ocsclient.php index 654c5e0527..072fd236fe 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -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); diff --git a/lib/setup.php b/lib/setup.php index 2dcedb9b82..e2d56ddaf4 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -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); diff --git a/lib/template.php b/lib/template.php index 440b62003e..d1439199e1 100644 --- a/lib/template.php +++ b/lib/template.php @@ -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 .= ''; + } + return $html; +} /** * This class provides the templates for owncloud. diff --git a/settings/templates/help.php b/settings/templates/help.php index 4e3cdd7b90..754bf8b637 100644 --- a/settings/templates/help.php +++ b/settings/templates/help.php @@ -9,7 +9,10 @@ printPage(); + if($pageNavi) + { + $pageNavi->printPage(); + } ?>