<?php
/**
*
* @author Benjamin Gillissen <hide@address.com>
*
* **************************************************************
Copyright (C) 2009 Benjamin Gillissen
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details at:
http://www.gnu.org/copyleft/gpl.html
* **************************************************************
*/
class pg_login extends pg_helper {
public static $PFEAT = Array();
public static $AJAX = Array();
public static $PARG = Array('realm', 'chal');
private $hdata;
public function __construct($pageid=NULL, $args=NULL){
if ( $pageid !== NULL AND $args !== NULL ){ parent::__construct($pageid, $args, self::$PFEAT, self::$AJAX); }
}
public static function getpfeats(){ return self::$PFEAT; }
public function send_header(){ }
public function send_content($pdata){
if ( $pdata !== NULL ){
//from realm html challenge pgen callback
$hdata['title'] = ' Login on Realm '.$this->args['realm'];
thm_mediaq::append_js_file('swap_realm');
if ($pdata['digest']){ thm_mediaq::append_js_file('authdigest'); }
themes::send_header($hdata);
unset($hdata);
$tpl = new template();
$tpl->output_function('langs::output_for_client');
if ( FALSE === $tpl->load_file('core/login.tpl') ){ return FALSE; }
$tpl->setdata($pdata);
$tpl->parse();
} else {
//direct pagegen call
$realm = new realm($this->args['realm']);
if ( empty($this->args['chal']) ){
$this->args['chal'] = configs::get('realm', 'realm', Array($this->args['realm'], 'chals', 0));
errors::raise("Missing page argument 'challenge', using first realm challenge", CORE_LOG_NOTICE, 'REALM');
}
$realm->login($this->args['chal'], NULL, TRUE);
}
}
public function send_footer(){ return themes::send_footer(); }
}
return 1;