Task #0001869: Session key : clef de session

This commit is contained in:
Dany wm De Bontridder 2020-12-22 20:32:34 +01:00 committed by sparkyx
parent df45c20cf8
commit 1f458a4f01
45 changed files with 149 additions and 143 deletions

View file

@ -56,7 +56,7 @@ if (isset($_REQUEST['plugin_code']) )
if ( $ext->search($_REQUEST['plugin_code']) != -1)
{
/* security */
if ( !isset ($_SESSION['g_user']) || $ext->can_request($_SESSION['g_user']) == 0 )
if ( !isset ($_SESSION[SESSION_KEY.'g_user']) || $ext->can_request($_SESSION[SESSION_KEY.'g_user']) == 0 )
{
exit();
}

View file

@ -42,7 +42,7 @@ if ( ! isset($_REQUEST['gDossier']))
redirect('user_login.php');
exit();
}
if ( ! isset ($_SESSION['g_theme']))
if ( ! isset ($_SESSION[SESSION_KEY.'g_theme']))
{
echo "<h2>"._('Vous êtes déconnecté')."</h2>";
$backurl=$_SERVER['REQUEST_URI'];
@ -68,7 +68,7 @@ if ( ! $cn->exist_table('version')) {
return;
}
$style_user=$http->post("style_user","string",$_SESSION['g_theme']);
$style_user=$http->post("style_user","string",$_SESSION[SESSION_KEY.'g_theme']);
html_page_start($style_user);
if ( DEBUG ) {

View file

@ -45,7 +45,7 @@ $ext=new Extension($cn);
if ( $ext->search($http->request("plugin_code")) != -1 )
{
/* security */
if ( !isset ($_SESSION['g_user']) || $ext->can_request($_SESSION['g_user']) == 0 )
if ( !isset ($_SESSION[SESSION_KEY.'g_user']) || $ext->can_request($_SESSION[SESSION_KEY.'g_user']) == 0 )
{
exit();
}

View file

@ -56,7 +56,7 @@ $fTva_id=$hi->request("t","string","none");
$fPrice_sale=$hi->request("p","string","none");
$fPrice_purchase=$hi->request("b","string","none");
if ( isset($_SESSION['isValid']) && $_SESSION['isValid'] == 1)
if ( isset($_SESSION[SESSION_KEY.'isValid']) && $_SESSION[SESSION_KEY.'isValid'] == 1)
{
$jrn=$hi->get('j', "number",'-1');
$d=$hi->get('d',"string", '');

View file

@ -145,7 +145,7 @@ load_all_script();
echo '<div id="info_div"></div>';
if ( $_GET['lang'] == "en_US.utf8" || $_GET['lang']=='fr_FR.utf8')
{
$_SESSION['g_lang']=$_GET['lang'];
$_SESSION[SESSION_KEY.'g_lang']=$_GET['lang'];
set_language();
}
?>

View file

@ -39,8 +39,8 @@ if ( isset ($_POST["p_user"] ) )
{
$g_user=strtolower(sql_string($_POST["p_user"]));
$g_pass=$_POST["p_pass"];
$_SESSION['g_user']=$g_user;
$_SESSION['g_pass']=$g_pass;
$_SESSION[SESSION_KEY.'g_user']=$g_user;
$_SESSION[SESSION_KEY.'g_pass']=$g_pass;

View file

@ -32,7 +32,7 @@ $http=new HttpInput();
/*
* Check if the user is still connected
*/
if ( ! isset ($_SESSION['g_user'] ) )
if ( ! isset ($_SESSION[SESSION_KEY.'g_user'] ) )
{
echo "<h2>"._('Vous êtes déconnecté')."</h2>";
$backurl=$_SERVER['REQUEST_URI'];
@ -42,7 +42,7 @@ if ( ! isset ($_SESSION['g_user'] ) )
}
html_page_start($_SESSION['g_theme']);
html_page_start($_SESSION[SESSION_KEY.'g_theme']);
echo '<div style="float:left;">';
?>
<script>

View file

@ -28,13 +28,13 @@ require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_ledger_search.class.php';
require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
if ( ! isset ($_SESSION['g_theme']))
if ( ! isset ($_SESSION[SESSION_KEY.'g_theme']))
{
echo "<h2>"._('Vous êtes déconnecté')."</h2>";
die();
}
html_page_start($_SESSION['g_theme']);
html_page_start($_SESSION[SESSION_KEY.'g_theme']);
load_all_script();
@ -101,7 +101,7 @@ if ( isset ($_GET['viewsearch']))
{
// Navigation bar
$step=$_SESSION['g_pagesize'];
$step=$_SESSION[SESSION_KEY.'g_pagesize'];
$page=$http->get("page","number",1);
$offset=$http->get("offset","number",0);

View file

@ -29,7 +29,7 @@ require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php';
@html_page_start($_SESSION['g_theme']);
@html_page_start($_SESSION[SESSION_KEY.'g_theme']);
$rep=new Database();
require_once NOALYSS_INCLUDE.'/class/user.class.php';
$User=new User($rep);

View file

@ -60,7 +60,7 @@ if ( $action== 'backup') {
require_once NOALYSS_INCLUDE."/backup.inc.php";
exit();
}
html_page_start($_SESSION['g_theme']);
html_page_start($_SESSION[SESSION_KEY.'g_theme']);
load_all_script();
echo '<H2 class="info"> '._('Administration').'</H2>';
echo '<div class="topmenu">';

View file

@ -36,7 +36,7 @@ $div=$http->request('div');
mb_internal_encoding("UTF-8");
$http=new HttpInput();
/**
*if $_SESSION['g_user'] is not set : echo a warning
*if $_SESSION[SESSION_KEY.'g_user'] is not set : echo a warning
*/
/* security */
if ( $g_user->check_dossier(dossier::id(),true) == 'X' ) exit();

View file

@ -66,7 +66,7 @@ catch (Exception $exc)
}
/**
*if $_SESSION['g_user'] is not set : echo a warning
*if $_SESSION[SESSION_KEY.'g_user'] is not set : echo a warning
*/
$cn=Dossier::connect();
@ -224,7 +224,7 @@ case 'file':
$obj=$op->get_quant(); /* return an obj. ACH / FIN or VEN or null if nothing is found*/
$repo = new Database();
$theme = $repo->get_value("select the_filestyle from theme where the_name=$1", array($_SESSION['g_theme']));
$theme = $repo->get_value("select the_filestyle from theme where the_name=$1", array($_SESSION[SESSION_KEY.'g_theme']));
html_min_page_start($theme);
// if there is a receipt document
@ -317,7 +317,7 @@ case 'loadfile':
echo "<html><head>";
$repo=new Database();
$theme=$repo->get_value("select the_filestyle from theme where the_name=$1",array($_SESSION['g_theme']));
$theme=$repo->get_value("select the_filestyle from theme where the_name=$1",array($_SESSION[SESSION_KEY.'g_theme']));
echo " <LINK REL=\"stylesheet\" type=\"text/css\" href=\"$theme\" media=\"screen\">";
echo "</head>";
if ( ! isset($_REQUEST['ajax']) ) echo "<body class=\"op_detail_frame\">"; else echo "<body>";
@ -347,7 +347,7 @@ case 'rmf':
{
echo "<html><head>";
$repo=new Database();
$theme=$repo->get_value("select the_filestyle from theme where the_name=$1",array($_SESSION['g_theme']));
$theme=$repo->get_value("select the_filestyle from theme where the_name=$1",array($_SESSION[SESSION_KEY.'g_theme']));
echo " <LINK REL=\"stylesheet\" type=\"text/css\" href=\"$theme\" media=\"screen\">";
echo "</head><body class=\"op_detail_frame\">";
echo "<h2>"._("Document")."</h2>";

View file

@ -34,7 +34,7 @@ $sql="
where user_name=$1
order by 2 ";
$a_menu=$cn->get_array($sql,array($_SESSION['g_user']));
$a_menu=$cn->get_array($sql,array($_SESSION[SESSION_KEY.'g_user']));
?>
<div class="content">

View file

@ -59,7 +59,7 @@ if (isset($_REQUEST['gDossier']) && $http->request("gDossier","number",0) != 0 )
$style->value = $repo->make_array("select the_name,the_name
from theme
order by the_name");
$style->selected =$_SESSION['g_theme'];
$style->selected =$_SESSION[SESSION_KEY.'g_theme'];
//----------------------------------------------------------------------------------------------
// Display the form
@ -164,8 +164,8 @@ if ( $action == 'display_form' )
<option value="200">200
<option value="-1"><?php echo _('Illimité');?>
<?php
$label = ($_SESSION['g_pagesize'] == -1) ? _('Illimité') : $_SESSION['g_pagesize'];
echo '<option value="' . $_SESSION['g_pagesize'] . '" selected>' . $label;
$label = ($_SESSION[SESSION_KEY.'g_pagesize'] == -1) ? _('Illimité') : $_SESSION[SESSION_KEY.'g_pagesize'];
echo '<option value="' . $_SESSION[SESSION_KEY.'g_pagesize'] . '" selected>' . $label;
?>
</SELECT>
@ -180,7 +180,7 @@ if ( $action == 'display_form' )
<legend><?=_("Format Export CSV")?></legend>
<p>
<?php
if ( $_SESSION['csv_fieldsep']==1 && $_SESSION['csv_decimal']==1)
if ( $_SESSION[SESSION_KEY.'csv_fieldsep']==1 && $_SESSION[SESSION_KEY.'csv_decimal']==1)
{
echo_warning(_("N'utilisez pas le même séparateur pour les champs et les décimales"));
}
@ -198,7 +198,7 @@ if ( $action == 'display_form' )
["label"=>_("Point-virgule"),"value"=>0],
["label"=>_("virgule"),"value"=>1]
];
$csv_fieldsep->selected=$_SESSION['csv_fieldsep'];
$csv_fieldsep->selected=$_SESSION[SESSION_KEY.'csv_fieldsep'];
echo $csv_fieldsep->input();
?>
</td>
@ -214,7 +214,7 @@ if ( $action == 'display_form' )
["label"=>_("point"),"value"=>0],
["label"=>_("virgule"),"value"=>1]
];
$csv_decimal->selected=$_SESSION['csv_decimal'];
$csv_decimal->selected=$_SESSION[SESSION_KEY.'csv_decimal'];
echo $csv_decimal->input();
?>
</td>
@ -230,7 +230,7 @@ if ( $action == 'display_form' )
["label"=>_("utf8"),"value"=>'utf8'],
["label"=>_("latin1"),"value"=>'latin1']
];
$csv_encoding->selected=$_SESSION['csv_encoding'];
$csv_encoding->selected=$_SESSION[SESSION_KEY.'csv_encoding'];
echo $csv_encoding->input();
?>
</td>
@ -268,7 +268,7 @@ if ( $action == 'display_form' )
for ($i = 0; $i < count($aLang); $i++)
{
$sel = "";
if ($aLang[$i][1] == $_SESSION['g_lang'])
if ($aLang[$i][1] == $_SESSION[SESSION_KEY.'g_lang'])
$sel = " selected ";
printf('<option value="%s" %s>%s</option>', $aLang[$i][1], $sel, $aLang[$i][0]);
}
@ -324,9 +324,9 @@ if ($action == 'save')
$g_user->save_global_preference('csv_encoding', $csv_encoding);
$g_user->save_email($p_email);
$_SESSION['g_theme']=$style_user;
$_SESSION['g_pagesize']=$p_size;
$_SESSION['g_lang']=$lang;
$_SESSION[SESSION_KEY.'g_theme']=$style_user;
$_SESSION[SESSION_KEY.'g_pagesize']=$p_size;
$_SESSION[SESSION_KEY.'g_lang']=$lang;
// find the right CSS theme
$style= $repo->get_value("select the_filestyle from theme

View file

@ -102,7 +102,7 @@ if ($ac == 'save')
if ($id <> 0 ) { $todo->load(); }
else
{
$todo->set_parameter("owner", $_SESSION['g_user']);
$todo->set_parameter("owner", $_SESSION[SESSION_KEY.'g_user']);
}
$todo->set_parameter("date",$http->post("p_date_todo","string", ""));
@ -111,7 +111,7 @@ if ($ac == 'save')
$todo->set_is_public($http->post("p_public", "string","N"));
ob_start();
if ( $todo->get_parameter('owner') == $_SESSION['g_user'] ) $todo->save();
if ( $todo->get_parameter('owner') == $_SESSION[SESSION_KEY.'g_user'] ) $todo->save();
ob_end_clean();
$dom=new DOMDocument('1.0','UTF-8');

View file

@ -2016,8 +2016,8 @@ class Acc_Ledger extends jrn_def_sql
echo Acc_Reconciliation::$javascript;
html_page_start();
$cn=Dossier::connect();
$_SESSION['g_user']=NOALYSS_ADMINISTRATOR;
$_SESSION['g_pass']='phpcompta';
$_SESSION[SESSION_KEY.'g_user']=NOALYSS_ADMINISTRATOR;
$_SESSION[SESSION_KEY.'g_pass']='phpcompta';
$id=(isset($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1;
$a=new Acc_Ledger($cn, $id);
@ -2109,8 +2109,8 @@ class Acc_Ledger extends jrn_def_sql
html_page_start();
$cn=Dossier::connect();
$ledger=new Acc_Ledger($cn, 0);
$_SESSION['g_user']=NOALYSS_ADMINISTRATOR;
$_SESSION['g_pass']='phpcompta';
$_SESSION[SESSION_KEY.'g_user']=NOALYSS_ADMINISTRATOR;
$_SESSION[SESSION_KEY.'g_pass']='phpcompta';
echo $ledger->search_form('ALL');
}
///////////////////////////////////////////////////////////////////////////

View file

@ -1788,7 +1788,7 @@ EOF;
// Show list of unpaid sell
// Date - date of payment - Customer - amount
// Nav. bar
$step=$_SESSION['g_pagesize'];
$step=$_SESSION[SESSION_KEY.'g_pagesize'];
$page=(isset($_GET['offset']))?$_GET['page']:1;
$offset=(isset($_GET['offset']))?$_GET['offset']:0;

View file

@ -639,7 +639,7 @@ class Acc_Ledger_Search
$fil_sec=$and." jr_def_id in ( select uj_jrn_id ".
" from user_sec_jrn where ".
" uj_login='".sql_string($_SESSION['g_user'])."'".
" uj_login='".sql_string($_SESSION[SESSION_KEY.'g_user'])."'".
" and uj_priv in ('R','W'))";
}
$where=$fil_ledger.$fil_amount.$fil_date.$fil_desc.$fil_sec.$fil_amount.
@ -712,7 +712,7 @@ class Acc_Ledger_Search
// Count nb of line
$max_line=$cn->count_sql($sql);
$step=$_SESSION['g_pagesize'];
$step=$_SESSION[SESSION_KEY.'g_pagesize'];
$page=(isset($_GET['offset']))?$_GET['page']:1;
$offset=(isset($_GET['offset']))?$_GET['offset']:0;
// create the nav. bar
@ -738,8 +738,8 @@ class Acc_Ledger_Search
$gDossier=dossier::id();
$amount_paid=0.0;
$amount_unpaid=0.0;
$limit=($_SESSION['g_pagesize']!=-1)?" LIMIT ".$_SESSION['g_pagesize']:"";
$offset=($_SESSION['g_pagesize']!=-1)?" OFFSET ".Database::escape_string($offset):"";
$limit=($_SESSION[SESSION_KEY.'g_pagesize']!=-1)?" LIMIT ".$_SESSION[SESSION_KEY.'g_pagesize']:"";
$offset=($_SESSION[SESSION_KEY.'g_pagesize']!=-1)?" OFFSET ".Database::escape_string($offset):"";
$order=" order by jr_date_order asc,jr_internal asc";
// Sort
$url="?".CleanUrl();
@ -1011,7 +1011,7 @@ class Acc_Ledger_Search
// Count nb of line
$max_line=$this->cn->count_sql($sql);
$step=$_SESSION['g_pagesize'];
$step=$_SESSION[SESSION_KEY.'g_pagesize'];
$page=(isset($_GET['offset']))?$_GET['page']:1;
$offset=(isset($_GET['offset']))?$_GET['offset']:0;
// create the nav. bar

View file

@ -56,7 +56,7 @@ class Acc_Operation
global $g_user;
$this->db=$p_cn;
$this->qcode="";
$this->user=$_SESSION['g_user'];
$this->user=$_SESSION[SESSION_KEY.'g_user'];
$this->periode=$g_user->get_periode();
$this->jr_id=0;
$this->jr_optype="NOR";
@ -700,8 +700,8 @@ class Acc_Operation
}
static function test_me()
{
$_SESSION['g_user']=NOALYSS_ADMINISTRATOR;
$_SESSION['g_pass']='dany';
$_SESSION[SESSION_KEY.'g_user']=NOALYSS_ADMINISTRATOR;
$_SESSION[SESSION_KEY.'g_pass']='dany';
global $g_user;
$cn=Dossier::connect();
$g_user=new User($cn);

View file

@ -274,7 +274,7 @@ class Anc_Operation
return _("Pas d'enregistrement trouvé");
// navigation_bar
$step=$_SESSION['g_pagesize'];
$step=$_SESSION[SESSION_KEY.'g_pagesize'];
$page=(isset($_GET['offset']))?$_GET['page']:1;
$offset=(isset($_GET['offset']))?$_GET['offset']:0;
$bar=navigation_bar($offset+1,count($array),$step,$page);

View file

@ -129,7 +129,7 @@ class Calendar
" to_char(tl_date,'MM')::integer=$1 ".
" and to_char(tl_date,'YYYY')::integer=$2 ".
" and use_login=$3 group by to_char(tl_date,'DD')::integer ";
$array=$cn->get_array($sql,array($this->month,$this->year,$_SESSION['g_user']));
$array=$cn->get_array($sql,array($this->month,$this->year,$_SESSION[SESSION_KEY.'g_user']));
for ($i=0;$i<count($array);$i++)
{
$ind=$array[$i]['tl_date_day'];
@ -143,7 +143,7 @@ class Calendar
" to_char(tl_date,'MM')::integer=$1 ".
" and to_char(tl_date,'YYYY')::integer=$2 ".
" and use_login=$3 ";
$array=$cn->get_array($sql,array($this->month,$this->year,$_SESSION['g_user']));
$array=$cn->get_array($sql,array($this->month,$this->year,$_SESSION[SESSION_KEY.'g_user']));
for ($i=0;$i<count($array);$i++)
{
$ind=$array[$i]['tl_date_day'];

View file

@ -63,7 +63,7 @@ class contact extends Fiche
// Get offset and page variable
$offset=( isset ($_REQUEST['offset'] )) ?$_REQUEST['offset']:0;
$page=(isset($_REQUEST['page']))?$_REQUEST['page']:1;
$bar=navigation_bar($offset,$all_contact,$_SESSION['g_pagesize'],$page);
$bar=navigation_bar($offset,$all_contact,$_SESSION[SESSION_KEY.'g_pagesize'],$page);
// set a filter ?
$search="";
if ( trim($p_search) != "" )

View file

@ -822,7 +822,7 @@ class Document
break;
case 'USER' :
return $_SESSION['use_name'].', '.$_SESSION['use_first_name'];
return $_SESSION[SESSION_KEY.'use_name'].', '.$_SESSION[SESSION_KEY.'use_first_name'];
break;
case 'REFERENCE':

View file

@ -97,7 +97,7 @@ class Extension extends Menu_Ref_sql
" menu_ref join profile_menu using (me_code)
join profile_user using (p_id) where ".
" user_name=$1 and me_type='PL' ORDER BY ME_MENU";
$a=$cn->get_array($sql, array($_SESSION['g_user']));
$a=$cn->get_array($sql, array($_SESSION[SESSION_KEY.'g_user']));
return $a;
}

View file

@ -303,7 +303,7 @@ class Fiche
}
else
{
$limit=($_SESSION['g_pagesize']!=-1)?"limit ".$_SESSION['g_pagesize']:"";
$limit=($_SESSION[SESSION_KEY.'g_pagesize']!=-1)?"limit ".$_SESSION[SESSION_KEY.'g_pagesize']:"";
$sql="select *
from
fiche join fiche_Def using (fd_id) join vw_fiche_name using(f_id)
@ -1776,7 +1776,7 @@ class Fiche
// Get offset and page variable
$offset=( isset ($_REQUEST['offset'] )) ?$_REQUEST['offset']:0;
$page=(isset($_REQUEST['page']))?$_REQUEST['page']:1;
$bar=navigation_bar($offset,$all_tiers,$_SESSION['g_pagesize'],$page);
$bar=navigation_bar($offset,$all_tiers,$_SESSION[SESSION_KEY.'g_pagesize'],$page);
// set a filter ?
$search=$p_sql;

View file

@ -324,10 +324,10 @@ $order
where ad_id=1 and fd_id=$1 order by 2";
// we use navigation_bar
if ($step == 1 && $_SESSION['g_pagesize'] != -1 )
if ($step == 1 && $_SESSION[SESSION_KEY.'g_pagesize'] != -1 )
{
$offset=(isset($_GET['offset']))?$_GET['offset']:0;
$step=$_SESSION['g_pagesize'];
$step=$_SESSION[SESSION_KEY.'g_pagesize'];
$sql.=" offset $offset limit $step";
}
@ -370,7 +370,7 @@ $order
$this->get();
echo '<H2 class="info">'.$this->id." ".$this->label.'</H2>';
$step=$_SESSION['g_pagesize'];
$step=$_SESSION[SESSION_KEY.'g_pagesize'];
$sql_limit="";
$sql_offset="";
$bar="";
@ -398,7 +398,7 @@ $order
$str="";
// save the url
// with offet &offset=15&step=15&page=2&size=15
if ( $_SESSION['g_pagesize'] != -1)
if ( $_SESSION[SESSION_KEY.'g_pagesize'] != -1)
{
$str=sprintf("&offset=%s&step=%s&page=%s&size=%s",
$offset,

View file

@ -577,7 +577,7 @@ class Follow_Up
$this->ag_dest, /* 7 */
$this->ag_hour, /* 8 */
$this->ag_priority, /* 9 */
$_SESSION['g_user'], /* 10 */
$_SESSION[SESSION_KEY.'g_user'], /* 10 */
$contact->id, /* 11 */
$this->ag_state, /* 12 */
$this->ag_remind_date /* 13 */
@ -602,12 +602,12 @@ class Follow_Up
if (trim($this->ag_comment)!='' && Document_Option::can_add_comment($this->ag_id))
{
$this->db->exec_sql("insert into action_gestion_comment (ag_id,tech_user,agc_comment) values ($1,$2,$3)"
, array($this->ag_id, $_SESSION['g_user'], $this->ag_comment));
, array($this->ag_id, $_SESSION[SESSION_KEY.'g_user'], $this->ag_comment));
}
if (trim($this->ag_description)!='' && Document_Option::can_add_comment($this->ag_id))
{
$this->db->exec_sql("insert into action_gestion_comment (ag_id,tech_user,agc_comment) values ($1,$2,$3)"
, array($this->ag_id, $_SESSION['g_user'], $this->ag_description));
, array($this->ag_id, $_SESSION[SESSION_KEY.'g_user'], $this->ag_description));
}
$this->insert_operation();
$this->insert_action();
@ -672,7 +672,7 @@ class Follow_Up
join document_state on (ag_state=s_id)
where $p_filter_doc $p_search $sort";
$max_line=$this->db->count_sql($sql);
$step=$_SESSION['g_pagesize'];
$step=$_SESSION[SESSION_KEY.'g_pagesize'];
$page=(isset($_GET['offset']))?$_GET['page']:1;
$offset=(isset($_GET['offset']))?Database::escape_string($_GET['offset']):0;
if ($step!=-1)
@ -925,12 +925,12 @@ class Follow_Up
if (trim($this->ag_comment)!='')
{
$this->db->exec_sql("insert into action_gestion_comment (ag_id,tech_user,agc_comment) values ($1,$2,$3)"
, array($this->ag_id, $_SESSION['g_user'], $this->ag_comment));
, array($this->ag_id, $_SESSION[SESSION_KEY.'g_user'], $this->ag_comment));
}
if (trim($this->ag_description)!='')
{
$this->db->exec_sql("insert into action_gestion_comment (ag_id,tech_user,agc_comment) values ($1,$2,$3)"
, array($this->ag_id, $_SESSION['g_user'], $this->ag_description));
, array($this->ag_id, $_SESSION[SESSION_KEY.'g_user'], $this->ag_description));
}
$this->insert_operation();
$this->insert_action();
@ -1355,11 +1355,11 @@ class Follow_Up
{
$action_query.= " and ((ag_dest = ".sql_string($p_array['ag_dest_query'])." and ".self::sql_security_filter($cn, "R").") or ".
"(ag_dest = ".sql_string($p_array['ag_dest_query'])." and ".self::sql_security_filter($cn, "R")." and ".
" ag_owner='".$_SESSION['g_user']."'))";
" ag_owner='".$_SESSION[SESSION_KEY.'g_user']."'))";
}
else
{
$action_query .=" and (ag_owner='".$_SESSION['g_user']."' or ".self::sql_security_filter($cn, "R")." or ag_dest=-1 )";
$action_query .=" and (ag_owner='".$_SESSION[SESSION_KEY.'g_user']."' or ".self::sql_security_filter($cn, "R")." or ag_dest=-1 )";
}
@ -1744,7 +1744,7 @@ class Follow_Up
$ag_ref, /* 6 */
$this->ag_dest, /* 7 */
$this->ag_priority, /* 8 */
$_SESSION['g_user'], /* 9 */
$_SESSION[SESSION_KEY.'g_user'], /* 9 */
$this->ag_state, /* 10 */
$this->ag_remind_date, /* 11 */
$this->ag_hour /* 12 */
@ -1754,7 +1754,7 @@ class Follow_Up
if (trim($this->ag_comment)!='')
{
$this->db->exec_sql("insert into action_gestion_comment (ag_id,tech_user,agc_comment) values ($1,$2,$3)"
, array($this->ag_id, $_SESSION['g_user'], $this->ag_comment));
, array($this->ag_id, $_SESSION[SESSION_KEY.'g_user'], $this->ag_comment));
}
}
/**

View file

@ -55,7 +55,7 @@ class Stock extends Stock_Sql
$order = (isset($p_array['ord'])) ? $p_array['ord'] : 'da';
$sql.=$tb->get_sql_order($order);
$step = $_SESSION['g_pagesize'];
$step = $_SESSION[SESSION_KEY.'g_pagesize'];
$page = (isset($_GET['offset'])) ? $_GET['page'] : 1;
$offset = (isset($_GET['offset'])) ? $_GET['offset'] : 0;

View file

@ -126,7 +126,7 @@ class Stock_Goods extends Stock_Goods_Sql
$ch->setp("c_comment", $p_array['p_motif']);
$ch->setp("r_id", $p_array['p_depot']);
$ch->setp("c_date", $p_array['p_date']);
$ch->setp('tech_user', $_SESSION['g_user']);
$ch->setp('tech_user', $_SESSION[SESSION_KEY.'g_user']);
$ch->insert();
$per = new Periode($cn);
$periode = $per->find_periode($p_array['p_date']);
@ -154,7 +154,7 @@ class Stock_Goods extends Stock_Goods_Sql
$a->sg_quantity = abs($p_array['sg_quantity' . $i]);
$a->sg_type = ($p_array['sg_quantity' . $i] > 0) ? 'd' : 'c';
$a->sg_comment = $p_array['p_motif'];
$a->tech_user = $_SESSION['g_user'];
$a->tech_user = $_SESSION[SESSION_KEY.'g_user'];
$a->r_id = $p_array['p_depot'];
$a->sg_exercice = $exercice;
$a->c_id = $ch->c_id;

View file

@ -57,7 +57,7 @@ class Todo_List
$this->cn=$p_init;
$this->tl_id=0;
$this->tl_desc="";
$this->use_login=$_SESSION['g_user'];
$this->use_login=$_SESSION[SESSION_KEY.'g_user'];
$this->is_public="N";
}
@ -228,7 +228,7 @@ class Todo_List
public function delete()
{
global $g_user;
if ( $this->use_login != $_SESSION['g_user'] && $g_user->check_action(SHARENOTEREMOVE)==0) return;
if ( $this->use_login != $_SESSION[SESSION_KEY.'g_user'] && $g_user->check_action(SHARENOTEREMOVE)==0) return;
$sql="delete from todo_list_shared where todo_list_id=$1 ";
$res=$this->cn->exec_sql($sql,array($this->tl_id));
@ -329,11 +329,11 @@ class Todo_List
htmlspecialchars($this->tl_title).
'</a>'.
'</td>';
if ( $this->is_public == 'Y' && $this->use_login != $_SESSION['g_user'] )
if ( $this->is_public == 'Y' && $this->use_login != $_SESSION[SESSION_KEY.'g_user'] )
{ // This is a public note, cannot be removed
$r.= '<td></td>';
}
elseif ($this->use_login == $_SESSION['g_user'] )
elseif ($this->use_login == $_SESSION[SESSION_KEY.'g_user'] )
{
// This a note the user owns
$r.= '<td>'.

View file

@ -53,28 +53,28 @@ class User
// if p_id is not set then check the connected user
if ($p_id == -1)
{
if (!isset($_SESSION['g_user']))
if (!isset($_SESSION[SESSION_KEY.'g_user']))
{
echo '<h2 class="error">' . _('Session expirée<br>Utilisateur déconnecté') . '</h2>';
redirect('index.php', 1);
exit();
}
$this->login =strtolower($_SESSION['g_user']);
$this->pass = $_SESSION['g_pass'];
$this->lang = (isset($_SESSION['g_lang'])) ? $_SESSION['g_lang'] : 'fr_FR.utf8';
$this->valid = (isset($_SESSION['isValid'])) ? 1 : 0;
$this->login =strtolower($_SESSION[SESSION_KEY.'g_user']);
$this->pass = $_SESSION[SESSION_KEY.'g_pass'];
$this->lang = (isset($_SESSION[SESSION_KEY.'g_lang'])) ? $_SESSION[SESSION_KEY.'g_lang'] : 'fr_FR.utf8';
$this->valid = (isset($_SESSION[SESSION_KEY.'isValid'])) ? 1 : 0;
$this->db = $p_cn;
$this->id = -1;
if (isset($_SESSION['g_theme']))
$this->theme = $_SESSION['g_theme'];
if (isset($_SESSION[SESSION_KEY.'g_theme']))
$this->theme = $_SESSION[SESSION_KEY.'g_theme'];
$this->admin = ( isset($_SESSION['use_admin']) ) ? $_SESSION['use_admin'] : 0;
$this->admin = ( isset($_SESSION[SESSION_KEY.'use_admin']) ) ? $_SESSION[SESSION_KEY.'use_admin'] : 0;
if (isset($_SESSION['use_name']))
$this->name = $_SESSION['use_name'];
if (isset($_SESSION['use_first_name']))
$this->first_name = $_SESSION['use_first_name'];
if (isset($_SESSION[SESSION_KEY.'use_name']))
$this->name = $_SESSION[SESSION_KEY.'use_name'];
if (isset($_SESSION[SESSION_KEY.'use_first_name']))
$this->first_name = $_SESSION[SESSION_KEY.'use_first_name'];
$this->load();
}
else // if p_id is set get data of another user
@ -176,21 +176,21 @@ class User
if ($res > 0)
{
$r = Database::fetch_array($ret, 0);
$_SESSION['use_admin'] = $r['use_admin'];
$_SESSION['use_name'] = $r['use_name'];
$_SESSION['use_first_name'] = $r['use_first_name'];
$_SESSION['isValid'] = 1;
$_SESSION[SESSION_KEY.'use_admin'] = $r['use_admin'];
$_SESSION[SESSION_KEY.'use_name'] = $r['use_name'];
$_SESSION[SESSION_KEY.'use_first_name'] = $r['use_first_name'];
$_SESSION[SESSION_KEY.'isValid'] = 1;
$this->admin = $_SESSION['use_admin'];
$this->name = $_SESSION['use_name'];
$this->first_name = $_SESSION['use_first_name'];
$this->admin = $_SESSION[SESSION_KEY.'use_admin'];
$this->name = $_SESSION[SESSION_KEY.'use_name'];
$this->first_name = $_SESSION[SESSION_KEY.'use_first_name'];
$this->load_global_pref();
}
$sql = "insert into audit_connect (ac_user,ac_ip,ac_module,ac_url,ac_state) values ($1,$2,$3,$4,$5)";
if ($res == 0)
{
$cn->exec_sql($sql, array($_SESSION['g_user'], $_SERVER["REMOTE_ADDR"], $from, $_SERVER['REQUEST_URI'], 'FAIL'));
$cn->exec_sql($sql, array($_SESSION[SESSION_KEY.'g_user'], $_SERVER["REMOTE_ADDR"], $from, $_SERVER['REQUEST_URI'], 'FAIL'));
if (!$silent)
{
echo '<script> alert(\''._('Utilisateur ou mot de passe incorrect').'\')</script>';
@ -203,7 +203,7 @@ class User
else
{
if ($from == 'LOGIN')
$cn->exec_sql($sql, array($_SESSION['g_user'], $_SERVER["REMOTE_ADDR"], $from, $_SERVER['REQUEST_URI'], 'SUCCESS'));
$cn->exec_sql($sql, array($_SESSION[SESSION_KEY.'g_user'], $_SERVER["REMOTE_ADDR"], $from, $_SERVER['REQUEST_URI'], 'SUCCESS'));
$this->valid = 1;
}
@ -597,7 +597,7 @@ class User
{
$cn = new Database();
$sql = "insert into audit_connect (ac_user,ac_ip,ac_module,ac_url,ac_state) values ($1,$2,$3,$4,$5)";
$cn->exec_sql($sql, array($_SESSION['g_user'], $_SERVER["REMOTE_ADDR"], $p_action_id, $_SERVER['REQUEST_URI'], 'FAIL'));
$cn->exec_sql($sql, array($_SESSION[SESSION_KEY.'g_user'], $_SERVER["REMOTE_ADDR"], $p_action_id, $_SERVER['REQUEST_URI'], 'FAIL'));
}
return 0;
}
@ -654,7 +654,7 @@ class User
$this->load_global_pref();
return;
}
$_SESSION[$name] = $line[$parameter];
$_SESSION[SESSION_KEY.$name] = $line[$parameter];
}
}
@ -1094,7 +1094,7 @@ class User
$sql = "insert into audit_connect (ac_user,ac_ip,ac_module,ac_url,ac_state) values ($1,$2,$3,$4,$5)";
$cn->exec_sql($sql, array(
$_SESSION['g_user'],
$_SESSION[SESSION_KEY.'g_user'],
$_SERVER["REMOTE_ADDR"],
$p_module,
$_SERVER['REQUEST_URI'],
@ -1115,7 +1115,7 @@ class User
$sql = "insert into audit_connect (ac_user,ac_ip,ac_module,ac_url,ac_state) values ($1,$2,$3,$4,$5)";
$cn->exec_sql($sql, array(
$_SESSION['g_user'],
$_SESSION[SESSION_KEY.'g_user'],
$_SERVER["REMOTE_ADDR"],
$p_module,
$_SERVER['REQUEST_URI'],
@ -1293,8 +1293,8 @@ class User
if ($p_pass1 == $p_pass2) {
$repo = new Database();
$l_pass = md5($_POST['pass_1']);
$repo->exec_sql("update ac_users set use_pass=$1 where use_login=$2", array($l_pass, $_SESSION['g_user']));
$_SESSION['g_pass'] = $_POST['pass_1'];
$repo->exec_sql("update ac_users set use_pass=$1 where use_login=$2", array($l_pass, $_SESSION[SESSION_KEY.'g_user']));
$_SESSION[SESSION_KEY.'g_pass'] = $_POST['pass_1'];
} else {
alert(_("Les mots de passe ne correspondent pas. Mot de passe inchangé"));
}
@ -1306,7 +1306,7 @@ class User
function save_email($p_email)
{
$repo=new Database();
$repo->exec_sql("update ac_users set use_email=$1 where use_login=$2", array($p_email, $_SESSION['g_user']));
$repo->exec_sql("update ac_users set use_email=$1 where use_login=$2", array($p_email, $_SESSION[SESSION_KEY.'g_user']));
}
/**
* Remove a user and all his privileges

View file

@ -69,4 +69,6 @@ define ("dbname","");
// In recent distribution linux, pdftk is a snap, you should set the path
// for exporting document in PDF
// $pdftk = /usr/bin/pdftk
// $pdftk = /snap/bin/pdftk
// $pdftk = /snap/bin/pdftk
// Define a random session key if you work with different version of NOALYSS
// define ('SESSION_KEY','abcde');

View file

@ -51,7 +51,9 @@ if ( !defined("FIX_BROKEN_PDF")) define ("FIX_BROKEN_PDF",'NO');
if ( !defined('NOALYSS_ADMINISTRATOR')) {
define ('NOALYSS_ADMINISTRATOR','phpcompta');
}
if (!defined ("SESSION_KEY")) {
define ("SESSION_KEY","RtYu0uu");
}
require_once NOALYSS_INCLUDE.'/constant.security.php';
if ( strpos($inc_path,";") != 0 ) {

View file

@ -14,7 +14,7 @@ require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
require_once NOALYSS_INCLUDE.'/constant.security.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
echo '<div class="topmenu">';
@html_page_start($_SESSION['g_theme']);
@html_page_start($_SESSION[SESSION_KEY.'g_theme']);
$cn=Dossier::connect();
global $g_user;

View file

@ -206,7 +206,7 @@ if ($histo->selected == -1)
// Create nav bar
$max = $cn->get_value("select count(*) from fiche as f " . $cond);
$step = $_SESSION['g_pagesize'];
$step = $_SESSION[SESSION_KEY.'g_pagesize'];
$page = (isset($_GET['offset'])) ? $_GET['page'] : 1;
$offset = (isset($_GET['offset'])) ? $_GET['offset'] : 0;
$bar = navigation_bar($offset, $max, $step, $page);

View file

@ -107,7 +107,7 @@ else
list($sql, $where) = $Ledger->build_search_sql($p_array);
$max_line = $cn->count_sql($sql);
$step = $_SESSION['g_pagesize'];
$step = $_SESSION[SESSION_KEY.'g_pagesize'];
$page = (isset($_GET['offset'])) ? $http->get('page') : 1;
$offset = (isset($_GET['offset'])) ? $http->get('offset') : 0;

View file

@ -344,11 +344,11 @@ function html_page_start($p_theme="", $p_script="", $p_script2="")
echo '<script language="javascript" src="js/calendar.js"></script>
<script type="text/javascript" src="js/lang/calendar-en.js"></script>';
if (isset($_SESSION['g_lang']) && $_SESSION['g_lang']=='fr_FR.utf8' )
if (isset($_SESSION[SESSION_KEY.'g_lang']) && $_SESSION[SESSION_KEY.'g_lang']=='fr_FR.utf8' )
{
echo '<script type="text/javascript" src="js/lang/calendar-fr.js"></script>';
}
if (isset($_SESSION['g_lang']) && $_SESSION['g_lang']=='nl_NL.utf8' )
if (isset($_SESSION[SESSION_KEY.'g_lang']) && $_SESSION[SESSION_KEY.'g_lang']=='nl_NL.utf8' )
{
echo '<script type="text/javascript" src="js/lang/calendar-nl.js"></script>';
}
@ -357,7 +357,7 @@ function html_page_start($p_theme="", $p_script="", $p_script2="")
<LINK REL="stylesheet" type="text/css" href="calendar-blue.css" media="screen">
';
// language
if (isset($_SESSION['g_lang']))
if (isset($_SESSION[SESSION_KEY.'g_lang']))
{
set_language();
}
@ -710,7 +710,7 @@ function set_language()
{
// desactivate local check
if ( defined("LOCALE") && LOCALE==0 ) return;
if ( ! isset ($_SESSION['g_lang'])) return;
if ( ! isset ($_SESSION[SESSION_KEY.'g_lang'])) return;
/*
* If translation is not supported by current
@ -721,12 +721,12 @@ function set_language()
// set differently the language depending of the operating system
if (what_os() == 1)
{
$dir = setlocale(LC_MESSAGES, $_SESSION['g_lang']);
$dir = setlocale(LC_MESSAGES, $_SESSION[SESSION_KEY.'g_lang']);
if ($dir == "")
{
$g_lang = 'fr_FR.utf8';
$dir = setlocale(LC_MESSAGES, $g_lang);
// echo '<span class="notice">' . $_SESSION['g_lang'] . ' domaine non supporté</h2>';
// echo '<span class="notice">' . $_SESSION[SESSION_KEY.'g_lang'] . ' domaine non supporté</h2>';
}
bindtextdomain('messages', NOALYSS_HOME.'/lang');
textdomain('messages');
@ -735,8 +735,8 @@ function set_language()
return;
}
// for windows
putenv('LANG=' . $_SESSION['g_lang']);
$dir = setlocale(LC_ALL, $_SESSION['g_lang']);
putenv('LANG=' . $_SESSION[SESSION_KEY.'g_lang']);
$dir = setlocale(LC_ALL, $_SESSION[SESSION_KEY.'g_lang']);
bindtextdomain('messages', '.\\lang');
textdomain('messages');
bind_textdomain_codeset('messages', 'UTF8');
@ -851,9 +851,9 @@ function format_date($p_date, $p_from_format = 'YYYY-MM-DD',$p_to_format='DD.MM.
function ajax_disconnected($div)
{
/**
* if $_SESSION['g_user'] is not set : echo a warning
* if $_SESSION[SESSION_KEY.'g_user'] is not set : echo a warning
*/
if (!isset($_SESSION['g_user']))
if (!isset($_SESSION[SESSION_KEY.'g_user']))
{
$script = 'var a=$("' . $div . '");a.style.height="70%";a.style.width="60%";';
$script.='a.style.top=posY-20+offsetY;a.style.left=posX+offsetX;';

View file

@ -344,7 +344,7 @@ class ICard extends HtmlInput
static public function test_me()
{
require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
$_SESSION['isValid']=1;
$_SESSION[SESSION_KEY.'isValid']=1;
$a=new ICard('testme');
$a->extra="all";
$a->set_attribute('label', 'ctl_label');

View file

@ -18,16 +18,17 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
// Copyright Author Dany De Bontridder danydb@noalyss.eu
/**
*\file
\brief Html Input
\brief Html Input Date type
*/
/// Html Input : Input a date format dd.mm.yyyy
/// The property title should be set to indicate what it is expected
/// @see calendar-setup.js
require_once NOALYSS_INCLUDE.'/lib/html_input.class.php';
class IDate extends HtmlInput
@ -74,14 +75,15 @@ class IDate extends HtmlInput
</span>
',$this->name,$this->id,$this->value,$this->placeholder,$this->title,$this->id
);
// @see calendar-setup.js
$r.=sprintf('<script type="text/javascript">
Calendar.setup({'.
'inputField : "%s", // id of the input field
ifFormat : "%%d.%%m.%%Y", // format of the input field
button : "%s_trigger", // trigger for the calendar (button ID)
align : "Bl", // alignment (defaults to "Bl")
singleClick : true
'inputField : "%s",
ifFormat : "%%d.%%m.%%Y",
button : "%s_trigger",
align : "Bl",
singleClick : true,
firstDay:0
});
</script>'
,$this->id,$this->id);

View file

@ -46,10 +46,10 @@ class Noalyss_Csv
$this->size=0;
$a_field=[';',','];
$this->sep_field=$a_field[$_SESSION['csv_fieldsep']];
$this->sep_field=$a_field[$_SESSION[SESSION_KEY.'csv_fieldsep']];
$a_field=['.',','];
$this->sep_dec=$a_field[$_SESSION['csv_decimal']];
$this->encoding=$_SESSION['csv_encoding'];
$this->sep_dec=$a_field[$_SESSION[SESSION_KEY.'csv_decimal']];
$this->encoding=$_SESSION[SESSION_KEY.'csv_encoding'];
}

View file

@ -69,7 +69,7 @@ function isValid_deprecrated ($p_cn,$p_grpt_id)
* \param $p_javascript javascript code to add
* \note example :
\verbatim
$step=$_SESSION['g_pagesize'];
$step=$_SESSION[SESSION_KEY.'g_pagesize'];
$page=(isset($_GET['offset']))?$_GET['page']:1;
$offset=(isset($_GET['offset']))?$_GET['offset']:0;
@ -82,10 +82,10 @@ function navigation_bar($p_offset,$p_line,$p_size=0,$p_page=1,$p_javascript="")
{
// if the pagesize is unlimited return ""
// in that case there is no nav. bar
if ( $_SESSION['g_pagesize'] == -1 ) return "";
if ( $_SESSION[SESSION_KEY.'g_pagesize'] == -1 ) return "";
if ( $p_size==0)
{
$p_size= $_SESSION['g_pagesize'];
$p_size= $_SESSION[SESSION_KEY.'g_pagesize'];
}
// if there is no row return an empty string
if ( $p_line == 0 ) return "";

View file

@ -11,14 +11,14 @@
<?php
$http=new HttpInput();
if ( $cn->get_value("select count(*) from profile join profile_user using (p_id)
where user_name=$1 and with_calc=true",array($_SESSION['g_user'])) ==1):
where user_name=$1 and with_calc=true",array($_SESSION[SESSION_KEY.'g_user'])) ==1):
echo '<div id="calc">';
echo IButton::show_calc();
echo '</div>';
endif;
if ( $cn->get_value("select count(*) from profile join profile_user using (p_id)
where user_name=$1 and with_direct_form=true",array($_SESSION['g_user'])) ==1):
where user_name=$1 and with_direct_form=true",array($_SESSION[SESSION_KEY.'g_user'])) ==1):
?>
<div id="direct">
<form method="get">

View file

@ -100,7 +100,7 @@ echo HtmlInput::title_box("Note","todo_list_div".$this->tl_id,'close',$close_sha
<?php echo HtmlInput::hidden('id',$this->tl_id) ?>
<p style='text-align: center'>
<ol style="list-style: none;">
<?php if ($this->use_login == $_SESSION['g_user']) : ?>
<?php if ($this->use_login == $_SESSION[SESSION_KEY.'g_user']) : ?>
<li style="display:inline">
<input type="submit" class="smallbutton" value="<?php echo _('Sauve');?>" onclick="todo_list_save(<?php echo $this->tl_id?>);return false">
</li>

View file

@ -28,7 +28,7 @@ define ("DOSSIER",48);
$_REQUEST['gDossier'] = DOSSIER;
$g_connection=new Database(DOSSIER);
$g_parameter = new Noalyss_Parameter_Folder($g_connection);
$_SESSION['g_user']='phpcompta';
$_SESSION['g_pass']='dany';
$_SESSION['g_pagesize']='50';
$_SESSION[SESSION_KEY.'g_user']='phpcompta';
$_SESSION[SESSION_KEY.'g_pass']='dany';
$_SESSION[SESSION_KEY.'g_pagesize']='50';
$g_user=new User($g_connection);

View file

@ -29,9 +29,9 @@ if (!defined("DOSSIER"))define ("DOSSIER",25);
$_REQUEST['gDossier'] = DOSSIER;
$g_connection=new Database(DOSSIER);
$g_parameter = new Noalyss_Parameter_Folder($g_connection);
$_SESSION['g_user']='admin';
$_SESSION['g_pass']='phpcompta';
$_SESSION['g_pagesize']='50';
$_SESSION[SESSION_KEY.'g_user']='admin';
$_SESSION[SESSION_KEY.'g_pass']='phpcompta';
$_SESSION[SESSION_KEY.'g_pagesize']='50';
$g_user=new User($g_connection);
require_once __DIR__.'/facility.class.php';