本文整理汇总了PHP中main::errors方法的典型用法代码示例。如果您正苦于以下问题:PHP main::errors方法的具体用法?PHP main::errors怎么用?PHP main::errors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main
的用法示例。
在下文中一共展示了main::errors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
if ($_POST) {
check::empty_fields();
if (!main::errors()) {
$user = $dbh->staff($_SESSION['user']);
if (!$user['password']) {
main::errors("Wrong username!?");
} else {
if (crypto::passhash($postvar['old'], $user['salt']) == $user['password']) {
if ($postvar['new'] != $postvar['confirm']) {
main::errors("Your passwords don't match!");
} else {
$salt = crypto::salt();
$newpass = crypto::passhash($postvar['new'], $salt);
$update_staff = array("password" => $newpass, "salt" => $salt);
$dbh->update("staff", $update_staff, array("id", "=", $_SESSION['user']));
main::errors("Password changed!");
}
} else {
main::errors("Your old password was wrong!");
}
}
}
}
echo style::replaceVar("tpl/admin/change-admin-password.tpl");
}
示例2: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
if (!$dbh->config("delacc")) {
die('This feature has been disabled.');
} else {
if ($_POST) {
$user = $_SESSION['cuser'];
$pass = $postvar['password'];
$client = $dbh->client($user);
unset($where);
$where[] = array("is_paid", "=", "0", "AND");
$where[] = array("uid", "=", $user);
$balance_query = $dbh->select("invoices", $where, 0, "1", 1);
if ($dbh->num_rows($balance_query) != 0) {
main::errors("You can't close your account with an outstanding balance. Please contact an administrator for assistance or pay any unpaid invoices.");
}
if (crypto::passhash($pass, $client['salt']) == $client['password']) {
if (server::terminate($client['id'], "", 1)) {
main::errors("Your account has been cancelled successfully.");
session_destroy();
} else {
main::errors("Your account wasn't cancelled. Please try again or contact your system administrator.");
}
} else {
main::errors("The password entered is incorrect.");
}
}
echo style::replaceVar("tpl/client/delete-account.tpl");
}
}
示例3: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
$client_data = $dbh->client($_SESSION['cuser']);
$packages_data = $dbh->select("packages", array("id", "=", $client_data['pid']));
$view_package_array['USER'] = $client_data['user'];
$view_package_array['SIGNUP'] = main::convertdate("n/d/Y", $client_data['signup']);
$view_package_array['DOMAIN'] = $client_data['domain'];
$view_package_array['PACKAGE'] = $packages_data['name'] . " <a href = '?page=upgrade'>Change</a>";
$view_package_array['DESCRIPTION'] = $packages_data['description'];
if ($_POST) {
if (crypto::passhash($postvar['currentpass'], $client_data['salt']) == $client_data['password']) {
if ($postvar['newpass'] == $postvar['cpass']) {
$cmd = main::changeClientPassword($client_data['id'], $postvar['newpass']);
if ($cmd === true) {
main::errors("Details updated!");
} else {
main::errors((string) $cmd);
}
} else {
main::errors("Your passwords don't match!");
}
} else {
main::errors("Your current password wasn't correct!");
}
}
echo style::replaceVar("tpl/client/view-package.tpl", $view_package_array);
}
示例4: 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);
}
示例5: empty_fields
public function empty_fields($omit = array())
{
global $dbh, $postvar, $getvar, $instance;
foreach ($postvar as $key => $value) {
if ($value == "" && !$n && !in_array($key, $omit)) {
main::errors("Please fill in all the fields!");
$n++;
}
}
}
示例6: conf_perms
public function conf_perms()
{
if (is_writable(INC . "/conf.inc.php")) {
if (main::perms(INC . "/conf.inc.php", 0444)) {
main::errors("Configuration File made unwritable.");
} else {
main::errors("Failed to make the configuration file unwritable.");
}
} else {
main::errors("Configuration File is already unwritable.");
}
echo style::replaceVar('tpl/admin/system/perms-tools.tpl');
}
示例7: import
public function import()
{
global $dbh, $postvar, $getvar, $instance;
if (!$_POST) {
$servers_query = $dbh->select("servers", array("type", "=", "zpanel"), 0, 0, 1);
while ($servers_data = $dbh->fetch_array($servers_query)) {
$values[] = array($servers_data['name'], $servers_data['id']);
}
$zpanel_array['DROPDOWN'] = main::dropdown("server", $values);
echo style::replaceVar("tpl/admin/import/zpanel.tpl", $zpanel_array);
} elseif ($_POST) {
$postvar['server'] = $postvar['server'];
//Hack to make sure we post the 'server' field as it doesn't post if it's empty.
check::empty_fields();
if (main::errors()) {
echo "<ERRORS>";
} else {
$n = 0;
include INC . "/servers/zpanel.php";
$zpanel = new zpanel($postvar['server']);
$zpanel_accounts = $zpanel->listaccs($postvar['server']);
foreach ($zpanel_accounts as $zpanel_data) {
$packages_data = $dbh->select("packages", array("backend", "=", $zpanel_data['package']));
$users_data = $dbh->select("users", array("user", "=", $zpanel_data['user']));
if (!$packages_data['id']) {
$packages_insert = array("name" => $zpanel_data['package'], "backend" => $zpanel_data['package'], "description" => "Imported from ZPanel: " . $zpanel_data['package'], "type" => "free", "server" => $postvar['server'], "admin" => "1");
$dbh->insert("packages", $packages_insert);
}
$new_packages_data = $dbh->select("packages", array("backend", "=", $zpanel_data['package']));
if (!$users_data['id']) {
$salt = crypto::salt();
$newpass = crypto::passhash(rand(), $salt);
$users_insert = array("user" => $zpanel_data['user'], "zpanel_uid" => $zpanel_data['user'], "email" => $zpanel_data['user'], "password" => $zpanel_data['user'], "salt" => $zpanel_data['user'], "signup" => $zpanel_data['user'], "status" => $zpanel_data['user'], "domain" => $zpanel_data['user'], "pid" => $zpanel_data['user']);
$dbh->insert("users", $users_insert);
$dbh->insert("users_bak", $users_insert);
$n++;
}
}
echo $n . " Accounts have been imported";
}
}
}
示例8: do_upgrade
public function do_upgrade($upgradeid, $mode, $no_errors_out = 0)
{
global $dbh, $postvar, $getvar, $instance;
//$mode
//
//Init - When the upgrade info is added, we call this function.
//Update - When cron or an admin does something with this function, we check to see if various tasks are ready to be performed.
//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.
//
$upgrade_data = $dbh->select("upgrade", array("id", "=", $upgradeid));
$userid = $upgrade_data['uid'];
$newpack = $upgrade_data['newpack'];
$flags = $upgrade_data['flags'];
$created = $upgrade_data['created'];
$coupcode = $upgrade_data['coupcode'];
$user_data = main::uidtopack($userid);
$current_pack_type = $user_data['packages']['type'];
$current_pack_name = $user_data['packages']['name'];
$current_pack_id = $user_data['packages']['id'];
$user_info = $dbh->select("users", array("id", "=", $userid));
$user_email = $user_info['email'];
$username = $user_info['user'];
$new_plan_data = $dbh->select("packages", array("id", "=", $newpack));
$newpack_name = $new_plan_data['name'];
$new_plan_additional = type::additional($newpack);
$new_server_data = $dbh->select("servers", array("id", "=", $new_plan_data['server']));
$new_server_name = $new_server_data['name'];
$old_server_data = $dbh->select("servers", array("id", "=", $user_data['packages']['server']));
$old_server_name = $old_server_data['name'];
switch ($flags) {
case "0":
$upgrade = 1;
break;
case "1":
$upgrade_today = self::upgrade_today($current_pack_type, $userid);
if ($upgrade_today) {
$upgrade = 1;
}
break;
case "2":
if ($mode = "Init") {
$admin_approval = 1;
} else {
//If its already the day for the upgrade, then we can do the upgrade now.
$upgrade_today = self::upgrade_today($current_pack_type, $userid);
if ($upgrade_today) {
$upgrade = 1;
}
if (!$upgrade) {
$dbh->update("upgrade", array("flags" => "1"), array("id", "=", $upgradeid), "1");
}
}
break;
case "3":
if ($mode = "Init") {
$admin_approval = 1;
$new_server = 1;
} else {
//If its already the day for the upgrade, then we can do the upgrade now.
$upgrade_today = self::upgrade_today($current_pack_type, $userid);
if ($upgrade_today) {
$upgrade = 1;
$new_server = 1;
}
if (!$upgrade) {
$dbh->update("upgrade", array("flags", "=", "4"), array("id", "=", $upgradeid), "1");
}
}
break;
case "4":
//If its already the day for the upgrade, then we can do the upgrade now.
$upgrade_today = self::upgrade_today($current_pack_type, $userid);
if ($upgrade_today) {
$upgrade = 1;
$new_server = 1;
$admin_inform = 1;
//.........这里部分代码省略.........
示例9: 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;
//.........这里部分代码省略.........
示例10: clientPage
public function clientPage()
{
global $dbh, $postvar, $getvar, $instance;
if (is_numeric($getvar['remove'])) {
coupons::remove_p2h_coupon($getvar['remove']);
main::redirect("?page=type&type=p2h&sub=forums");
exit;
}
if ($_POST['submitaddcoupon']) {
if (!$postvar['addcoupon']) {
main::errors("Please enter a coupon code.");
} else {
$coupcode = $postvar['addcoupon'];
$pack_data = main::uidtopack();
$packid = $pack_data['packages']['id'];
$multi_coupons = $dbh->config("multicoupons");
$coupon_info = coupons::coupon_data($coupcode);
$coupid = $coupon_info['id'];
$use_coupon = coupons::use_coupon($coupid, $packid);
if (!$use_coupon) {
if (!$multi_coupons) {
main::errors("Coupon code entered was invalid or you're already using a coupon.");
} else {
main::errors("Coupon code entered was invalid.");
}
} else {
main::redirect("?page=type&type=p2h&sub=forums");
}
}
}
$userid = $_SESSION['cuser'];
$client = $dbh->client($userid);
$forum = type::additional($client['pid'], 'forum');
$user = type::userAdditional($client['id']);
$fdetails = $this->forumdata($forum);
$this->con = $this->forumCon($forum);
$posts = $this->checkMonthly($fdetails['forumtype'], $user['fuser'], $fdetails['prefix']);
$total_posts = coupons::totalposts($userid);
$p2h_payments = $dbh->select("coupons_p2h", array("uid", "=", $userid));
$package_info = main::uidtopack($userid);
$user_posts = $this->userposts($package_info['packages']['id'], $package_info['user_data']['id']);
$monthly = $this->getMonthly($client['pid']);
if (empty($p2h_payments)) {
$p2h_pay_array = array("uid" => $userid, "amt_paid" => $user_posts, "txn" => $package_info['uadditional']['fuser'], "datepaid" => time(), "gateway" => $package_info['additional']['forum']);
$dbh->insert("coupons_p2h", $p2h_pay_array);
$p2h_payments = $dbh->select("coupons_p2h", array("uid", "=", $userid));
}
$amt_paid = $p2h_payments['amt_paid'];
$txn = $p2h_payments['txn'];
$datepaid = $p2h_payments['datepaid'];
$gateway = $p2h_payments['gateway'];
$amt_paid = explode(",", $amt_paid);
$txn = explode(",", $txn);
$datepaid = explode(",", $datepaid);
$gateway = explode(",", $gateway);
for ($i = 0; $i < count($amt_paid); $i++) {
if ($txn[$i] == $package_info['uadditional']['fuser']) {
if ($amt_paid[$i] != $user_posts) {
$reload = 1;
}
$amt_paid[$i] = $user_posts;
$datepaid[$i] = time();
}
$p2h_data = $dbh->select("p2h", array("id", "=", $gateway[$i]));
$transaction_list_array['PAIDAMOUNT'] = main::s($amt_paid[$i], " Post");
$transaction_list_array['TXN'] = $txn[$i];
$transaction_list_array['PAIDDATE'] = main::convertdate("n/d/Y", $datepaid[$i]);
$transaction_list_array['GATEWAY'] = str_replace(",", "", $p2h_data['forumname']);
$invoice_transactions_array['TXNS'] .= style::replaceVar("tpl/invoices/transaction-list.tpl", $transaction_list_array);
$paidamts = $paidamts . "," . $amt_paid[$i];
$paidtxn = $paidtxn . "," . $txn[$i];
$paiddate = $paiddate . "," . $datepaid[$i];
$paidgateway = $paidgateway . "," . $gateway[$i];
}
$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);
$where[] = array("uid", "=", $userid);
$dbh->update("coupons_p2h", $p2h_pay_array, $where);
if ($reload) {
main::redirect("?page=type&type=p2h&sub=forums");
}
$invoice_transactions_array['TOTALPAID'] = main::s($total_posts, " Post");
$posts_array['TRANSACTIONS'] = style::replaceVar("tpl/invoices/invoice-transactions.tpl", $invoice_transactions_array);
$pack_monthly = $package_info['additional']['monthly'];
$coupon_total = $pack_monthly - coupons::get_discount("p2hmonthly", $pack_monthly, $userid);
$balance = max(0, $monthly - $total_posts);
unset($where);
$where[] = array("user", "=", $_SESSION['cuser'], "AND");
$where[] = array("disabled", "=", "0");
$coupons_used_query = $dbh->select("coupons_used", $where, array("id", "ASC"), 0, 1);
while ($coupons_used_data = $dbh->fetch_array($coupons_used_query)) {
$valid_coupon = coupons::check_expire($coupons_used_data['coupcode']);
if ($valid_coupon) {
$multipost_text = main::s($coupons_used_data['p2hmonthlydisc'], " Post");
$coupons_list_array['COUPONAMOUNT'] = $multipost_text;
$coupons_list_array['COUPCODE'] = $coupons_used_data['coupcode'];
$coupons_list_array['REMOVE'] = $balance == 0 ? "" : '(<a href = "?page=type&type=p2h&sub=forums&remove=' . $coupons_used_data['id'] . '">Remove</a>)';
//.........这里部分代码省略.........
示例11: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
$client = $dbh->client($_SESSION['cuser']);
$edit_account_array['USER'] = $client['user'];
$edit_account_array['EMAIL'] = $client['email'];
$edit_account_array['DOMAIN'] = $client['domain'];
$edit_account_array['FIRSTNAME'] = $client['firstname'];
$edit_account_array['LASTNAME'] = $client['lastname'];
$edit_account_array['ADDRESS'] = $client['address'];
$edit_account_array['CITY'] = $client['city'];
$edit_account_array['STATE'] = $client['state'];
$edit_account_array['ZIP'] = $client['zip'];
$edit_account_array['PHONE'] = $client['phone'];
$edit_account_array['TZADJUST'] = main::tzlist($client['tzadjust']);
$edit_account_array['DISP'] = "<div>";
$edit_account_array['COUNTRY'] = main::countries(1, $client['country']) . '<a title="Your country." class="tooltip"><img src="<ICONDIR>information.png" /></a>';
if ($_POST) {
if (!check::email($postvar['email'], $_SESSION['cuser'])) {
main::errors("Your email is the wrong format!");
}
if (!check::state($postvar['state'])) {
main::errors("Please enter a valid state!");
}
if (!check::address($postvar['address'])) {
main::errors("Please enter a valid address!");
}
if (!check::phone($postvar['phone'])) {
main::errors("Please enter a valid phone number!");
}
if (!check::zip($postvar['zip'])) {
main::errors("Please enter a valid zip/postal code!");
}
if (!check::city($postvar['city'])) {
main::errors("Please enter a valid city!");
}
if (!check::firstname($postvar['firstname'])) {
main::errors("Please enter a valid first name!");
}
if (!check::lastname($postvar['lastname'])) {
main::errors("Please enter a valid time last name!");
}
if (!main::errors()) {
if ($postvar['country']) {
$country_q = "";
}
$users_update = array("email" => $postvar['email'], "state" => $postvar['state'], "address" => $postvar['address'], "phone" => $postvar['phone'], "zip" => $postvar['zip'], "city" => $postvar['city'], "tzadjust" => $postvar['tzones'], "firstname" => $postvar['firstname'], "lastname" => $postvar['lastname'], "country" => $postvar['country']);
$dbh->update("users", $users_update, array("id", "=", $_SESSION['cuser']));
if ($postvar['change']) {
$client = $dbh->client($_SESSION['cuser']);
if (crypto::passhash($postvar['currentpass'], $client['salt']) == $client['password']) {
if ($postvar['newpass'] === $postvar['cpass']) {
$cmd = main::changeClientPassword($_SESSION['cuser'], $postvar['newpass']);
if ($cmd === true) {
main::errors("Details updated!");
} else {
main::errors((string) $cmd);
}
} else {
main::errors("Your passwords don't match!");
}
} else {
main::errors("Your current password is incorrect.");
}
} else {
$edit_account_array['DISP'] = "<div style=\"display:none;\">";
main::errors("Details updated!");
}
}
}
echo style::replaceVar("tpl/client/edit-account.tpl", $edit_account_array);
}
示例12: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
$upackinfo = main::uidtopack();
$currentpack = $upackinfo['user_data']['pid'];
$packsid = $postvar['packs'];
if (!$packsid) {
$packsid = $getvar['package'];
}
unset($where);
if (is_numeric($packsid)) {
$where[] = array("id", "=", $packsid, "AND");
} else {
$where[] = array("is_hidden", "=", "0", "AND");
}
$where[] = array("is_disabled", "=", "0", "AND");
$where[] = array("id", "!=", $currentpack);
$packages_order[] = array("type", "ASC");
$packages_order[] = array("name", "ASC");
$packages_query = $dbh->select("packages", $where, $packages_order, 0, 1);
$upgrade_array['PACK'] = "";
while ($packages_data = $dbh->fetch_array($packages_query)) {
$additional = type::additional($packages_data['id']);
$monthly = $additional['monthly'];
$signup = $additional['signup'];
unset($info);
if ($packages_data['type'] == "p2h") {
$info = "[Signup Posts: " . $signup . ", Monthly Posts: " . $monthly . "] ";
$contribution = "<strong>Signup Posts:</strong> " . $signup . "<br><strong>Monthly Posts:</strong> " . $monthly;
} elseif ($packages_data['type'] == "paid") {
$info = "[" . main::money($monthly) . "] ";
$contribution = main::money($monthly);
} else {
$contribution = "Free";
}
$packages[] = array("[" . $packages_data['type'] . "] " . $info . $packages_data['name'], $packages_data['id']);
if ($packsid && $packsid == $packages_data['id']) {
$prorate = upgrade::prorate($packages_data['id'], $postvar['coupon']);
$package_array['DISABLED'] = "";
if ($prorate == "inelegible") {
main::errors("You are currently not elegible for the plan selected because you do not have enough posts.<br><br>");
$package_array['DISABLED'] = "disabled";
}
if ($prorate == "owe") {
main::errors("You have outstanding charges on your account and can only upgrade your paid package. Your charges are outstanding! Keep up the good work. lol<br><br>");
$package_array['DISABLED'] = "disabled";
}
if ($prorate == "oweposts") {
main::errors("You still owe your required monthly posts and can only upgrade to a paid plan until you finish your posting quota. Our forum is a lot of fun, so come join us! =)<br><br>");
$package_array['DISABLED'] = "disabled";
}
if ($prorate == "next" || $prorate == "check next") {
main::errors("If you choose this package, you'll be upgraded at the start of your next billing cycle. If you do not wish to wait, please contact us.<br><br>");
$next_month = 1;
}
if (is_numeric($prorate) && $prorate > 0) {
$contribution .= " (You pay only <font color = '#FF0055'>" . main::money($prorate) . "</font> more today to upgrade.)";
}
if ($prorate == "check" || $prorate == "check next" || $prorate == "check now") {
$fuser = $postvar['fuser'];
$fpass = $postvar['fpass'];
$forum_credentials_array['FUSER'] = $fuser;
$forum_credentials_array['FPASS'] = $fpass;
$package_array['FORUMINFO'] = style::replaceVar("tpl/upgrade/forum-credentials.tpl", $forum_credentials_array);
} else {
if ($packages_data['type'] == "p2h") {
$fuser = $upackinfo['uadditional']['fuser'];
$fpass = $upackinfo['uadditional']['fpass'];
$no_fcheck = 1;
}
$package_array['FORUMINFO'] = "";
}
$coupon_entry_array['COUPCODE'] = "";
$coupon_entry_array['COUPTEXT'] = "";
$coupon_entry_array['COUPCODEVALID'] = "";
if ($packages_data['type'] == "p2h" && $prorate != "owe") {
//Paid users can enter them when they pay the invoice and free users don't need coupons.
$coupcode = $postvar['coupon'];
$validcoupon = $postvar['validcoupon'];
if ($postvar['addcoupon']) {
$uname = main::uname($_SESSION['cuser']);
if ($coupcode) {
$response = coupons::validate_coupon($coupcode, "orders", $uname, $packsid);
if ($response) {
$coup_data = coupons::coupon_data($coupcode);
$discount = $coup_data['p2hinitdisc'];
$multi_coupons = $dbh->config("multicoupons");
if ($multi_coupons) {
$discount = $discount + upgrade::get_init_discount();
}
$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>");
$package_array['DISABLED'] = "disabled";
$coupon_entry_array['COUPCODEVALID'] = "";
} else {
$prorate = upgrade::prorate($packages_data['id'], $coupcode);
if ($prorate == "next" || $prorate == "check next" || $prorate == "inelegible") {
//We know they're eligible or they wouldn't be at this stage. It just doesn't check existing coupons.
//.........这里部分代码省略.........
示例13: 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!");
}
}
//.........这里部分代码省略.........
示例14: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
if ($getvar['mode'] == 'ticketsall') {
$no_tickets_msg = "You currently have no tickets.";
$view_mode_text = "<center><i><u><a href=\"?page=tickets\" title=\"View open tickets\">View open tickets</a></u></i></center>";
} else {
$where[] = array("status", "!=", "3", "AND");
$no_tickets_msg = "You currently have no new tickets! <i><u><a href=\"?page=tickets&mode=ticketsall\" title=\"View all tickets.\">View all tickets</a></u></i>";
$view_mode_text = "<center><i><u><a href=\"?page=tickets&mode=ticketsall\" title=\"View all tickets\">View all tickets</a></u></i></center>";
}
if (!$getvar['do']) {
$where[] = array("reply", "=", "0");
$tickets_query = $dbh->select("tickets", $where, array("time", "DESC"), 0, 1);
if (!$dbh->num_rows($tickets_query)) {
echo $no_tickets_msg;
} else {
if ($getvar['mode'] == 'ticketsall') {
echo "<div style=\"display: none;\" id=\"nun-tickets\">You currently have no tickets!</div>";
} else {
echo "<div style=\"display: none;\" id=\"nun-tickets\">You currently have no new tickets!</div>";
}
$num_rows = $dbh->num_rows($tickets_query);
echo style::replaceVar("tpl/admin/tickets/tickets-js.tpl", array('NUM_TICKETS' => $num_rows));
while ($tickets_data = $dbh->fetch_array($tickets_query)) {
$ticket_view_box_array['TITLE'] = $tickets_data['title'];
$ticket_view_box_array['UPDATE'] = $this->lastUpdated($tickets_data['id']);
$ticket_view_box_array['STATUS'] = $tickets_data['status'];
$ticket_view_box_array['STATUSMSG'] = $this->status($tickets_data['status']);
$ticket_view_box_array['ID'] = $tickets_data['id'];
$ticket_view_box_array['URGENCYTEXT'] = $tickets_data['urgency'];
$ticket_view_box_array['URGENCY_CLASS'] = strtolower(str_replace(" ", "_", $tickets_data['urgency']));
echo style::replaceVar("tpl/admin/tickets/ticket-view-box.tpl", $ticket_view_box_array);
}
echo $view_mode_text;
}
} else {
unset($where);
$where[] = array("id", "=", $getvar['do'], "OR");
$where[] = array("ticketid", "=", $getvar['do']);
$tickets_query = $dbh->select("tickets", $where, array("time", "ASC"), 0, 1);
if (!$dbh->num_rows($tickets_query)) {
echo "That ticket doesn't exist!";
} else {
if ($_POST) {
check::empty_fields(array("admin"));
if (!main::errors()) {
$time = time();
$tickets_insert = array("title" => $postvar['title'], "content" => $postvar['content'], "time" => $time, "userid" => $_SESSION['user'], "reply" => "1", "ticketid" => $getvar['do'], "staff" => "1");
$dbh->insert("tickets", $tickets_insert);
main::errors("Reply has been added!");
$last_ticket_data = $dbh->select("tickets", array("time", "=", $time), 0, "1");
$tickets_data = $dbh->fetch_array($tickets_query);
$client = $dbh->staff($_SESSION['user']);
$user = $dbh->client($tickets_data['userid']);
$template = email::emailTemplate("ticket-staff-responded");
$clientresponse_array['TITLE'] = $tickets_data['title'];
$clientresponse_array['STAFF'] = $client['name'];
$clientresponse_array['CONTENT'] = $postvar['content'];
$clientresponse_array['LINK'] = $dbh->config("url") . "/client/?page=tickets&sub=view&do=" . $last_ticket_data['ticketid'];
email::send($user['email'], $template['subject'], $template['content'], $clientresponse_array);
main::redirect("?page=tickets&sub=view&do=" . $getvar['do']);
}
}
$tickets_data = $dbh->fetch_array($tickets_query);
$view_ticket_array['AUTHOR'] = $this->determineAuthor($tickets_data['userid'], $tickets_data['staff']);
$view_ticket_array['TIME'] = main::convertdate("n/d/Y - g:i A", $tickets_data['time']);
$view_ticket_array['NUMREPLIES'] = $dbh->num_rows($tickets_query) - 1;
$view_ticket_array['UPDATED'] = $this->lastUpdated($tickets_data['id']);
$view_ticket_array['ORIG'] = $this->showReply($tickets_data['id']);
$view_ticket_array['URGENCY'] = $tickets_data['urgency'];
$view_ticket_array['STATUS'] = $this->status($tickets_data['status']);
switch ($tickets_data['status']) {
case "1":
$view_ticket_array['STATUSCOLOR'] = "779500";
break;
case "2":
$view_ticket_array['STATUSCOLOR'] = "FF9500";
break;
case "3":
$view_ticket_array['STATUSCOLOR'] = "FF0000";
break;
default:
$view_ticket_array['STATUSCOLOR'] = "000000";
break;
}
$view_ticket_array['REPLIES'] = "";
$n = 0;
while ($reply = $dbh->fetch_array($tickets_query)) {
if (!$n) {
$view_ticket_array['REPLIES'] .= "<br /><b>Replies</b>";
}
$view_ticket_array['REPLIES'] .= $this->showReply($reply['id']);
$n++;
}
$view_ticket_array['ADDREPLY'] .= "<br /><b>Change Ticket Status</b>";
$values[] = array("Open", 1);
$values[] = array("On Hold", 2);
$values[] = array("Closed", 3);
$change_status_array['DROPDOWN'] = main::dropdown("status", $values, $tickets_data['status'], 0);
//.........这里部分代码省略.........
示例15: ChangePassword
private function ChangePassword($client)
{
global $dbh, $postvar, $getvar, $instance;
$change_password_array['MSG'] = "This will change the user's password in THT and the control panel.<br><br>";
if ($_POST) {
if (empty($postvar['passwd'])) {
main::errors('A password was not provided.');
} else {
$command = main::changeClientPassword($client['id'], $postvar['passwd']);
if ($command === true) {
main::errors('Password changed!');
} else {
main::errors($command);
}
}
}
$clientview_array['BOX'] = "";
$clientview_array['CONTENT'] = style::replaceVar("tpl/admin/clients/change-password.tpl", $change_password_array);
return $clientview_array;
}