Compare commits

...

3 Commits

Author SHA1 Message Date
Clemens Schwaighofer
56612cb13b Clean up for move to .php files an phan checks 2019-09-13 16:08:49 +09:00
Clemens Schwaighofer
d9ad041c47 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.
2019-09-13 15:47:37 +09:00
Clemens Schwaighofer
5558a21824 Composter update to 1.9.0 2019-09-13 10:43:07 +09:00
56 changed files with 149 additions and 126 deletions

81
.phan/config.php Normal file
View File

@@ -0,0 +1,81 @@
<?php
use Phan\Config;
/**
* This configuration will be read and overlaid on top of the
* default configuration. Command line arguments will be applied
* after this file is read.
*
* @see src/Phan/Config.php
* See Config for all configurable options.
*
* A Note About Paths
* ==================
*
* Files referenced from this file should be defined as
*
* ```
* Config::projectPath('relative_path/to/file')
* ```
*
* where the relative path is relative to the root of the
* project which is defined as either the working directory
* of the phan executable or a path passed in via the CLI
* '-d' flag.
*/
return [
// If true, missing properties will be created when
// they are first seen. If false, we'll report an
// error message.
"allow_missing_properties" => true,
// Allow null to be cast as any type and for any
// type to be cast to null.
"null_casts_as_any_type" => true,
// Backwards Compatibility Checking
'backward_compatibility_checks' => false,
// Run a quick version of checks that takes less
// time
"quick_mode" => false,
// Only emit critical issues to start with
// (0 is low severity, 5 is normal severity, 10 is critical)
"minimum_severity" => 10,
// A list of directories that should be parsed for class and
// method information. After excluding the directories
// defined in exclude_analysis_directory_list, the remaining
// files will be statically analyzed for errors.
//
// Thus, both first-party and third-party code being used by
// your application should be included in this list.
'directory_list' => [
// Change this to include the folders you wish to analyze
// (and the folders of their dependencies)
'www',
// To speed up analysis, we recommend going back later and
// limiting this to only the vendor/ subdirectories your
// project depends on.
// `phan --init` will generate a list of folders for you
//'www/vendor',
],
// A list of directories holding code that we want
// to parse, but not analyze
"exclude_analysis_directory_list" => [
'www/vendor',
'www/lib/FileUpload',
'www/lib/pChart',
'www/lib/pChart2.1.4',
'www/lib/Smarty',
'www/lib/smarty-3.1.30',
'www/templates_c',
'www/log',
'www/tmp',
'www/cache',
'www/media',
],
];

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

@@ -16,7 +16,7 @@ $MAX_UPLOAD_SIZE = $base->StringByteFormat(ini_get('upload_max_filesize'));
$allowedExtensions = array ('csv', 'zip', 'jpg', 'pdf', 'bz2');
$sizeLimit = $MAX_UPLOAD_SIZE; // as set in php ini
$base->debug('AJAX UPLOAD', 'Size: '.$sizeLimit.', Memory Limit: '.ini_get('memory_limit'));
$uploader = new CoreLibs\Upload\qqFileUploader($allowedExtensions, $sizeLimit);
$uploader = new FileUpload\qqFileUploader($allowedExtensions, $sizeLimit);
// either in post or get
$_action= $_POST['action'] ? $_POST['action'] : $_GET['action'];
$_task_uid = $_POST['task_uid'] ? $_POST['task_uid'] : $_GET['task_uid'];

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);

Binary file not shown.

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

@@ -9,19 +9,19 @@ $edit_access = array (
),
'name' => array (
'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '',
'output_name' => $this->l->__('Access Group Name'),
'output_name' => 'Access Group Name',
'mandatory' => 1,
'type' => 'text',
'error_check' => 'alphanumericspace|unique'
),
'description' => array (
'value' => isset($GLOBALS['description']) ? $GLOBALS['description'] : '',
'output_name' => $this->l->__('Description'),
'output_name' => 'Description',
'type' => 'textarea'
),
'color' => array (
'value' => isset($GLOBALS['color']) ? $GLOBALS['color'] : '',
'output_name' => $this->l->__('Color'),
'output_name' => 'Color',
'mandatory' => 0,
'type' => 'text',
'size' => 6,

View File

@@ -9,13 +9,13 @@ $edit_menu_group = array (
),
'name' => array (
'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '',
'output_name' => $this->l->__('Group name'),
'output_name' => 'Group name',
'mandatory' => 1,
'type' => 'text'
),
'flag' => array (
'value' => isset($GLOBALS['flag']) ? $GLOBALS['flag'] : '',
'output_name' => $this->l->__('Flag'),
'output_name' => 'Flag',
'mandatory' => 1,
'type' => 'text',
'error_check' => 'alphanumeric|unique'

View File

@@ -9,13 +9,13 @@ $edit_visible_group = array (
),
'name' => array (
'value' => isset($GLOBALS['name']) ? $GLOBALS['name'] : '',
'output_name' => $this->l->__('Group name'),
'output_name' => 'Group name',
'mandatory' => 1,
'type' => 'text'
),
'flag' => array (
'value' => isset($GLOBALS['flag']) ? $GLOBALS['flag'] : '',
'output_name' => $this->l->__('Flag'),
'output_name' => 'Flag',
'mandatory' => 1,
'type' => 'text',
'error_check' => 'alphanumeric|unique'

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
@@ -777,6 +770,15 @@ class Login extends \CoreLibs\DB\IO
return $is_valid_password;
}
// METHOD: loginPasswordForgot
// PARAMS: none
// RETURN: none
// DESC : dummy declare for password forget
private function loginPasswordForgot()
{
// will do some password recovert, eg send email
}
// METHOD: loginSetPasswordMinLength
// PARAMS: set the minimum length
// RETURN: true/false on success

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

@@ -435,7 +435,7 @@ class PgSQL
return $offset;
}
} else {
$offset = pg_array_parse($text, $output[], $limit, $offset + 1);
$offset = $this->__dbArrayParse($text, $output[], $limit, $offset + 1);
}
} while ($limit > $offset);
}

View File

@@ -24,7 +24,7 @@ namespace CoreLibs\Language\Core;
// Preloads entire file in memory first, then creates a StringReader
// over it (it assumes knowledge of StringReader internals)
class CachedFileReader extends CoreLibs\Language\Core\StringReader
class CachedFileReader extends \CoreLibs\Language\Core\StringReader
{
public function __construct($filename)
{

View File

@@ -369,7 +369,7 @@ class GetTextReader
* Detects which plural form to take
*
* @access private
* @param n count
* @param string count
* @return int array index of the right plural form
*/
private function select_string($n)

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)
@@ -931,12 +923,12 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
}
break;
case 'date': // YYYY-MM-DD
if (!check_date($this->table_array[$key]['value'], 1)) {
if (!$this->checkDate($this->table_array[$key]['value'], 1)) {
$this->msg .= sprintf($this->l->__('Please enter a vailid date (YYYY-MM-DD) for the <b>%s</b> Field!<br>'), $this->table_array[$key]['output_name']);
}
break;
case 'time': // HH:MM[:SS]
if (!check_time($this->table_array[$key]['value'])) {
if (!$this->checkDateTime($this->table_array[$key]['value'])) {
$this->msg .= sprintf($this->l->__('Please enter a vailid time (HH:MM[:SS]) for the <b>%s</b> Field!<br>'), $this->table_array[$key]['output_name']);
}
break;

View File

@@ -25,7 +25,8 @@ class SmartyExtend extends SmartyBC
SmartyBC::__construct();
$this->l10n = new \CoreLibs\Language\L10n($lang);
// variable variable register
$this->register_modifier('getvar', array(&$this, 'get_template_vars'));
// $this->register_modifier('getvar', array(&$this, 'get_template_vars'));
$this->registerPlugin('modifier', 'getvar', array(&$this, 'get_template_vars'));
}
}

View File

@@ -2,8 +2,7 @@
namespace FileUpload;
use \FileUpload\Core\qqUploadedFileForm;
use \FileUpload\Core\qqUploadedFileXhr;
use \FileUpload\Core;
class qqFileUploader
{
@@ -21,9 +20,9 @@ class qqFileUploader
$this->checkServerSettings();
if (isset($_GET['qqfile'])) {
$this->file = new qqUploadedFileXhr();
$this->file = new \FileUpload\Core\qqUploadedFileXhr();
} elseif (isset($_FILES['qqfile'])) {
$this->file = new qqUploadedFileForm();
$this->file = new \FileUpload\Core\qqUploadedFileForm();
} else {
$this->file = false;
}

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