Commit 024781ad authored by f4eyq's avatar f4eyq

update crx-framework/v3-1

parent e71d91ae
------------------------
CRX FRAMEWORK
Current version:3.0.1
Update:28/04/0.2019
Date:01/2008
------------------------
Update 28/04/2019
......
......@@ -3,10 +3,10 @@
* CRX-FRAMEWORK
* @author Bastien Barbe
* @creation date 2005
* @revision 17062018
* @revision 02052019
* @module dxClusterWeb
* @copyright see header
* @version 2.0.2
* @version 2.0.2-2
*/
namespace crx;
......@@ -14,6 +14,11 @@ namespace crx;
class crxFramework
extends crxCore{
var $_debug_mail_inside_log = 0;
var $_dont_send_mail_on_network = 0;
static function getCurrentConnectedUserInfo(){
......@@ -180,13 +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());
}
......@@ -790,26 +795,31 @@ extends crxCore{
return $this->goCrxLog;
}
function mailAdminNotification($content,$mail_admin=null,$usersGroups=null,$subject=null){
if(!$this->crxCfg)$this->loadConfiguration();
if(!$mail_admin)$mail_admin=$this->crxCfg['configuration']['global']['website_webmaster_mail'];
function mailAdminNotification($content,$mail_admin=null,$usersGroups=null,$subject=null){
//if(!isset($this->crxCfg))
$this->loadConfiguration();
if(!$mail_admin) $mail_admin = $this->crxCfg['configuration']['global']['website_webmaster_mail'];
if(!isset($mail_admin))return false;
$this->mail = new crxMail();
$this->mail->debug($this->_debug_mail_inside_log,$this->_dont_send_mail_on_network);
$this->mail -> from(
$this->mail = new crxMail();
$this->mail->debug($this->_debug_mail_inside_log,$this->_dont_send_mail_on_network);
$this->mail -> from(
$this->crxCfg['configuration']['global']['website_webmaster_mail'],
$this->crxCfg['configuration']['global']['website_mail_title']
);
);
$this->mail -> to($mail_admin);
$this->mail -> subject($subject);
$this->mail -> content($content);
$this->mail -> send();
}
$this->mail -> to($mail_admin);
$this->mail -> subject($subject);
$this->mail -> content($content);
$this->mail -> send();
}
......
......@@ -3,7 +3,7 @@
/**
* @author Bastien Barbe - CRX-FRAMEWORK
* @creation date 2005
* @revision 18/04/2018
* @revision 30/04/2019
* @module crxFrameworkWeb
* @copyright see header
* @version 2.0.2
......@@ -33,7 +33,7 @@ class crxFrameworkWebCommon {
static $_modules_dictionnary = array();
//For all php HTML we need this security thread protection :
function secureDisplayFromXss($dsp){
static function secureDisplayFromXss($dsp){
return htmlspecialchars($dsp);
......@@ -159,7 +159,7 @@ class crxFrameworkWebCommon {
}
function getCurrentUserLanguage(){
static function getCurrentUserLanguage(){
return self::$_currentUserLanguage;
......
......@@ -56,42 +56,67 @@ abstract class frameworkCrxUser extends crxFramework {
abstract function __delete($_id);
}
class crxUser extends frameworkCrxUser{
var $__isDonator = 0;
var $__isChatAdmin = 0;
var $__isAdmin = 0;
var $_messages = '';
var $__isDonator = 0;
var $__isChatAdmin = 0;
var $__isAdmin = 0;
function getUserTableDirectorySchema(){
return $this->_userTableDirectoryShema;
}
function setDataInstance($data_instance){
$this->_dataAccess = $data_instance;
}
var $_userDonationTableShema = array(
'donation_id',
'donation_id'=>'pk',
'donation_date',
'donation_user_id',
'donation_amount',
'donation_type'
);
function deleteDonation($_id){
$this->_dataAccess -> defineTableShema($this->_userDonationTableShema);
$this->_dataAccess -> formatSqlQuery('',$this->_table_users_donation,'DELETE',array('donation_id'=>$_id));
$this->_dataAccess -> execSql();
}
function returnDonationDataFromId($id){
$this->_dataAccess->formatSqlQuery('',$this->_table_users_donation,'DISPLAY','',array('filter_key'=>'donation_id','filter_key_value'=>$id));
$this->_dataAccess -> ExecSql();
//$this->_dataAccess -> printQuery();
return $this->_dataAccess -> returnLineAsso();
}
function editDonation($donation_id,$updatedata){
$this->_dataAccess -> defineTableShema($this->_userDonationTableShema);
$this->_dataAccess -> formatSqlQuery($updatedata,$this->_table_users_donation,'UPDATE',array('donation_id'=>$donation_id));
$this->_dataAccess -> execSql();
$this->_dataAccess -> printQuery();
if( $donation_id== -1 ){
$this->_dataAccess -> defineTableShema($this->_userDonationTableShema);
$this->_dataAccess -> formatSqlQuery($updatedata,$this->_table_users_donation,'INSERT');
$this->_dataAccess -> execSql();
//die($this->_dataAccess -> getExecSqlError());
return $this->_dataAccess->getLastItem();
}
if( $donation_id <> -1 ){
$this->_dataAccess -> defineTableShema($this->_userDonationTableShema);
$this->_dataAccess -> formatSqlQuery($updatedata,$this->_table_users_donation,'UPDATE',array('donation_id'=>$donation_id));
$this->_dataAccess -> execSql();
return $donation_id;
}
//$this->_dataAccess -> printQuery();
/*
......@@ -108,7 +133,7 @@ CREATE TABLE `crx_users_donation` (
}
var $_release='31082017';
var $_release='31042019';
var $_session_online_window_threshold = 90;
......@@ -949,7 +974,7 @@ $exec='curl -X POST '.$uri.' \
$user_id = $this->_returnLastId();
if(is_array($create_data['user_groups_form'])){
if(isset($create_data['user_groups_form']) && is_array($create_data['user_groups_form'])){
foreach($create_data['user_groups_form'] as $k=>$groupId){
$this->saveGroupUserMembers($user_id,$groupId);
}
......
......@@ -3,16 +3,21 @@
* CRX-FRAMEWORK
* @author Bastien Barbe
* @date 01/01/2005
* @revision 24/04/2019
* @revision 02/05/2019
* @crx-core classes
* @version 1.2.2
* @version 1.2.2-2
*/
namespace crx;
class crxHtmlInterface extends crxFramework{
var $_disableMin = false;
var $_disableHour = false;
var $_template = false;
//dd
var $_current_ico_pack = 'icons_dist';
protected static $_sIco = array();
......@@ -485,7 +490,7 @@ class crxHtmlInterface extends crxFramework{
}
$this->_template -> assign("FIELD_INFO",LNG_FIELD_INFO);
//$this->_template -> assign("FIELD_INFO",LNG_FIELD_INFO);
if($link<>NULL)
$this->_template -> assign("LINK_RETURN_TO",$link);
......@@ -523,7 +528,9 @@ class crxHtmlInterface extends crxFramework{
$this->lng=$input_lang;
}
if(!isset($this->_template)){
//die(_APPLI_INTERFACE_HTML_TPL_PATH_);
/// public/html-interface/
//if(!isset($this->_template)){
$this->_template = new fastTemplate( _APPLI_INTERFACE_HTML_TPL_PATH_ );
$this->_template -> define(
......@@ -534,7 +541,7 @@ class crxHtmlInterface extends crxFramework{
'templateComfirmScreen' => 'confirm_delete_item.htm'
)
);
}
//}
if(isset($_GET['id']))
$id = $_GET['id'];
......@@ -980,23 +987,28 @@ class crxHtmlInterface extends crxFramework{
function DisplayInterface() {
echo $this->ObjInt;
}
function ReturnInterface(){
return $this->ObjInt;
}
/**
*
*/
function returnDisplayFilter($moduleName){
//$_SESSION['explorer'][$moduleName]['display']['order']
//$_SESSION['explorer'][$moduleName]['display']['field']
if(isset($_SESSION['explorer']))
return array(
'ORDERBY'=>$_SESSION['explorer'][$moduleName]['display']['order'],
'FIELD'=>$_SESSION['explorer'][$moduleName]['display']['field']
);
if(isset($_SESSION['explorer'])){
if(
!isset($_SESSION['explorer'][$moduleName]['display']['order'])
|| !isset($_SESSION['explorer'][$moduleName]['display']['field'])
){
return array();
}
return array(
'ORDERBY'=>$_SESSION['explorer'][$moduleName]['display']['order'],
'FIELD'=>$_SESSION['explorer'][$moduleName]['display']['field']
);
}
}
......@@ -1183,9 +1195,9 @@ class crxHtmlInterface extends crxFramework{
$visible=true,
$id=null
){
$this->ico = $this->loadIco();
if($type=='info') $ico = $this->ico[32]['messagebox_info'];
$ico = '';
//$this->ico = $this->loadIco();
//if($type=='info') $ico = $this->ico[32]['messagebox_info'];
$html_mess_box = "<div class='quoteText'>".$ico.$mess."</div>";
return $html_mess_box;
}
......
......@@ -3,19 +3,21 @@
CRX-FRAMEWORK
* @author Bastien Barbe
* @date 01/01/2005
* @revision 28/04/2019
* @revision 01/05/2019
* @lib webapp
* @version 1.5.3
* @version 1.5.3-1
*/
namespace crx;
class crxDataSource extends crxSchema{
var $_autoFlushQuerie = 0;
var $ERROR = '';
var $_autoFlushQuerie = 0;
var $_force_insert_with_pk_field_set = 0;
var $_debugProcess = 0;
var $_debugProcess = 0;
#This method generate SQL code from PHP class objet.
#It call by objet class via method installSchema ()
......@@ -33,14 +35,16 @@ class crxDataSource extends crxSchema{
}
*/
function getExecSqlError(){
return $this->ERROR;
}
function secureStr($str){
return $this->dbi -> secureStr($str);
}
//mysql_real_escape_string($string, $connection
......@@ -1010,7 +1014,6 @@ class crxDataSource extends crxSchema{
if($sqlRequest<>NULL && $this->_autoFlushQuerie == 1){
$this->flush();
}
if($this->_debug_queries_inside_file){
......@@ -1020,9 +1023,6 @@ class crxDataSource extends crxSchema{
$content_log.=$this->query.$sqlRequest."\n";
crxFile::setFileContent($log_db_file,$content_log);
}
//Request is set via method param
//!isset($this->query) &&
......@@ -1033,10 +1033,12 @@ class crxDataSource extends crxSchema{
//If query is set via the method formatSqlQuery...
if(isset($this->query) && !empty($this->query)){
//print_r($this->strace());
$rst=$this->dbi -> execSql($this->query);
return $this->dbi -> execSql($this->query);
if(!$rst)$this->ERROR=$this->dbi -> error;
return $rst;
}
else{
......@@ -1351,10 +1353,7 @@ class crxDataSource extends crxSchema{
){
if(!isset($display['filter_operator']))$display['filter_operator']='=';
$append_sql_where = ' WHERE '.$sys_tag.''.$display['filter_key'].''.$sys_tag.' '
. $display['filter_operator'].' "'
. $display['filter_key_value'].'"';
$append_sql_where = ' WHERE '.$sys_tag.''.$display['filter_key'].''.$sys_tag.' '. $display['filter_operator'].' "'. $display['filter_key_value'].'"';
}
//else $append_sql_where = NULL;
......
<?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 16/03/2010
* @module data
* @copyright see header
* @version 1.1.20090425
*/
namespace crx;
class dboStoreObjects{
var $_objects = array();
......@@ -34,9 +19,6 @@ class dboStoreObjects{
}
//Shortcut :
function selectAndInitObject($objet_type,$object_id,&$return_object,$object_parameters_initialisation=null){
......
......@@ -475,9 +475,14 @@ class crxFile{
$this->src_w = $this->size[0];
$this->src_h = $this->size[1];
$this->test_h = round(($this->dst_w / $this->src_w) * $this->src_h); //Check if size of picture is correct for the page
if(!isset($this->dst_h)){
$this->dst_h=null;
}
$this->test_w = round(($this->dst_h / $this->src_h) * $this->src_w);
if(!$this->dst_h) $this->dst_h = $this->test_h; // If height is not set
if($this->dst_h==null) $this->dst_h = $this->test_h; // If height is not set
elseif(!$this->dst_w) $this->dst_w = $this->test_w; // Else if width is not set
elseif($this->test_h > $this->dst_h) $this->dst_w = $this->test_w; // Else we test if resize is correct
else $this->dst_h = $this->test_h;
......@@ -621,7 +626,7 @@ class crxFile{
}
function rmDir2($dir){
static function rmDir2($dir){
if(!is_dir($dir))
return false;
for($s = DIRECTORY_SEPARATOR, $stack = array($dir), $emptyDirs = array($dir); $dir = array_pop($stack);){
......
......@@ -68,7 +68,11 @@ class crxUploadFiles extends crxFramework{
function retreiveFileTypeFromExt($ext){
return $this->tableFilesFormat[strtolower($ext)];
$f=strtolower($ext);
if($f=='')return;
return $this->tableFilesFormat[$f];
}
......
......@@ -2,9 +2,9 @@
/**
* @author Bastien Barbe
* @date 03/2017
* @update 28/04/2019
* @update 02/05/2019
* @copyright see header
* @version 0.7.2
* @version 0.7.2-2
*/
/*
......@@ -514,7 +514,7 @@ namespace crx;
$oid = $this->itemsProperties[0][$this->_pk_name];
$this->c_db->formatSqlQuery($data,$this->_table,'DELETE',array($this->_pk_name=>$oid));
$this->c_db->formatSqlQuery(array(),$this->_table,'DELETE',array($this->_pk_name=>$oid));
return $this->c_db->execSql();
......
......@@ -541,6 +541,10 @@ static function convlocator($locator) {
function DisplayDistance(){
//if($this->Distance==0){return 0;}
if(!isset($this->ArraySourceLocator))return 0;
return $this->distance($this->ArraySourceLocator,$this->ArrayDestinationLocator);
}
......
<?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 22/08/2009
* @revision 01/05/2019
* @module htmlInterface
* @copyright see header
* @version 1.1.20090822
* @version 1.2
*/
namespace crx;
class crxCommentInterface
extends crxHtmlInterface{
var $widgetsData=NULL;
var $_debug = false;
var $widgetsData = null;
var $_enableHtmlCache = true;
var $_enableHtmlCache = true;
var $htmlOutput = NULL;
var $htmlOutput = null;
var $_table_comments = 'comments';
......@@ -212,6 +199,9 @@ extends crxHtmlInterface{
$this->htmlGen -> createHtmlForm();
if(!isset($this->widget['content']))$this->widget['content']='';
if(!isset($this->widget['title']))$this->widget['title']='';
/* Comment title */
$this->htmlGen -> appendFormLine(
$this->lng('LNG_TITLE'),
......@@ -229,6 +219,8 @@ extends crxHtmlInterface{
}
/* Comment Content */
$this->htmlGen -> appendFormLine(
$this->lng('COMMENT'),
......@@ -254,7 +246,7 @@ extends crxHtmlInterface{
$comments=$this->showComments();
$this->htmlGen->windowIco = $this->windowIco;
if(isset($this->windowIco))$this->htmlGen->windowIco = $this->windowIco;
$this->htmlGen->windowTitle = $this->windowTitle;
$this->htmlGen->windowContent = $comments.$htmlForm;
......
......@@ -91,6 +91,7 @@ class crxView extends crxHtmlInterface{
break;
case 'datagrid.ico';
$this->ico[16]['userItem'] = $this->ico[16]['personal'];
$this->datagrid -> window['ico'] = $this->ico[16][(string)$opt->value];
break;
......
......@@ -148,47 +148,33 @@ class datagrid extends crxHtmlInterface{
function initNavigationCursors($options=NULL){
$this->_QUERY_options=$options;
if(!$this->cursorsValues[$this->name]){
$nb_items=$this->countNumberOfItems($options);
if(!$nb_items)
$nb_items=$this->nbItemPages;
$this->nb_pages=(int)@ceil($nb_items/$this->nbItemPages);
$this->cursorsValues[$this->name]=array(
'go_value' => 0,
'number_of_items' => $nb_items,
'numberOfPage' => $this->nb_pages
);
}
$this->sqlFilter=$this->returnDisplayFilter($this->moduleName);
$this->sqlFilter=$this->returnDisplayFilter($this->moduleName);
if(!isset($this->sqlFilter['ORDERBY']))
$this->sqlFilter['ORDERBY']='DESC';
$this->sqlFilter['ORDERBY']='DESC';
if(!isset($this->sqlFilter['FIELD'])){
if(isset($this->defaultFieldOrderBy)){
$this->sqlFilter['FIELD'] = $this->defaultFieldOrderBy;
}
else{
//It take the first field of the table schema for the order by
if(isset($this->dataShema))
$this->sqlFilter['FIELD']=$this->dataShema[0];
}
}
$this->cursor['start'] = $this->cursorsValues[$this->name]['go_value'] * $this->nbItemPages;
$this->cursor['end'] = $this->nbItemPages;
......@@ -475,9 +461,6 @@ class datagrid extends crxHtmlInterface{
$this->cursorsValues[$this->name]['numberOfPage']<>1 && $this->navigationBar){
/*
$this->name
$this->cursorsValues
......@@ -487,7 +470,6 @@ class datagrid extends crxHtmlInterface{
//Default is button's navigation : // buttonsClassic mode
if(!isset($this->_dataGridOptions['navigationWidget']) || $this->_dataGridOptions['navigationWidget'] == 'buttonsClassic'){
$bf=$do='';
if(isset($this->_dataGridOptions['navigationWidgetHtmlAfter']))$do=$this->_dataGridOptions['navigationWidgetHtmlAfter'];
if(isset($this->_dataGridOptions['navigationWidgetHtmlBefore']))$bf=$this->_dataGridOptions['navigationWidgetHtmlBefore'];
......@@ -495,16 +477,9 @@ class datagrid extends crxHtmlInterface{
}
// textPages mode
else{
return $this->_dataGridOptions['navigationWidgetHtmlBefore'].
$this->widgetTextNavigationMultipages()."".
$this->_dataGridOptions['navigationWidgetHtmlAfter'];
return $this->_dataGridOptions['navigationWidgetHtmlBefore'].$this->widgetTextNavigationMultipages().$this->_dataGridOptions['navigationWidgetHtmlAfter'];
}
}
}
function navigationHttpListener(){
......@@ -593,7 +568,6 @@ class datagrid extends crxHtmlInterface{
'limitFields' => $limit
);
//If QUERY Options are set it will merge key + options
$keys=array();
......
......@@ -3,9 +3,9 @@
* CRX-PHP-FRAMEWORK http://git.crx.cloud/crx-php/crx-framework
* @author Bastien Barbe
* @date 01/01/2005
* @revision 24/04/2019
* @revision 01/05/2019
* @module htmlInterface
* @version 1.2.1
* @version 1.2.1-2