本文整理汇总了PHP中main::dropDown方法的典型用法代码示例。如果您正苦于以下问题:PHP main::dropDown方法的具体用法?PHP main::dropDown怎么用?PHP main::dropDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main
的用法示例。
在下文中一共展示了main::dropDown方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
global $dbh, $postvar, $getvar, $instance;
$this->acpForm[] = array("Signup Posts", '<input name="signup" type="text" id="signup" size="5" />', 'signup');
$this->acpForm[] = array("Monthly Posts", '<input name="monthly" type="text" id="monthly" size="5" />', 'monthly');
$this->orderForm[] = array("Forum Username", '<input name="type_fuser" type="text" id="type_fuser" />', 'fuser');
$this->orderForm[] = array("Forum Password", '<input name="type_fpass" type="password" id="type_fpass" />', 'fpass');
$p2h_query = $dbh->select("p2h");
while ($p2h_data = $dbh->fetch_array($p2h_query)) {
$values[] = array($p2h_data['forumname'], $p2h_data['id']);
}
$this->acpForm[] = array("Forum", main::dropDown("forum", $values), 'forum');
$this->acpNav[] = array("P2H Forums", "forums", "lightning.png", "P2H Forums");
$this->clientNav[] = array("Forum Posting", "forums", "lightning.png", "Forum Posting");
}
示例2: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
switch ($getvar['sub']) {
case "tchoose":
if ($_POST) {
check::empty_fields();
if (!main::errors()) {
foreach ($postvar as $key => $value) {
$dbh->updateConfig($key, $value);
}
main::errors("Settings Updated!");
}
}
$folder = "../themes/";
if ($handle = opendir($folder)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != ".svn" && $file != "icons" && $file != "index.html" && $file != "flags") {
$values[] = array($file, $file);
}
}
}
closedir($handle);
$theme_settings_array['THEME'] = main::dropDown("theme", $values, $dbh->config("theme"));
echo style::replaceVar("tpl/admin/lof/theme-settings.tpl", $theme_settings_array);
break;
case "tupload":
// Theme Uploader
echo "Here you can upload a theme of your choice to the installer. Please be sure that the theme is in .zip format.<br><br>";
if ($_POST) {
$response = main::upload_theme();
echo $response . "<br><br>";
}
echo style::replaceVar('tpl/admin/lof/theme-upload.tpl');
break;
case "cssedit":
echo $this->EditTemplate("style", "css");
break;
case "tpledit":
echo style::replaceVar('tpl/admin/lof/template-editor.tpl');
break;
case "navedit":
echo style::replaceVar("tpl/admin/lof/navedit/top.tpl");
$navbar_query = $dbh->select("navbar", 0, array("sortorder", "ASC"));
while ($navbar_data = $dbh->fetch_array($navbar_query)) {
$link_box_array['ID'] = $navbar_data['id'];
$link_box_array['NAME'] = $navbar_data['visual'];
$link_box_array['ICON'] = $navbar_data['icon'];
$link_box_array['LINK'] = $navbar_data['link'];
$links_array['LINKS'] .= style::replaceVar("tpl/admin/lof/navedit/link-box.tpl", $link_box_array);
}
echo style::replaceVar("tpl/admin/lof/navedit/links.tpl", $links_array);
echo style::replaceVar("tpl/admin/lof/navedit/bottom.tpl");
break;
case "editheader":
echo $this->EditTemplate("header", "tpl");
break;
case "editfooter":
echo $this->EditTemplate("footer", "tpl");
break;
case "ui-theme":
if ($_POST) {
check::empty_fields();
if (!main::errors()) {
foreach ($postvar as $key => $value) {
$dbh->updateConfig($key, $value);
}
main::errors("Settings Updated!");
}
}
$folder = INC . "/css/";
foreach (main::folderFiles($folder) as $file) {
$files[] = array($file, $file);
}
$jquery_theme_changer_array['THEME'] = main::dropDown("ui-theme", $files, $dbh->config("ui-theme"));
echo style::replaceVar('tpl/admin/lof/jquery-theme-changer.tpl', $jquery_theme_changer_array);
break;
}
}
示例3: content
//.........这里部分代码省略.........
}
if ($p2hid) {
$paidamts = substr($paidamts, 1, strlen($paidamts));
$paidtxn = substr($paidtxn, 1, strlen($paidtxn));
$paiddate = substr($paiddate, 1, strlen($paiddate));
$paidgateway = substr($paidgateway, 1, strlen($paidgateway));
$p2h_pay_array = array("amt_paid" => $paidamts, "txn" => $paidtxn, "datepaid" => $paiddate, "gateway" => $paidgateway);
unset($where);
$where[] = array("uid", "=", $userid);
$dbh->update("coupons_p2h", $p2h_pay_array, $where);
if ($getvar['remtxn'] || $reload) {
main::redirect("?page=invoices&view=" . $getvar['view']);
}
} else {
if ($getvar['remtxn']) {
$paidamts = substr($paidamts, 1, strlen($paidamts));
$paidtxn = substr($paidtxn, 1, strlen($paidtxn));
$paiddate = substr($paiddate, 1, strlen($paiddate));
$paidgateway = substr($paidgateway, 1, strlen($paidgateway));
$update_invoices = array("amt_paid" => $paidamts, "txn" => $paidtxn, "datepaid" => $paiddate, "gateway" => $paidgateway);
$dbh->update("invoices", $update_invoices, array("id", "=", $invoiceid), "1");
main::redirect("?page=invoices&view=" . $invoiceid);
}
}
if ($invoice_info['amt_paid'] || $p2hid) {
$view_invoice_array['TRANSACTIONS'] = style::replaceVar("tpl/invoices/invoice-transactions.tpl", $invoice_transactions_array);
}
$addsub[] = array("Add", "add");
$addsub[] = array("Subtract", "subtract");
$days[] = array("1 Day", "1");
for ($num = 2; $num < 31; $num++) {
$days[] = array($num . " Days", $num);
}
$payment_arrangments_array['ADDSUB'] = main::dropDown("addsub", $addsub, "add", 0);
$payment_arrangments_array['DAYS'] = main::dropDown("days", $days, 1, 0);
if ($userdata['removed'] == 1) {
$admin_ops_array['MODIFYFUNCS'] = '
<tr>
<td align="center" colspan = "2"><font color = "#FF0055"><strong>The owner of this invoice has been dismembered. Er... I mean the member who owned this invoice has been removed.</strong></font></td>
</tr>';
} else {
if (!$p2hid) {
$admin_ops_modify_array['PAYARRANGE'] = style::replaceVar("tpl/admin/invoices/payment-arrangments.tpl", $payment_arrangments_array);
} else {
$admin_ops_modify_array['PAYARRANGE'] = "";
}
$admin_ops_array['MODIFYFUNCS'] = style::replaceVar("tpl/admin/invoices/admin-ops-modify.tpl", $admin_ops_modify_array);
if ($invoice_info['changed_plan']) {
$admin_ops_array['MODIFYFUNCS'] .= '
<tr>
<td align="center" colspan = "2"><font color = "#FF0055"><strong>The owner of this invoice has upgraded their account and this is an invoice from an old account.</strong></font></td>
</tr>';
}
}
$view_invoice_array['TRANSACTIONS'] .= style::replaceVar("tpl/admin/invoices/admin-ops.tpl", $admin_ops_array);
if (!$warning_page) {
echo style::replaceVar("tpl/invoices/view-invoice.tpl", $view_invoice_array);
}
} else {
//Display the invoice list
//Status search
$showstatus = "all";
if ($postvar['submitstatus']) {
$showstatus = $postvar['status'];
}
//End ststus search
示例4: content
//.........这里部分代码省略.........
$total_posts = coupons::totalposts($_SESSION['cuser'], $packages_data['id']) + $discount;
if ($total_posts < $signup) {
$error = 1;
main::errors("You are currently not elegible for the plan selected because you do not have enough posts.<br><br>");
}
}
if (!$error) {
//The user is elegible to upgrade and all checks have passed.
if ($packages_data['admin']) {
$admin = 1;
}
if ($packages_data['server'] != $upackinfo['packages']['server']) {
$different_server = 1;
}
//Flag meaning:
//
//IMMEDIATE UPGRADE FLAGS
//
//0 - Upgrade is immediate.
//5 - If admin approves the upgrade, then the upgrade will be immediate.
//
//6 - If admin approves the upgrade, then the new account will be created on the new server and the
// admin will know that they are moving to a new server so they can manually close the old account
// when they're ready.
//
//7 - The new account on the new server will be immediately created and the admin will be notified that
// the user is switching servers.
//
//NEXT MONTH UPGRADE FLAGS
//
//1 - Cron will upgrade them next month.
//2 - If admin approves this, then it will be set to 1 for cron to upgrade them next month.
//3 - The admin will be notified that the user wishes to be upgraded and if they approve it,
// then an account on the new server will be created so they can migrate to the new server.
// the admin can opt to switch the account over before next month if they both agree and the
// switch will be made in the admin area manually.
//
//4 - Cron will create a new account on the new server next month and inform the admin that the
// user is changing to the new server.
//
if ($next_month) {
$flags = "1";
if ($admin) {
$flags = "2";
if ($different_server) {
$flags = "3";
}
} else {
if ($different_server) {
$flags = "4";
}
}
} else {
$flags = "0";
if ($admin) {
$flags = "5";
if ($different_server) {
$flags = "6";
}
} else {
if ($different_server) {
$flags = "7";
}
}
}
$pending_upgrade = $dbh->select("upgrade", array("uid", "=", $_SESSION['cuser']));
//When the upgrade is finished, the entry is removed.
if ($pending_upgrade['id']) {
$upgrade_update = array("uid" => $_SESSION['cuser'], "newpack" => $packsid, "flags" => $flags, "created" => time(), "coupcode" => $db_coupcode);
$dbh->update("upgrade", $upgrade_update, array("id", "=", $pending_upgrade['id']), "1");
} else {
$upgrade_insert = array("uid" => $_SESSION['cuser'], "newpack" => $packsid, "flags" => $flags, "created" => time(), "coupcode" => $db_coupcode);
$dbh->insert("upgrade", $upgrade_insert);
}
$pending_upgrade = $dbh->select("upgrade", array("uid", "=", $_SESSION['cuser']));
$response = upgrade::do_upgrade($pending_upgrade['id'], "Init");
if ($response === false) {
echo "Your upgrade could not be completed as dialed. Please check with your admin and try your upgrade again later. The following tones are for the deaf community in hopes that they'll be able to hear again. BEEEEEEEEEEEEEEEEEEEEEEEEP!!!!!!!!";
} else {
echo $response;
}
return;
}
}
}
}
}
if ($packsid) {
$upgrade_array['PACK'] = style::replaceVar("tpl/upgrade/package.tpl", $package_array);
} else {
$select_package_array['PACKS'] = main::dropDown("packs", $packages, '', 0);
$upgrade_array['PACK'] = style::replaceVar("tpl/upgrade/select-package.tpl", $select_package_array);
}
echo style::replaceVar("tpl/upgrade/upgrade.tpl", $upgrade_array);
$page_shown = 1;
//The page doesn't show if they refresh it after the upgrade since the loop checks if they're upgrading to the same package they are on and fails if they are.
if (!$page_shown) {
main::redirect("?page=upgrade");
}
}
示例5: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
switch ($getvar['sub']) {
default:
if ($_POST) {
check::empty_fields();
if (!main::errors()) {
$subdomains_insert = array("domain" => $postvar['domain'], "server" => $postvar['server']);
$dbh->insert("subdomains", $subdomains_insert);
main::errors("Subdomain domain has been added!");
}
}
$servers_query = $dbh->select("servers");
if ($dbh->num_rows($servers_query) == 0) {
echo "There are no servers, you need to add a server first!";
return;
}
while ($servers_data = $dbh->fetch_array($servers_query)) {
$values[] = array($servers_data['name'], $servers_data['id']);
}
$add_subdomain_array['SERVER'] = main::dropDown("server", $values);
echo style::replaceVar("tpl/admin/subdomains/add-subdomain.tpl", $add_subdomain_array);
break;
case "edit":
if (isset($getvar['do'])) {
$subdomains_data = $dbh->select("subdomains", array("id", "=", $getvar['do']));
if (!$subdomains_data['id']) {
echo "That subdomain domain doesn't exist!";
} else {
if ($_POST) {
check::empty_fields();
if (!main::errors()) {
$subdomains_update = array("domain" => $postvar['domain'], "server" => $postvar['server']);
$dbh->update("subdomains", $subdomains_update, array("id", "=", $getvar['do']));
//Subdomain added
main::done();
}
}
$edit_subdomain_array['DOMAIN'] = $subdomains_data['domain'];
$servers_query = $dbh->select("servers");
while ($servers_data = $dbh->fetch_array($servers_query)) {
$values[] = array($servers_data['name'], $servers_data['id']);
}
$edit_subdomain_array['SERVER'] = main::dropDown("server", $values, $servers_data['server']);
echo style::replaceVar("tpl/admin/subdomains/edit-subdomain.tpl", $edit_subdomain_array);
}
} else {
$subdomains_query = $dbh->select("subdomains");
if ($dbh->num_rows($subdomains_query) == 0) {
echo "There are no subdomain domains to edit!";
} else {
echo "<ERRORS>";
while ($subdomains_data = $dbh->fetch_array($subdomains_query)) {
echo main::sub("<strong>" . $subdomains_data['domain'] . "</strong>", '<a href="?page=sub&sub=edit&do=' . $subdomains_data['id'] . '"><img src="' . URL . 'themes/icons/pencil.png"></a>');
}
}
}
break;
case "delete":
if (isset($getvar['do'])) {
$dbh->delete("subdomains", array("id", "=", $getvar['do']));
main::errors("Subdomain Deleted!");
}
$subdomains_query = $dbh->select("subdomains");
if ($dbh->num_rows($subdomains_query) == 0) {
echo "There are no subdomain domains to delete!";
} else {
echo "<ERRORS>";
while ($subdomains_data = $dbh->fetch_array($subdomains_query)) {
echo main::sub("<strong>" . $subdomains_data['domain'] . "</strong>", '<a href="?page=sub&sub=delete&do=' . $subdomains_data['id'] . '"><img src="' . URL . 'themes/icons/delete.png"></a>');
}
}
break;
}
}
示例6: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
switch ($getvar['sub']) {
default:
if ($_POST['add']) {
$no_check_array = array("resellerport", "welcome", "nstmp", "passtoo", "resellerid");
check::empty_fields($no_check_array);
if (!main::errors()) {
$servers_insert = array("ip" => $postvar['ip'], "resellerport" => $postvar['resellerport'], "port" => $postvar['port'], "nameservers" => $postvar['nameservers'], "name" => $postvar['name'], "host" => $postvar['host'], "user" => $postvar['user'], "accesshash" => $postvar['hash'], "type" => $postvar['type'], "dnstemplate" => $postvar['nstmp'], "welcome" => $postvar['welcome'], "pass" => $postvar['pass'], "reseller_id" => $postvar['resellerid'], "https" => $postvar['https'], "apiport" => $postvar['apiport']);
$dbh->insert("servers", $servers_insert);
main::errors("Server has been added!");
}
}
if ($_POST['addtype'] || $_POST['add']) {
$serverfile = server::createServer(0, $postvar['type']);
$server_fields = $serverfile->acp_form();
$add_server_array['SERVER_FIELDS'] = $server_fields;
$add_server_array['TYPE'] = $postvar['type'];
echo style::replaceVar("tpl/admin/servers/add-server.tpl", $add_server_array);
break;
}
$files = main::folderFiles(INC . "/servers/");
foreach ($files as $value) {
include INC . "/servers/" . $value;
$fname = explode(".", $value);
$stype = new $fname[0]();
$values[] = array($stype->name, $fname[0]);
}
$server_type_array['TYPE'] = main::dropDown("type", $values, 0);
echo style::replaceVar("tpl/admin/servers/server-type.tpl", $server_type_array);
break;
case "view":
if (isset($getvar['do'])) {
$servers_query = $dbh->select("servers", array("id", "=", $getvar['do']), 0, 0, 1);
if ($dbh->num_rows($servers_query) == 0) {
echo "That server doesn't exist!";
} else {
if ($_POST) {
check::empty_fields();
if (!main::errors()) {
$servers_update = array("name" => $postvar['name'], "host" => $postvar['host'], "reseller_id" => $postvar['resellerid'], "user" => $postvar['user'], "pass" => $postvar['pass'], "accesshash" => $postvar['hash'], "port" => $postvar['port'], "resellerport" => $postvar['resellerport'], "nameservers" => $postvar['nameservers'], "ip" => $postvar['ip'], "dnstemplate" => $postvar['nstmp'], "welcome" => $postvar['welcome'], "https" => $postvar['https'], "apiport" => $postvar['apiport']);
$dbh->update("servers", $servers_update, array("id", "=", $getvar['do']), 1);
//Server edit complete
main::done();
}
}
$servers_data = $dbh->fetch_array($servers_query);
$serverfile = server::createServer(0, $servers_data['type']);
$server_fields = $serverfile->acp_form($getvar['do']);
$edit_server_array['NAME'] = $servers_data['name'];
$edit_server_array['HOST'] = $servers_data['host'];
$edit_server_array['SERVERIP'] = $servers_data['ip'];
$edit_server_array['RESELLERPORT'] = $servers_data['resellerport'];
$edit_server_array['PORT'] = $servers_data['port'];
$edit_server_array['NAMESERVERS'] = $servers_data['nameservers'];
$edit_server_array['SERVER_FIELDS'] = $server_fields;
echo style::replaceVar("tpl/admin/servers/edit-server.tpl", $edit_server_array);
}
} else {
$servers_query = $dbh->select("servers");
if ($dbh->num_rows($servers_query) == 0) {
echo "There are no servers to view!";
} else {
echo "<ERRORS>";
while ($servers_data = $dbh->fetch_array($servers_query)) {
echo main::sub("<strong>" . $servers_data['name'] . "</strong>", '<a href="?page=servers&sub=view&do=' . $servers_data['id'] . '"><img src="' . URL . 'themes/icons/magnifier.png"></a>');
}
}
}
break;
case "delete":
if ($getvar['do']) {
$dbh->delete("servers", array("id", "=", $getvar['do']));
main::errors("Server Deleted!");
}
$servers_query = $dbh->select("servers");
if ($dbh->num_rows($servers_query) == 0) {
echo "There are no servers to delete!";
} else {
echo "<ERRORS>";
while ($servers_data = $dbh->fetch_array($servers_query)) {
echo main::sub("<strong>" . $servers_data['name'] . "</strong>", '<a href="?page=servers&sub=delete&do=' . $servers_data['id'] . '"><img src="' . URL . 'themes/icons/delete.png"></a>');
}
}
break;
case "test":
if (isset($getvar["do"])) {
$result = server::testConnection($getvar["do"]);
if ($result === true) {
echo '<div style="text-align:center;padding-top:10px;">' . style::notice(true, "Connected to the server successfully!") . "</div>";
} else {
echo '<div style="text-align:center;">' . style::notice(false, "Couldn't connect to the server...") . "</div>";
echo '<strong>Error:</strong><pre>' . (string) $result . '</pre>';
}
} else {
$servers_query = $dbh->select("servers");
if ($dbh->num_rows($servers_query) == 0) {
echo "There are no servers to view!";
} else {
//.........这里部分代码省略.........
示例7: acpPage
public function acpPage()
{
global $dbh, $postvar, $getvar, $instance;
if ($_POST) {
check::empty_fields(array("password", "paypalsandemail"));
if (!main::errors()) {
if (is_numeric($postvar['susdays']) && is_numeric($postvar['termdays'])) {
$dbh->updateConfig("suspensiondays", $postvar['susdays']);
$dbh->updateConfig("terminationdays", $postvar['termdays']);
$dbh->updateConfig("currency", $postvar['currency']);
$dbh->updateConfig("currency_format", $postvar['currency_format']);
$dbh->updateConfig("paypalemail", $postvar['paypalemail']);
$dbh->updateConfig("paypalmode", $postvar['paypalmode']);
$dbh->updateConfig("paypalsandemail", $postvar['paypalsandemail']);
main::errors("Values have been updated!");
} else {
main::errors("Please enter a valid value!");
}
}
}
$currency_values[] = array("Pound Sterling", "GBP");
$currency_values[] = array("US Dollars", "USD");
$currency_values[] = array("Australian Dollars", "AUD");
$currency_values[] = array("Canadian Dollars", "CAD");
$currency_values[] = array("Euros", "EUR");
$currency_values[] = array("Yen", "JPY");
$currency_values[] = array("New Zealand Dollar", "NZD");
$currency_values[] = array("Swiss Franc", "CHF");
$currency_values[] = array("Hong Kong Dollar", "HKD");
$currency_values[] = array("Singapore Dollar", "SGD");
$currency_values[] = array("Swedish Krona", "SEK");
$currency_values[] = array("Danish Krone", "DKK");
$currency_values[] = array("Polish Zloty", "PLN");
$currency_values[] = array("Norwegian Krone", "NOK");
$currency_values[] = array("Hungarian Forint", "HUF");
$currency_values[] = array("Czech Koruna", "CZK");
$currency_values[] = array("Israeli Shekel", "ILS");
$currency_values[] = array("Mexican Peso", "MXN");
$paypal_values[] = array("Live", "live");
$paypal_values[] = array("Sandbox", "sandbox");
$currency_format_values[] = array("1,000.99", ".");
$currency_format_values[] = array("1 000,99", ",");
$paid_configuration_array['CURRENCY'] = main::dropDown("currency", $currency_values, $dbh->config("currency"));
$paid_configuration_array['CURRENCY_FORMAT'] = main::dropDown("currency_format", $currency_format_values, $dbh->config("currency_format"));
$paid_configuration_array['PAYPALMODE'] = main::dropDown("paypalmode", $paypal_values, $dbh->config("paypalmode"));
$paid_configuration_array['PAYPALSANDEMAIL'] = $dbh->config("paypalsandemail");
$paid_configuration_array['SUSDAYS'] = $dbh->config("suspensiondays");
$paid_configuration_array['TERDAYS'] = $dbh->config("terminationdays");
$paid_configuration_array['PAYPALEMAIL'] = $dbh->config("paypalemail");
echo style::replaceVar("tpl/admin/paid-configuration.tpl", $paid_configuration_array);
}
示例8: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
switch ($getvar['sub']) {
default:
if ($_POST['add']) {
$no_check_array = array("admin", "groupid", "sendwelcome", "welcomesubject", "welcomebody");
check::empty_fields($no_check_array);
$ZserverID = $postvar['server'];
unset($where);
$where[] = array("id", "=", $ZserverID, "AND");
$where[] = array("type", "=", "zpanel");
$servers_query = $dbh->select("servers", $where, 0, 0, 1);
if ($dbh->num_rows($servers_query) == 1) {
$zpanel_srv = 1;
}
//Hack to make sure the Group ID isn't 0 on ZPanel
if ($zpanel_srv && ($postvar["groupid"] == 0 || $postvar["backend"] == 0)) {
main::errors(" ZPanel server packages must include a Group ID for the package and the a backend package ID that's greater than 0. See the info bubbles for help.");
}
if ($postvar["monthly"] && !is_numeric($postvar["monthly"]) || $postvar["signup"] && !is_numeric($postvar["signup"])) {
main::errors("Please enter a positive number for the cost or posts fields.");
}
if (!main::errors()) {
$not_additional_array = array("add", "name", "backend", "description", "type", "server", "admin", "groupid", "sendwelcome", "welcomesubject", "welcomebody", $GLOBALS['csrf']['input-name']);
foreach ($postvar as $key => $value) {
if (!in_array($key, $not_additional_array)) {
if ($n) {
$additional .= ",";
}
$additional .= $key . "=" . str_replace(array(" ", ","), array("", "."), $value);
$n++;
}
}
$packages_insert = array("name" => $postvar['name'], "backend" => $postvar['backend'], "description" => $postvar['description'], "type" => $postvar['type'], "server" => $postvar['server'], "admin" => $postvar['admin'], "is_hidden" => $postvar['hidden'], "is_disabled" => $postvar['disabled'], "additional" => $additional, "reseller" => $postvar['reseller'], "groupid" => $postvar['groupid'], "send_email" => $postvar['sendwelcome'], "email_subject" => $postvar['welcomesubject'], "email_body" => $postvar['welcomebody']);
$dbh->insert("packages", $packages_insert);
main::errors("Package has been added!<br>");
}
}
if ($_POST['packserver'] || $_POST['add']) {
$servers_data = $dbh->select("servers", array("id", "=", $postvar['server']), 0, "1");
$serverfile = server::createServer(0, $servers_data['type']);
$package_fields = $serverfile->acp_packages_form();
$add_package_array['TYPE_FORM'] = type::acpPadd($postvar['type']);
$add_package_array['TYPE'] = $postvar['type'];
$add_package_array['PACKAGES_FIELDS'] = $package_fields;
$add_package_array['SERVER'] = $postvar['server'];
echo style::replaceVar("tpl/admin/packages/add-package.tpl", $add_package_array);
break;
}
$servers_query = $dbh->select("servers");
if ($dbh->num_rows($servers_query) == 0) {
echo "There are no servers, you need to add a server first!";
return;
}
while ($servers_data = $dbh->fetch_array($servers_query)) {
$values[] = array($servers_data['name'], $servers_data['id']);
}
$p2h_query = $dbh->select("p2h");
$p2h_data = $dbh->num_rows($p2h_query);
if ($p2h_data != "0") {
$package_server_array['P2HOPTION'] = '<option value="p2h">Post 2 Host</option>';
} else {
$package_server_array['P2HOPTION'] == "";
}
$package_server_array['SERVER'] = main::dropDown("server", $values);
echo "This will only add the package to THT, not create the package on the backend for you.<br><br>";
echo style::replaceVar("tpl/admin/packages/package-server.tpl", $package_server_array);
break;
case "edit":
if (isset($getvar['do'])) {
$packages_query = $dbh->select("packages", array("id", "=", $getvar['do']), 0, 0, 1);
if ($dbh->num_rows($packages_query) == 0) {
echo "That package doesn't exist!";
} else {
if ($_POST) {
$no_check_array = array("admin", "groupid", "sendwelcome", "welcomesubject", "welcomebody");
check::empty_fields($no_check_array);
$ZserverID = $postvar['server'];
unset($where);
$where[] = array("id", "=", $ZserverID, "AND");
$where[] = array("type", "=", "zpanel");
$servers_query = $dbh->select("servers", $where, 0, 0, 1);
if ($dbh->num_rows($servers_query) == 1) {
$zpanel_srv = 1;
}
//Hack to make sure the Group ID isn't 0 on ZPanel
if ($zpanel_srv && ($postvar["groupid"] == 0 || $postvar["backend"] == 0)) {
main::errors(" ZPanel server packages must include a Group ID for the package and the a backend package ID that's greater than 0. See the info bubbles for help.");
}
if ($postvar["monthly"] && !is_numeric($postvar["monthly"]) || $postvar["signup"] && !is_numeric($postvar["signup"])) {
main::errors("Please enter a positive number for the cost or posts fields.");
}
if (!main::errors()) {
$not_additional_array = array("edit", "name", "backend", "description", "type", "server", "admin", "groupid", "sendwelcome", "welcomesubject", "welcomebody", $GLOBALS['csrf']['input-name']);
foreach ($postvar as $key => $value) {
if (!in_array($key, $not_additional_array)) {
if ($n) {
$additional .= ",";
}
//.........这里部分代码省略.........
示例9: edit_article
private function edit_article()
{
global $dbh, $postvar, $getvar, $instance;
$cats_query = $dbh->select("cats");
if (!$dbh->num_rows($cats_query)) {
echo "You need to add a category before you add an article.";
return;
}
if ($_POST['edit']) {
check::empty_fields();
if (!main::errors()) {
$articles_update = array("name" => $postvar['editname'], "content" => $postvar['editdescription'], "catid" => $postvar['catid']);
$dbh->update("articles", $articles_update, array("id", "=", $getvar['id']));
main::errors("Article Edited!");
}
}
if ($getvar['del']) {
$dbh->delete("articles", array("id", "=", $getvar['del']));
main::errors("Article Deleted!");
}
if (main::isint($getvar['categoryid'])) {
$show_cat[] = array("catid", "=", $getvar['categoryid']);
}
if (!main::isint($getvar['id'])) {
$list_articles_array['BOXES'] = "";
$articles_query = $dbh->select("articles", $show_cat, 0, 0, 1);
if ($dbh->num_rows($articles_query)) {
while ($articles_data = $dbh->fetch_array($articles_query)) {
$edit_article_box_array['NAME'] = $articles_data['name'];
$edit_article_box_array['ID'] = $articles_data['id'];
$list_articles_array['BOXES'] .= style::replaceVar("tpl/admin/kb/edit-article-box.tpl", $edit_article_box_array);
}
}
echo style::replaceVar("tpl/admin/kb/list-articles.tpl", $list_articles_array);
} else {
$cats_query = $dbh->select("cats");
while ($cat = $dbh->fetch_array($cats_query)) {
$values[] = array($cat['name'], $cat['id']);
}
$article_data = $dbh->select("articles", array("id", "=", $getvar['id']), 0, "1");
$edit_article_array['NAME'] = $article_data['name'];
$edit_article_array['DESCRIPTION'] = $article_data['content'];
$edit_article_array['DROPDOWN'] = main::dropDown("catid", $values, $article_data['catid']);
echo style::replaceVar("tpl/admin/kb/edit-article.tpl", $edit_article_array);
}
}
示例10: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
switch ($getvar['sub']) {
default:
if ($_POST) {
$no_check_fields = array("last_tld_update", "otherdefault");
check::empty_fields($no_check_fields);
if ($postvar['url'] && substr($postvar['url'], -1, 1) != "/") {
$postvar['url'] = $postvar['url'] . "/";
}
if ($postvar['default_page'] && $postvar['default_page'] == "-other-") {
if (!$postvar['otherdefault']) {
main::errors("Please enter the default directory to redirect to.");
} else {
if (is_dir("../" . $postvar['otherdefault'])) {
$postvar['default_page'] = $postvar['otherdefault'];
} else {
main::errors("The default directory entered does not exist.");
}
}
}
if ($postvar['last_tld_update'] == "never") {
$dbh->updateConfig("last_tld_update", "never");
} else {
unset($postvar['last_tld_update']);
}
if (!main::errors()) {
foreach ($postvar as $key => $value) {
$dbh->updateConfig($key, $value);
}
main::errors("Settings Updated!");
}
}
$general_settings_array['NAME'] = $dbh->config("name");
$general_settings_array['URL'] = $dbh->config("url");
$general_settings_array['RECURL'] = $_SERVER['HTTP_HOST'];
$values[] = array("Order Form", "order");
$values[] = array("Client Area", "client");
$values[] = array("Knowledge Base", "support");
$values[] = array("Other", "-other-");
if ($dbh->config('default_page') != ADMINDIR && $dbh->config('default_page') != "order" && $dbh->config('default_page') != "client") {
$general_settings_array['DEFAULT_PAGE'] = main::dropDown("default_page", $values, "-other-");
$general_settings_array['OTHERDEFAULT'] = $dbh->config('default_page');
} else {
$general_settings_array['OTHERDEFAULT'] = "";
$general_settings_array['DEFAULT_PAGE'] = main::dropDown('default_page', $values, $dbh->config('default_page'));
}
$IANA_queue_values[] = array("No", "");
$IANA_queue_values[] = array("Yes", "never");
$general_settings_array['QUEUE_IANA'] = main::dropDown("last_tld_update", $IANA_queue_values, $dbh->config("last_tld_update"));
$general_settings_array['TLD_UPDATE_DAYS'] = $dbh->config("tld_update_days");
echo style::replaceVar("tpl/admin/settings/general-settings.tpl", $general_settings_array);
break;
case "security":
//security settings
if ($_POST) {
check::empty_fields();
if (!check::email($postvar['email_for_cron'], 0, 0, 1)) {
main::errors("Please verify that the email you're using for cron output is of a valid format.");
}
if (!main::errors()) {
foreach ($postvar as $key => $value) {
$dbh->updateConfig($key, $value);
}
main::errors("Settings Updated!");
}
}
$values[] = array("Yes", "1");
$values[] = array("No", "0");
$security_settings_array['SHOW_VERSION_ID'] = main::dropDown("show_version_id", $values, $dbh->config("show_version_id"));
$security_settings_array['SHOW_PAGE_GENTIME'] = main::dropDown("show_page_gentime", $values, $dbh->config("show_page_gentime"));
$security_settings_array['SHOW_FOOTER'] = main::dropDown("show_footer", $values, $dbh->config("show_footer"));
$security_settings_array['SHOW_ERRORS'] = main::dropDown("show_errors", $values, $dbh->config("show_errors"));
$security_settings_array['EMAIL_ON_CRON'] = main::dropDown("emailoncron", $values, $dbh->config("emailoncron"));
$security_settings_array['EMAIL_FOR_CRON'] = $dbh->config("email_for_cron");
$security_settings_array['SESSION_TIMEOUT'] = $dbh->config("session_timeout");
echo style::replaceVar("tpl/admin/settings/security-settings.tpl", $security_settings_array);
break;
case "tos":
if ($_POST) {
check::empty_fields();
if (!main::errors()) {
$dbh->updateConfig("tos", $postvar['tos']);
main::errors("Settings Updated!");
}
}
$tos_array['TOS'] = $dbh->config("tos");
echo style::replaceVar("tpl/admin/settings/tos.tpl", $tos_array);
break;
case "signup":
if ($_POST) {
check::empty_fields();
if (!main::errors()) {
foreach ($postvar as $key => $value) {
$dbh->updateConfig($key, $value);
}
main::errors("Settings Updated!");
}
}
//.........这里部分代码省略.........
示例11: EditEmailTemplates
private function EditEmailTemplates()
{
global $dbh, $postvar, $getvar, $instance;
if (main::isint($getvar['do'])) {
if ($postvar['edittpl']) {
check::empty_fields();
if (!main::errors()) {
$dbh->update("templates", array("subject" => $postvar['subject']), array("id", "=", $getvar['do']));
$template_info = $dbh->select("templates", array("id", "=", $getvar['do']));
$tmpl_file_base = INC . "/tpl/email/" . $template_info['dir'] . "/" . $template_info['name'];
if (!is_writable($tmpl_file_base . ".tpl")) {
main::errors("In order to make changes to this file (" . $tmpl_file_base . ".tpl), please make it writable.");
} else {
$contents = stripslashes($postvar['emailcontent']);
if ($contents) {
$filetochangeOpen = fopen($tmpl_file_base . ".tpl", "w");
if (!fputs($filetochangeOpen, $contents)) {
main::errors("Could not write the template file, " . $tmpl_file_base . ".tpl");
}
fclose($filetochangeOpen);
}
if (!main::errors()) {
main::errors("Template edited!");
}
}
}
}
$template_data = $dbh->select("templates", array("id", "=", $getvar['do']));
if (!$template_data['id']) {
$error_array['Error'] = "Template not found.";
$error_array['Template ID'] = $getvar['do'];
main::error($error_array);
} else {
$tmpl_file_base = INC . "/tpl/email/" . $template_data['dir'] . "/" . $template_data['name'];
$tmpl_content_file = @file_get_contents($tmpl_file_base . ".tpl");
$tmpl_descrip_file = @file_get_contents($tmpl_file_base . ".desc.tpl");
if (!$tmpl_content_file && !$tmpl_descrip_file) {
$error_array['Error'] = "One of the template files don't exist.<br>";
$error_array['Template Locations'] = "<br>" . $tmpl_file_base . ".tpl<br>" . $tmpl_file_base . ".desc.tpl";
main::error($error_array);
} else {
$edit_email_template_array['SUBJECT'] = $template_data['subject'];
$edit_email_template_array['DESCRIPTION'] = $tmpl_descrip_file;
$edit_email_template_array['TEMPLATE'] = $tmpl_content_file;
}
}
echo style::replaceVar("tpl/admin/mail/edit-email-template.tpl", $edit_email_template_array);
return;
}
if (main::isint($postvar['template'])) {
main::redirect("?page=email&sub=templates&do=" . $postvar['template']);
}
$templates_query = $dbh->select("templates", 0, array("acpvisual", "ASC"));
while ($templates_data = $dbh->fetch_array($templates_query)) {
$values[] = array($templates_data['acpvisual'], $templates_data['id']);
}
$select_email_template_array['TEMPLATES'] = main::dropDown("template", $values, 0, 1);
echo style::replaceVar("tpl/admin/mail/select-email-template.tpl", $select_email_template_array);
}