| Server IP : 27.254.152.13 / Your IP : 216.73.217.38 Web Server : Apache/2 System : Linux ns1-252017.dragonhispeed.com 5.2.0 #1 SMP Fri Mar 29 22:50:14 MSK 2024 x86_64 User : coloflew ( 1072) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/coloflew/domains/fulltion.com/public_html/administrator/modules/manu_permistion/ |
Upload File : |
<?php
$linkUrl = "index.php?name=manu_permistion&file=usergroup";
if(@$_GET['act']=="add"){
@$arrData = array();
@$idarr = @$db->getOne("admin_permistion","*","","order by Permistion desc","limit 1");
@$id = @$idarr['Permistion'];
@$autoid = @$id+1;
@$lang = @$db->getAll("language","*","","","");
@$arrData['menu_group'] = @$_POST['menu_group'];
@$arrData['status'] = @$_POST['status'];
@$arrData['lang_code'] = 'En';
@$arrData['Permistion'] = @$autoid;
foreach(@$arrData as $k => $v ){
@$arrData[@$k] = str_replace("'", "\'", @$v);
}
//echo "<pre>"; print_r(@$arrData);
//exit;
@$db->insertData("admin_permistion",@$arrData);
//exit;
@$msg = "Save Data complete.";
@$res = true;
}elseif(@$_GET['act']=="editdata"){
@$arrData = array();
@$arrData['menu_group'] = @$_POST['menu_group'];
foreach(@$arrData as $k => $v ){
@$arrData[@$k] = str_replace("'", "\'", @$v);
}
@$db->updateData("admin_permistion",@$arrData," Permistion='".@$_POST['Permistion']."'");
@$db->deleteData("permission","personnel_id='".@$_POST['Permistion']."' ", @$option);
//@$db->insertData("permistion",@$arrData);
if(count(@$_POST['menuid'])){
foreach($_POST['menuid'] as $key => $val) {
@$arrData = @$db->getOne( "permission_mainmenu", "menuid,tag", "menuid=".@$val);
@$resDataServ =array();
@$resDataServ['personnel_id'] = @$_POST['Permistion'];
@$resDataServ['sub_idfn'] = @$arrData['menuid'];
@$resDataServ['tags'] = @$arrData['tag'];
@$resDataServ['flg'] = '1';
if(@$val){
@$resDataServ['status'] = "yes";
}else{
@$resDataServ['status'] = "no";
}
@$db->insertData("permission", @$resDataServ);
}
}
if(count(@$_POST['subVal'])){
foreach(@$_POST['subVal'] as $key => $val) {
@$arrData = @$db->getOne( "permistion_submenu", "submenuid,name", "submenuid=".@$val);
@$resDataServ =array();
@$resDataServ['personnel_id'] = @$_POST['Permistion'];
@$resDataServ['sub_idfn'] = @$arrData['submenuid'];
@$resDataServ['tags'] = @$arrData['name'];
@$resDataServ['flg'] = '1';
if(@$val){
@$resDataServ['status'] = "yes";
}else{
@$resDataServ['status'] = "no";
}
@$db->insertData("permission", @$resDataServ);
@$new_id++;
}
}
@$msg = "Edit Data complete.";
@$res = true;
}elseif(@$_GET['act']=="edit"){
@$arrRes = @$db->getOne("admin_permistion","*"," Permistion='".@$_GET['Permistion']."'");
@$data_personnel = @$_GET['Permistion'];
if(@$data_personnel){
@$permission_menu = @$db->getAll( "permission_mainmenu", '*', "", "", "");
foreach(@$permission_menu as $key0=>$val0){
@$menu_permission = @$db->getOne( "permission", '*', " tags='".@$val0['tag']."' AND personnel_id='".@$data_personnel."' AND flg ='1' ", "", "");
if(@$menu_permission){ @$permission_menu[@$key0]["checked"] ="checked"; }
else{ @$permission_menu[@$key0]["checked"] =""; }
if(count(@$permission_menu)){
foreach(@$permission_menu as $key => $val){
@$permission_main = @$db->getAll( "permistion_submenu", '*', " mainmenuid='".@$val['menuid']."' ", "", "");
if(count(@$permission_main)){
foreach(@$permission_main as $key0=>$val1){
@$m_permission = @$db->getOne( "permission", '*', " tags='".@$val1['name']."' AND personnel_id='".@$data_personnel['id']."' AND flg ='1' ", "", "");
if(@$m_permission){ @$permission_main[@$key0]["checked"] ="checked"; }
else{ @$permission_main[@$key0]["checked"] =""; }
}
@$permission_menu[@$key]['permistion_submenu'] = @$permission_main;
}
}
//@$permission_menu[@$key0]['permistion_submenu'] = @$permission_main;
//if(count(@$permission_main)){
// foreach(@$permission_main as $key => $val){
// @$permission_sub = @$db->getAll( "permission_submenufunction", '*', " submenuid='".@$val['submenuid']."' ", "", "");
//
// if(count(@$permission_sub)){
// foreach(@$permission_sub as @$key1=>@$val1){
// @$m_permission = @$db->getOne( "permission", '*', " tags='".@$val1['tag']."' AND personnel_id='". @$data_personnel['id']."' AND flg ='0' ", "", "");
// if(@$m_permission){ @$permission_sub[@$key1]["checked"] ="checked"; }
// else{ @$permission_sub[@$key1]["checked"] =""; }
// }
// @$permission_main[@$key]['permission_submenufunction'] = @$permission_sub;
// }
// }
// @$permission_menu[@$key0]['permistion_submenu'] = @$permission_main;
}
}
}
}elseif(@$_GET['act']=="deletedata"){
@$db->deleteData("admin_permistion"," Permistion='".@$_GET['Permistion']."'");
@$msg = "Delete Data complete.";
@$res = true;
}elseif(@$_GET['act']=="deleteAll"){
//echo "<pre>"; print_r(@$_POST);
if(count(@$_POST['pagedel']) > 0){
foreach(@$_POST['pagedel'] as $key => $val){
@$db->deleteData("admin_permistion"," Permistion='".@$val."'");
}
}
@$msg = "Delete Data complete.";
@$res = true;
}
@$where_f = "lang_code='".@$lang_code."'";
@$page = @$_GET['page'] ? @$_GET['page'] : 1;
@$arrpageP = @$db->getAll("admin_permistion","*","","");
@$arrPage = @$objMaster->viewPages(@$page, @$arrpageP, "15");
@$getPage = @$db->getAll("admin_permistion","*","","",@$arrPage["offset"]);
//echo '<pre>'; print_r(@$permission_main);
//echo '<pre>'; print_r(@$permission_menu);
//echo "<pre>"; print_r(@$getPage);
?>
<!-- Start Content Box -->
<div class="content-box">
<!-- Start Content Box Header-->
<div class="content-box-header">
<h3><?php echo @$lang_set['grouptitle']; ?></h3>
<ul class="content-box-tabs">
<li><a href="#list" <?php echo (@$_GET['act']=="" ? 'class="default-tab"' : '');?>><?php echo @$lang_set['group_list']; ?></a></li> <!-- href must be unique and match the id of target div -->
<li><a href="#add" <?php echo (@$_GET['act']=="edit" ? 'class="default-tab"' : '');?>><?php echo @$lang_set['add_group']; ?></a></li>
</ul>
<div class="clear"></div>
</div>
<!-- End Content Box Header-->
<!-- Start Content Box Content-->
<div class="content-box-content">
<?php if(@$res){?>
<div class="notification success png_bg">
<a href="#" class="close"><img src="resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
<div>
<?php echo @$msg;?>
</div>
</div>
<meta http-equiv="refresh" content="1;URL=<?php echo $linkUrl;?>&Permistion=<?php echo @$_GET['Permistion']?>">
<?php }?>
<!-- Start Tab Content id="list"-->
<div class="tab-content <?php echo (@$_GET['act']=="" ? 'default-tab' : '');?>" id="list">
<form action="<?php echo $linkUrl;?>&permistion=<?php echo @$_GET['Permistion']?>&act=deleteAll" method="post" onsubmit="return confirmDelete(this);">
<table cellpadding="0" cellspacing="0" width="100%">
<thead>
<tr>
<th><input type="checkbox" class="check_all" /></th>
<th><?php echo @$lang_set['menu_group']; ?></th>
<th style="text-align:right;"><?php echo @$lang_set['groupstatus']; ?></th>
<th style="text-align:right;"><?php echo @$lang_set['action']; ?></th>
</tr>
</thead>
<?php
if(@$getPage){
foreach(@$getPage as $key => $val){
?>
<tr>
<th><input type="checkbox" name="pagedel[]" value="<?php echo @$val['Permistion'];?>"/></th>
<th><?php echo @$val['menu_group'];?></th>
<th style="text-align:right;">
<select name="status" onchange="AJAX_Update_status('admin_permistion','status',this.options[this.selectedIndex].value,'<?php echo @$val['Permistion']?>','Permistion');">
<option value="1" <?php echo (@$val['status']=="1" ? "selected" : "");?>><?php echo @$lang_set['show']; ?></option>
<option value="0" <?php echo (@$val['status']=="0" ? "selected" : "");?>><?php echo @$lang_set['hide']; ?></option>
</select></th>
<th style="text-align:right;">
<a href="<?php echo $linkUrl;?>&permistion=<?php echo @$_GET['Permistion']?>&act=edit&Permistion=<?php echo @$val['Permistion']?>#add" title="Edit"><img src="resources/images/icons/pencil.png" alt="Edit" /></a>
<?PHP if(@$val['Permistion'] != '4'){?>
|
<a href="javascript:void();" title="Delete" onclick="chkConfirm('<?php echo $linkUrl;?>&permistion=<?php echo @$_GET['Permistion']?>&act=deletedata&Permistion=<?php echo @$val['Permistion']?>','ยืนยันการลบข้อมูล');"><img src="resources/images/icons/cross.png" alt="Delete" /></a>
<?PHP }?>
</th>
</tr>
<?php
}
}else{
?>
<tr>
<th colspan="11" style="text-align:center"><?php echo @$lang_set['not_data']; ?></th>
</tr>
<?php
}
?>
<tfoot>
<tr>
<td colspan="11">
<div class="bulk-actions align-left">
<select name="actdel">
<option value="del"><?php echo @$lang_set['delete']; ?></option>
</select>
<input class="button" type="submit" value="<?php echo @$lang_set['selected']; ?>" />
</div>
<!-- Start .pagination -->
<div class="pagination">
<?php if($arrPage['allpage']>1){?>
<a href="<?php echo $linkUrl;?>&page=1&keyword=<?PHP echo @$search;?>" title="หน้าแรก">« หน้าแรก</a><a href="<?php echo $linkUrl;?>&page=<?php echo (1==$page ? $page : @$page-1);?>&keyword=<?PHP echo @$search;?>" title="ก่อนหน้า">« ก่อนหน้า</a>
<?php if( @$arrPage["startPage"]!="" && @$arrPage["endPage"] !="" ){?>
<?php
for($i = @$arrPage["startPage"]; $i <= @$arrPage["endPage"]; ++$i) {
echo'<a href="'. $linkUrl.'&keyword='.@$search.'&page='.@$i.'" '.(@$page == @$i ? 'class="number current"' : '').'>'.(@$i).'</a>';
}?>
<?php }?>
<a href="<?php echo $linkUrl;?>&page=<?php echo ($page==$arrPage["allpage"] ? $page : $page+1);?>&keyword=<?PHP echo @$search;?>" title="ถัดไป">ถัดไป »</a><a href="<?php echo $linkUrl;?>&page=<?php echo @$arrPage["allpage"];?>&keyword=<?PHP echo @$search;?>" title="หน้าสุดท้าย">หน้าสุดท้าย »</a>
<?php }?>
</div>
<!-- End .pagination -->
<div class="clear"></div>
</td>
</tr>
</tfoot>
</table>
</form>
</div>
<!-- End Tab Content id="list"-->
<!-- Start Tab Content id="add"-->
<div class="tab-content <?php echo (@$_GET['act']=="edit" ? 'default-tab' : '');?>" id="add">
<form action="<?php echo $linkUrl;?>&permistion=<?php echo @$_GET['Permistion']?>&act=<?php echo (@$_GET['act']=="edit" ? "editdata" : "add");?>#add" method="post" enctype="multipart/form-data" onsubmit="return checkpageusergroup();"><!--onsubmit="return checkdelivery();"-->
<fieldset>
<input type="hidden" name="Permistion" value="<?php echo @$_GET['Permistion'];?>">
<p>
<label><?php echo @$lang_set['menu_group']; ?>:</label>
<input type="text" class="text-input medium-input" name="menu_group" id="menu_group" value="<?php echo @$arrRes['menu_group'];?>" /> </p><p>
<table>
<?php if(@$permission_menu){
foreach(@$permission_menu as $mainKey => $mainVal){
?><tr><td>
<p>
<input type="checkbox" name="menuid[<?php echo @$mainVal['menuid'];?>]" value="<?php echo @$mainVal['menuid'];?>" <?php echo (@$mainVal['checked']=="checked" ? "checked" : "");?> /> <B><?php echo @$lang_set[@$mainVal['name']]?></B>
<?php if(@$mainVal['permistion_submenu']){
foreach(@$mainVal['permistion_submenu'] as $subKey => $subVal){
?>
<p>
<input type="checkbox" name="subVal[<?php echo @$subVal['submenuid'];?>]" value="<?php echo @$subVal['submenuid'];?>" <?php echo (@$subVal['checked']=="checked" ? "checked" : "");?> style="margin-left:80px;" /> <?php echo @$lang_set[@$subVal['name']]?>
<?php }
}
?>
</p></td></tr>
<?php }
}
?></table>
<!--<span class="input-notification error png_bg" id="span_name"></span>--></p>
<p>
<p>
<input type="submit" class="button" value="<?php echo @$lang_set['submit']; ?>" />
</p>
</fieldset>
</form>
</div>
<!-- End Tab Content id="add"-->
</div>