Beispiel #1
0
<?php

/**
 * Copyright (c) 2011 Jakob Sack <*****@*****.**>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
OCP\App::checkAppEnabled('calendar');
if (substr(OCP\Util::getRequestUri(), 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
$RUNTIME_APPTYPES = array('authentication');
OC_App::loadApps($RUNTIME_APPTYPES);
// Backends
$authBackend = new OC_Connector_Sabre_Auth();
$principalBackend = new OC_Connector_Sabre_Principal();
$caldavBackend = new OC_Connector_Sabre_CalDAV();
$requestBackend = new OC_Connector_Sabre_Request();
// Root nodes
$Sabre_CalDAV_Principal_Collection = new Sabre_CalDAV_Principal_Collection($principalBackend);
$Sabre_CalDAV_Principal_Collection->disableListing = true;
// Disable listening
$calendarRoot = new OC_Connector_Sabre_CalDAV_CalendarRoot($principalBackend, $caldavBackend);
$calendarRoot->disableListing = true;
// Disable listening
$nodes = array($Sabre_CalDAV_Principal_Collection, $calendarRoot);
// Fire up server
$server = new Sabre_DAV_Server($nodes);
$server->httpRequest = $requestBackend;
Beispiel #2
0
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
OCP\App::checkAppEnabled('contacts');
if (substr(OCP\Util::getRequestUri(), 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
$RUNTIME_APPTYPES = array('authentication');
OC_App::loadApps($RUNTIME_APPTYPES);
// Backends
$authBackend = new OC_Connector_Sabre_Auth();
$principalBackend = new OC_Connector_Sabre_Principal();
$addressbookbackends = array();
$addressbookbackends[] = new OCA\Contacts\Backend\Database(\OCP\User::getUser());
$carddavBackend = new OCA\Contacts\CardDAV\Backend(array('local', 'shared'));
$requestBackend = new OC_Connector_Sabre_Request();
// Root nodes
$principalCollection = new Sabre_CalDAV_Principal_Collection($principalBackend);
$principalCollection->disableListing = true;
Beispiel #3
0
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */
require_once '../lib/base.php';
header('Content-type: application/xml');
$url = OCP\Util::getServerProtocol() . '://' . substr(OCP\Util::getServerHost() . OCP\Util::getRequestUri(), 0, -17) . 'ocs/v1.php/';
$writer = new XMLWriter();
$writer->openURI('php://output');
$writer->startDocument('1.0', 'UTF-8');
$writer->setIndent(4);
$writer->startElement('providers');
$writer->startElement('provider');
$writer->writeElement('id', 'ownCloud');
$writer->writeElement('location', $url);
$writer->writeElement('name', 'ownCloud');
$writer->writeElement('icon', '');
$writer->writeElement('termsofuse', '');
$writer->writeElement('register', '');
$writer->startElement('services');
$writer->startElement('config');
$writer->writeAttribute('ocsversion', '1.7');
Beispiel #4
0
<form>
<h1>OpenId page</h1>
<?php 
p(OCP\Util::getRequestUri());
?>
</form>
Beispiel #5
0
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
*
*
* This uses the Zend OpenID implementation, find a tutorial about it at http://framework.zend.com/manual/en/zend.openid.html .
*
*/
OC::$CLASSPATH['OC_OpenIdProviderUserSession'] = 'user_openid_provider/lib/OpenIdProviderUserSession.php';
OC::$CLASSPATH['OC_OpenIdProviderStorage'] = 'user_openid_provider/lib/OpenIdProviderStorage.php';
$userName = '';
if (strpos(OCP\Util::getRequestUri(), '?') and !strpos(OCP\Util::getRequestUri(), '=')) {
    if (strpos(OCP\Util::getRequestUri(), '/?') !== false) {
        $userName = substr(OCP\Util::getRequestUri(), strpos(OCP\Util::getRequestUri(), '/?') + 2);
    } elseif (strpos(OCP\Util::getRequestUri(), '.php?') !== false) {
        $userName = substr(OCP\Util::getRequestUri(), strpos(OCP\Util::getRequestUri(), '.php?') + 5);
    }
}
$remote_token = 'openid_provider';
if (($pos = strpos(OCP\Util::getRequestUri(), $remote_token)) !== false) {
    $pos += strlen($remote_token) + 1;
    $userName = substr(OCP\Util::getRequestUri(), $pos);
}
//die('username: '******'') {
    OCP\Util::addHeader('link', array('rel' => 'openid.server', 'href' => OCP\Util::linkToRemote($remote_token) . $userName));
    OCP\Util::addHeader('link', array('rel' => 'openid.delegate', 'href' => OCP\Util::linkToAbsolute('', '?') . $userName));
}
OCP\App::registerPersonal('user_openid_provider', 'settings');