2015-02-11 23:52:11 -05:00
|
|
|
<?php
|
2015-02-12 15:23:08 -05:00
|
|
|
session_start();
|
|
|
|
require_once("config.inc.php");
|
2017-05-12 11:12:29 -04:00
|
|
|
require_once($yaptc_lang);
|
|
|
|
|
2015-02-20 05:16:28 -05:00
|
|
|
require_once($yaptc_inc . "functions.inc.php");
|
2015-02-25 16:01:50 -05:00
|
|
|
$yaptc_pagename = lang('ACCOUNT');
|
2016-02-04 14:18:34 -05:00
|
|
|
$yaptc_pageicon = '<i class="fa fa-cog"></i> ';
|
2015-02-12 15:23:08 -05:00
|
|
|
require_once($yaptc_inc . "header.inc.php");
|
2015-02-20 01:57:34 -05:00
|
|
|
if (getSessionStatus() == false):
|
2015-02-19 11:02:13 -05:00
|
|
|
killSession();
|
2015-02-24 10:37:52 -05:00
|
|
|
else: ?>
|
2015-02-25 16:01:50 -05:00
|
|
|
<!-- ********** BEGIN CONTENT ********** -->
|
2015-02-20 01:57:34 -05:00
|
|
|
<?php
|
2015-02-25 16:01:50 -05:00
|
|
|
if (isset($_POST['saveprofile'])):
|
2015-02-23 03:09:15 -05:00
|
|
|
if (empty($_POST['password']) && empty($_POST['newpassword2'])):
|
2017-05-11 13:22:44 -04:00
|
|
|
setUserInfo($yaptc_db, $session_user["0"]["userid"], $_POST['firstname'], $_POST['lastname'], $_POST['email'], $session_user["0"]["usertypeid"], $session_user["0"]["password"]);
|
2015-02-23 03:09:15 -05:00
|
|
|
header('Location: ' . $_SERVER['PHP_SELF']);
|
2015-02-24 10:37:52 -05:00
|
|
|
elseif (strlen($_POST['password']) < $yaptc_min_password):
|
|
|
|
echo "Password must be at least $yaptc_min_password characters.";
|
|
|
|
elseif (!empty($_POST['password']) && empty($_POST['newpassword2'])):
|
|
|
|
echo "Please confirm password if you wish to change it";
|
|
|
|
elseif ($_POST['password'] != $_POST['newpassword2']):
|
|
|
|
echo "New passwords do not match";
|
|
|
|
elseif (!empty($_POST['password']) && ($_POST['password'] = $_POST['newpassword2'])):
|
|
|
|
// change pw
|
2015-02-20 01:57:34 -05:00
|
|
|
require_once($yaptc_lib . "phpass-0.3/PasswordHash.php");
|
2015-02-23 03:09:15 -05:00
|
|
|
$hasher = new PasswordHash(8, FALSE);
|
|
|
|
$password = $hasher->HashPassword($_POST['password']);
|
2017-05-11 13:22:44 -04:00
|
|
|
setUserInfo($yaptc_db, $session_user["0"]["userid"], $_POST['firstname'], $_POST['lastname'], $_POST['email'], $session_user["0"]["usertypeid"], $password);
|
2015-02-23 03:09:15 -05:00
|
|
|
header('Location: ' . $_SERVER['PHP_SELF']);
|
2015-02-24 10:37:52 -05:00
|
|
|
endif;
|
2015-02-23 03:09:15 -05:00
|
|
|
endif;
|
2015-02-26 12:44:21 -05:00
|
|
|
|
|
|
|
// Set up pagination
|
|
|
|
$page_num = 1;
|
|
|
|
if(!empty($_GET['pnum'])):
|
|
|
|
$page_num = filter_input(INPUT_GET, 'pnum', FILTER_VALIDATE_INT);
|
|
|
|
if(false === $page_num):
|
|
|
|
$page_num = 1;
|
|
|
|
endif;
|
|
|
|
endif;
|
2017-05-11 13:22:44 -04:00
|
|
|
$offset = ($page_num - 1) * $yaptc_rowsperpage;
|
|
|
|
$row_count = count(listPunches($yaptc_db, $session_user["0"]["userid"]));
|
2015-02-26 12:44:21 -05:00
|
|
|
$page_count = 0;
|
2017-05-11 13:22:44 -04:00
|
|
|
if (0 === $row_count): else: $page_count = (int)ceil($row_count / $yaptc_rowsperpage); if($page_num > $page_count): $page_num = 1; endif; endif;
|
2015-02-23 03:09:15 -05:00
|
|
|
?>
|
|
|
|
|
2017-05-11 23:07:56 -04:00
|
|
|
|
|
|
|
<!-- Begin page content -->
|
|
|
|
<div class="container">
|
|
|
|
<div class="page-header">
|
|
|
|
<h2><i class="glyphicon glyphicon-edit"></i> <?php echo lang('EDIT_PROFILE'); ?></h2>
|
|
|
|
</div>
|
|
|
|
<p class="lead"><?php echo lang('ACCOUNT_INFO_DESC') . $yaptc_min_password; ?></p>
|
|
|
|
|
|
|
|
|
|
|
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
|
2015-02-25 16:01:50 -05:00
|
|
|
<fieldset>
|
2017-05-11 23:07:56 -04:00
|
|
|
<div class="form-group row">
|
|
|
|
<label for="username" class="col-sm-2 col-form-label"><?php echo lang('USERNAME'); ?></label>
|
|
|
|
<div class="col-sm-2"><input class="form-control" type="text" name="username" id="username" maxlength="50" value="<?php echo $session_user["0"]["username"]; ?>" readonly /></div>
|
|
|
|
<label for="created" class="col-sm-2 col-form-label"><?php echo lang('CREATED'); ?></label>
|
|
|
|
<div class="col-sm-2"><input class="form-control" type="text" name="created" id="created" value="<?php echo $session_user["0"]["created"]; ?>" readonly /></div>
|
|
|
|
<label for="usertype" class="col-sm-2 col-form-label"><?php echo lang('USERTYPE'); ?></label>
|
|
|
|
<div class="col-sm-2"><input class="form-control" type="text" name="usertype" id="usertype" maxlength="50" value="<?php echo $session_user["0"]["usertype"]; ?>" readonly /></div>
|
2015-02-25 16:01:50 -05:00
|
|
|
</div>
|
2017-05-11 23:07:56 -04:00
|
|
|
<div class="form-group row">
|
|
|
|
<label for="firstname" class="col-sm-2 col-form-label"><?php echo lang('FIRSTNAME'); ?></label>
|
|
|
|
<div class="col-sm-2"><input class="form-control" type="text" name="firstname" id="firstname" maxlength="50" value="<?php echo $session_user["0"]["firstname"]; ?>" /></div>
|
|
|
|
<label for="lastname" class="col-sm-2 col-form-label"><?php echo lang('LASTNAME'); ?></label>
|
|
|
|
<div class="col-sm-2"><input class="form-control" type="text" name="lastname" id="lastname" maxlength="50" value="<?php echo $session_user["0"]["lastname"]; ?>" /></div>
|
|
|
|
<label for="email" class="col-sm-2 col-form-label"><?php echo lang('EMAIL'); ?></label>
|
|
|
|
<div class="col-sm-2"><input class="form-control" type="text" name="email" id="email" maxlength="100" value="<?php echo $session_user["0"]["email"]; ?>" /></div>
|
2015-02-25 16:01:50 -05:00
|
|
|
</div>
|
2017-05-11 23:07:56 -04:00
|
|
|
<div class="form-group row">
|
|
|
|
<label for="password" class="col-sm-2 col-form-label"><?php echo lang('NEW') . " " . lang('PASSWORD'); ?></label>
|
|
|
|
<div class="col-sm-2"><input class="form-control" type="password" name="password" id="password" /></div>
|
|
|
|
<label for="newpassword2" class="col-sm-2 col-form-label"><?php echo lang('CONFIRM') . " " . lang('NEW') . " " . lang('PASSWORD'); ?></label>
|
|
|
|
<div class="col-sm-2"><input class="form-control" type="password" name="newpassword2" id="newpassword2" /></div>
|
|
|
|
<div class="col-sm-4"><button type="submit" name="saveprofile" id="saveprofile" class="form-control btn btn-block btn-primary"><?php echo lang('SAVE'); ?></button></div>
|
2015-02-25 16:01:50 -05:00
|
|
|
</div>
|
2017-05-11 23:07:56 -04:00
|
|
|
|
2015-02-25 16:01:50 -05:00
|
|
|
</fieldset>
|
|
|
|
</form>
|
2017-05-11 23:07:56 -04:00
|
|
|
</div>
|
2015-02-26 12:44:21 -05:00
|
|
|
|
|
|
|
|
2017-05-11 23:07:56 -04:00
|
|
|
<div class="container">
|
|
|
|
<div class="page-header">
|
|
|
|
<h2><i class="glyphicon glyphicon-folder-open"></i> <?php echo lang('PUNCH_HISTORY_HEADER'); ?></h2>
|
|
|
|
</div>
|
|
|
|
<p class="lead"><?php echo lang('PUNCH_HISTORY_DESC'); ?></p>
|
2015-02-26 12:44:21 -05:00
|
|
|
|
2017-05-11 23:07:56 -04:00
|
|
|
<table class="table table-striped">
|
2015-02-25 16:01:50 -05:00
|
|
|
<thead>
|
2017-05-12 00:38:26 -04:00
|
|
|
<tr><th colspan="4"><?php echo '<ul class="pagination pagination-sm">'; for ($i = 1; $i <= $page_count; $i++): echo '<li class="'; if ($i === $page_num): echo 'active'; else: echo ' '; endif; echo '"><a href="' . $_SERVER['PHP_SELF'] . '?pnum=' . $i . '">' . $i . '</a></li>'; endfor; echo '</ul>'; ?></th></tr>
|
2015-02-25 16:01:50 -05:00
|
|
|
<tr><th><?php echo lang('IN') . " / " . lang('OUT'); ?></th><th><?php echo lang('HOURS'); ?></th><th><?php echo lang('FLAG'); ?></th><th><?php echo lang('NOTES'); ?></th></tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2017-05-11 13:22:44 -04:00
|
|
|
<?php foreach (listPunches($yaptc_db, $session_user["0"]["userid"], $yaptc_rowsperpage, $offset) as $row): ?>
|
2015-02-25 16:01:50 -05:00
|
|
|
<tr>
|
|
|
|
<td><?php echo $row['intime'] . " / " . $row['outtime']; ?></td><td><?php echo $row['punchhours']; ?></td><td><?php echo $row['modified']; ?></td><td><?php echo $row['notes']; ?></td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2015-02-23 03:09:15 -05:00
|
|
|
|
2017-05-11 23:07:56 -04:00
|
|
|
</div>
|
2015-02-25 16:01:50 -05:00
|
|
|
<!-- ********** END CONTENT ********** -->
|
2015-02-24 10:37:52 -05:00
|
|
|
<?php endif; require_once($yaptc_inc . "footer.inc.php"); ?>
|