public function __construct($node, $parent = null, $edit_type = 0)
 {
     global $a;
     global $user;
     global $thulit;
     $this->parent = $parent;
     if (isset($parent)) {
         $this->properties = $parent->properties;
     }
     load_node_properties($node, $this);
     $this->_prepare();
     load_properties($node, $this);
     //$this->display_tpl();
     $vl = $this->properties['view_level'];
     if (!isset($vl)) {
         $vl = 99;
     }
     if ($user['user_level'] > $vl) {
         loginFunction(2);
     } else {
         $this->_prepare();
         $this->_check();
         print_tpl($this);
     }
 }
function smarty_function_call_content($params, &$smarty)
{
    global $a;
    global $user;
    $vl = $params['obj']->properties['view_level'];
    if (!isset($vl)) {
        $vl = 99;
    }
    if ($user['user_level'] > $vl) {
        loginFunction('2');
    } else {
        $params['obj']->_call_part($params['part']);
    }
}
 public function __construct($node, $parent = null, $edit_type = 0)
 {
     global $a;
     global $user;
     $this->parent = $parent;
     if (isset($parent)) {
         $this->properties = $parent->properties;
     }
     load_properties($node, $this);
     $this->_prepare();
     //$this->display_tpl();
     if ($edit_type == 0) {
         //display node
         $vl = $this->properties['view_level'];
         if (!isset($vl)) {
             $vl = 99;
         }
         if ($user['user_level'] > $vl) {
             loginFunction(2);
         } else {
             print_tpl($this);
         }
     } elseif ($edit_type > 0) {
         //editing node
         $el = $this->properties['edit_level'];
         if (!isset($el)) {
             $el = 99;
         }
         if ($user['user_level'] <= $el) {
             $this->edit_text();
         } else {
             loginFunction(2);
         }
     } elseif ($edit_type < 0) {
         //saving changes
         $el = $this->properties['edit_level'];
         if (!isset($el)) {
             $el = 99;
         }
         if ($user['user_level'] <= $el) {
             $this->save_text();
         } else {
             loginFunction(2);
         }
     }
 }
Exemple #4
0
        $user_id = 0;
        //проверяем, существует ли такой пользователь в базе
        if ($q = mysql_query("SELECT user_id, seed, email, ident FROM ulogin where ident='{$data['identity']}'")) {
            $user = mysql_fetch_assoc($q);
            if (!($q = mysql_query("SELECT id FROM users where id='{$user['user_id']}'"))) {
                mysql_query("DELETE from ulogin where ident='{$data['identity']}'");
            } else {
                $user_id = $user['user_id'];
            }
        }
        //добавляем нового пользователя
        if (!$user_id) {
            //генерируем соль
            $seed = sha1(mt_rand());
            //генерируем хеш пароля. паролем служит строка $data['identity'].$seed
            $password = md5($data['identity']);
            //.$seed);
            $data['password'] = md5($data['first_name']);
            //добавляем пользователя в таблицу users сайта и получаем user_id новой записи
            if ($q = mysql_query("INSERT INTO users (first_name, last_name, password,email)\r\n                    VALUES ('{$data['first_name']}','{$data['last_name']}','{$password}','{$data['email']}')")) {
                $user_id = mysql_insert_id();
                register_forum($data, $data['password']);
                if ($q = mysql_query("INSERT INTO ulogin (user_id, ident, email, seed)\r\n                        VALUES ('{$user_id}','{$data['identity']}','{$data['email']}','{$seed}')")) {
                    //подготовим юзера к авторизации
                    $user = array('ident' => $data['identity'], 'email' => $data['email'], 'user_id' => $user_id, 'seed' => $seed, 'nick' => $data['nickname']);
                }
            }
        }
        loginFunction($user);
    }
}
Exemple #5
0
    $message = 'loggedOut';
    $auth->logout();
    loginFunction();
    exit;
}
// check run mode
switch (WEBPAGE::$runMode) {
    case WEBPAGE::_RUN_MODE_NORMAL:
        break;
    case WEBPAGE::_RUN_MODE_OUTDATED:
        require 'includes/index.update.inc';
        exit;
    default:
        $message = 'loggedOut.maintenance';
        $auth->logout();
        loginFunction();
        exit;
}
// check permissions here ....  first line below is just an example
//if (!(is_numeric(WEBPAGE::$userAccessCode))) { exit; }
if (!(intval(WEBPAGE::$userAccessCode) & intval($_CONF[WEBPAGE::$scr_name]))) {
    $message = 'loggedOut';
    $auth->logout();
    loginFunction();
    exit;
}
//echo '<pre>';print_r($_CONF['url']);echo '</pre>';
//echo $_SESSION['_authsession']['data']['url'];
require './includes/index.inc';
?>