Exemplo n.º 1
0
                            }
                        }
                    } else {
                        //Redirect to the subscription form
                        header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/inscription.php?username='******'openid.sreg.nickname'] . '&email=' . $res['openid.sreg.email'] . '&openid=' . $res['openid.identity'] . '&openid_msg=idnotfound');
                        //$loginFailed = true;
                    }
                } else {
                    $loginFailed = true;
                }
            } else {
                $loginFailed = true;
            }
        }
    } elseif (KeyAuth::is_enabled()) {
        $success = KeyAuth::instance()->login();
        if ($success) {
            $use_anonymous = false;
        }
    }
    $uidReset = true;
}
// end
if ($loginFailed == true && !empty($errorMessage)) {
    header('Location: ' . api_get_path(WEB_PUBLIC_PATH) . 'index?error=' . $errorMessage);
    exit;
}
//Now check for anonymous user mode
if (isset($use_anonymous) && $use_anonymous) {
    //if anonymous mode is set, then try to set the current user as anonymous
    //if he doesn't have a login yet
Exemplo n.º 2
0
<?php

/**
 * Displays courses tools activities in RSS format.
 *
 * @license see /license.txt
 * @author Laurent Opprecht <*****@*****.**> for the Univesity of Geneva
 */
//require_once dirname(__FILE__) . '/../inc/autoload.inc.php';
$controller = CourseNoticeController::instance();
KeyAuth::enable_services($controller);
$language_file = array('announcements', 'document', 'link', 'agenda', 'admin');
require_once dirname(__FILE__) . '/../inc/global.inc.php';
$controller->run();
Exemplo n.º 3
0
 *      - several documents (file and/or folders) zipped together
 *
 * Used to transfer files to another application through http.
 *
 * Script parameters:
 *
 *      - id        id(s) of the document id=1 or id=1,2,4
 *      - cidReq    course code
 *
 * Note this script enables key authentication so access with a key token is possible.
 *
 * @package chamilo.document
 * @license see /license.txt
 * @author Laurent Opprecht <*****@*****.**> for the Univesity of Geneva
 */
KeyAuth::enable();
require_once __DIR__ . '/../inc/global.inc.php';
$has_access = api_protect_course_script();
if (!$has_access) {
    exit;
}
session_cache_limiter('none');
$ids = Request::get('id', '');
$ids = $ids ? explode(',', $ids) : array();
$course = Course::current();
/**
 * No files requested. We make sure we return 404 error to tell the client
 * that the call failed.
 */
if (count($ids) == 0 || empty($course)) {
    Response::not_found();
Exemplo n.º 4
0
    /**
     * Returns a temporary url to download files and/or folders.
     * 
     * @param string|array $ids
     * @return string 
     */
    public static function download_url($ids, $tool)
    {
        $ids = is_array($ids) ? implode(',', $ids) : $ids;

        $params = Uri::course_params();
        $params['id'] = $ids;
        $params[KeyAuth::PARAM_ACCESS_TOKEN] = KeyAuth::create_temp_token();
        $result = Uri::url("/main/$tool/file.php", $params, false);
        return $result;
    }