/[phpcompta]/phpcompta/include/class_user.php
ViewVC logotype

Diff of /phpcompta/include/class_user.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by sparkyx, Tue Oct 25 09:54:07 2005 UTC revision 1.14 by sparkyx, Tue Oct 25 12:10:28 2005 UTC
# Line 40  class cl_user { Line 40  class cl_user {
40      $this->pass=$_SESSION['g_pass'];      $this->pass=$_SESSION['g_pass'];
41      $this->valid=(isset ($_SESSION['isValid']))?1:0;      $this->valid=(isset ($_SESSION['isValid']))?1:0;
42      $this->db=$p_cn;      $this->db=$p_cn;
43      if ( isset($_SESSION['use_theme']) )      if ( isset($_SESSION['g_theme']) )
44        $this->theme=$_SESSION['use_theme'];        $this->theme=$_SESSION['g_theme'];
45            
46      $this->admin=( isset($_SESSION['use_admin']) )?$_SESSION['use_admin']:0;      $this->admin=( isset($_SESSION['use_admin']) )?$_SESSION['use_admin']:0;
47            
# Line 58  class cl_user { Line 58  class cl_user {
58               use_name,               use_name,
59               use_login,               use_login,
60               use_active,               use_active,
61               use_admin               use_admin,
62                       from ac_users                       from ac_users
63               where use_id=$p_id";               where use_id=$p_id";
64        $cn=DbConnect();        $cn=DbConnect();
# Line 91  class cl_user { Line 91  class cl_user {
91          $cn=DbConnect();          $cn=DbConnect();
92          if ( $cn != false ) {          if ( $cn != false ) {
93            $sql="select ac_users.use_login,ac_users.use_active, ac_users.use_pass,            $sql="select ac_users.use_login,ac_users.use_active, ac_users.use_pass,
94                         use_theme,use_admin,use_first_name,use_name                      use_admin,use_first_name,use_name
95                                  from ac_users                                    from ac_users  
96                                   where ac_users.use_login='$this->id'                                   where ac_users.use_login='$this->id'
97                                          and ac_users.use_active=1                                          and ac_users.use_active=1
# Line 102  class cl_user { Line 102  class cl_user {
102              echo_debug(__FILE__,__LINE__,"Number of found rows : $res");              echo_debug(__FILE__,__LINE__,"Number of found rows : $res");
103              if ( $res >0 ) {              if ( $res >0 ) {
104                $r=pg_fetch_array($ret,0);                $r=pg_fetch_array($ret,0);
               $_SESSION['use_theme']=$r['use_theme'];  
105                $_SESSION['use_admin']=$r['use_admin'];                $_SESSION['use_admin']=$r['use_admin'];
106                $_SESSION['use_name']=$r['use_name'];                $_SESSION['use_name']=$r['use_name'];
107                $_SESSION['use_first_name']=$r['use_first_name'];                $_SESSION['use_first_name']=$r['use_first_name'];
108                                
109                $this->theme=$_SESSION['use_theme'];                $this->theme=$_SESSION['g_theme'];
110                $this->admin=$_SESSION['use_admin'];                $this->admin=$_SESSION['use_admin'];
111                $this->name=$_SESSION['use_name'];                $this->name=$_SESSION['use_name'];
112                $this->first_name=$_SESSION['use_first_name'];                $this->first_name=$_SESSION['use_first_name'];
113                  $this->GetGlobalPref();
114    
115              }              }
116            }            }
117                        
# Line 265  function GetPreferences () Line 266  function GetPreferences ()
266    if ( $Count == 1 ) return 1;    if ( $Count == 1 ) return 1;
267    echo "<H2 class=\"error\"> Invalid action !!! $Count select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id </H2>";    echo "<H2 class=\"error\"> Invalid action !!! $Count select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id </H2>";
268  }  }
269    /* function GetGlobalPref
270     **************************************************
271     * Purpose : Get the global preferences from user_global_pref
272     *        in the account_repository db
273     * parm :
274     *      - set g_variable
275     * gen :
276     *      - none
277     * return:
278     *     - none
279     */
280    
281    
282    function GetGlobalPref()
283    {
284      $cn=Dbconnect();
285      // Load everything in an array
286      $Res=ExecSql ($cn,"select parameter_type,parameter_value from
287                      user_global_pref
288                      where user_id='".$this->id."'");
289      $Max=pg_NumRows($Res);
290      if (  $Max == 0 ) return null;
291      // Load value into array
292      $line=array();
293      for ($i=0;$i<$Max;$i++) {
294        $row=pg_fetch_array($Res,$i);
295        $type=$row['parameter_type'];
296        $line[$type]=$row['parameter_value'];;
297      }
298      // save array into g_ variable
299      $array_pref=array ('g_theme'=>'THEME','g_pagesize'=>'PAGESIZE');
300      foreach ($array_pref as $name=>$parameter ) {
301        $_SESSION[$name]=$line[$parameter];
302      }
303    }
304  }  }
305  ?>  ?>

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26