t('You have no bookmarks');
- require_once(OC::$APPSROOT . '/apps/bookmarks/templates/bookmarklet.php');
+ require_once(OC_App::getAppPath('bookmarks') .'/templates/bookmarklet.php');
createBookmarklet();
?>
diff --git a/apps/calendar/ajax/calendar/new.php b/apps/calendar/ajax/calendar/new.php
index 278c8e5520..e77d4ebff0 100644
--- a/apps/calendar/ajax/calendar/new.php
+++ b/apps/calendar/ajax/calendar/new.php
@@ -31,7 +31,13 @@ OC_Calendar_Calendar::setCalendarActive($calendarid, 1);
$calendar = OC_Calendar_Calendar::find($calendarid);
$tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields');
$tmpl->assign('calendar', $calendar);
+if(OC_Calendar_Share::allUsersSharedwith($calendarid, OC_Calendar_Share::CALENDAR) == array()){
+ $shared = false;
+}else{
+ $shared = true;
+}
+$tmpl->assign('shared', $shared);
OCP\JSON::success(array(
'page' => $tmpl->fetchPage(),
'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar),
-));
\ No newline at end of file
+));
diff --git a/apps/calendar/ajax/calendar/update.php b/apps/calendar/ajax/calendar/update.php
index 5cf63d396f..a2c898c807 100644
--- a/apps/calendar/ajax/calendar/update.php
+++ b/apps/calendar/ajax/calendar/update.php
@@ -36,7 +36,13 @@ OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']);
$calendar = OC_Calendar_App::getCalendar($calendarid);
$tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields');
$tmpl->assign('calendar', $calendar);
+if(OC_Calendar_Share::allUsersSharedwith($calendarid, OC_Calendar_Share::CALENDAR) == array()){
+ $shared = false;
+}else{
+ $shared = true;
+}
+$tmpl->assign('shared', $shared);
OCP\JSON::success(array(
'page' => $tmpl->fetchPage(),
'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar),
-));
\ No newline at end of file
+));
diff --git a/apps/calendar/ajax/event/edit.form.php b/apps/calendar/ajax/event/edit.form.php
index 6e5709a18d..26a0cc2a60 100644
--- a/apps/calendar/ajax/event/edit.form.php
+++ b/apps/calendar/ajax/event/edit.form.php
@@ -27,6 +27,14 @@ $vevent = $object->VEVENT;
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
switch($dtstart->getDateType()) {
+ case Sabre_VObject_Property_DateTime::UTC:
+ $timeOffset = OC_Calendar_App::$tz*60;
+ $newDT = $dtstart->getDateTime();
+ $newDT->add(new DateInterval("PT" . $timeOffset . "M"));
+ $dtstart->setDateTime($newDT);
+ $newDT = $dtend->getDateTime();
+ $newDT->add(new DateInterval("PT" . $timeOffset . "M"));
+ $dtend->setDateTime($newDT);
case Sabre_VObject_Property_DateTime::LOCALTZ:
case Sabre_VObject_Property_DateTime::LOCAL:
$startdate = $dtstart->getDateTime()->format('d-m-Y');
diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php
index 7178358c7b..ae55cbc02d 100644
--- a/apps/calendar/ajax/events.php
+++ b/apps/calendar/ajax/events.php
@@ -22,7 +22,7 @@ $calendar_id = (is_null($calendar_id)?strip_tags($_GET['calendar_id']):$calendar
$start = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['start']):new DateTime('@' . $_GET['start']);
$end = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['end']):new DateTime('@' . $_GET['end']);
-$events = OC_Calendar_App::getrequestedEvents($calendar_id, $start, $end);
+$events = OC_Calendar_App::getrequestedEvents($_GET['calendar_id'], $start, $end);
$output = array();
foreach($events as $event){
$output = array_merge($output, OC_Calendar_App::generateEventOutput($event, $start, $end));
diff --git a/apps/calendar/appinfo/remote.php b/apps/calendar/appinfo/remote.php
index 3bd8737ee9..7ab546245f 100644
--- a/apps/calendar/appinfo/remote.php
+++ b/apps/calendar/appinfo/remote.php
@@ -7,8 +7,8 @@
*/
OCP\App::checkAppEnabled('calendar');
-if(substr($_SERVER["REQUEST_URI"],0,strlen(OC::$APPSWEBROOT . '/apps/calendar/caldav.php')) == OC::$APPSWEBROOT . '/apps/calendar/caldav.php'){
- $baseuri = OC::$APPSWEBROOT . '/apps/calendar/caldav.php';
+if(substr($_SERVER["REQUEST_URI"],0,strlen(OC_App::getAppWebPath('calendar').'/caldav.php')) == OC_App::getAppWebPath('calendar'). '/caldav.php'){
+ $baseuri = OC_App::getAppWebPath('calendar').'/caldav.php';
}
// only need authentication apps
diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js
index 3b1be59381..e17f88e38b 100644
--- a/apps/calendar/js/calendar.js
+++ b/apps/calendar/js/calendar.js
@@ -207,8 +207,7 @@ Calendar={
}
},
showCalDAVUrl:function(username, calname){
- $('#caldav_url').val(totalurl + '/' + username + '/' + calname);
- $('#caldav_url').val(encodeURI($('#caldav_url').val()));
+ $('#caldav_url').val(totalurl + '/' + username + '/' + decodeURIComponent(calname));
$('#caldav_url').show();
$("#caldav_url_close").show();
},
@@ -706,10 +705,12 @@ function ListView(element, calendar) {
if (delta) {
if (delta < 0){
addDays(t.start, -7);
+ addDays(t.end, -7);
if (!opt('weekends')) {
skipWeekend(t.start, delta < 0 ? -1 : 1);
}
}else{
+ addDays(t.start, 7);
addDays(t.end, 7);
if (!opt('weekends')) {
skipWeekend(t.end, delta < 0 ? -1 : 1);
diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php
index 167382a5e7..8e13b13b8a 100644
--- a/apps/calendar/lib/app.php
+++ b/apps/calendar/lib/app.php
@@ -338,6 +338,9 @@ class OC_Calendar_App{
$singleevents = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::EVENT, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r');
foreach($singleevents as $singleevent){
$event = OC_Calendar_Object::find($singleevent['eventid']);
+ if(!array_key_exists('summary', $event)){
+ $event['summary'] = self::$l10n->t('unnamed');
+ }
$event['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($event['id']) . ')';
$events[] = $event;
}
diff --git a/apps/calendar/lib/calendar.php b/apps/calendar/lib/calendar.php
index b725898858..1bfab5cd64 100644
--- a/apps/calendar/lib/calendar.php
+++ b/apps/calendar/lib/calendar.php
@@ -206,7 +206,7 @@ class OC_Calendar_Calendar{
$stmt->execute(array($id));
OCP\Util::emitHook('OC_Calendar', 'deleteCalendar', $id);
- if(count(self::allCalendars()) == 0) {
+ if(count(self::allCalendars(OCP\USER::getUser())) == 0) {
self::addCalendar(OCP\USER::getUser(),'Default calendar');
}
diff --git a/apps/calendar/lib/search.php b/apps/calendar/lib/search.php
index 6526b4223a..560330f65e 100644
--- a/apps/calendar/lib/search.php
+++ b/apps/calendar/lib/search.php
@@ -17,6 +17,9 @@ class OC_Search_Provider_Calendar extends OC_Search_Provider{
foreach($calendars as $calendar){
$objects = OC_Calendar_Object::all($calendar['id']);
foreach($objects as $object){
+ if($object['objecttype']!='VEVENT') {
+ continue;
+ }
if(substr_count(strtolower($object['summary']), strtolower($query)) > 0){
$calendardata = OC_VObject::parse($object['calendardata']);
$vevent = $calendardata->VEVENT;
@@ -37,7 +40,7 @@ class OC_Search_Provider_Calendar extends OC_Search_Provider{
$info = $l->t('Date') . ': ' . $start_dt->format('d.m.y H:i') . ' - ' . $end_dt->format('d.m.y H:i');
}
$link = OCP\Util::linkTo('calendar', 'index.php').'?showevent='.urlencode($object['id']);
- $results[]=new OC_Search_Result($object['summary'],$info, $link,$l->t('Cal.'));//$name,$text,$link,$type
+ $results[]=new OC_Search_Result($object['summary'],$info, $link,(string)$l->t('Cal.'));//$name,$text,$link,$type
}
}
}
diff --git a/apps/calendar/templates/part.choosecalendar.rowfields.php b/apps/calendar/templates/part.choosecalendar.rowfields.php
index 965523f847..4492ce731c 100644
--- a/apps/calendar/templates/part.choosecalendar.rowfields.php
+++ b/apps/calendar/templates/part.choosecalendar.rowfields.php
@@ -1,8 +1,21 @@
-
diff --git a/apps/contacts/appinfo/remote.php b/apps/contacts/appinfo/remote.php
index ef50e4ad39..5add3bc688 100644
--- a/apps/contacts/appinfo/remote.php
+++ b/apps/contacts/appinfo/remote.php
@@ -22,8 +22,8 @@
OCP\App::checkAppEnabled('contacts');
-if(substr($_SERVER["REQUEST_URI"],0,strlen(OC::$APPSWEBROOT . '/apps/contacts/carddav.php')) == OC::$APPSWEBROOT . '/apps/contacts/carddav.php'){
- $baseuri = OC::$APPSWEBROOT . '/apps/contacts/carddav.php';
+if(substr($_SERVER["REQUEST_URI"],0,strlen(OC_App::getAppWebPath('contacts').'/carddav.php')) == OC_App::getAppWebPath('contacts').'/carddav.php'){
+ $baseuri = OC_App::getAppWebPath('contacts').'/carddav.php';
}
// only need authentication apps
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index 8ab2a3fbb8..6f5602c211 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -77,7 +77,7 @@ Contacts={
}
},
showCardDAVUrl:function(username, bookname){
- $('#carddav_url').val(totalurl + '/' + username + '/' + bookname);
+ $('#carddav_url').val(totalurl + '/' + username + '/' + decodeURIComponent(bookname));
$('#carddav_url').show();
$('#carddav_url_close').show();
},
@@ -256,12 +256,14 @@ Contacts={
}
} else {
newid = id;
+ bookid = bookid?bookid:$('#contacts li[data-id="'+newid+'"]').data('bookid');
}
var localLoadContact = function(newid, bookid) {
if($('.contacts li').length > 0) {
- firstitem.addClass('active');
+ $('#contacts li[data-id="'+newid+'"]').addClass('active');
$.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':newid},function(jsondata){
if(jsondata.status == 'success'){
+ $('#contacts h3[data-id="'+bookid+'"]').trigger('click');
Contacts.UI.Card.loadContact(jsondata.data, bookid);
} else {
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
@@ -1503,7 +1505,7 @@ Contacts={
},
Contacts:{
// Reload the contacts list.
- update:function(){
+ update:function(id){
$.getJSON(OC.filePath('contacts', 'ajax', 'contacts.php'),{},function(jsondata){
if(jsondata.status == 'success'){
$('#contacts').html(jsondata.data.page).ready(function() {
@@ -1518,7 +1520,7 @@ Contacts={
})}, 100);
setTimeout(Contacts.UI.Contacts.lazyupdate, 500);*/
});
- Contacts.UI.Card.update();
+ Contacts.UI.Card.update(id);
}
else{
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
@@ -1707,5 +1709,5 @@ $(document).ready(function(){
$('#contacts_propertymenu_dropdown a').keydown(propertyMenuItem);
Contacts.UI.loadHandlers();
- Contacts.UI.Contacts.update();
+ Contacts.UI.Contacts.update(id);
});
diff --git a/apps/contacts/lib/search.php b/apps/contacts/lib/search.php
index 19330fa9be..5d9ca97e76 100644
--- a/apps/contacts/lib/search.php
+++ b/apps/contacts/lib/search.php
@@ -11,8 +11,8 @@ class OC_Search_Provider_Contacts extends OC_Search_Provider{
$vcards = OC_Contacts_VCard::all($addressbook['id']);
foreach($vcards as $vcard){
if(substr_count(strtolower($vcard['fullname']), strtolower($query)) > 0){
- $link = OCP\Util::linkTo('contacts', 'index.php').'?id='.urlencode($vcard['id']);
- $results[]=new OC_Search_Result($vcard['fullname'],'', $link,$l->t('Contact'));//$name,$text,$link,$type
+ $link = OCP\Util::linkTo('contacts', 'index.php').'&id='.urlencode($vcard['id']);
+ $results[]=new OC_Search_Result($vcard['fullname'],'', $link,(string)$l->t('Contact'));//$name,$text,$link,$type
}
}
}
diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php
index d16356d4a5..0d4219c9f2 100644
--- a/apps/contacts/templates/index.php
+++ b/apps/contacts/templates/index.php
@@ -1,6 +1,7 @@
diff --git a/apps/contacts/templates/part.chooseaddressbook.rowfields.php b/apps/contacts/templates/part.chooseaddressbook.rowfields.php
index 780920ea3c..2988bb44c5 100644
--- a/apps/contacts/templates/part.chooseaddressbook.rowfields.php
+++ b/apps/contacts/templates/part.chooseaddressbook.rowfields.php
@@ -2,10 +2,10 @@
" type="checkbox" onClick="Contacts.UI.Addressbooks.activation(this, )" >
-
+
|
- ');" title="t("CardDav Link"); ?>" class="svg action globe">
+ " class="svg action globe">
|
" title="t("Download"); ?>" class="svg action download">
diff --git a/apps/contacts/templates/part.contacts.php b/apps/contacts/templates/part.contacts.php
index f0b14c8e5f..c33c5832e8 100644
--- a/apps/contacts/templates/part.contacts.php
+++ b/apps/contacts/templates/part.contacts.php
@@ -3,7 +3,7 @@ foreach($_['books'] as $id => $addressbook) {
echo ''.$addressbook['displayname'].'';
echo '';
}
diff --git a/apps/contacts/thumbnail.php b/apps/contacts/thumbnail.php
index da4e930f3e..8378507163 100644
--- a/apps/contacts/thumbnail.php
+++ b/apps/contacts/thumbnail.php
@@ -23,6 +23,7 @@
OCP\JSON::checkLoggedIn();
//OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
+session_close_write();
function getStandardImage(){
//OCP\Response::setExpiresHeader('P10D');
diff --git a/apps/files/templates/part.breadcrumb.php b/apps/files/templates/part.breadcrumb.php
index 43fe2d1fa9..22d9bb4490 100644
--- a/apps/files/templates/part.breadcrumb.php
+++ b/apps/files/templates/part.breadcrumb.php
@@ -1,6 +1,6 @@
svg" data-dir='' style='background-image:url("")'>
- ">
+ ">
diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php
index 4c0ffa978e..849e88ee0b 100644
--- a/apps/files_encryption/lib/crypt.php
+++ b/apps/files_encryption/lib/crypt.php
@@ -44,18 +44,16 @@ class OC_Crypt {
}
public static function init($login,$password) {
- $view1=new OC_FilesystemView('/');
- if(!$view1->file_exists('/'.$login)){
- $view1->mkdir('/'.$login);
+ $view=new OC_FilesystemView('/');
+ if(!$view->file_exists('/'.$login)){
+ $view->mkdir('/'.$login);
}
- $view=new OC_FilesystemView('/'.$login);
-
OC_FileProxy::$enabled=false;
- if(!$view->file_exists('/encryption.key')){// does key exist?
+ if(!$view->file_exists('/'.$login.'/encryption.key')){// does key exist?
OC_Crypt::createkey($login,$password);
}
- $key=$view->file_get_contents('/encryption.key');
+ $key=$view->file_get_contents('/'.$login.'/encryption.key');
OC_FileProxy::$enabled=true;
$_SESSION['enckey']=OC_Crypt::decrypt($key, $password);
}
@@ -206,12 +204,16 @@ class OC_Crypt {
/**
* decrypt data in 8192b sized blocks
*/
- public static function blockDecrypt($data, $key=''){
+ public static function blockDecrypt($data, $key='',$maxLength=0){
$result='';
while(strlen($data)){
$result.=self::decrypt(substr($data,0,8192),$key);
$data=substr($data,8192);
}
- return rtrim($result, "\0");
+ if($maxLength>0){
+ return substr($result,0,$maxLength);
+ }else{
+ return rtrim($result, "\0");
+ }
}
}
diff --git a/apps/files_encryption/lib/cryptstream.php b/apps/files_encryption/lib/cryptstream.php
index 64fec381de..e002053756 100644
--- a/apps/files_encryption/lib/cryptstream.php
+++ b/apps/files_encryption/lib/cryptstream.php
@@ -35,6 +35,7 @@ class OC_CryptStream{
private $meta=array();//header/meta for source stream
private $count;
private $writeCache;
+ private $size;
private static $rootView;
public function stream_open($path, $mode, $options, &$opened_path){
@@ -45,8 +46,14 @@ class OC_CryptStream{
if(dirname($path)=='streams' and isset(self::$sourceStreams[basename($path)])){
$this->source=self::$sourceStreams[basename($path)]['stream'];
$this->path=self::$sourceStreams[basename($path)]['path'];
+ $this->size=self::$sourceStreams[basename($path)]['size'];
}else{
$this->path=$path;
+ if($mode=='w' or $mode=='w+' or $mode=='wb' or $mode=='wb+'){
+ $this->size=0;
+ }else{
+ $this->size=self::$rootView->filesize($path,$mode);
+ }
OC_FileProxy::$enabled=false;//disable fileproxies so we can open the source file
$this->source=self::$rootView->fopen($path,$mode);
OC_FileProxy::$enabled=true;
@@ -77,14 +84,16 @@ class OC_CryptStream{
OCP\Util::writeLog('files_encryption','php bug 21641 no longer holds, decryption will not work',OCP\Util::FATAL);
die();
}
+ $pos=ftell($this->source);
$data=fread($this->source,8192);
if(strlen($data)){
$result=OC_Crypt::decrypt($data);
}else{
$result='';
}
- if($this->stream_eof()){
- $result=rtrim($result, "\0");
+ $length=$this->size-$pos;
+ if($length<8192){
+ $result=substr($result,0,$length);
}
return $result;
}
@@ -106,8 +115,9 @@ class OC_CryptStream{
$data=substr($block,0,$currentPos%8192).$data;
fseek($this->source,-($currentPos%8192),SEEK_CUR);
}
- while(strlen($data)>0){
- if(strlen($data)<8192){
+ $currentPos=ftell($this->source);
+ while($remainingLength=strlen($data)>0){
+ if($remainingLength<8192){
$this->writeCache=$data;
$data='';
}else{
@@ -116,6 +126,7 @@ class OC_CryptStream{
$data=substr($data,8192);
}
}
+ $this->size=max($this->size,$currentPos+$length);
return $length;
}
@@ -159,7 +170,7 @@ class OC_CryptStream{
public function stream_close(){
$this->flush();
if($this->meta['mode']!='r' and $this->meta['mode']!='rb'){
- OC_FileCache::put($this->path,array('encrypted'=>true),'');
+ OC_FileCache::put($this->path,array('encrypted'=>true,'size'=>$this->size),'');
}
return fclose($this->source);
}
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index b9e719448a..f25e4a662f 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -66,15 +66,17 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
public function preFile_put_contents($path,&$data){
if(self::shouldEncrypt($path)){
if (!is_resource($data)) {//stream put contents should have been converter to fopen
+ $size=strlen($data);
$data=OC_Crypt::blockEncrypt($data);
- OC_FileCache::put($path,array('encrypted'=>true),'');
+ OC_FileCache::put($path,array('encrypted'=>true,'size'=>$size),'');
}
}
}
public function postFile_get_contents($path,$data){
if(self::isEncrypted($path)){
- $data=OC_Crypt::blockDecrypt($data);
+ $cached=OC_FileCache_Cached::get($path,'');
+ $data=OC_Crypt::blockDecrypt($data,'',$cached['size']);
}
return $data;
}
@@ -108,4 +110,21 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
}
return $mime;
}
+
+ public function postStat($path,$data){
+ if(self::isEncrypted($path)){
+ $cached=OC_FileCache_Cached::get($path,'');
+ $data['size']=$cached['size'];
+ }
+ return $data;
+ }
+
+ public function postFileSize($path,$size){
+ if(self::isEncrypted($path)){
+ $cached=OC_FileCache_Cached::get($path,'');
+ return $cached['size'];
+ }else{
+ return $size;
+ }
+ }
}
diff --git a/apps/files_encryption/tests/encryption.php b/apps/files_encryption/tests/encryption.php
index 70aa1daf4c..286770a69f 100644
--- a/apps/files_encryption/tests/encryption.php
+++ b/apps/files_encryption/tests/encryption.php
@@ -66,7 +66,7 @@ class Test_Encryption extends UnitTestCase {
$this->assertEqual($decrypted,$source);
$encrypted=OC_Crypt::blockEncrypt($source,$key);
- $decrypted=OC_Crypt::blockDecrypt($encrypted,$key);
+ $decrypted=OC_Crypt::blockDecrypt($encrypted,$key,strlen($source));
$this->assertEqual($decrypted,$source);
}
}
diff --git a/apps/files_encryption/tests/proxy.php b/apps/files_encryption/tests/proxy.php
index 5616e2091a..fcfc4cfb9f 100644
--- a/apps/files_encryption/tests/proxy.php
+++ b/apps/files_encryption/tests/proxy.php
@@ -8,10 +8,12 @@
class Test_CryptProxy extends UnitTestCase {
private $oldConfig;
+ private $oldKey;
public function setUp(){
$this->oldConfig=OCP\Config::getAppValue('files_encryption','enable_encryption','true');
OCP\Config::setAppValue('files_encryption','enable_encryption','true');
+ $this->oldKey=isset($_SESSION['enckey'])?$_SESSION['enckey']:null;
//set testing key
@@ -36,6 +38,9 @@ class Test_CryptProxy extends UnitTestCase {
public function tearDown(){
OCP\Config::setAppValue('files_encryption','enable_encryption',$this->oldConfig);
+ if(!is_null($this->oldKey)){
+ $_SESSION['enckey']=$this->oldKey;
+ }
}
public function testSimple(){
@@ -50,6 +55,7 @@ class Test_CryptProxy extends UnitTestCase {
$fromFile=OC_Filesystem::file_get_contents('/file');
$this->assertNotEqual($original,$stored);
+ $this->assertEqual(strlen($original),strlen($fromFile));
$this->assertEqual($original,$fromFile);
}
@@ -88,6 +94,20 @@ class Test_CryptProxy extends UnitTestCase {
$fromFile=OC_Filesystem::file_get_contents('/file');
$this->assertNotEqual($original,$stored);
+ $this->assertEqual(strlen($original),strlen($fromFile));
$this->assertEqual($original,$fromFile);
+
+ $file=__DIR__.'/zeros';
+ $original=file_get_contents($file);
+
+ OC_Filesystem::file_put_contents('/file',$original);
+
+ OC_FileProxy::$enabled=false;
+ $stored=OC_Filesystem::file_get_contents('/file');
+ OC_FileProxy::$enabled=true;
+
+ $fromFile=OC_Filesystem::file_get_contents('/file');
+ $this->assertNotEqual($original,$stored);
+ $this->assertEqual(strlen($original),strlen($fromFile));
}
}
diff --git a/apps/files_encryption/tests/stream.php b/apps/files_encryption/tests/stream.php
index 4ffeb6210a..d95ea792f7 100644
--- a/apps/files_encryption/tests/stream.php
+++ b/apps/files_encryption/tests/stream.php
@@ -10,23 +10,23 @@ class Test_CryptStream extends UnitTestCase {
private $tmpFiles=array();
function testStream(){
- $stream=$this->getStream('test1','w');
+ $stream=$this->getStream('test1','w',strlen('foobar'));
fwrite($stream,'foobar');
fclose($stream);
- $stream=$this->getStream('test1','r');
+ $stream=$this->getStream('test1','r',strlen('foobar'));
$data=fread($stream,6);
fclose($stream);
$this->assertEqual('foobar',$data);
$file=OC::$SERVERROOT.'/3rdparty/MDB2.php';
$source=fopen($file,'r');
- $target=$this->getStream('test2','w');
+ $target=$this->getStream('test2','w',0);
OCP\Files::streamCopy($source,$target);
fclose($target);
fclose($source);
- $stream=$this->getStream('test2','r');
+ $stream=$this->getStream('test2','r',filesize($file));
$data=stream_get_contents($stream);
$original=file_get_contents($file);
$this->assertEqual(strlen($original),strlen($data));
@@ -37,9 +37,10 @@ class Test_CryptStream extends UnitTestCase {
* get a cryptstream to a temporary file
* @param string $id
* @param string $mode
+ * @param int size
* @return resource
*/
- function getStream($id,$mode){
+ function getStream($id,$mode,$size){
if($id===''){
$id=uniqid();
}
@@ -50,7 +51,7 @@ class Test_CryptStream extends UnitTestCase {
$file=$this->tmpFiles[$id];
}
$stream=fopen($file,$mode);
- OC_CryptStream::$sourceStreams[$id]=array('path'=>'dummy'.$id,'stream'=>$stream);
+ OC_CryptStream::$sourceStreams[$id]=array('path'=>'dummy'.$id,'stream'=>$stream,'size'=>$size);
return fopen('crypt://streams/'.$id,$mode);
}
@@ -58,11 +59,24 @@ class Test_CryptStream extends UnitTestCase {
$file=__DIR__.'/binary';
$source=file_get_contents($file);
- $stream=$this->getStream('test','w');
+ $stream=$this->getStream('test','w',strlen($source));
fwrite($stream,$source);
fclose($stream);
- $stream=$this->getStream('test','r');
+ $stream=$this->getStream('test','r',strlen($source));
+ $data=stream_get_contents($stream);
+ fclose($stream);
+ $this->assertEqual(strlen($data),strlen($source));
+ $this->assertEqual($source,$data);
+
+ $file=__DIR__.'/zeros';
+ $source=file_get_contents($file);
+
+ $stream=$this->getStream('test2','w',strlen($source));
+ fwrite($stream,$source);
+ fclose($stream);
+
+ $stream=$this->getStream('test2','r',strlen($source));
$data=stream_get_contents($stream);
fclose($stream);
$this->assertEqual(strlen($data),strlen($source));
diff --git a/apps/files_encryption/tests/zeros b/apps/files_encryption/tests/zeros
new file mode 100644
index 0000000000..ff982acf42
Binary files /dev/null and b/apps/files_encryption/tests/zeros differ
diff --git a/apps/files_external/js/google.js b/apps/files_external/js/google.js
index 0d65cfda01..84c74c5742 100644
--- a/apps/files_external/js/google.js
+++ b/apps/files_external/js/google.js
@@ -11,7 +11,7 @@ $(document).ready(function() {
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
params[key] = value;
});
- if (params['oauth_token'].length > 1 && decodeURIComponent(params['oauth_token']) == $(token).val() && params['oauth_verifier'].length > 1) {
+ if (params['oauth_token'] !== undefined && params['oauth_verifier'] !== undefined && decodeURIComponent(params['oauth_token']) == $(token).val()) {
var tr = $(this);
$.post(OC.filePath('files_external', 'ajax', 'google.php'), { step: 2, oauth_verifier: params['oauth_verifier'], request_token: $(token).val(), request_token_secret: $(token_secret).val() }, function(result) {
if (result && result.status == 'success') {
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 870c13b5ae..5b9e00a378 100755
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -157,12 +157,17 @@ class OC_Mount_Config {
*/
public static function removeMountPoint($mountPoint, $mountType, $applicable, $isPersonal = false) {
// Verify that the mount point applies for the current user
- if ($isPersonal && $applicable != OCP\User::getUser()) {
- return false;
+ if ($isPersonal) {
+ if ($applicable != OCP\User::getUser()) {
+ return false;
+ }
+ $mountPoint = '/'.$applicable.'/files/'.ltrim($mountPoint, '/');
+ } else {
+ $mountPoint = '/$user/files/'.ltrim($mountPoint, '/');
}
$mountPoints = self::readData($isPersonal);
// Remove mount point
- unset($mountPoints[$mountType][$applicable]['/$user/files/'.$mountPoint]);
+ unset($mountPoints[$mountType][$applicable][$mountPoint]);
// Unset parent arrays if empty
if (empty($mountPoints[$mountType][$applicable])) {
unset($mountPoints[$mountType][$applicable]);
diff --git a/apps/files_imageviewer/css/jquery.fancybox-1.3.4.css b/apps/files_imageviewer/css/jquery.fancybox-1.3.4.css
index 5fdf7af14c..6e982805a4 100644
--- a/apps/files_imageviewer/css/jquery.fancybox-1.3.4.css
+++ b/apps/files_imageviewer/css/jquery.fancybox-1.3.4.css
@@ -35,7 +35,7 @@
left: 0;
width: 40px;
height: 480px;
- background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
+ background-image: url('%appswebroot%/files_imageviewer/img/fancybox.png');
}
#fancybox-overlay {
@@ -99,7 +99,7 @@
right: -15px;
width: 30px;
height: 30px;
- background: transparent url('%appswebroot%/apps/files_imageviewer/img/fancybox.png') -40px 0px;
+ background: transparent url('%appswebroot%/files_imageviewer/img/fancybox.png') -40px 0px;
cursor: pointer;
z-index: 1103;
display: none;
@@ -137,7 +137,7 @@
width: 35%;
cursor: pointer;
outline: none;
- background: transparent url('%appswebroot%/apps/files_imageviewer/img/blank.gif');
+ background: transparent url('%appswebroot%/files_imageviewer/img/blank.gif');
z-index: 1102;
display: none;
}
@@ -163,12 +163,12 @@
}
#fancybox-left-ico {
- background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
+ background-image: url('%appswebroot%/files_imageviewer/img/fancybox.png');
background-position: -40px -30px;
}
#fancybox-right-ico {
- background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
+ background-image: url('%appswebroot%/files_imageviewer/img/fancybox.png');
background-position: -40px -60px;
}
@@ -199,13 +199,13 @@
top: -20px;
left: 0;
width: 100%;
- background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox-x.png');
+ background-image: url('%appswebroot%/files_imageviewer/img/fancybox-x.png');
}
#fancybox-bg-ne {
top: -20px;
right: -20px;
- background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
+ background-image: url('%appswebroot%/files_imageviewer/img/fancybox.png');
background-position: -40px -162px;
}
@@ -213,14 +213,14 @@
top: 0;
right: -20px;
height: 100%;
- background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox-y.png');
+ background-image: url('%appswebroot%/files_imageviewer/img/fancybox-y.png');
background-position: -20px 0px;
}
#fancybox-bg-se {
bottom: -20px;
right: -20px;
- background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
+ background-image: url('%appswebroot%/files_imageviewer/img/fancybox.png');
background-position: -40px -182px;
}
@@ -228,14 +228,14 @@
bottom: -20px;
left: 0;
width: 100%;
- background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox-x.png');
+ background-image: url('%appswebroot%/files_imageviewer/img/fancybox-x.png');
background-position: 0px -20px;
}
#fancybox-bg-sw {
bottom: -20px;
left: -20px;
- background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
+ background-image: url('%appswebroot%/files_imageviewer/img/fancybox.png');
background-position: -40px -142px;
}
@@ -243,13 +243,13 @@
top: 0;
left: -20px;
height: 100%;
- background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox-y.png');
+ background-image: url('%appswebroot%/files_imageviewer/img/fancybox-y.png');
}
#fancybox-bg-nw {
top: -20px;
left: -20px;
- background-image: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png');
+ background-image: url('%appswebroot%/files_imageviewer/img/fancybox.png');
background-position: -40px -122px;
}
@@ -282,7 +282,7 @@
#fancybox-title-over {
padding: 10px;
- background-image: url('%appswebroot%/apps/files_imageviewer/img/fancy_title_over.png');
+ background-image: url('%appswebroot%/files_imageviewer/img/fancy_title_over.png');
display: block;
}
@@ -306,7 +306,7 @@
#fancybox-title-float-left {
padding: 0 0 0 15px;
- background: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png') -40px -90px no-repeat;
+ background: url('%appswebroot%/files_imageviewer/img/fancybox.png') -40px -90px no-repeat;
}
#fancybox-title-float-main {
@@ -314,25 +314,25 @@
line-height: 29px;
font-weight: bold;
padding: 0 0 3px 0;
- background: url('%appswebroot%/apps/files_imageviewer/img/fancybox-x.png') 0px -40px;
+ background: url('%appswebroot%/files_imageviewer/img/fancybox-x.png') 0px -40px;
}
#fancybox-title-float-right {
padding: 0 0 0 15px;
- background: url('%appswebroot%/apps/files_imageviewer/img/fancybox.png') -55px -90px no-repeat;
+ background: url('%appswebroot%/files_imageviewer/img/fancybox.png') -55px -90px no-repeat;
}
/* IE6 */
-.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_close.png', sizingMethod='scale'); }
+.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_close.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_nav_left.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_nav_right.png', sizingMethod='scale'); }
+.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_nav_left.png', sizingMethod='scale'); }
+.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_nav_right.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_title_over.png', sizingMethod='scale'); zoom: 1; }
-.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_title_left.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_title_main.png', sizingMethod='scale'); }
-.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_title_right.png', sizingMethod='scale'); }
+.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_title_over.png', sizingMethod='scale'); zoom: 1; }
+.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_title_left.png', sizingMethod='scale'); }
+.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_title_main.png', sizingMethod='scale'); }
+.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_title_right.png', sizingMethod='scale'); }
.fancybox-ie6 #fancybox-bg-w, .fancybox-ie6 #fancybox-bg-e, .fancybox-ie6 #fancybox-left, .fancybox-ie6 #fancybox-right, #fancybox-hide-sel-frame {
height: expression(this.parentNode.clientHeight + "px");
@@ -343,17 +343,17 @@
top: expression( (-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px');
}
-#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_loading.png', sizingMethod='scale'); }
+#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_loading.png', sizingMethod='scale'); }
/* IE6, IE7, IE8 */
.fancybox-ie .fancybox-bg { background: transparent !important; }
-.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_n.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_ne.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_e.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_se.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_s.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_sw.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_w.png', sizingMethod='scale'); }
-.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/apps/files_imageviewer/img/fancy_shadow_nw.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_shadow_n.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_shadow_ne.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_shadow_e.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_shadow_se.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_shadow_s.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_shadow_sw.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_shadow_w.png', sizingMethod='scale'); }
+.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%appswebroot%/files_imageviewer/img/fancy_shadow_nw.png', sizingMethod='scale'); }
diff --git a/apps/files_pdfviewer/js/pdfjs/viewer.js b/apps/files_pdfviewer/js/pdfjs/viewer.js
index 8a568e6a74..f49257d792 100644
--- a/apps/files_pdfviewer/js/pdfjs/viewer.js
+++ b/apps/files_pdfviewer/js/pdfjs/viewer.js
@@ -1871,70 +1871,4 @@ window.addEventListener('DOMMouseScroll', function(evt) {
}
}, false);
-window.addEventListener('keydown', function keydown(evt) {
- var handled = false;
- var cmd = (evt.ctrlKey ? 1 : 0) |
- (evt.altKey ? 2 : 0) |
- (evt.shiftKey ? 4 : 0) |
- (evt.metaKey ? 8 : 0);
- // First, handle the key bindings that are independent whether an input
- // control is selected or not.
- if (cmd == 1 || cmd == 8) { // either CTRL or META key.
- switch (evt.keyCode) {
- case 61: // FF/Mac '='
- case 107: // FF '+' and '='
- case 187: // Chrome '+'
- PDFView.zoomIn();
- handled = true;
- break;
- case 109: // FF '-'
- case 189: // Chrome '-'
- PDFView.zoomOut();
- handled = true;
- break;
- case 48: // '0'
- PDFView.parseScale(kDefaultScale, true);
- handled = true;
- break;
- }
- }
-
- if (handled) {
- evt.preventDefault();
- return;
- }
-
- // Some shortcuts should not get handled if a control/input element
- // is selected.
- var curElement = document.activeElement;
- if (curElement && curElement.tagName == 'INPUT')
- return;
- var controlsElement = document.getElementById('controls');
- while (curElement) {
- if (curElement === controlsElement)
- return; // ignoring if the 'controls' element is focused
- curElement = curElement.parentNode;
- }
-
- if (cmd == 0) { // no control key pressed at all.
- switch (evt.keyCode) {
- case 37: // left arrow
- case 75: // 'k'
- case 80: // 'p'
- PDFView.page--;
- handled = true;
- break;
- case 39: // right arrow
- case 74: // 'j'
- case 78: // 'n'
- PDFView.page++;
- handled = true;
- break;
- }
- }
-
- if (handled) {
- evt.preventDefault();
- }
-});
diff --git a/apps/files_sharing/get.php b/apps/files_sharing/get.php
index 1ab8c6a257..40a90a1530 100644
--- a/apps/files_sharing/get.php
+++ b/apps/files_sharing/get.php
@@ -77,7 +77,7 @@ if (isset($_GET['token']) && $source = OC_Share::getSource($_GET['token'])) {
header("Content-Length: " . OC_Filesystem::filesize($source));
//download the file
@ob_clean();
- OCP\Util::emitHook('OC_Share', 'public-download', array('source'=>$source, 'token'=>$token);
+ OCP\Util::emitHook('OC_Share', 'public-download', array('source'=>$source, 'token'=>$token));
OC_Filesystem::readfile($source);
}
} else {
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php
index 62c86ee18e..fed1b834fa 100644
--- a/apps/files_sharing/sharedstorage.php
+++ b/apps/files_sharing/sharedstorage.php
@@ -25,7 +25,7 @@ require_once( 'lib_share.php' );
/**
* Convert target path to source path and pass the function call to the correct storage provider
*/
-class OC_Filestorage_Shared extends OC_Filestorage {
+class OC_Filestorage_Shared extends OC_Filestorage_Common {
private $datadir;
private $sourcePaths = array();
@@ -492,7 +492,7 @@ class OC_Filestorage_Shared extends OC_Filestorage {
return $this->searchInDir($query);
}
- private function searchInDir($query, $path = "") {
+ protected function searchInDir($query, $path = "") {
$files = array();
if ($dh = $this->opendir($path)) {
while (($filename = readdir($dh)) !== false) {
diff --git a/apps/files_texteditor/css/DroidSansMono/stylesheet.css b/apps/files_texteditor/css/DroidSansMono/stylesheet.css
index 5bf9122ed7..4d814b262d 100644
--- a/apps/files_texteditor/css/DroidSansMono/stylesheet.css
+++ b/apps/files_texteditor/css/DroidSansMono/stylesheet.css
@@ -4,11 +4,11 @@
@font-face {
font-family: 'Droid Sans Mono';
- src: url('%appswebroot%/apps/files_texteditor/css/DroidSansMono/DroidSansMono-webfont.eot');
- src: url('%appswebroot%/apps/files_texteditor/css/DroidSansMono/DroidSansMono-webfont.eot?#iefix') format('embedded-opentype'),
- url('%appswebroot%/apps/files_texteditor/css/DroidSansMono/DroidSansMono-webfont.woff') format('woff'),
- url('%appswebroot%/apps/files_texteditor/css/DroidSansMono/DroidSansMono-webfont.ttf') format('truetype'),
- url('%appswebroot%/apps/files_texteditor/css/DroidSansMono/DroidSansMono-webfont.svg#DroidSansMonoRegular') format('svg');
+ src: url('%appswebroot%/files_texteditor/css/DroidSansMono/DroidSansMono-webfont.eot');
+ src: url('%appswebroot%/files_texteditor/css/DroidSansMono/DroidSansMono-webfont.eot?#iefix') format('embedded-opentype'),
+ url('%appswebroot%/files_texteditor/css/DroidSansMono/DroidSansMono-webfont.woff') format('woff'),
+ url('%appswebroot%/files_texteditor/css/DroidSansMono/DroidSansMono-webfont.ttf') format('truetype'),
+ url('%appswebroot%/files_texteditor/css/DroidSansMono/DroidSansMono-webfont.svg#DroidSansMonoRegular') format('svg');
font-weight: normal;
font-style: normal;
diff --git a/apps/files_texteditor/css/style.css b/apps/files_texteditor/css/style.css
index d91a91d18d..82c57b88bb 100644
--- a/apps/files_texteditor/css/style.css
+++ b/apps/files_texteditor/css/style.css
@@ -1,16 +1,8 @@
#editor{
position: fixed;
display: block;
- top: 6.5em;
- left: 12.5em;
-}
-#editorwrapper{
- position: absolute;
- height: 0;
- width: 0;
- top: 41px;
- left: 160px;
- display: none;
+ top: 6.8em;
+ left: 13.5em;
}
#editor_save{
margin-left: 7px;
diff --git a/apps/files_texteditor/js/editor.js b/apps/files_texteditor/js/editor.js
index 70bb74a910..9d168c1c4f 100644
--- a/apps/files_texteditor/js/editor.js
+++ b/apps/files_texteditor/js/editor.js
@@ -67,7 +67,7 @@ function setSyntaxMode(ext){
function showControls(filename,writeperms){
// Loads the control bar at the top.
// Load the new toolbar.
- var editorbarhtml = ''+filename.replace(/, "<").replace(/>/, ">")+' ';
+ var editorbarhtml = ' ';
if(writeperms=="true"){
editorbarhtml += ' ';
}
diff --git a/apps/files_versions/js/settings-personal.js b/apps/files_versions/js/settings-personal.js
index d9456f3f2a..6ea8c1a950 100644
--- a/apps/files_versions/js/settings-personal.js
+++ b/apps/files_versions/js/settings-personal.js
@@ -1,51 +1,39 @@
-// $(document).ready(function(){
-// $('#versions').change( function(){
-// OC.msg.startSaving('#calendar .msg')
-// // Serialize the data
-// var post = $( '#timezone' ).serialize();
-// $.post( OC.filePath('calendar', 'ajax/settings', 'settimezone.php'), post, function(data){
-// //OC.msg.finishedSaving('#calendar .msg', data);
-// });
-// return false;
-// });
-// });
+// TODO: allow the button to be clicked only once
-$(document).ready(function(){
+$( document ).ready(function(){
//
- $('#expireAllBtn').click(function(){
+ $( '#expireAllBtn' ).click(
- // Prevent page from reloading
- event.preventDefault();
+ function( event ) {
- // Show loading gif
- $('.expireAllLoading').show();
-
- $.getJSON(
- OC.filePath('files_versions','ajax','expireAll.php'),
- function(result){
- if (result.status == 'success') {
- $('.expireAllLoading').hide();
- $('#expireAllBtn').html('Expiration successful');
- } else {
-
- // Cancel loading
- $('#expireAllBtn').html('Expiration failed');
-
- // Show Dialog
- OC.dialogs.alert(
- 'Something went wrong, your files may not have been expired',
- 'An error has occurred',
- function(){
- $('#expireAllBtn').html(t('files_versions', 'Expire all versions')+' ');
- }
-
- );
-
- }
- }
+ // Prevent page from reloading
+ event.preventDefault();
- );
-
- });
-
+ // Show loading gif
+ $('.expireAllLoading').show();
+
+ $.getJSON(
+ OC.filePath('files_versions','ajax','expireAll.php'),
+ function(result){
+ if (result.status == 'success') {
+ $('.expireAllLoading').hide();
+ $('#expireAllBtn').html('Expiration successful');
+ } else {
+
+ // Cancel loading
+ $('#expireAllBtn').html('Expiration failed');
+
+ // Show Dialog
+ OC.dialogs.alert(
+ 'Something went wrong, your files may not have been expired',
+ 'An error has occurred',
+ function(){
+ $('#expireAllBtn').html(t('files_versions', 'Expire all versions')+' ');
+ }
+ );
+ }
+ }
+ );
+ }
+ );
});
\ No newline at end of file
diff --git a/apps/files_versions/versions.php b/apps/files_versions/versions.php
index 7522538caf..9c0829ff1d 100644
--- a/apps/files_versions/versions.php
+++ b/apps/files_versions/versions.php
@@ -261,10 +261,8 @@ class Storage {
}
-
-
/**
- * expire old versions of a file.
+ * @brief Erase a file's versions which exceed the set quota
*/
public static function expire($filename) {
if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
@@ -298,90 +296,16 @@ class Storage {
}
/**
- * @brief erase all old versions of all user files
- * @return
+ * @brief Erase all old versions of all user files
+ * @return true/false
*/
public static function expireAll() {
-
- function deleteAll( $directory, $empty = false ) {
- // strip leading slash
- if( substr( $directory, 0, 1 ) == "/" ) {
-
- $directory = substr( $directory, 1 );
-
- }
-
- // strip trailing slash
- if( substr( $directory, -1) == "/" ) {
-
- $directory = substr( $directory, 0, -1 );
-
- }
-
- $view = new \OC_FilesystemView('');
-
- if ( !$view->file_exists( $directory ) || !$view->is_dir( $directory ) ) {
-
- return false;
-
- } elseif( !$view->is_readable( $directory ) ) {
-
- return false;
-
- } else {
-
- $foldername = \OCP\Config::getSystemValue('datadirectory') .'/' . \OCP\USER::getUser() .'/' . $directory; // have to set an absolute path for use with PHP's opendir as OC version doesn't work
-
- $directoryHandle = $view->opendir( \OCP\USER::getUser() . '/' . $directory );
-
- while ( $contents = readdir( $directoryHandle ) ) {
-
- if ( $contents != '.' && $contents != '..') {
-
- $path = $directory . "/" . $contents;
-
- if ( $view->is_dir( $path ) ) {
-
- deleteAll( $path );
-
- } else {
-
- $view->unlink( \OCP\USER::getUser() .'/' . $path ); // TODO: make unlink use same system path as is_dir
-
- }
- }
-
- }
-
- //$view->closedir( $directoryHandle ); // TODO: implement closedir in OC_FSV
-
- if ( $empty == false ) {
-
- if ( !$view->rmdir( $directory ) ) {
-
- return false;
-
- }
-
- }
-
- return true;
- }
-
- }
+ $view = new \OC_FilesystemView('');
$dir = \OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
- if ( deleteAll( $dir, true ) ) {
-
- return true;
-
- } else {
-
- return false;
-
- }
+ return $view->deleteAll( $dir, true );
}
diff --git a/apps/gallery/ajax/thumbnail.php b/apps/gallery/ajax/thumbnail.php
index 4fc9eba992..5bf1d420dc 100644
--- a/apps/gallery/ajax/thumbnail.php
+++ b/apps/gallery/ajax/thumbnail.php
@@ -23,6 +23,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('gallery');
+session_write_close();
require_once('apps/gallery/lib/managers.php');
diff --git a/apps/gallery/appinfo/update.php b/apps/gallery/appinfo/update.php
index a0997ab5e8..c1d2212742 100644
--- a/apps/gallery/appinfo/update.php
+++ b/apps/gallery/appinfo/update.php
@@ -7,5 +7,5 @@ if (version_compare($currentVersion, '0.5.0', '<')) {
$stmt = OCP\DB::prepare('DROP TABLE IF EXISTS *PREFIX*gallery_albums');
$stmt->execute();
- \OC_DB::createDbFromStructure(OC::$APPSROOT.'/apps/'.$appid.'/appinfo/database.xml');
+ \OC_DB::createDbFromStructure(OC_App::getAppPath($appid).'/appinfo/database.xml');
}
diff --git a/apps/gallery/css/sharing.css b/apps/gallery/css/sharing.css
index d061fc3e6c..4712369cc8 100644
--- a/apps/gallery/css/sharing.css
+++ b/apps/gallery/css/sharing.css
@@ -5,4 +5,4 @@ div.gallery_box:hover { color: black; }
div.gallery_box h1 {font-size: 17px; font-weight: normal;}
div#breadcrumb { border: 0; width: 70%; margin: 0 auto; padding: 25px 0; font-family: Verdana; text-align: center;}
span.breadcrumbelement { margin: 10px; margin-right: 0; cursor: pointer;}
-span.inside { background-image: url('%appswebroot%/apps/gallery/img/breadcrumb.png'); padding-left: 20px; background-position: left; background-repeat: no-repeat;}
+span.inside { background-image: url('%appswebroot%/gallery/img/breadcrumb.png'); padding-left: 20px; background-position: left; background-repeat: no-repeat;}
diff --git a/apps/gallery/lib/tiles.php b/apps/gallery/lib/tiles.php
index 2ff4fa5647..011168471f 100644
--- a/apps/gallery/lib/tiles.php
+++ b/apps/gallery/lib/tiles.php
@@ -141,7 +141,7 @@ class TileStack extends TileBase {
}
public function get() {
- $r = ' '.$this->stack_name.' ';
+ $r = ' '. \OCP\Util::sanitizeHTML($this->stack_name).' ';
for ($i = 0; $i < count($this->tiles_array); $i++) {
$top = rand(-5, 5);
$left = rand(-5, 5);
@@ -168,7 +168,7 @@ class TileStack extends TileBase {
}
public function getOnClickAction() {
- return 'javascript:openNewGal(\''.$this->stack_name.'\');';
+ return 'javascript:openNewGal(\''.\OCP\Util::sanitizeHTML($this->stack_name).'\');';
}
private $tiles_array;
diff --git a/apps/gallery/templates/index.php b/apps/gallery/templates/index.php
index 1890552fc0..c3b4a17854 100644
--- a/apps/gallery/templates/index.php
+++ b/apps/gallery/templates/index.php
@@ -1,6 +1,6 @@
diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php
index 500ac9beda..d6911fd1e1 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -12,7 +12,7 @@
@@ -47,7 +47,7 @@
diff --git a/core/templates/login.php b/core/templates/login.php
index a40bf5c330..985cf90c2a 100644
--- a/core/templates/login.php
+++ b/core/templates/login.php
@@ -7,7 +7,7 @@
- autocomplete="off" required />
+ autocomplete="off" required />
diff --git a/lib/app.php b/lib/app.php
index c08e977b03..486704a222 100755
--- a/lib/app.php
+++ b/lib/app.php
@@ -83,7 +83,7 @@ class OC_App{
* @param string app
*/
public static function loadApp($app){
- if(is_file(OC::$APPSROOT.'/apps/'.$app.'/appinfo/app.php')){
+ if(is_file(self::getAppPath($app).'/appinfo/app.php')){
require_once( $app.'/appinfo/app.php' );
}
}
@@ -143,6 +143,8 @@ class OC_App{
* get all enabled apps
*/
public static function getEnabledApps(){
+ if(!OC_Config::getValue('installed', false))
+ return array();
$apps=array('files');
$query = OC_DB::prepare( 'SELECT appid FROM *PREFIX*appconfig WHERE configkey = \'enabled\' AND configvalue=\'yes\'' );
$result=$query->execute();
@@ -327,11 +329,56 @@ class OC_App{
return $list;
}
+ /**
+ * Get the path where to install apps
+ */
+ public static function getInstallPath() {
+ if(OC_Config::getValue('appstoreenabled', true)==false) {
+ return false;
+ }
+
+ foreach(OC::$APPSROOTS as $dir) {
+ if(isset($dir['writable']) && $dir['writable']===true)
+ return $dir['path'];
+ }
+
+ OC_Log::write('core','No application directories are marked as writable.',OC_Log::ERROR);
+ return null;
+ }
+
+
+ protected static function findAppInDirectories($appid) {
+ foreach(OC::$APPSROOTS as $dir) {
+ if(file_exists($dir['path'].'/'.$appid)) {
+ return $dir;
+ }
+ }
+ }
+ /**
+ * Get the directory for the given app.
+ * If the app is defined in multiple directory, the first one is taken. (false if not found)
+ */
+ public static function getAppPath($appid) {
+ if( ($dir = self::findAppInDirectories($appid)) != false) {
+ return $dir['path'].'/'.$appid;
+ }
+ }
+
+ /**
+ * Get the path for the given app on the access
+ * If the app is defined in multiple directory, the first one is taken. (false if not found)
+ */
+ public static function getAppWebPath($appid) {
+ if( ($dir = self::findAppInDirectories($appid)) != false) {
+ return OC::$WEBROOT.$dir['url'].'/'.$appid;
+ }
+ }
+
/**
* get the last version of the app, either from appinfo/version or from appinfo/info.xml
*/
public static function getAppVersion($appid){
- $file=OC::$APPSROOT.'/apps/'.$appid.'/appinfo/version';
+ $file= self::getAppPath($appid).'/appinfo/version';
$version=@file_get_contents($file);
if($version){
return $version;
@@ -354,7 +401,7 @@ class OC_App{
if(isset(self::$appInfo[$appid])){
return self::$appInfo[$appid];
}
- $file=OC::$APPSROOT.'/apps/'.$appid.'/appinfo/info.xml';
+ $file= self::getAppPath($appid).'/appinfo/info.xml';
}
$data=array();
$content=@file_get_contents($file);
@@ -467,10 +514,12 @@ class OC_App{
*/
public static function getAllApps(){
$apps=array();
- $dh=opendir(OC::$APPSROOT.'/apps');
- while($file=readdir($dh)){
- if($file[0]!='.' and is_file(OC::$APPSROOT.'/apps/'.$file.'/appinfo/app.php')){
- $apps[]=$file;
+ foreach(OC::$APPSROOTS as $apps_dir) {
+ $dh=opendir($apps_dir['path']);
+ while($file=readdir($dh)){
+ if($file[0]!='.' and is_file($apps_dir['path'].'/'.$file.'/appinfo/app.php')){
+ $apps[]=$file;
+ }
}
}
return $apps;
@@ -536,24 +585,24 @@ class OC_App{
* @param string appid
*/
public static function updateApp($appid){
- if(file_exists(OC::$APPSROOT.'/apps/'.$appid.'/appinfo/database.xml')){
- OC_DB::updateDbFromStructure(OC::$APPSROOT.'/apps/'.$appid.'/appinfo/database.xml');
+ if(file_exists(self::getAppPath($appid).'/appinfo/database.xml')){
+ OC_DB::updateDbFromStructure(self::getAppPath($appid).'/appinfo/database.xml');
}
if(!self::isEnabled($appid)){
return;
}
- if(file_exists(OC::$APPSROOT.'/apps/'.$appid.'/appinfo/update.php')){
+ if(file_exists(self::getAppPath($appid).'/appinfo/update.php')){
self::loadApp($appid);
- include OC::$APPSROOT.'/apps/'.$appid.'/appinfo/update.php';
+ include self::getAppPath($appid).'/appinfo/update.php';
}
//set remote/public handelers
$appData=self::getAppInfo($appid);
foreach($appData['remote'] as $name=>$path){
- OCP\CONFIG::setAppValue('core', 'remote_'.$name, '/apps/'.$appid.'/'.$path);
+ OCP\CONFIG::setAppValue('core', 'remote_'.$name, $path);
}
foreach($appData['public'] as $name=>$path){
- OCP\CONFIG::setAppValue('core', 'public_'.$name, '/apps/'.$appid.'/'.$path);
+ OCP\CONFIG::setAppValue('core', 'public_'.$name, $appid.'/'.$path);
}
self::setAppTypes($appid);
diff --git a/lib/base.php b/lib/base.php
index b6ca19568f..870550f267 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -51,13 +51,9 @@ class OC{
*/
public static $THIRDPARTYWEBROOT = '';
/**
- * The installation path of the apps folder on the server (e.g. /srv/http/owncloud)
+ * The installation path array of the apps folder on the server (e.g. /srv/http/owncloud) 'path' and web path in 'url'
*/
- public static $APPSROOT = '';
- /**
- * the root path of the apps folder for http requests (e.g. owncloud)
- */
- public static $APPSWEBROOT = '';
+ public static $APPSROOTS = array();
/*
* requested app
*/
@@ -75,7 +71,11 @@ class OC{
*/
public static function autoload($className){
if(array_key_exists($className,OC::$CLASSPATH)){
- require_once OC::$CLASSPATH[$className];
+ /** @TODO: Remove this when necessary
+ Remove "apps/" from inclusion path for smooth migration to mutli app dir
+ */
+ $path = preg_replace('/apps\//','', OC::$CLASSPATH[$className]);
+ require_once $path;
}
elseif(strpos($className,'OC_')===0){
require_once strtolower(str_replace('_','/',substr($className,3)) . '.php');
@@ -132,29 +132,34 @@ class OC{
echo("3rdparty directory not found! Please put the ownCloud 3rdparty folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file.");
exit;
}
-
// search the apps folder
- if(OC_Config::getValue('appsroot', '')<>''){
- OC::$APPSROOT=OC_Config::getValue('appsroot', '');
- OC::$APPSWEBROOT=OC_Config::getValue('appsurl', '');
+ $config_paths = OC_Config::getValue('apps_paths', array());
+ if(! empty($config_paths)){
+ foreach($config_paths as $paths) {
+ if( isset($paths['url']) && isset($paths['path']))
+ OC::$APPSROOTS[] = $paths;
+ }
}elseif(file_exists(OC::$SERVERROOT.'/apps')){
- OC::$APPSROOT=OC::$SERVERROOT;
- OC::$APPSWEBROOT=OC::$WEBROOT;
+ OC::$APPSROOTS[] = array('path'=> OC::$SERVERROOT.'/apps', 'url' => '/apps/', 'writable' => true);
}elseif(file_exists(OC::$SERVERROOT.'/../apps')){
+ OC::$APPSROOTS[] = array('path'=> rtrim(dirname(OC::$SERVERROOT), '/').'/apps', 'url' => '/apps/', 'writable' => true);
OC::$APPSROOT=rtrim(dirname(OC::$SERVERROOT), '/');
- OC::$APPSWEBROOT=rtrim(dirname(OC::$WEBROOT), '/');
- }else{
+ }
+
+ if(empty(OC::$APPSROOTS)){
echo("apps directory not found! Please put the ownCloud apps folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file.");
exit;
}
+ $paths = array();
+ foreach( OC::$APPSROOTS as $path)
+ $paths[] = $path['path'];
// set the right include path
set_include_path(
OC::$SERVERROOT.'/lib'.PATH_SEPARATOR.
OC::$SERVERROOT.'/config'.PATH_SEPARATOR.
OC::$THIRDPARTYROOT.'/3rdparty'.PATH_SEPARATOR.
- OC::$APPSROOT.PATH_SEPARATOR.
- OC::$APPSROOT.'/apps'.PATH_SEPARATOR.
+ implode($paths,PATH_SEPARATOR).PATH_SEPARATOR.
get_include_path().PATH_SEPARATOR.
OC::$SERVERROOT
);
@@ -232,24 +237,25 @@ class OC{
}
public static function loadapp(){
- if(file_exists(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/index.php')){
- require_once(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/index.php');
+ if(file_exists(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/index.php')){
+ require_once(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/index.php');
}else{
trigger_error('The requested App was not found.', E_USER_ERROR);//load default app instead?
}
}
public static function loadfile(){
- if(file_exists(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE)){
+ if(file_exists(OC_App::getAppPath(OC::$REQUESTEDAPP) . '/' . OC::$REQUESTEDFILE)){
if(substr(OC::$REQUESTEDFILE, -3) == 'css'){
- $file = 'apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE;
+ $file = OC_App::getAppWebPath(OC::$REQUESTEDAPP). '/' . OC::$REQUESTEDFILE;
$minimizer = new OC_Minimizer_CSS();
- $minimizer->output(array(array(OC::$APPSROOT, OC::$APPSWEBROOT, $file)), $file);
+ $minimizer->output(array(array(OC_App::getAppPath(OC::$REQUESTEDAPP), OC_App::getAppWebPath(OC::$REQUESTEDAPP), OC::$REQUESTEDFILE)),$file);
exit;
}elseif(substr(OC::$REQUESTEDFILE, -3) == 'php'){
- require_once(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE);
+ require_once(OC_App::getAppPath(OC::$REQUESTEDAPP). '/' . OC::$REQUESTEDFILE);
}
}else{
+ die();
header('HTTP/1.0 404 Not Found');
exit;
}
@@ -391,8 +397,8 @@ class OC{
$_GET['getfile'] = $file;
}
if(!is_null(self::$REQUESTEDFILE)){
- $subdir = OC::$APPSROOT . '/apps/' . self::$REQUESTEDAPP . '/' . self::$REQUESTEDFILE;
- $parent = OC::$APPSROOT . '/apps/' . self::$REQUESTEDAPP;
+ $subdir = OC_App::getAppPath(OC::$REQUESTEDAPP) . '/' . self::$REQUESTEDFILE;
+ $parent = OC_App::getAppPath(OC::$REQUESTEDAPP);
if(!OC_Helper::issubdirectory($subdir, $parent)){
self::$REQUESTEDFILE = null;
header('HTTP/1.0 404 Not Found');
diff --git a/lib/cache/apc.php b/lib/cache/apc.php
index f814afbe49..b1ce87f526 100644
--- a/lib/cache/apc.php
+++ b/lib/cache/apc.php
@@ -44,3 +44,11 @@ class OC_Cache_APC {
}
}
}
+if(!function_exists('apc_exists')) {
+ function apc_exists($keys)
+ {
+ $result;
+ apc_fetch($keys, $result);
+ return $result;
+ }
+}
diff --git a/lib/config.php b/lib/config.php
index 9279549b1b..65f9fdc06b 100644
--- a/lib/config.php
+++ b/lib/config.php
@@ -152,23 +152,12 @@ class OC_Config{
*
* Saves the config to the config file.
*
- * Known flaws: Strings are not escaped properly
*/
public static function writeData(){
// Create a php file ...
- $content = " $value ){
- if( is_bool( $value )){
- $value = $value ? 'true' : 'false';
- $content .= "\"$key\" => $value,\n";
- }
- else{
- $value = str_replace( "'", "\\'", $value );
- $content .= "\"$key\" => '$value',\n";
- }
- }
- $content .= ");\n?>\n";
+ $content = "\n";
$filename = OC::$SERVERROOT."/config/config.php";
// Write the file
diff --git a/lib/connector/sabre/auth.php b/lib/connector/sabre/auth.php
index 1c7a84f0f2..ee68039162 100644
--- a/lib/connector/sabre/auth.php
+++ b/lib/connector/sabre/auth.php
@@ -33,7 +33,7 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
protected function validateUserPass($username, $password){
OC_Util::setUpFS();//login hooks may need early access to the filesystem
if(OC_User::login($username,$password)){
- OC_Util::setUpFS();
+ OC_Util::setUpFS($username);
return true;
}
else{
diff --git a/lib/filecache.php b/lib/filecache.php
index 9963a5a3ba..e3bcc7d000 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -68,14 +68,14 @@ class OC_FileCache{
$path=$root.$path;
$parent=self::getParentId($path);
$id=self::getId($path,'');
+ if(isset(OC_FileCache_Cached::$savedData[$path])){
+ $data=array_merge(OC_FileCache_Cached::$savedData[$path],$data);
+ unset(OC_FileCache_Cached::$savedData[$path]);
+ }
if($id!=-1){
self::update($id,$data);
return;
}
- if(isset(OC_FileCache_Cached::$savedData[$path])){
- $data=array_merge($data,OC_FileCache_Cached::$savedData[$path]);
- unset(OC_FileCache_Cached::$savedData[$path]);
- }
if(!isset($data['size']) or !isset($data['mtime'])){//save incomplete data for the next time we write it
OC_FileCache_Cached::$savedData[$path]=$data;
return;
diff --git a/lib/filestorage/common.php b/lib/filestorage/common.php
index f2a5775fd1..ba78fca80e 100644
--- a/lib/filestorage/common.php
+++ b/lib/filestorage/common.php
@@ -20,6 +20,18 @@
* License along with this library. If not, see .
*/
+/**
+ * Storage backend class for providing common filesystem operation methods
+ * which are not storage-backend specific.
+ *
+ * OC_Filestorage_Common is never used directly; it is extended by all other
+ * storage backends, where its methods may be overridden, and additional
+ * (backend-specific) methods are defined.
+ *
+ * Some OC_Filestorage_Common methods call functions which are first defined
+ * in classes which extend it, e.g. $this->stat() .
+ */
+
abstract class OC_Filestorage_Common extends OC_Filestorage {
public function __construct($parameters){}
@@ -87,6 +99,79 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
return $count>0;
}
// abstract public function fopen($path,$mode);
+
+ /**
+ * @brief Deletes all files and folders recursively within a directory
+ * @param $directory The directory whose contents will be deleted
+ * @param $empty Flag indicating whether directory will be emptied
+ * @returns true/false
+ *
+ * @note By default the directory specified by $directory will be
+ * deleted together with its contents. To avoid this set $empty to true
+ */
+ public function deleteAll( $directory, $empty = false ) {
+
+ // strip leading slash
+ if( substr( $directory, 0, 1 ) == "/" ) {
+
+ $directory = substr( $directory, 1 );
+
+ }
+
+ // strip trailing slash
+ if( substr( $directory, -1) == "/" ) {
+
+ $directory = substr( $directory, 0, -1 );
+
+ }
+
+ if ( !$this->file_exists( \OCP\USER::getUser() . '/' . $directory ) || !$this->is_dir( \OCP\USER::getUser() . '/' . $directory ) ) {
+
+ return false;
+
+ } elseif( !$this->is_readable( \OCP\USER::getUser() . '/' . $directory ) ) {
+
+ return false;
+
+ } else {
+
+ $directoryHandle = $this->opendir( \OCP\USER::getUser() . '/' . $directory );
+
+ while ( $contents = readdir( $directoryHandle ) ) {
+
+ if ( $contents != '.' && $contents != '..') {
+
+ $path = $directory . "/" . $contents;
+
+ if ( $this->is_dir( $path ) ) {
+
+ deleteAll( $path );
+
+ } else {
+
+ $this->unlink( \OCP\USER::getUser() .'/' . $path ); // TODO: make unlink use same system path as is_dir
+
+ }
+ }
+
+ }
+
+ //$this->closedir( $directoryHandle ); // TODO: implement closedir in OC_FSV
+
+ if ( $empty == false ) {
+
+ if ( !$this->rmdir( $directory ) ) {
+
+ return false;
+
+ }
+
+ }
+
+ return true;
+ }
+
+ }
public function getMimeType($path){
if(!$this->file_exists($path)){
return false;
diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php
index 44a2ab0f63..b2eba05151 100644
--- a/lib/filestorage/local.php
+++ b/lib/filestorage/local.php
@@ -2,7 +2,7 @@
/**
* for local filestore, we only have to map the paths
*/
-class OC_Filestorage_Local extends OC_Filestorage{
+class OC_Filestorage_Local extends OC_Filestorage_Common{
protected $datadir;
private static $mimetypes=null;
public function __construct($arguments){
@@ -172,7 +172,7 @@ class OC_Filestorage_Local extends OC_Filestorage{
return $this->datadir.$path;
}
- private function searchInDir($query,$dir=''){
+ protected function searchInDir($query,$dir=''){
$files=array();
foreach (scandir($this->datadir.$dir) as $item) {
if ($item == '.' || $item == '..') continue;
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index da622bcf92..99e08c50e7 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -252,6 +252,9 @@ class OC_FilesystemView {
public function unlink($path){
return $this->basicOperation('unlink',$path,array('delete'));
}
+ public function deleteAll( $directory, $empty = false ) {
+ return $this->basicOperation( 'deleteAll', $directory, array('delete'), $empty );
+ }
public function rename($path1,$path2){
$absolutePath1=$this->getAbsolutePath($path1);
$absolutePath2=$this->getAbsolutePath($path2);
diff --git a/lib/helper.php b/lib/helper.php
index 480c3fe930..37914b73e1 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -40,7 +40,7 @@ class OC_Helper {
if( $app != '' ){
$app .= '/';
// Check if the app is in the app folder
- if( file_exists( OC::$APPSROOT . '/apps/'. $app.$file )){
+ if( file_exists( OC_App::getAppPath($app).'/'.$file )){
if(substr($file, -3) == 'php' || substr($file, -3) == 'css'){
if(substr($app, -1, 1) == '/'){
$app = substr($app, 0, strlen($app) - 1);
@@ -48,7 +48,7 @@ class OC_Helper {
$urlLinkTo = OC::$WEBROOT . '/?app=' . $app;
$urlLinkTo .= ($file!='index.php')?'&getfile=' . urlencode($file):'';
}else{
- $urlLinkTo = OC::$APPSWEBROOT . '/apps/' . $app . $file;
+ $urlLinkTo = OC_App::getAppWebPath($app) . $file;
}
}
else{
@@ -150,8 +150,8 @@ class OC_Helper {
// Check if the app is in the app folder
if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image" )){
return OC::$WEBROOT."/themes/$theme/apps/$app/img/$image";
- }elseif( file_exists( OC::$APPSROOT."/apps/$app/img/$image" )){
- return OC::$APPSWEBROOT."/apps/$app/img/$image";
+ }elseif( file_exists(OC_App::getAppPath($app)."/img/$image" )){
+ return OC_App::getAppWebPath($app)."/img/$image";
}elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/themes/$theme/$app/img/$image" )){
return OC::$WEBROOT."/themes/$theme/$app/img/$image";
}elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/$app/img/$image" )){
diff --git a/lib/installer.php b/lib/installer.php
index 34c6f8c7bb..c0903f93d5 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -126,8 +126,6 @@ class OC_Installer{
return false;
}
$info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml',true);
- $basedir=OC::$APPSROOT.'/apps/'.$info['id'];
-
// check the code for not allowed calls
if(!OC_Installer::checkCode($info['id'],$extractDir)){
OC_Log::write('core','App can\'t be installed because of not allowed code in the App',OC_Log::ERROR);
@@ -153,6 +151,7 @@ class OC_Installer{
return false;
}
+ $basedir=OC_App::getInstallPath().'/'.$info['id'];
//check if the destination directory already exists
if(is_dir($basedir)){
OC_Log::write('core','App directory already exists',OC_Log::WARN);
@@ -197,10 +196,10 @@ class OC_Installer{
//set remote/public handelers
foreach($info['remote'] as $name=>$path){
- OCP\CONFIG::setAppValue('core', 'remote_'.$name, '/apps/'.$info['id'].'/'.$path);
+ OCP\CONFIG::setAppValue('core', 'remote_'.$name, $app.'/'.$path);
}
foreach($info['public'] as $name=>$path){
- OCP\CONFIG::setAppValue('core', 'public_'.$name, '/apps/'.$info['id'].'/'.$path);
+ OCP\CONFIG::setAppValue('core', 'public_'.$name, $app.'/'.$path);
}
OC_App::setAppTypes($info['id']);
@@ -287,22 +286,24 @@ class OC_Installer{
* This function installs all apps found in the 'apps' directory that should be enabled by default;
*/
public static function installShippedApps(){
- $dir = opendir( OC::$APPSROOT."/apps" );
- while( false !== ( $filename = readdir( $dir ))){
- if( substr( $filename, 0, 1 ) != '.' and is_dir(OC::$APPSROOT."/apps/$filename") ){
- if( file_exists( OC::$APPSROOT."/apps/$filename/appinfo/app.php" )){
- if(!OC_Installer::isInstalled($filename)){
- $info=OC_App::getAppInfo($filename);
- $enabled = isset($info['default_enable']);
- if( $enabled ){
- OC_Installer::installShippedApp($filename);
- OC_Appconfig::setValue($filename,'enabled','yes');
+ foreach(OC::$APPSROOTS as $app_dir) {
+ $dir = opendir( $app_dir['path'] );
+ while( false !== ( $filename = readdir( $dir ))){
+ if( substr( $filename, 0, 1 ) != '.' and is_dir($app_dir['path']."/$filename") ){
+ if( file_exists( $app_dir['path']."/$filename/appinfo/app.php" )){
+ if(!OC_Installer::isInstalled($filename)){
+ $info=OC_App::getAppInfo($filename);
+ $enabled = isset($info['default_enable']);
+ if( $enabled ){
+ OC_Installer::installShippedApp($filename);
+ OC_Appconfig::setValue($filename,'enabled','yes');
+ }
}
}
}
}
+ closedir( $dir );
}
- closedir( $dir );
}
/**
@@ -312,23 +313,23 @@ class OC_Installer{
*/
public static function installShippedApp($app){
//install the database
- if(is_file(OC::$APPSROOT."/apps/$app/appinfo/database.xml")){
- OC_DB::createDbFromStructure(OC::$APPSROOT."/apps/$app/appinfo/database.xml");
+ if(is_file(OC_App::getAppPath($app)."/appinfo/database.xml")){
+ OC_DB::createDbFromStructure(OC_App::getAppPath($app)."/appinfo/database.xml");
}
//run appinfo/install.php
- if(is_file(OC::$APPSROOT."/apps/$app/appinfo/install.php")){
- include(OC::$APPSROOT."/apps/$app/appinfo/install.php");
+ if(is_file(OC_App::getAppPath($app)."/appinfo/install.php")){
+ include(OC_App::getAppPath($app)."/appinfo/install.php");
}
$info=OC_App::getAppInfo($app);
OC_Appconfig::setValue($app,'installed_version',OC_App::getAppVersion($app));
//set remote/public handelers
foreach($info['remote'] as $name=>$path){
- OCP\CONFIG::setAppValue('core', 'remote_'.$name, '/apps/'.$app.'/'.$path);
+ OCP\CONFIG::setAppValue('core', 'remote_'.$name, $app.'/'.$path);
}
foreach($info['public'] as $name=>$path){
- OCP\CONFIG::setAppValue('core', 'public_'.$name, '/apps/'.$app.'/'.$path);
+ OCP\CONFIG::setAppValue('core', 'public_'.$name, $app.'/'.$path);
}
OC_App::setAppTypes($info['id']);
diff --git a/lib/json.php b/lib/json.php
index dfc0a7b894..4eab4fce9f 100644
--- a/lib/json.php
+++ b/lib/json.php
@@ -81,6 +81,15 @@ class OC_JSON{
self::encodedPrint($data);
}
+ /**
+ * Convert OC_L10N_String to string, for use in json encodings
+ */
+ protected static function to_string(&$value){
+ if ($value instanceof OC_L10N_String) {
+ $value = (string)$value;
+ }
+ }
+
/**
* Encode and print $data in json format
*/
@@ -89,6 +98,7 @@ class OC_JSON{
if($setContentType){
self::setContentTypeHeader();
}
+ array_walk_recursive($data, array('OC_JSON', 'to_string'));
echo json_encode($data);
}
}
diff --git a/lib/l10n.php b/lib/l10n.php
index 0f01e927ff..4acbc5dceb 100644
--- a/lib/l10n.php
+++ b/lib/l10n.php
@@ -289,8 +289,8 @@ class OC_L10N{
$i18ndir = OC::$SERVERROOT.'/core/l10n/';
if($app != ''){
// Check if the app is in the app folder
- if(file_exists(OC::$APPSROOT.'/apps/'.$app.'/l10n/')){
- $i18ndir = OC::$APPSROOT.'/apps/'.$app.'/l10n/';
+ if(file_exists(OC_App::getAppPath($app).'/l10n/')){
+ $i18ndir = OC_App::getAppPath($app).'/l10n/';
}
else{
$i18ndir = OC::$SERVERROOT.'/'.$app.'/l10n/';
diff --git a/lib/mimetypes.fixlist.php b/lib/mimetypes.fixlist.php
index a40fbd9e22..13e3f16b36 100644
--- a/lib/mimetypes.fixlist.php
+++ b/lib/mimetypes.fixlist.php
@@ -17,5 +17,6 @@ return array(
'xlsx'=>'application/msexcel',
'ppt'=>'application/mspowerpoint',
'pptx'=>'application/mspowerpoint',
- 'sgf' => 'application/sgf'
+ 'sgf' => 'application/sgf',
+ 'cdr' => 'application/coreldraw'
);
diff --git a/lib/minimizer/css.php b/lib/minimizer/css.php
index da502bfa9e..f8e84482bb 100644
--- a/lib/minimizer/css.php
+++ b/lib/minimizer/css.php
@@ -8,14 +8,21 @@ class OC_Minimizer_CSS extends OC_Minimizer
public function minimizeFiles($files) {
$css_out = '';
- $appswebroot = (string) OC::$APPSWEBROOT;
$webroot = (string) OC::$WEBROOT;
foreach($files as $file_info) {
$file = $file_info[0] . '/' . $file_info[2];
$css_out .= '/* ' . $file . ' */' . "\n";
$css = file_get_contents($file);
- if (strpos($file, OC::$APPSROOT) == 0) {
- $css = str_replace('%appswebroot%', $appswebroot, $css);
+
+ $in_root = false;
+ foreach(OC::$APPSROOTS as $app_root) {
+ if(strpos($file, $app_root['path']) === 0) {
+ $in_root = $webroot.$app_root['url'];
+ break;
+ }
+ }
+ if ($in_root !== false) {
+ $css = str_replace('%appswebroot%', $in_root, $css);
$css = str_replace('%webroot%', $webroot, $css);
}
$remote = $file_info[1];
diff --git a/lib/ocsclient.php b/lib/ocsclient.php
index 2888569ad1..951d761d7e 100644
--- a/lib/ocsclient.php
+++ b/lib/ocsclient.php
@@ -57,6 +57,9 @@ class OC_OCSClient{
* This function returns a list of all the application categories on the OCS server
*/
public static function getCategories(){
+ if(OC_Config::getValue('appstoreenabled', true)==false){
+ return NULL;
+ }
$url=OC_OCSClient::getAppStoreURL().'/content/categories';
$xml=@file_get_contents($url);
@@ -130,6 +133,9 @@ class OC_OCSClient{
* This function returns an applications from the OCS server
*/
public static function getApplication($id){
+ if(OC_Config::getValue('appstoreenabled', true)==false){
+ return NULL;
+ }
$url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id);
$xml=@file_get_contents($url);
@@ -157,31 +163,34 @@ class OC_OCSClient{
return $app;
}
- /**
- * @brief Get the download url for an application from the OCS server
- * @returns array with application data
- *
- * This function returns an download url for an applications from the OCS server
- */
- public static function getApplicationDownload($id,$item){
- $url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item);
+ /**
+ * @brief Get the download url for an application from the OCS server
+ * @returns array with application data
+ *
+ * This function returns an download url for an applications from the OCS server
+ */
+ public static function getApplicationDownload($id,$item){
+ if(OC_Config::getValue('appstoreenabled', true)==false){
+ return NULL;
+ }
+ $url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item);
- $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);
+ $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);
- $tmp=$data->data->content;
- $app=array();
- if(isset($tmp->downloadlink)) {
- $app['downloadlink']=$tmp->downloadlink;
+ $tmp=$data->data->content;
+ $app=array();
+ if(isset($tmp->downloadlink)) {
+ $app['downloadlink']=$tmp->downloadlink;
}else{
$app['downloadlink']='';
}
- return $app;
- }
+ return $app;
+ }
/**
diff --git a/lib/template.php b/lib/template.php
index 8fb0133b28..3b48c27b9b 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -242,10 +242,10 @@ class OC_Template{
// Check if it is a app template or not.
if( $app != "" ){
// Check if the app is in the app folder or in the root
- if( file_exists( OC::$APPSROOT."/apps/$app/templates/" )){
+ if( file_exists(OC_App::getAppPath($app)."/templates/" )){
// Check if the template is overwritten by the selected theme
if ($this->checkPathForTemplate(OC::$SERVERROOT."/themes/$theme/apps/$app/templates/", $name, $fext)) {
- }elseif ($this->checkPathForTemplate(OC::$APPSROOT."/apps/$app/templates/", $name, $fext)) {
+ }elseif ($this->checkPathForTemplate(OC_App::getAppPath($app)."/templates/", $name, $fext)) {
}
}else{
// Check if the template is overwritten by the selected theme
diff --git a/lib/templatelayout.php b/lib/templatelayout.php
index 1f82e82be7..d33a87e9e4 100644
--- a/lib/templatelayout.php
+++ b/lib/templatelayout.php
@@ -9,6 +9,7 @@
class OC_TemplateLayout extends OC_Template {
public function __construct( $renderas ){
// Decide which page we show
+
if( $renderas == 'user' ){
parent::__construct( 'core', 'layout.user' );
$this->assign('searchurl',OC_Helper::linkTo( 'search', 'index.php' ), false);
@@ -32,6 +33,12 @@ class OC_TemplateLayout extends OC_Template {
parent::__construct( 'core', 'layout.guest' );
}
+ $apps_paths = array();
+ foreach(OC_App::getEnabledApps() as $app){
+ $apps_paths[$app] = OC_App::getAppWebPath($app);
+ }
+ $this->assign( 'apps_paths', str_replace('\\/', '/',json_encode($apps_paths)),false ); // Ugly unescape slashes waiting for better solution
+
// Add the js files
$jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
$this->assign('jsfiles', array(), false);
@@ -44,19 +51,29 @@ class OC_TemplateLayout extends OC_Template {
// Add the css files
$cssfiles = self::findStylesheetFiles(OC_Util::$styles);
+
$this->assign('cssfiles', array());
foreach($cssfiles as $info) {
$root = $info[0];
$web = $info[1];
$file = $info[2];
$paths = explode('/', $file);
- if($root == OC::$APPSROOT && $paths[0] == 'apps'){
- $app = $paths[1];
+
+ $in_root = false;
+ foreach(OC::$APPSROOTS as $app_root) {
+ if($root == $app_root['path']) {
+ $in_root = true;
+ break;
+ }
+ }
+
+ if($in_root ) {
+ $app = $paths[0];
unset($paths[0]);
- unset($paths[1]);
$path = implode('/', $paths);
$this->append( 'cssfiles', OC_Helper::linkTo($app, $path));
- }else{
+ }
+ else {
$this->append( 'cssfiles', $web.'/'.$file);
}
}
@@ -89,10 +106,6 @@ class OC_TemplateLayout extends OC_Template {
// is it in 3rdparty?
if(self::appendIfExist($files, OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $style.'.css')) {
- // or in apps?
- }elseif(self::appendIfExist($files, OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$style$fext.css" )) {
- }elseif(self::appendIfExist($files, OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$style.css" )) {
-
// or in the owncloud root?
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "$style$fext.css" )) {
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "$style.css" )) {
@@ -102,8 +115,17 @@ class OC_TemplateLayout extends OC_Template {
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "core/$style.css" )) {
}else{
- echo('css file not found: style:'.$style.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
- die();
+ $append = false;
+ // or in apps?
+ foreach( OC::$APPSROOTS as $apps_dir)
+ {
+ if(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style$fext.css")) { $append =true; break; }
+ elseif(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style.css")) { $append =true; break; }
+ }
+ if(! $append) {
+ echo('css file not found: style:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
+ die();
+ }
}
}
// Add the theme css files. you can override the default values here
@@ -139,10 +161,6 @@ class OC_TemplateLayout extends OC_Template {
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script$fext.js" )) {
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script.js" )) {
- // Is it part of an app?
- }elseif(self::appendIfExist($files, OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$script$fext.js" )) {
- }elseif(self::appendIfExist($files, OC::$APPSROOT, OC::$APPSWEBROOT, "apps/$script.js" )) {
-
// Is it in the owncloud root but overwritten by the theme?
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script$fext.js" )) {
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script.js" )) {
@@ -160,9 +178,16 @@ class OC_TemplateLayout extends OC_Template {
}elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "core/$script.js" )) {
}else{
- echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
- die();
-
+ // Is it part of an app?
+ $append = false;
+ foreach( OC::$APPSROOTS as $apps_dir) {
+ if(self::appendIfExist($files, $apps_dir['path'], OC::$WEBROOT.$apps_dir['url'], "$script$fext.js")) { $append =true; break; }
+ elseif(self::appendIfExist($files, $apps_dir['path'], OC::$WEBROOT.$apps_dir['url'], "$script.js")) { $append =true; break; }
+ }
+ if(! $append) {
+ echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
+ die();
+ }
}
}
return $files;
diff --git a/lib/util.php b/lib/util.php
index 7792f96d44..0d9f412944 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -200,9 +200,12 @@ class OC_Util {
$errors[]=array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud");
}
- // Check if apps folder is writable.
- if(OC_Config::getValue('writable_appsdir', true) && !is_writable(OC::$SERVERROOT."/apps/")) {
- $errors[]=array('error'=>"Can't write into apps directory 'apps'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud");
+ // Check if there is a writable install folder.
+ if(OC_Config::getValue('appstoreenabled', true)) {
+ if( OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath())) {
+ $errors[]=array('error'=>"Can't write into apps directory",'hint'=>"You can usually fix this by giving the webserver user write access to the apps directory
+ in owncloud or disabling the appstore in the config file.");
+ }
}
$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
@@ -420,18 +423,58 @@ class OC_Util {
}
}
- /**
- * @brief Public function to sanitize HTML
- *
- * This function is used to sanitize HTML and should be applied on any string or array of strings before displaying it on a web page.
+ /**
+ * @brief Public function to sanitize HTML
+ *
+ * This function is used to sanitize HTML and should be applied on any
+ * string or array of strings before displaying it on a web page.
*
* @param string or array of strings
- * @return array with sanitized strings or a single sinitized string, depends on the input parameter.
+ * @return array with sanitized strings or a single sanitized string, depends on the input parameter.
*/
- public static function sanitizeHTML( &$value ){
- if (is_array($value) || is_object($value)) array_walk_recursive($value,'OC_Util::sanitizeHTML');
- else $value = htmlentities($value, ENT_QUOTES, 'UTF-8'); //Specify encoding for PHP<5.4
+ public static function sanitizeHTML( &$value ){
+ if (is_array($value) || is_object($value)) array_walk_recursive($value,'OC_Util::sanitizeHTML');
+ else $value = htmlentities($value, ENT_QUOTES, 'UTF-8'); //Specify encoding for PHP<5.4
return $value;
}
+
+ /**
+ * Check if the htaccess file is working by creating a test file in the data directory and trying to access via http
+ */
+ public static function ishtaccessworking() {
+
+ // testdata
+ $filename='/htaccesstest.txt';
+ $testcontent='testcontent';
+
+ // creating a test file
+ $testfile = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ).'/'.$filename;
+ $fp = @fopen($testfile, 'w');
+ @fwrite($fp, $testcontent);
+ @fclose($fp);
+
+ // accessing the file via http
+ $url = OC_Helper::serverProtocol(). '://' . OC_Helper::serverHost() . OC::$WEBROOT.'/data'.$filename;
+ $fp = @fopen($url, 'r');
+ $content=@fread($fp, 2048);
+ @fclose($fp);
+
+ // cleanup
+ @unlink($testfile);
+
+ // does it work ?
+ if($content==$testcontent) {
+ return(false);
+ }else{
+ return(true);
+
+ }
+
+ }
+
+
+
+
+
}
diff --git a/public.php b/public.php
index f974e1c50d..19c02a7a02 100644
--- a/public.php
+++ b/public.php
@@ -8,8 +8,8 @@ if(is_null($file)){
exit;
}
-$parts=explode('/',$file);
-$app=$parts[2];
+$parts=explode('/',$file,2);
+$app=$parts[0];
OC_App::loadApp($app);
-require_once(OC::$APPSROOT . $file);
+require_once(OC_App::getAppPath($app) .'/'. $parts[1]);
diff --git a/remote.php b/remote.php
index 0c5804221b..ef610f3694 100644
--- a/remote.php
+++ b/remote.php
@@ -20,10 +20,16 @@ if(is_null($file)){
OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
exit;
}
-
-$parts=explode('/',$file);
-$app=$parts[2];
-OC_App::loadApp($app);
-
-$baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
-require_once(OC::$APPSROOT . $file);
+if(count(explode('/',$file)) == 3) {
+ $parts=explode('/',$file);
+ $app=$parts[2];
+ OC_App::loadApp($app);
+ $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
+ require_once( OC::$SERVERROOT.$file);
+} else {
+ $parts=explode('/', $file, 4);
+ $app=$parts[2];
+ OC_App::loadApp($app);
+ $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
+ require_once(OC_App::getAppPath($app) .'/'. $parts[3]);
+}
diff --git a/search/js/result.js b/search/js/result.js
index 1087f9684b..27a2383e2c 100644
--- a/search/js/result.js
+++ b/search/js/result.js
@@ -41,23 +41,13 @@ OC.search.showResults=function(results){
for(var name in types){
var type=types[name];
if(type.length>0){
- var row=$('#searchresults tr.template').clone();
- row.removeClass('template');
- row.addClass('result');
- row.children('td.type').text(name);
- row.find('td.result a').attr('href',type[0].link);
- row.find('td.result div.name').text(type[0].name);
- row.find('td.result div.text').text(type[0].text);
- row.data('index',index);
- index++;
- if(OC.search.customResults[name]){//give plugins the ability to customize the entries in here
- OC.search.customResults[name](row,type[0]);
- }
- $('#searchresults tbody').append(row);
- for(var i=1;iassign('loglevel',OC_Config::getValue( "loglevel", 2 ));
$tmpl->assign('entries',$entries);
+$tmpl->assign('htaccessworking',$htaccessworking);
$tmpl->assign('forms',array());
foreach($forms as $form){
$tmpl->append('forms',$form);
diff --git a/settings/ajax/togglegroups.php b/settings/ajax/togglegroups.php
index f76e22f51d..7773c1049c 100644
--- a/settings/ajax/togglegroups.php
+++ b/settings/ajax/togglegroups.php
@@ -10,7 +10,7 @@ $error = "add user to";
$action = "add";
$username = $_POST["username"];
-$group = htmlentities($_POST["group"]);
+$group = OC_Util::sanitizeHTML($_POST["group"]);
if(!OC_Group::groupExists($group)){
OC_Group::createGroup($group);
diff --git a/settings/css/settings.css b/settings/css/settings.css
index df1e3cfd3c..80e96df5e6 100644
--- a/settings/css/settings.css
+++ b/settings/css/settings.css
@@ -48,5 +48,8 @@ li.active { color:#000; }
small.externalapp { color:#FFF; background-color:#BBB; font-weight:bold; font-size:6pt; padding:4px; border-radius: 4px;}
span.version { margin-left:3em; color:#ddd; }
-/* LOF */
+/* LOG */
#log { white-space:normal; }
+
+/* ADMIN */
+span.securitywarning {color:#C33; font-weight:bold; }
diff --git a/settings/js/log.js b/settings/js/log.js
index 6063c7d9a9..fe2e92f7a8 100644
--- a/settings/js/log.js
+++ b/settings/js/log.js
@@ -39,7 +39,7 @@ OC.Log={
row.append(appTd);
var messageTd=$(' | ');
- messageTd.text(entry.message);
+ messageTd.html(entry.message);
row.append(messageTd);
var timeTd=$(' | ');
diff --git a/settings/templates/admin.php b/settings/templates/admin.php
old mode 100644
new mode 100755
index 38c6042c82..a9f727d676
--- a/settings/templates/admin.php
+++ b/settings/templates/admin.php
@@ -6,6 +6,21 @@
$levels=array('Debug','Info','Warning','Error','Fatal');
?>
+
+
+
+
+
|