Initial commit
This commit is contained in:
235
production/admin/sources/adminusers/administrators.inc.php
Normal file
235
production/admin/sources/adminusers/administrators.inc.php
Normal file
@@ -0,0 +1,235 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| administrators.inc.php
|
||||
| ========================================
|
||||
| Manage Administrators
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (!defined('CC_INI_SET')) die("Access Denied");
|
||||
|
||||
$lang = getLang("admin".CC_DS."admin_adminusers.inc.php");
|
||||
|
||||
permission('administrators', 'read', true);
|
||||
|
||||
$rowsPerPage = 25;
|
||||
|
||||
if (isset($_GET["delete"]) && $_GET["delete"]>0){
|
||||
|
||||
$where = 'adminId='.$db->mySQLSafe($_GET['delete']);
|
||||
$delete = $db->delete($glob['dbprefix'].'CubeCart_admin_users', $where);
|
||||
$deletePerms = $db->delete($glob['dbprefix'].'CubeCart_admin_permissions', $where);
|
||||
|
||||
if ($delete) {
|
||||
$msg = '<p class="infoText">'.$lang['admin']['adminusers_del_success'].'</p>';
|
||||
} else {
|
||||
$msg = '<p class="warnText">'.$lang['admin']['adminusers_del_failed'].'</p>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if (isset($_POST['adminId'])) {
|
||||
|
||||
$record["name"] = $db->mySQLSafe($_POST['name']);
|
||||
$record["username"] = $db->mySQLSafe($_POST['adminUsername']);
|
||||
|
||||
if(!empty($_POST['adminPassword'])){
|
||||
$record["password"] = $db->mySQLSafe(md5($_POST['adminPassword']));
|
||||
}
|
||||
|
||||
$record["notes"] = $db->mySQLSafe($_POST['notes']);
|
||||
$record["email"] = $db->mySQLSafe($_POST['email']);
|
||||
$record["isSuper"] = $db->mySQLSafe($_POST['isSuper']);
|
||||
|
||||
if($_POST['adminId']>0) {
|
||||
$where = "adminId=".$db->mySQLSafe($_POST['adminId']);
|
||||
$update = $db->update($glob['dbprefix']."CubeCart_admin_users", $record, $where);
|
||||
unset($record, $where);
|
||||
|
||||
if($update == TRUE)
|
||||
{
|
||||
|
||||
$msg = "<p class='infoText'>'".$_POST['name']."' ".$lang['admin']['adminusers_update_success']."</p>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$msg = "<p class='warnText'>".$lang['admin']['adminusers_update_fail']."</p>";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$insert = $db->insert($glob['dbprefix']."CubeCart_admin_users", $record);
|
||||
unset($record);
|
||||
|
||||
if($insert == TRUE)
|
||||
{
|
||||
|
||||
$msg = "<p class='infoText'>'".$_POST['name']."' ".$lang['admin']['adminusers_add_success']."</p>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$msg = "<p class='warnText'>".$lang['admin']['adminusers_add_failed']."</p>";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($_GET['mode'])){
|
||||
|
||||
// make sql query
|
||||
if(isset($_GET['edit']) && $_GET['edit']>0){
|
||||
$query = sprintf("SELECT * FROM ".$glob['dbprefix']."CubeCart_admin_users WHERE adminId = %s", $db->mySQLSafe($_GET['edit']));
|
||||
} else {
|
||||
|
||||
$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_admin_users ORDER BY isSuper DESC";
|
||||
}
|
||||
|
||||
if(isset($_GET['page'])){
|
||||
|
||||
$page = $_GET['page'];
|
||||
|
||||
} else {
|
||||
|
||||
$page = 0;
|
||||
|
||||
}
|
||||
|
||||
// query database
|
||||
$results = $db->select($query, $rowsPerPage, $page);
|
||||
$numrows = $db->numrows($query);
|
||||
$pagination = paginate($numrows, $rowsPerPage, $page, "page");
|
||||
}
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
?>
|
||||
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td nowrap='nowrap'><p class="pageTitle"><?php echo $lang['admin']['adminusers_administrators_title'];?></p></td>
|
||||
<?php if(!isset($_GET["mode"]) && permission("users","add")==TRUE){ ?><td align="right" valign="middle"><a href="<?php echo $glob['adminFile']; ?>?_g=adminusers/administrators&mode=new" class="txtLink"><img src="<?php echo $glob['adminFolder']; ?>/images/buttons/new.gif" alt="" hspace="4" border="0" title="" /><?php echo $lang['admin_common']['add_new'];?></a></td><?php } ?>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
if(isset($msg))
|
||||
{
|
||||
echo msg($msg);
|
||||
}
|
||||
|
||||
if(!isset($_GET["mode"]) && !isset($_GET['edit'])){
|
||||
?>
|
||||
<p class="copyText"><?php echo $lang['admin']['adminusers_current_users'];?></p>
|
||||
<p class="copyText"><?php echo $pagination; ?></p>
|
||||
<table width="100%" border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td class="tdTitle"><?php echo $lang['admin']['adminusers_id'];?></td>
|
||||
<td class="tdTitle"><?php echo $lang['admin']['adminusers_user_notes'];?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin']['adminusers_no_logins'];?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin']['adminusers_super_user'];?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin']['adminusers_email'];?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin']['adminusers_action'];?></td>
|
||||
</tr>
|
||||
<?php
|
||||
for($i=0; $i<count($results); $i++) {
|
||||
|
||||
$cellColor = "";
|
||||
$cellColor = cellColor($i);
|
||||
?>
|
||||
<tr>
|
||||
<td class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo $results[$i]['adminId']; ?>.</span></td>
|
||||
<td class="<?php echo $cellColor; ?>"><span class="copyText"><strong><?php echo $results[$i]['username']; ?></strong><?php if(!empty($results[$i]['notes'])) { echo " - ".$results[$i]['notes']; } ?></span></td>
|
||||
<td align="center" class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo $results[$i]['noLogins']; ?></span></td>
|
||||
<td align="center" class="<?php echo $cellColor; ?>"><img src="<?php echo $glob['adminFolder']; ?>/images/<?php echo $results[$i]['isSuper']; ?>.gif" alt="" title="" /></td>
|
||||
<td align="center" class="<?php echo $cellColor; ?>"><a href="mailto:<?php echo $results[$i]['ipAddress']; ?>" class="txtLink"><?php echo $results[$i]['email']; ?></a></td>
|
||||
<td align="center" class="<?php echo $cellColor; ?>">
|
||||
<?php if(permission("users","edit")==TRUE){ ?>
|
||||
<a href="<?php echo $glob['adminFile']; ?>?_g=adminusers/administrators&edit=<?php echo $results[$i]['adminId']; ?>" class="txtLink"><?php echo $lang['admin_common']['edit']; ?></a> /
|
||||
<?php } if(permission("users","delete")==TRUE) { ?>
|
||||
<a href="javascript:decision('<?php echo $lang['admin_common']['delete_q']; ?>','<?php echo $glob['adminFile']; ?>?_g=adminusers/administrators&delete=<?php echo $results[$i]['adminId']; ?>');" class="txtLink"><?php echo $lang['admin_common']['delete']; ?></a>
|
||||
<?php } if(permission("users","edit")==TRUE && $results[$i]['isSuper']==0) { ?>
|
||||
/ <a href="<?php echo $glob['adminFile']; ?>?_g=adminusers/permissions&adminId=<?php echo $results[$i]['adminId']; ?>" class="txtLink"><?php echo $lang['admin']['adminusers_permissions'];?></a> <?php } ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
</table>
|
||||
<p class="copyText"><?php echo $pagination; ?></p>
|
||||
|
||||
|
||||
<?php
|
||||
} elseif($_GET["mode"]=="new" || $_GET["edit"]>0){
|
||||
|
||||
if(isset($_GET["edit"]) && $_GET["edit"]>0){ $modeTxt = $lang['admin_common']['edit']; } else { $modeTxt = $lang['admin_common']['add']; }
|
||||
?>
|
||||
<p class="copyText"><?php echo $lang['admin']['adminusers_add_admin'];?></p>
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=adminusers/administrators" method="post" enctype="multipart/form-data" name="form1">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle"><?php if(isset($_GET["edit"]) && $_GET["edit"]>0){ echo $modeTxt; } else { echo $modeTxt; } echo ' '.$lang['admin']['adminusers_administrator']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="25%" class="tdText"><strong><?php echo $lang['admin']['adminusers_full_name']; ?></strong></td>
|
||||
<td>
|
||||
<input name="name" type="text" class="textbox" value="<?php if(isset($results[0]['name'])) echo $results[0]['name']; ?>" maxlength="255" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="25%" class="tdText"><strong><?php echo $lang['admin']['adminusers_username']; ?></strong><br />
|
||||
</td>
|
||||
<td><input name="adminUsername" type="text" class="textbox" value="<?php if(isset($results[0]['username'])) echo $results[0]['username']; ?>" maxlength="255" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="25%" class="tdText"><strong><?php echo $lang['admin']['adminusers_email2']; ?></strong></td>
|
||||
<td><input name="email" value="<?php if(isset($results[0]['email'])) echo $results[0]['email']; ?>" type="text" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tdText"><strong><?php echo $lang['admin']['adminusers_password']; ?></strong><br />
|
||||
<?php echo $lang['admin']['adminusers_pass_warn']; ?></td>
|
||||
<td class="tdText"><input type="password" name="adminPassword" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tdText"><?php echo $lang['admin']['adminusers_make_super']; ?></td>
|
||||
<td class="tdText">
|
||||
<?php echo $lang['admin_common']['yes']; ?>
|
||||
<input name="isSuper" type="radio" value="1" <?php if(isset($results[0]['isSuper']) && $results[0]['isSuper']==1) { echo "checked='checked'"; } ?> />
|
||||
<?php echo $lang['admin_common']['no']; ?>
|
||||
<input name="isSuper" type="radio" value="0" <?php if(isset($results[0]['isSuper']) && $results[0]['isSuper']==0) echo "checked='checked'"; if(isset($_GET['mode']) && $_GET['mode']=="new") { echo "checked='checked'"; } ?> /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top" class="tdText"><strong><?php echo $lang['admin']['adminusers_notes']; ?></strong></td>
|
||||
<td><textarea name="notes" class="textbox" cols="60" rows="3" id="notes"><?php if(isset($results[0]['notes'])) echo $results[0]['notes']; ?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="25%"> </td>
|
||||
<td>
|
||||
<input type="hidden" name="adminId" value="<?php if(isset($results[0]['adminId'])) echo $results[0]['adminId']; ?>" />
|
||||
<input name="Submit" type="submit" class="submit" value="<?php if(isset($_GET["edit"]) && $_GET["edit"]>0){ echo $modeTxt; } else { echo $modeTxt; } ?> User" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
77
production/admin/sources/adminusers/changePass.inc.php
Normal file
77
production/admin/sources/adminusers/changePass.inc.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| changePass.inc.php
|
||||
| ========================================
|
||||
| Change Admin Password
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if(!defined('CC_INI_SET')) { die("Access Denied"); }
|
||||
|
||||
$lang = getLang("admin".CC_DS."admin_adminusers.inc.php");
|
||||
|
||||
if(isset($_POST['oldPass']) && isset($_POST['newPass']) && isset($_POST['confirmPass'])){
|
||||
|
||||
$query = sprintf("SELECT adminId FROM ".$glob['dbprefix']."CubeCart_admin_users WHERE password = %s AND adminId = %s",
|
||||
$db->mySQLSafe(md5($_POST['oldPass'])),
|
||||
$db->mySQLSafe($ccAdminData['adminId']));
|
||||
|
||||
$result = $db->select($query);
|
||||
|
||||
|
||||
if($result == TRUE) {
|
||||
$data['password'] = $db->mySQLSafe(md5($_POST['newPass']));
|
||||
$update = $db->update($glob['dbprefix']."CubeCart_admin_users",$data,"adminId=".$result[0]['adminId']);
|
||||
$msg = "<p class='infoText'>".$lang['admin']['adminusers_pass_updated']."</p>";
|
||||
} else {
|
||||
$msg = "<p class='warnText'>".$lang['admin']['adminusers_pass_not_updated']."</p>";
|
||||
}
|
||||
}
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
if(isset($msg)){
|
||||
echo msg($msg);
|
||||
}
|
||||
?>
|
||||
<p class="pageTitle"><?php echo $lang['admin']['adminusers_change_password']; ?></p>
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=adminusers/changePass" method="post" enctype="multipart/form-data" name="login" target="_self">
|
||||
<table border="0" align="center" cellpadding="3" cellspacing="1" class="mainTable">
|
||||
<tr>
|
||||
<td colspan="2" class="tdTitle"><?php echo $lang['admin']['adminusers_change_pass_below']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tdText"><?php echo $lang['admin']['adminusers_old_pass']; ?></td>
|
||||
<td><input name="oldPass" type="password" id="oldPass" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tdText"><?php echo $lang['admin']['adminusers_new_pass']; ?></td>
|
||||
<td><input name="newPass" type="password" id="newPass" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tdText"><?php echo $lang['admin']['adminusers_confirm_pass']; ?></td>
|
||||
<td><input name="confirmPass" type="password" id="confirmPass" class="textbox" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input name="login" type="submit" class="submit" id="login" value="<?php echo $lang['admin']['adminusers_update_pass']; ?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
76
production/admin/sources/adminusers/logs.inc.php
Normal file
76
production/admin/sources/adminusers/logs.inc.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| logs.inc.php
|
||||
| ========================================
|
||||
| Logs admin actions
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
$lang = getLang("admin".CC_DS."admin_adminusers.inc.php");
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
$rowsPerPage = 50;
|
||||
?>
|
||||
<p class="pageTitle"><?php echo $lang['admin']['adminusers_admin_logs'];?></p>
|
||||
|
||||
<table width="100%" border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td class="tdTitle"><?php echo $lang['admin']['adminusers_id'];?></td>
|
||||
<td class="tdTitle"><?php echo $lang['admin']['adminusers_username2'];?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin']['adminusers_admin_log'];?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin']['adminusers_admin_log_time'];?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin']['adminusers_admin_log_ip'];?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
if(isset($_GET['page'])){
|
||||
$page = $_GET['page'];
|
||||
} else {
|
||||
$page = 0;
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_admin_log ORDER BY `time` DESC";
|
||||
$results = $db->select($query, $rowsPerPage, $page);
|
||||
$numrows = $db->numrows($query);
|
||||
|
||||
if($results == TRUE){
|
||||
|
||||
for($i=0; $i<count($results); $i++) {
|
||||
|
||||
$cellColor = "";
|
||||
$cellColor = cellColor($i);
|
||||
?>
|
||||
<tr>
|
||||
<td class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo $results[$i]['id']; ?>.</span></td>
|
||||
<td class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo $results[$i]['user']; ?></span></td>
|
||||
<td align="left" class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo $results[$i]['desc']; ?></span></td>
|
||||
<td align="center" class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo formatTime($results[$i]['time']); ?></span></td>
|
||||
<td align="center" class="<?php echo $cellColor; ?>"><a href="javascript:;" class="txtLink" onclick="openPopUp('<?php echo $glob['adminFile']; ?>?_g=misc/lookupip&ip=<?php echo $results[$i]['ipAddress']; ?>','misc',300,130,'yes,resizable=yes')"><?php echo $results[$i]['ipAddress']; ?></a></td>
|
||||
</tr>
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
<p class="copyText"><?php echo paginate($numrows, $rowsPerPage, $page, "page"); ?></p>
|
||||
109
production/admin/sources/adminusers/permissions.inc.php
Normal file
109
production/admin/sources/adminusers/permissions.inc.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| permissions.inc.php
|
||||
| ========================================
|
||||
| Set Admin Users Permissions
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
$lang = getLang("admin".CC_DS."admin_adminusers.inc.php");
|
||||
|
||||
permission("administrators","read",$halt=TRUE);
|
||||
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
|
||||
if($_POST['noSections']>0)
|
||||
{
|
||||
|
||||
// delete all current permissions to replace them
|
||||
$delete = $db->delete($glob['dbprefix']."CubeCart_admin_permissions","adminId=".$db->mySQLSafe($_POST['adminId']));
|
||||
|
||||
for($i=0; $i<=$_POST['noSections']; $i++){
|
||||
|
||||
$data['sectId'] = $db->mySQLSafe($_POST['sectId'.$i]);
|
||||
$data['read'] = $db->mySQLSafe($_POST['read'.$i]);
|
||||
$data['write'] = $db->mySQLSafe($_POST['write'.$i]);
|
||||
$data['edit'] = $db->mySQLSafe($_POST['edit'.$i]);
|
||||
$data['delete'] = $db->mySQLSafe($_POST['delete'.$i]);
|
||||
$data['adminId'] = $db->mySQLSafe($_POST['adminId']);
|
||||
$insert = $db->insert($glob['dbprefix']."CubeCart_admin_permissions",$data);
|
||||
|
||||
}
|
||||
|
||||
$msg = "<p class='infoText'>".$lang['admin']['adminusers_perms_updated']."</p>";
|
||||
|
||||
}
|
||||
?>
|
||||
<p class="pageTitle"><?php echo $lang['admin']['adminusers_permissions']; ?></p>
|
||||
<?php
|
||||
if(isset($msg))
|
||||
{
|
||||
echo msg($msg);
|
||||
}
|
||||
?>
|
||||
<p class="copyText"><?php echo $lang['admin']['adminusers_set_perms']; ?></p>
|
||||
<form action="<?php echo $glob['adminFile']; ?>?_g=adminusers/permissions&adminId=<?php echo $_GET['adminId']; ?>" method="post" enctype="multipart/form-data" target="_self">
|
||||
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td class="tdTitle"><?php echo $lang['admin']['adminusers_section']; ?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin_common']['read']; ?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin_common']['write']; ?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin_common']['edit']; ?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin_common']['delete']; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$sectionsQuery = "SELECT * FROM ".$glob['dbprefix']."CubeCart_admin_sections";
|
||||
$sectionsResult = $db->select($sectionsQuery);
|
||||
|
||||
if($sectionsResult == TRUE) {
|
||||
|
||||
for($i=0; $i<count($sectionsResult); $i++) {
|
||||
|
||||
|
||||
$permissionsQuery = "SELECT * FROM ".$glob['dbprefix']."CubeCart_admin_permissions WHERE adminId = ".$db->mySQLSafe($_GET['adminId'])." AND sectId = ".$db->mySQLSafe($sectionsResult[$i]['sectId']);
|
||||
$permissionsResult = $db->select($permissionsQuery);
|
||||
|
||||
$cellColor = "";
|
||||
$cellColor = cellColor($i);
|
||||
?>
|
||||
<tr>
|
||||
<td class="<?php echo $cellColor; ?>"><span class="copyText"><strong><?php echo ucfirst($sectionsResult[$i]['name']); ?></strong> - <?php echo $sectionsResult[$i]['description']; ?></span><input type="hidden" name="sectId<?php echo $i; ?>" value="<?php echo $sectionsResult[$i]['sectId']; ?>" /></td>
|
||||
<td align="center" valign="middle" class="<?php echo $cellColor; ?>"><input name="read<?php echo $i; ?>" type="checkbox" value="1" <?php if($permissionsResult[0]['read']==1) { echo "checked='checked'"; } ?> /></td>
|
||||
<td align="center" valign="middle" class="<?php echo $cellColor; ?>"><input name="write<?php echo $i; ?>" type="checkbox" value="1" <?php if($permissionsResult[0]['write']==1) { echo "checked='checked'"; } ?> /></td>
|
||||
<td align="center" valign="middle" class="<?php echo $cellColor; ?>"><input name="edit<?php echo $i; ?>" type="checkbox" value="1" <?php if($permissionsResult[0]['edit']==1) { echo "checked='checked'"; } ?> /></td>
|
||||
<td align="center" valign="middle" class="<?php echo $cellColor; ?>"><input name="delete<?php echo $i; ?>" type="checkbox" value="1" <?php if($permissionsResult[0]['delete']==1) { echo "checked='checked'"; } ?> /></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="5" align="right">
|
||||
<input type="hidden" value="<?php echo $_GET['adminId']; ?>" name="adminId" />
|
||||
<input type="hidden" value="<?php echo $i; ?>" name="noSections" />
|
||||
<input name="Submit" type="submit" class="submit" id="Submit" value="Update Permissions" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<span class="copyText"><?php echo $lang['admin']['adminusers_nb_bulk']; ?></span>
|
||||
76
production/admin/sources/adminusers/sessions.inc.php
Normal file
76
production/admin/sources/adminusers/sessions.inc.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| CubeCart 4
|
||||
| ========================================
|
||||
| CubeCart is a registered trade mark of Devellion Limited
|
||||
| Copyright Devellion Limited 2006. All rights reserved.
|
||||
| Devellion Limited,
|
||||
| 5 Bridge Street,
|
||||
| Bishops Stortford,
|
||||
| HERTFORDSHIRE.
|
||||
| CM23 2JU
|
||||
| UNITED KINGDOM
|
||||
| http://www.devellion.com
|
||||
| UK Private Limited Company No. 5323904
|
||||
| ========================================
|
||||
| Web: http://www.cubecart.com
|
||||
| Email: info (at) cubecart (dot) com
|
||||
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
|
||||
| Licence Info: http://www.cubecart.com/site/faq/license.php
|
||||
+--------------------------------------------------------------------------
|
||||
| sessions.inc.php
|
||||
| ========================================
|
||||
| Lists last x amount of admin logins
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if(!defined('CC_INI_SET')){ die("Access Denied"); }
|
||||
|
||||
$lang = getLang("admin".CC_DS."admin_adminusers.inc.php");
|
||||
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
|
||||
$rowsPerPage = 50;
|
||||
?>
|
||||
<p class="pageTitle"><?php echo $lang['admin']['adminusers_admin_sessions']; ?></p>
|
||||
|
||||
<p class="copyText"><?php echo $lang['admin']['adminusers_sessions_desc']; ?></p>
|
||||
<table width="100%" border="0" cellspacing="1" cellpadding="3" class="mainTable">
|
||||
<tr>
|
||||
<td class="tdTitle"><?php echo $lang['admin']['adminusers_login_id']; ?></td>
|
||||
<td class="tdTitle"><?php echo $lang['admin']['adminusers_username']; ?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin']['adminusers_time']; ?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin']['adminusers_ip_address']; ?></td>
|
||||
<td align="center" class="tdTitle"><?php echo $lang['admin']['adminusers_success']; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
if(isset($_GET['page'])){
|
||||
$page = $_GET['page'];
|
||||
} else {
|
||||
$page = 0;
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_admin_sessions ORDER BY `time` DESC";
|
||||
$results = $db->select($query, $rowsPerPage, $page);
|
||||
$numrows = $db->numrows($query);
|
||||
|
||||
if($results == TRUE){
|
||||
|
||||
for($i=0; $i<count($results); $i++) {
|
||||
|
||||
$cellColor = "";
|
||||
$cellColor = cellColor($i);
|
||||
?>
|
||||
<tr>
|
||||
<td class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo $results[$i]['loginId']; ?>.</span></td>
|
||||
<td class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo $results[$i]['username']; ?></span></td>
|
||||
<td align="center" class="<?php echo $cellColor; ?>"><span class="copyText"><?php echo formatTime($results[$i]['time']); ?></span></td>
|
||||
<td align="center" class="<?php echo $cellColor; ?>"><a href="javascript:;" class="txtLink" onclick="openPopUp('<?php echo $glob['adminFile']; ?>?_g=misc/lookupip&ip=<?php echo $results[$i]['ipAddress']; ?>','misc',300,130,'yes,resizable=yes')"><?php echo $results[$i]['ipAddress']; ?></a></td>
|
||||
<td align="center" class="<?php echo $cellColor; ?>"><img src="<?php echo $glob['adminFolder']; ?>/images/<?php echo $results[$i]['success']; ?>.gif" alt="" title="" /></td>
|
||||
</tr>
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
<p class="copyText"><?php echo paginate($numrows, $rowsPerPage, $page, "page"); ?></p>
|
||||
Reference in New Issue
Block a user