Remove session creation in scripts

This commit is contained in:
bergware
2022-07-06 08:50:22 +02:00
parent 1dc59e5fd9
commit 594533f8a2
15 changed files with 32 additions and 61 deletions

View File

@@ -12,7 +12,6 @@
*/
?>
<?
session_start();
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
@@ -20,7 +19,7 @@ extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = 'docker';
$_SESSION['locale'] = $display['locale'];
$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";
$unit = ['B','kB','MB','GB','TB','PB','EB','ZB','YB'];

View File

@@ -1,7 +1,7 @@
#!/usr/bin/php
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2014-2018, Guilherme Jardim, Eric Schultz, Jon Panozzo.
/* Copyright 2005-2022, Lime Technology
* Copyright 2014-2022, Guilherme Jardim, Eric Schultz, Jon Panozzo.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -12,16 +12,14 @@
*/
?>
<?
session_start();
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
$unraid = parse_plugin_cfg('dynamix', true);
$unraid = parse_plugin_cfg('dynamix', true);
// Multi-language support
$_SESSION['locale'] = $unraid['display']['locale'];
$_SERVER['REQUEST_URI'] = "scripts";
$login_locale = $unraid['display']['locale'];
require_once "$docroot/webGui/include/Translations.php";
exec("pgrep docker", $pid);

View File

@@ -12,7 +12,6 @@
*/
?>
<?
session_start();
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
@@ -21,7 +20,7 @@ extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = 'plugins';
$_SESSION['locale'] = $display['locale'];
$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";
$console = $argv[$argc-1] != 'nchan'; // console or nchan output

View File

@@ -1,7 +1,7 @@
#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2022, Lime Technology
* Copyright 2012-2022, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -12,19 +12,17 @@
*/
?>
<?
session_start();
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
$var = parse_ini_file('/var/local/emhttp/var.ini');
$unraid = parse_plugin_cfg('dynamix', true);
$var = parse_ini_file('/var/local/emhttp/var.ini');
$unraid = parse_plugin_cfg('dynamix', true);
// Multi-language support
$_SESSION['locale'] = $unraid['display']['locale'];
$_SERVER['REQUEST_URI'] = "scripts";
$login_locale = $unraid['display']['locale'];
require_once "$docroot/webGui/include/Translations.php";
$server = strtoupper($var['NAME']);

View File

@@ -1,7 +1,7 @@
#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
/* Copyright 2005-2022, Lime Technology
* Copyright 2012-2022, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -12,18 +12,17 @@
*/
?>
<?
session_start();
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
$var = parse_ini_file('/var/local/emhttp/var.ini');
$unraid = parse_plugin_cfg('dynamix', true);
$var = parse_ini_file('/var/local/emhttp/var.ini');
$unraid = parse_plugin_cfg('dynamix', true);
// Multi-language support
$_SESSION['locale'] = $unraid['display']['locale'];
$_SERVER['REQUEST_URI'] = "scripts";
$login_locale = $unraid['display']['locale'];
require_once "$docroot/webGui/include/Translations.php";
function apos($text) {

View File

@@ -12,7 +12,6 @@
*/
?>
<?
session_start();
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
@@ -20,7 +19,7 @@ extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = 'plugins';
$_SESSION['locale'] = $display['locale'];
$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";
$file = realpath($argv[1] ?? '');

View File

@@ -1,7 +1,7 @@
#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
/* Copyright 2005-2022, Lime Technology
* Copyright 2012-2022, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -12,7 +12,6 @@
*/
?>
<?
session_start();
$docroot = '/usr/local/emhttp';
$varroot = '/var/local/emhttp';
$pool_log = '/var/tmp/pool_log.tmp';
@@ -25,15 +24,12 @@ extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = 'main';
$_SESSION['locale'] = $display['locale'];
$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";
// remember current language
$locale_init = $locale;
// close session, it is not needed anymore
session_unset();
session_destroy();
function initSum() {
return ['count'=>0, 'temp'=>0, 'fsSize'=>0, 'fsUsed'=>0, 'fsFree'=>0, 'ioReads'=>0, 'ioWrites'=>0, 'numReads'=>0, 'numWrites'=>0, 'numErrors'=>0];
}

View File

@@ -12,7 +12,6 @@
*/
?>
<?
session_start();
$docroot = '/usr/local/emhttp';
$varroot = '/var/local/emhttp';
$log = '/boot/config/parity-checks.log';
@@ -27,15 +26,12 @@ $dot = $display['number'][0];
// add translations
$_SERVER['REQUEST_URI'] = 'main';
$_SESSION['locale'] = $display['locale'];
$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";
// remember current language
$locale_init = $locale;
// close session, it is not needed anymore
session_unset();
session_destroy();
function new_parity_log($timestamp) {
global $log;
return file_exists($log) ? explode('|',tail($log))[0]!=$timestamp : true;

View File

@@ -12,7 +12,6 @@
*/
?>
<?
session_start();
$docroot = '/usr/local/emhttp';
$varroot = '/var/local/emhttp';
$stamps = '/var/tmp/stamps.ini';
@@ -24,15 +23,12 @@ extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = 'dashboard/main';
$_SESSION['locale'] = $display['locale'];
$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";
// remember current language
$locale_init = $locale;
// close session, it is not needed anymore
session_unset();
session_destroy();
function my_clock($time) {
if (!$time) return _('less than a minute');
$days = floor($time/1440);

View File

@@ -13,7 +13,6 @@
*/
?>
<?
session_start();
$docroot = '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
@@ -22,15 +21,12 @@ extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
$_SESSION['locale'] = $display['locale'];
$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";
// remember current language
$locale_init = $locale;
// close session, it is not needed anymore
session_unset();
session_destroy();
$state = [
'TRIM ONLINE' => 'Online (trim)',
'BOOST ONLINE' => 'Online (boost)',

View File

@@ -12,7 +12,6 @@
*/
?>
<?
session_start();
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Helpers.php";
@@ -20,7 +19,7 @@ extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = '';
$_SESSION['locale'] = $display['locale'];
$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";
function write($message){

View File

@@ -12,7 +12,6 @@
*/
?>
<?
session_start();
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Helpers.php";
@@ -20,7 +19,7 @@ extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = 'main';
$_SESSION['locale'] = $display['locale'];
$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";
$month = [' Jan '=>'-01-',' Feb '=>'-02-',' Mar '=>'-03-',' Apr '=>'-04-',' May '=>'-05-',' Jun '=>'-06-',' Jul '=>'-07-',' Aug '=>'-08-',' Sep '=>'-09-',' Oct '=>'-10-',' Nov '=>'-11-',' Dec '=>'-12-'];

View File

@@ -12,7 +12,6 @@
*/
?>
<?
session_start();
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Helpers.php";
@@ -20,7 +19,7 @@ extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = 'dashboard';
$_SESSION['locale'] = $display['locale'];
$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";
function write($message){

View File

@@ -12,7 +12,6 @@
*/
?>
<?
session_start();
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Helpers.php";
@@ -20,7 +19,7 @@ extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = '';
$_SESSION['locale'] = $display['locale'];
$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";
function write($message){

View File

@@ -12,7 +12,6 @@
*/
?>
<?
session_start();
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
@@ -20,7 +19,7 @@ extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
$_SESSION['locale'] = $display['locale'];
$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";
function write($message){