mirror of
https://github.com/nextcloud/server.git
synced 2026-03-02 05:20:46 -05:00
Merge branch 'master' into subadmin
This commit is contained in:
commit
f0c82686fd
48 changed files with 292 additions and 162 deletions
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('calendar');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$calendarid = $_POST['calendarid'];
|
||||
$calendar = OC_Calendar_App::getCalendar($calendarid, true);
|
||||
if(!$calendar){
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('calendar');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$cal = $_POST["calendarid"];
|
||||
$calendar = OC_Calendar_App::getCalendar($cal, true);
|
||||
|
|
|
|||
|
|
@ -6,11 +6,10 @@
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// Check if we are a user
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('calendar');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
if(trim($_POST['name']) == ''){
|
||||
OCP\JSON::error(array('message'=>'empty'));
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
// Check if we are a user
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('calendar');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
if(trim($_POST['name']) == ''){
|
||||
OCP\JSON::error(array('message'=>'empty'));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('calendar');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
foreach ($_POST as $key=>$element) {
|
||||
debug('_POST: '.$key.'=>'.print_r($element, true));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('calendar');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$id = $_POST['id'];
|
||||
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('calendar');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$id = $_POST['id'];
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$id = $_POST['id'];
|
||||
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('calendar');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$errarr = OC_Calendar_Object::validateRequest($_POST);
|
||||
if($errarr){
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$id = $_POST['id'];
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ ob_start();
|
|||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\App::checkAppEnabled('calendar');
|
||||
OCP\JSON::callCheck();
|
||||
session_write_close();
|
||||
|
||||
$nl="\r\n";
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::callCheck();
|
||||
if(isset($_POST["firstday"])){
|
||||
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'firstday', $_POST["firstday"]);
|
||||
OCP\JSON::success();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::callCheck();
|
||||
if(isset($_POST["timeformat"])){
|
||||
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]);
|
||||
OCP\JSON::success();
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ $l=OC_L10N::get('calendar');
|
|||
// Check if we are a user
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('calendar');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
// Get data
|
||||
if( isset( $_POST['timezone'] ) ){
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ OC::$CLASSPATH['OC_Calendar_Share'] = 'apps/calendar/lib/share.php';
|
|||
OC::$CLASSPATH['OC_Search_Provider_Calendar'] = 'apps/calendar/lib/search.php';
|
||||
OC::$CLASSPATH['OC_Calendar_Export'] = 'apps/calendar/lib/export.php';
|
||||
//General Hooks
|
||||
OCP\Util::connectHook('OC_User', 'post_createUser', 'OC_Calendar_Hooks', 'createUser');
|
||||
OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser');
|
||||
//Repeating Events Hooks
|
||||
OCP\Util::connectHook('OC_Calendar', 'addEvent', 'OC_Calendar_Repeat', 'generate');
|
||||
|
|
|
|||
|
|
@ -11,7 +11,18 @@
|
|||
*/
|
||||
class OC_Calendar_Hooks{
|
||||
/**
|
||||
* @brief Deletes all Addressbooks of a certain user
|
||||
* @brief Creates default calendar for a user
|
||||
* @param paramters parameters from postCreateUser-Hook
|
||||
* @return array
|
||||
*/
|
||||
public static function createUser($parameters) {
|
||||
OC_Calendar_Calendar::addCalendar($parameters['uid'],'Default calendar');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Deletes all calendars of a certain user
|
||||
* @param paramters parameters from postDeleteUser-Hook
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
var defaultView = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') ?>';
|
||||
var eventSources = <?php echo json_encode($_['eventSources']) ?>;
|
||||
var categories = <?php echo json_encode($_['categories']); ?>;
|
||||
var dayNames = <?php echo json_encode($l->tA(array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'))) ?>;
|
||||
var dayNamesShort = <?php echo json_encode($l->tA(array('Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'))) ?>;
|
||||
var monthNames = <?php echo json_encode($l->tA(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))) ?>;
|
||||
var monthNamesShort = <?php echo json_encode($l->tA(array('Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'))) ?>;
|
||||
var dayNames = new Array("<?php echo $l -> t("Sunday");?>", "<?php echo $l -> t("Monday");?>", "<?php echo $l -> t("Tuesday");?>", "<?php echo $l -> t("Wednesday");?>", "<?php echo $l -> t("Thursday");?>", "<?php echo $l -> t("Friday");?>", "<?php echo $l -> t("Saturday");?>");
|
||||
var dayNamesShort = new Array("<?php echo $l -> t("Sun.");?>", "<?php echo $l -> t("Mon.");?>", "<?php echo $l -> t("Tue.");?>", "<?php echo $l -> t("Wed.");?>", "<?php echo $l -> t("Thu.");?>", "<?php echo $l -> t("Fri.");?>", "<?php echo $l -> t("Sat.");?>");
|
||||
var monthNames = new Array("<?php echo $l -> t("January");?>", "<?php echo $l -> t("February");?>", "<?php echo $l -> t("March");?>", "<?php echo $l -> t("April");?>", "<?php echo $l -> t("May");?>", "<?php echo $l -> t("June");?>", "<?php echo $l -> t("July");?>", "<?php echo $l -> t("August");?>", "<?php echo $l -> t("September");?>", "<?php echo $l -> t("October");?>", "<?php echo $l -> t("November");?>", "<?php echo $l -> t("December");?>");
|
||||
var monthNamesShort = new Array("<?php echo $l -> t("Jan.");?>", "<?php echo $l -> t("Feb.");?>", "<?php echo $l -> t("Mar.");?>", "<?php echo $l -> t("Apr.");?>", "<?php echo $l -> t("May.");?>", "<?php echo $l -> t("Jun.");?>", "<?php echo $l -> t("Jul.");?>", "<?php echo $l -> t("Aug.");?>", "<?php echo $l -> t("Sep.");?>", "<?php echo $l -> t("Oct.");?>", "<?php echo $l -> t("Nov.");?>", "<?php echo $l -> t("Dec.");?>");
|
||||
var agendatime = '<?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>{ - <?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>}';
|
||||
var defaulttime = '<?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>';
|
||||
var allDayText = '<?php echo addslashes($l->t('All day')) ?>';
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@
|
|||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('contacts');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
require_once('../loghandler.php');
|
||||
require_once(__DIR__.'/../loghandler.php');
|
||||
|
||||
$categories = isset($_POST['categories'])?$_POST['categories']:null;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('contacts');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
OC_Contacts_App::scanCategories();
|
||||
$categories = OC_Contacts_App::getCategories();
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ $id = isset($_GET['id'])?$_GET['id']:null;
|
|||
if(is_null($id)) {
|
||||
bailOut(OC_Contacts_App::$l10n->t('Missing ID'));
|
||||
}
|
||||
$card = OC_Contacts_VCard::find($id);
|
||||
$vcard = OC_Contacts_App::getContactVCard( $id );
|
||||
if(is_null($vcard)) {
|
||||
bailOut(OC_Contacts_App::$l10n->t('Error parsing VCard for ID: "'.$id.'"'));
|
||||
|
|
@ -50,5 +51,7 @@ if(isset($details['PHOTO'])) {
|
|||
$details['PHOTO'] = false;
|
||||
}
|
||||
$details['id'] = $id;
|
||||
$details['displayname'] = $card['fullname'];
|
||||
$details['addressbookid'] = $card['addressbookid'];
|
||||
OC_Contacts_App::setLastModifiedHeader($vcard);
|
||||
OCP\JSON::success(array('data' => $details));
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ if($element != $name) {
|
|||
switch($element) {
|
||||
case 'BDAY':
|
||||
$date = New DateTime($value);
|
||||
//$vcard->setDateTime('BDAY', $date, Sabre_VObject_Element_DateTime::DATE);
|
||||
$value = $date->format(DateTime::ATOM);
|
||||
$value = $date->format('Y-m-d');
|
||||
break;
|
||||
case 'FN':
|
||||
if(!$value) {
|
||||
|
|
@ -89,6 +88,14 @@ if(!$value) {
|
|||
} else {
|
||||
/* setting value */
|
||||
switch($element) {
|
||||
case 'BDAY':
|
||||
// I don't use setDateTime() because that formats it as YYYYMMDD instead of YYYY-MM-DD
|
||||
// which is what the RFC recommends.
|
||||
$vcard->children[$line]->setValue($value);
|
||||
$vcard->children[$line]->parameters = array();
|
||||
$vcard->children[$line]->add(new Sabre_VObject_Parameter('VALUE', 'DATE'));
|
||||
debug('Setting value:'.$name.' '.$vcard->children[$line]);
|
||||
break;
|
||||
case 'CATEGORIES':
|
||||
debug('Setting string:'.$name.' '.$value);
|
||||
$vcard->children[$line]->setValue($value);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
$installedVersion=OCP\Config::getAppValue('contacts', 'installed_version');
|
||||
if (version_compare($installedVersion, '0.2.90', '<')) {
|
||||
if (version_compare($installedVersion, '0.2.3', '<')) {
|
||||
// First set all address books in-active.
|
||||
$stmt = OCP\DB::prepare( 'UPDATE *PREFIX*contacts_addressbooks SET active=0' );
|
||||
$result = $stmt->execute(array());
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#leftcontent a { padding: 0 0 0 25px; }
|
||||
#rightcontent { top: 3.5em !important; padding-top: 5px; }
|
||||
#leftcontent h3 { cursor: pointer; -moz-transition: background 300ms ease 0s; background: none no-repeat scroll 1em center #eee; border-bottom: 1px solid #ddd; border-top: 1px solid #fff; display: block; max-width: 100%; padding: 0.5em 0.8em; color: #666; text-shadow: 0 1px 0 #f8f8f8; font-size: 1.2em; }
|
||||
#leftcontent h3:hover,#leftcontent h3:active,#leftcontent h3.active { background-color: #DBDBDB; border-bottom: 1px solid #CCCCCC; border-top: 1px solid #D4D4D4; color: #333333; }
|
||||
#leftcontent h3:hover,#leftcontent h3:active,#leftcontent h3.active { background-color: #DBDBDB; border-bottom: 1px solid #CCCCCC; border-top: 1px solid #D4D4D4; color: #333333; font-weight: bold; }
|
||||
#contacts { position: fixed; background: #fff; max-width: 100%; width: 20em; left: 12.5em; top: 3.7em; bottom: 3em; overflow: auto; padding: 0; margin: 0; }
|
||||
.contacts a { height: 23px; display: block; left: 12.5em; margin: 0 0 0 0; padding: 0 0 0 25px; }
|
||||
.contacts li.ui-draggable { height: 23px; }
|
||||
|
|
|
|||
|
|
@ -80,6 +80,11 @@ $imported = 0;
|
|||
$failed = 0;
|
||||
if(!count($parts) > 0) {
|
||||
OCP\JSON::error(array('data' => array('message' => 'No contacts to import in '.$_POST['file'].'. Please check if the file is corrupted.', 'file'=>$_POST['file'])));
|
||||
if(isset($_POST['fstype']) && $_POST['fstype'] == 'OC_FilesystemView') {
|
||||
if(!$view->unlink('/imports/' . $_POST['file'])) {
|
||||
OCP\Util::writeLog('contacts','Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'], OCP\Util::ERROR);
|
||||
}
|
||||
}
|
||||
exit();
|
||||
}
|
||||
foreach($parts as $part){
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ Contacts={
|
|||
data:undefined,
|
||||
update:function(params) { // params {cid:int, aid:int}
|
||||
if(!params) { params = {}; }
|
||||
$('#contacts li').removeClass('active');
|
||||
$('#contacts li,#contacts h3').removeClass('active');
|
||||
console.log('Card, cid: ' + params.cid + ' aid: ' + params.aid);
|
||||
var newid, bookid, firstitem;
|
||||
if(!parseInt(params.cid) && !parseInt(params.aid)) {
|
||||
|
|
@ -299,7 +299,13 @@ Contacts={
|
|||
newid = parseInt($('#contacts').find('li[data-bookid="'+bookid+'"]').first().data('id'));
|
||||
} else if(parseInt(params.cid) && !parseInt(params.aid)) {
|
||||
newid = parseInt(params.cid);
|
||||
bookid = parseInt($('#contacts li[data-id="'+newid+'"]').data('bookid'));
|
||||
var listitem = $('#contacts li[data-id="'+newid+'"]');
|
||||
console.log('Is contact in list? ' + listitem.length);
|
||||
if(listitem.length) {
|
||||
bookid = parseInt($('#contacts li[data-id="'+newid+'"]').data('bookid'));
|
||||
} else { // contact isn't in list yet.
|
||||
bookid = 'unknown';
|
||||
}
|
||||
} else {
|
||||
newid = parseInt(params.cid);
|
||||
bookid = parseInt(params.aid);
|
||||
|
|
@ -311,9 +317,14 @@ Contacts={
|
|||
console.log('newid: ' + newid + ' bookid: ' +bookid);
|
||||
var localLoadContact = function(newid, bookid) {
|
||||
if($('.contacts li').length > 0) {
|
||||
$('#contacts li[data-id="'+newid+'"]').addClass('active');
|
||||
$.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':newid},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
if(bookid == 'unknown') {
|
||||
bookid = jsondata.data.addressbookid;
|
||||
var entry = Contacts.UI.Card.createEntry(jsondata.data);
|
||||
$('#contacts ul[data-id="'+bookid+'"]').append(entry);
|
||||
}
|
||||
$('#contacts li[data-id="'+newid+'"],#contacts h3[data-id="'+bookid+'"]').addClass('active');
|
||||
$('#contacts ul[data-id="'+bookid+'"]').slideDown(300);
|
||||
Contacts.UI.Card.loadContact(jsondata.data, bookid);
|
||||
} else {
|
||||
|
|
@ -1334,8 +1345,6 @@ Contacts={
|
|||
},
|
||||
},
|
||||
Addressbooks:{
|
||||
droptarget:undefined,
|
||||
droptext:t('contacts', 'Drop a VCF file<br />to import contacts.'),
|
||||
overview:function(){
|
||||
if($('#chooseaddressbook_dialog').dialog('isOpen') == true){
|
||||
$('#chooseaddressbook_dialog').dialog('moveToTop');
|
||||
|
|
@ -1456,12 +1465,18 @@ Contacts={
|
|||
batchnum:50,
|
||||
drop:function(event, ui) {
|
||||
var dragitem = ui.draggable, droptarget = $(this);
|
||||
//console.log('Drop ' + dragitem.data('id') +' on: ' + droptarget.data('id'));
|
||||
if(dragitem.is('li')) {
|
||||
Contacts.UI.Contacts.dropContact(event, dragitem, droptarget);
|
||||
} else {
|
||||
Contacts.UI.Contacts.dropAddressbook(event, dragitem, droptarget);
|
||||
}
|
||||
},
|
||||
dropContact:function(event, dragitem, droptarget) {
|
||||
if(dragitem.data('bookid') == droptarget.data('id')) {
|
||||
return false;
|
||||
}
|
||||
var droplist = (droptarget.is('ul'))?droptarget:droptarget.next();
|
||||
$.post(OC.filePath('contacts', 'ajax', 'movetoaddressbook.php'), { ids: dragitem.data('id'), aid: $(this).data('id') },
|
||||
$.post(OC.filePath('contacts', 'ajax', 'movetoaddressbook.php'), { ids: dragitem.data('id'), aid: droptarget.data('id') },
|
||||
function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
// Do some inserting/removing/sorting magic
|
||||
|
|
@ -1485,6 +1500,9 @@ Contacts={
|
|||
}
|
||||
});
|
||||
},
|
||||
dropAddressbook:function(event, dragitem, droptarget) {
|
||||
alert('Dropping address books not implemented yet');
|
||||
},
|
||||
// Reload the contacts list.
|
||||
update:function(params){
|
||||
if(!params) { params = {}; }
|
||||
|
|
@ -1534,7 +1552,7 @@ Contacts={
|
|||
$('#contacts ul[data-id="'+b+'"]').slideToggle(300);
|
||||
return false;
|
||||
});
|
||||
var accept = 'li:not([data-bookid="'+b+'"])';
|
||||
var accept = 'li:not([data-bookid="'+b+'"]),h3:not([data-id="'+b+'"])';
|
||||
$('#contacts h3[data-id="'+b+'"],#contacts ul[data-id="'+b+'"]').droppable({
|
||||
drop: Contacts.UI.Contacts.drop,
|
||||
activeClass: 'ui-state-hover',
|
||||
|
|
@ -1542,9 +1560,10 @@ Contacts={
|
|||
});
|
||||
}
|
||||
var contactlist = $('#contacts ul[data-id="'+b+'"]');
|
||||
var contacts = $('#contacts ul[data-id="'+b+'"] li');
|
||||
for(var c in book.contacts) {
|
||||
if(book.contacts[c].id == undefined) { continue; }
|
||||
if($('#contacts li[data-id="'+book.contacts[c]['id']+'"][data-id="'+book.contacts[c]['bookid']+'"]').length == 0) {
|
||||
if(!$('#contacts li[data-id="'+book.contacts[c]['id']+'"]').length) {
|
||||
var contact = Contacts.UI.Card.createEntry(book.contacts[c]);
|
||||
if(c == self.batchnum-5) {
|
||||
contact.bind('inview', function(event, isInView, visiblePartX, visiblePartY) {
|
||||
|
|
@ -1557,12 +1576,22 @@ Contacts={
|
|||
}
|
||||
});
|
||||
}
|
||||
contactlist.append(contact);
|
||||
var added = false;
|
||||
contacts.each(function(){
|
||||
if ($(this).text().toLowerCase() > book.contacts[c].displayname.toLowerCase()) {
|
||||
$(this).before(contact);
|
||||
added = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if(!added) {
|
||||
contactlist.append(contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if($('#contacts h3').length > 1) {
|
||||
$('#contacts li').draggable({
|
||||
$('#contacts li,#contacts h3').draggable({
|
||||
revert: 'invalid',
|
||||
axis: 'y', containment: '#contacts',
|
||||
scroll: true, scrollSensitivity: 100,
|
||||
|
|
@ -1625,7 +1654,13 @@ $(document).ready(function(){
|
|||
item.addClass('active');
|
||||
var oldid = $('#rightcontent').data('id');
|
||||
if(oldid != 0){
|
||||
$('.contacts li[data-id="'+oldid+'"]').removeClass('active');
|
||||
var olditem = $('.contacts li[data-id="'+oldid+'"]');
|
||||
var oldbookid = olditem.data('bookid');
|
||||
olditem.removeClass('active');
|
||||
if(oldbookid != bookid) {
|
||||
$('#contacts h3[data-id="'+oldbookid+'"]').removeClass('active');
|
||||
$('#contacts h3[data-id="'+bookid+'"]').addClass('active');
|
||||
}
|
||||
}
|
||||
$.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':id},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
|
|
@ -1643,53 +1678,55 @@ $(document).ready(function(){
|
|||
Contacts.UI.Card.saveProperty(this);
|
||||
});
|
||||
|
||||
// Upload function for dropped contact photos files. Should go in the Contacts class/object.
|
||||
$.fileUpload = function(files){
|
||||
var file = files[0];
|
||||
if(file.size > $('#max_upload').val()){
|
||||
OC.dialogs.alert(t('contacts','The file you are trying to upload exceed the maximum size for file uploads on this server.'), t('contacts','Upload too large'));
|
||||
return;
|
||||
}
|
||||
if (file.type.indexOf("image") != 0) {
|
||||
OC.dialogs.alert(t('contacts','Only image files can be used as profile picture.'), t('contacts','Wrong file type'));
|
||||
return;
|
||||
}
|
||||
var xhr = new XMLHttpRequest();
|
||||
$(function() {
|
||||
// Upload function for dropped contact photos files. Should go in the Contacts class/object.
|
||||
$.fileUpload = function(files){
|
||||
var file = files[0];
|
||||
if(file.size > $('#max_upload').val()){
|
||||
OC.dialogs.alert(t('contacts','The file you are trying to upload exceed the maximum size for file uploads on this server.'), t('contacts','Upload too large'));
|
||||
return;
|
||||
}
|
||||
if (file.type.indexOf("image") != 0) {
|
||||
OC.dialogs.alert(t('contacts','Only image files can be used as profile picture.'), t('contacts','Wrong file type'));
|
||||
return;
|
||||
}
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
if (!xhr.upload) {
|
||||
OC.dialogs.alert(t('contacts', 'Your browser doesn\'t support AJAX upload. Please click on the profile picture to select a photo to upload.'), t('contacts', 'Error'))
|
||||
}
|
||||
fileUpload = xhr.upload,
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == 4){
|
||||
response = $.parseJSON(xhr.responseText);
|
||||
if(response.status == 'success') {
|
||||
if(xhr.status == 200) {
|
||||
Contacts.UI.Card.editPhoto(response.data.id, response.data.tmp);
|
||||
if (!xhr.upload) {
|
||||
OC.dialogs.alert(t('contacts', 'Your browser doesn\'t support AJAX upload. Please click on the profile picture to select a photo to upload.'), t('contacts', 'Error'))
|
||||
}
|
||||
fileUpload = xhr.upload,
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == 4){
|
||||
response = $.parseJSON(xhr.responseText);
|
||||
if(response.status == 'success') {
|
||||
if(xhr.status == 200) {
|
||||
Contacts.UI.Card.editPhoto(response.data.id, response.data.tmp);
|
||||
} else {
|
||||
OC.dialogs.alert(xhr.status + ': ' + xhr.responseText, t('contacts', 'Error'));
|
||||
}
|
||||
} else {
|
||||
OC.dialogs.alert(xhr.status + ': ' + xhr.responseText, t('contacts', 'Error'));
|
||||
OC.dialogs.alert(response.data.message, t('contacts', 'Error'));
|
||||
}
|
||||
} else {
|
||||
OC.dialogs.alert(response.data.message, t('contacts', 'Error'));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
fileUpload.onprogress = function(e){
|
||||
if (e.lengthComputable){
|
||||
var _progress = Math.round((e.loaded * 100) / e.total);
|
||||
//if (_progress != 100){
|
||||
//}
|
||||
}
|
||||
};
|
||||
xhr.open('POST', OC.filePath('contacts', 'ajax', 'uploadphoto.php')+'?id='+Contacts.UI.Card.id+'&requesttoken='+requesttoken+'&imagefile='+encodeURIComponent(file.name), true);
|
||||
xhr.setRequestHeader('Cache-Control', 'no-cache');
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
xhr.setRequestHeader('X_FILE_NAME', encodeURIComponent(file.name));
|
||||
xhr.setRequestHeader('X-File-Size', file.size);
|
||||
xhr.setRequestHeader('Content-Type', file.type);
|
||||
xhr.send(file);
|
||||
}
|
||||
};
|
||||
|
||||
fileUpload.onprogress = function(e){
|
||||
if (e.lengthComputable){
|
||||
var _progress = Math.round((e.loaded * 100) / e.total);
|
||||
//if (_progress != 100){
|
||||
//}
|
||||
}
|
||||
};
|
||||
xhr.open('POST', OC.filePath('contacts', 'ajax', 'uploadphoto.php')+'?id='+Contacts.UI.Card.id+'&requesttoken='+requesttoken+'&imagefile='+encodeURIComponent(file.name), true);
|
||||
xhr.setRequestHeader('Cache-Control', 'no-cache');
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
xhr.setRequestHeader('X_FILE_NAME', encodeURIComponent(file.name));
|
||||
xhr.setRequestHeader('X-File-Size', file.size);
|
||||
xhr.setRequestHeader('Content-Type', file.type);
|
||||
xhr.send(file);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).bind('drop dragover', function (e) {
|
||||
e.preventDefault(); // prevent browser from doing anything, if file isn't dropped in dropZone
|
||||
|
|
|
|||
|
|
@ -34,12 +34,12 @@
|
|||
*/
|
||||
class OC_Contacts_Hooks{
|
||||
/**
|
||||
* @brief Add default Addressbooks of a certain user
|
||||
* @param paramters parameters from postDeleteUser-Hook
|
||||
* @brief Add default Addressbook for a certain user
|
||||
* @param paramters parameters from postCreateUser-Hook
|
||||
* @return array
|
||||
*/
|
||||
static public function createUser($parameters) {
|
||||
OC_Contacts_Addressbook::addDefault($parameters['uid'],'default','Default Address Book');
|
||||
OC_Contacts_Addressbook::addDefault($parameters['uid']);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -430,7 +430,6 @@ class OC_Contacts_VCard{
|
|||
* @return boolean
|
||||
*/
|
||||
public static function delete($id){
|
||||
// FIXME: Add error checking.
|
||||
OC_Hook::emit('OC_Contacts_VCard', 'pre_deleteVCard', array('aid' => null, 'id' => $id, 'uri' => null));
|
||||
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE id = ?' );
|
||||
try {
|
||||
|
|
@ -451,7 +450,6 @@ class OC_Contacts_VCard{
|
|||
* @return boolean
|
||||
*/
|
||||
public static function deleteFromDAVData($aid,$uri){
|
||||
// FIXME: Add error checking. Deleting a card gives an Kontact/Akonadi error.
|
||||
OC_Hook::emit('OC_Contacts_VCard', 'pre_deleteVCard', array('aid' => $aid, 'id' => null, 'uri' => $uri));
|
||||
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri=?' );
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<name>*dbname*</name>
|
||||
<create>true</create>
|
||||
<overwrite>false</overwrite>
|
||||
<charset>latin1</charset>
|
||||
<charset>utf8</charset>
|
||||
<table>
|
||||
<name>*dbprefix*sharing_log</name>
|
||||
<declaration>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
// Check user and app status
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\App::checkAppEnabled('files_versions');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$versions = new OCA_Versions\Storage();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
OCP\JSON::checkAppEnabled('files_versions');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$userDirectory = "/".OCP\USER::getUser()."/files";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
OCP\JSON::checkAppEnabled('files_versions');
|
||||
OCP\JSON::checkAdminUser();
|
||||
OCP\JSON::callCheck();
|
||||
if (OCP\Config::getSystemValue('versions', 'true')=='true') {
|
||||
OCP\Config::setSystemValue('versions', 'false');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -7,4 +7,7 @@
|
|||
<author>Michiel de Jong</author>
|
||||
<require>4</require>
|
||||
<shipped>true</shipped>
|
||||
<remote>
|
||||
<remoteStorage>webdav.php</remoteStorage>
|
||||
</remote>
|
||||
</info>
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
0.6
|
||||
0.7
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<?php if(OC_User::userExists(WF_USER)) { ?>
|
||||
<?php if(OC_User::userExists(WF_USER)): ?>
|
||||
{
|
||||
"rel":"remoteStorage",
|
||||
"template":"<?php echo WF_BASEURL; ?>/apps/remoteStorage/WebDAV.php/<?php echo WF_USER; ?>/remoteStorage/{category}/",
|
||||
"template":"<?php echo WF_BASEURL; ?>/remote.php/remoteStorage/<?php echo WF_USER; ?>/remoteStorage/{category}/",
|
||||
"api":"WebDAV",
|
||||
"auth":"<?php echo WF_BASEURL; ?>/?app=remoteStorage&getfile=auth.php&userid=<?php echo WF_USER; ?>"
|
||||
}
|
||||
<?php } ?>
|
||||
<?php endif ?>
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
class OC_Connector_Sabre_Auth_ro_oauth extends Sabre_DAV_Auth_Backend_AbstractBasic {
|
||||
private $validTokens;
|
||||
private $category;
|
||||
private $category;
|
||||
public function __construct($validTokensArg, $categoryArg) {
|
||||
$this->validTokens = $validTokensArg;
|
||||
$this->category = $categoryArg;
|
||||
$this->category = $categoryArg;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -25,16 +25,16 @@ class OC_Connector_Sabre_Auth_ro_oauth extends Sabre_DAV_Auth_Backend_AbstractBa
|
|||
*/
|
||||
protected function validateUserPass($username, $password){
|
||||
//always give read-only:
|
||||
if(($_SERVER['REQUEST_METHOD'] == 'OPTIONS')
|
||||
if(($_SERVER['REQUEST_METHOD'] == 'OPTIONS')
|
||||
|| (isset($this->validTokens[$password]))
|
||||
|| (($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
|
||||
) {
|
||||
|| (($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
|
||||
) {
|
||||
OC_Util::setUpFS();
|
||||
return true;
|
||||
} else {
|
||||
//var_export($_SERVER);
|
||||
//var_export($this->validTokens);
|
||||
//die('not getting in with "'.$username.'"/"'.$password.'"!');
|
||||
//var_export($_SERVER);
|
||||
//var_export($this->validTokens);
|
||||
//die('not getting in with "'.$username.'"/"'.$password.'"!');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -48,8 +48,8 @@ class OC_Connector_Sabre_Auth_ro_oauth extends Sabre_DAV_Auth_Backend_AbstractBa
|
|||
$userpass = $auth->getUserPass();
|
||||
if (!$userpass) {
|
||||
if(($_SERVER['REQUEST_METHOD'] == 'OPTIONS')
|
||||
||(($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
|
||||
) {
|
||||
||(($_SERVER['REQUEST_METHOD'] == 'GET') && ($this->category == 'public'))
|
||||
) {
|
||||
$userpass = array('', '');
|
||||
} else {
|
||||
$auth->requireLogin();
|
||||
|
|
|
|||
|
|
@ -25,22 +25,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
// Do not load FS ...
|
||||
$RUNTIME_NOSETUPFS = true;
|
||||
|
||||
|
||||
require_once('../../lib/base.php');
|
||||
|
||||
require_once('../../lib/user.php');
|
||||
require_once('../../lib/public/user.php');
|
||||
|
||||
require_once('../../lib/app.php');
|
||||
require_once('../../lib/public/app.php');
|
||||
|
||||
require_once('../../3rdparty/Sabre/DAV/Auth/IBackend.php');
|
||||
require_once('../../3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php');
|
||||
require_once('../../lib/connector/sabre/auth.php');
|
||||
OC_App::loadApps(array('filesystem','authentication'));
|
||||
|
||||
OCP\App::checkAppEnabled('remoteStorage');
|
||||
require_once('lib_remoteStorage.php');
|
||||
|
|
@ -61,14 +46,15 @@ if(isset($_SERVER['HTTP_ORIGIN'])) {
|
|||
header('Access-Control-Allow-Origin: *');
|
||||
}
|
||||
|
||||
$path = substr($_SERVER["REQUEST_URI"], strlen($_SERVER["SCRIPT_NAME"]));
|
||||
$path = substr($_SERVER["REQUEST_URI"], strlen($baseuri));
|
||||
|
||||
$pathParts = explode('/', $path);
|
||||
// for webdav:
|
||||
// 0/ 1 / 2 / 3...
|
||||
// /$ownCloudUser/remoteStorage/$category/
|
||||
// 0 / 1 / 2...
|
||||
// $ownCloudUser/remoteStorage/$category/
|
||||
|
||||
if(count($pathParts) >= 3 && $pathParts[0] == '') {
|
||||
list($dummy, $ownCloudUser, $dummy2, $category) = $pathParts;
|
||||
if(count($pathParts) >= 2) {
|
||||
list($ownCloudUser, $dummy2, $category) = $pathParts;
|
||||
|
||||
OC_Util::setupFS($ownCloudUser);
|
||||
|
||||
|
|
@ -77,13 +63,13 @@ if(count($pathParts) >= 3 && $pathParts[0] == '') {
|
|||
$server = new Sabre_DAV_Server($publicDir);
|
||||
|
||||
// Path to our script
|
||||
$server->setBaseUri(OC::$WEBROOT."/apps/remoteStorage/WebDAV.php/$ownCloudUser");
|
||||
$server->setBaseUri($baseuri.$ownCloudUser);
|
||||
|
||||
// Auth backend
|
||||
$authBackend = new OC_Connector_Sabre_Auth_ro_oauth(
|
||||
OC_remoteStorage::getValidTokens($ownCloudUser, $category),
|
||||
$category
|
||||
);
|
||||
OC_remoteStorage::getValidTokens($ownCloudUser, $category),
|
||||
$category
|
||||
);
|
||||
|
||||
$authPlugin = new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud');//should use $validTokens here
|
||||
$server->addPlugin($authPlugin);
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
// Init owncloud
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('tasks');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
|
||||
$first_calendar = reset($calendars);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
// Init owncloud
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('tasks');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$id = $_POST['id'];
|
||||
$task = OC_Calendar_App::getEventObject( $id );
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
// Init owncloud
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('tasks');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$l10n = new OC_L10N('tasks');
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// Init owncloud
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('tasks');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$id = $_POST['id'];
|
||||
$property = $_POST['type'];
|
||||
|
|
|
|||
5
apps/user_webfinger/.htaccess
Normal file
5
apps/user_webfinger/.htaccess
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine on
|
||||
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
RewriteRule ^host-meta host-meta.php [QSA,L]
|
||||
</IfModule>
|
||||
|
|
@ -1,10 +1,27 @@
|
|||
<?php
|
||||
|
||||
if(class_exists('OC')){
|
||||
$WEBROOT=OC::$WEBROOT;
|
||||
}else{//not called trough remote.php try to guess the webroot the best we can from here
|
||||
// calculate the root directories
|
||||
$SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-strlen('apps/user_webfinger/host-meta.php')));
|
||||
$WEBROOT=substr($SERVERROOT,strlen(realpath($_SERVER['DOCUMENT_ROOT'])));
|
||||
|
||||
if($WEBROOT!='' and $WEBROOT[0]!=='/'){
|
||||
$WEBROOT='/'.$WEBROOT;
|
||||
}
|
||||
}
|
||||
|
||||
if(substr($WEBROOT,-1)==='/'){
|
||||
$WEBROOT=substr($WEBROOT,0,-1);
|
||||
}
|
||||
|
||||
$hostMetaHeader = array(
|
||||
'Access-Control-Allow-Origin' => '*',
|
||||
'Content-Type' => 'application/xrd+json'
|
||||
);
|
||||
$serverName = $_SERVER['SERVER_NAME'];
|
||||
$hostMetaContents = '{"links":[{"rel":"lrdd","template":"http'.(isset($_SERVER['HTTPS'])?'s':'').'://'.$serverName.'/public.php?service=webfinger&q={uri}"}]}';
|
||||
$hostMetaContents = '{"links":[{"rel":"lrdd","template":"http'.(isset($_SERVER['HTTPS'])?'s':'').'://'.$serverName.$WEBROOT.'/public.php?service=webfinger&q={uri}"}]}';
|
||||
foreach($hostMetaHeader as $header => $value) {
|
||||
header($header . ": " . $value);
|
||||
}
|
||||
|
|
|
|||
95
autotest.sh
95
autotest.sh
|
|
@ -1,53 +1,36 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# sqlite testing now
|
||||
# ownCloud
|
||||
#
|
||||
echo "Setup environment for sqlite testing ..."
|
||||
# @author Thomas Müller
|
||||
# @copyright 2012 Thomas Müller thomas.mueller@tmit.eu
|
||||
#
|
||||
|
||||
DATADIR=data-autotest
|
||||
rm -rf $DATADIR
|
||||
mkdir $DATADIR
|
||||
rm -rf config/config.php
|
||||
#cp autotest/config.sqlite.php config/autoconfig.php
|
||||
cat > ./config/autoconfig.php <<DELIM
|
||||
BASEDIR=$PWD
|
||||
|
||||
# create autoconfig for sqlite, mysql and (soon) postgresql
|
||||
cat > ./tests/autoconfig-sqlite.php <<DELIM
|
||||
<?php
|
||||
\$AUTOCONFIG = array (
|
||||
'installed' => false,
|
||||
'dbtype' => 'sqlite',
|
||||
'dbtableprefix' => 'oc_',
|
||||
'datadirectory' => 'data',
|
||||
'adminlogin' => 'admin',
|
||||
'adminpass' => 'admin',
|
||||
'directory' => '$PWD/$DATADIR',
|
||||
'directory' => '$BASEDIR/$DATADIR',
|
||||
);
|
||||
DELIM
|
||||
|
||||
php -f index.php
|
||||
|
||||
#test execution
|
||||
echo 'Testing with sqlite ...'
|
||||
cd tests
|
||||
php -f index.php -- xml > autotest-results-sqlite.xml
|
||||
|
||||
#
|
||||
# mysql testing now
|
||||
#
|
||||
# NOTES:
|
||||
# - grant access permissions: grant all on oc_autotest.* to 'oc_autotest'@'localhost';
|
||||
#
|
||||
echo "Setup environment for MySql testing ..."
|
||||
DATADIR=data-autotest
|
||||
rm -rf $DATADIR
|
||||
mkdir $DATADIR
|
||||
rm -rf config/config.php
|
||||
cat > ./config/autoconfig.php <<DELIM
|
||||
cat > ./tests/autoconfig-mysql.php <<DELIM
|
||||
<?php
|
||||
\$AUTOCONFIG = array (
|
||||
'installed' => false,
|
||||
'dbtype' => 'mysql',
|
||||
'dbtableprefix' => 'oc_',
|
||||
'datadirectory' => 'data',
|
||||
'adminlogin' => 'admin',
|
||||
'adminpass' => 'admin',
|
||||
'directory' => '$PWD/$DATADIR',
|
||||
'directory' => '$BASEDIR/$DATADIR',
|
||||
'dbuser' => 'oc_autotest',
|
||||
'dbname' => 'oc_autotest',
|
||||
'dbhost' => 'localhost',
|
||||
|
|
@ -55,18 +38,52 @@ cat > ./config/autoconfig.php <<DELIM
|
|||
);
|
||||
DELIM
|
||||
|
||||
#drop the database
|
||||
mysql -u oc_autotest -powncloud -e "DROP DATABASE oc_autotest"
|
||||
|
||||
#setup
|
||||
php -f index.php
|
||||
function execute_tests {
|
||||
echo "Setup environment for $1 testing ..."
|
||||
# back to root folder
|
||||
cd $BASEDIR
|
||||
echo $BASEDIR
|
||||
|
||||
#test execution
|
||||
echo 'Testing with MySql ...'
|
||||
cd tests
|
||||
php -f index.php -- xml > autotest-results-MySql.xml
|
||||
# revert changes to tests/data
|
||||
git checkout tests/data/*
|
||||
|
||||
# reset data directory
|
||||
rm -rf $DATADIR
|
||||
mkdir $DATADIR
|
||||
|
||||
# remove the old config file
|
||||
rm -rf config/config.php
|
||||
|
||||
# drop database
|
||||
if [ "$1" == "mysql" ] ; then
|
||||
mysql -u oc_autotest -powncloud -e "DROP DATABASE oc_autotest"
|
||||
fi
|
||||
|
||||
# copy autoconfig
|
||||
cp $BASEDIR/tests/autoconfig-$1.php $BASEDIR/config/autoconfig.php
|
||||
|
||||
# trigger installation
|
||||
php -f index.php
|
||||
|
||||
#test execution
|
||||
echo "Testing with $1 ..."
|
||||
cd tests
|
||||
php -f index.php -- xml $1 > autotest-results-$1.xml
|
||||
}
|
||||
|
||||
#
|
||||
# TODO: create config for postgres
|
||||
# start test execution
|
||||
#
|
||||
execute_tests "sqlite"
|
||||
execute_tests 'mysql'
|
||||
|
||||
# TODO: implement this
|
||||
#execute_tests 'postgresql'
|
||||
|
||||
#
|
||||
# NOTES:
|
||||
# - CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY 'owncloud';
|
||||
# - grant access permissions: grant all on oc_autotest.* to 'oc_autotest'@'localhost';
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -31,13 +31,18 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
|
|||
* @return bool
|
||||
*/
|
||||
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($username);
|
||||
if (OC_User::isLoggedIn()) {
|
||||
OC_Util::setupFS($username);
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
} else {
|
||||
OC_Util::setUpFS();//login hooks may need early access to the filesystem
|
||||
if(OC_User::login($username,$password)){
|
||||
OC_Util::setUpFS($username);
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
|
|||
*/
|
||||
public function get() {
|
||||
|
||||
return OC_Filesystem::readfile($this->path);
|
||||
return OC_Filesystem::fopen($this->path,'rb');
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,8 +154,15 @@ class OC_L10N{
|
|||
*
|
||||
* Returns the translation. If no translation is found, $textArray will be
|
||||
* returned.
|
||||
*
|
||||
*
|
||||
* @deprecated deprecated since ownCloud version 5.0
|
||||
* This method will probably be removed with ownCloud 6.0
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function tA($textArray){
|
||||
OC_Log::write('core', 'DEPRECATED: the method tA is deprecated and will be removed soon.',OC_Log::WARN);
|
||||
$result = array();
|
||||
foreach($textArray as $key => $text){
|
||||
$result[$key] = (string)$this->t($text);
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ class OC_User {
|
|||
if( $run ){
|
||||
$uid=self::checkPassword( $uid, $password );
|
||||
if($uid){
|
||||
session_regenerate_id();
|
||||
session_regenerate_id(true);
|
||||
self::setUserId($uid);
|
||||
OC_Hook::emit( "OC_User", "post_login", array( "uid" => $uid, 'password'=>$password ));
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ require_once 'simpletest/mock_objects.php';
|
|||
require_once 'simpletest/collector.php';
|
||||
require_once 'simpletest/default_reporter.php';
|
||||
|
||||
// test suite instance
|
||||
$testSuite=new TestSuite("ownCloud Unit Test Suite");
|
||||
$testSuiteName="ownCloud Unit Test Suite";
|
||||
|
||||
// prepare the reporter
|
||||
if(OC::$CLI){
|
||||
|
|
@ -37,12 +36,19 @@ if(OC::$CLI){
|
|||
{
|
||||
$reporter= new XmlReporter;
|
||||
$test=false;
|
||||
|
||||
if(isset($_SERVER['argv'][2])){
|
||||
$testSuiteName=$testSuiteName." (".$_SERVER['argv'][2].")";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$reporter='HtmlReporter';
|
||||
$test=isset($_GET['test'])?$_GET['test']:false;
|
||||
}
|
||||
|
||||
// test suite instance
|
||||
$testSuite=new TestSuite($testSuiteName);
|
||||
|
||||
//load core test cases
|
||||
loadTests(dirname(__FILE__), $testSuite, $test);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue