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
|
<?php
function sshAccountsCallback ($id){
global $pro_mysql_ssh_table;
global $conf_dtc_system_uid;
global $conf_dtc_system_gid;
$q = "UPDATE $pro_mysql_ssh_table SET uid='$conf_dtc_system_uid',gid='$conf_dtc_system_gid' WHERE id='$id';";
$r = mysql_query($q)or die("Cannot query \"$q\" line ".__LINE__." file ".__FILE__." sql said: ".mysql_error());
return "";
}
////////////////////////////////////////////////////
// One domain name ssh account collection edition //
////////////////////////////////////////////////////
function drawAdminTools_SSH($domain,$adm_path){
global $adm_login;
global $adm_pass;
global $edit_domain;
global $edssh_account;
global $addrlink;
global $conf_hide_password;
global $conf_domain_based_ssh_logins;
global $pro_mysql_ssh_table;
$txt = "";
// Build the popup values and display values arrays
$path_popup_vals = array();
$path_popup_disp = array();
//$path_popup_vals[] = "$adm_path";
//$path_popup_disp[] = "/ [ uses www ]";
//$path_popup_vals[] = "$adm_path/$edit_domain";
//$path_popup_disp[] = "/$edit_domain [ uses www ]";
$nbr_subdomains = sizeof($domain["subdomains"]);
for($i=0;$i<$nbr_subdomains;$i++){
$sub_name = $domain["subdomains"][$i]["name"];
$path_popup_vals[] = "$adm_path/$edit_domain/subdomains/$sub_name";
$path_popup_disp[] = "/$edit_domain/subdomains/$sub_name";
$path_popup_vals[] = "$adm_path/$edit_domain/subdomains.aufs/$sub_name";
$path_popup_disp[] = "/$edit_domain/subdomains.aufs/$sub_name";
}
$dsc = array(
"title" => _("List of your SSH accounts:") ,
"new_item_title" => _("New SSH account:") ,
"new_item_link" => _("new SSH account") ,
"edit_item_title" => _("SSH account configuration:") ,
"table_name" => $pro_mysql_ssh_table,
"action" => "ssh_access_editor",
"forward" => array("adm_login","adm_pass","addrlink"),
"id_fld" => "id",
"list_fld_show" => "login",
"max_item" => $domain["max_ssh"],
"num_item_txt" => _("Number of active ssh accounts:") ,
"create_item_callback" => "sshAccountsCallback",
"where_list" => array(
"hostname" => $domain["name"]),
"check_unique" => array( "login" ),
"check_unique_msg" => _("There is already an ssh login by that name") ,
"check_unique_use_where_list" => "no",
"order_by" => "login",
"cols" => array(
"id" => array(
"type" => "id",
"display" => "no",
"legend" => "id"),
"login" => array(
"type" => "text",
"check" => "dtc_login_or_email",
"legend" => _("Login:") ),
"password" => array(
"type" => "password",
"check" => "dtc_pass",
"cryptfield" => "crypt",
"legend" => _("Password:") ),
"homedir" => array(
"type" => "popup",
"values" => $path_popup_vals,
"display_replace" => $path_popup_disp,
"legend" => _("Path:") )
)
);
if($conf_domain_based_ssh_logins == "yes"){
$dsc["cols"]["login"]["happen_domain"] = "@".$domain["name"];
}
$txt .= dtcListItemsEdit($dsc);
$txt .= helpLink("PmWiki/Ssh-Accounts");
return $txt;
}
?>
|