Ejemplo n.º 1
0
 protected function start_session($user_id)
 {
     global $perm, $user, $auth, $sess, $forced_language, $_language;
     $user = new Seminar_User();
     $user->start($user_id);
     foreach (array("uid" => $user_id, "perm" => $user->perms, "uname" => $user->username, "auth_plugin" => $user->auth_plugin, "exp" => time() + 60 * 15, "refresh" => time()) as $k => $v) {
         $auth->auth[$k] = $v;
     }
     $auth->nobody = false;
     $sess->regenerate_session_id(array('auth', 'forced_language', '_language'));
     $sess->freeze();
 }
    return true;
}
function parse_msg_to_clean_text($long_msg, $separator = "§")
{
    $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
$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');
$user = new Seminar_User();
$user->fake_user = true;
$user->register_globals = false;
$user->start('cli');
$perm = new Seminar_Perm();