Commit e71d91ae authored by f4eyq's avatar f4eyq

update crx-framework/v3 - 1

parent 903d4ee9
------------------------
CRX FRAMEWORK
Current version:2.0.2
Update:31032019
Current version:3.0.1
Update:28/04/0.2019
Date:01/2008
------------------------
Update XX/XX/2019
Update 28/04/2019
------------------------
- Add name space "crx" for framework engine, and "crxboot" for loader classes and name space "crxcms" for the Web cms CRX-CMS.
- Add multiples delegations classes to single controller class, see genericAdminModule,delegation.
------------------------
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.
- 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
------------------------
......
......@@ -601,6 +601,12 @@ extends crxCore{
if(isset($moduleTarget))
$this->_moduleName = $moduleTarget;
/*
echo '[INFO] call crxFramework::prepareAdminUrl() :
<br />moduleTarget : '.dumper($this->_moduleName).'
<br />options :'.dumper($options)._BR_;*/
debugAndContinue('[INFO] call crxFramework::prepareAdminUrl() :
<br />moduleTarget : '.dumper($this->_moduleName).'
......
......@@ -7,7 +7,11 @@
* @copyright see header
* @version 1.2.1
*/
namespace crx;
class crxFrameworkAjax extends crxFrameworkWebCommon {
function displayOutput(){
/*
crxTemplateXhtmlWrapper::setTemplatePath( _APPLI_INTERFACE_HTML_TPL_PATH_ );
......
......@@ -7,11 +7,16 @@ class frameworkCommon{
}
}*/
class crxFrameworkProcess extends frameworkCommon{
namespace crx;
class crxFrameworkProcess extends frameworkCommon{
function initContext(){}
function setGlobalValue($k,$v){ }
function getGlobalValue($k,$v){ }
}
?>
\ No newline at end of file
......@@ -140,7 +140,7 @@ class crxFrameworkWebCommon {
// TODO COMMON MEMCACHED STACK :
//
function setCommmonUsersGlobalValue($k,$v){
static function setCommmonUsersGlobalValue($k,$v){
$app_name = _APPLI_SEC_KEY_;
$_SESSION[$app_name]['public'][$k]=$v;
}
......@@ -291,7 +291,7 @@ class crxFrameworkWebCommon {
debugAndContinue('[INFO] Loading dictionnary from user session (cache) : '.$current_lng,DEBUG_LNG_LAYER);
}
$this->setCommmonUsersGlobalValue('cached_languages',$cached_languages);
self::setCommmonUsersGlobalValue('cached_languages',$cached_languages);
self::$_modules_dictionnary['common'][$current_lng] = $cached_languages['common'][$current_lng];
}
......@@ -417,7 +417,7 @@ class crxFrameworkWebCommon {
//Update memory and put the result inside the lang stack :
$cached_languages = $this->getCommmonUsersGlobalValue('cached_languages');
$cached_languages[$current_module][$current_lang][$key] = $dic_data[$key];
$this->setCommmonUsersGlobalValue('cached_languages',$cached_languages);
self::setCommmonUsersGlobalValue('cached_languages',$cached_languages);
//Finnaly return the result :
return $dic_data[$key];
......@@ -470,7 +470,7 @@ class crxFrameworkWebCommon {
//SCRICT_LNG_LAYER
}
$this->setCommmonUsersGlobalValue('cached_languages',$cached_languages);
self::setCommmonUsersGlobalValue('cached_languages',$cached_languages);
}
......@@ -589,7 +589,7 @@ class crxFrameworkWebCommon {
$user = crxFramework::getUserInstance();
$user->setValue('lang_pref',$uri['data']['lang'],crxFrameworkWebCommon::getGlobalValue('userId'));
$this->setCommmonUsersGlobalValue('cached_languages',NULL);
self::setCommmonUsersGlobalValue('cached_languages',NULL);
$this->setGlobalValue('lang',$uri['data']['lang']);
$_SESSION['cache']=NULL;
......@@ -938,13 +938,13 @@ class crxFrameworkWebCommon {
}
function getUserIpAdress(){
static function getUserIpAdress(){
//Via web
return $_SERVER['REMOTE_ADDR'];
}
}
?>
......@@ -2,22 +2,20 @@
/**
* @author Bastien Barbe - CRX-FRAMEWORK
* @date 01/01/2005
* @revision 10/2018 / implement spl_autoload_register.
* @revision 04/2019 / implement spl_autoload_register.
* @crx-core classes
* @copyright see header
*/
namespace crx;
function __crxAutoloader($c) {
// debugAndContinue('[INFO]crxLoader.php, crxLoader, __AutoLoad('.$c.') ',DEBUG_FRMW_MODULE_LOADER_LAYER);
debugAndContinue('[INFO]crxLoader.php, crxLoader, load('.$c.') ',DEBUG_FRMW_MODULE_LOADER_LAYER);
$locator = new crxLoader();
$locator->load($c);
}
spl_autoload_register('crx\__crxAutoloader');
//spl_autoload_register('__crxAutoloader');
class crxLoader{
......
......@@ -1142,7 +1142,8 @@ $exec='curl -X POST '.$uri.' \
$userGrp[]=$userGroups;
}
if(!is_array($userGrp))return false;
if( !isset($userGrp) || !is_array($userGrp) )return false;
foreach($userGrp as $k => $userGroups){
if($userGroups['group_id']<>""){
......
......@@ -3,9 +3,9 @@
* CRX-FRAMEWORK
* @author Bastien Barbe
* @date 01/01/2005
* @revision 22/08/2018
* @revision 24/04/2019
* @crx-core classes
* @version 1.2
* @version 1.2.2
*/
namespace crx;
......@@ -23,6 +23,8 @@ class crxHtmlInterface extends crxFramework{
var $template;
var $id = '';
///var $_table_country = 'country';
function displayError($code=0){
......@@ -489,8 +491,8 @@ class crxHtmlInterface extends crxFramework{
$this->_template -> assign("LINK_RETURN_TO",$link);
if($this->warningMode=='on')
$this->_template ->assign("STYLE","FF0000");
if(isset($this->warningMode) && $this->warningMode=='on')
$this->_template ->assign("STYLE","FF0000");
else
$this->_template ->assign("STYLE","3D8FEB");
......@@ -521,7 +523,7 @@ class crxHtmlInterface extends crxFramework{
$this->lng=$input_lang;
}
if(!$this->_template){
if(!isset($this->_template)){
$this->_template = new fastTemplate( _APPLI_INTERFACE_HTML_TPL_PATH_ );
$this->_template -> define(
......@@ -534,9 +536,10 @@ class crxHtmlInterface extends crxFramework{
);
}
if($_GET['id']) $id = $_GET['id'];
if(isset($_GET['id']))
$id = $_GET['id'];
if($this->id) $id = $this->id;
if($this->id && $this->id <> '') $id = $this->id;
$this->_template -> assign("ID",$id);
......
......@@ -3,15 +3,24 @@
* CRX-FRAMEWORK
* @author Bastien Barbe
* @date 01/01/2005
* @revision 04/04/2019
* @revision 26/04/2019
* @crx-core classes
* @version 2.2
* @version 2.2.1
*/
namespace crx;
class crxTemplateXhtmlWrapper extends crxFramework{
class crxTemplateXhtmlWrapper
extends crxFramework{
var $_js_gfiles=array(
'lib_ajax.js',
'lib_browser.js',
'lib_item.js',
'lib_navigation.js',
'lib_bbtags.js',
'lib_tabpane-min.js',
'main.js'
);
//Array witch contain HTML output module
var $_htmlInput = null;
......@@ -342,9 +351,7 @@ extends crxFramework{
$root_js_compress = _APPLI_MAIN_PATH_.'app-js/';
$root_js = _APPLI_MAIN_PATH_.'app-js/'.$module_name.'/';
if(!file_exists($root_js_compress.$final_js) || (FORCE_REFRESH_JS_CACHE)){
$toupdate = FALSE;
if(file_exists($root_js_compress.$final_js)){
......@@ -366,11 +373,9 @@ extends crxFramework{
}
if($toupdate){
echo "Update content: ".$root_js_compress.$final_js._BR_;
if(file_exists($root_js_compress.$final_js)){
unlink($root_js_compress.$final_js);
}
......@@ -399,18 +404,9 @@ extends crxFramework{
return;
}
if(DEV_MODE){
$gfile=array(
'lib_ajax.js',
'lib_browser.js',
'lib_item.js',
'lib_navigation.js',
'lib_bbtags.js',
'lib_tabpane-min.js',
'main.js'
);
if(DEV_MODE){
$final_js='crx.g.common.js';
$this->defineJavaScript2Minify('common',$final_js,$gfile);
$this->defineJavaScript2Minify('common',$final_js,$this->_js_gfiles);
}
//$module_js_def
......@@ -445,10 +441,18 @@ extends crxFramework{
}
$n="\n";
$global_js_lib='<script type="text/javascript" src="app-js/crx.g.common.js"></script>';
if(DEV_MODE){
$global_js_lib='';
foreach($this->_js_gfiles as $k=>$v){
$global_js_lib.='<script type="text/javascript" src="app-js/common/'.$v.'"></script>'."\n";
}
}
$this->_tplMainInterface -> assign('JAVA_SCRIPT','
<!-- framework web js def -->
<script type="text/javascript" src="app-js/crx.g.common.js"></script> '.$n.'
'.$global_js_lib.$n.'
<!-- jquery and tools def -->
'.$jquery.' '.$n.'
'.$fancybox.'
......
......@@ -152,19 +152,25 @@ class crxArray{
}
function encodeArray($array,$set_charset=''){
static function encodeArray($array,$set_charset=''){
if(!$array)return false;
if($set_charset=='utf8'){
foreach($array as $k=>$e){
if(is_array($e))$final_array[$k]=$e;
else
$final_array[$k]=utf8_encode($e);
}
return $final_array;
}
else
return $array;
return $array;
}
......
......@@ -9,9 +9,7 @@
*/
namespace crx;
class crxDataSource
extends crxSchema{
class crxDataSource extends crxSchema{
var $_autoFlushQuerie = 0;
......@@ -1143,9 +1141,7 @@ extends crxSchema{
$seq['tableName'] = $tblnamewithoutprefix;
}
/////////////////////////////////////////
//var_dump($seq['tableName']);
$sql='';
$sql.='SELECT '.$fieldsLimit.' FROM '.$seq['tableName'].' ';
$sql.='WHERE (';
foreach($seq['fields'] as $k=>$field){
......@@ -1166,7 +1162,7 @@ extends crxSchema{
}
$sql.=')';
if(is_array($seq['date_filter'])){
if(isset($seq['date_filter']) && is_array($seq['date_filter'])){
foreach($seq['date_filter'] as $k=>$dateFilter){
$sql.=' AND ('.$dateFilter['field'].' '.$dateFilter['operator'].' '.$dateFilter['date_value'].')';
}
......
......@@ -3,7 +3,7 @@
* CRX-FRAMEWORK
* @author Bastien Barbe
* @date 01/2005
* @revision 05/04/2019
* @revision 23/04/2019
* @module file
* @copyright see header
* @version 1.3.3
......@@ -635,13 +635,13 @@ class crxFile{
for($i = count($emptyDirs); $i--; rmdir($emptyDirs[$i]));
}
function mkdir($dir,$dir_mode=0777){
static function mkdir($dir,$dir_mode=0777){
mkdir($dir, 0777, TRUE);
}
function delTree($dir) {
static function delTree($dir) {
$files = glob( $dir . '*', GLOB_MARK );
foreach( $files as $file ){
if( substr( $file, -1 ) == '/' )
......@@ -649,12 +649,10 @@ class crxFile{
else
unlink( $file );
}
if(is_dir($dir)){
rmdir( $dir );
}
}
}
function rmDir($path,$empty=true){
......
<?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.
*
*************************************************************************************
*/
/**
* @author Bastien Barbe - CRX-FRAMEWORK (cms part)
* CRX-FRAMEWORK
* @author Bastien Barbe
* @date 01/01/2005
* @revision 02/02/2008
* @revision 04/2019
* @module file
* @copyright see header
* @version 1.1.20080203
* @version 1.2
*/
namespace crx;
class crxFileObj{
var $error,$db,$struct = NULL;
var $_tblName = "files";
var $_tblShema = array(
'file_id' ,
'file_title',
......@@ -115,7 +99,7 @@ class crxFileObj{
$this->c_db->formatSqlQuery('',$this->_tblName,'DISPLAY','',$key);
$this->c_db->execSql();
$file = array();
$files = array();
while( $file = $this->c_db -> returnLineAsso() ){
......
<?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.
*
*************************************************************************************
*/
/**
* @author Bastien Barbe - CRX-FRAMEWORK (cms part)
* @date 01/01/2005
* @revision 01/06/2017
* @revision 04/2019
* @module file
* @copyright see header
* @version 1.2.1
* @version 1.2.2
*/
namespace crx;
//See \crx-framework\V2\loader\constant.php for : DEBUG_crxUploadFiles
class crxUploadFiles
extends crxFramework{
var $uploadRootDirectory = NULL;
class crxUploadFiles extends crxFramework{
var $_fileNamePrefix = '';
var $uploadRootDirectory = NULL;
var $generateThumbnail = FALSE;
var $_useDatabaseStorage = true;//Using to store file info
var $_controlFileExtension = true;
......
<?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.
*
*************************************************************************************
*/
/**
* @author Bastien Barbe - CRX-FRAMEWORK (cms part)
* CRX-FRAMEWORK for CMS
* @author Bastien Barbe
* @date 01/01/2005
* @revision 10/2018
* @revision 25/04/2019
* @module generic
* @copyright see header
* @version 1.3
* @version 1.3.1
*/
namespace crx;
......@@ -623,11 +605,7 @@ extends crxHtmlInterface{
$call_method = $this->_handlerMethodNamePrefix.$uri['modAction'];
$action=$uri['modAction'];
}
if(!isset($uri['modAction'])) { $uri['modAction'] = null; }
if(!isset($uri['action'])) { $uri['action'] = null; }
......@@ -675,11 +653,7 @@ extends crxHtmlInterface{
}
}
if(
isset($this->_private_scope_handler_ajaxapp)
&& isset($action)
......@@ -707,9 +681,6 @@ extends crxHtmlInterface{
//echo "@@@";
//var_dump($action);
if(self::$_authentificationComponent<>null){
$session_auth_key = self::$_authentificationComponent->getAuthentificationSessionStorageName();
......@@ -855,44 +826,38 @@ extends crxHtmlInterface{
//Method didn't exist or is delegated :
else{
if(isset($this->_delegateModuleHandler['classToLoad'])){
$call = $this->_delegateModuleHandler['classToLoad'];
$handle = $this->_delegateModuleHandler['handleToLoad'];
$hparent = $this->_delegateModuleHandler['parent'];
foreach($this->_delegateModuleHandler as $k=>$cl){
if(isset($cl['classToLoad'])){
$call = $cl['classToLoad'];
$handle = $cl['handleToLoad'];
$hparent = $cl['parent'];
$ns_exec='';
if($ns=$this->getNameSpace()){
$ns_exec='\\'.$ns.'\\';
}
$cc=$ns_exec.$call;
$idelegate = new $cc($hparent);
if(method_exists($idelegate,$call_method)){
$idelegate->$call_method();
if(method_exists($hparent,$handle)){
$hparent->$handle($idelegate);
$idelegate = new $cc($hparent);
if(method_exists($idelegate,$call_method)){
if(method_exists($hparent,$handle)){
//echo "[info] handle to load : $handle <br />";
$hparent->$handle($idelegate);
}
}
else{
//throw new crxException("Can load method : $call_method");
}
//else{
//echo "[error] cannot load handle : $handle <br />";
//}
//echo "[info] load method : $call_method on $cc (this)<br />";
$idelegate->$call_method();
}
//else{
//throw new crxException("Can load method : $call_method on $cc (this)");
//}
}
debugAndContinue('[ERROR][MODULE-ENGINE] Can load method : '.$call_method,DEBUG_MODULE_ENGINE_LAYER);
//else{
//debugAndContinue('[ERROR][MODULE-ENGINE] Can load method : '.$call_method,DEBUG_MODULE_ENGINE_LAYER);
//}
}
//if($this->_capMethodException)throw new crxException("Can load method : $call_method");
}
}
function debugCalledActionParams($uri){
......@@ -1011,6 +976,9 @@ extends crxHtmlInterface{
//Load models :
if(is_dir($path_handlers)){
$handlers_availables = crxFile::ls($path_handlers,false);
//var_dump($handlers_availables);
if(is_array($handlers_availables)){foreach($handlers_availables as $k=>$v){if(ereg(".php",$v))
include_once($path_handlers.$v);}
}
......@@ -1043,6 +1011,7 @@ extends crxHtmlInterface{
if(is_dir($path_models)){
$models_availables_inside_current_module = crxFile::ls($path_models,false);
if(is_array($models_availables_inside_current_module)){
foreach($models_availables_inside_current_module as $k=>$v){
......
......@@ -111,8 +111,11 @@ class crxCountry{
}
function returnDxccLongitudeAndLatitude($dxcc){
$this->loadTxtDatabaseFile();
return $this->Data_Dxcc[$dxcc] ;
if($dxcc==null)return array();
$this->loadTxtDatabaseFile();
return $this->Data_Dxcc[$dxcc] ;
}
function returnCountryNameFromId($_country_id){
......
......@@ -3,7 +3,7 @@
CRX-FRAMEWORK
* @author Bastien Barbe
* @date 01/01/2005
* @revision 04/04/2019
* @revision 27/04/2019
* @lib geography
* @copyright see header
* @version 1.2.1
......@@ -111,7 +111,11 @@ function test__DDistance($latitude_A, $longitude_A, $latitude_B, $longitude_B){
if($latitude_A == $latitude_B && $longitude_A == $longitude_B) {
return 0;
}
settype($longitude_A,'double');
settype($latitude_A,'double');
settype($longitude_B,'double');
settype($latitude_B,'double');
$rlo1 = deg2rad($longitude_A);
......
......@@ -334,8 +334,8 @@ class bbcodeParser extends crxHtmlInterface{
function showHtmlPico($in){
$key = $in[1];
$this->ico = crxHtmlInterface::loadIco();
$i=new crxHtmlInterface();