Ejemplo n.º 1
0
 public function __construct($storage_engine = "mysql", $mysql_server = "localhost", $mysql_username = "******", $mysql_password = "", $mysql_db = "phprd", $mysql_table = "users")
 {
     $this->error = ErrorHandler::singleton();
     if (empty($storage_engine) || empty($mysql_server) || empty($mysql_username) || empty($mysql_db) || empty($mysql_table)) {
         $this->error->add_error_die("Not enough parameters for connection to DB");
     }
     switch ($storage_engine) {
         case "mysql":
             $this->db_handle = new mysql();
             $r = $this->db_handle->connect($mysql_server, $mysql_username, $mysql_password, $mysql_db);
             if (!$r) {
                 $this->error->add_error_die("Server <strong>{$mysql_server}</strong> connect failure");
             } else {
                 $query = 'CREATE TABLE IF NOT EXISTS `users`(`id` serial, `username` varchar(32) default "" not null, `password` varchar(32) default "" not null, `email` varchar(64) default "" not null, `group` varchar(32) default "" not null)';
                 $r = $this->db_handle->sql($query);
                 $this->storage = $storage_engine;
                 $this->db_table = $mysql_table;
             }
             break;
         case "file":
             $this->storage = $storage_engine;
             break;
         default:
             break;
     }
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     if (!class_exists("ErrorHandler")) {
         die("No error class, load+instantiate error class before template!");
     }
     $this->error_handler = ErrorHandler::singleton();
 }
Ejemplo n.º 3
0
 */
global $config, $page_attributes, $smarty, $lang_str, $_SERWEB;
print_html_head($page_attributes);
unset($page_attributes['tab_collection']);
$page_attributes['logout'] = false;
$page_attributes['self_account_delete'] = false;
print_html_body_begin($page_attributes);
//create copy of some options from config in order to sensitive options will not accessible via templates
$cfg = new stdclass();
$cfg->img_src_path = $config->img_src_path;
$cfg->js_src_path = $config->js_src_path;
$cfg->style_src_path = $config->style_src_path;
$cfg->user_pages_path = $config->user_pages_path;
$cfg->admin_pages_path = $config->admin_pages_path;
$cfg->domains_path = $config->domains_path;
$eh =& ErrorHandler::singleton();
$page_attributes['errors'] =& $eh->get_errors_array();
//	$page_attributes['message'] = &$message;
$smarty->assign_by_ref('parameters', $page_attributes);
$smarty->assign_by_ref("cfg", $cfg);
$smarty->assign_by_ref('lang_str', $lang_str);
$f_uname = $config->fully_qualified_name_on_login ? $this->auth['uname'] . '@' . $this->auth['realm'] : $this->auth['uname'];
/* create html form */
$form = array();
$form['start'] = '<form name="login_form" action="' . $this->url() . '" method=post>';
$form['username'] = '******' . $f_uname . '" autocomplete="off" size=32 disabled>';
$form['password'] = '******';
$form['okey'] = '<input type="submit" name="okey_x" id="okey" value="' . $lang_str['b_login'] . '">';
$form['finish'] = '</form>';
$smarty->assign_by_ref("form", $form);
/* 
Ejemplo n.º 4
0
 /**
  *	get error message from PEAR_Error object and write it to $errors array and to error log
  *
  *	This method may be called staticaly e.g.: ErrorHandler::log_errors($err_object);
  *	or dynamicaly e.g. $e = &ErrorHandler::singleton(); $e->log_errors($err_object);
  *
  *	@param object $err_object PEAR_Error object
  *	@return	none
  */
 function log_errors($err_object)
 {
     if (isset($this) and is_a($this, 'ErrorHandler')) {
         $in =& $this;
     } else {
         $in =& ErrorHandler::singleton();
     }
     log_errors($err_object, $in->errors);
 }
 function page_conroler()
 {
     $this->reg = Creg::singleton();
     // create regular expressions class
     $eh =& ErrorHandler::singleton();
     $eh->set_errors_ref($this->errors);
     $this->errors_from_get_param();
     $this->messages_from_get_param();
     $this->session_init();
     $this->init_this_uid_and_did();
     $this->set_interapu_vars();
 }
Ejemplo n.º 6
0
 function page_conroler()
 {
     $this->reg = Creg::singleton();
     // create regular expressions class
     $eh =& ErrorHandler::singleton();
     $eh->set_errors_ref($this->errors);
     $this->errors_from_get_param();
     $this->session_init();
     $this->xxl_init();
     $this->init_this_uid_and_did();
     $this->set_interapu_vars();
     // if $data_selected_proxy was not set, reference it to $data_auth
     if (!isset($GLOBALS['data_selected_proxy']) or !$GLOBALS['data_selected_proxy']) {
         $GLOBALS['data_selected_proxy'] =& $GLOBALS['data_auth'];
     }
 }