-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloader.php
148 lines (138 loc) · 6.51 KB
/
loader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
////////////////////////////////////////////////////////////////////////////////
// File name : loader.php //
// Version : 21.2 //
// Begin : 2020-08-28 //
// Last Change : 2021-04-19 //
// Author : FeRox Management Consulting GmbH & Co. KG //
// Adolf-Langer-Weg 11a, D-94036 Passau (Germany) //
// https://www.ferox.de - info@ferox.de //
// License : GNU-GPL v3 (https://opensource.org/licenses/GPL-3.0) //
// -------------------------------------------------------------------------- //
// fx-project - An open source PHP Project Managament Software //
// Copyright © FeRox Management Consulting GmbH & Co. KG //
// -------------------------------------------------------------------------- //
// 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 3 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. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <https://www.gnu.org/licenses/>. //
// //
// See ../LICENSE.TXT file for more information. //
// -------------------------------------------------------------------------- //
// LICENSING ADDENDUM: //
// Programs in the SPP (Special Programs) subfolder are coded extensions of //
// the open source software fx-project. These programs are offered for sale //
// by the manufacturer FeRox Management Consulting GmbH & Co. KG and require //
// a valid key for execution. It is forbidden to resell these programs //
// and/or keys or to pass them on free of charge or use them without the //
// express written permission of FeRox Management Consulting GmbH & Co. KG. //
////////////////////////////////////////////////////////////////////////////////
/**
* @file
* Loader program to check if a requested PHP/INC/TXT file exsists - if it does, this program is loaded and executed, else either the error handler or the default index program is loaded and executed
*
* @author FeRox Management Consulting GmbH & Co. KG, Adolf-Langer-Weg 11a, D-94036 Passau (Germany)
* @version 21.2
*/
$GLOBALS['__loaded_'.basename(__FILE__)]=true;
// Search for and include "basics.inc" to set all definitions, variables and necessary dynamic paths
$__pnm='basics.inc';
if(!isset($GLOBALS['__loaded_'.$__pnm]))
{
$__prg=$__pnm;
$__pfc=0;
while(($__pfc < 10) && !file_exists($__prg))
{
$__pfc++;
$__prg='../'.$__prg;
}
if(file_exists($__prg))
{
require($__prg);
}
else
die('<div style="padding:8px;"><h1 style="padding:8px;color:red;background:#fff;border:2px solid red;box-shadow:4px 4px 4px rgba(0,0,0, 0.5);">fx-project - ERROR: Necessary file "'.$__pnm.'" not found!</h1></div>');
}
// User must be logged in?
$__valid_call=false;
if(fxIsArray($GLOBALS['fxpglobals']) && isset($GLOBALS['fxpglobals']['user']) && ($GLOBALS['fxpglobals']['user'] > 0) && isset($GLOBALS['fxpglobals']['client']) && ($GLOBALS['fxpglobals']['client'] > 0))
$__valid_call=true;
// Get program that should be loaded
//fxDebug('_GET');
$__cpnm='';
$__cpnp='';
if(fxIsArray($_GET) && isset($_GET['url']))
{
$__cpnm=trim($_GET['url']);
$__qaa=array('?', '&');
foreach($__qaa as $__qa)
{
$__qap=strpos($__cpnm,$__qa);
if($__qap !== false)
$__cpnm=trim(substr($__cpnm,0,$__qap));
}
$__cpnp=basename($__cpnm);
}
//fxDebug(array('$__cpnm'=>$__cpnm, '$__cpnp'=>$__cpnp),'GET', 0);
// Check if program exists (if it does, get name and type)
$__fpnm='';
$__fpst='';
if(strlen($__cpnm) && strlen($GLOBALS['locstoid']) && strlen($GLOBALS['sesstoid']) && isset($GLOBALS['_phpfiles']) && strlen($GLOBALS['_phpfiles']) && file_exists($GLOBALS['_phpfiles']))
{
require($GLOBALS['_phpfiles']);
//fxDebug($ppa,'$ppa', 0);
if(fxIsArray($ppa))
{
$__vcpa=array();
if(!$__valid_call)
{
if(($__cpnm == 'check_patch.inc') && fxIsArray($_GET) && isset($_GET['lcnt']) && ((int)$_GET['lcnt'] == 0))
$__vcpa[$__cpnm]='AJX';
if(($__cpnm == 'timestamp.inc') && fxIsArray($_GET) && isset($_GET['lcnt']) && ((int)$_GET['lcnt'] > 0))
$__vcpa[$__cpnm]='AJX';
if(($__cpnm == 'worker.inc') && fxIsArray($_GET) && isset($_GET['lcnt']) && ((int)$_GET['lcnt'] > 1))
$__vcpa[$__cpnm]='SYS';
if((($__cpnm == 'check_update.inc') || ($__cpnm == 'popup_hlp.inc')) && fxIsArray($_GET) && isset($_GET['lcnt']) && ((int)$_GET['lcnt'] > 2))
$__vcpa[$__cpnm]='AJX';
if(($__cpnm == '021_ini.inc') && fxIsArray($_POST) && isset($_POST['mode']))
$__vcpa[$__cpnm]='SPP';
//fxDebug($__vcpa,'$__vcpa', 0);
}
foreach($ppa as $phpfilename => $pa)
{
if(($pa['filename'] === $__cpnm) && ($__valid_call || !strlen($pa['filepath']) || ($pa['filepath'] == 'APP') || ($pa['filepath'] == 'INT') || isset($__vcpa[$pa['filename']])))
{
$__fpnm=$phpfilename;
$__dp=strrpos($__fpnm,'.');
if($__dp)
$__fpst=strtolower(substr($__fpnm,$__dp+1));
break;
}
}
}
}
//fxDebug(array('$__fpnm'=>$__fpnm, '$__fpst'=>$__fpst),'CHECK', 0);
// Requested program found (and is valid: name and type)?
$__vta=array('php'=>true, 'inc'=>true, 'txt'=>true);
if(strlen($__fpnm) && strlen($__fpst) && isset($__vta[$__fpst]))
{
require($GLOBALS['mainpath'].$__fpnm); die;
}
// Requested program not found?
if(strlen($__cpnm))
{
//fxDebug($GLOBALS['__server_array'],'$GLOBALS[\'__server_array\']', 0);
require($GLOBALS['mainpath'].'error.inc'); die;
}
// Default
//fxDebug($GLOBALS['__server_array'],'$GLOBALS[\'__server_array\']', 0); die;
require($GLOBALS['mainpath'].'index.php');
?>