C:\$Recycle.Bin\S-1-5-21-3967099092-2644009230-141905953-500\$R30CG93\tcpro\viewprofile.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<?php
/**
 * viewprofile.php
 * 
 * Displays the user profile dialog for viewing 
 * 
 * @package TeamCalPro
 * @version 3.3.001 
 * @author George Lewe
 * @copyright Copyright (c) 2004-2010 by George Lewe
 * @link http://www.lewe.com
 * @license http://www.lewe.com/tcpro/doc/license.txt Extended GNU Public License
 */
 
//echo "<script type=\"text/javascript\">alert(\"Debug: \");</script>";

/**
 * Set parent flag to control access to child scripts 
 */
define'_VALID_TCPRO');

/**
 * Includes 
 */
require ("config.tcpro.php");
require_once (
"includes/functions.tcpro.php");
getOptions();
if (
strlen($CONF['options']['lang'])) require ("includes/lang/" $CONF['options']['lang'] . ".tcpro.php");
else                                  require (
"includes/lang/english.tcpro.php");

require_once( 
"includes/tcabsence.class.php" );
require_once( 
"includes/tcallowance.class.php" );
require_once( 
"includes/tcavatar.class.php" );
require_once( 
"includes/tcconfig.class.php" );
require_once( 
"includes/tcgroup.class.php" );
require_once( 
"includes/tclogin.class.php" );
require_once( 
"includes/tctemplate.class.php" );
require_once( 
"includes/tcuser.class.php" );
require_once( 
"includes/tcusergroup.class.php" );

$A  = new tcAbsence;
$AV = new tcAvatar;
$B  = new tcAllowance;
$C  = new tcConfig;
$G  = new tcGroup;
$L  = new tcLogin;
$T  = new tcTemplate;
$U  = new tcUser;
$UG = new tcUserGroup;

if ( isset(
$_REQUEST['username']) ) $req_username $_REQUEST['username'];
$error false;
$msg false;

/**
 * Check authorization 
 */
if ( !checkAuth("viewProfile",$req_username) ) 
{
   
$err_short=$LANG['err_not_authorized_short'];
   
$err_long=$LANG['err_not_authorized_long'];
   
$err_module="viewprofile.php";
   require( 
"includes/header.html.inc.php" );
   include (
"error.php");
   require( 
"includes/footer.html.inc.php" );
}
else
{
   
$U->findByName($req_username);

   
/**
    * Default period for absence count
    */
   
$today     getdate();
   
$countfrom str_replace("-","",$C->readConfig("defperiodfrom"));
   
$countto str_replace("-","",$C->readConfig("defperiodto"));

   
/**
    * Process form 
    */
   
if ( isset($_POST['btn_send']) ) 
   {
      
$to .= $U->email;
      
mail($tostripslashes($_POST['subject']), stripslashes($_POST['msg']), "From: " $C->readConfig("mailFrom") . "\r\n" "Reply-To: " $C->readConfig("mailReply") . "\r\n");
      
$msg true;
      
$message $LANG['message_msgsent'];
   }
   else if ( isset(
$_POST['btn_refresh']) ) 
   {
      
/**
       * Adjust period for absence count
       */
      
$countfrom stripslashes($_POST['cntfrom']);
      
$countto stripslashes($_POST['cntto']);
   }
   
   require( 
"includes/header.html.inc.php" );
?>
      
<body>
   <form name="userprofile" method="POST" action="<?php echo $_SERVER['PHP_SELF']."?username=".$U->username."&amp;lang=".$CONF['options']['lang']; ?>">
      <table class="dlg">
         <tr>
            <td class="dlg-header">
               <?php printDialogTop($LANG['show_profile_title'],"view_profile.html","ico_users.png"); ?>
            </td>
         </tr>
         <tr>
            <td class="dlg-body">
               <table class="dlg-frame">
                  <tr>
                     <td class="dlg-body" width="110" rowspan="9">
                        <?php
                        
if ($AV->find($U->username)) {
                           echo 
"<img src=\"".$AV->path.$AV->filename.".".$AV->fileextension."\" align=\"top\" border=\"0\" alt=\"".$U->username."\" title=\"".$U->username."\">";
                        }
                        else {
                           echo 
"<img src=\"".$AV->path."noavatar.gif\" align=\"top\" border=\"0\" alt=\"No avatar\" title=\"No avatar\">";
                        }
                        
?>
                     </td>
                     <td class="dlg-body" width="80"><strong><?php echo $LANG['show_profile_name']; ?></strong></td>
                     <td class="dlg-body2"><b><?php echo $U->title." ".$U->firstname." ".$U->lastname?></b></td>
                  </tr>
                  <tr>
                     <td class="dlg-body" width="80"><strong><?php echo $LANG['show_profile_uname']; ?></strong></td>
                     <td class="dlg-body"><?php echo $U->username?></td>
                  </tr>
                  <tr>
                     <td class="dlg-body" width="80"><strong><?php echo $LANG['show_profile_position']; ?></strong></td>
                     <td class="dlg-body"><?php echo $U->position?></td>
                  </tr>
                  <tr>
                     <td class="dlg-body" width="80"><strong><?php echo $LANG['show_profile_idnumber']; ?></strong></td>
                     <td class="dlg-body"><?php echo $U->idnumber?></td>
                  </tr>
                  <tr>
                     <td class="dlg-body" width="80"><strong><?php echo $LANG['show_profile_group']; ?></strong></td>
                     <td class="dlg-body">
                     <?php
                          $query  
"SELECT * FROM `".$UG->table."` WHERE `username` = '".$U->username."';";
                          
$result $UG->db->db_query($query);
                          while ( 
$row $UG->db->db_fetch_array($result,MYSQL_ASSOC) ){
                             
$G->findByName($row['groupname']);
                             echo 
$row['groupname']." - ".$G->description." (".ucfirst($row['type']).")<br>";
                          }
                     
?>
                     </td>
                  </tr>
                  <tr>
                     <td class="dlg-body" width="80"><strong><?php echo $LANG['show_profile_phone']; ?></strong></td>
                     <td class="dlg-body"><?php echo $U->phone?></td>
                  </tr>
                  <tr>
                     <td class="dlg-body" width="80"><strong><?php echo $LANG['show_profile_mobile']; ?></strong></td>
                     <td class="dlg-body"><?php echo $U->mobile?></td>
                  </tr>
                  <tr>
                     <td class="dlg-body" width="80"><strong><?php echo $LANG['show_profile_email']; ?></strong></td>
                     <td class="dlg-body"><?php echo $U->email?></td>
                  </tr>
                  <tr>
                     <td class="dlg-body" width="80"><strong><?php echo $LANG['show_profile_gender']; ?></strong></td>
                     <td class="dlg-body">
                        <?php
                           
if ( $U->checkUserType($CONF['UTMALE']) ) 
                             echo 
$LANG['show_profile_male'];
                           else 
                             echo 
$LANG['show_profile_female'];
                        
?>
                     </td>
                  </tr>
               </table>
            </td>
         </tr>
              
         <?php if (checkAuth("sendMessage")) { ?>
         <tr>
            <td class="dlg-help">
               <table class="dlg-frame">
                  <tr>
                     <td class="dlg-body" colspan="2"><strong><?php echo $LANG['show_profile_sendmail']; ?></strong></td>
                  </tr>
                  <tr>
                     <td class="dlg-body" width="80"><strong><?php echo $LANG['message_subject_caption']; ?></strong></td>
                     <td class="dlg-body">
                        <input name="subject" id="subject" size="50" type="text" class="text" value="<?php echo $LANG['show_profile_subject']; ?>">
                        <br />
                     </td>
                  </tr>
                  <tr>
                     <td class="dlg-body"><strong><?php echo $LANG['show_profile_message']; ?></strong></td>
                     <td class="dlg-body">
                        <textarea name="msg" id="msg" class="text" ROWS="8" COLS="47">
<?php echo $LANG['message_msg'] . "\r\n"?></textarea>
                        <br />
                     </td>
                  </tr>
                  <tr>
                     <td class="dlg-body">&nbsp;</td>
                     <td class="dlg-body">
                        <input name="btn_send" type="submit" class="button" value="<?php echo $LANG['btn_send']; ?>" onmouseover="this.className='button-over';" onmouseout="this.className='button';">
                     </td>
                  </tr>
               </table>
            </td>
         </tr>
             <?php }
             if ( 
checkAuth("viewAbsenceCount") ) { ?>
             
         <tr>
            <td class="dlg-bodyffc">
               <div align="center">
                     <?php include( $CONF['app_root']."includes/absencecount.inc.php" ); ?>
               </div>
            </td>
         </tr>
             <?php ?>
             
         <tr>
            <td class="dlg-menu">
               <input name="btn_help" type="button" class="button" onclick="javascript:this.blur(); openPopup('help/<?php echo $CONF['options']['helplang']; ?>/html/index.html?view_profile.html','help','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,titlebar=0,resizable=0,dependent=1,width=750,height=500');" value="<?=$LANG['btn_help']?>" onmouseover="this.className='button-over';" onmouseout="this.className='button';">
               <input name="btn_close" type="button" class="button" onclick="javascript:window.close();" value="<?=$LANG['btn_close']?>" onmouseover="this.className='button-over';" onmouseout="this.className='button';">
            </td>
         </tr>
      </table>
   </form>
   <br />

<?php
   
if ($msg) echo ("<script type=\"text/javascript\">alert(\"".$message."\")</script>");
   require( 
"includes/footer.html.inc.php" );
}
?>