예제 #1
0
/**
 * Shortcut for HTML imports
 * @param string $app the appname
 * @param string|string[] $file the path relative to the app's component folder,
 * if an array is given it will add all components
 */
function component($app, $file)
{
    if (is_array($file)) {
        foreach ($file as $f) {
            $url = link_to($app, 'component/' . $f . '.html');
            OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url));
        }
    } else {
        $url = link_to($app, 'component/' . $file . '.html');
        OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url));
    }
}
예제 #2
0
 /**
  * Add a custom element to the header
  * If $text is null then the element will be written as empty element.
  * So use "" to get a closing tag.
  * @param string $tag tag name of the element
  * @param array $attributes array of attributes for the element
  * @param string $text the text content for the element
  * @since 4.0.0
  */
 public static function addHeader($tag, $attributes, $text = null)
 {
     \OC_Util::addHeader($tag, $attributes, $text);
 }
<?php

//check if curl extension installed
if (!in_array('curl', get_loaded_extensions())) {
    return;
}
$userName = '';
if (strpos($_SERVER["REQUEST_URI"], '?') and !strpos($_SERVER["REQUEST_URI"], '=')) {
    if (strpos($_SERVER["REQUEST_URI"], '/?')) {
        $userName = substr($_SERVER["REQUEST_URI"], strpos($_SERVER["REQUEST_URI"], '/?') + 2);
    } elseif (strpos($_SERVER["REQUEST_URI"], '.php?')) {
        $userName = substr($_SERVER["REQUEST_URI"], strpos($_SERVER["REQUEST_URI"], '.php?') + 5);
    }
}
OC_Util::addHeader('link', array('rel' => 'openid.server', 'href' => OC_Helper::linkTo("user_openid", "user.php", null, true) . '/' . $userName));
OC_Util::addHeader('link', array('rel' => 'openid.delegate', 'href' => OC_Helper::linkTo("user_openid", "user.php", null, true) . '/' . $userName));
OC_APP::registerPersonal('user_openid', 'settings');
require_once 'apps/user_openid/user_openid.php';
//active the openid backend
OC_User::useBackend('openid');
//check for results from openid requests
if (isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res') {
    if (defined("DEBUG") && DEBUG) {
        error_log('openid retured');
    }
    $openid = new SimpleOpenID();
    $openid->SetIdentity($_GET['openid_identity']);
    $openid_validation_result = $openid->ValidateWithServer();
    if ($openid_validation_result == true) {
        // OK HERE KEY IS VALID
        if (defined("DEBUG") && DEBUG) {