Mini Shell
<?php
//////////////////////////////////////////////////////////////
//===========================================================
// support_access_theme.php
//===========================================================
// SOFTACULOUS
// Version : 1.1
// Inspired by the DESIRE to be the BEST OF ALL
// ----------------------------------------------------------
// Started by: Alons
// Date: 10th Jan 2009
// Time: 21:00 hrs
// Site: http://www.softaculous.com/ (SOFTACULOUS)
// ----------------------------------------------------------
// Please Read the Terms of use at http://www.softaculous.com
// ----------------------------------------------------------
//===========================================================
// (c)Softaculous Inc.
//===========================================================
//////////////////////////////////////////////////////////////
if(!defined('SITEPAD') && !defined('SITEMUSH')){
die('Hacking Attempt');
}
function support_access_theme(){
global $theme, $globals, $user, $l, $error, $updated, $info, $report, $access_users, $success_msg, $warning_msg;
softheader($l['support_access_head']);
echo '<div class="container-fluid">
<div class="sai_page-title text-center mb-3 mt-3">
<h2>'.$l['support_access'].'</h2>
</div>
</div>';
echo '<div class="container-fluid">';
error_handle($error);
echo '</div>';
if(!empty($success_msg)){
echo '<div class="container-fluid">
<div class="alert alert-success"><i class="fa sai-success fa-lg sai_icons mr-2"></i>
'.$success_msg.'</div>
</div>';
}
if(!empty($warning_msg)){
echo '<div class="container-fluid">
<div class="alert alert-warning"><i class="fa sai-warning fa-lg sai_icons mr-2"></i>
'.$warning_msg.'</div>
</div>';
}
echo '
<div id="stooltip" style="display:none; position:absolute; top: 0px; left: 0px; border: 1px solid #CCC; padding: 8px; background: #FFF; z-index:1000;"></div>
<form accept-charset="'.$globals['charset'].'" name="support_access" method="post" action="" class="form-horizontal">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="sai_form sai_card p-3 mb-3">
<div class="sai_main_head" style="background:transparent">
<span class="mb-2">'.$l['support_access_app'].'</span>
<hr class="sai_main_head_hr"/>
</div>
<div class="col-12 col-md-6 mb-2">
<label for="access_hours" class="sai_head mb-0">'.$l['access_hour'].'</label><br />
<span class="sai_exp2 mb-2">'.$l['access_hour_exp'].'</span>
<div class="input-group">
<input type="text" name="access_hours" class="form-control" id="access_hours" size="10" value="'.POSTval('access_hours').'" />
<div class="input-group-addon">
<span class="input-group-text">'.$l['hour'].'</span>
</div>
</div>
</div>
<div class="col-12 col-md-6 mb-2">
<label for="note" class="sai_head mb-0">'.$l['note_opt'].'</label><br />
<span class="sai_exp2 mb-2">'.$l['note_opt_exp'].'</span>
<input type="text" name="note" class="form-control" id="note" size="10" value="'.POSTval('note').'" />
<input type="submit" name="grant_access" value="'.$l['grant_access'].'" class="flat-butt mt-4"/>
</div>
<br />
<div class="col-12 mb-2">
<p class=""><b>'.$l['note'].'</b>:<br />
'.$l['access_steps_msg'].':<br />
- '.$l['user_privileges_msg'].'<br />
- '.$l['username_msg'].'<br />
- '.$l['unique_public_key_msg'].'<br />
- '.$l['public_key_msg'].'<br />
- '.$l['wheel_user_msg'].'<br />
</p>
</div>
<div class="col-12 mb-2 table-responsive">
<table border="0" cellpadding="5" cellspacing="1" class="soft-table-list table" align="" style="font-size:14px">
<thead class="sai_sub-type">
<tr>
<td><input type="checkbox" onclick="check(document.getElementsByName(\'accessids[]\'), this);" /></td>
<td>'.$l['username'].'</td>
<td>'.$l['access_granted'].'</td>
<td>'.$l['revoke_time'].'</td>
<td>'.$l['ips_allow'].'</td>
<td class="text-center">'.$l['note'].'</td>
<td class="text-center">'.$l['options'].'</td>
</tr>
</thead>';
$i=1;
if(!empty($access_users)){
foreach($access_users as $sk => $sv){
echo '<tr class="'.($i % 2 == 0 ? "sai_evenrowcolor" : "sai_oddrowcolor").'">
<td>
<input type="checkbox" name="accessids[]" id="'.$sk.'" value="'.$sk.'">
</td>
<td>'.$sv['username'].'</td>
<td>'.datify($sv['installed']).'</td>
<td>'.datify($sv['revoke_time']).'</td>
<td>'.implode(', ', $sv['tunnel_ips']).'</td>
'.(!empty($sv['note']) ? '<td width="10%" class="text-center"><i class="fa sai-file px-1 fa-lg" style="cursor:pointer;" onmouseover="showtip(\''.addcslashes(htmlentities($sv['note'], ), "'").'\', this);"></i></td>' : '<td width="10%"> </td>').'
<td class="text-center">
<button type="submit" revoke="'.$sk.'" onclick="return delconf(this);" title="'.$l['revoke'].'" class="text-decoration-none remove-btn">
<i class="fa sai-delete sai_icons" style="color:red;"></i>
</button>
</td>
</tr>';
$i++;
}
}else{
echo '
<tr class="sai_evenrowcolor text-center">
<td colspan="6">
'.$l['create_access_msg'].'
</td>
</tr>';
}
echo '</table>
</div>
<div class="row">
<div class="col-12 col-lg-6 ml-auto mt-4 text-right">
<span class="sai_head">
'.$l['with_selected'].':
<select name="multi_options" id="multi_options" class="form-control d-inline-block w-50">
<option name="todo" id="todo" value="0">---</option>
<option name="todo" id="todo" value="mult_rem">'.$l['revoke_access'].'</option>
</select>
<input type="button" value="'.$l['access_go'].'" onclick="show_confirm()" class="flat-butt">
</span>
</div>
</div>
<div id="rem_div"></div>
</div>
</div>
</div>
</div>
</div>
</form>
<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
accessids = new Array();
removed = new Object();
function show_confirm(){
accessids = new Array();
removed = new Object();
if($_("multi_options").value != "mult_rem"){
return false;
}
// Build the list of access ids to revoke
var field = document.getElementsByName(\'accessids[]\');
accessids = new Array();
var c = 0;
for(i = 0; i < field.length; i++){
if(field[i].checked == true){
accessids[c] = field[i].value;
c++;
}
}
//alert(accessids);
if(c == 0){
alert("'.$l['no_access_user_selected'].'");
return false;
}
var r = confirm("'.$l['confirm_selected_revoke_access'].'");
if(r != true){
return false;
}
remove_by_id(accessids[0], "", 0);
}
function remove_by_id(accessid, re, oldaccessid){
removed[accessid] = false;
if(re.length > 0 && oldaccessid > 0){
if(re == "removed"){
removed[accessid] = true;
}
}
nextaccessid = 0;
// Find the next user to remove
for(i = 0; i < accessids.length; i++){
if(typeof(removed[accessids[i]]) != "undefined"){
continue;
}
nextaccessid = accessids[i];
break;
}
// If there is something left to be removed
if(accessid != 0){
try{
$.ajax({
type: "POST",
url: "'.$globals['index'].'act=support_access&api=json&ajax=1",
data: {
revoke: accessid,
random: Math.random()
},
// Checking for error
success: function(data){
remove_by_id(nextaccessid, data, accessid);
}
});
$_("rem_div").innerHTML = "<br /><br /><p align=\"center\"><img src=\"' . $theme['images'] . 'ajax_remove.gif\"> <br />'.$l['revoking_access']. ': " +accessid+ "<br /></p>";
return true;
}catch(e){
return false;
}
}
$_("rem_div").innerHTML = "";
alert("'.$l['alert_access_revoked'].'");
window.location.href = "'.$globals['index'].'act=support_access";
return true;
}
$(document).ready(function(){
$(".sai_altrowstable tr").mouseover(function(){
var old_class = $(this).attr("class");
//alert(old_class);
$(this).attr("class", "sai_tr_bgcolor");
$(this).mouseout(function(){
$(this).attr("class", old_class);
});
});
});
function showtip(txt, el){
$_("stooltip").innerHTML = txt;
var pos = findelpos(el);
$_("stooltip").style.display = "";
var tipheight = parseInt($_("stooltip").offsetHeight);
var tipwidth = parseInt($_("stooltip").offsetWidth);
//alert(tipheight+" "+tipwidth);
var abody = findelpos($_("abody"));
var bodyWidth = abody[0] + $_("abody").offsetWidth
if((pos[0] + tipwidth) > bodyWidth){
pos[0] = pos[0] - (pos[0] + tipwidth - bodyWidth) + 15;
}
$_("stooltip").style.left = pos[0]+"px";
$_("stooltip").style.top = (pos[1]-5-tipheight)+"px";
el.onmouseout = function(){
hidetip();
};
};
function hidetip(){
$_("stooltip").style.display = "none";
}
function delconf(el){
if(!confirm("'.$l['confirm_revoke_access'].'")){
return false;
}
accessids = new Array();
var accessid = el.getAttribute("revoke");
accessids[0] = accessid;
//alert(accessids);
remove_by_id(accessids[0], "", 0);
return false;
};
// ]]></script>
';
softfooter();
}
Zerion Mini Shell 1.0