remove html/verif.php
add ./makedoc for creating automatically doc add doc/mod_function header for the functions New GetUserProperties to get the user profile -> replace the checkAdmin function
This commit is contained in:
parent
4fdc742c84
commit
b2e485274b
23 changed files with 226 additions and 176 deletions
21
doc/makedoc
Executable file
21
doc/makedoc
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
BASE_DIR=`pwd`
|
||||
|
||||
ext_dir ()
|
||||
{
|
||||
for i in *.php; do
|
||||
( echo $i
|
||||
awk '/\/\* function/,/\*\// {print $0;}' $i
|
||||
) >> $BASE_DIR/function.txt
|
||||
done
|
||||
}
|
||||
|
||||
cd ../html
|
||||
|
||||
ext_dir
|
||||
cd $BASE_DIR
|
||||
|
||||
cd ../include
|
||||
|
||||
ext_dir
|
||||
|
||||
|
||||
|
|
@ -24,15 +24,15 @@ include_once("postgres.php");
|
|||
include_once("debug.php");
|
||||
html_page_start();
|
||||
echo_debug("entering admin_repo");
|
||||
echo_debug("user $user");
|
||||
//echo_debug("user $g_user");
|
||||
|
||||
CheckUser();
|
||||
if (CheckAdmin() != 1) {
|
||||
if ($g_UserProperty['use_admin'] != 1) {
|
||||
html_page_stop();
|
||||
return;
|
||||
}
|
||||
include ("top_menu_compta.php");
|
||||
//ShowMenu(0,"<A class=\"mtitle\" HREF=\"login.php\"> Dossier </A>");
|
||||
|
||||
echo '<H2 style="color:blue;text-align:center"> Administration Globale</H2>';
|
||||
if ( ! isset ($g_dossier) ) $g_dossier=0;
|
||||
ShowMenuAdminGlobalRight($g_dossier);
|
||||
|
|
|
|||
|
|
@ -35,8 +35,9 @@ include_once("preference.php");
|
|||
include_once ("top_menu_compta.php");
|
||||
ShowMenuCompta($g_dossier);
|
||||
ShowMenuComptaRight($g_dossier);
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
$r=CheckAction($g_dossier,$user,CENTRALIZE);
|
||||
|
||||
if ( $g_UserProperty['use_admin']==0 ) {
|
||||
$r=CheckAction($g_dossier,$g_user,CENTRALIZE);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
include ("ac_common.php");
|
||||
/* $Revision$ */
|
||||
session_start();
|
||||
html_page_start();
|
||||
if ( isset ( $dos ) ) {
|
||||
$g_dossier=$dos;
|
||||
|
|
@ -26,24 +27,28 @@ if ( isset ( $dos ) ) {
|
|||
echo_debug("admin_dossier = $g_dossier ");
|
||||
} else {
|
||||
echo "You must choose a Dossier ";
|
||||
phpinfo();
|
||||
// phpinfo();
|
||||
exit -2;
|
||||
}
|
||||
include ("postgres.php");
|
||||
echo_debug ("user is $g_user");
|
||||
/* CheckUser */
|
||||
CheckUser();
|
||||
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
|
||||
echo_debug("theme ".$g_UserProperty['use_theme']);
|
||||
|
||||
if ( $g_UserProperty['use_admin'] == 0 ) {
|
||||
|
||||
$r=GetPriv($g_dossier,$user);
|
||||
$r=GetPriv($g_dossier,$g_user);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
}
|
||||
}
|
||||
SyncRight($g_dossier,$user);
|
||||
SyncRight($g_dossier,$g_user);
|
||||
|
||||
$g_UserType=GetUserType($user);
|
||||
$g_UserType=GetUserType($g_user);
|
||||
session_register($g_UserType);
|
||||
|
||||
switch ($g_UserType) {
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ ShowMenuCompta($g_dossier);
|
|||
ShowMenuComptaRight($g_dossier);
|
||||
include_once ("check_priv.php");
|
||||
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
$r=CheckAction($g_dossier,$user,PARM);
|
||||
if ( $g_UserProperty['use_admin'] == 0 ) {
|
||||
$r=CheckAction($g_dossier,$g_user,PARM);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
* along with WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
/* $Revision$ */
|
||||
include_once ("ac_common.php");
|
||||
|
|
@ -46,33 +47,35 @@ include_once("poste.php");
|
|||
include_once ("top_menu_compta.php");
|
||||
ShowMenuCompta($g_dossier);
|
||||
ShowMenuComptaRight($g_dossier);
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
$r=CheckAction($g_dossier,$user,ENCJRN);
|
||||
if ( $g_UserProperty['use_admin'] == 0 ) {
|
||||
$r=CheckAction($g_dossier,$g_user,ENCJRN);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
}
|
||||
$right=CheckJrn($g_dossier,$user,$g_jrn);
|
||||
if ($right == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
if ( isset ($g_jrn)) {
|
||||
$right=CheckJrn($g_dossier,$g_user,$g_jrn);
|
||||
if ($right == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
} // if isset g_jrn
|
||||
|
||||
}
|
||||
|
||||
ShowMenuJrnUser($g_dossier,$user);
|
||||
ShowMenuJrnUser($g_dossier,$g_user);
|
||||
|
||||
if ( isset ( $_GET["action"] )) {
|
||||
if ( $_GET["action"] == "view" ) {
|
||||
ShowMenuRecherche($g_dossier,$g_jrn);
|
||||
|
||||
echo '<DIV class="redcontent">';
|
||||
ViewJrn($g_dossier,$user,$g_jrn);
|
||||
ViewJrn($g_dossier,$g_user,$g_jrn);
|
||||
echo '</DIV>';
|
||||
}
|
||||
if ( $_GET["action"] == "record" ) {
|
||||
if ( CheckJrn($g_dossier,$user,$g_jrn) < 2 ) {
|
||||
if ( CheckJrn($g_dossier,$g_user,$g_jrn) < 2 ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
|
||||
|
|
@ -80,10 +83,10 @@ if ( isset ( $_GET["action"] )) {
|
|||
echo_debug("record");
|
||||
$max_deb=$_GET["max_deb"];
|
||||
$max_cred=$_GET["max_cred"];
|
||||
RecordJrn($g_dossier,$user,$g_jrn,$max_deb,$max_cred);
|
||||
RecordJrn($g_dossier,$g_user,$g_jrn,$max_deb,$max_cred);
|
||||
}
|
||||
if ($_GET["action"]=="update" ) {
|
||||
if ( CheckJrn($g_dossier,$user,$g_jrn) < 2 ) {
|
||||
if ( CheckJrn($g_dossier,$g_user,$g_jrn) < 2 ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
|
||||
|
|
@ -109,8 +112,8 @@ if ( isset ( $_GET["action"] )) {
|
|||
}
|
||||
$p_MaxDeb+=2;
|
||||
echo "</DIV>";
|
||||
CorrectRecord($g_dossier,$user,$g_jrn,$p_MaxDeb,$p_MaxCred,$HTTP_POST_VARS);
|
||||
echo_debug("CorrectRecord($g_dossier,$user,$g_jrn,$p_MaxDeb,$p_MaxCred,$HTTP_POST_VARS);");
|
||||
CorrectRecord($g_dossier,$g_user,$g_jrn,$p_MaxDeb,$p_MaxCred,$HTTP_POST_VARS);
|
||||
echo_debug("CorrectRecord($g_dossier,$g_user,$g_jrn,$p_MaxDeb,$p_MaxCred,$HTTP_POST_VARS);");
|
||||
}
|
||||
|
||||
if ( isset ($_POST['add_line_cred']) ) {
|
||||
|
|
@ -120,15 +123,15 @@ if ( isset ( $_GET["action"] )) {
|
|||
}
|
||||
$p_MaxCred+=2;
|
||||
echo "</DIV>";
|
||||
CorrectRecord($g_dossier,$user,$g_jrn,$p_MaxDeb,$p_MaxCred,$HTTP_POST_VARS);
|
||||
echo_debug("CorrectRecord($g_dossier,$user,$g_jrn,$p_MaxDeb,$p_MaxCred+10,$HTTP_POST_VARS);");
|
||||
CorrectRecord($g_dossier,$g_user,$g_jrn,$p_MaxDeb,$p_MaxCred,$HTTP_POST_VARS);
|
||||
echo_debug("CorrectRecord($g_dossier,$g_user,$g_jrn,$p_MaxDeb,$p_MaxCred+10,$HTTP_POST_VARS);");
|
||||
}
|
||||
if ( isset ($_POST['viewsearch']) ) {
|
||||
reset($HTTP_POST_VARS);
|
||||
ShowMenuRecherche($g_dossier,$g_jrn,$HTTP_POST_VARS);
|
||||
|
||||
echo '<DIV class="redcontent">';
|
||||
ViewJrn($g_dossier,$user,$g_jrn,$HTTP_POST_VARS);
|
||||
ViewJrn($g_dossier,$g_user,$g_jrn,$HTTP_POST_VARS);
|
||||
echo '</DIV>';
|
||||
|
||||
}
|
||||
|
|
@ -142,7 +145,7 @@ if ( isset($_POST['add_record']) ) {
|
|||
}
|
||||
|
||||
|
||||
$result=VerifData($cn,$HTTP_POST_VARS,$user);
|
||||
$result=VerifData($cn,$HTTP_POST_VARS,$g_user);
|
||||
|
||||
switch( $result) {
|
||||
case NOERROR:
|
||||
|
|
@ -176,12 +179,12 @@ if ( isset($_POST['add_record']) ) {
|
|||
}
|
||||
if ($result != NOERROR) {
|
||||
echo "</DIV>";
|
||||
CorrectRecord($g_dossier,$user,$g_jrn,$p_MaxDeb,$p_MaxCred,$HTTP_POST_VARS);
|
||||
CorrectRecord($g_dossier,$g_user,$g_jrn,$p_MaxDeb,$p_MaxCred,$HTTP_POST_VARS);
|
||||
return;
|
||||
}
|
||||
|
||||
$Res=StartSql($cn);
|
||||
$userPref=GetUserPeriode($cn,$user);
|
||||
$userPref=GetUserPeriode($cn,$g_user);
|
||||
$seq=GetNextId($cn,'j_grpt')+1;
|
||||
$s_op=GetNextId($cn,'j_id')+1;
|
||||
$tot_cred=0;
|
||||
|
|
@ -196,7 +199,7 @@ if ( isset($_POST['add_record']) ) {
|
|||
j_jrn_def,j_debit,j_tech_user,j_tech_per)
|
||||
values ( $s_op,to_date('$p_op_date','DD.MM.YYYY'), ".$montant.",'$p_text',
|
||||
$l_class,$seq,
|
||||
$g_jrn,true,'$user',$userPref)";
|
||||
$g_jrn,true,'$g_user',$userPref)";
|
||||
echo_debug("sql $Sql");
|
||||
$s_op++;
|
||||
$tot_deb+=$montant;
|
||||
|
|
@ -214,7 +217,7 @@ if ( isset($_POST['add_record']) ) {
|
|||
j_jrn_def,j_debit,j_tech_user,j_tech_per)
|
||||
values ( $s_op,to_date('$p_op_date','DD.MM.YYYY'), $montant,'$p_text',
|
||||
$l_class,$seq,
|
||||
$g_jrn,false,'$user',$userPref)";
|
||||
$g_jrn,false,'$g_user',$userPref)";
|
||||
echo_debug("sql $Sql");
|
||||
$s_op++;
|
||||
$tot_cred+=$montant;
|
||||
|
|
@ -313,7 +316,7 @@ if ( isset($_POST['update_record']) ) {
|
|||
${"p_$name"}=$element;
|
||||
}
|
||||
reset($HTTP_POST_VARS);
|
||||
$result=VerifData($cn,$HTTP_POST_VARS,$user);
|
||||
$result=VerifData($cn,$HTTP_POST_VARS,$g_user);
|
||||
|
||||
switch( $result) {
|
||||
case NOERROR:
|
||||
|
|
@ -365,7 +368,7 @@ if ( isset($_POST['update_record']) ) {
|
|||
${"p_$name"}=$element;
|
||||
echo_debug("p_name p_$name = $element");
|
||||
}
|
||||
$userPref=GetUserPeriode($cn,$user);
|
||||
$userPref=GetUserPeriode($cn,$g_user);
|
||||
|
||||
for ( $i = 0; $i < $p_MaxDeb; $i++) {
|
||||
$j_id=${"p_op_deb$i"};
|
||||
|
|
@ -374,9 +377,8 @@ if ( isset($_POST['update_record']) ) {
|
|||
if ( strlen(trim($montant)) == 0) $montant=0;
|
||||
$p_text=(FormatString(${"p_text_deb$i"})==null)?GetPosteLibelle($g_dossier,$l_class):FormatString(${"p_text_deb$i"});
|
||||
|
||||
$Sql=sprintf("update jrnx set j_montant=%f, j_poste=%d,j_tech_user='%s',j_date=to_date('%s','DD.MM.YYYY'),j_text='%s',j_tech_per=%s
|
||||
where j_id=%d",
|
||||
$montant,$l_class,$user,$p_op_date,$p_text,$userPref,$j_id);
|
||||
$Sql=sprintf("update jrnx set j_montant=%f, j_poste=%d,j_tech_user='%s',j_date=to_date('%s','DD.MM.YYYY'),j_text='%s' where j_id=%d",
|
||||
$montant,$l_class,$g_user,$p_op_date,$p_text,$j_id);
|
||||
echo_debug("sql $Sql");
|
||||
$Res=ExecSql($cn,$Sql);
|
||||
if ( $Res == false ) { Rollback($cn); EndSql($cn); return;}
|
||||
|
|
@ -391,9 +393,8 @@ if ( isset($_POST['update_record']) ) {
|
|||
if ( strlen(trim($montant)) == 0 ) $montant=0;
|
||||
$p_text=(FormatString(${"p_text_cred$i"})==null)?GetPosteLibelle($g_dossier,$l_class):FormatString(${"p_text_cred$i"});
|
||||
|
||||
$Sql=sprintf("update jrnx set j_montant=%f,j_poste=%d,j_tech_user='%s', j_date=to_date('%s','DD.MM.YYYY'),j_text='%s',".
|
||||
" j_tech_per=%s where j_id=%d",
|
||||
$montant,$l_class,$user,$p_op_date,$p_text,$userPref,$j_id);
|
||||
$Sql=sprintf("update jrnx set j_montant=%f,j_poste=%d,j_tech_user='%s', j_date=to_date('%s','DD.MM.YYYY'),j_text='%s' where j_id=%d",
|
||||
$montant,$l_class,$g_user,$p_op_date,$p_text,$j_id);
|
||||
echo_debug("sql $Sql");
|
||||
// $s_op++;
|
||||
$Res=ExecSql($cn,$Sql);
|
||||
|
|
@ -425,14 +426,15 @@ if ( isset($_POST['update_record']) ) {
|
|||
$comment=FormatString($_POST["comment"]);
|
||||
|
||||
$Sql=sprintf("update jrn set jr_comment='%s',jr_date=%s,jr_rapt='%s',".
|
||||
"jr_montant=%f,jr_tech_per where
|
||||
"jr_montant=%f j_tech_per=%d where
|
||||
jr_id=%d",
|
||||
$comment,
|
||||
$l_date,
|
||||
$p_rapt,
|
||||
$p_sum_deb,
|
||||
$userPref,
|
||||
$p_jr_id);
|
||||
$p_jr_id
|
||||
);
|
||||
|
||||
$Res=ExecSql($cn,$Sql);
|
||||
$current_internal=GetInternal($cn,$p_jr_id);
|
||||
|
|
@ -445,10 +447,9 @@ if ( isset($_POST['update_record']) ) {
|
|||
} else {
|
||||
$comment=FormatString($_POST["comment"]);
|
||||
$Sql=sprintf("update jrn set jr_comment='%s',
|
||||
jr_date=%s,jr_rapt=null,jr_montant=%f,jr_tech_per=%s where jr_id=%d",
|
||||
jr_date=%s,jr_rapt=null,jr_montant=%f,jr_tech_per=%d where jr_id=%d",
|
||||
$comment,
|
||||
$l_date,$p_sum_deb,
|
||||
$userPref,
|
||||
$l_date,$p_sum_deb,$userPref,
|
||||
$p_jr_id);
|
||||
$Res=ExecSql($cn,$Sql);
|
||||
|
||||
|
|
@ -463,7 +464,7 @@ if ( isset($_POST['update_record']) ) {
|
|||
Rollback($cn);
|
||||
EndSql($cn);
|
||||
}
|
||||
ViewJrn($g_dossier,$user,$g_jrn);
|
||||
ViewJrn($g_dossier,$g_user,$g_jrn);
|
||||
|
||||
} // if update_record
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ CheckUser();
|
|||
include ("top_menu_compta.php");
|
||||
ShowMenuCompta($g_dossier);
|
||||
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
$r=CheckAction($g_dossier,$user,FACT);
|
||||
if ( $g_UserProperty['use_admin']==0 ) {
|
||||
$r=CheckAction($g_dossier,$g_user,FACT);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ if ( isset($_POST['add_modele']) ) {
|
|||
|
||||
|
||||
ShowMenuComptaRight($g_dossier);
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
$r=CheckAction($g_dossier,$user,FICHE);
|
||||
if ( $g_UserProperty['use_admin'] == 0 ) {
|
||||
$r=CheckAction($g_dossier,$g_user,FICHE);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ include ("check_priv.php");
|
|||
|
||||
ShowMenuComptaRight($g_dossier);
|
||||
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
$r=CheckAction($g_dossier,$user,FORM);
|
||||
if ( $g_UserProperty['use_admin'] == 0 ) {
|
||||
$r=CheckAction($g_dossier,$g_user,FORM);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
|
|
|
|||
|
|
@ -34,15 +34,15 @@ ShowMenuCompta($g_dossier);
|
|||
|
||||
include_once("impress_inc.php");
|
||||
ShowMenuComptaRight($g_dossier);
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
$r=CheckAction($g_dossier,$user,IMP);
|
||||
if ( $g_UserProperty['use_admin'] == 0 ) {
|
||||
$r=CheckAction($g_dossier,$g_user,IMP);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
}
|
||||
if (isset ($_GET["p_id"]) && isset ($_GET["type"])) {
|
||||
if ( $type="jrn") {
|
||||
$right=CheckJrn($g_dossier,$user,$_GET['p_id']);
|
||||
$right=CheckJrn($g_dossier,$g_user,$_GET['p_id']);
|
||||
if ($right == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
|
|
@ -54,7 +54,7 @@ if ( CheckAdmin() == 0 ) {
|
|||
|
||||
$l_Db=sprintf("dossier%d",$g_dossier);
|
||||
$cn=DbConnect($l_Db);
|
||||
ShowMenuJrnUserImp($cn,$user,$g_dossier);
|
||||
ShowMenuJrnUserImp($cn,$g_user,$g_dossier);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ include_once ("top_menu_compta.php");
|
|||
ShowMenuCompta($g_dossier);
|
||||
ShowMenuComptaRight($g_dossier);
|
||||
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
$r=CheckAction($g_dossier,$user,SECU);
|
||||
if ( $g_UserProperty['use_admin'] == 0 ) {
|
||||
$r=CheckAction($g_dossier,$g_user,SECU);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ ShowMenuCompta($g_dossier);
|
|||
ShowMenuComptaRight($g_dossier);
|
||||
include_once("check_priv.php");
|
||||
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
if ( $g_UserProperty['use_admin'] == 0 ) {
|
||||
include_once("check_priv.php");
|
||||
|
||||
$r=CheckAction($g_dossier,$user,SECU);
|
||||
$r=CheckAction($g_dossier,$g_user,SECU);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ include_once ("check_priv.php");
|
|||
include_once ("top_menu_compta.php");
|
||||
ShowMenuCompta($g_dossier);
|
||||
ShowMenuComptaRight($g_dossier);
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
$r=CheckAction($g_dossier,$user,GJRN);
|
||||
if ( $g_UserProperty['use_admin'] == 0 ) {
|
||||
$r=CheckAction($g_dossier,$g_user,GJRN);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ include_once("check_priv.php");
|
|||
/* Admin. Dossier */
|
||||
CheckUser();
|
||||
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
$r=CheckAction($g_dossier,$user,SECU);
|
||||
if ( $g_UserProperty['use_admin'] == 0 ) {
|
||||
$r=CheckAction($g_dossier,$g_user,SECU);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
|
|
|
|||
|
|
@ -28,12 +28,15 @@ include_once("debug.php");
|
|||
|
||||
if ( isset ($_POST["p_user"] ) ) {
|
||||
echo_debug("user is set");
|
||||
$user=$_POST["p_user"];
|
||||
$pass=$_POST["p_pass"];
|
||||
$g_user=$_POST["p_user"];
|
||||
$g_pass=$_POST["p_pass"];
|
||||
session_register("g_user");
|
||||
session_register("g_pass");
|
||||
html_page_start();
|
||||
|
||||
} else
|
||||
{
|
||||
if ( strlen($user) != 0 ) {
|
||||
if ( strlen($g_user) != 0 ) {
|
||||
echo_debug("user is not null");
|
||||
html_page_start();
|
||||
} else
|
||||
|
|
@ -52,8 +55,8 @@ if ( isset ($db_page) ) {
|
|||
}
|
||||
|
||||
|
||||
echo_debug("USER=$user - ");
|
||||
echo_debug($HTTP_SESSION_VARS["user"]);
|
||||
echo_debug("USER=$g_user - ");
|
||||
//echo_debug($HTTP_SESSION_VARS["user"]);
|
||||
echo_debug("PAGE = $db_page");
|
||||
|
||||
$cn=pg_connect("dbname=account_repository user='webcompta' ");
|
||||
|
|
@ -61,18 +64,14 @@ $IsValid=0;
|
|||
// Verif if User and Pass match DB
|
||||
// if no, then redirect to the login page
|
||||
CheckUser();
|
||||
$g_UserProperty=GetUserProperty($cn,$g_user);
|
||||
session_register("g_UserProperty");
|
||||
echo_debug("theme =".$g_UserProperty['use_theme']);
|
||||
|
||||
|
||||
if ( $user != 'webcompta') {
|
||||
$sql="select use_id from ac_users where use_login='$user'
|
||||
and use_active=1 and use_admin=1";
|
||||
|
||||
$rs=pg_exec($cn,$sql);
|
||||
$isAdmin=pg_NumRows($rs);
|
||||
} else $isAdmin=1;
|
||||
include("top_menu_compta.php");
|
||||
ShowMenu();
|
||||
if ( $isAdmin != 0 ) {
|
||||
// Show the first menu
|
||||
ShowMenu($g_UserProperty['use_admin']);
|
||||
if ( $g_UserProperty['use_admin'] != 0 || $g_user=='webcompta' ) {
|
||||
/* Administrator */
|
||||
$l_MaxLine=0;
|
||||
$r_database=ShowDossier('all',$db_page,$db_page+15,&$l_MaxLine);
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ include_once ("check_priv.php");
|
|||
|
||||
ShowMenuCompta($g_dossier);
|
||||
ShowMenuComptaRight($g_dossier);
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
$r=CheckAction($g_dossier,$user,MPCMN);
|
||||
if ( $g_UserProperty['use_admin'] == 0 ) {
|
||||
$r=CheckAction($g_dossier,$g_user,MPCMN);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ echo_debug("entering priv_users");
|
|||
|
||||
|
||||
CheckUser();
|
||||
if (CheckAdmin() != 1) {
|
||||
if ($g_UserProperty['use_admin'] != 1) {
|
||||
html_page_stop();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ function SaveRate(p_code,p_rate)
|
|||
</script>
|
||||
<?
|
||||
CheckUser();
|
||||
if ( CheckAdmin()==0 ) return;
|
||||
if ( $g_UserProperty['use_admin'] ) return;
|
||||
$dossier=sprint("dossier%d",$g_dossier);
|
||||
$cn=DbConnect($dossier);
|
||||
$Res=ExecSql($cn,"select pm_code, pm_rate from parm_money where pm_code='$p_code'");
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ if ( isset ($spass) ) {
|
|||
else {
|
||||
$Cn=DbConnect();
|
||||
$l_pass=md5($pass_1);
|
||||
$Res=ExecSql($Cn,"update ac_users set use_pass='$l_pass' where use_login='$user'");
|
||||
$Res=ExecSql($Cn,"update ac_users set use_pass='$l_pass' where use_login='$g_user'");
|
||||
$pass=$pass_1;
|
||||
echo '<H2 class="info"> Mot de passe changé </H1>';
|
||||
}
|
||||
|
|
@ -70,10 +70,10 @@ if ( isset ($g_dossier) ) {
|
|||
|
||||
if ( isset ($_POST["sub_periode"] ) ) {
|
||||
$periode=$_POST["periode"];
|
||||
SetUserPeriode($cn,$periode,$user);
|
||||
SetUserPeriode($cn,$periode,$g_user);
|
||||
}
|
||||
|
||||
$l_user_per=GetUserPeriode($cn,$user);
|
||||
$l_user_per=GetUserPeriode($cn,$g_user);
|
||||
$l_form_per=FormPeriode($cn,$l_user_per);
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ CheckUser();
|
|||
include_once ("top_menu_compta.php");
|
||||
ShowMenuCompta($g_dossier);
|
||||
ShowMenuComptaRight($g_dossier);
|
||||
if ( CheckAdmin() == 0 ) {
|
||||
$r=CheckAction($g_dossier,$user,SECU);
|
||||
if ( $g_UserProperty['use_admin']== 0 ) {
|
||||
$r=CheckAction($g_dossier,$g_user,SECU);
|
||||
if ($r == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
|
|
|
|||
|
|
@ -95,16 +95,17 @@ function formatDate($p_date) {
|
|||
}
|
||||
function html_page_start($p_first=0,$p_script="")
|
||||
{
|
||||
global $user,$pass;
|
||||
/*global $user,$pass;
|
||||
if ($p_first == 1 ) {
|
||||
echo_debug("Start session explicit");
|
||||
session_start();
|
||||
}
|
||||
session_register("user");
|
||||
session_register("pass");
|
||||
|
||||
|
||||
|
||||
echo_debug("user = ".$user." pass=".$pass);
|
||||
*/
|
||||
echo '<!DOCTYPE HTML PUBLIC "-//W3C/DTD HTML 3.2 FINAL//EN">';
|
||||
echo "<HTML>";
|
||||
echo "<HEAD>
|
||||
|
|
|
|||
|
|
@ -33,16 +33,16 @@
|
|||
++*/
|
||||
function CheckUser()
|
||||
{
|
||||
global $user,$pass,$IsValid;
|
||||
global $g_user,$g_pass,$IsValid;
|
||||
echo_debug("CheckUser");
|
||||
$res=0;
|
||||
$pass5=md5($pass);
|
||||
$pass5=md5($g_pass);
|
||||
if ( $IsValid == 1 ) { return; }
|
||||
$cn=pg_connect("dbname=account_repository host=127.0.0.1 user='webcompta'");
|
||||
if ( $cn != false ) {
|
||||
$sql="select ac_users.use_login,ac_users.use_active, ac_users.use_pass
|
||||
from ac_users
|
||||
where ac_users.use_login='$user'
|
||||
where ac_users.use_login='$g_user'
|
||||
and ac_users.use_active=1
|
||||
and ac_users.use_pass='$pass5'";
|
||||
echo_debug("Sql = $sql");
|
||||
|
|
@ -75,7 +75,7 @@ function CheckUser()
|
|||
* Show the folder where user have access
|
||||
++*/
|
||||
function ShowDossier($p_type,$p_first=0,$p_max=10,$p_Num=0) {
|
||||
global $user;
|
||||
global $g_user;
|
||||
if ( $p_max == 0 ) {
|
||||
$l_step="";
|
||||
} else {
|
||||
|
|
@ -90,7 +90,7 @@ function ShowDossier($p_type,$p_first=0,$p_max=10,$p_Num=0) {
|
|||
natural join ac_dossier
|
||||
natural join ac_users
|
||||
inner join priv_user on priv_jnt=jnt_id where
|
||||
use_login='".$user."' and priv_priv !='NO'
|
||||
use_login='".$g_user."' and priv_priv !='NO'
|
||||
order by dos_name ";
|
||||
$p_Num=CountSql($cn,$l_sql);
|
||||
}
|
||||
|
|
@ -107,44 +107,16 @@ function ShowDossier($p_type,$p_first=0,$p_max=10,$p_Num=0) {
|
|||
//echo $row[dossier];
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
/*++
|
||||
* function : CheckAccess
|
||||
* Parameter : $p_right (user or admin)
|
||||
* $p_database (name of the database)
|
||||
* Return : 1 if ok
|
||||
* Description :
|
||||
* Check user's access right to the given database
|
||||
++*/
|
||||
function CheckAccess($p_right,$p_database)
|
||||
{
|
||||
// global $user,$pass;
|
||||
// echo "User is $user";
|
||||
// $cn=pg_connect("host=127.0.0.1 dbname=$p_database user='webcompta' ");
|
||||
// $ret=pg_exec($cn,"select name from ac_dossier where name='$user' and dossier='$p_database' and priv='$p_right'");
|
||||
// if ( pg_NumRows($ret) == 0 ) {
|
||||
// /* echo '<META HTTP-EQUIV="REFRESH" content="4;url=index.html">';*/
|
||||
// echo "<BR><BR><BR><BR><BR><BR>";
|
||||
// echo "<P ALIGN=center><BLINK>
|
||||
// <FONT size=+12 COLOR=RED>
|
||||
// You haven't the right to connect
|
||||
// </FONT></BLINK></P>";
|
||||
// session_unset();
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
// return $ret;
|
||||
|
||||
}
|
||||
// Check if the user has admin right
|
||||
// to be complete
|
||||
function CheckAdmin() {
|
||||
global $user,$pass;
|
||||
global $g_user,$g_pass;
|
||||
$res=0;
|
||||
|
||||
if ( $user != 'webcompta') {
|
||||
$pass5=md5($pass);
|
||||
$sql="select use_id from ac_users where use_login='$user'
|
||||
if ( $g_user != 'webcompta') {
|
||||
$pass5=md5($g_pass);
|
||||
$sql="select use_id from ac_users where use_login='$g_user'
|
||||
and use_active=1 and use_admin=1 and use_pass='$pass5'";
|
||||
|
||||
$cn=DbConnect();
|
||||
|
|
@ -154,11 +126,24 @@ function CheckAdmin() {
|
|||
|
||||
return $isAdmin;
|
||||
}
|
||||
/* function DbConnect
|
||||
* purpose : connect to the database
|
||||
* parameter : p_db : db_name
|
||||
* return the connection
|
||||
* todo : replace hardcoded by variable placed in
|
||||
* constant.php
|
||||
*/
|
||||
function DbConnect($p_db="account_repository") {
|
||||
$a=pg_connect("dbname=$p_db host=127.0.0.1 user='webcompta'");
|
||||
echo_debug ("connect to $p_db");
|
||||
return $a;
|
||||
}
|
||||
/* function ExecSql
|
||||
* purpose : send a sql string to the database
|
||||
* parameter p_connection db connection
|
||||
* p_string sql string
|
||||
* return false if error otherwise true
|
||||
*/
|
||||
function ExecSql($p_connection, $p_string) {
|
||||
echo_debug("SQL = $p_string");
|
||||
$ret=pg_exec($p_connection,$p_string);
|
||||
|
|
@ -351,4 +336,31 @@ function SyncRight($p_dossier,$p_user) {
|
|||
"(select uj_jrn_id from user_sec_jrn where uj_login='".$p_user."')";
|
||||
$Res=ExecSql($cn,$sql);
|
||||
}
|
||||
/* function GetUserProperty
|
||||
* Purpose : Get the properties of an user
|
||||
* it means theme, profile, admin...
|
||||
*
|
||||
* parm :
|
||||
* - $p_user user login
|
||||
* - $p_cn connection resource
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return: an array
|
||||
*/
|
||||
function GetUserProperty($p_cn,$p_user)
|
||||
{
|
||||
$sql="select use_admin,use_usertype,use_theme
|
||||
from ac_users where use_login='$p_user'";
|
||||
$Ret=ExecSql($p_cn,$sql);
|
||||
if ( pg_NumRows($Ret) == 0)
|
||||
return array('use_admin'=>0,
|
||||
'use_usertype'=>'user',
|
||||
'use_theme'=>'classic');
|
||||
|
||||
$a=pg_fetch_array($Ret,0);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -21,29 +21,29 @@
|
|||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
/* $Revision$ */
|
||||
|
||||
/* function
|
||||
* Purpose :
|
||||
/* function ShowMenu
|
||||
* Purpose : Show The login menu
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* - $p_admin 1 if admin
|
||||
* - $p_item item to add
|
||||
* gen :
|
||||
* -
|
||||
* - none
|
||||
* return:
|
||||
* -
|
||||
* - nothing
|
||||
*
|
||||
*/
|
||||
function ShowMenu($p_check = 1,$p_item="")
|
||||
function ShowMenu($p_admin,$p_check = 1,$p_item="")
|
||||
{
|
||||
/* $p_check == 1 si test sur Admin */
|
||||
include_once("postgres.php");
|
||||
echo '<div class="mtitle">';
|
||||
echo "<TABLE align=center><TR>";
|
||||
if ( $p_check == 1 ) {
|
||||
if ( CheckAdmin() != 0 ) {
|
||||
if ( $p_admin !=0 ) {
|
||||
/* Administrator Menu */
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF=admin_repo.php>Administrator Menu</A></TD>';
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen ( $p_item ) != 0 ) {
|
||||
echo '<TD class="mtitle">'.$p_item.'</A></TD>';
|
||||
}
|
||||
|
|
@ -178,15 +178,16 @@ function ShowMenuComptaLeft($p_dossier,$p_item)
|
|||
|
||||
}
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
/* function ShowMenuComptaRight
|
||||
* Purpose : Display menu on the Right
|
||||
* (preference, logout and admin)
|
||||
* parm :
|
||||
* -
|
||||
* - $p_dossier the current dossier
|
||||
* - $p_more code
|
||||
* gen :
|
||||
* -
|
||||
* - none
|
||||
* return:
|
||||
* -
|
||||
* - none
|
||||
*
|
||||
*/
|
||||
function ShowMenuComptaRight($p_dossier=0,$p_more="")
|
||||
|
|
@ -208,15 +209,15 @@ function ShowMenuComptaRight($p_dossier=0,$p_more="")
|
|||
echo "</TABLE>";
|
||||
echo '</div>';
|
||||
}
|
||||
/* function
|
||||
/* function ShowMenuAdminGlobalRight($p_dossier=0)
|
||||
* Purpose :
|
||||
*
|
||||
* Same as previous : show the right menu
|
||||
* parm :
|
||||
* -
|
||||
* - p_dossier
|
||||
* gen :
|
||||
* -
|
||||
* - none
|
||||
* return:
|
||||
* -
|
||||
* - none
|
||||
*
|
||||
*/
|
||||
function ShowMenuAdminGlobalRight($p_dossier=0)
|
||||
|
|
@ -237,15 +238,15 @@ printf( '<TR><TD class="mtitle"> <A class="mtitle" HREF="compta.php?dos=%d">Reto
|
|||
echo "</TABLE>";
|
||||
echo '</div>';
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
/* function ShowMenuPcmn($p_start=1)
|
||||
* Purpose : Show the menu from the pcmn page
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* - $p_start class start
|
||||
* gen :
|
||||
* -
|
||||
* - none
|
||||
* return:
|
||||
* -
|
||||
* - none
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -264,15 +265,15 @@ function ShowMenuPcmn($p_start=1)
|
|||
echo '</div>';
|
||||
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
/* function ShowMenuJrn($p_dossier)
|
||||
* Purpose : Show the menu in the jrn page
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* - $p_dossier
|
||||
* gen :
|
||||
* -
|
||||
* - none
|
||||
* return:
|
||||
* -
|
||||
* - none
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -284,7 +285,8 @@ function ShowMenuJrn($p_dossier)
|
|||
include_once("postgres.php");
|
||||
$l_jrn=sprintf("dossier%d",$p_dossier);
|
||||
$Cn=DbConnect($l_jrn);
|
||||
$Ret=ExecSql($Cn,"select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc
|
||||
$Ret=ExecSql($Cn,"select jrn_def_id,jrn_def_name,
|
||||
jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc
|
||||
from jrn_def join jrn_type on jrn_def_type=jrn_type_id");
|
||||
$Max=pg_NumRows($Ret);
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
|
|
@ -297,15 +299,17 @@ function ShowMenuJrn($p_dossier)
|
|||
echo '</div>';
|
||||
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
/* function ShowMenuJrnUser($p_dossier,$p_user)
|
||||
* Purpose : Show the Menu from the jrn encode
|
||||
* page
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* - $p_dossier
|
||||
* - $p_user
|
||||
* gen :
|
||||
* -
|
||||
* - none
|
||||
* return:
|
||||
* -
|
||||
* - none
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -362,15 +366,17 @@ function ShowMenuJrnUser($p_dossier,$p_user)
|
|||
echo '</div>';
|
||||
|
||||
}
|
||||
/* function
|
||||
/* function ShowMenuRecherche
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* - $p_dossier,
|
||||
* - $p_jrn jrn id
|
||||
* - $p_array=null previous search
|
||||
* gen :
|
||||
* -
|
||||
* - none
|
||||
* return:
|
||||
* -
|
||||
* - none
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -456,15 +462,19 @@ function ShowMenuComptaForm($p_dossier) {
|
|||
echo "</TABLE>";
|
||||
echo '</div>';
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
/* function ShowMenuJrnUserImp(
|
||||
*
|
||||
*
|
||||
* Purpose : Show the menu of jrn to print
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* - $p_cn, connection
|
||||
* $p_user, user
|
||||
* $p_dossier dossier
|
||||
* gen :
|
||||
* -
|
||||
* - none
|
||||
* return:
|
||||
* -
|
||||
* - none
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -590,7 +600,7 @@ function ShowMenuAdminGlobal()
|
|||
echo $menu;
|
||||
echo '</DIV>';
|
||||
}
|
||||
/* Function ShowItem($p_array) */
|
||||
/* function ShowItem($p_array) */
|
||||
/* purpose : store the string which print */
|
||||
/* the content of p_array in a table */
|
||||
/* used to display the menu */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue