Commit dd839468 authored by f4eyq's avatar f4eyq

update 30122019

parent 69559020
[hawaii] [ internet creation ]
[ ham radio ][ dxcluster creation from GB ]
------------------------
CRX FRAMEWORK
Current version:3.0.1
Current version:3.0.1 - 3
Date:01/2008
------------------------
Update 24/12/2019
------------------------
- Correct some bugs into various class since migration to php 7.4.
------------------------
Update 07/06/2019
------------------------
- Improve : crxGdPicture ( using by map module ), to configure output format.
crxTemplateXhtmlWrapper : add constant to configure if output html is compress or not.
crxDataSource + Mysql driver : improve code for exception management.
------------------------
Update 29/05/2019
------------------------
- Improve : crxFrameworkWebCommon for language detection, when user is not connected,
system now detect the user language and set the interface language.
------------------------
Update 26/05/2019
------------------------
......
......@@ -3,10 +3,10 @@
* CRX-FRAMEWORK
* @author Bastien Barbe
* @creation date 2005
* @revision 02052019
* @revision 24122019
* @module dxClusterWeb
* @copyright see header
* @version 2.0.2-2
* @version 2.0.2-3
*/
namespace crx;
......@@ -148,8 +148,6 @@ extends crxCore{
function showVars(){
return crxBootLoader::showConstantAsHtmlArray();
}
......@@ -185,18 +183,13 @@ extends crxCore{
$this->GOB_parserXml -> defineItemName('item');
try{
self::$_GOB_db = crxDataSource::getDs(self::$_frameworkObjectsOptions['app_main_ds']);
}
catch(Exception $e){
debugAndContinue($e->getMessage());
}
if(is_object(self::$_GOB_db)){
if(self::$_frameworkConfiguration['load_user_module']){
self::$_userItemInstance = new crxUser('main instance');
......@@ -252,8 +245,16 @@ extends crxCore{
}
//Framework process created can disabled loading module processus (via the array _env return of listenAction method)
//isset($this->_env['disable_module_loading_process']) &&
if(!isset($this->_env)){
$this->_env = array(
'disable_module_loading_process' => FALSE,
'run_module' => FALSE
);
}
if(!$this->_env['disable_module_loading_process']){
//If nothing is set by default we load default module !
if(!self::$_process_module_to_load)
self::$_process_module_to_load = self::$_frameworkConfiguration['default_loaded_module'];
......@@ -296,8 +297,10 @@ extends crxCore{
}
//Framework process created can set a module and command to launch : (via the array _env return of listenAction method)
if($this->_env['run_module']){
//Framework process created can set a module and command to launch :
//(via the array _env return of listenAction method)
if(isset($this->_env['run_module']) && $this->_env['run_module']){
if(isset(self::$_frameworkConfiguration['process_options_for_module_to_load'])){
self::$_process_options_for_module_to_load = self::$_frameworkConfiguration['process_options_for_module_to_load'];
}
......@@ -357,6 +360,7 @@ extends crxCore{
require_once('crxFrameworkWebserviceCrx.php');
self::$_frameworkProcess=new crxFrameworkWebserviceCrx();
self::$_frameworkProcess->initContext();
$this->_env = self::$_frameworkProcess->listenAction();
if(DEBUG_WEBSERVICE_CRX_LAYER)dbg('crxFramework::__createFrameworkProcessHttpWebserviceCrx() => set env : ');
if(DEBUG_WEBSERVICE_CRX_LAYER)dbg($this->_env);
......@@ -370,7 +374,7 @@ extends crxCore{
require_once('crxFrameworkWeb.php');
crxFrameworkWeb::setUrlmode('normal');
self::$_frameworkProcess=new crxFrameworkWeb();
self::$_frameworkProcess->initContext();
......@@ -652,11 +656,12 @@ extends crxCore{
}
static function sGetAvailableLanguage(){
return self::$_frameworkConfiguration['available_languages'];
}
function getAvailableLanguage(){
return self::$_frameworkConfiguration['available_languages'];
}
static function getUserInstance(){
......@@ -723,8 +728,12 @@ extends crxCore{
require_once($path);
}else{
throw new crxException('@');
}
return $mod['module_user_controler'];
}
......
......@@ -537,6 +537,7 @@ class crxFrameworkModuleLoader{
$u=crxFramework::getUserInstance();
$u->currentModuleGid=self::$_currentModuleGid;
$acl=$u->getUserRightsOnCurrentModule();
......
......@@ -3,10 +3,10 @@
* CRX-PHP-FRAMEWORK http://git.crx.cloud/crx-php/crx-framework
* @author Bastien Barbe
* @date 01/01/2005
* @revision 03/04/2019
* @revision 07/06/2019
* @package core/crxUsers , frameworkCrxUser.
* @copyright see header
* @version 1.8.2
* @version 1.8.2 - 2
*/
namespace crx;
......@@ -133,9 +133,9 @@ CREATE TABLE `crx_users_donation` (
}
var $_release='31042019';
var $_release='07122019';
var $_session_online_window_threshold = 90;
var $_session_online_window_threshold = 360; // 90
var $_dataAccess=NULL;
......@@ -310,6 +310,9 @@ CREATE TABLE `crx_users_donation` (
function __construct(){
}
......@@ -792,27 +795,31 @@ $exec='curl -X POST '.$uri.' \
if(isset($options['getClusterStat']) && $options['getClusterStat']==1){
$this->_dataAccess->formatSqlQuery('',$this->_table_dxclusterSpots,'DISPLAY','',
array(
'filter_key' => 'callsign_sender',
'filter_key_value' => $r_user_profil['callsign_main']
)
);
$this->_dataAccess -> execSql();
$map['clusterSpotsStats']['nbSpots'] = $this->_dataAccess->tuplesCounter();
$this->_dataAccess->formatSqlQuery('',$this->_table_dxclusterSpots_arch,'DISPLAY','',
array(
'filter_key' => 'callsign_sender',
'filter_key_value' => $r_user_profil['callsign_main']
)
);
$this->_dataAccess -> execSql();
$map['clusterSpotsStats']['nbSpotsArch'] = $this->_dataAccess->tuplesCounter();
if(DXM == 'HAM'){
$q='SELECT * FROM `crx_cluster_stats_nbspot` WHERE user_id = '.$_id;
$this->_dataAccess -> execSql($q);
$rstats=$this->_dataAccess->returnLine();
$map['clusterSpotsStats']['nbSpots'] = $rstats['nb_spots_main'];
$map['clusterSpotsStats']['nbSpotsArch']= $rstats['nb_spots_archives'];
}
else{
$this->_dataAccess->formatSqlQuery('',$this->_table_dxclusterSpots,'DISPLAY','',
array(
'filter_key' => 'callsign_sender',
'filter_key_value' => $r_user_profil['callsign_main']
)
);
$this->_dataAccess -> execSql();
$map['clusterSpotsStats']['nbSpots'] = $this->_dataAccess->tuplesCounter();
$this->_dataAccess->formatSqlQuery('',$this->_table_dxclusterSpots_arch,'DISPLAY','',
array(
'filter_key' => 'callsign_sender',
'filter_key_value' => $r_user_profil['callsign_main']
)
);
$this->_dataAccess -> execSql();
$map['clusterSpotsStats']['nbSpotsArch'] = $this->_dataAccess->tuplesCounter();
}
}
......
<?php
/*
*************************************************************************************
*
* Crx-cms powered by CRX-PHP-FRAMEWORK http://git.crx.cloud/crx-php/crx-framework
* Copyright (c) Bastien Barbe and contributors. All rights
* reserved.
*
* Crx-cms 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 2 of the License, or
* (at your option) any later version.
* Crx-cms 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.
*
* CRX-PHP-FRAMEWORK http://git.crx.cloud/crx-php/crx-framework
*************************************************************************************
*/
/**
* @author Bastien Barbe - CRX-FRAMEWORK
* @date 01/01/2005
* @revision 26032019
* @revision 09122019
* @crx-core classes
* @copyright see header
* @version 1.2
* @version 1.2.1-1
*/
namespace crx;
class crxXml {
......@@ -171,18 +153,23 @@ class crxXml {
}
function parseAndReturnValues(){
$itemType=$this->xmlItemType;
$itemType=$this->xmlItemType;//defineItemName( )
$ress_xml = simplexml_load_file($this->_pathOfXmlFile);
$p_cnt = count($ress_xml->$itemType);
for($i = 0; $i < $p_cnt; $i++) {
$item=$ress_xml->$itemType[$i];
$itemarr=array();
foreach($item as $k=>$v){
$k=(string)$k;
$v=(string)$v;
//var_dump($k);
$itemarr[$k]=$v;
}
$this->_finalItem[]=$itemarr;
}
return $this->_finalItem;
......
......@@ -3,11 +3,10 @@
* CRX-FRAMEWORK
* @author Bastien Barbe
* @date 01/01/2005
* @revision 26/04/2019
* @revision 07/06/2019
* @crx-core classes
* @version 2.2.1
* @version 2.2.1-2
*/
namespace crx;
class crxTemplateXhtmlWrapper extends crxFramework{
......@@ -599,18 +598,16 @@ class crxTemplateXhtmlWrapper extends crxFramework{
$this->_tplMainInterface -> parse('INTERFACE','FILE');
//TODO: //if( (!DEV_MODE && COMPRESS_HTML) || ( FORCE_COMPRESS_HTML ) ){
echo $this->compressOutput(
$this->_tplMainInterface -> return_template('INTERFACE')
);
if(ENABLE_HTTP_COMPRESSION)
echo $this->compressOutput($this->_tplMainInterface -> return_template('INTERFACE'));
else
echo $this->_tplMainInterface -> return_template('INTERFACE');
}
function compressOutput($buffer){
if(!ENABLE_HTTP_COMPRESSION)return $buffer;
//remove html comment :
$buffer = preg_replace('/<!--(.|\s)*?-->/', '', $buffer);
//remove js comment :
......@@ -696,19 +693,13 @@ $remove = array(
$buffer = $body instanceof DOMNode ? $dom->saveXml($body) : 'something failed';
*/
/*
$num_matches = preg_match_all("/\<!--/u", $buffer, $matches);
if($num_matches){
$buffer = preg_replace('/\<!--(.)*--\>/isu', '', $buffer);
}*/
}
}
?>
?>
\ No newline at end of file
......@@ -148,6 +148,8 @@ class crxDataSource extends crxSchema{
function setDataSourceProperties($p){
$this->_dataSourceConfiguration = $p;
......@@ -489,8 +491,6 @@ class crxDataSource extends crxSchema{
$path = $this->getDataSourcesPath();
$data_src_ressources_xml_files=crxFile::ls($path,false);
foreach($data_src_ressources_xml_files as $k=>$file){
......@@ -640,6 +640,8 @@ class crxDataSource extends crxSchema{
$xml_def_file = $this->builtSourcePathName($this->_dataSrcName);
$this->_currentXmlDsConfiguration=$xml_def_file;
if(!file_exists($xml_def_file))return FALSE;
$read_xml = new crxDataXml();
......@@ -676,6 +678,8 @@ class crxDataSource extends crxSchema{
);
$this->_dataSourceInformation['xml_conf']=$this->_currentXmlDsConfiguration;
if($this->dbi == NULL)return FALSE;
$this->setDataConfiguration( $this->_dataSourceInformation );
......@@ -754,7 +758,9 @@ class crxDataSource extends crxSchema{
}
function returnDataDriver(){
return $this->_dataSourceInformation['source_type'];
}
function setDataConfiguration($conf){
......@@ -869,6 +875,7 @@ class crxDataSource extends crxSchema{
$this->dbi -> connection();
}
catch(crxException $e){
throw $e;
}
}
......@@ -1193,12 +1200,16 @@ class crxDataSource extends crxSchema{
function secureData($value){
//Protect mysql :
if (!get_magic_quotes_gpc()) {
//var_dump(get_magic_quotes_gpc());
//die();
//=>FALSE, Deprecated: Function get_magic_quotes_gpc() is deprecated
//if (!get_magic_quotes_gpc()) {
if(!is_array($value))
$value=addslashes($value);
}
//}
//Protect sqlite :
if($this->_dataSourceConfiguration['source_type'] == 'SQLITE' ){
......
......@@ -20,15 +20,14 @@
/**
* @author Bastien Barbe - CRX-FRAMEWORK (cms part)
* @date 01/01/2005
* @revision 06/19/2014
* @revision 24/12/2019
* @module data
* @copyright see header
* @version 1.2
* @version 1.2-1
*/
/**
XML Reader part :
Using example :
$xml = new crxDataXml();
$xml->reader(
"nodes.xml",
......@@ -36,19 +35,14 @@
$l_2 = "node"
);
if($xml->getItems()){
foreach($xml->getItems() as $k=>$i){
foreach($xml->getItems() as $k=>$i){
// DO SOMETHING !!!
}
}
*/
namespace crx;
class crxDataXml
extends crxFramework{
private $_xmlFile = null;
......@@ -111,8 +105,8 @@ extends crxFramework{
*/
private function startCaptureStrXml($char){
if($this->xml_string{($this->curs-1)}=='>'){
$curs=$this->curs-1;
if($this->xml_string[$curs]=='>'){
if($this->_position>0)$calc_item=str_repeat(" ",$this->_position);
$this->_position++;
//$crlf=CRLF;
......
......@@ -16,11 +16,13 @@
* GNU General Public License for more details.
*
@ Creation : 2012.
@ Update : 08 / 11 / 2013.
@ Update : 16 / 12 / 2019.
@ History : 11/2013: Migrate SQLITE 1 to SQLITE 3 with PDO
*************************************************************************************
*/
namespace crx;
class itemToSqlite{
......@@ -70,7 +72,7 @@ class itemToSqlite{
function retreiveAll($cursors_nav=array('start','end','filtering_display')){
if($cursors_nav['filtering_display']){
if(isset($cursors_nav['filtering_display']) && $cursors_nav['filtering_display']){
$sql='SELECT * FROM '.$this->___table.' WHERE '.$cursors_nav['filtering_display'].';';
}
......@@ -83,7 +85,7 @@ class itemToSqlite{
$result=$this->_db_instance->query($sql);
if(is_object($result))
$row = $result->fetchall(PDO::FETCH_ASSOC);
$row = $result->fetchall(\PDO::FETCH_ASSOC);
return $row;
}
......@@ -93,7 +95,7 @@ class itemToSqlite{
if(file_exists(self::get_sqlite_path())){
$this->debug("<u>Open sqlite db :</u><b>".self::get_sqlite_path()."</b>",$this->_debug_sql);
$this->_db_instance = new PDO('sqlite:'.self::get_sqlite_path());
$this->_db_instance = new \PDO('sqlite:'.self::get_sqlite_path());
//@TEST :
//$this->_db_instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // ERRMODE_WARNING | ERRMODE_EXCEPTION | ERRMODE_SILENT
......@@ -103,7 +105,7 @@ class itemToSqlite{
else{
$this->debug("Create new sqlite db : <b>".self::get_sqlite_path()."</b>",$this->_debug_sql);
touch(self::get_sqlite_path());
$this->_db_instance = new PDO('sqlite:'.self::get_sqlite_path());
$this->_db_instance = new \PDO('sqlite:'.self::get_sqlite_path());
}
$this->checkSchemaOrCreateNewIfNotExists();
......@@ -127,7 +129,7 @@ class itemToSqlite{
if(in_array($this->___table,$v)){
$this->debug("Table <b>".$this->___table."</b> is found inside system.table do nothing.",$this->_debug_sql);
$result=$this->_db_instance->query("SELECT * FROM sqlite_master WHERE tbl_name = '".$this->___table."' AND type = 'table'");
$row = $result->fetch(PDO::FETCH_ASSOC);
$row = $result->fetch(\PDO::FETCH_ASSOC);
$this->debug("<u>For info actual schema is :</u>".$row['sql'],$this->_debug_sql);
return;
}
......
......@@ -3,10 +3,10 @@
* CRX-FRAMEWORK
* @author Bastien Barbe
* @date 01/2005
* @revision 23/04/2019
* @revision 27/05/2019
* @module file
* @copyright see header
* @version 1.3.3
* @version 1.3.3-1
*/
namespace crx;
......@@ -14,7 +14,10 @@ namespace crx;
class crxFile{
var $_var_line = '';
static function sfileExist($file){
if(file_exists($file))return true;
return false;
}
function fileExist($file){
if(file_exists($file))return true;
return false;
......@@ -32,7 +35,6 @@ class crxFile{
$f = pathinfo($path_conf.$file, PATHINFO_EXTENSION);
return $f;
}
function _getFileType(){
$out=explode('.',$this->file_name);
......@@ -62,14 +64,10 @@ class crxFile{
}
//setFileContent($file,$content)
//crxFile
function appendVarLine($str_var,$str_value){
$this->_var_line.=''.$str_var.'='.$str_value.';'."\n";
}
......@@ -83,14 +81,12 @@ class crxFile{
}
static function dirExist($path){
return is_dir($path);
}
static function rm($path){
if(file_exists($path)){
......@@ -175,7 +171,6 @@ class crxFile{
}
//todo implement new method : file_get_contents
static function getFileContent($file,$create_if_not_exist_yet=true,$cache_result=false,$cache_key=''){
......@@ -214,7 +209,6 @@ class crxFile{
@touch($file);
}
}
//todo implement new method : file_put_contents
static function setFileContent($file,$content){
......
......@@ -19,12 +19,17 @@ extends parsorCrxFiles{
function __construct($path,$mode=NULL){
parent::__construct();
$this->_cfg["path_init_files"]='';
if($mode==NULL)$mode='r';
$this->_setPath($path);
$this->_setHandleFile($mode);
}
function getAllIniValue($options=array()){
$this->_cfg['options']=$options;
if(isset($this->_cfg['options']['line_with_simple_value']) && $this->_cfg['options']['line_with_simple_value']==1){
$this->_setLineHandler($this,'getLineSimpleValue','crxIniParsor');
......@@ -103,11 +108,11 @@ extends parsorCrxFiles{
}
}
$fileData=file($this->cfg["path_init_files"].$filename);
$fileData=file($this->_cfg["path_init_files"].$filename);
$saved=FALSE;
$fp = fopen($this->cfg["path_init_files"].$filename, "wb");
$fp = fopen($this->_cfg["path_init_files"].$filename, "wb");
foreach($fileData as $line){
......@@ -144,13 +149,13 @@ extends parsorCrxFiles{
function removeOptionFromIniFile($filename,$optionName,$splitter='='){
$fileData = file($this->cfg["path_init_files"].$filename);
$fileData = file($this->_cfg["path_init_files"].$filename);
$saved = FALSE;
unlink($this->cfg["path_init_files"].$filename);
unlink($this->_cfg["path_init_files"].$filename);
$fp = fopen($this->cfg["path_init_files"].$filename, "wb");
$fp = fopen($this->_cfg["path_init_files"].$filename, "wb");
foreach($fileData as $line){
......
......@@ -759,7 +759,9 @@ extends crxHtmlInterface{
}
}
//var_dump($this->_currentModuleLoad);
debugAndContinue('[INFO][MODULE-ENGINE] Try to call : '.$call_method,DEBUG_MODULE_ENGINE_LAYER);
//print 'Try to call : '.$call_method._BR_;
......@@ -816,8 +818,6 @@ extends crxHtmlInterface{
}
//Else simply call method !
$this->$call_method();
......@@ -901,7 +901,7 @@ extends crxHtmlInterface{
if(isset($input_url['mt']))
$this->_currentModuleLoad=$input_url['mt'];
$this->loadPhpModuleLibs();
$this->buildViewObjects();
......
......@@ -2,9 +2,9 @@
/**
* @author Bastien Barbe
* @date 03/2017
* @update 02/05/2019
* @update 28/11/2019
* @copyright see header
* @version 0.7.2-2
* @version 0.7.3-2
*/
/*
......@@ -60,16 +60,27 @@ namespace crx;
class genericOb{
var $_date = '10/03/2017';
var $_release_version = '22052019';
var $_release_version = '25102019';
var $_force_insert_with_pk_field_set = 0;
var $_uniq = 0;
var $c_db = null;