Commit 00f2507c authored by root's avatar root

update 20022020

parent c49a6a4b
------------------------
CRX FRAMEWORK
Date: 01/2008
Current version: 3.0.2 - 3
Current version: 3.0.2 - 4
------------------------
Update 20/02/2020
------------------------
- Improve user authentication process.
Add user password hash configuration ( default is now sha256 ).
it can be defined via : framework_conf > userPasswordHashMethod (into bootWeb::boot).
------------------------
Update 29/01/2020
......
......@@ -3,10 +3,10 @@
* CRX-FRAMEWORK
* @author Bastien Barbe
* @creation date 2005
* @revision 24122019
* @revision 05/02/2020
* @module dxClusterWeb
* @copyright see header
* @version 2.0.2-3
* @version 2.0.2-4
*/
namespace crx;
......@@ -498,11 +498,13 @@ extends crxCore{
function lng($key,$mod=null,$lng_selected=null){
/* xdebug test : $_SESSION:5.1ms / without => 5ms
if(isset($_SESSION) && $_SESSION['lngc'][$lng_selected][$key]){
return $_SESSION['lngc'][$lng_selected][$key];
}
*/
/*if(isset($_SESSION) && isset($_SESSION['lngc'][$lng_selected][$key])){
return $_SESSION['lngc'][$lng_selected][$key];
}*/
if($mod){
$module = $mod;
}
......@@ -519,7 +521,7 @@ extends crxCore{
$out = self::$_frameworkProcess->lng($key,$module,$lng_selected);
//$_SESSION['lngc'][$lng_selected][$key]=$out;
/*$_SESSION['lngc'][$lng_selected][$key]=$out;*/
return $out;
......
......@@ -3,10 +3,10 @@
/**
* @author Bastien Barbe - CRX-FRAMEWORK
* @creation date 2005
* @revision 24/12/2019
* @revision 20/02/2020
* @module crxFrameworkWeb
* @copyright see header
* @version 2.0.3-4
* @version 2.0.3-5
*/
namespace crx;
class crxFrameworkWebCommon {
......@@ -380,8 +380,10 @@ class crxFrameworkWebCommon {
//$df=DEBUG_LNG_LAYER;
//$df=0;
//if($key=='LOST_PWD'){$this->_debug_lng = 1;}
//if($key=='EQSL'){$this->_debug_lng = 1;}
//else{$this->_debug_lng = 0;}
///$this->_debug_lng = $df;
//$this->disableLngCache();
......@@ -546,7 +548,20 @@ class crxFrameworkWebCommon {
return $dic_data[$key];
}
//Finnaly try common module + language english :
$current_module='common';
$dic = new crxLanguage(FALSE);
$dic -> setCurrentLanguagesAvailableList(self::$_languages);
$dic -> setCurrentModuleInformation($i[$current_module]);
$dic -> setCurrentLanguageIsInUse('en');
$dic_data = $dic -> loadDictionnary($disable_cache_ini_2_php);
$key=(string)$key;
if(isset($dic_data[$key])){
return $dic_data[$key];
}
return '';
}
function __forceLoadModuleDictionnary($current_module,$current_lang,$key=NULL){
......
......@@ -3,10 +3,10 @@
* CRX-PHP-FRAMEWORK http://git.crx.cloud/crx-php/crx-framework
* @author Bastien Barbe
* @date 01/01/2005
* @revision 29/01/2020
* @revision 20/02/2020
* @package core/crxUsers , frameworkCrxUser.
* @copyright see header
* @version 1.8.3 - 1
* @version 1.8.3 - 3
*/
namespace crx;
......@@ -262,6 +262,12 @@ CREATE TABLE `crx_users_donation` (
);
function getSessionOnlineWindowThreshold(){
return $this->_session_online_window_threshold;
}
function setValueNoId($k,$v,$sk){
......@@ -541,9 +547,15 @@ $exec='curl -X POST '.$uri.' \
$this->_dataAccess -> execSql();
$r = $this->_dataAccess->returnLine();
$_SESSION['user_cache_get_value'][$user_id][$k]=$r[$k];
if($user_id<>null){
$_SESSION['user_cache_get_value'][$user_id][$k]=$r[$k];
return $r[$k];
return $r[$k];
}
}
function getUserInfo($login=null,$id=null){
......@@ -634,20 +646,40 @@ $exec='curl -X POST '.$uri.' \
return $ip;
}
function checkLoginAndPassword($login,$password){
$password = md5($password);
$hm=crxFramework::getFrameworkConfigurationValue('userPasswordHashMethod');
if($hm==null){$hm='sha256';}
$this->_dataAccess->formatSqlQuery('',$this->_table_users,'DISPLAY','',
array(
'filter_key' => 'login_user',
'filter_key_value' => $login
)
);
$this->_dataAccess -> execSql();
$getHashMethod = $this->_dataAccess->returnLine();
$getHashMethod=explode(':',$getHashMethod['pwd_user']);
//No hash conf in password :
if(count($getHashMethod) == 1 ){
$password_test = md5($password);//old method/compatible for the moment for old profile/or non updated password.
}
////Ex: sha256:[SUM PWD STRING]
else{
$method = $getHashMethod[0];
$password_test = $method.':'.hash($method,$password);//old method.
}
$this->_dataAccess->formatSqlQuery('',$this->_table_users,'DISPLAY','',
array(
'filter_key' => 'login_user',
'filter_key_value' => $login,
'AND_filter_key' => 'pwd_user',
'AND_filter_value' => $password,
'AND_filter_value' => $password_test,
)
);
$this->_dataAccess -> execSql();
$m_ = $l = $this->_dataAccess->returnLine();
......@@ -968,15 +1000,13 @@ $exec='curl -X POST '.$uri.' \
$this->_dataAccess -> flush();
$this->_dataAccess -> defineTableShema($this->_userTableShema);
$create_data['pwd_user']=md5($create_data['pwd_user']);
$hm=crxFramework::getFrameworkConfigurationValue('userPasswordHashMethod');
if($hm==null){$hm='sha256';}
$create_data['pwd_user'] = $hm.':'.hash($hm,$create_data['pwd_user']);
$this->_dataAccess -> formatSqlQuery($create_data,$this->_table_users,'INSERT');
//@Debug user creation :
//$this->_dataAccess -> printQuery();
$this->_dataAccess -> execSql();
$user_id = $this->_returnLastId();
......@@ -1082,9 +1112,15 @@ $exec='curl -X POST '.$uri.' \
if(!empty($input_pwd_1) && ($input_pwd_1==$input_pwd_2)){
$hm=crxFramework::getFrameworkConfigurationValue('userPasswordHashMethod');
if($hm==null){$hm='sha256';}
$pwdstring = $hm.':'.hash($hm,$input_pwd_1);
$updatedata=array(
'pwd_user' => md5($input_pwd_1)
'pwd_user' => $pwdstring //md5($input_pwd_1)
);
......
......@@ -3,7 +3,7 @@
* CRX-FRAMEWORK
* @author Bastien Barbe
* @date 01/01/2005
* @revision 11/01/2020
* @revision 10/02/2020
* @crx-core classes
* @version 1.2.3-1
*/
......@@ -290,28 +290,21 @@ class crxHtmlInterface extends crxFramework{
}
function loadIco($force=false){
$path_php_file=_APPLI_MAIN_PATH_.'/registry/ico.php';
$path_php_file=_APPLI_MAIN_PATH_ROOT_.'/conf/ico.php';
if(!$force){
if(!isset($_SESSION))return;
if(isset($_SESSION['ico']) && $_SESSION['ico']){
$ico=$_SESSION['ico'];
return $ico;
if(isset($_SESSION['ico'])){
return $_SESSION['ico'];
}
if(file_exists($path_php_file) && !$ico && !isset($_SESSION['ico'])){
elseif(file_exists($path_php_file) && !isset($_SESSION['ico'])){
require_once($path_php_file);
$_SESSION['ico']=$ico;
return $ico;
}
}
$cache_ds = crxFramework::getFrameworkConfigurationValue('cachingDataSource');
$ds = crxDataSource::getDs($cache_ds);
$ico = array();
if($ds && !$force){
$ds->connection();
$ico = $ds->getValue('ico_html_interface');
......@@ -322,14 +315,10 @@ class crxHtmlInterface extends crxFramework{
}
$theme_dir = _APPLI_ICOS_HTML_PATH_ . $this->_current_ico_pack;
$this->_crxFile = new crxFile();
if(is_dir($theme_dir)){
//Array ( [ 16x16] => 16x16 [ 22x22] => 22x22 [ 32x32] => 32x32 [ 48x48] => 48x48 )
$folder_content=$this->_crxFile->ls($theme_dir,$only_dir=TRUE);
foreach($folder_content as $k=>$folder_level1){
$id_resolution=explode("x",$folder_level1);
......@@ -349,11 +338,8 @@ class crxHtmlInterface extends crxFramework{
$_ico[$id_resolution[0]][$get_ico_name[0]]='<img src=\''.$dir_ico.'\' alt=\''.$get_ico_name[0].'\' border=\'0\' />';
unset($dir_ico,$get_ico_name);
}
}
}
}
if($ds){
......
......@@ -3,9 +3,9 @@
CRX-FRAMEWORK
* @author Bastien Barbe
* @date 01/01/2005
* @revision 01/05/2019
* @revision 06/02/2020
* @lib webapp
* @version 1.5.3-2
* @version 1.5.3-4
*/
namespace crx;
......@@ -383,7 +383,7 @@ class crxDataSource extends crxSchema{
$type = $tableSchemaType[$v]['type'];
if($tableSchemaType[$v]['size'])
if(isset($tableSchemaType[$v]['size']) && $tableSchemaType[$v]['size'])
$field_max_size = $tableSchemaType[$v]['size'];
}
......@@ -874,7 +874,7 @@ class crxDataSource extends crxSchema{
function checkConnexion(){
$this->dbi -> ping();
return $this->dbi -> ping();
}
......@@ -1233,6 +1233,7 @@ class crxDataSource extends crxSchema{
}
function builtSelectKey($display){
$append_sql_where='';
if(
isset($display['filter_key']) &&
$display['filter_key']<>"" &&
......
......@@ -2,9 +2,9 @@
/**
* @author Bastien Barbe
* @date 03/2017
* @update 28/11/2019
* @update 06/02/2020
* @copyright see header
* @version 0.7.3-2
* @version 0.7.4-1
*/
/*
......@@ -56,8 +56,8 @@ class userTransceiverProfile extends \crx\genericOb{
*/
namespace crx;
class genericOb{
class genericOb{
var $_date = '10/03/2017';
var $_release_version = '25102019';
......@@ -70,6 +70,44 @@ namespace crx;
private $itemsProperties = array(0=>array());
/*
Example :
$c = new userConfiguration();
$c->setDbHandler($this->c_db);
$c->target_uid=$uid;
$c->target_module='eQsl';
$c->target_conf_name='myEqslDesign';
$d=$c->getFormatedData(array('unserialize'=>'target_conf_param'));
*/
function getFormatedData($in){
$sql='SELECT * FROM '.$this->c_db -> dbi -> Prefix.$this->_table.' WHERE ';
$c=count($this->itemsProperties[0]);
$i=1;
foreach($this->itemsProperties[0] as $k=>$v){
if($i<$c){$kw=' AND ';}
else $kw='';
$sql.="`$k` = '".$v."'".$kw;
$i++;
}
$this->c_db->execSql($sql);
$result=$this->c_db->returnLine();
if(isset($in['unserialize'])){
foreach($in as $action=>$v){}
if($action=='unserialize'){
$key=$in['unserialize'];
if(isset($result[$key])){
$input=$result[$key];
$input=str_replace('\\','',$input);
$result[$key]=unserialize($input);
}
}
}
return $result;
}
function __construct($db=NULL){
if($db<>NULL){
$this->setDbHandler($db);
......@@ -147,6 +185,7 @@ namespace crx;
$this->itemsProperties=array();
}
function retreive($fields=array(),$use_field='',$return_method='BOTH'){
......
......@@ -550,11 +550,20 @@
<version>1.0</version>
<class_name>userRegistry</class_name>
<class_group>users</class_group>
<class_desc>User registry system</class_desc>
<class_desc>User registry system based on sqlite.</class_desc>
<class_file>userRegistry.php</class_file>
<is_load>1</is_load>
</item>
<item>
<version>1.0</version>
<class_name>userConfiguration</class_name>
<class_group>users</class_group>
<class_desc>User registry system based on mysql.</class_desc>
<class_file>userConfiguration.php</class_file>
<is_load>1</is_load>
</item>
<item>
<version>1.1.20080203</version>
<class_name>crxView</class_name>
......
......@@ -99,6 +99,19 @@ class abstractDxClusterSpot{
$this->_cont['NA']='1,2,3,4,5,6,7,8';
}
function getContinentsAndCqZoneInfo(){
$this->initCqZoneByContinent();
$stack=array();
foreach($this->_cont as $contname=>$cqzone_list){
$cqzone_list=explode(',',$cqzone_list);
foreach($cqzone_list as $cqzk=>$cqzonevalue){
$stack[$cqzonevalue]=$contname;
}
}
return $stack;
}
function improvesAccuracyGeographicPositions($spot){
$c = new hamCountry();
return $c->geoLocatorSpotCommentParser($spot);
......@@ -150,13 +163,6 @@ class abstractDxClusterSpot{
if(isset($tmp['id']))unset($tmp['id']);
$this->global_subbands_filtering_selected=$tmp;
if(!empty($this->global_subbands_filtering_selected)){
//var_dump($this->bands_filtering_selected);
}
/*
var_dump($this->global_subbands_filtering_selected);
array (size=3)
......@@ -170,10 +176,6 @@ class abstractDxClusterSpot{
*/
if(isset($params['filters_order_by'])) $this->display_filters_order_by = $params['filters_order_by'];
if(isset($params['filters_send_filter'])) $this->display_filters_send_filter = $params['filters_send_filter'];
......
......@@ -2,14 +2,14 @@
/**
* @author Bastien Barbe - DXCLUSTER CRX WEB (HAM Version)
* @creation date 2014
* @revision 26/04/2019
* @revision 07/02/2020
* @module dxClusterMailAlertServer
* @version 0.3.2
* @version 0.3.3
*/
namespace crx;
class spotAlert extends generic_crxItem{
var $_tableSchema=array(
'alert_uid',//=>'pk'
'alert_time_repeat',
......@@ -27,15 +27,10 @@ class spotAlert extends generic_crxItem{
'spoter_filter_call'
);
function __construct(){
}
function __construct(){ }
function setDxHamSpotInstance($inst){
$this->_iDxSpots=$inst;
}
function testingProcessSpotsAlerting($uid,$spot_test,$ico,$lng){
......@@ -141,7 +136,6 @@ class spotAlert extends generic_crxItem{
<PRE>'.$content.'</PRE>
'.$content_html.'
</body></html>';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: '.$tname.' <'.$temail.'>' . "\r\n";
......@@ -177,11 +171,9 @@ class spotAlert extends generic_crxItem{
$mail_Data .= "<title> ".$mail_subjet." </title> $nl";
$mail_Data .= "</head> $nl";
$mail_Data .= "<body> $nl";
$mail_Data .= "$mail_content <br />$nl";
$mail_Data .= "</body> $nl";
$mail_Data .= "</HTML> $nl";
$headers = "MIME-Version: 1.0 $nl";
$headers .= "Content-type: text/html; charset=iso-8859-1 $nl";
......@@ -196,14 +188,21 @@ class spotAlert extends generic_crxItem{
if(!$_disable_mail_alert_on_network)
mail ($to, $mail_subjet, $mail_Data, $headers);
}
function logit($message){
\crx\debugAndContinue($message,DEBUG_MAIL_PROCESS);
$lf='/home/hosting/www_root/ham.crx.cloud/logs/dxspots_alerts.log';
$cnt=\crx\crxFile::getFileContent($lf);
//'DEBUG:'.dumper($final_querie_get_dxcluster_spots
\crx\crxFile::setFileContent($lf,$cnt."\n".$message);
}
function processSpotsAlerting($spots_data,$log_instance,$mail_instance,$_disable_mail_alert_on_network=FALSE){
function processSpotsAlerting($spots_data,$log_instance,$mail_instance,$_disable_mail_alert_on_network=FALSE,$_debug_to_logfile=FALSE,$send_only_uid1=FALSE){
foreach($spots_data as $k=>$spot){
foreach($spots_data as $kd=>$spot){
debugAndContinue('[INFO] '.time()." Compute dx-alert for : ".$spot['spotcall'],DEBUG_MAIL_PROCESS);
$this->logit('[INFO] '.time()." Compute dx-alert for : ".$spot['spotcall']);
$spot_dxcc_id = $spot['spotdxcc'];
......@@ -222,7 +221,7 @@ class spotAlert extends generic_crxItem{
foreach($dxalerts as $k=>$rs){
debugAndContinue('[INFO] '.time()." Found user uid :".$rs['user_id'].' / mail alert : '.$rs['alert_user_email'],DEBUG_MAIL_PROCESS);
$this->logit('[INFO] '.time()." Found user uid :".$rs['user_id'].' / mail alert : '.$rs['alert_user_email']);
$user_itu_filter=array();
$process_to_alert=TRUE;
......@@ -244,14 +243,12 @@ class spotAlert extends generic_crxItem{
foreach($uitg as $kk=>$vv){$user_itu_filter[$vv]=$vv;}
}
if(in_array($spotter_itu_id,$user_itu_filter)){
debugAndContinue('[INFO] '.time()." User itu filter(s) match with spotter itu so alert can be process (".$rs['spoter_filter_itu'].$rs['alert_global_spoter_filter_itu']." / spot:$spotter_itu_id).",DEBUG_MAIL_PROCESS);
$log_instance -> reportMessage("[".date('d/m/Y H:i:s')."][HAM] User (".$rs['user_id'].") itu filter:(".$rs['spoter_filter_itu'].$rs['alert_global_spoter_filter_itu']." / spot:$spotter_itu_id) match with spotter itu so alert can be process.",'dxcluster');
$this->logit('[INFO] '.time()." User itu filter(s) match with spotter itu so alert can be process (".$rs['spoter_filter_itu'].$rs['alert_global_spoter_filter_itu']." / spot:$spotter_itu_id).");
}
else{
$process_to_alert=FALSE;
debugAndContinue('[INFO] '.time()." User itu filter(s) doesnt match so we stop alerting process.",DEBUG_MAIL_PROCESS);
$log_instance -> reportMessage('[INFO] '.time()." User (".$rs['user_id'].") itu filter(s) doesnt match so we stop alerting process. (spot:".$spotter_itu_id.' | user gdxf:'.$rs['alert_global_spoter_filter_itu'].' dxf:'.$rs['spoter_filter_itu']." ).",'dxcluster');
$this->logit('[INFO] '.time()." User itu filter(s) doesnt match (alert_global_spoter_filter_itu:".$rs['alert_global_spoter_filter_itu'].",spoter_filter_itu:".$rs['spoter_filter_itu'].") so we stop alerting process.");
}
}
......@@ -262,57 +259,63 @@ class spotAlert extends generic_crxItem{
if($process_to_alert && $rs['spoter_filter_call']){
if($spot_dxcallsign<>$rs['spoter_filter_call']){
$process_to_alert=FALSE;
debugAndContinue('[INFO] '.time()." User call filter(s) doesnt match so we stop alerting process (spot:$spot_dxcallsign <> user:".$rs['spoter_filter_call'].").",DEBUG_MAIL_PROCESS);
$this->logit('[INFO] '.time()." User call filter(s) doesnt match so we stop alerting process (spot:$spot_dxcallsign <> user:".$rs['spoter_filter_call'].").");
}else{
debugAndContinue('[INFO] '.time()." User call filter(s) match so we continue alerting process (spot:$spot_dxcallsign <> user:".$rs['spoter_filter_call'].").",DEBUG_MAIL_PROCESS);
$this->logit('[INFO] '.time()." User call filter(s) match so we continue alerting process (spot:$spot_dxcallsign <> user:".$rs['spoter_filter_call'].").");
}
}
//ITU filter(s) is ok , we check now into the journal for "time" parameter :
if($process_to_alert){
debugAndContinue('[INFO] '.time()." Check now time frq for dx-alert into the journal.",DEBUG_MAIL_PROCESS);
$time_check = $date_now - $alert_time_repeat;
$time_check=$date_now - $alert_time_repeat;
$sql_check_log='SELECT * FROM `crx_cluster_dxcc_alerts_log` WHERE mail_alert_spotrow = '.$spot['rowid'].' AND mail_alert_time >= '.$time_check.'';
$this->logit('[INFO] '.time()." Check now time frq for dx-alert into the journal.");
$this->logit('[INFO] '.time()." => mail_alert_time >= ".date('d/m/Y H:i',$time_check));
$sql_check_log='SELECT * FROM `crx_cluster_dxcc_alerts_log` WHERE mail_alert_uid = \''.$rs['user_id'].'\' AND mail_alert_spotrow = \''.$spot['spotcall'].'\' AND mail_alert_time >= '.$time_check.'';
$this->c_db->execSql($sql_check_log);
$this->logit('[INFO] '.time().' '.$sql_check_log);
$log=$this->c_db->returnLine();
if(!$log){
$process_to_alert=TRUE;
}else{
$process_to_alert=FALSE;
debugAndContinue('[INFO] '.mktime()." User setting for time interval is set to : ".$alert_time_repeat." sec, we stop alerting process.",DEBUG_MAIL_PROCESS);
$log_instance -> reportMessage("[".date('d/m/Y H:i:s')."][HAM] User (".$rs['user_id'].") time interval is set to : ".$alert_time_repeat." sec, we stop alerting process.",'dxcluster');
$this->logit('[INFO] '.time()." User setting for time interval is set to : ".$alert_time_repeat." sec, we stop alerting process.");
}
}
if( $process_to_alert ){
$this->logit('[INFO] '.time()." Send dx-alert to the user ...");
if($send_only_uid1==false){
$this->sendAlert($spot,$user_email,$mail_instance,$_disable_mail_alert_on_network);
$this->logAlert(
array(
'mail_alert_time' => time(),
'mail_alert_uid' => $user_id,
'mail_alert_spotrow' => $spot['spotcall']
)
);
}
else{//Using for debug operation :
if($user_id==1){
$this->sendAlert($spot,$user_email,$mail_instance,$_disable_mail_alert_on_network);
$this->logAlert(
array(
'mail_alert_time' => time(),
'mail_alert_uid' => $user_id,
'mail_alert_spotrow' => $spot['spotcall']
)
);
}
}
$log_instance -> reportMessage("[".date('d/m/Y H:i:s')."][HAM] User (".$rs['user_id'].") send email alert, spot:".$spot['rowid']." user email:$user_email.",'dxcluster');
debugAndContinue('[INFO] '.mktime()." Send dx-alert to the user ...",DEBUG_MAIL_PROCESS);
$this->sendAlert($spot,$user_email,$mail_instance,$_disable_mail_alert_on_network);
$this->logAlert(
array(
'mail_alert_time' => mktime(),
'mail_alert_uid' => $user_id,
'mail_alert_spotrow' => $spot['rowid']
)
);
}
usleep(25000);
}
}
}
function logAlert($alert_data){
......@@ -363,7 +366,9 @@ class spotAlert extends generic_crxItem{
),
'cluster_dxcc_alerts_user_define','INSERT'
);
//$this->c_db -> printQuery();
$this->c_db -> execSql();
}
......@@ -373,11 +378,17 @@ class spotAlert extends generic_crxItem{
function saveUserSettings($s){
$uid = $s['alert_uid'];
$get_dxalert_user_settings = 'SELECT * FROM `crx_cluster_dxcc_alerts_user_settings` WHERE `alert_uid` = "'.$uid.'" ';
//echo $get_dxalert_user_settings._BR_;
$this->c_db->execSql($get_dxalert_user_settings);
//var_dump($s);
if(!$this->c_db->returnLine()){
//echo "add ..."._BR_;
$this->add($s);
}else{
//$this->_debug=1;
//echo "update ... "._BR_;
$this->update($s,'alert_uid',$uid);
}
}
......
......@@ -56,7 +56,12 @@ class spotMode{
'RTTY'=>'RTTY',
'AM'=>'AM',
'FM'=>'FM',
'DSTAR'=>'DSTAR',
'C4FM'=>'C4FM',
'DMR'=>'DMR',
'FUSION'=>'FUSION',
'PSK31'=>'PSK31',
'PSK63'=>'PSK63',
......
......@@ -3,18 +3,14 @@
* CRX-FRAMEWORK
* @author Bastien Barbe
* @date 01/01/2005
* @revision 05/04/2019
* @revision 20/02/2020
* @lib users
* @copyright see header