Commit 6d34b679 authored by f4eyq's avatar f4eyq

update pre 31/3 - part 2

parent 6647a84c
------------------------
CRX FRAMEWORK
Current version:2.0.1
Update:12/2018
Current version:2.0.2
Update:31032019
Date:01/2008
------------------------
Update 31/03/2019
------------------------
Add html compression to main interface
Add enable_user_auth option from loader script,
to enable or display user authent ( ex on webservice it can be disable ).
Add user registry class, to build a small registry by user,
ex : save current db schema value, and update if necessary.
------------------------
Update 27/01/2019
------------------------
......
......@@ -81,6 +81,15 @@ class crxFrameworkWeb extends crxFrameworkWebCommon{
}
}
function compressHtml($in){
$c = new crxTemplateXhtmlWrapper();
return $c->compressOutput($in);
}
function displayOutput(){
crxTemplateXhtmlWrapper::setTemplatePath( _APPLI_INTERFACE_HTML_TPL_PATH_ );
......
......@@ -542,9 +542,7 @@ class crxFrameworkWebCommon {
* @access public
*/
function listenAction(){
$user = crxFramework::getUserInstance();
$visitor = crxFramework::getVisitorInstance();
$auth = crxFramework::getUserAuthInstance();
......@@ -556,8 +554,6 @@ class crxFrameworkWebCommon {
$auth -> loadObjects();
}
if(crxFramework::getFrameworkConfigurationValue('framework_debug_console')){
echo self::showDebugConsole();
......@@ -573,6 +569,8 @@ class crxFrameworkWebCommon {
}
$uri=NULL;
$enable_user_auth = crxFramework::getFrameworkConfigurationValue('enable_user_auth');
if(isset($_GET['id']) || isset($_GET['mt'])){
......@@ -607,6 +605,7 @@ class crxFrameworkWebCommon {
//crxFrameworkWeb::debugGlobalValue('userId');
if(
$enable_user_auth &&
isset($_POST['SubmitLogout']) &&
is_object($auth) &&
$auth -> tryToCloseHttpSession($_POST['SubmitLogout'])
......@@ -616,7 +615,7 @@ class crxFrameworkWebCommon {
}
if(!crxFramework::getLoginUserStatus()){
if($enable_user_auth && !crxFramework::getLoginUserStatus()){
//Try to login-in with user cookie !
if (isset($_COOKIE['crx_log'])) {
......@@ -728,8 +727,8 @@ class crxFrameworkWebCommon {
//TEST /
//php7 addon :
if(isset($uri['data']['action']) && crxFramework::getLoginUserStatus() && $uri['data']['action'] == 'crxFrameworkAuthUser'){
//if(isset($uri['data']['action']) && crxFramework::getLoginUserStatus() && $uri['data']['action'] == 'crxFrameworkAuthUser'){
//??????
///return $this->redirect('/');
......@@ -751,7 +750,7 @@ class crxFrameworkWebCommon {
);
*/
}
//} //N?????
if(!isset($uri['data']))$uri['data']=array();
......@@ -761,16 +760,14 @@ class crxFrameworkWebCommon {
);
//var_dump($uri);
}//if(isset($_GET['id']) || isset($_GET['mt'])){
if($uri==NULL){
//User is not login in and try to load website ROOT
//we redirect him with valid http session, on login in module ! :)
if(!crxFramework::getLoginUserStatus()){
//User is not login in and try to load website :
//We redirect him with valid http session, on login in module.
if($enable_user_auth && !crxFramework::getLoginUserStatus()){
//Try to login-in with user cookie !
if (isset($_COOKIE['crx_log'])) {
......@@ -778,9 +775,7 @@ class crxFrameworkWebCommon {
$auth -> tryToOpenHttpSessionFromCookie(
$_COOKIE['crx_log'],
$_COOKIE['crx_pwd'])
){
//@APPEND CODE
$url_encodage_mode = crxFramework::getFrameworkConfigurationValue('enforceUriSecurityMode');
if($url_encodage_mode=='b64id'){$uri = '?id=';}
else $uri = NULL;
......@@ -797,6 +792,7 @@ class crxFrameworkWebCommon {
);
}
}
}
//Received POST on web root (like webservice command) :
......
......@@ -20,10 +20,10 @@
/**
* @author Bastien Barbe - CRX-FRAMEWORK
* @date 01/01/2005
* @revision 14/02/2008
* @revision 26032019
* @crx-core classes
* @copyright see header
* @version 1.1.20080214
* @version 1.2
*/
class crxXml {
......@@ -99,15 +99,9 @@ class crxXml {
}
function setPath($path){
$this->_pathOfXmlFile = $path;
return;
/*
if(!is_file($path))return;
if(!$fd = fopen($path, 'r')){
......@@ -116,24 +110,67 @@ class crxXml {
//else print $path;
if($fd)
fclose($fd);
$this->_xmlFilePathMD5 = md5($path);
$this->_xmlFileContent = file($path);
$this->_xmlFileContent = file($path);*/
}
function defineItemName($item){
$this->xmlItemType=$item;
return;
/*
//deprecated:
$this->MSItem = '<'.$item.'>';
$this->MEItem = '</'.$item.'>';
$this->RegMSItem = addcslashes($this->MSItem,"/");//Convert data for regex use(Add / for each \).
$this->RegMEItem = addcslashes($this->MEItem,"/");
*/
}
function parseAndReturnValues(){
function defineItemNameL2($item){
$this->xmlItemTypeL2=$item;
return;
}
function parseAndReturnValuesL2(){
$itemType=$this->xmlItemType;
$itemType = $this->xmlItemType;
$ress_xml = simplexml_load_file($this->_pathOfXmlFile);
$itemTypeL2 = $this->xmlItemTypeL2;
$p_cnt = count($ress_xml->$itemType);
$ress_xml = simplexml_load_file($this->_pathOfXmlFile);
if($itemTypeL2<>null)
$p_cnt = count($ress_xml->$itemType->$itemTypeL2);
else
$p_cnt = count($ress_xml->$itemType);
for($i = 0; $i < $p_cnt; $i++) {
if($itemTypeL2<>null)
$item=$ress_xml->$itemType->$itemTypeL2[$i];
else
$item=$ress_xml->$itemType[$i];
foreach($item as $k=>$v){
$k=(string)$k;
$v=(string)$v;
$itemarr[$k]=$v;
}
$this->_finalItem[]=$itemarr;
}
return $this->_finalItem;
}
function parseAndReturnValues(){
$itemType=$this->xmlItemType;
$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];
foreach($item as $k=>$v){
$k=(string)$k;
......@@ -141,18 +178,12 @@ class crxXml {
//var_dump($k);
$itemarr[$k]=$v;
}
$this->_finalItem[]=$itemarr;
}
return $this->_finalItem;
//OLD METHOD :
/*
$j = 0;
$xml_cache_path = _APPLI_CACHE_SCRIPT_PATH_ . "interface"._SD_."xml_".$this->_xmlFilePathMD5;
......@@ -229,40 +260,15 @@ class crxXml {
$this->_finalItem[$this->_itemId][$this->_tabFieldConstructor[$j]] = $_currentField[1];
}
$j++;
}
}
if($this->_enable_xml_cache && class_exists('crxFile') && !empty($this->_finalItem) ){
crxFile::setFileContent($xml_cache_path,serialize($this->_finalItem));
}
}
return $this->_finalItem;
}
function defineItemName($item){
$this->xmlItemType=$item;
return;
//deprecated:
$this->MSItem = '<'.$item.'>';
$this->MEItem = '</'.$item.'>';
$this->RegMSItem = addcslashes($this->MSItem,"/");//Convert data for regex use(Add / for each \).
$this->RegMEItem = addcslashes($this->MEItem,"/");
*/
}
function returnLine(){
......
......@@ -256,16 +256,14 @@ class crxFile{
if(!file_exists($file)){
$r=touch($file);
if(!$r){
return false;
}
}
file_put_contents($file,$content);
$f=file_put_contents($file,$content);
//var_dump($f);
return true;
......
......@@ -111,6 +111,8 @@
}
$this->_debug_sql_querie=$sql;
return $this->itemsProperties;
}
......@@ -155,6 +157,8 @@
$sql='SELECT * FROM '.$this->c_db -> dbi -> Prefix.$this->_table.';';
}
$this->_debug_sql_querie=$sql;
$row=array();
$this->c_db->setItemConfig(
$this->_data,
......@@ -271,7 +275,6 @@
}
function updateSchema(){
......
......@@ -547,6 +547,15 @@
<is_load>1</is_load>
</item>
<item>
<version>1.0</version>
<class_name>userRegistry</class_name>
<class_group>users</class_group>
<class_desc>User registry system</class_desc>
<class_file>userRegistry.php</class_file>
<is_load>1</is_load>
</item>
<item>
<version>1.1.20080203</version>
<class_name>crxView</class_name>
......@@ -881,11 +890,11 @@
<is_load>1</is_load>
</item>
<item>
<version>1.1.20080203</version>
<class_name>dxClusterSpots</class_name>
<version>1.2.20190331</version>
<class_name>dxClusterSpot11m</class_name>
<class_group>radioamator</class_group>
<class_desc>11m dx-spot</class_desc>
<class_file>class.dxClusterSpots.php</class_file>
<class_file>dxClusterSpot11m.php</class_file>
<is_load>1</is_load>
</item>
<item>
......
......@@ -20,10 +20,10 @@
/**
* @author Bastien Barbe - CRX-FRAMEWORK
* @date 01/01/2005
* @revision 02/02/2008
* @revision 31/03/2019
* @lib logs
* @copyright see header
* @version 1.1.20080203
* @version 1.2
*/
class crxSysLog
extends crxLoger{
......@@ -75,6 +75,9 @@ extends crxLoger{
$this->setLogFile($this->_logPath);
//var_dump($this->_logPath);
$ip='';
if($showIPAdress)$ip=' - IP: '.$this->getIp();
$this->appendEntry($message.$ip);
......
<?php
// extends generic_crxItem
// v122018
// v1.0.31032019
class abstractDxClusterSpot{
var $_debug_details = '';
......@@ -24,7 +24,9 @@ class abstractDxClusterSpot{
function setSpotCallsign($call){
$this->_spot_calldx = $call;
}
function setSpotCallSender($call){
$this->_spot_callsender=$call;
}
function setSpotdxLocator($locator){
$this->_spot_dx_locator = $locator;
......
......@@ -6,6 +6,8 @@
* @copyright see header
*/
//TODO rename to : dxClusterSpot11m
//NOW DEPRECATED MOVE TO dxClusterSpot11m.php
//dxClusterSpotHam
class dxClusterSpots
extends abstractDxClusterSpot{
......@@ -577,10 +579,8 @@ extends abstractDxClusterSpot{
$c->c_db=$this->c_db;
$dxcoor=$c->getDxccLatitudeAndLongitudeFrom11mContryPrefix($dx_id);
$sendcoor=$c->getDxccLatitudeAndLongitudeFrom11mContryPrefix($send_id);
/**
* If locator sender is correct we used it to create
* locator instance :
......@@ -607,7 +607,7 @@ extends abstractDxClusterSpot{
$this->_destinationDeg = $locator_info ->ArrayDestinationLocatorDegres;
$azimut = $locator_info ->getAzimutDeg();
$distance = $locator_info ->getDistanceKm();
$distance = $locator_info ->getDistanceKmV2();//getDistanceKm();
$azimut_inv = $locator_info ->getSpotAzimutInv();
$azimutBr = $locator_info ->getSpotAzimutBr();
$_rote = $locator_info ->getRadiusOfTheEarth();
......@@ -619,12 +619,9 @@ extends abstractDxClusterSpot{
'destination'=>$locator_info ->ArrayDestinationLocatorDegres
);
/*
echo "@@@";
//var_dump($this->_spot_sender_locator);
var_dump($this->_coordComputed);
echo "@@@";
var_dump($this->_spot_sender_locator);
*/
$this->_azimut_inv = $azimut_inv;//azm LP
......@@ -633,9 +630,7 @@ extends abstractDxClusterSpot{
$this->_azimutBr = $azimutBr;
$this->_rote = $_rote;
$this->_pi = $_pi;
}
function setSpotData($data){
......
......@@ -183,11 +183,20 @@ extends generic_crxItem{
if($p<>''){
/*
Official version :
types = "images" / "gallery"
$photos.='<a data-fancybox="images" href="'.$p.'" title="Station Photo ('.$i.')">
<img src="'.$p.'" width="250px">
</a>';
*/
/* fancybox version with button:*/
$photos.='
<a class="fancybox" href="'.$p.'" data-fancybox-group="gallery" title="Station Photo ('.$i.')">
<img src="'.$p.'" width="250px">
</a>';
}
......
......@@ -19,17 +19,19 @@ class dxClusterSpot {
function getDxClusterStatsContinentDxSpotRepartition($db='spot',$time_select=array('start','end'),$user_continent='EU',$nb_total_spots=0,$user_band_selected='ALL',$debug=0){
//HAM Radio mode :
if($this->__mode == 'HAM'){
$sp=new dxClusterSpotHam();
$sp->c_db=$this->c_db;
}
else{//11M
$sp=new dxClusterSpots();
else{//11M/PMR amator :
$sp=new dxClusterSpot11m();
$sp->setDbHandler($this->c_db);
}
$sp->setTableSpotName($db);
$sp->initCqZoneByContinent();
return $sp->getDxClusterStatsContinentDxSpotRepartition(
......@@ -85,7 +87,7 @@ class dxClusterSpot {
$s->setDbHandler($this->c_db);
}
else{
$s=new dxClusterSpots();
$s=new dxClusterSpot11m();
$s->setDbHandler($this->c_db);
}
......@@ -168,7 +170,7 @@ class dxClusterSpot {
$filters['filters_order_by'] = 'time';
}
else{
$s=new dxClusterSpots();
$s=new dxClusterSpot11m();
$s->setDbHandler($this->c_db);
$s->setDebug($this->debug);
$filters['tbl_crx_spots'] = 'crx_cluster_spots';
......
This diff is collapsed.
......@@ -8,6 +8,14 @@
<class_file>crxVisitor.php</class_file>
<is_load>1</is_load>
</item>
<item>
<version>1.1.20080505</version>
<class_name>crxAuthentificationComponent</class_name>
<class_group>users</class_group>
<class_desc>User authentification process</class_desc>
<class_file>crxAuthentificationComponent.php</class_file>
<is_load>1</is_load>
</item>
<item>
<version>1.1.20080203</version>
<class_name>crxUserAuthentification</class_name>
......@@ -16,4 +24,12 @@
<class_file>crxUserAuthentification.php</class_file>
<is_load>1</is_load>
</item>
<item>
<version>1.0</version>
<class_name>userRegistry</class_name>
<class_group>users</class_group>
<class_desc>User registry system</class_desc>
<class_file>userRegistry.php</class_file>
<is_load>1</is_load>
</item>
</global>
<?php
//todo move this class to crx framework
//date 201806
//up 26032019
class userRegistry{
var $_reg_values = array();
var $_mod = NULL;
var $_uid = NULL;
function setModName($name){$this->_mod=$name;}
function setUserId($uid){$this->_uid=$uid;}
function __construct($mod_name,$uid){
$this->setModName($mod_name);
$this->setUserId($uid);
}
function setAllRegValues($values){
$this->_reg_values=$values;
}
function setAllRegValue($k,$value){
$this->_reg_values[$k]=$value;
}
function setPathRoot($r){
$this->_path_root = $r;
}
function getRegValues(){
$content=array();
$path_reg=$this->_path_root.'/conf/dbo-persistant/'.$this->_mod.'/user_registry_'.$this->_uid.'.reg';
if(file_exists($path_reg)){
$content=file_get_contents($path_reg);
$content=unserialize($content);
$this->_reg_values=$content;
}
return $content;
}
function commit(){
$path_reg=$this->_path_root.'/conf/dbo-persistant/'.$this->_mod.'/user_registry_'.$this->_uid.'.reg';
if(!file_exists($path_reg)){
$this->_reg_values['created_date'] = time();
}
$this->_reg_values['update_date'] = time();
$content=serialize($this->_reg_values);
file_put_contents($path_reg,$content);
}
function checkIfExists(){
$path_reg=$this->_path_root.'/conf/dbo-persistant/'.$this->_mod.'/user_registry_'.$this->_uid.'.reg';
if(!file_exists($path_reg)){
return FALSE;
}
else
return TRUE;
}
}
?>
......@@ -163,7 +163,9 @@ extends crxSchema{
function setItemProperties($data,$table_name,$table_shema,$table_schema_type,$pk_name,$auto_create_schema=1,$uniq_field=array(),$index_field=array(),$debug=0,$mysql_bulk=0){
$this->_dbg='';
$this->_table_schema=$table_shema;
$this->dbi->_dataSourceConfiguration=$this->_dataSourceConfiguration;
$table_exist=1;
......@@ -223,12 +225,15 @@ extends crxSchema{
if($this->_debugProcess)
$this->_dbg.="\n->Force insert with pk field is set to:".$this->_force_insert_with_pk_field_set."\n";
//INSERT
if($data[$pk_name] == null || $data[$pk_name] == 0 || $data[$pk_name] == -1){
if($this->_debugProcess)$this->_dbg.="\n->Insert data via classiq SQL INSERT.\n";
$this->dbi -> defineTableShema($this->_table_schema);
$s=$this->dbi -> formatSqlQuery($data,$table_name,'INSERT');
$s=$this->dbi -> formatSqlQuery($data,$table_name,'INSERT');
if($this->_debugProcess)$this->_dbg.="\n->SQL:$s\n";
if($mysql_bulk==0)
......@@ -242,7 +247,7 @@ extends crxSchema{
}
//UPDATE
elseif(isset($data[$pk_name])){
$k=array($pk_name=>$data[$pk_name]);
......@@ -1420,7 +1425,7 @@ extends crxSchema{
// && $data_array[$fieldName]<>null
if(!is_array($fieldName) && $fieldName<>'pk' && isset($data_array[$fieldName]) && $data_array[$fieldName]<>null)
if(!is_array($fieldName) && $fieldName<>'pk' && isset($data_array[$fieldName]))// && $data_array[$fieldName]<>null
/* Secure SQL Query with secSql (htmlspecialchars + addslashes) */
......
......@@ -345,11 +345,11 @@ extends crxDataSource{
var $_debug = false;
var $dataInstance = NULL;
var $dataInstance = NULL;
var $queryId = NULL;
var $error = NULL;
var $error = NULL;
var $_defCharset = 'utf8';
......
......@@ -6,7 +6,7 @@ define('DEBUG_MODULE_ENGINE_LAYER',0);
define('DEBUG_WEBSERVICE_CRX_LAYER',0);//See crxFrameworkWebserviceCrx
define('ENABLE_LOG_DEBUG',0);//See crxFrameworkWebserviceCrx
define('_DEBUG_LOG_FILE_','/tmp/debug_php.log');//Set debug path
define('DEBUG_crxUploadFiles',1);
define('DEBUG_crxGdPicture',1);
define('DEBUG_crxUploadFiles',0);
define('DEBUG_crxGdPicture',0);
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment