$v){ if(strncmp($k, "pre_", 4)!=0){ $args_login[]="$k=$v"; } } $qs_login=''; if($args_login){ $qs_login="?".implode('&', $args_login); } if(!$debug_nologin){ $uid=query_value("select u.uid from users as u where u.email='".dbesc($args['pre_email'])."' and u.haslo=PASSWORD('".dbesc($args['pre_pass'])."') and u.status_user='aktywny'"); if($uid){ query("update users as u set u.logins=ifnull(u.logins+1, 1), last_login=now() where u.uid=$uid"); load_profile($uid); save_state(); header("Location: index.php".$qs_login); exit; } else { if($args['pre_email']){ header("Location: $frontrelpath".( $qs_login ? $qs_login."&pre_login_err=1" : "?pre_login_err=1" )); } else { header("Location: $frontrelpath".$qs_login); } exit; } } } else { // a tu taki myk jakby ktorys admin wywalil uzytkownika gdy ten jest zalogowany if(!$debug_nologin){ $cnt=query_value("select count(*) as cnt from users as u where uid=$app_user->uid and status_user='aktywny'"); if(!$cnt){ session_destroy(); header("Location: $frontrelpath"); exit; } } } if($args['app_logout']) { session_destroy(); header("location: $frontrelpath"); exit; } if($args['noctx']) { unset($args['noctx']); reset_tvars(); $app_bookmarks=array(); $context=''; }; /* if($app_user->logins==0) { if(!in_array($args['haction'], array('m_dane_save', 'm_konfig_save', 'm_o_mnie_save', 'sel_lang_set'))) { unset($args['haction']); if(!in_array($args['vaction'], array('m_dane', 'm_konfig', 'm_o_mnie'))) $args['vaction']='m_initpath'; }; }; */ $slang=tvar('glob_slang'); $slang_id=tvar('glob_slang_id'); $slang_collate=tvar('glob_slang_collate'); if(!$slang || !$slang_id){ $slang_id=$app_user->jezyk; if($slang_id){ tvar('glob_slang_id', $slang_id); $slang=$app_user->jezyk_kod; tvar('glob_slang', $slang); $slang_collate=$app_user->kolacja; tvar('glob_slang_collate', $slang_collate); } else { $slang_id=$def_slang_id; $slang=$def_slang; $slang_collate=$def_slang_collate; } } $sql_collate=''; if($slang_collate) $sql_collate="collate $slang_collate"; if(file_exists("lang/${slang}.inc.php")) include_once "lang/${slang}.inc.php"; // akcje niewidoczne (haction) if($args['haction']) { if(isperm($args['haction'])) $app_haction=$args['haction']; }; unset($args['haction']); if($app_haction) { if($debug && !$debug_noforward) ob_start(); $i=0; do{ if($debug) print "
DEBUG: app_haction=$app_haction
\n"; action($app_haction); if($app_nexthaction) $app_haction=$app_nexthaction; else $app_haction=null; $app_nexthaction=null; }while($app_haction && ++$i<$app_maxhactions); if($debug && !$debug_noforward) { $hlog=ob_get_contents(); // mozna ob_get_clean() ale to jest od PHP 4.3.0, lepiej uwazac ob_end_clean(); }; if(!$app_nextvaction) // hakcja nie ustawila zadnej vakcji wiec staramy sie ustawic ta co byla poprzednio { if($app_history) { $ob=end($app_history); reset($app_history); $app_nextvaction=$ob->vaction; $app_nextvaction_args=$ob->args; }else { $app_nextvaction=$cfg['role_akcje'][$app_user->rola]; $app_nextvaction_args=array(); }; }; $oryg_args=$args; if(!$debug_noforward){ if($debug) tvar('hlog', $hlog); header("Location: ".make_url_('vaction', $app_nextvaction, $app_nextvaction_args, 0)); save_state(); exit; } } $app_haction=null; $app_nexthaction=null; // akcje widoczne (vaction) $app_reg_params=array(); // to czyscimy przed vakcjami! if($app_nextvaction){ $app_vaction=$app_nextvaction; $args=$app_nextvaction_args; } else if($args['vaction']){ if(isperm($args['vaction'])){ $app_vaction=$args['vaction']; } else { if($debug){ tvar('hlog', $hlog); } header("Location: ".make_url_('vaction', $cfg['role_akcje'][$app_user->rola], array(), 1)); save_state(); exit; } unset($args['vaction']); } else { $app_vaction=$cfg['role_akcje'][$app_user->rola]; } include "header.php"; if($debug){ if(!$debug_noforward) { $hlog=tvar('hlog'); tvar('hlog', null); } print $hlog; } if(!$ob){ $ob = new stdClass(); } $ob->vaction=$app_vaction; $ob->args=$args; if($debug){ print "
DEBUG: app_vaction=$app_vaction
\n"; } action($app_vaction); array_push($app_history, $ob); $c=count($app_history); if($c>$app_maxhistory){ array_splice($app_history, 0, $c-$app_maxhistory); } include "footer.php"; unset($oryg_args); save_state(); session_write_close(); ?>