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}"; } $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 a 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; }
function drawAdminTools_Ftp($domain, $adm_path) { global $adm_login; global $adm_pass; global $edit_domain; global $edftp_account; global $addrlink; global $conf_hide_password; global $conf_domain_based_ftp_logins; global $pro_mysql_ftp_table; global $pro_mysql_admin_table; checkLoginPassAndDomain($adm_login, $adm_pass, $domain["name"]); $q = "SELECT restricted_ftp_path,ftp_login_flag FROM {$pro_mysql_admin_table} WHERE adm_login='******';"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); if ($n != 1) { die("adm_login {$adm_login} not found line " . __LINE__ . " file " . __FILE__); } $a = mysql_fetch_array($r); if ($a["ftp_login_flag"] == "no") { die("adm_login {$adm_login} had no rights to edit FTP accounts line " . __LINE__ . " file " . __FILE__); } $txt = ""; // Build the popup values and display values arrays $path_popup_vals = array(); $path_popup_disp = array(); if ($a["restricted_ftp_path"] != "yes") { $path_popup_vals[] = "{$adm_path}"; $path_popup_disp[] = "/"; $path_popup_vals[] = "{$adm_path}/{$edit_domain}"; $path_popup_disp[] = "/{$edit_domain}"; } $nbr_subdomains = sizeof($domain["subdomains"]); for ($i = 0; $i < $nbr_subdomains; $i++) { $sub_name = $domain["subdomains"][$i]["name"]; if ($a["restricted_ftp_path"] != "yes") { $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/{$sub_name}/html"; $path_popup_disp[] = "/{$edit_domain}/subdomains/{$sub_name}/html"; } // Just create the list editor now... $dsc = array("title" => _("List of your FTP accounts: "), "new_item_title" => _("New FTP account: "), "new_item_link" => _("new FTP account"), "edit_item_title" => _("FTP account configuration: "), "table_name" => $pro_mysql_ftp_table, "action" => "ftp_access_editor", "forward" => array("adm_login", "adm_pass", "addrlink"), "id_fld" => "id", "list_fld_show" => "login", "max_item" => $domain["max_ftp"], "num_item_txt" => _("Number of active ftp accounts:"), "create_item_callback" => "ftpAccountsCallback", "where_list" => array("hostname" => $domain["name"]), "check_unique" => array("login"), "check_unique_msg" => _("There is already a ftp 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", "legend" => _("Password: "******"homedir" => array("type" => "popup", "values" => $path_popup_vals, "display_replace" => $path_popup_disp, "legend" => _("Path: ")))); if ($conf_domain_based_ftp_logins == "yes") { $dsc["cols"]["login"]["happen_domain"] = "@" . $domain["name"]; } $txt .= dtcListItemsEdit($dsc); return $txt; }
function drawAdminTools_Aliases($domain) { global $adm_login; global $adm_pass; global $edit_domain; global $edit_mailbox; global $addrlink; global $pro_mysql_pop_table; global $pro_mysql_mailaliasgroup_table; checkLoginPassAndDomain($adm_login, $adm_pass, $domain["name"]); $out = ""; $dsc = array("title" => _("List of your mail groups"), "new_item_title" => _("Create New Mail Group"), "new_item_link" => _("Create Mail Group"), "edit_item_title" => _("Edit Mail Group"), "table_name" => $pro_mysql_mailaliasgroup_table, "action" => "aliasgroup", "forward" => array("adm_login", "adm_pass", "addrlink"), "id_fld" => "autoinc", "list_fld_show" => "id", "max_item" => $domain["max_email"], "num_item_txt" => _("Number of active mailboxes:"), "create_item_callback" => "emailAliasesCreateCallback", "delete_item_callback" => "emailAliasesDeleteCallback", "edit_item_callback" => "emailAliasesEditCallback", "order_by" => "id", "where_list" => array("domain_parent" => $domain["name"]), "cols" => array("autoinc" => array("type" => "id", "display" => "no", "legend" => _("Login:"******"id" => array("type" => "text", "check" => "dtc_login_or_email", "disable_edit" => "yes", "happen" => "@" . $domain["name"], "legend" => _("Email:")), "delivery_group" => array("type" => "textarea", "check" => "mail_alias_group", "legend" => _("Delivery Group:"), "cols" => "40", "rows" => "7")), "check_unique" => array("id"), "check_unique_msg" => _("Email address is already in use!")); $list_items = dtcListItemsEdit($dsc); // We have to query again, in case something has changed $q = "SELECT id FROM {$pro_mysql_mailaliasgroup_table} WHERE domain_parent='" . $domain["name"] . "';"; $r = mysql_query($q) or die("Cannot query {$q} line: " . __LINE__ . " file " . __FILE__ . " sql said:" . mysql_error()); $n = mysql_num_rows($r); $out .= $list_items; $out .= helpLink("PmWiki/Email-Accounts"); return $out; }
function drawRenewalTables() { global $pro_mysql_product_table; global $pro_mysql_admin_table; global $pro_mysql_ssl_ips_table; global $pro_mysql_product_table; global $pro_mysql_vps_table; global $pro_mysql_dedicated_table; global $pro_mysql_ssl_ips_table; global $pro_mysql_client_table; global $pro_mysql_domain_table; global $pro_mysql_completedorders_table; global $pro_mysql_pay_table; global $pro_mysql_spent_type_table; global $pro_mysql_spent_providers_table; global $pro_mysql_spent_moneyout_table; global $pro_mysql_companies_table; global $pro_mysql_spent_bank_table; global $pro_mysql_client_table; global $pro_mysql_new_admin_table; global $secpayconf_currency_letters; global $rub; global $conf_vps_renewal_shutdown; get_secpay_conf(); if (!isset($_REQUEST["sousrub"]) || $_REQUEST["sousrub"] == "") { $sousrub = "renewalreport"; } else { $sousrub = $_REQUEST["sousrub"]; } $out = '<ul class="box_wnb_content_nb">'; if ($sousrub == "renewalreport") { $out .= "<li class=\"box_wnb_content_nb_item_select\"><a href=\"?rub={$rub}\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_clientinterface.gif\" align=\"absmiddle\" border=\"0\"> " . _("Renewal report") . "</a></li>"; } else { $out .= "<li class=\"box_wnb_content_nb_item\"><a href=\"?rub={$rub}\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_clientinterface.gif\" align=\"absmiddle\" border=\"0\"> " . _("Renewal repport") . "</a></li>"; } $out .= '<li class="box_wnb_content_nb_item_vsep"></li>'; if ($sousrub == "spent") { $out .= "<li class=\"box_wnb_content_nb_item_select\"><a href=\"?rub={$rub}&sousrub=spent\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/config-icon/box_wnb_nb_picto-payementgateway.gif\" align=\"absmiddle\" border=\"0\">" . _("Money spent") . "</a></li>"; } else { $out .= "<li class=\"box_wnb_content_nb_item\"><a href=\"?rub={$rub}&sousrub=spent\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/config-icon/box_wnb_nb_picto-payementgateway.gif\" align=\"absmiddle\" border=\"0\">" . _("Money spent") . "</a></li>"; } $out .= '<li class="box_wnb_content_nb_item_vsep"></li>'; if ($sousrub == "bank") { $out .= "<li class=\"box_wnb_content_nb_item_select\"><a href=\"?rub={$rub}&sousrub=bank\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/config-icon/box_wnb_nb_picto-payementgateway.gif\" align=\"absmiddle\" border=\"0\">" . _("Bank accounts & payments") . "</a></li>"; } else { $out .= "<li class=\"box_wnb_content_nb_item\"><a href=\"?rub={$rub}&sousrub=bank\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/config-icon/box_wnb_nb_picto-payementgateway.gif\" align=\"absmiddle\" border=\"0\">" . _("Bank accounts & payments") . "</a></li>"; } $out .= '<li class="box_wnb_content_nb_item_vsep"></li>'; if ($sousrub == "provideredit") { $out .= "<li class=\"box_wnb_content_nb_item_select\"><a href=\"?rub={$rub}&sousrub=provideredit\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_admineditor.gif\" align=\"absmiddle\" border=\"0\">" . _("Upstream provider editor") . "</a></li>"; } else { $out .= "<li class=\"box_wnb_content_nb_item\"><a href=\"?rub={$rub}&sousrub=provideredit\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_admineditor.gif\" align=\"absmiddle\" border=\"0\">" . _("Upstream provider editor") . "</a></li>"; } $out .= "</ul>"; switch ($sousrub) { case "spent": $ret = dateSelector("spent_moneyout", "invoice_date", "date_selector"); $out .= $ret["text"]; $where_condition = $ret["where_condition"]; $q = "SELECT * FROM {$pro_mysql_spent_providers_table} "; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); $prov_popup_id = array(); $prov_popup_names = array(); for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $prov_popup_id[] = $a["id"]; $prov_popup_names[] = $a["quick_name"]; } $q = "SELECT * FROM {$pro_mysql_spent_type_table} "; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); $spent_type_popup_id = array(); $spent_type_names = array(); for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $spent_type_popup_id[] = $a["id"]; $spent_type_names[] = $a["label"]; } $q = "SELECT * FROM {$pro_mysql_companies_table} "; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); $company_paying_popup_id = array(); $company_paying_names = array(); for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $company_paying_popup_id[] = $a["id"]; $company_paying_names[] = $a["name"]; } $q = "SELECT * FROM {$pro_mysql_spent_bank_table} "; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); $bank_popup_id = array(); $bank_names = array(); for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $bank_popup_id[] = $a["id"]; $bank_names[] = $a["acct_name"]; } $dsc = array("title" => _("List of payments done by your hosting company"), "table_name" => $pro_mysql_spent_moneyout_table, "action" => "money_out_editor", "forward" => array("rub", "sousrub"), "print_where_condition" => $where_condition, "order_by" => "invoice_date", "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "label" => array("type" => "text", "size" => "10", "legend" => _("Label")), "id_company_spending" => array("legend" => _("Company paying"), "type" => "popup", "values" => $company_paying_popup_id, "display_replace" => $company_paying_names), "id_provider" => array("legend" => _("Company paid"), "type" => "popup", "values" => $prov_popup_id, "display_replace" => $prov_popup_names), "expenditure_type" => array("legend" => _("Expenditure type"), "type" => "popup", "values" => $spent_type_popup_id, "display_replace" => $spent_type_names), "payment_type" => array("legend" => _("Means of payment"), "type" => "popup", "values" => array("none", "credit_card", "wire_transfer", "paypal", "check", "cash"), "display_replace" => array(_("Unknown"), _("Credit card"), _("Wire transfer"), _("Paypal"), _("Check"), _("Cash"))), "payment_total" => array("type" => "text", "size" => 6, "legend" => _("Total cost")), "vat_rate" => array("type" => "text", "size" => 4, "legend" => _("Tax rate")), "vat_total" => array("type" => "text", "size" => 4, "legend" => _("Total tax")), "currency_type" => array("type" => "text", "size" => 4, "legend" => _("Currency")), "bank_acct_id" => array("type" => "popup", "values" => $bank_popup_id, "display_replace" => $bank_names, "legend" => _("Bank account")), "amount" => array("type" => "text", "size" => 6, "legend" => _("Bank amount")), "invoice_date" => array("type" => "text", "size" => 10, "legend" => _("Invoice date")), "paid_date" => array("type" => "text", "size" => 10, "legend" => _("Payment date")))); if (isset($_REQUEST["date_selector"])) { $dsc["forward"][] = "date_selector"; } $out .= dtcDatagrid($dsc); break; case "bank": $q = "SELECT * FROM {$pro_mysql_companies_table} "; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); $company_paying_popup_id = array(); $company_paying_names = array(); for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $company_paying_popup_id[] = $a["id"]; $company_paying_names[] = $a["name"]; } $dsc = array("title" => _("Bank accounts edition"), "table_name" => $pro_mysql_spent_bank_table, "action" => "bank_account_editor", "forward" => array("rub", "sousrub"), "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "acct_name" => array("type" => "text", "legend" => _("Account name")), "id_company" => array("legend" => _("Company"), "type" => "popup", "values" => $company_paying_popup_id, "display_replace" => $company_paying_names), "sort_code" => array("legend" => _("Sort code"), "type" => "text", "size" => "8"), "acct_number" => array("legend" => _("Account number"), "type" => "text"), "swift" => array("legend" => _("SWIFT"), "type" => "text", "size" => "8"), "bank_addr" => array("legend" => _("Bank address"), "type" => "text"), "currency_type" => array("legend" => _("Currency"), "type" => "text", "size" => "4"))); $out .= dtcDatagrid($dsc); // Payment type $dsc = array("title" => _("Payment type edition"), "table_name" => $pro_mysql_spent_type_table, "action" => "payment_type_editor", "forward" => array("rub", "sousrub"), "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "label" => array("legend" => _("Type of payment"), "type" => "text", "size" => "32"))); $out .= dtcDatagrid($dsc); break; case "provideredit": $dsc = array("title" => _("Upstream provider list edition"), "table_name" => $pro_mysql_spent_providers_table, "action" => "provider_list_editor", "forward" => array("rub", "sousrub"), "id_fld" => "id", "list_fld_show" => "quick_name", "new_item_title" => _("New upstream provider") . ":", "new_item_link" => _("New upsream provider"), "edit_item_title" => _("Edit upstream provider") . ":", "check_unique" => array("quick_name"), "where_list" => array("always_yes" => "yes"), "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "quick_name" => array("type" => "text", "disable_edit" => "yes", "check" => "dtc_login_or_email", "legend" => _("Short name:")), "company_name" => array("legend" => _("Company name:"), "type" => "text"), "is_company" => array("type" => "checkbox", "values" => array("yes", "no"), "default" => "yes", "legend" => _("Is it a company:")), "familyname" => array("legend" => _("First name:"), "type" => "text"), "christname" => array("legend" => _("Familly name:"), "type" => "text"), "addr1" => array("legend" => _("Address:"), "type" => "text"), "addr2" => array("legend" => _("Address (line2):"), "type" => "text"), "addr3" => array("legend" => _("Address (line3):"), "type" => "text"), "city" => array("legend" => _("City:"), "type" => "text"), "zipcode" => array("legend" => _("Zipcode:"), "type" => "text"), "state" => array("legend" => _("State:"), "type" => "text"), "country" => array("legend" => _("Country:"), "type" => "text"), "phone" => array("legend" => _("Phone:"), "type" => "text"), "fax" => array("legend" => _("Fax:"), "type" => "text"), "email" => array("legend" => _("Email:"), "type" => "text"), "special_note" => array("legend" => _("Note:"), "type" => "textarea"))); $out .= dtcListItemsEdit($dsc); break; default: case "renewalreport": // Allow shutdown of expired VPS if (isset($_REQUEST["action"])) { switch ($_REQUEST["action"]) { case "shutdown_expired_vps": // Perform a clean shutdown remoteVPSAction($_REQUEST["server_hostname"], $_REQUEST["vps_name"], "shutdown_vps"); break; case "kill_vps_and_owner": // Do a brutal kill of the running instance deleteVPS($_REQUEST["vps_id"]); remoteVPSAction($_REQUEST["server_hostname"], $_REQUEST["vps_name"], "destroy_vps"); remoteVPSAction($_REQUEST["server_hostname"], $_REQUEST["vps_name"], "kill_vps_disk"); // Delete the admin $q = "DELETE FROM {$pro_mysql_admin_table} WHERE adm_login='******';"; $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); // And the client $q = "DELETE FROM {$pro_mysql_client_table} WHERE id='" . $_REQUEST["client_id"] . "';"; $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); break; default: break; } } // Display of each month payment list if (isset($_REQUEST["date"])) { $ret = dateSelector($pro_mysql_pay_table, "date", "date"); $out .= $ret["text"]; $where_condition = $ret["where_condition"]; $q = "SELECT id,name FROM {$pro_mysql_product_table} "; $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); $prod_ids = array(); $prod_names = array(); for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $prod_ids[] = $a["id"]; $prod_names[] = $a["name"]; } $out .= "<h3>" . _("Payements for the period: ") . $_REQUEST["date"] . "</h3>"; $dsc = array("title" => _("Payment history"), "table_name" => $pro_mysql_pay_table, "action" => "payment_history_list_editor", "forward" => array("rub", "sousrub", "date"), "order_by" => "date", "skip_deletion" => "yes", "skip_creation" => "yes", "print_where_condition" => $where_condition, "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "date" => array("type" => "text", "size" => "8", "legend" => _("Date")), "id_client" => array("type" => "forkey", "forkey_type" => "info", "table" => $pro_mysql_client_table, "other_table_fld" => "CONCAT(company_name,': ',familyname,', ',christname)", "other_table_key" => "id", "this_table_field" => "id_client", "link" => "?rub=crm&id=", "bk_table" => $pro_mysql_new_admin_table, "bk_other_table_fld" => "CONCAT(comp_name,': ',family_name,', ',first_name)", "bk_other_table_key" => "id", "bk_this_table_field" => "id_client", "legend" => _("Customer name")), "product_id" => array("type" => "popup", "values" => $prod_ids, "display_replace" => $prod_names, "legend" => _("Product")), "refund_amount" => array("type" => "text", "size" => "8", "legend" => _("Refund amount")), "paiement_cost" => array("type" => "text", "size" => "4", "legend" => _("Gate cost")), "vat_rate" => array("type" => "text", "size" => "4", "legend" => _("VAT rate")), "vat_total" => array("type" => "text", "size" => "4", "legend" => _("VAT total")), "paiement_total" => array("type" => "text", "size" => "6", "legend" => _("Grand total")), "paiement_type" => array("type" => "text", "size" => "6", "legend" => _("Type")), "secpay_site" => array("type" => "text", "size" => "4", "legend" => _("Gate type")), "new_account" => array("type" => "popup", "values" => array("no", "yes"), "display_replace" => array(_("New account"), _("Renewal")), "legend" => _("Is renewal")), "valid" => array("type" => "popup", "values" => array("no", "pending", "yes"), "display_replace" => array(_("No"), _("Pending"), _("Yes")), "legend" => _("Validated")), "pending_reason" => array("type" => "text", "size" => "6", "legend" => _("Pending reason")))); $out .= dtcDatagrid($dsc); return $out; $ret = dateSelector($pro_mysql_completedorders_table, "date", "date"); // Allow nuke of bad payment (hackers?) to have accounting done correctly if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "nuke_payment") { $q = "DELETE FROM {$pro_mysql_completedorders_table} WHERE id='" . $_REQUEST["completedorders_id"] . "';"; $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); } $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); if ($n < 1) { $out .= _("No past payments for this period") . "<br>"; } else { $out .= "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">\n\t\t\t\t<tr><td>" . _("Product") . "</td><td>" . _("Client ID") . "</td><td>" . _("Client") . "</td><td>" . _("Service country") . "</td>\n\t\t\t\t<td>" . _("Client country") . "</td>\n\t\t\t\t<td>" . _("VAT collected") . "</td><td>" . _("Period") . "</td><td>" . _("Payment date") . "</td><td>" . _("Total") . "</td><td>" . _("Payment method") . "</td>\n\t\t\t\t<td>" . _("Action") . "</td></tr>"; for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); if ($a["id_client"] == 0) { $client_name = _("No client id"); $client_id_txt = _("No client id"); } else { $q2 = "SELECT * FROM {$pro_mysql_client_table} WHERE id='" . $a["id_client"] . "';"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 != 1) { $client_name = _("N/A"); $client_id_txt = _("N/A"); $client_country = _("N/A"); } else { $a2 = mysql_fetch_array($r2); $client_name = $a2["company_name"] . ":" . $a2["christname"] . ", " . $a2["familyname"]; $client_id_txt = $a["id_client"]; $client_country = $a2["country"]; } } $q2 = "SELECT * FROM {$pro_mysql_product_table} WHERE id='" . $a["product_id"] . "';"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 != 1) { $product_txt = _("Product not found"); } else { $a2 = mysql_fetch_array($r2); $product_txt = $a2["name"]; $product_period_size = $a2["period"]; } $q2 = "SELECT * FROM {$pro_mysql_pay_table} WHERE id='" . $a["payment_id"] . "';"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 != 1) { $payment_txt = _("Payment not found"); $payment_type = _("Payment not found"); $vat_collected = _("VAT not found"); } else { $a2 = mysql_fetch_array($r2); $payment_txt = $a2["paiement_total"] . " " . $a2["currency"]; $payment_type = $a2["paiement_type"]; if ($payment_type == "online") { $payment_type .= ": " . $a2["secpay_site"]; } $vat_collected = $a2["paiement_total"] * $a2["vat_rate"] / 100; } if ($a["last_expiry_date"] == "0000-00-00") { $last_expiry_date = $a["date"]; } else { $last_expiry_date = $a["last_expiry_date"]; } if ($payment_type == 'wire') { $pay = _("Wire"); } else { if ($payment_type == 'cheque') { $pay = _("cheque"); } else { if ($payment_type == 'online: none') { $pay = _("online: none"); } else { $pay = $payment_type; } } } $new_expiry_date = calculateExpirationDate($last_expiry_date, $product_period_size); $out .= "<tr><td>{$product_txt}</td><td>{$client_id_txt}</td><td>{$client_name}</td><td>" . $a["country_code"] . "</td>\n\t\t\t\t\t<td>{$client_country}</td>\n\t\t\t\t\t<td>{$vat_collected}</td><td>{$last_expiry_date} -> {$new_expiry_date}</td><td>" . $a["date"] . "</td><td>{$payment_txt}</td>\n\t\t\t\t\t<td>{$pay}</td>\n\t\t\t\t\t<td><a href=\"" . $_SERVER["PHP_SELF"] . "?rub={$rub}&date=" . $_REQUEST["date"] . "&action=nuke_payment&completedorders_id=" . $a["id"] . "\">" . _("Delete") . "</a></tr>"; } $out .= "</table>"; } return $out; } // Calculation of recuring totals $out .= "<h3>" . _("Total recurring incomes per month:") . "</h3>"; // Monthly recurring for shared hosting: $q = "SELECT {$pro_mysql_product_table}.price_dollar,{$pro_mysql_product_table}.period,{$pro_mysql_product_table}.id\n\t\tFROM {$pro_mysql_product_table},{$pro_mysql_admin_table}\n\t\tWHERE {$pro_mysql_product_table}.id = {$pro_mysql_admin_table}.prod_id\n\t\tAND {$pro_mysql_product_table}.heb_type='shared'\n\t\tAND {$pro_mysql_admin_table}.expire != '0000-00-00'"; $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); $total_shared = 0; for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $period = $a["period"]; $price = $a["price_dollar"]; $id = $a["id"]; if ($period == '0001-00-00') { $total_shared += $price / 12; } else { $papoum = explode('-', $period); $months = $papoum[1]; if ($months == 0) { echo "Product {$id} has zero month.<br>"; } else { $total_shared += $price / $months; } } } // Calculate how much SSL IPs have been taken $q = "SELECT count(id) as num_ssl FROM {$pro_mysql_ssl_ips_table} WHERE available='no'"; $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); $total_ssl = 0; if ($n != 0) { $a = mysql_fetch_array($r); $q = "SELECT price_dollar FROM {$pro_mysql_product_table} WHERE heb_type='ssl'"; $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); if ($n != 0) { $b = mysql_fetch_array($r); $total_ssl = $a["num_ssl"] * $b["price_dollar"] / 12; } } // Monthly recurring for VPS: $q = "SELECT {$pro_mysql_product_table}.price_dollar,{$pro_mysql_product_table}.period,{$pro_mysql_product_table}.id\n\t\tFROM {$pro_mysql_product_table},{$pro_mysql_vps_table}\n\t\tWHERE {$pro_mysql_product_table}.id = {$pro_mysql_vps_table}.product_id"; $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); $total_vps = 0; for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $period = $a["period"]; $price = $a["price_dollar"]; $id = $a["id"]; if ($period == '0001-00-00') { $total_shared += $price / 12; } else { $papoum = explode('-', $period); $months = $papoum[1]; if ($months != 0) { $total_vps += $price / $months; } else { echo "Product {$id} has zero month.<br>"; } } } // Monthly recurring for dedicated servers: $q = "SELECT {$pro_mysql_product_table}.price_dollar,{$pro_mysql_product_table}.period,{$pro_mysql_product_table}.id\n\t\tFROM {$pro_mysql_product_table},{$pro_mysql_dedicated_table}\n\t\tWHERE {$pro_mysql_product_table}.id = {$pro_mysql_dedicated_table}.product_id"; $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); $total_dedicated = 0; for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $period = $a["period"]; $price = $a["price_dollar"]; $id = $a["id"]; if ($period == '0001-00-00') { $total_shared += $price / 12; } else { $papoum = explode('-', $period); $months = $papoum[1]; if ($months == 0) { echo _("Dedicated server product ID {$id} has zero for the number of month to renew") . "<br>"; } else { $total_dedicated += $price / $months; } } } $p_renewal = ""; $p_renewal .= _("Shared hosting: ") . round($total_shared, 2) . " {$secpayconf_currency_letters}<br>"; $p_renewal .= _("SSL IPs renewals: ") . round($total_ssl, 2) . " {$secpayconf_currency_letters}<br>"; $p_renewal .= _("VPS: ") . round($total_vps, 2) . " {$secpayconf_currency_letters}<br>"; $p_renewal .= _("Dedicated servers: ") . round($total_dedicated, 2) . " {$secpayconf_currency_letters}<br>"; $big_total = $total_shared + $total_vps + $total_dedicated + $total_ssl; $p_renewal .= "<b>" . _("Total: ") . round($big_total, 2) . " {$secpayconf_currency_letters}</b>"; // Show a quick history of payments $year = date("Y"); $month = date("m"); $cur_year = $year - 2; $cur_month = $month; $p_history = ""; $p_history .= "<table cellspacing=\"1\" cellpadding=\"1\" border=\"1\">\n\t\t<tr><td>" . _("Period") . "</td><td>" . _("Amount") . "</td><td>" . _("VAT collected") . "</td><td>" . _("Payment gateway cost") . "</td><td>" . _("Profit") . "</td></tr>"; for ($i = 0; $i < 25; $i++) { $q2 = "SELECT {$pro_mysql_pay_table}.paiement_total,{$pro_mysql_pay_table}.vat_rate,{$pro_mysql_pay_table}.paiement_cost\n\t\t\tFROM {$pro_mysql_pay_table},{$pro_mysql_completedorders_table}\n\t\t\tWHERE {$pro_mysql_pay_table}.vat_rate!='0.00'\n\t\t\tAND {$pro_mysql_completedorders_table}.payment_id = {$pro_mysql_pay_table}.id\n\t\t\tAND {$pro_mysql_completedorders_table}.date LIKE '" . $cur_year . "-" . $cur_month . "-%';"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); $vat_collected = 0; $month_total = 0; $cost_total = 0; for ($j = 0; $j < $n2; $j++) { $a2 = mysql_fetch_array($r2); $tt = $a2["paiement_total"]; $vat = $a2["vat_rate"]; $vat_collected += $tt * $vat / 100; $month_total += $tt; $cost_total += $a2["paiement_cost"]; } $q2 = "SELECT sum(paiement_total) as paiement_total, sum(paiement_cost) as paiement_cost FROM {$pro_mysql_completedorders_table},{$pro_mysql_pay_table}\n\t\t\tWHERE {$pro_mysql_completedorders_table}.date LIKE '" . $cur_year . "-" . $cur_month . "%'\n\t\t\tAND {$pro_mysql_completedorders_table}.payment_id = {$pro_mysql_pay_table}.id\n\t\t\tAND {$pro_mysql_pay_table}.vat_rate = '0.00';"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 > 0) { $a2 = mysql_fetch_array($r2); $cost_total += $a2["paiement_cost"]; $month_total += $a2["paiement_total"]; $profit = $month_total - $cost_total - $vat_collected; $p_history .= "<tr><td style=\"text-align:right;\"><a href=\"" . $_SERVER["PHP_SELF"] . "?rub={$rub}&date=" . $cur_year . "-" . $cur_month . "\">" . $cur_year . "-" . $cur_month . "</a></td>\n\t\t\t\t<td style=\"text-align:right;\">" . $month_total . " {$secpayconf_currency_letters}</td>\n\t\t\t\t<td style=\"text-align:right;\">" . round($vat_collected, 2) . " {$secpayconf_currency_letters}</td>\n\t\t\t\t<td style=\"text-align:right;\">" . round($cost_total, 2) . " {$secpayconf_currency_letters}</td>\n\t\t\t\t<td style=\"text-align:right;\">" . round($profit, 2) . " {$secpayconf_currency_letters}</td></tr>"; } $cur_month++; if ($cur_month > 12) { $cur_month = 1; $cur_year++; } if ($cur_month < 10) { $cur_month = "0" . $cur_month; } } $p_history .= "</table>"; $p_active_prods = "<img src=\"active_prods_graph.php?graph=year\"><br>\n<img src=\"active_prods_graph.php?graph=month\">"; // Layout the recuring stat and the effective payment statistics $out .= "<table cellspacing=\"1\" cellpadding=\"4\" border=\"0\" width=\"100%\">\n\t\t<tr valign=\"top\"><td valign=\"top\" width=\"50%\">{$p_history}</td>\n\t\t<td valign=\"top\">{$p_renewal}</td>\n\t\t<td valign=\"top\">{$p_active_prods}</td></tr></table>"; $out .= "<h3>" . _("Shared hosting renewals:") . "</h3>"; $q = "SELECT * FROM {$pro_mysql_admin_table} WHERE expire < '" . date("Y-m-d") . "' AND id_client!='0' AND expire !='0000-00-00' ORDER BY expire;"; $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__); $n = mysql_num_rows($r); if ($n < 1) { $out .= _("No shared account expired.") . "<br>"; } else { $out .= "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">\n\t\t\t<tr><td>" . _("Login") . "</td><td>" . _("Client") . "</td><td>" . _("Email") . "</td><td>" . _("Expiration date") . "</td></tr>"; for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $q2 = "SELECT * FROM {$pro_mysql_client_table} WHERE id='" . $a["id_client"] . "';"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 != 1) { $client_name = _("Client name not found!"); } else { $a2 = mysql_fetch_array($r2); $client_name = $a2["company_name"] . ":" . $a2["christname"] . ", " . $a2["familyname"]; } $q2 = "SELECT * FROM {$pro_mysql_domain_table} WHERE owner='" . $a["adm_login"] . "';"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__); $n2 = mysql_num_rows($r2); if ($n2 > 0) { $out .= "<tr><td>" . $a["adm_login"] . "</td><td>{$client_name}</td><td>" . $a2["email"] . "</td><td>" . $a["expire"] . "</td></tr>"; } } $out .= "</table>"; } // List of expired expired SSL IPs $out .= "<h3>" . _("SSL IPs renewals") . "</h3>"; $q = "SELECT * FROM {$pro_mysql_ssl_ips_table} WHERE expire < '" . date("Y-m-d") . "' AND available='no' ORDER BY expire"; $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); if ($n < 1) { $out .= _("No SSL IP expired") . "<br>"; } else { $out .= "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">\n\t\t\t<tr><td>" . _("Login") . "</td><td>" . _("Client") . "</td><td>" . _("Email") . "</td><td>" . _("Expiration date") . "</td></tr>"; for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $q2 = "SELECT * FROM {$pro_mysql_admin_table} WHERE adm_login='******';"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 != 1) { die("Cannot find admin name " . $a["adm_login"] . " line " . __LINE__ . " file " . __FILE__); } else { $admin = mysql_fetch_array($r2); } $q2 = "SELECT * FROM {$pro_mysql_client_table} WHERE id='" . $admin["id_client"] . "';"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 != 1) { $client_name = _("Client name not found!"); } else { $a2 = mysql_fetch_array($r2); $client_name = $a2["company_name"] . ":" . $a2["christname"] . ", " . $a2["familyname"]; } $out .= "<tr><td>" . $a["adm_login"] . "</td><td>{$client_name}</td><td>" . $a2["email"] . "</td><td>" . $a["expire"] . "</td></tr>"; } $out .= "</table>"; } // List if expired VPS $out .= "<h3>" . _("VPS renewals:") . "</h3>"; $q = "SELECT * FROM {$pro_mysql_vps_table} WHERE expire_date < '" . date("Y-m-d") . "' ORDER BY expire_date"; $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); if ($n < 1) { $out .= _("No VPS expired") . "<br>"; } else { $out .= "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">\n\t\t\t<tr><td>" . _("Login") . "</td><td>" . _("VPS") . "</td>\n\t\t\t<td>" . _("Client") . "</td>\n\t\t\t<td>" . _("Email") . "</td>\n\t\t\t<td>" . _("Expiration date") . "</td>\n\t\t\t<td>" . _("Days of expiration") . "</td>\n\t\t\t<td>" . _("Action") . "</td>\n\t\t\t</tr>"; for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $q2 = "SELECT * FROM {$pro_mysql_admin_table} WHERE adm_login='******';"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 != 1) { die("Cannot find admin name " . $a["owner"] . " line " . __LINE__ . " file " . __FILE__); } else { $admin = mysql_fetch_array($r2); } $q2 = "SELECT * FROM {$pro_mysql_client_table} WHERE id='" . $admin["id_client"] . "';"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 != 1) { $client_name = _("Client name not found!"); } else { $a2 = mysql_fetch_array($r2); $client_name = $a2["company_name"] . ":" . $a2["christname"] . ", " . $a2["familyname"]; } $q2 = "SELECT adm_login FROM {$pro_mysql_admin_table} WHERE id_client='" . $admin["id_client"] . "'"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 == 1) { $q2 = "SELECT * FROM {$pro_mysql_vps_table} WHERE owner='" . $admin["adm_login"] . "'"; $r2 = mysql_query($q2) or die("Cannot querry " . $q2 . " line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 == 1) { $q2 = "SELECT * FROM {$pro_mysql_dedicated_table} WHERE owner='" . $admin["adm_login"] . "'"; $r2 = mysql_query($q2) or die("Cannot querry " . $q2 . " line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 == 0) { $q2 = "SELECT * FROM {$pro_mysql_domain_table} WHERE owner='" . $admin["adm_login"] . "'"; $r2 = mysql_query($q2) or die("Cannot querry " . $q2 . " line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 == 0) { $kill_owner_txt = "<a href=\"" . $_SERVER["PHP_SELF"] . "?action=kill_vps_and_owner&adm_login="******"adm_login"] . "&client_id=" . $admin["id_client"] . "&vps_name=" . $a["vps_xen_name"] . "&server_hostname=" . $a["vps_server_hostname"] . "&vps_id=" . $a["id"] . "\">" . _("Kill VPS and owner") . "</a>"; } else { $kill_owner_txt = _("Has some domains"); } } else { $kill_owner_txt = _("Has a dedicated"); } } else { $kill_owner_txt = _("More than one VPS"); } } else { $kill_owner_txt = _("More than one login"); } if (numOfDays($a["expire_date"]) >= $conf_vps_renewal_shutdown) { $bgcolor = " bgcolor=\"#FF8888\" "; } else { $bgcolor = " "; } $out .= "<tr><td>" . $a["owner"] . "</td>\n\t\t\t\t<td>" . $a["vps_xen_name"] . ":" . $a["vps_server_hostname"] . "</td>\n\t\t\t\t<td>{$client_name}</td>\n\t\t\t\t<td>" . $a2["email"] . "</td>\n\t\t\t\t<td {$bgcolor}>" . $a["expire_date"] . "</td>\n\t\t\t\t<td {$bgcolor}>" . calculateAge($a["expire_date"], "00:00:00") . "</td>\n\t\t\t\t<td><a href=\"" . $_SERVER["PHP_SELF"] . "?rub={$rub}&action=shutdown_expired_vps&server_hostname=" . $a["vps_server_hostname"] . "&vps_name=" . $a["vps_xen_name"] . "\">" . _("Shutdown") . "</a> - {$kill_owner_txt}</td></tr>"; } $out .= "</table>"; } // List expired dedicated servers $out .= "<h3>" . _("Dedicated servers renewals") . "</h3>"; $q = "SELECT * FROM {$pro_mysql_dedicated_table} WHERE expire_date < '" . date("Y-m-d") . "' ORDER BY expire_date"; $r = mysql_query($q) or die("Cannot querry {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); if ($n < 1) { $out .= _("No dedicated server expired") . "<br>"; } else { $out .= "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">\n\t\t\t<tr><td>" . _("Login") . "</td><td>" . _("Server") . "</td><td>" . _("Client") . "</td><td>" . _("Email") . "</td><td>" . _("Expiration date") . "</td></tr>"; for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $q2 = "SELECT * FROM {$pro_mysql_admin_table} WHERE adm_login='******';"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 != 1) { die("Cannot find admin name " . $a["owner"] . " line " . __LINE__ . " file " . __FILE__); } else { $admin = mysql_fetch_array($r2); } $q2 = "SELECT * FROM {$pro_mysql_client_table} WHERE id='" . $admin["id_client"] . "';"; $r2 = mysql_query($q2) or die("Cannot querry {$q2} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n2 = mysql_num_rows($r2); if ($n2 != 1) { $client_name = _("Client name not found!"); } else { $a2 = mysql_fetch_array($r2); $client_name = $a2["company_name"] . ":" . $a2["christname"] . ", " . $a2["familyname"]; } $out .= "<tr><td>" . $a["owner"] . "</td><td>" . $a["server_hostname"] . "</td><td>{$client_name}</td><td>" . $a2["email"] . "</td><td>" . $a["expire_date"] . "</td></tr>"; } $out .= "</table>"; } break; } return $out; }
function drawAdminTools_Emails($domain) { global $adm_login; global $adm_pass; global $edit_domain; global $edit_mailbox; global $addrlink; global $cyrus_used; global $cyrus_default_quota; global $CYRUS; global $conf_hide_password; global $pro_mysql_pop_table; checkLoginPassAndDomain($adm_login, $adm_pass, $domain["name"]); $out = ""; $dsc = array("title" => _("List of your mailboxes:"), "new_item_title" => _("New mailbox"), "new_item_link" => _("new mailbox"), "edit_item_title" => _("Mailbox configuration:"), "table_name" => $pro_mysql_pop_table, "action" => "pop_access_editor", "forward" => array("adm_login", "adm_pass", "addrlink"), "id_fld" => "autoinc", "list_fld_show" => "id", "max_item" => $domain["max_email"], "num_item_txt" => _("Number of active mailboxes:"), "create_item_callback" => "emailAccountsCreateCallback", "delete_item_callback" => "emailAccountsDeleteCallback", "edit_item_callback" => "emailAccountsEditCallback", "where_list" => array("mbox_host" => $domain["name"]), "check_unique" => array("id"), "check_unique_msg" => _("There is already a mailbox by that name"), "order_by" => "id", "cols" => array("autoinc" => array("type" => "id", "display" => "no", "legend" => _("Login:"******"id" => array("type" => "text", "disable_edit" => "yes", "check" => "dtc_login_or_email", "happen" => "@" . $domain["name"], "legend" => _("Login:"******"memo" => array("type" => "text", "help" => _("This text is just a memo for yourself, and will not really be used."), "legend" => _("Name:")), "passwd" => array("type" => "password", "check" => "dtc_pass", "legend" => _("Password:"******"spam_mailbox_enable" => array("type" => "checkbox", "help" => _("If selected, spams will be sent in a SPAM folder and wont reach your inbox. Later you can check this folder with the webmail or using IMAP."), "values" => array("yes", "no"), "legend" => _("Enable SPAM filtering: ")), "spam_mailbox" => array("type" => "text", "help" => _("Name of the SPAM folder to receive the spam (the above option has to be activated)."), "default" => "SPAM", "legend" => _("SPAM mailbox destination: ")))); if ($cyrus_used) { $dsc["cols"]["quota_size"] = array("type" => "text", "check" => "number", "default" => "{$cyrus_default_quota}", "legend" => _("Mailbox quota: ")); $dsc["cols"]["quota_used"] = array("type" => "readonly", "hide_create" => "yes", "callback" => "getCyrusUsedQuota", "happen" => _("MBytes"), "legend" => _("Used quota: ")); } else { $dsc["cols"]["quota_size"] = array("type" => "text", "check" => "max_value_2096", "default" => "10", "happen" => _("MBytes"), "help" => _("Setting BOTH the number of files and overall mailbox size to zero will disable quota."), "legend" => _("Mailbox quota: ")); $dsc["cols"]["quota_files"] = array("type" => "text", "check" => "number", "default" => "1024", "happen" => _("files"), "legend" => _("Mailbox max files quota: ")); $dsc["cols"]["redirect1"] = array("type" => "text", "check" => "email", "can_be_empty" => "yes", "empty_makes_sql_null" => "yes", "legend" => _("Redirection 1: ")); $dsc["cols"]["redirect2"] = array("type" => "text", "check" => "email", "can_be_empty" => "yes", "empty_makes_sql_null" => "yes", "legend" => _("Redirection 2: ")); $dsc["cols"]["localdeliver"] = array("type" => "checkbox", "values" => array("yes", "no"), "legend" => _("Deliver messages locally in INBOX: ")); $dsc["cols"]["vacation_flag"] = array("type" => "checkbox", "values" => array("yes", "no"), "default" => "no", "legend" => _("Check to send a bounce message (vacation): ")); $dsc["cols"]["vacation_text"] = array("type" => "textarea", "legend" => _("Bounce message content: "), "cols" => "40", "rows" => "7"); } $list_items = dtcListItemsEdit($dsc); // We have to query again, in case something has changed $q = "SELECT id FROM {$pro_mysql_pop_table} WHERE mbox_host='" . $domain["name"] . "';"; $r = mysql_query($q) or die("Cannot query {$q} line: " . __LINE__ . " file " . __FILE__ . " sql said:" . mysql_error()); $n = mysql_num_rows($r); $catch_popup = "<option value=\"no-mail-account\">" . _("No catch-all") . "</option>"; for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); if ($a["id"] == $domain["catchall_email"]) { $selected = " selected "; } else { $selected = " "; } $catch_popup .= "<option value=\"" . $a["id"] . "\" {$selected}>" . $a["id"] . "</option>"; } $out .= "<b><u>" . _("Catch-all email set to deliver to") . ":</u></b><br>"; $out .= "<form action=\"" . $_SERVER["PHP_SELF"] . "\">\n\t<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n\t<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n\t<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">\n\t<input type=\"hidden\" name=\"edit_domain\" value=\"{$edit_domain}\">\n\tCatchall: <input type=\"hidden\" name=\"action\" value=\"set_catchall_account\">\n\t<select name=\"catchall_popup\">{$catch_popup}</select><input type=\"image\" src=\"gfx/stock_apply_20.png\">\n</form>"; $out .= $list_items; $out .= helpLink("PmWiki/Email-Accounts"); return $out; }
function drawCompaniesConfig() { global $pro_mysql_companies_table; global $cc_code_array; global $conf_generated_file_path; $out = ""; $country_codes = array_keys($cc_code_array); $country_fullnames = array_values($cc_code_array); $dsc = array("title" => _("List of your companies:"), "new_item_title" => _("Add a new company:"), "new_item_link" => _("Add a new company"), "edit_item_title" => _("Edit a company:"), "table_name" => $pro_mysql_companies_table, "action" => "hosting_company_editor", "forward" => array("rub", "sousrub"), "id_fld" => "id", "list_fld_show" => "name", "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "name" => array("type" => "text", "size" => "30", "legend" => _("Company name:")), "address" => array("type" => "textarea", "cols" => "60", "rows" => "5", "legend" => _("Address:")), "country" => array("type" => "popup", "legend" => _("Country:"), "values" => $country_codes, "display_replace" => $country_fullnames), "registration_number" => array("type" => "text", "size" => "30", "legend" => _("Registration number:")), "vat_number" => array("type" => "text", "size" => "30", "legend" => _("VAT number:")), "vat_rate" => array("type" => "text", "size" => "10", "legend" => _("VAT rate:")), "logo_path" => array("type" => "text", "size" => "30", "legend" => _("Logo path relative to") . "<br>{$conf_generated_file_path}/invoice_pics/:"), "text_after" => array("type" => "textarea", "cols" => "60", "rows" => "5", "legend" => _("Invoice free text:")), "footer" => array("type" => "textarea", "cols" => "60", "rows" => "5", "legend" => _("Invoice footer:")))); $out .= dtcListItemsEdit($dsc); return $out; }
function drawAdminTools_Subdomain($admin, $domain) { global $adm_login; global $adm_pass; global $edit_domain; global $addrlink; global $conf_administrative_site; global $conf_hide_password; global $edit_a_subdomain; global $dtcshared_path; global $pro_mysql_nameservers_table; global $pro_mysql_subdomain_table; global $pro_mysql_ssl_ips_table; $txt = ""; checkLoginPassAndDomain($adm_login, $adm_pass, $domain["name"]); $nbr_subdomain = sizeof($domain["subdomains"]); $max_subdomain = $domain["max_subdomain"]; // Let's start a form ! $frm = "<form action=\"?\" methode=\"post\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"adm_login\" value=\"{$adm_login}\">\n<input type=\"hidden\" name=\"adm_pass\" value=\"{$adm_pass}\">\n<input type=\"hidden\" name=\"addrlink\" value=\"{$addrlink}\">\n<input type=\"hidden\" name=\"edit_domain\" value=\"{$edit_domain}\">\n<input type=\"hidden\" name=\"whatdoiedit\" value=\"subdomains\">"; $txt .= $frm; // Popup for choosing default subdomain. $subdomains = $domain["subdomains"]; $txt .= "<table><tr><td align=\"right\">"; $txt .= _("Default subdomain: ") . "</td><td><select name=\"subdomaindefault_name\">"; for ($i = 0; $i < $nbr_subdomain; $i++) { $sub = $subdomains[$i]["name"]; if ($domain["default_subdomain"] == "{$sub}") { $txt .= "<option value=\"{$sub}\" selected>{$sub}</option>"; } else { $txt .= "<option value=\"{$sub}\">{$sub}</option>"; } } $txt .= "</select></td></tr>"; // Radio to choose wildcard or not if ($domain["wildcard_dns"] == "yes") { $yes_flag = " checked "; $no_flag = " "; } else { $yes_flag = " "; $no_flag = " checked "; } $txt .= "<tr><td align=\"right\">" . _("Use as wildcard for the domain:") . " </td><td><input type=\"radio\" name=\"wildcard_dns\" value=\"yes\"{$yes_flag}>" . _("Yes") . "<input type=\"radio\" name=\"wildcard_dns\" value=\"no\"{$no_flag}>" . _("No") . "</td></tr>"; // Radio to activate the ServerAlias on the default subdomain if ($domain["default_sub_server_alias"] == "yes") { $yes_flag = " checked "; $no_flag = " "; } else { $yes_flag = " "; $no_flag = " checked "; } $txt .= "<tr><td align=\"right\">" . _("Generate a ServerAlias for the root of the domain:") . " </td><td><input type=\"radio\" name=\"default_sub_server_alias\" value=\"yes\"{$yes_flag}>" . _("Yes") . "<input type=\"radio\" name=\"default_sub_server_alias\" value=\"no\"{$no_flag}>" . _("No") . "</td></tr>"; // Apply button $txt .= "<tr><td></td><td><input type=\"hidden\" name=\"subdomaindefault\" value=\"Ok\"><input type=\"image\" src=\"gfx/stock_apply_20.png\"></td></tr></table></form>"; $txt .= $frm . ""; $dsc = array("title" => _("List of your subdomains: "), "new_item_title" => _("Create a subdomain: "), "new_item_link" => _("New subdomain"), "edit_item_title" => _("Edit one of your subdomains"), "table_name" => $pro_mysql_subdomain_table, "action" => "subdomain_editor", "forward" => array("adm_login", "adm_pass", "addrlink"), "id_fld" => "id", "list_fld_show" => "subdomain_name", "max_item" => $max_subdomain, "num_item_txt" => _("Number of active subdomains:"), "create_item_callback" => "subdomainCreateDirsCallBack", "delete_item_callback" => "subdomainDeleteDirsCallBack", "edit_item_callback" => "subdomainEditCallBack", "order_by" => "subdomain_name", "where_list" => array("domain_name" => $domain["name"]), "cols" => array("id" => array("type" => "id", "display" => "no", "legend" => "id"), "subdomain_name" => array("type" => "text", "check" => "subdomain", "disable_edit" => "yes", "legend" => _("Subdomain name: ")), "ip" => array("type" => "text", "check" => "subdomain_or_ip", "can_be_empty" => "yes", "empty_makes_default" => "yes", "legend" => _("IP address or CNAME: ")), "ip6" => array("type" => "text", "check" => "ip6", "can_be_empty" => "yes", "empty_makes_default" => "yes", "legend" => _("IPv6 address: ")), "generate_vhost" => array("type" => "radio", "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "legend" => _("Generate a vhost entry for this subdomain:")), "add_default_charset" => array("type" => "popup", "values" => array("dtc-wont-add", "Off", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-10", "ISO-8859-11", "ISO-8859-12", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15", "ISO-8859-16", "ISO-2022-JP", "ISO-2022-KR", "ISO-2022-CN", "Big5", "cn-Big5", "WINDOWS-1251", "CP866", "KOI8", "KOI8-E", "KOI8-r", "KOI8-U", "KOI8-ru", "ISO-10646-UCS-2", "ISO-10646-UCS-4", "UTF-7", "UTF-8", "UTF-16", "UTF-16BE", "UTF-16LE", "UTF-32", "UTF-32BE", "UTF-32LE", "euc-cn", "euc-gb", "euc-jp", "euc-kr", "EUC-TW", "gb2312", "iso-10646-ucs-2", "iso-10646-ucs-4", "shift_jis"), "legend" => "AddDefaultCharset"), "srv_record" => array("type" => "text", "can_be_empty" => "yes", "legend" => _("This subdomain is a service (SRV)<br>entry for the following port: ")), "srv_record_protocol" => array("type" => "radio", "values" => array("tcp", "udp", "sctp"), "default" => "tcp", "legend" => _("SRV protocol: ")), "register_globals" => array("type" => "radio", "values" => array("yes", "no"), "default" => "no", "display_replace" => array(_("Yes"), _("No")), "legend" => _("Use register_globals=1: ")), "associated_txt_record" => array("type" => "text", "legend" => _("TXT field of the subdomain: ")), "nameserver_for" => array("type" => "text", "check" => "domain_or_ip", "can_be_empty" => "yes", "legend" => _("This subdomain is a nameserver (NS)<br>entry for the following subdomain: ")))); if ($domain["safe_mode"] == "no") { $dsc["cols"]["safe_mode"] = array("type" => "radio", "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "legend" => "PHP safe mode: "); } if ($domain["sbox_protect"] == "no") { $dsc["cols"]["sbox_protect"] = array("type" => "radio", "values" => array("yes", "no"), "display_replace" => array(_("Yes"), _("No")), "legend" => _("Sbox cgi-bin protection: ")); } // Get all SSL IPs asigned to this customer $q = "SELECT * FROM {$pro_mysql_ssl_ips_table} WHERE adm_login='******' AND available='no';"; $r = mysql_query($q) or die("Cannot query {$q} line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $n = mysql_num_rows($r); if ($n != 0) { $ssl_ips = array(); $ssl_ips[] = "none"; // Check if some SSL certs are free, or used by current subdomain for ($i = 0; $i < $n; $i++) { $a = mysql_fetch_array($r); $nbr_domains = sizeof($admin["data"]); $used_by = "none"; for ($j = 0; $j < $nbr_domains; $j++) { $nbr_subdomains = sizeof($admin["data"][$j]["subdomains"]); for ($k = 0; $k < $nbr_subdomains; $k++) { if ($admin["data"][$j]["subdomains"][$k]["ssl_ip"] == $a["ip_addr"]) { // The cert is used by current subdomain if (isset($_REQUEST["item"]) && isset($_REQUEST["subaction"]) && $_REQUEST["subaction"] == "subdomain_editor_edit_item" && $_REQUEST["item"] == $admin["data"][$j]["subdomains"][$k]["id"]) { $ssl_ips[] = $a["ip_addr"]; // The cert is used by another subdomain, don't show it... } else { $used_by = $admin["data"][$j]["name"] . $admin["data"][$j]["subdomains"][$k]["name"]; } } } } if ($used_by == "none") { $ssl_ips[] = $a["ip_addr"]; } } $dsc["cols"]["ssl_ip"] = array("type" => "popup", "values" => $ssl_ips, "legend" => _("Use an SSL vhost using this IP: ")); } // Check to see if there is some SSL IPs for that customer $q = "SELECT * FROM {$pro_mysql_ssl_ips_table} WHERE adm_login='******' AND available='no';"; $r = mysql_query($q) or die("Cannot query \"{$q}\" line " . __LINE__ . " file " . __FILE__ . " sql said: " . mysql_error()); $dsc["cols"]["login"] = array("type" => "text", "check" => "dtc_login", "empty_makes_sql_null" => "yes", "can_be_empty" => "yes", "legend" => _("Dynamic IP update login: "******"cols"]["pass"] = array("type" => "password", "check" => "dtc_pass", "empty_makes_sql_null" => "yes", "can_be_empty" => "yes", "legend" => _("Dynamic IP update password: "******"<br>" . _("Windows users (and UNIX users running WINE) can update their IP address dynamically by downloading and installing the following open source DTC client:") . "<br>" . "<a href=\"http://www.gplhost.com/DTC-Dynamic_IP_updater.exe\">DTC-Dynamic_IP_updater.exe</a><br>" . _("For unix users, a simple wget command in a cron joe like below will do. Something like this:") . "<br>" . htmlspecialchars("wget https://" . $conf_administrative_site . "/dtc/dynip.php?login=MYLOGIN&pass=MYPASS&domain=" . $domain["name"] . "&ip=1.2.3.4") . "<br>"; $txt .= helpLink("PmWiki/Subdomains"); return $txt; }