mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 00:15:51 +00:00
Merge branch 'dev' of ../p3 into dev
This commit is contained in:
commit
869abbea59
3 changed files with 84 additions and 58 deletions
|
@ -21,21 +21,62 @@ class WebServer {
|
||||||
|
|
||||||
sys_boot();
|
sys_boot();
|
||||||
|
|
||||||
|
$this->start_session();
|
||||||
|
|
||||||
App::$language = get_best_language();
|
$this->set_language();
|
||||||
load_translation_table(App::$language,App::$install);
|
|
||||||
|
|
||||||
|
$this->set_identities();
|
||||||
|
|
||||||
/**
|
$this->initialise_notifications();
|
||||||
*
|
|
||||||
* Important stuff we always need to do.
|
if (App::$install) {
|
||||||
*
|
|
||||||
* The order of these may be important so use caution if you think they're all
|
/*
|
||||||
* intertwingled with no logical order and decide to sort it out. Some of the
|
* During installation, only permit the view module and setup module.
|
||||||
* dependencies have changed, but at least at one time in the recent past - the
|
* The view module is required to expand/replace variables in style.css
|
||||||
* order was critical to everything working properly
|
*/
|
||||||
*
|
|
||||||
*/
|
if (App::$module !== 'view') {
|
||||||
|
App::$module = 'setup';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check_config() is responsible for running update scripts. These automatically
|
||||||
|
* update the DB schema whenever we push a new one out. It also checks to see if
|
||||||
|
* any plugins have been added or removed and reacts accordingly.
|
||||||
|
*/
|
||||||
|
|
||||||
|
check_config();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->create_channel_links();
|
||||||
|
|
||||||
|
$this->initialise_content();
|
||||||
|
|
||||||
|
$Router = new Router();
|
||||||
|
$Router->Dispatch();
|
||||||
|
|
||||||
|
// if the observer is a visitor, add some javascript to the page to let
|
||||||
|
// the application take them home.
|
||||||
|
|
||||||
|
$this->set_homebase();
|
||||||
|
|
||||||
|
// now that we've been through the module content, see if the page reported
|
||||||
|
// a permission problem via session based notifications and if so, a 403
|
||||||
|
// response would seem to be in order.
|
||||||
|
|
||||||
|
if (is_array($_SESSION['sysmsg']) && stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
|
||||||
|
header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
construct_page();
|
||||||
|
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function start_session() {
|
||||||
|
|
||||||
if (App::$session) {
|
if (App::$session) {
|
||||||
App::$session->start();
|
App::$session->start();
|
||||||
|
@ -45,24 +86,45 @@ class WebServer {
|
||||||
register_shutdown_function('session_write_close');
|
register_shutdown_function('session_write_close');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
}
|
||||||
* Language was set earlier, but we can over-ride it in the session.
|
|
||||||
* We have to do it here because the session was just now opened.
|
private function set_language() {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Determine the language of the interface
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// First use the browser preference, if available. This will fall back to 'en'
|
||||||
|
// if there is no built-in language support for the preferred languagge
|
||||||
|
|
||||||
|
|
||||||
|
App::$language = get_best_language();
|
||||||
|
load_translation_table(App::$language, App::$install);
|
||||||
|
|
||||||
|
// See if there's a request to over-ride the language
|
||||||
|
// store it in the session.
|
||||||
|
|
||||||
if (array_key_exists('system_language',$_REQUEST)) {
|
if (array_key_exists('system_language',$_REQUEST)) {
|
||||||
if (strlen($_REQUEST['system_language'])) {
|
if (strlen($_REQUEST['system_language'])) {
|
||||||
$_SESSION['language'] = $_REQUEST['system_language'];
|
$_SESSION['language'] = $_REQUEST['system_language'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// reset to default if it's an empty string
|
||||||
unset($_SESSION['language']);
|
unset($_SESSION['language']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((x($_SESSION, 'language')) && ($_SESSION['language'] !== $lang)) {
|
|
||||||
|
// If we've over-ridden the language, set it now.
|
||||||
|
|
||||||
|
if ((x($_SESSION, 'language')) && ($_SESSION['language'] !== App::$language)) {
|
||||||
App::$language = $_SESSION['language'];
|
App::$language = $_SESSION['language'];
|
||||||
load_translation_table(App::$language);
|
load_translation_table(App::$language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function set_identities() {
|
||||||
|
|
||||||
if ((x($_GET,'zid')) && (! App::$install)) {
|
if ((x($_GET,'zid')) && (! App::$install)) {
|
||||||
App::$query_string = strip_zids(App::$query_string);
|
App::$query_string = strip_zids(App::$query_string);
|
||||||
if (! local_channel()) {
|
if (! local_channel()) {
|
||||||
|
@ -90,7 +152,9 @@ class WebServer {
|
||||||
if ((x($_SESSION, 'authenticated')) || (x($_POST, 'auth-params')) || (App::$module === 'login')) {
|
if ((x($_SESSION, 'authenticated')) || (x($_POST, 'auth-params')) || (App::$module === 'login')) {
|
||||||
require('include/auth.php');
|
require('include/auth.php');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function initialise_notifications() {
|
||||||
if (! x($_SESSION, 'sysmsg')) {
|
if (! x($_SESSION, 'sysmsg')) {
|
||||||
$_SESSION['sysmsg'] = [];
|
$_SESSION['sysmsg'] = [];
|
||||||
}
|
}
|
||||||
|
@ -98,49 +162,8 @@ class WebServer {
|
||||||
if (! x($_SESSION, 'sysmsg_info')) {
|
if (! x($_SESSION, 'sysmsg_info')) {
|
||||||
$_SESSION['sysmsg_info'] = [];
|
$_SESSION['sysmsg_info'] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (App::$install) {
|
|
||||||
/* Allow an exception for the view module so that pcss will be interpreted during installation */
|
|
||||||
if (App::$module !== 'view')
|
|
||||||
App::$module = 'setup';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* check_config() is responsible for running update scripts. These automatically
|
|
||||||
* update the DB schema whenever we push a new one out. It also checks to see if
|
|
||||||
* any plugins have been added or removed and reacts accordingly.
|
|
||||||
*/
|
|
||||||
|
|
||||||
check_config();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->create_channel_links();
|
|
||||||
|
|
||||||
$Router = new Router();
|
|
||||||
|
|
||||||
$this->initialise_content();
|
|
||||||
|
|
||||||
$Router->Dispatch();
|
|
||||||
|
|
||||||
$this->set_homebase();
|
|
||||||
|
|
||||||
// now that we've been through the module content, see if the page reported
|
|
||||||
// a permission problem and if so, a 403 response would seem to be in order.
|
|
||||||
|
|
||||||
if (is_array($_SESSION['sysmsg']) && stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
|
|
||||||
header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.'));
|
|
||||||
}
|
|
||||||
|
|
||||||
call_hooks('page_end', App::$page['content']);
|
|
||||||
|
|
||||||
construct_page();
|
|
||||||
|
|
||||||
killme();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function initialise_content() {
|
private function initialise_content() {
|
||||||
|
|
||||||
/* initialise content region */
|
/* initialise content region */
|
||||||
|
|
2
boot.php
2
boot.php
|
@ -2182,6 +2182,8 @@ function exec_pdl() {
|
||||||
*/
|
*/
|
||||||
function construct_page() {
|
function construct_page() {
|
||||||
|
|
||||||
|
call_hooks('page_end', App::$page['content']);
|
||||||
|
|
||||||
exec_pdl();
|
exec_pdl();
|
||||||
|
|
||||||
$comanche = ((isset(App::$layout) && is_array(App::$layout) && count(App::$layout)) ? true : false);
|
$comanche = ((isset(App::$layout) && is_array(App::$layout) && count(App::$layout)) ? true : false);
|
||||||
|
|
|
@ -344,6 +344,7 @@ function import_remote_xchan_photo($photo, $xchan, $thing = false) {
|
||||||
|
|
||||||
// Assume the worst.
|
// Assume the worst.
|
||||||
$failed = true;
|
$failed = true;
|
||||||
|
$type = EMPTY_STR;
|
||||||
|
|
||||||
$path = Hashpath::path((($thing) ? $photo . $xchan : $xchan),'cache/xp',2);
|
$path = Hashpath::path((($thing) ? $photo . $xchan : $xchan),'cache/xp',2);
|
||||||
$hash = basename($path);
|
$hash = basename($path);
|
||||||
|
|
Loading…
Reference in a new issue