当前位置: 首页>>代码示例>>PHP>>正文


PHP server::createServer方法代码示例

本文整理汇总了PHP中server::createServer方法的典型用法代码示例。如果您正苦于以下问题:PHP server::createServer方法的具体用法?PHP server::createServer怎么用?PHP server::createServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在server的用法示例。


在下文中一共展示了server::createServer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: serverhasrestore

 public function serverhasrestore($servertype)
 {
     global $dbh, $postvar, $getvar, $instance;
     $restoreserver = server::createServer(0, $servertype);
     if (method_exists($restoreserver, "restore")) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:10,代码来源:class_backup.php

示例2: array

 $domain_array['DOMAIN'] = $postvar['cdom'];
 if (empty($domain_array['DOMAIN'])) {
     $domain_array['DOMAIN'] = $postvar['csub'];
 }
 $order_form_array['TOS'] = $dbh->config("tos");
 $order_form_array['TZADJUST'] = main::tzlist($tz_default);
 $order_form_array['COUNTRIES'] = main::countries(1, $postvar['country']);
 //1 = Make it a drop down instead of pulling an array.  The second part makes it set it's default.
 $ptype = type::packagetype($getvar['package']);
 $order_form_array['TYPESPECIFIC'] = type::orderForm($ptype);
 if ($getvar['domsub'] == "dom") {
     $order_form_array['DOMORSUB'] = style::replaceVar("tpl/order/domain.tpl", $domain_array);
 } else {
     $pack = $getvar['package'];
     $server_type = type::packageserver($pack);
     $serverfile = server::createServer($server_type);
     $can_create_subs = $serverfile->subdomains;
     if ($can_create_subs == false) {
         $maincontent = main::table("Subdomain Error", "Sorry, but the server for this package doesn't allow subdomains to be used without a unique domain present on the account.  If you'd like to\n                                                                   use a domain, please go back and select the domain option.");
     } else {
         $subdomains_query = $dbh->select("subdomains", array("server", "=", $server_type), array("subdomain", "ASC"), 0, 1);
         while ($subdomains_data = $dbh->fetch_array($subdomains_query)) {
             $subdomains[] = array($subdomains_data['domain'], $subdomains_data['domain']);
         }
         if ($postvar['csub2']) {
             $subtld = $postvar['csub2'];
         } else {
             $subtld = $subdomains[0]['domain'];
         }
         $subdomain_array['SUBDOMTLDLIST'] = main::dropdown("csub2", $subdomains, $subtld);
         $order_form_array['DOMORSUB'] = style::replaceVar("tpl/order/subdomain.tpl", $subdomain_array);
开发者ID:cozylife,项目名称:tht-reworked,代码行数:31,代码来源:index.php

示例3: do_upgrade


//.........这里部分代码省略.........
                 $new_server = 1;
             }
             break;
         case "7":
             $upgrade = 1;
             $new_server = 1;
             $admin_inform = 1;
             break;
     }
     $adminmsg_array['USER'] = $username;
     $adminmsg_array['NEWPLAN'] = $newpack_name;
     $adminmsg_array['OLDPLAN'] = $current_pack_name;
     $adminmsg_array['NEWSERVER'] = $new_server_name;
     $adminmsg_array['OLDSERVER'] = $old_server_name;
     if ($immediate) {
         $adminmsg_array['NEXTMONTH_IMMEDIATELY'] = "immediately";
     } else {
         $adminmsg_array['NEXTMONTH_IMMEDIATELY'] = "next billing cycle";
     }
     $url = $dbh->config("url");
     if (ADMINDIR) {
         $admin_dir = ADMINDIR;
     } else {
         $admin_dir = "admin";
     }
     $adminmsg_array['APPROVE_LINK'] = $url . $admin_dir . "/?page=users&sub=upgrade";
     if ($upgrade) {
         if ($new_plan_data['type'] == "paid") {
             $new_invoice_text = "  A new invoice has been generated.";
             if ($current_pack_type == "paid" && $user_data['additional']['monthly'] >= $new_plan_additional['monthly']) {
                 unset($new_invoice_text);
             }
         }
         $serverfile = server::createServer($newpack);
         if ($new_server) {
             $new_serv_pass_for_email = time();
             $domsub = "sub";
             //Checks to see if the domain contains 3 or more segments and fails if there are more than 3 and if the last one two aren't TLD portions, it fails,
             //so we can see if this is a subdomain this way.
             if (check::domain($user_data['user_data']['domain'])) {
                 $domsub = "dom";
             }
             $done = $serverfile->signup(type::packageserver($newpack), $new_plan_data['reseller'], $username, $user_email, $new_serv_pass_for_email, $user_data['user_data']['domain'], type::packageBackend($newpack), $domsub);
             if ($done === true) {
                 if ($new_plan_data['reseller']) {
                     $uemaildata = email::emailTemplate("upgrade-newserv-resell-welcome");
                 } else {
                     $uemaildata = email::emailTemplate("upgrade-newserv-welcome");
                 }
                 $change_tht = 1;
                 main::errors("Your upgrade request has been completed.  An email has been sent to you detailing your upgraded account on the new server." . $new_invoice_text);
             } else {
                 return false;
             }
         } else {
             if ($serverfile->canupgrade) {
                 $done = $serverfile->do_upgrade($new_plan_data['server'], type::packageBackend($newpack), $username);
                 if ($done === true) {
                     if ($new_plan_data['reseller']) {
                         $uemaildata = email::emailTemplate("upgrade-resell-welcome");
                     } else {
                         $uemaildata = email::emailTemplate("upgrade-welcome");
                     }
                     $change_tht = 1;
                     main::errors("Your upgrade request has been completed.  An email has been sent to you detailing your upgraded account." . $new_invoice_text);
                 } else {
开发者ID:cozylife,项目名称:tht-reworked,代码行数:67,代码来源:class_upgrade.php

示例4: 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 {
//.........这里部分代码省略.........
开发者ID:cozylife,项目名称:tht-reworked,代码行数:101,代码来源:servers.php

示例5: 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 .= ",";
                                     }
//.........这里部分代码省略.........
开发者ID:cozylife,项目名称:tht-reworked,代码行数:101,代码来源:packages.php


注:本文中的server::createServer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。