/** * Internal function used to assign the session details to a user's new session. * @param object $u The user+session object we (probably) read from the database. */ function AssignSessionDetails($u) { if (!isset($u->principal_id)) { // If they don't have a principal_id set then we should re-read from our local database $qry = new AwlQuery('SELECT * FROM dav_principal WHERE username = :username', array(':username' => $u->username)); if ($qry->Exec() && $qry->rows() == 1) { $u = $qry->Fetch(); } } parent::AssignSessionDetails($u); $this->GetRoles(); if (function_exists('awl_set_locale') && isset($this->locale) && $this->locale != '') { awl_set_locale($this->locale); } }
/** * The constructor, which just calls the actual type configured */ function PublicSession() { global $c; $principal = new Principal('username', 'unauthenticated'); // Assign each field in the selected record to the object foreach ($principal as $k => $v) { $this->{$k} = $v; } $this->username = $principal->username(); $this->user_no = $principal->user_no(); $this->principal_id = $principal->principal_id(); $this->email = $principal->email(); $this->dav_name = $principal->dav_name(); $this->principal = $principal; if (function_exists("awl_set_locale") && isset($this->locale) && $this->locale != "") { awl_set_locale($this->locale); } $this->groups = isset($c->public_groups) ? $c->public_groups : array(); $this->roles = array('Public' => true); $this->logged_in = false; }
} if (isset($_SERVER['HTTP_X_DAVICAL_TESTCASE'])) { @dbg_error_log('LOG', '==========> Test case =%s=', $_SERVER['HTTP_X_DAVICAL_TESTCASE']); } else { if (isset($c->dbg['script_start']) && $c->dbg['script_start']) { // Only log this if more than a little debugging of some sort is turned on, somewhere @dbg_error_log('LOG', '==========> method =%s= =%s= =%s= =%s= =%s=', $_SERVER['REQUEST_METHOD'], $c->protocol_server_port_script, isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '$_SERVER[PATH_INFO] undefined', $c->base_url, $c->base_directory); } } /** * Now that we have loaded the configuration file we can switch to a * default site locale. This may be overridden by each user. */ putenv("LANG=" . $c->default_locale); if (function_exists('awl_set_locale')) { awl_set_locale($c->default_locale); init_gettext('davical', $c->locale_path); } /** * Work out our version * */ $c->code_version = 0; $c->want_awl_version = '0.54'; $c->version_string = '1.1.2'; // The actual version # is replaced into that during the build /release process if (isset($c->version_string) && preg_match('/(\\d+)\\.(\\d+)\\.(\\d+)(.*)/', $c->version_string, $matches)) { $c->code_major = $matches[1]; $c->code_minor = $matches[2]; $c->code_patch = $matches[3]; $c->code_version = $c->code_major * 1000 + $c->code_minor . '.' . $c->code_patch;
/** * Internal function used to assign the session details to a user's new session. * @param object $u The user+session object we (probably) read from the database. */ function AssignSessionDetails($u) { if (!isset($u->principal_id)) { // If they don't have a principal_id set then we should re-read from our local database $qry = new AwlQuery('SELECT * FROM dav_principal WHERE username = :username', array(':username' => $u->username)); if ($qry->Exec() && $qry->rows() == 1) { $u = $qry->Fetch(); } } // Assign each field in the selected record to the object foreach ($u as $k => $v) { $this->{$k} = $v; } $this->GetRoles(); $this->logged_in = true; if (function_exists("awl_set_locale") && isset($this->locale) && $this->locale != "") { awl_set_locale($this->locale); } }
/** * Internal function used to assign the session details to a user's new session. * @param object $u The user+session object we (probably) read from the database. */ function AssignSessionDetails($principal) { if (is_string($principal)) { $principal = new Principal('username', $principal); } if (get_class($principal) != 'Principal') { $principal = new Principal('username', $principal->username); } // Assign each field in the selected record to the object foreach ($principal as $k => $v) { $this->{$k} = $v; } if (!get_class($principal) == 'Principal') { throw new Exception('HTTPAuthSession::AssignSessionDetails could not find a Principal object'); } $this->username = $principal->username(); $this->user_no = $principal->user_no(); $this->principal_id = $principal->principal_id(); $this->email = $principal->email(); $this->dav_name = $principal->dav_name(); $this->principal = $principal; $this->GetRoles(); $this->logged_in = true; if (function_exists("awl_set_locale") && isset($this->locale) && $this->locale != "") { awl_set_locale($this->locale); } }