Esempio n. 1
0
 function sotf_Page()
 {
     global $lang, $user, $outputLanguages, $smarty, $defaultLanguage;
     global $nodeId, $basedir, $lang, $rootdir, $imagedir, $smartyDebug, $debug;
     // start session
     session_start();
     // load user data
     if ($_SESSION['userid']) {
         //debug("userid", $_SESSION['userid']);
         $this->user = new sotf_User($_SESSION['userid']);
     }
     // Currently it is not needed
     /*else
     		{
     			$this->user = new sotf_User();
     		}*/
     $user = $this->user;
     // determine language
     if ($this->user) {
         $lang = $this->user->language;
         if (!in_array($lang, $outputLanguages)) {
             $lang = '';
         }
         // user's language is not allowed yet
     }
     if (!$lang && in_array($_SERVER['HTTP_ACCEPT_LANGUAGE'], $outputLanguages)) {
         $lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
     }
     if (!$lang) {
         $lang = $defaultLanguage;
     }
     // load localization constants for language
     $this->loadLoc();
     // determine the action
     preg_match('/(\\w+)\\.php$/', $_SERVER['SCRIPT_NAME'], $m);
     $this->action = $m[1];
     // auth key generation
     if (!$this->loggedIn()) {
         if (!$this->getAuthKey()) {
             $key = sotf_Utils::randString(30);
             //debug("KEY", $key);
             $c = base64_encode(myGetenv("REMOTE_ADDR") . ':' . $key);
             if (!setcookie($this->authKeyName, $c, time() + 365 * 24 * 3600, '/')) {
                 debug("could not set cookie for auth key");
             }
         }
     }
 }
 function sotf_Page()
 {
     global $lang, $user, $config, $smarty;
     // load user data
     if ($_SESSION['currentUserId']) {
         //debug("userid", $_SESSION['currentUserId']);
         $this->user = new sotf_User($_SESSION['currentUserId']);
     }
     // Currently it is not needed
     /*else
     		{
     			$this->user = new sotf_User();
     		}*/
     $user = $this->user;
     // determine language
     $lang = sotf_Utils::getParameter('uiLang');
     if (!$lang) {
         $lang = $_COOKIE['uiLang'];
     }
     if (!$lang && $this->user) {
         $lang = $this->user->language;
     }
     debug("LANG1", $lang);
     // check if this is an allowed language
     $langOK = false;
     foreach ($config['outputLanguages'] as $oLang) {
         if ($lang == $oLang[0]) {
             $langOK = true;
             break;
         }
     }
     if (!$langOK) {
         $lang = '';
     }
     // user's language is not allowed yet
     debug("LANG2", $lang);
     /*
     	if(!$lang && in_array($_SERVER['HTTP_ACCEPT_LANGUAGE'], $config['outputLanguages']))
       $lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
     */
     if (!$lang) {
         $lang = $config['defaultLanguage'];
     }
     debug("LANG5", $lang);
     // load localization constants for language
     $this->loadLoc();
     // determine the action
     preg_match('/(\\w+)\\.php$/', $_SERVER['SCRIPT_NAME'], $m);
     $this->action = $m[1];
     // auth key generation
     if (!headers_sent() && !$this->loggedIn()) {
         if (!$this->getAuthKey()) {
             $key = sotf_Utils::randString(30);
             //debug("KEY", $key);
             $c = base64_encode(myGetenv("REMOTE_ADDR") . ':' . $key);
             if (!setcookie($this->authKeyName, $c, time() + 365 * 24 * 3600, '/')) {
                 debug("could not set cookie for auth key");
             }
         }
     }
 }
Esempio n. 3
0
 * Created for the StreamOnTheFly project (IST-2001-32226)
 * Author: Martin Schmidt, ptmschmidt@fh-stpoelten.ac.at
 */
require "init.inc.php";
$username = sotf_Utils::getParameter('userid');
$email = sotf_Utils::getParameter('email');
$okURL = sotf_Utils::getParameter('okURL');
if ($username && $email) {
    $temp_user = new sotf_User();
    $storage = $temp_user->getStorageObject();
    $fields['userid'] = $temp_user->getUserid($username);
    if ($fields['userid'] != NULL) {
        $data = $storage->userDbSelect($fields);
    }
    if ($email == $data['email'] && $username == $data['username']) {
        $new_password = sotf_Utils::randString(6);
        global $page;
        $login_href = "http://" . $_SERVER['HTTP_HOST'] . $config['localPrefix'] . "/login.php";
        $subject = $page->getlocalized("pass_mail_subject");
        $message = $page->getlocalizedWithParams("pass_mail_message", $username, $new_password, $login_href);
        mail($email, $subject, $message, "From: no-reply@streamonthefly.org\r\nX-Mailer: PHP/" . phpversion() . "\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset=utf-8\r\nContent-Transfer-Encoding: 8bit\r\n\r\n");
        $fields['password'] = $new_password;
        $fields['email'] = $email;
        $storage->userDbUpdate($fields);
    } else {
        $errorMsg = $page->getlocalized("new_pass_error");
    }
    if (!$errorMsg) {
        if ($okURL) {
            $page->redirect($okURL);
        } else {