plugins/SpecialUserFuncs.php
changeset 372 5bd429428101
parent 371 dc6026376919
child 377 bb3e6c3bd4f4
equal deleted inserted replaced
371:dc6026376919 372:5bd429428101
   371     $data = enano_json_decode($_POST['params']);
   371     $data = enano_json_decode($_POST['params']);
   372     $captcha_hash = ( isset($data['captcha_hash']) ) ? $data['captcha_hash'] : false;
   372     $captcha_hash = ( isset($data['captcha_hash']) ) ? $data['captcha_hash'] : false;
   373     $captcha_code = ( isset($data['captcha_code']) ) ? $data['captcha_code'] : false;
   373     $captcha_code = ( isset($data['captcha_code']) ) ? $data['captcha_code'] : false;
   374     $level = ( isset($data['level']) ) ? intval($data['level']) : USER_LEVEL_MEMBER;
   374     $level = ( isset($data['level']) ) ? intval($data['level']) : USER_LEVEL_MEMBER;
   375     $result = $session->login_with_crypto($data['username'], $data['crypt_data'], $data['crypt_key'], $data['challenge'], $level, $captcha_hash, $captcha_code);
   375     $result = $session->login_with_crypto($data['username'], $data['crypt_data'], $data['crypt_key'], $data['challenge'], $level, $captcha_hash, $captcha_code);
   376     $session->start();
       
   377     
       
   378     // Run the session_started hook to establish special pages
       
   379     $code = $plugins->setHook('session_started');
       
   380     foreach ( $code as $cmd )
       
   381     {
       
   382       eval($cmd);
       
   383     }
       
   384     
   376     
   385     if ( $result['success'] )
   377     if ( $result['success'] )
   386     {
   378     {
   387       $response = Array(
   379       $response = Array(
   388           'result' => 'success',
   380           'result' => 'success',
   417     }
   409     }
   418     else
   410     else
   419     {
   411     {
   420       $result = $session->login_without_crypto($_POST['username'], $_POST['pass'], false, intval($_POST['auth_level']), $captcha_hash, $captcha_code);
   412       $result = $session->login_without_crypto($_POST['username'], $_POST['pass'], false, intval($_POST['auth_level']), $captcha_hash, $captcha_code);
   421     }
   413     }
   422     $session->start();
   414    
   423     
       
   424     // Run the session_started hook to establish special pages
       
   425     $code = $plugins->setHook('session_started');
       
   426     foreach ( $code as $cmd )
       
   427     {
       
   428       eval($cmd);
       
   429     }
       
   430     
       
   431     $paths->init();
       
   432     if($result['success'])
   415     if($result['success'])
   433     {
   416     {
       
   417       $session->start();
       
   418       
   434       $template->load_theme($session->theme, $session->style);
   419       $template->load_theme($session->theme, $session->style);
   435       if(isset($_POST['return_to']))
   420       if(isset($_POST['return_to']))
   436       {
   421       {
   437         $name = ( isset($paths->pages[$_POST['return_to']]['name']) ) ? $paths->pages[$_POST['return_to']]['name'] : $_POST['return_to'];
   422         $name = ( isset($paths->pages[$_POST['return_to']]['name']) ) ? $paths->pages[$_POST['return_to']]['name'] : $_POST['return_to'];
   438         $subst = array(
   423         $subst = array(