Renamed all .inc PHP files to .php and replaced all .inc calls

Because .inc style is deprecated and also dangerious as often not setup
correctly on the server all .inc files have been renamed to .php files.

All internall calls have been udpated.
This commit is contained in:
Clemens Schwaighofer
2019-09-13 15:47:37 +09:00
parent 5558a21824
commit d9ad041c47
55 changed files with 124 additions and 108 deletions

View File

@@ -14,7 +14,6 @@ ob_start();
// basic class test file
define('USE_DATABASE', true);
// sample config
// require("config.inc");
require 'config.php';
// set session name
if (!defined('SET_SESSION_NAME')) {

View File

@@ -1 +1 @@
../includes/edit_base.inc
../includes/edit_base.php

View File

@@ -1 +1 @@
../includes/edit_base.inc
../includes/edit_base.php

View File

@@ -1 +1 @@
../includes/edit_base.inc
../includes/edit_base.php

View File

@@ -1 +1 @@
../includes/edit_base.inc
../includes/edit_base.php

View File

@@ -1 +1 @@
../includes/edit_base.inc
../includes/edit_base.php

View File

@@ -1 +1 @@
../includes/edit_base.inc
../includes/edit_base.php

View File

@@ -1 +1 @@
../includes/edit_base.inc
../includes/edit_base.php

View File

@@ -1 +1 @@
../includes/edit_base.inc
../includes/edit_base.php

View File

@@ -1 +1 @@
../includes/edit_base.inc
../includes/edit_base.php

View File

@@ -11,8 +11,8 @@ if ($DEBUG_ALL) {
// sample config
require 'config.php';
echo "FILE: ".BASE.LIB."Error.Handling.inc<br>";
require(BASE.LIB."Error.Handling.inc");
echo "FILE: ".BASE.LIB."Error.Handling.php<br>";
require(BASE.LIB."Error.Handling.php");
if ($var) {
echo "OUT<br>";

View File

@@ -1,7 +1,5 @@
<?php declare(strict_types=1);
declare(strict_types=1);
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
$DEBUG_ALL = 1;
$PRINT_ALL = 1;

View File

@@ -1,5 +1,7 @@
<?php
use \CoreLibs\Upload;
$DEBUG_ALL = 1;
$ECHO_ALL = 0;
$PRINT_ALL = 1;

View File

@@ -9,7 +9,7 @@ $LOG_PER_RUN = 1;
define('USE_DATABASE', true);
define('USE_HEADER', true);
require 'config.php';
require BASE.INCLUDES.'admin_header.inc';
require BASE.INCLUDES.'admin_header.php';
$MASTER_TEMPLATE_NAME = 'main_body.tpl';
$TEMPLATE_NAME = 'smarty_test.tpl';
$CSS_NAME = 'smart_test.css';
@@ -24,7 +24,7 @@ if ($USE_PROTOTYPE) {
$JS_NAME = 'jquery.test.js';
}
$PAGE_WIDTH = "100%";
require BASE.INCLUDES.'admin_set_paths.inc';
require BASE.INCLUDES.'admin_set_paths.php';
// smarty test
$cms->DATA['SMARTY_TEST'] = 'Test Data';
@@ -48,5 +48,5 @@ $options = array (
$cms->DATA['drop_down_test'] = $options;
require BASE.INCLUDES.'admin_smarty.inc';
require BASE.INCLUDES.'admin_footer.inc';
require BASE.INCLUDES.'admin_smarty.php';
require BASE.INCLUDES.'admin_footer.php';

View File

@@ -6,7 +6,6 @@ $PRINT_ALL = 1;
$DB_DEBUG = 1;
// admin class tests
// require 'config.inc';
require 'config.php';
DEFINE('SET_SESSION_NAME', EDIT_SESSION_NAME);
$base = new CoreLibs\Basic();
@@ -43,7 +42,7 @@ print "LB remove: ".$base->removeLB($text, '##BR##')."<br>";
// )
// );
$base->debug('ARRAY', $base->printAr($test));
// $base->debug('ARRAY', $base->printAr($test));
function rec($pre, $cur, $node = array ())
{
@@ -82,6 +81,7 @@ function flattenArrayKey(array $array, array $return = array ())
return $return;
}
$test = array ();
// core
$test = rec('', 'A', $test);
$test = rec('', '1', $test);

View File

@@ -167,16 +167,16 @@ DEFINE('TEST_SCHEMA', 'public');
DEFINE('LIVE_SCHEMA', 'public');
/************* DB ACCESS *****************/
if (file_exists(BASE.CONFIGS.'config.db.inc')) {
require BASE.CONFIGS.'config.db.inc';
if (file_exists(BASE.CONFIGS.'config.db.php')) {
require BASE.CONFIGS.'config.db.php';
}
/************* CORE HOST SETTINGS *****************/
if (file_exists(BASE.CONFIGS.'config.host.inc')) {
require BASE.CONFIGS.'config.host.inc';
if (file_exists(BASE.CONFIGS.'config.host.php')) {
require BASE.CONFIGS.'config.host.php';
}
/************* OTHER PATHS *****************/
if (file_exists(BASE.CONFIGS.'config.path.inc')) {
require BASE.CONFIGS.'config.path.inc';
if (file_exists(BASE.CONFIGS.'config.path.php')) {
require BASE.CONFIGS.'config.path.php';
}
// set the USE_DATABASE var, if there is nothing set, we assume TRUE

View File

@@ -12,8 +12,8 @@ define('CONFIG_PATH', 'configs'.DIRECTORY_SEPARATOR);
$CONFIG_PATH_PREFIX = '';
for ($dir_pos = 0, $dir_max = count(explode(DIRECTORY_SEPARATOR, __DIR__)); $dir_pos <= $dir_max; $dir_pos ++) {
$CONFIG_PATH_PREFIX .= '..'.DIRECTORY_SEPARATOR;
if (file_exists($CONFIG_PATH_PREFIX.CONFIG_PATH.'config.inc')) {
require $CONFIG_PATH_PREFIX.CONFIG_PATH.'config.inc';
if (file_exists($CONFIG_PATH_PREFIX.CONFIG_PATH.'config.master.php')) {
require $CONFIG_PATH_PREFIX.CONFIG_PATH.'config.master.php';
break;
}
}

View File

@@ -10,7 +10,7 @@
//------------------------------ variable init start
// for dev test we set full error reporting; writes everything, except E_ERROR into logs/php_error-<day>.log
if ($DEBUG_ALL && $ENABLE_ERROR_HANDLING) {
include BASE.LIBS."Error.Handling.inc";
include BASE.LIBS."Error.Handling.php";
}
// predefine vars
$lang = '';

View File

@@ -39,7 +39,7 @@ $FORM_NAME = !isset($FORM_NAME) || !$FORM_NAME ? str_replace(".php", "", $cms->p
$L_TITLE = ucfirst(str_replace('_', ' ', $cms->getPageName(1))).(defined(G_TITLE) ? ' - '.G_TITLE : '');
// strip tpl and replace it with inc
// php include file per page
$cms->INC_TEMPLATE_NAME = str_replace(".tpl", ".inc", $CONTENT_INCLUDE);
$cms->INC_TEMPLATE_NAME = str_replace(".tpl", ".php", $CONTENT_INCLUDE);
// javascript include per page
$cms->JS_TEMPLATE_NAME = str_replace(".tpl", ".js", $CONTENT_INCLUDE);
// css per page

View File

@@ -64,6 +64,7 @@ class Login extends \CoreLibs\DB\IO
private $euid; // the user id var
private $permission_okay = 0; // is set to one if login okay, or EUID is set and user is okay to access this page
public $login; // pressed login
private $action; // master action command
private $username; // login name
private $password; // login password
private $logout; // logout button
@@ -217,14 +218,6 @@ class Login extends \CoreLibs\DB\IO
// users that never get locked, even if they are set strict
$this->lock_deny_users = array ('admin');
// internal
$this->class_info['login'] = array(
'class_name' => 'Login',
'class_version' => '5.0.0',
'class_created' => '2000-06-01',
'class_author' => 'Clemens Schwaighofer'
);
// init default ACL list array
$_SESSION['DEFAULT_ACL_LIST'] = array ();
// read the current edit_access_right list into an array

View File

@@ -93,14 +93,6 @@ class Backend extends \CoreLibs\DB\IO
// init the database class
parent::__construct($db_config, $set_control_flag);
// internal
$this->class_info["adbBackend"] = array(
"class_name" => "Admin Interface Backend",
"class_version" => "1.0.0",
"class_created" => "2006/08/15",
"class_author" => "Clemens Schwaighofer"
);
// set the action ids
foreach ($this->action_list as $_action) {
$this->$_action = (isset($_POST[$_action])) ? $_POST[$_action] : '';

View File

@@ -11,7 +11,6 @@
* basic class start class for ALL clases, holds basic vars, infos, methods, etc
*
* PUBLIC VARIABLES
* class_info
*
* These are if there is any debug to print out at all at the end
* debug_output_all - general yes no
@@ -96,12 +95,12 @@
namespace CoreLibs;
// define check vars for the flags we can have
/** @internal */
define('CLASS_STRICT_MODE', 1);
define('CLASS_OFF_COMPATIBLE_MODE', 2);
class Basic
{
public $class_info; // class info var
// control vars
// compatible mode sets variable even if it is not defined
private $set_compatible = true;
@@ -194,14 +193,6 @@ class Basic
// set per run UID for logging
$this->running_uid = hash($this->hash_algo, uniqid((string)rand(), true));
// internal info var
$this->class_info["basic"] = array (
"class_name" => "Basic",
"class_version" => "2.0.0",
"class_created" => "2003-03-24",
"class_author" => 'Clemens Schwaighofer'
);
// before we start any work, we should check that all MUST constants are defined
$abort = false;
foreach (array(
@@ -482,6 +473,10 @@ class Basic
// GENERAL METHODS
// *************************************************************
/**
* @param string $string
* @return string
*/
// METHOD: basicSetLogId
// PARAMS: string
// RETURN: current set string
@@ -498,27 +493,6 @@ class Basic
return $log_file_id;
}
// METHOD: classInfo
// PARAMS: print to debug (true/false)
// RETURN: string with info
// DESC : default class info (prints out class info)
public function classInfo(string $class_name = 'basic', bool $print_to_debug = false): string
{
unset($string);
list($major, $minor, $patchlvl) = explode(".", $this->class_info[$class_name]["class_version"]);
$string = '';
$string .= "<b>-Class-info-[".$class_name."]-></b> Class Name: <b>".$this->class_info[$class_name]["class_name"]."</b><br>";
$string .= "<b>-Class-info-[".$class_name."]-></b> Class Author: <b>".$this->class_info[$class_name]["class_author"]."</b><br>";
$string .= "<b>-Class-info-[".$class_name."]-></b> Class Version: <b>".$this->class_info[$class_name]["class_version"]."</b><br>";
$string .= "<b>-Class-info-[".$class_name."]-></b> Class Revision: <b>".$this->class_info[$class_name]["class_revision"]."</b><br>";
$string .= "<b>-Class-info-[".$class_name."]-></b> Class Created: <b>".$this->class_info[$class_name]["class_created"]."</b><br>";
$string .= "<b>-Class-info-[".$class_name."]-></b> Class Last Change: <b>".$this->class_info[$class_name]["class_last_changed"]."</b>";
if ($print_to_debug === true) {
$this->debug('info', '<br>'.$string);
}
return $string;
}
// ****** DEBUG/ERROR FUNCTIONS ******
// METHOD: hrRunningTime
@@ -949,10 +923,10 @@ class Basic
// this will not set the class key length variable
public function randomKeyGen(int $key_length = -1): string
{
$use_key_length;
$use_key_length = 0;
// only if valid int key with valid length
if ($this->validateRandomKeyLenght($key_length) === true) {
$use_key_length= $key_length;
$use_key_length = $key_length;
} else {
$use_key_length = $this->key_length;
}

View File

@@ -75,14 +75,6 @@ class ArrayIO extends \CoreLibs\DB\IO
}
}
} // set pk_name IF table_array was given
// internal
$this->class_info['db_array_io'] = array (
'class_name' => 'DB Array IO',
'class_version' => '1.0.0',
'class_created' => '2002/12/17',
'class_author' => 'Clemens Schwaighofer'
);
// echo "CALSS INFO POST [A]: <pre>".print_r($this->class_info, true)."</pre><br>";
}
// deconstruktor

View File

@@ -383,13 +383,6 @@ class IO extends \CoreLibs\Basic
return false;
}
$this->class_info['db_io']=array(
'class_name' => 'DB IO',
'class_version' => '5.0.0',
'class_created' => '2000-11-23',
'class_author' => 'Clemens Schwaighofer'
);
// so we can check that we have a successful DB connection created
return true;
}

View File

@@ -173,7 +173,7 @@
* only a certain field list. If where is filled out and used in combination with insert (not same_db)
* then this key will be SET when inserted into the DB !!!
* 2003-04-09: added open_dir for download of file (URL), save_dir is only for upload (absolute path)
* added require once for class_db_array_io.inc
* added require once for class_db_array_io.php
* 2003-03-31: added a file upload module (type==file)
* 2003-03-20: added form_procedure_new, etc functions so for default calls it is easier to write
* also added security levels to all functions where it is needed
@@ -260,12 +260,12 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
// WARNING: auto spl load does not work with this as it is an array and not a function/object
// check if this is the old path or the new path
if (is_dir(TABLE_ARRAYS)) {
if (is_file(TABLE_ARRAYS.'array_'.$this->my_page_name.'.inc')) {
include(TABLE_ARRAYS.'array_'.$this->my_page_name.'.inc');
if (is_file(TABLE_ARRAYS.'array_'.$this->my_page_name.'.php')) {
include(TABLE_ARRAYS.'array_'.$this->my_page_name.'.php');
}
} else {
if (is_file(BASE.INCLUDES.TABLE_ARRAYS.'array_'.$this->my_page_name.'.inc')) {
include(BASE.INCLUDES.TABLE_ARRAYS.'array_'.$this->my_page_name.'.inc');
if (is_file(BASE.INCLUDES.TABLE_ARRAYS.'array_'.$this->my_page_name.'.php')) {
include(BASE.INCLUDES.TABLE_ARRAYS.'array_'.$this->my_page_name.'.php');
}
}
if (isset(${$this->my_page_name}) && is_array(${$this->my_page_name})) {
@@ -330,14 +330,6 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
}
// write array to class var
$this->security_level = $config_array['security_level'];
// internal
$this->class_info['form'] = array(
'class_name' => 'Form create',
'class_version' => '3.0.0',
'class_created' => '2002-10-22',
'class_author' => 'Clemens Schwaighofer'
);
}
// dumps all values into output (for error msg)

View File

@@ -33,7 +33,7 @@ if (class_exists('Autoload', false) === false) {
$len = strlen(__NAMESPACE__);
}
// set default extension
$extension = '.inc';
$extension = '.php';
// set full include path
$path = __DIR__.$ds.$LIB.substr($class, $len);
// replace namespace \ with dir sepeator