function poll_url($cid)
    {

        $abs_base = $GLOBALS['ABSOLUTE_URI_STUDIP'];

        # Fallback to HTTP for uos
        # TODO remove me ASAP
        if (0 === strncasecmp($abs_base, 'https', 5)) {
            if (stripos($abs_base, 'uos.de') !== FALSE || stripos($abs_base, 'uni-osnabrueck.de') !== FALSE) {
                $abs_base = 'http' . substr($abs_base, 5);
            }
        }

        # force an absolute URL
        URLHelper::setBaseUrl($abs_base);

        $url = current(explode('?', $this->url_for('poll', $cid)));

        # reset to the default set in plugins.php
        URLHelper::setBaseUrl($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP']);

        return $url;
    }
Example #2
0
<?php

# Lifter002: TODO
# Lifter007: TODO
# Lifter003: TODO
# Lifter010: TODO
/*
 * index.php - <short-description>
 *
 * Copyright (C) 2006 - Marcus Lunzenauer <*****@*****.**>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 */
require '../lib/bootstrap.php';
// prepare environment
URLHelper::setBaseUrl($GLOBALS['ABSOLUTE_URI_STUDIP']);
$request_uri = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '/';
$dispatcher = new StudipDispatcher();
$dispatcher->dispatch($request_uri);
<?php

if (!isset($pluginrelativepath)) {
    require '../../../../lib/bootstrap.php';
    page_open(array("sess" => "Seminar_Session", "auth" => "Seminar_Auth", "perm" => "Seminar_Perm", "user" => "Seminar_User"));
    require_once 'lib/visual.inc.php';
    require_once 'lib/functions.php';
    URLHelper::setBaseUrl('/');
}
require "Sajax.php";
function get_highscore()
{
    $db = new DB_Seminar("SELECT MAX(score) FROM murmeln_highscore");
    $db->next_record();
    return $db->f(0);
}
function get_highscore_list()
{
    $db = new DB_Seminar("SELECT murmeln_highscore.*,username FROM murmeln_highscore LEFT JOIN auth_user_md5 USING(user_id) ORDER BY score DESC LIMIT 20");
    $ret = '<ol>';
    $maxscore = 0;
    while ($db->next_record()) {
        $ret .= '<li><b>' . $db->f('score') . '</b> - 
				' . ($db->f('username') ? '<a href="' . UrlHelper::getLink('about.php?username='******'username')) . '">' . htmlReady(get_fullname_from_uname($db->f('username'))) . '</a>' : htmlready($db->f('name'))) . '</li>';
        $maxscore = $db->f('score');
    }
    $ret .= '</ol>';
    $db->query("DELETE FROM murmeln_highscore WHERE score < " . $maxscore);
    return $ret;
}
function set_highscore($score = 0)
Example #4
0
{
    $msg = explode($separator, $long_msg);
    $ret = array();
    for ($i = 0; $i < count($msg); $i = $i + 2) {
        if ($msg[$i + 1]) {
            $ret[] = trim(decodeHTML(preg_replace("'<[\\/\\!]*?[^<>]*?>'si", "", $msg[$i + 1])));
        }
    }
    return join("\n", $ret);
}
$STUDIP_BASE_PATH = realpath(dirname(__FILE__) . '/..');
$include_path = get_include_path();
$include_path .= PATH_SEPARATOR . $STUDIP_BASE_PATH . DIRECTORY_SEPARATOR . 'public';
set_include_path($include_path);
set_error_handler('CliErrorHandler');
require_once $STUDIP_BASE_PATH . "/lib/bootstrap.php";
// disable caching for cli scripts
$GLOBAL_CACHING_ENABLE = $GLOBALS['CACHING_ENABLE'];
$CACHING_ENABLE = false;
// set base url for URLHelper class
URLHelper::setBaseUrl($ABSOLUTE_URI_STUDIP);
//cli scripts run always as faked (Stud.IP) root
$auth = new Seminar_Auth();
$auth->auth = array('uid' => 'cli', 'uname' => 'cli', 'perm' => 'root');
$faked_root = new User();
$faked_root->user_id = 'cli';
$faked_root->username = '******';
$faked_root->perms = 'root';
$user = new Seminar_User($faked_root);
unset($faked_root);
$perm = new Seminar_Perm();
Example #5
0
# Lifter002: TODO
# Lifter007: TODO
# Lifter003: TODO
# Lifter010: TODO
/*
 * Copyright (C) 2007 - Marcus Lunzenauer <*****@*****.**>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 */
require '../lib/bootstrap.php';
# set base url for URLHelper class
URLHelper::setBaseUrl($CANONICAL_RELATIVE_PATH_STUDIP);
# initialize Stud.IP-Session
page_open(array('sess' => 'Seminar_Session', 'auth' => 'Seminar_Default_Auth', 'perm' => 'Seminar_Perm', 'user' => 'Seminar_User'));
try {
    require_once 'lib/seminar_open.php';
    # get plugin class from request
    $dispatch_to = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
    list($plugin_class, $unconsumed) = PluginEngine::routeRequest($dispatch_to);
    # retrieve corresponding plugin info
    $plugin_manager = PluginManager::getInstance();
    $plugin_info = $plugin_manager->getPluginInfo($plugin_class);
    # create an instance of the queried plugin
    $plugin = PluginEngine::getPlugin($plugin_class);
    # user is not permitted, show login screen
    if (is_null($plugin)) {
        # TODO (mlunzena) should not getPlugin throw this exception?
Example #6
0
<?php

namespace {
    StudipAutoloader::addAutoloadPath($GLOBALS['STUDIP_BASE_PATH'] . '/vendor/oauth-php/library');
    StudipAutoloader::addClassLookup('DocBlock', 'vendor/docblock-parser/docblock-parser.php');
    // Set base url for URLHelper class
    URLHelper::setBaseUrl($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP']);
}
namespace RESTAPI {
    use Studip, OAuthStore;
    // Define api version
    const VERSION = '2';
    $router = Router::getInstance();
    // Register JSON content renderer
    $router->registerRenderer(new Renderer\JSONRenderer(), true);
    // If in development mode, register debug content renderer
    if (defined('Studip\\ENV') && Studip\ENV === 'development') {
        $router->registerRenderer(new Renderer\DebugRenderer());
    }
    OAuthStore::instance('PDO', array('dsn' => 'mysql:host=' . $GLOBALS['DB_STUDIP_HOST'] . ';dbname=' . $GLOBALS['DB_STUDIP_DATABASE'], 'username' => $GLOBALS['DB_STUDIP_USER'], 'password' => $GLOBALS['DB_STUDIP_PASSWORD']));
    // Register default consumers
    Consumer\Base::addType('http', 'RESTAPI\\Consumer\\HTTP');
    Consumer\Base::addType('studip', 'RESTAPI\\Consumer\\Studip');
    Consumer\Base::addType('oauth', 'RESTAPI\\Consumer\\OAuth');
    // $router->registerConsumer('oauth', new Consumer\OAuth);
    // $router->registerConsumer('basic', new Consumer\HTTP);
    // $router->registerConsumer('studip', new Consumer\Studip);
}