Commit 6af5c193 authored by f4eyq's avatar f4eyq

update 13122019

parent 69559020
[hawaii] [ internet creation ]
[ ham radio ][ dxcluster creation from GB ]
------------------------
CRX FRAMEWORK
Current version:3.0.1
Current version:3.0.1 - 3
LastUpdate:12/2019
Date:01/2008
------------------------
Update 12/2019
------------------------
- Correct bug into XML parsing.
------------------------
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
------------------------
......
......@@ -185,18 +185,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');
......@@ -357,6 +352,10 @@ 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 +369,7 @@ extends crxCore{
require_once('crxFrameworkWeb.php');
crxFrameworkWeb::setUrlmode('normal');
self::$_frameworkProcess=new crxFrameworkWeb();
self::$_frameworkProcess->initContext();
......@@ -652,11 +651,12 @@ extends crxCore{
}
static function sGetAvailableLanguage(){
return self::$_frameworkConfiguration['available_languages'];
}
function getAvailableLanguage(){
return self::$_frameworkConfiguration['available_languages'];
}
static function getUserInstance(){
......@@ -723,8 +723,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;
}
}
......
......@@ -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;
private $itemsProperties = array(0=>array());
function __construct($db=NULL){
if($db<>NULL){
$this->setDbHandler($db);
}else{
$this->setDbHandler(crxDataSource::getDs('mysql'));
if(!$this->c_db){
die('ERROR - Missing $db arg, die.'."\n");
}
}
}
function setTableName($t){
$this->_table = $t;
......@@ -85,9 +96,8 @@ namespace crx;
function getTablePrefix(){
return $this->c_db -> dbi -> Prefix;
}
public function __set($key, $value) {
......@@ -168,7 +178,7 @@ namespace crx;
function get(){
$fd='';
$pp=$this->itemsProperties[0];
$c=count($pp);$i=1;
foreach($pp as $k=>$v){
......@@ -294,10 +304,8 @@ namespace crx;
$this->_data=$d;
}
//$this->c_db->enableDebugProcess(1);
$p = $this->c_db->setItemProperties(
$this->_data,
$this->_table,
......@@ -310,10 +318,9 @@ namespace crx;
0,
$mysql_bulk
);
//echo '<PRE>'.dumper($this->c_db->_dbg).'</PRE>';
//return $this->c_db->_dbg;
//return $this->c_db->_dbg;
//echo '<PRE>'.dumper($this->c_db->_dbg).'</PRE>';
//echo $this->c_db->_dbg;
......@@ -362,15 +369,16 @@ namespace crx;
foreach($this->_tableShema as $k=>$v){
foreach($this->_tableShema as $k=>$v){
if(in_array($v,$fields)){
//echo "column already in table : $v <br />";
}elseif($v<>'pk'){
//echo "detect new field: $v <br />";
$t=$this->c_db -> dbi -> Prefix.$this->_table;
$sql='ALTER TABLE `'.$t.'` ADD `'.$v.'` VARCHAR(255) NULL DEFAULT NULL AFTER `'.$prec_field.'`';
$t=$this->c_db -> dbi -> Prefix.$this->_table;
/*var $_tableSchemaType = array('my_column' => array('type'=>'text')); */
$typesql='VARCHAR(255)';
if(isset($this->_tableSchemaType[$v])){$typesql=$this->_tableSchemaType[$v]['type'];}
$sql='ALTER TABLE `'.$t.'` ADD `'.$v.'` '.$typesql.' NULL DEFAULT NULL AFTER `'.$prec_field.'`';
$this->c_db -> execSql($sql);
//$message.="<br /><br />".$sql."<br />";
}
......@@ -419,16 +427,7 @@ namespace crx;
}
function __construct($db=NULL){
if($db<>NULL){
$this->setDbHandler($db);
}else{
$this->setDbHandler(crxDataSource::getDs('mysql'));
if(!$this->c_db){
die('ERROR - Missing $db arg, die.'."\n");
}
}
}
function getDbHandler(){
......@@ -567,6 +566,8 @@ namespace crx;
);
$this->itemsProperties=array();
$this->c_db -> execSql($sql);
while($r = $this->c_db -> returnLineAsso()){
$this->itemsProperties[]=$r;
......
......@@ -126,7 +126,6 @@ class crxCountry{
$getCountryName = $this->c_db -> returnLine();
return $getCountryName['country_name'];
}
function lsAll($mode){
//mode : allAndDxccNum11m , onlyCountryName
......
......@@ -70,71 +70,53 @@ extends crxHtmlInterface{
// All templates will be loaded from this "root" directory
// Can be changed in mid-process by re-calling with a new
// value.
function set_root ($root){
function set_root($root){
$trailer = substr($root,-1);
if(!$this->WIN32){
if( (ord($trailer)) != 47 ) {
$root = "$root". chr(47);
}
if(is_dir($root)){
$this->ROOT = $root;
return;
}
else{
$this->ROOT = "";
$this->error("Specified ROOT dir [$root] is not a directory");
}
}
else{
// WIN32 box - no testing
if( (ord($trailer)) != 92 ){
$root = "$root" . chr(92);
}
$this->ROOT = $root;
}
} // End set_root()
//TODO
// ************************************************************
// Grabs a template from the root dir and
// reads it into a (potentially REALLY) big string
function get_template ($template)
{
if(empty($this->ROOT))
{
function get_template ($template){
if(empty($this->ROOT)){
//echo "@1".time();
$this->error("TEMPLATE ERROR : Cannot open template. Root not valid (empty).",1);
return false;
}
if(!is_dir($this->ROOT))
{
if(!is_dir($this->ROOT)){