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


PHP main::sub方法代码示例

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


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

示例1: content

 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     $version_info = main::latest_version();
     $current_version = $version_info['THT'];
     $new_version_download = $version_info['THT_DL'];
     $running_version = $dbh->config('version');
     $install_check = $this->checkDir(INC . "../install/");
     $conf_check = $this->checkPerms(INC . "/conf.inc.php");
     if ($current_version == $running_version) {
         $updatemsg = "<span style='color:green'>Up-To-Date</span>";
         $upgrademsg = "";
     } else {
         $updatemsg = "<span style='color:red'>Upgrade Avaliable</span>";
         $upgrademsg = "<div class='warn'><img src='../themes/icons/error.png' alt='' /> There is a new version ({$current_version}) avaliable! <a href = '" . $new_version_download . "' target = '_blank'>Please download it here</a> and upgrade!</div>";
     }
     unset($current_version);
     unset($running_version);
     $stats['VERSION'] = $dbh->config('version');
     $stats['THEME'] = $dbh->config('theme');
     $stats['CENABLED'] = main::cleaninteger($dbh->config('cenabled'));
     $stats['SVID'] = main::cleaninteger($dbh->config('show_version_id'));
     $stats['SENABLED'] = main::cleaninteger($dbh->config('senabled'));
     $stats['DEFAULT'] = $dbh->config('default_page');
     $stats['EMETHOD'] = $dbh->config('emailmethod');
     $stats['SIGNENABLE'] = main::cleaninteger($dbh->config('general'));
     $stats['MULTI'] = main::cleaninteger($dbh->config('multiple'));
     $stats['UPDATE'] = $updatemsg;
     $stats['UPG_BOX'] = $upgrademsg;
     $stats_box = style::replaceVar('tpl/admin/home/stats.tpl', $stats);
     $content = '<strong>Welcome to your Admin Dashboard!</strong><br />Welcome to the dashboard of your Admin Control Panel. In this area you can do the tasks that you need to complete such as manage servers, create packages, manage users.<br />
             Here, you can also change the look and feel of your THT Installation. If you require any help, be sure to ask at the <a href="http://thehostingtool.com/forum" title="THT Community is the official stop for THT Support, THT Modules, Developer Center and more! Visit our growing community now!" class="tooltip">THT Community</a><br /><br />' . $stats_box . '<br />' . $install_check . $conf_check . '</div></div>';
     echo $content;
     if ($_POST) {
         $dbh->update("admin_notes", array("notes" => $postvar['admin_notes']), array("id", "=", "1"));
         main::errors("Settings Updated!");
         main::done();
     }
     $notes_data = $dbh->select("admin_notes", array("id", "=", "1"));
     $notepad_array['NOTEPAD'] = $notes_data['notes'];
     $content_notepad = style::replaceVar('tpl/admin/home/notepad.tpl', $notepad_array);
     echo '<br />';
     echo main::table('Admin Notepad', $content_notepad, 'auto', 'auto');
     $news = main::sub("<strong>Add the THT RSS Feed!</strong>", '<a href="http://thehostingtool.com/forum/syndication.php?fid=2" target="_blank" class="tooltip" title="Add the THT RSS Feed!"><img src="<URL>themes/icons/feed.png" /></a>');
     $rss_feed = @file_get_contents("http://thehostingtool.com/forum/syndication.php?fid=2&limit=3");
     if ($rss_feed !== false) {
         $xml = new SimpleXMLElement($rss_feed);
         foreach ($xml->channel->item as $item) {
             $newsitem_array['title'] = $item->title;
             $newsitem_array['author'] = "THT";
             $newsitem_array['link'] = $item->link;
             $newsitem_array['TIME'] = main::convertdate("n/d/Y", strtotime($item->pubDate));
             $newsitem_array['SUMMARY'] = $item->description;
             $news .= style::replaceVar('tpl/admin/home/news-item.tpl', $newsitem_array);
         }
     }
     echo "<br />";
     echo main::table('THT News & Updates', $news);
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:59,代码来源:home.php

示例2: content

 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     $cats_query = $dbh->select("cats");
     if (!$dbh->num_rows($cats_query)) {
         echo "There are no knowledge base categories or articles!";
     } else {
         if ($getvar['cat']) {
             $cats_data = $dbh->select("cats", array("id", "=", $getvar['cat']));
             if (!$cats_data['id']) {
                 echo "That category doesn't exist!";
             } else {
                 echo main::sub('<img src="<ICONDIR>arrow_rotate_clockwise.png"><a href="?page=kb">Return To Category Selection</a>', '');
                 $articles_query = $dbh->select("articles", array("catid", "=", $getvar['cat']), 0, 0, 1);
                 if (!$dbh->num_rows($articles_query)) {
                     echo "There are no articles in this category!";
                 } else {
                     while ($articles_data = $dbh->fetch_array($articles_query)) {
                         $article_box_array['NAME'] = $articles_data['name'];
                         $article_box_array['ID'] = $articles_data['id'];
                         echo style::replaceVar("tpl/kb/article-box.tpl", $article_box_array);
                     }
                 }
             }
             return;
         }
         if ($getvar['art']) {
             $articles_data = $dbh->select("articles", array("id", "=", $getvar['art']));
             if (!$articles_data['id']) {
                 echo "That article doesn't exist!";
             } else {
                 $view_article_array['NAME'] = $articles_data['name'];
                 $view_article_array['CONTENT'] = $articles_data['content'];
                 $view_article_array['CATID'] = $articles_data['catid'];
                 echo style::replaceVar("tpl/kb/view-article.tpl", $view_article_array);
             }
             return;
         }
         //Show this by default.
         while ($cats_data = $dbh->fetch_array($cats_query)) {
             $category_box_array['NAME'] = $cats_data['name'];
             $category_box_array['DESCRIPTION'] = $cats_data['description'];
             $category_box_array['ID'] = $cats_data['id'];
             echo style::replaceVar("tpl/kb/category-box.tpl", $category_box_array);
         }
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:47,代码来源:kb.php

示例3: ViewClient

 private function ViewClient($client)
 {
     global $dbh, $postvar, $getvar, $instance;
     $client_details_array['DATE'] = main::convertdate("n/d/Y", $client['signup']);
     $client_details_array['EMAIL'] = $client['email'];
     $client_details_array['UPGRADEINFO'] = "";
     $existing_upgrade = $dbh->select("upgrade", array("uid", "=", $client['id']));
     $all_packs_query = $dbh->select("packages", array("is_disabled", "=", "0"), array("type", "ASC"), 0, 1);
     while ($all_packs_data = $dbh->fetch_array($all_packs_query)) {
         $additional = type::additional($all_packs_data['id']);
         $monthly = $additional['monthly'];
         $signup = $additional['signup'];
         unset($info);
         if ($all_packs_data['type'] == "p2h") {
             $info = "[Signup Posts: " . $signup . ", Monthly Posts: " . $monthly . "] ";
         } elseif ($all_packs_data['type'] == "paid") {
             $info = "[" . main::money($monthly) . "] ";
         }
         $packages[] = array("[" . $all_packs_data['type'] . "] " . $info . $all_packs_data['name'], $all_packs_data['id']);
         if ($existing_upgrade && $existing_upgrade['newpack'] == $all_packs_data['id']) {
             if ($all_packs_data['admin']) {
                 $admin = " after you approve them";
             }
             if ($existing_upgrade['flags'] && $existing_upgrade['flags'] < 5) {
                 $next_cycle = " next billing cycle";
             }
             $client_details_array['UPGRADEINFO'] = "NOTE: This user is slated for an upgrade to \"" . $all_packs_data['name'] . "\"" . $next_cycle . $admin . ".<br><br>";
         }
     }
     $client_details_array['PACKAGE'] = main::dropdown("newpackage", $packages, $client['pid']);
     $client_details_array['USER'] = $client['user'];
     $client_details_array['DOMAIN'] = $client['domain'];
     $client_details_array['CLIENTIP'] = $client['ip'];
     $client_details_array['FIRSTNAME'] = $client['firstname'];
     $client_details_array['LASTNAME'] = $client['lastname'];
     $client_details_array['ADDRESS'] = $client['address'];
     $client_details_array['CITY'] = $client['city'];
     $client_details_array['STATE'] = $client['state'];
     $client_details_array['ZIP'] = $client['zip'];
     $client_details_array['COUNTRY'] = strtolower($client['country']);
     $client_details_array['FULLCOUNTRY'] = main::country_code_to_country($client['country']);
     $client_details_array['PHONE'] = $client['phone'];
     unset($where);
     $where[] = array("uid", "=", $client['id'], "AND");
     $where[] = array("is_paid", "=", "0");
     $invoices_query = $dbh->select("invoices", $where, 0, 0, 1);
     $client_details_array['INVOICES'] = $dbh->num_rows($invoices_query);
     switch ($client['status']) {
         default:
             $client_details_array['STATUS'] = "Other";
             break;
         case "1":
             $client_details_array['STATUS'] = "Active";
             break;
         case "2":
             $client_details_array['STATUS'] = "Suspended";
             break;
         case "3":
             $client_details_array['STATUS'] = "Awaiting Validation";
             break;
         case "4":
             $client_details_array['STATUS'] = "Awaiting Payment";
             break;
         case "5":
             $client_details_array['STATUS'] = "Awaiting Email Confirmation";
             break;
         case "9":
             $client_details_array['STATUS'] = "Cancelled";
             break;
     }
     $class = type::packagetype($client['pid']);
     $packtype = $instance->packtypes[$class];
     if (method_exists($packtype, "acpBox")) {
         $box = $packtype->acpBox();
         $clientview_array['BOX'] = main::sub($box[0], $box[1]);
     } else {
         $clientview_array['BOX'] = "";
     }
     $clientview_array['CONTENT'] = style::replaceVar("tpl/admin/clients/client-details.tpl", $client_details_array);
     return $clientview_array;
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:81,代码来源:users.php

示例4: content

 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     unset($where);
     $where[] = array("reply", "=", "0", "AND");
     $where[] = array("userid", "=", $_SESSION['cuser']);
     $all_tickets_query = $dbh->select("tickets", $where, 0, 0, 1);
     $client_home_array['TICKETS'] = $dbh->num_rows($all_tickets_query);
     unset($where);
     $where[] = array("reply", "=", "0", "AND");
     $where[] = array("status", "=", "1", "AND");
     $where[] = array("userid", "=", $_SESSION['cuser']);
     $open_tickets_query = $dbh->select("tickets", $where, 0, 0, 1);
     $client_home_array['OPENTICKETS'] = $dbh->num_rows($open_tickets_query);
     unset($where);
     $where[] = array("reply", "=", "0", "AND");
     $where[] = array("status", "=", "3", "AND");
     $where[] = array("userid", "=", $_SESSION['cuser']);
     $closed_tickets_query = $dbh->select("tickets", $where, 0, 0, 1);
     $client_home_array['CLOSEDTICKETS'] = $dbh->num_rows($closed_tickets_query);
     unset($where);
     $where[] = array("uid", "=", $_SESSION['cuser'], "AND");
     $where[] = array("message", "LIKE", "Login%");
     $log_data = $dbh->select("logs", $where, array("id", "DESC"), "1");
     if ($log_data['logtime']) {
         $client_home_array['LASTDATE'] = main::convertdate("n/d/Y", $log_data['logtime']);
         $client_home_array['LASTTIME'] = main::convertdate("g:i a", $log_data['logtime']);
         $client_home_array['LASTLOGIN'] = $client_home_array['LASTDATE'] . " at " . $client_home_array['LASTTIME'];
     } else {
         $client_home_array['LASTLOGIN'] = "None";
     }
     $client_data = $dbh->client($_SESSION['cuser']);
     $client_home_array['DATE'] = main::convertdate("n/d/Y", $client_data['signup']);
     $client_home_array['EMAIL'] = $client_data['email'];
     $client_home_array['ALERTS'] = $dbh->config('alerts');
     $client_home_array['UNAME'] = $client_data['user'];
     $packages_data = $dbh->select("packages", array("id", "=", $client_data['pid']));
     $client_home_array['PACKAGE'] = $packages_data['name'];
     unset($where);
     $where[] = array("uid", "=", $client_data['id'], "AND");
     $where[] = array("is_paid", "=", "0");
     $invoices_query = $dbh->select("invoices", $where, 0, 0, 1);
     $client_home_array['INVOICES'] = $dbh->num_rows($invoices_query);
     unset($where);
     $where[] = array("uid", "=", $client_data['id'], "AND");
     $where[] = array("message", "LIKE", "Suspended (%");
     $suspended_data = $dbh->select("logs", $where, array("id", "DESC"), "1");
     switch ($client_data['status']) {
         default:
             $client_home_array['STATUS'] = "Other";
             break;
         case "1":
             $client_home_array['STATUS'] = "Active";
             break;
         case "2":
             $client_home_array['STATUS'] = "Suspended";
             $suspended_message = str_replace(")", "", $suspended_data['message']);
             $suspended_message = str_replace("Suspended (", "", $suspended_message);
             $client_home_array['STATUS_REASON'] = "<br><br><b>Suspended for:</b> " . $suspended_message;
             break;
         case "4":
             $client_home_array['STATUS'] = "Awaiting Payment";
             break;
         case "5":
             $client_home_array['STATUS'] = "Awaiting Email Confirmation";
             break;
         case "9":
             $client_home_array['STATUS'] = "Cancelled";
             break;
     }
     if (!$client_home_array['STATUS_REASON']) {
         $client_home_array['STATUS_REASON'] = "";
     }
     $typename = type::packagetype($client_data['pid']);
     $type_instance = $instance->packtypes[$typename];
     if (method_exists($type_instance, "clientBox")) {
         $box = $type_instance->clientBox();
         $client_home_array['BOX'] = main::sub($box[0], $box[1]);
     } else {
         $clienthome_array['BOX'] = "";
     }
     if ($dbh->config('alerts')) {
         $client_home_array['ALERTS'] = "<font size = '3'><b>Announcements:</b></font><br><font size = '2'>" . $dbh->config('alerts') . "</font><br><hr size = '1' noshade'><br>";
     } else {
         $client_home_array['ALERTS'] = "";
     }
     echo style::replaceVar("tpl/client/client-home.tpl", $client_home_array);
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:88,代码来源:home.php

示例5: content

 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     switch ($getvar['sub']) {
         default:
             if ($_POST) {
                 check::empty_fields();
                 foreach ($postvar as $key => $value) {
                     $broke = explode("_", $key);
                     if ($broke[0] == "pages") {
                         $postvar['perms'][$broke[1]] = $value;
                     }
                 }
                 if (!main::errors()) {
                     $staff_query = $dbh->select("staff", array("user", "=", $postvar['user']), 0, "1", 1);
                     if (!check::email($postvar['email'])) {
                         main::errors("Your email is the wrong format or is already in use by another staff member or client.");
                     } elseif ($postvar['pass'] != $postvar['conpass']) {
                         main::errors("Passwords don't match!");
                     } elseif ($dbh->num_rows($staff_query) >= 1) {
                         main::errors("That account already exists!");
                     } else {
                         if ($postvar['perms']) {
                             foreach ($postvar['perms'] as $key => $value) {
                                 if ($n) {
                                     $perms .= ",";
                                 }
                                 if ($value == "1") {
                                     $perms .= $key;
                                 }
                                 $n++;
                             }
                         }
                         $salt = crypto::salt();
                         $password = crypto::passhash($postvar['pass'], $salt);
                         $staff_insert = array("user" => $postvar['user'], "name" => $postvar['name'], "email" => $postvar['email'], "password" => $password, "salt" => $salt, "perms" => $perms, "tzadjust" => $postvar['tzones']);
                         $dbh->insert("staff", $staff_insert);
                         main::errors("Account added!");
                     }
                 }
             }
             $acpnav_query = $dbh->select("acpnav", array("link", "!=", "home"), array("id", "ASC"), 0, 1);
             $add_staff_member_array['PAGES'] = '<table width="100%" border="0" cellspacing="0" cellpadding="1">';
             while ($acpnav_data = $dbh->fetch_array($acpnav_query)) {
                 $add_staff_member_array['PAGES'] .= '<tr><td width="30%" align="left">' . $acpnav_data['visual'] . ':</td><td><input name="pages_' . $acpnav_data['id'] . '" id="pages_' . $acpnav_data['id'] . '" type="checkbox" value="1" /></td></tr>';
             }
             $add_staff_member_array['PAGES'] .= '<tr><td width="30%" align="left">Paid Configuration:</td><td><input name="pages_paid" id="pages_paid" type="checkbox" value="1" /></td></tr>';
             $add_staff_member_array['PAGES'] .= '<tr><td width="30%" align="left">P2H Forums:</td><td><input name="pages_p2h" id="pages_p2h" type="checkbox" value="1" /></td></tr>';
             $add_staff_member_array['PAGES'] .= "</table>";
             $add_staff_member_array['TZADJUST'] = main::tzlist();
             echo style::replaceVar("tpl/admin/staff/add-staff-member.tpl", $add_staff_member_array);
             break;
         case "edit":
             if (isset($getvar['do'])) {
                 $staff_data = $dbh->select("staff", array("id", "=", $getvar['do']));
                 if (!$staff_data["user"]) {
                     echo "That account doesn't exist!";
                 } else {
                     if ($_POST) {
                         check::empty_fields();
                         foreach ($postvar as $key => $value) {
                             $broke = explode("_", $key);
                             if ($broke[0] == "pages") {
                                 $postvar['perms'][$broke[1]] = $value;
                             }
                         }
                         if (!main::errors()) {
                             if (!check::email($postvar['email'], $getvar['do'], "staff")) {
                                 main::errors("Your email is the wrong format or is already in use by another staff member or client.");
                             } else {
                                 if ($postvar['perms']) {
                                     foreach ($postvar['perms'] as $key => $value) {
                                         if ($n) {
                                             $perms .= ",";
                                         }
                                         if ($value == "1") {
                                             $perms .= $key;
                                         }
                                         $n++;
                                     }
                                 }
                                 $staff_update = array("email" => $postvar['email'], "name" => $postvar['name'], "perms" => $perms, "tzadjust" => $postvar['tzones'], "user" => $postvar['user']);
                                 $dbh->update("staff", $staff_update, array("id", "=", $getvar['do']));
                                 //Staff account edit complete
                                 main::done();
                             }
                         }
                     }
                     $edit_staff_member_array['USER'] = $staff_data['user'];
                     $edit_staff_member_array['EMAIL'] = $staff_data['email'];
                     $edit_staff_member_array['NAME'] = $staff_data['name'];
                     $edit_staff_member_array['TZADJUST'] = main::tzlist($staff_data['tzadjust']);
                     $acpnav_query = $dbh->select("acpnav", array("link", "!=", "home"), array("id", "ASC"), 0, 1);
                     $edit_staff_member_array['PAGES'] = '<table width="100%" border="0" cellspacing="0" cellpadding="1">';
                     while ($acpnav_data = $dbh->fetch_array($acpnav_query)) {
                         if (!main::checkPerms($acpnav_data['id'], $staff_data['id'])) {
                             $checked = 'checked="checked"';
                         }
                         $edit_staff_member_array['PAGES'] .= '<tr><td width="30%" align="left">' . $acpnav_data['visual'] . ':</td><td><input name="pages_' . $acpnav_data['id'] . '" id="pages_' . $acpnav_data['id'] . '" type="checkbox" value="1" ' . $checked . '/></td></tr>' . "\n";
                         $checked = NULL;
//.........这里部分代码省略.........
开发者ID:cozylife,项目名称:tht-reworked,代码行数:101,代码来源:staff.php

示例6: acpPage

 public function acpPage()
 {
     global $dbh, $postvar, $getvar, $instance;
     switch ($getvar['do']) {
         default:
             if ($_POST) {
                 check::empty_fields(array("prefix"));
                 if (!main::errors()) {
                     $forumcon = $dbh->connect($postvar['hostname'], $postvar['username'], $postvar['password'], $postvar['database']);
                     if (is_string($forumcon)) {
                         main::errors($forumcon);
                     } else {
                         $forums_params = $this->forumdata($postvar['forumname']);
                         if ($forums_params['id']) {
                             main::errors("This forum name has already been used! Please choose a new one.<br>");
                         } else {
                             $p2h_insert = array("forumname" => $postvar['forumname'], "username" => $postvar['username'], "password" => $postvar['password'], "forumdb" => $postvar['database'], "hostname" => $postvar['hostname'], "prefix" => $postvar['prefix'], "forumtype" => $postvar['forum'], "url" => $postvar['url']);
                             $dbh->insert("p2h", $p2h_insert);
                             main::errors("Your forum has been added!<br>");
                         }
                     }
                 }
             }
             $manage_forums_array['CONTENT'] = style::replaceVar("tpl/admin/p2h/add-forum.tpl");
             break;
         case "edit":
             $forums_params = $this->forumdata();
             if ($dbh->num_rows($forums_params) == 0) {
                 $manage_forums_array['CONTENT'] = "There are no forums to edit!<br>";
             } else {
                 if ($getvar['id']) {
                     if ($_POST) {
                         check::empty_fields(array("password"));
                         if (!main::errors()) {
                             $forumcon = $dbh->connect($postvar['hostname'], $postvar['username'], $postvar['password'], $postvar['database']);
                             if (is_string($forumcon)) {
                                 main::errors($forumcon);
                             } else {
                                 $forums_params = $this->forumdata($getvar['id']);
                                 if (!$forums_params['id']) {
                                     main::errors("This forum name does not exist.<br>");
                                 } else {
                                     $p2h_update = array("forumname" => $postvar['forumname'], "username" => $postvar['username'], "forumdb" => $postvar['database'], "hostname" => $postvar['hostname'], "prefix" => $postvar['prefix'], "url" => $postvar['url']);
                                     $dbh->update("p2h", $p2h_update, array("id", "=", $getvar['id']));
                                     if ($postvar['password']) {
                                         $dbh->update("p2h", array("password" => $postvar['password']), array("id", "=", $getvar['id']));
                                     }
                                     main::errors("Forum Edited!<br>");
                                 }
                             }
                         }
                     }
                     $forumdata = $this->forumdata($getvar['id']);
                     if (!$forumdata['id']) {
                         main::done();
                     }
                     $edit_forum_array['HOST'] = $forumdata['hostname'];
                     $edit_forum_array['NAME'] = $forumdata['forumname'];
                     $edit_forum_array['URL'] = $forumdata['url'];
                     $manage_forums_array['CONTENT'] = style::replaceVar("tpl/admin/p2h/edit-forum.tpl", $edit_forum_array);
                 } else {
                     $manage_forums_array['CONTENT'] .= "<ERRORS>";
                     while ($forums_params_data = $dbh->fetch_array($forums_params)) {
                         $manage_forums_array['CONTENT'] .= main::sub("<strong>" . $forums_params_data['forumname'] . "</strong>", '<a href="?page=type&type=p2h&sub=forums&do=edit&id=' . $forums_params_data['id'] . '"><img src="' . URL . 'themes/icons/pencil.png"></a>');
                     }
                 }
             }
             break;
         case "delete":
             $forums_params = $this->forumdata();
             if ($dbh->num_rows($forums_params) == 0) {
                 $manage_forums_array['CONTENT'] = "There are no forums to delete!<br>";
             } else {
                 if ($getvar['id']) {
                     $dbh->delete("p2h", array("id", "=", $getvar['id']));
                     main::errors("Forum deleted!<br>");
                     $forums_params = $this->forumdata();
                 }
                 $manage_forums_array['CONTENT'] .= "<ERRORS>";
                 while ($forums_params_data = $dbh->fetch_array($forums_params)) {
                     $manage_forums_array['CONTENT'] .= main::sub("<strong>" . $forums_params_data['forumname'] . "</strong>", '<a href="?page=type&type=p2h&sub=forums&do=delete&id=' . $forums_params_data['id'] . '"><img src="' . URL . 'themes/icons/delete.png"></a>');
                 }
             }
             break;
         case "config":
             if ($_POST) {
                 check::empty_fields(array("password"));
                 if (!main::errors()) {
                     if (!is_numeric($postvar['p2hwarndate']) || !($postvar['p2hwarndate'] < 28)) {
                         main::errors("The P2H Warn date must be a number less than 28.<br>");
                     } else {
                         $dbh->updateConfig("p2hwarndate", $postvar['p2hwarndate']);
                         main::errors("Configuration updated.<br>");
                     }
                 }
             }
             $forum_config_array['WARNDATE'] = $dbh->config("p2hwarndate");
             $manage_forums_array['CONTENT'] = style::replaceVar("tpl/admin/p2h/forum-config.tpl", $forum_config_array);
             break;
     }
//.........这里部分代码省略.........
开发者ID:cozylife,项目名称:tht-reworked,代码行数:101,代码来源:p2h.php

示例7: 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

示例8: 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;
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:76,代码来源:sub.php

示例9: 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

示例10: acp

function acp()
{
    global $dbh, $postvar, $getvar, $instance;
    ob_start();
    if ($_SESSION['clogged'] || $_SESSION['cuser']) {
        session_destroy();
        main::redirect("?page=home");
    }
    if (!$getvar['page']) {
        $getvar['page'] = "home";
    }
    $page = $dbh->select("acpnav", array("link", "=", $getvar['page']));
    // "Hack" to get the credits and tickets page looking nicer
    switch ($getvar["page"]) {
        case "credits":
            $header = "Credits";
            break;
        default:
            if ($page['visual'] == "Tickets" && $getvar['mode'] == 'ticketsall') {
                $header = "All Tickets";
            } else {
                $header = $page['visual'];
            }
            break;
    }
    $link = "pages/" . $getvar['page'] . ".php";
    $staff_data = $dbh->select("staff", array("id", "=", $_SESSION['user']));
    $user_perms = $staff_data['perms'];
    if (substr_count($user_perms, "paid") == '1') {
        $nopaid = '1';
    }
    if (substr_count($user_perms, "p2h") == '1') {
        $nop2h = '1';
    }
    if (!file_exists($link)) {
        $html = "<strong>THT Fatal Error:</strong> That page doesn't exist.";
    } elseif (!main::checkPerms($page['id']) && !$nopaid && !$nop2h && $user_perms) {
        $html = "You don't have access to this page.";
    } elseif ($getvar['page'] == "type" && $getvar['type'] == "paid" && $nopaid) {
        $html = "You don't have access to this page.";
    } elseif ($getvar['page'] == "type" && $getvar['type'] == "p2h" && $nop2h) {
        $html = "You don't have access to this page.";
    } else {
        include $link;
        $content = new page();
        // Main Side Bar HTML
        $nav = "Sidebar Menu";
        $sub = $dbh->select("acpnav", 0, array("id", "ASC"));
        while ($row = $dbh->fetch_array($sub)) {
            if (main::checkPerms($row['id'])) {
                $sidebarlink_array['IMGURL'] = $row['icon'];
                $sidebarlink_array['LINK'] = "?page=" . $row['link'];
                $sidebarlink_array['VISUAL'] = $row['visual'];
                $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebarlink_array);
            }
        }
        // Types Navbar
        /*
         * When Working on the navbar, to make a spacer use this:
         * $sidebar_array['LINKS'] .= style::replaceVar("tpl/spacer.tpl");
         */
        foreach ($instance->packtypes as $key => $value) {
            if ($key == "paid" && $nopaid != "1" || $key == "p2h" && $nop2h != "1" || $key != "paid" && $key != "p2h") {
                if ($instance->packtypes[$key]->acpNav) {
                    foreach ($instance->packtypes[$key]->acpNav as $key2 => $value) {
                        $sidebarlink_array['IMGURL'] = $value[2];
                        $sidebarlink_array['LINK'] = "?page=type&type=" . $key . "&sub=" . $value[1];
                        $sidebarlink_array['VISUAL'] = $value[0];
                        $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebarlink_array);
                        if ($getvar['page'] == "type" && $getvar['type'] == $key && $getvar['sub'] == $value[1]) {
                            define("SUB", $value[3]);
                            $header = $value[3];
                            $getvar['myheader'] = $value[3];
                        }
                    }
                }
            }
        }
        $sidebarlink_array['IMGURL'] = "information.png";
        $sidebarlink_array['LINK'] = "?page=credits";
        $sidebarlink_array['VISUAL'] = "Credits";
        $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebarlink_array);
        $sidebarlink_array['IMGURL'] = "delete.png";
        $sidebarlink_array['LINK'] = "?page=logout";
        $sidebarlink_array['VISUAL'] = "Logout";
        $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebarlink_array);
        $sidebar = style::replaceVar("tpl/sidebar.tpl", $sidebar_array);
        //Page Sidebar
        if ($content->navtitle) {
            $subnav = $content->navtitle;
            foreach ($content->navlist as $key => $value) {
                $sub_sidebarlink_array['IMGURL'] = $value[1];
                $sub_sidebarlink_array['LINK'] = "?page=" . $getvar['page'] . "&sub=" . $value[2];
                $sub_sidebarlink_array['VISUAL'] = $value[0];
                $sub_sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sub_sidebarlink_array);
            }
            $subsidebar = style::replaceVar("tpl/sidebar.tpl", $sub_sidebar_array);
        }
        if ($getvar['sub'] && $getvar['page'] != "type") {
            foreach ($content->navlist as $key => $value) {
//.........这里部分代码省略.........
开发者ID:cozylife,项目名称:tht-reworked,代码行数:101,代码来源:index.php


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