本文整理汇总了PHP中main::convertdate方法的典型用法代码示例。如果您正苦于以下问题:PHP main::convertdate方法的具体用法?PHP main::convertdate怎么用?PHP main::convertdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main
的用法示例。
在下文中一共展示了main::convertdate方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: create
public function create($uid, $amount, $due, $notes)
{
global $dbh, $postvar, $getvar, $instance;
$client = $dbh->client($uid);
$emailtemp = email::emailTemplate("new-invoice");
$newinvoice_array['USER'] = $client['user'];
$newinvoice_array['AMOUNT'] = main::addzeros($amount);
$newinvoice_array['LINK'] = $dbh->config("url") . "/client/?page=invoices";
$newinvoice_array['DUE'] = main::convertdate("n/d/Y", $due, $uid);
$is_paid = $newinvoice_array['AMOUNT'] == "0.00" ? "1" : "0";
email::send($client['email'], $emailtemp['subject'], $emailtemp['content'], $newinvoice_array);
unset($where);
$where[] = array("amount", "=", "0", "OR");
$where[] = array("amount", "=", "0.00");
$dbh->update("invoices", array("is_paid" => "1"), $where);
//This way people won't see unpaid invoices for $0.
$invoices_insert = array("uid" => $uid, "amount" => $amount, "created" => time(), "due" => $due, "notes" => $notes, "pay_now" => $amount, "is_paid" => $is_paid);
$response = $dbh->insert("invoices", $invoices_insert);
return $response;
}
示例4: 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;
}
示例5: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
if (is_numeric($getvar['dellogid'])) {
$dbh->delete("logs", array("id", "=", $getvar['dellogid']), "1");
main::errors("Log entry deleted.");
}
if (is_numeric($getvar['removeall'])) {
if ($getvar['confirm'] != '1') {
main::errors("Are you sure you wish to remove ALL log entries? <a href = '?page=logs&removeall=" . $getvar['removeall'] . "&confirm=1'>Yes</a> | <a href = '?page=logs'>No</a>");
} else {
$dbh->delete("logs", 0, 0, 1);
main::thtlog("Logs Cleared", "All Logs were removed.", $_SESSION['user'], "", "staff");
main::redirect("?page=logs");
}
}
if (is_numeric($getvar['logid'])) {
$loginfo = $dbh->select("logs", array("id", "=", $getvar['logid']));
$admin_log_view_array['MESSAGE'] = $loginfo['message'];
echo style::replaceVar("tpl/admin/logs/admin-log-view.tpl", $admin_log_view_array);
} else {
$per_page = $getvar['limit'];
$start = $getvar['start'];
if (!$postvar['show']) {
$show = $getvar['show'];
} else {
$show = $postvar['show'];
$start = 0;
}
if (!$show) {
$show = "all";
}
if (!$per_page) {
$per_page = 10;
}
if (!$start) {
$start = 0;
}
if ($show != "all") {
$logs_query = $dbh->select("logs", array("logtype", "=", $show), array("logtime", "DESC"), $start . ", " . $per_page, 1);
} else {
$logs_query = $dbh->select("logs", 0, array("logtime", "DESC"), $start . ", " . $per_page, 1);
}
$all_logs_query = $dbh->select("logs");
$num_logs = $dbh->num_rows($all_logs_query);
$pages = ceil($num_logs / $per_page);
if ($num_logs == 0) {
$admin_logs_list_array['LOGS'] = "";
$admin_logs_list_array['PAGING'] = "";
main::errors("No logs found.");
} else {
while ($logs_data = $dbh->fetch_array($logs_query)) {
$message_data = explode("<", substr($logs_data['message'], 0, 100));
$admin_log_item_array['USER'] = $logs_data['loguser'];
$admin_log_item_array['DATE'] = main::convertdate("n/d/Y", $logs_data['logtime']);
$admin_log_item_array['TIME'] = main::convertdate("g:i A", $logs_data['logtime']);
$admin_log_item_array['MESSAGE'] = $message_data[0];
$admin_log_item_array['LOGID'] = $logs_data['id'];
$admin_logs_list_array['LOGS'] .= style::replaceVar("tpl/admin/logs/admin-log-item.tpl", $admin_log_item_array);
}
}
if ($start != 0) {
$back_page = $start - $per_page;
$admin_logs_list_array['PAGING'] = '<a href="?page=logs&show=' . $show . '&start=' . $back_page . '&limit=' . $per_page . '">BACK</a> ';
}
for ($i = 1; $i <= $pages; $i++) {
$start_link = $per_page * ($i - 1);
if ($start_link == $start) {
$admin_logs_list_array['PAGING'] .= ' <b>' . $i . '</b> ';
} else {
$admin_logs_list_array['PAGING'] .= ' <a href="?page=logs&show=' . $show . '&start=' . $start_link . '&limit=' . $per_page . '">' . $i . '</a> ';
}
}
if (($start + $per_page) / $per_page < $pages && $pages != 1) {
$next_page = $start + $per_page;
$admin_logs_list_array['PAGING'] .= ' <a href="?page=logs&show=' . $show . '&start=' . $next_page . '&limit=' . $per_page . '">NEXT</a>';
}
$shown = array();
$log_type_values[] = array("Show All", "all");
$logs_query = $dbh->select("logs", 0, array("logtype", "ASC"), 0, 1);
while ($logs_data = $dbh->fetch_array($logs_query)) {
if (!in_array($logs_data['logtype'], $shown)) {
$log_type_values[] = array($logs_data['logtype'], $logs_data['logtype']);
$shown[] = $logs_data['logtype'];
}
}
$admin_logs_list_array['SHOW_TYPE'] = main::dropdown("show", $log_type_values);
echo style::replaceVar("tpl/admin/logs/admin-logs-list.tpl", $admin_logs_list_array);
}
}
示例6: content
//.........这里部分代码省略.........
exit;
}
if ($p2hid) {
$due = date("m/t/Y");
$created = date("m/1/Y");
$p2h = $instance->packtypes["p2h"];
$monthly_with_disc = coupons::get_discount("p2hmonthly", $subtotal, $userid);
$total_posts = $p2h->userposts($package['id'], $p2hid);
$total_paid = coupons::totalposts($userid);
if (empty($total_paid)) {
$total_paid = 0;
}
if (empty($total_posts)) {
$total_posts = 0;
}
$acct_balance = max(0, $monthly_with_disc - $total_paid);
$view_invoice_array['BASEAMOUNT'] = $invoice_info['amount'] != $subtotal ? main::s($invoice_info['amount'], " Post") . " (Package price: " . main::s($subtotal, " Post") . ")" : main::s($invoice_info['amount'], " Post");
$view_invoice_array['COUPONTOTAL'] = main::s($subtotal - $monthly_with_disc, " Post");
$invoice_transactions_array['TOTALAMOUNT'] = main::s($acct_balance, " Post");
$invoice_transactions_array['TOTALPAID'] = main::s($total_paid, " Post");
$admin_ops_array['TOTALAMT'] = main::s($acct_balance, " Post");
$admin_ops_array['DELRESET'] = "Reset";
$admin_ops_modify_array['CREDIT'] = $acct_balance;
$admin_ops_modify_array['CURRSYMBOL'] = "";
$admin_ops_modify_array['POSTS'] = " Posts";
} else {
$created = $invoice_info['created'];
$thirty_days = 30 * 24 * 60 * 60;
$orig_due = $created + $thirty_days;
if ($getvar['resetpayarange']) {
$dbh->update("invoices", array("due" => $orig_due), array("id", "=", $invoiceid), "1");
main::redirect("?page=invoices&view=" . $invoiceid);
}
if (main::convertdate("n/d/Y", $invoice_info['due']) != main::convertdate("n/d/Y", $created + $thirty_days)) {
$due_text = " (Originally " . main::convertdate("n/d/Y", $orig_due) . ") - <a href = '?page=invoices&view=" . $invoiceid . "&resetpayarange=1'>Reset</a>";
}
$due = main::convertdate("n/d/Y", $invoice_info['due']);
$created = main::convertdate("n/d/Y", $created);
$total_paid_real = coupons::totalpaid($invoiceid);
if ($total_paid_real < 0) {
$total_paid = "0.00";
} else {
$total_paid = $total_paid_real;
}
$acct_balance = $invoice_info['amount'] - $total_paid_real;
$acct_balance = main::addzeros($acct_balance);
if ($acct_balance < 0) {
$acct_balance = "0.00";
}
if ($acct_balance == 0 && $invoice_info['is_paid'] == '0') {
$dbh->update("invoices", array("is_paid" => "1"), array("id", "=", $invoice_info['id']), "1");
unset($where);
$where[] = array("id", "=", $invoice_info['uid'], "AND");
$where[] = array("status", "=", "4");
$dbh->update("users", array("status" => "1"), $where, "1");
unset($where);
$where[] = array("id", "=", $invoice_info['uid'], "AND");
$where[] = array("status", "=", "4");
$dbh->update("users", array("status" => "1"), $where, "1");
main::redirect("?page=invoices&view=" . $invoiceid);
}
if ($acct_balance > 0 && $invoice_info['is_paid'] == '1') {
$dbh->update("invoices", array("is_paid" => "0"), array("id", "=", $invoice_info['id']), "1");
main::redirect("?page=invoices&view=" . $invoiceid);
}
$view_invoice_array['BASEAMOUNT'] = $invoice_info['amount'] != $subtotal ? main::money($invoice_info['amount']) . " (Package price: " . main::money($subtotal) . ")" : main::money($invoice_info['amount']);
示例7: 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);
}
示例8: checkMonthly
private function checkMonthly($forum, $fuser, $prefix)
{
global $dbh, $postvar, $getvar, $instance;
$nmonth = date("m");
$nyear = date("y");
$n = 0;
switch ($forum) {
case "ipb":
$ipb_members_data = $dbh->select($prefix . "members", array("name", "=", $fuser), 0, 0, 0, $this->con);
$ipb_posts_query = $dbh->select($prefix . "posts", array("author_name", "=", $ipb_members_data['members_display_name']), 0, 0, 1, $this->con);
while ($ipb_posts_data = $dbh->fetch_array($ipb_posts_query)) {
$date = explode(":", main::convertdate("m:y", $ipb_posts_data['post_date']));
if ($nmonth == $date[0] && $nyear == $date[1]) {
$n++;
}
}
break;
case "ipb3":
$ipb3_members_data = $dbh->select($prefix . "members", array("name", "=", $fuser), 0, 0, 0, $this->con);
$ipb3_posts_query = $dbh->select($prefix . "posts", array("author_name", "=", $ipb3_members_data['members_display_name']), 0, 0, 1, $this->con);
while ($ipb3_posts_data = $dbh->fetch_array($ipb3_posts_query)) {
$date = explode(":", main::convertdate("m:y", $ipb3_posts_data['post_date']));
if ($nmonth == $date[0] && $nyear == $date[1]) {
$n++;
}
}
break;
case "mybb":
$mybb_posts_query = $dbh->select($prefix . "posts", array("username", "=", $fuser), 0, 0, 1, $this->con);
while ($mybb_posts_data = $dbh->fetch_array($mybb_posts_query)) {
$date = explode(":", main::convertdate("m:y", $mybb_posts_data['dateline']));
if ($nmonth == $date[0] && $nyear == $date[1]) {
$n++;
}
}
break;
case "phpbb":
$phpbb_users_data = $dbh->select($prefix . "users", array("username", "=", $fuser), 0, 0, 0, $this->con);
$phpbb_posts_query = $dbh->select($prefix . "posts", array("poster_id", "=", $phpbb_users_data['user_id']), 0, 0, 1, $this->con);
while ($phpbb_posts_data = $dbh->fetch_array($phpbb_posts_query)) {
$date = explode(":", main::convertdate("m:y", $phpbb_posts_data['post_time']));
if ($nmonth == $date[0] && $nyear == $date[1]) {
$n++;
}
}
break;
case "phpbb2":
$phpbb2_users_data = $dbh->select($prefix . "users", array("username", "=", $fuser), 0, 0, 0, $this->con);
$phpbb2_posts_query = $dbh->select($prefix . "posts", array("poster_id", "=", $phpbb2_users_data['user_id']), 0, 0, 1, $this->con);
while ($phpbb2_posts_data = $dbh->fetch_array($phpbb2_posts_query)) {
$date = explode(":", main::convertdate("m:y", $phpbb2_posts_data['post_time']));
if ($nmonth == $date[0] && $nyear == $date[1]) {
$n++;
}
}
break;
case "vb":
$vb_post_query = $dbh->select($prefix . "post", array("username", "=", $fuser), 0, 0, 1, $this->con);
while ($vb_post_data = $dbh->fetch_array($vb_post_query)) {
$date = explode(":", main::convertdate("m:y", $vb_post_data['dateline']));
if ($nmonth == $date[0] && $nyear == $date[1]) {
$n++;
}
}
break;
case "smf":
$smf_messages_query = $dbh->select($prefix . "messages", array("posterName", "=", $fuser), 0, 0, 1, $this->con);
while ($smf_messages_data = $dbh->fetch_array($smf_messages_query)) {
$date = explode(":", main::convertdate("m:y", $smf_messages_data['posterTime']));
if ($nmonth == $date[0] && $nyear == $date[1]) {
$n++;
}
}
break;
case "aef":
$aef_users_data = $dbh->select($prefix . "users", array("username", "=", $fuser), 0, 0, 0, $this->con);
$aef_posts_query = $dbh->select($prefix . "posts", array("poster_id", "=", $aef_users_data['id']), 0, 0, 1, $this->con);
while ($aef_posts_data = $dbh->fetch_array($aef_posts_query)) {
$date = explode(":", main::convertdate("m:y", $aef_posts_data['ptime']));
if ($nmonth == $date[0] && $nyear == $date[1]) {
$n++;
}
}
break;
case "drupal":
$drupal_users_data = $dbh->select($prefix . "users", array("name", "=", $fuser), 0, "1", 0, $this->con);
unset($where);
$where[] = array("type", "=", "forum", "AND");
$where[] = array("uid", "=", $drupal_users_data["uid"]);
$drupal_node_query = $dbh->select($prefix . "node", $where, 0, 0, 1, $this->con);
while ($drupal_node_data = $dbh->fetch_array($drupal_node_query)) {
$date = explode(":", main::convertdate("m:y", $drupal_node_data['created']));
if ($nmonth == $date[0] && $nyear == $date[1]) {
$n++;
}
unset($where);
$where[] = array("nid", "=", $drupal_node_data["nid"], "AND");
$where[] = array("uid", "=", $drupal_users_data["uid"]);
$drupal_comments_query = $dbh->select($prefix . "comments", $where, 0, 0, 1, $this->con);
unset($comments);
//.........这里部分代码省略.........
示例9: 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);
//.........这里部分代码省略.........
示例10: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
if (is_numeric($getvar['view'])) {
//Show the invoice
unset($where);
$where[] = array("uid", "=", $_SESSION['cuser'], "AND");
$where[] = array("id", "=", $getvar['view']);
$invoice_info_top = $dbh->select("invoices", $where);
$pack_data_top = main::uidtopack();
if (!$invoice_info_top['pid']) {
$dbh->update("invoices", array("pid" => $pack_data_top['user_data']['pid']), array("id", "=", $invoice_info_top['id']));
$invoice_info_top['pid'] = $pack_data_top['user_data']['pid'];
}
if ($_POST['submitaddcoupon']) {
if (!$postvar['addcoupon']) {
main::errors("Please enter a coupon code or click the checkout button.");
} else {
$coupcode = $postvar['addcoupon'];
$user = main::uname($_SESSION['cuser']);
$pack_data = main::uidtopack();
if ($invoice_info_top['pid'] != $pack_data['user_data']['pid']) {
$pack_data = upgrade::pidtobak($invoice_info_top['pid']);
}
$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, $getvar['view']);
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=invoices&view=" . $getvar['view']);
}
}
}
unset($where);
$where[] = array("uid", "=", $_SESSION['cuser'], "AND");
$where[] = array("id", "=", $getvar['view']);
$invoice_info = $dbh->select("invoices", $where);
if (empty($invoice_info)) {
main::redirect("?page=invoices");
exit;
}
$package = $dbh->select("packages", array("id", "=", $invoice_info['pid']));
$monthly = type::additional($package['id']);
$subtotal = $monthly['monthly'];
if (is_numeric($getvar['remove'])) {
$remove_id = $getvar['remove'];
$remove = coupons::remove_coupon($remove_id, $package['id'], $invoice_info['id'], $_SESSION['cuser']);
main::redirect("?page=invoices&view=" . $invoice_info['id']);
exit;
}
$total_paid_real = coupons::totalpaid($getvar['view']);
if ($total_paid_real < 0) {
$total_paid = "0.00";
} else {
$total_paid = $total_paid_real;
}
$acct_balance = coupons::get_discount("paid", $subtotal) - $total_paid_real;
if ($acct_balance < 0) {
$acct_balance = "0.00";
}
$acct_balance = main::addzeros($acct_balance);
if ($acct_balance == 0 && $invoice_info['is_paid'] == '0') {
$dbh->update("invoices", array("is_paid" => "1"), array("id", "=", $invoice_info['id']), "1");
main::redirect("?page=invoices&view=" . $invoice_info['id']);
}
if ($acct_balance > 0 && $invoice_info['is_paid'] == '1') {
$dbh->update("invoices", array("is_paid" => "0"), array("id", "=", $invoice_info['id']), "1");
main::redirect("?page=invoices&view=" . $invoice_info['id']);
}
if ($_POST['checkout']) {
$postvar['paythis'] = str_replace(array(" ", ","), array("", "."), $postvar['paythis']);
if (!is_numeric($postvar['paythis'])) {
main::errors("Please enter the amount you wish to pay today.");
} else {
if ($postvar['paythis'] > $acct_balance || $acct_balance <= 0) {
main::errors("You can't pay more than you owe. =)");
} else {
$dbh->update("invoices", array("pay_now" => $postvar['paythis']), array("id", "=", $getvar['view']));
main::redirect("?page=invoices&iid=" . $getvar['view']);
exit;
}
}
}
$created = $invoice_info['created'];
$thirty_days = 30 * 24 * 60 * 60;
$orig_due = $created + $thirty_days;
if (main::convertdate("n/d/Y", $invoice_info['due']) != main::convertdate("n/d/Y", $created + $thirty_days)) {
$due_text = " (Originally " . main::convertdate("n/d/Y", $orig_due) . ")";
}
$due = main::convertdate("n/d/Y", $invoice_info['due']);
$client = $dbh->client($_SESSION['cuser']);
$invoice_transactions_array['TOTALAMOUNT'] = main::money($acct_balance);
$invoice_transactions_array['TOTALPAID'] = main::money($total_paid);
//.........这里部分代码省略.........
示例11: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
switch ($getvar['sub']) {
default:
if ($_POST) {
check::empty_fields();
if (!main::errors()) {
$time = time();
$tickets_insert = array("title" => $postvar['title'], "content" => $postvar['content'], "urgency" => $postvar['urgency'], "time" => $time, "userid" => $_SESSION['cuser']);
$dbh->insert("tickets", $tickets_insert);
$last_ticket_data = $dbh->select("tickets", array("time", "=", $time), 0, "1");
$template = email::emailTemplate("new-ticket");
$newticket_array['TITLE'] = $postvar['title'];
$newticket_array['URGENCY'] = $postvar['urgency'];
$newticket_array['CONTENT'] = $postvar['content'];
$newticket_array['LINK'] = $dbh->config("url") . ADMINDIR . "/?page=tickets&sub=view&do=" . $last_ticket_data['id'];
email::staff($template['subject'], $template['content'], $newticket_array);
main::errors("Ticket has been added!");
}
}
echo style::replaceVar("tpl/client/tickets/add-ticket.tpl");
break;
case "view":
if (is_numeric($getvar['deltid'])) {
$userid = $_SESSION['cuser'];
$tid = $getvar['deltid'];
unset($where);
$where[] = array("id", "=", $tid, "AND");
$where[] = array("userid", "=", $userid);
$user_check = $dbh->select("tickets", $where, 0, "1", 1);
$user_check_rows = $dbh->num_rows($user_check);
if ($user_check_rows == "0") {
echo "<font color = '#FF0000'>This ticket is not yours to delete or does not exist.</font><br>";
} else {
unset($where);
$where[] = array("id", "=", $tid, "OR");
$where[] = array("ticketid", "=", $tid);
$dbh->delete("tickets", $where);
}
}
if (!$getvar['do']) {
unset($where);
$where[] = array("userid", "=", $_SESSION['cuser'], "AND");
$where[] = array("reply", "=", "0");
$tickets_query = $dbh->select("tickets", $where, 0, 0, 1);
if (!$dbh->num_rows($tickets_query)) {
echo "You currently have no tickets!";
} else {
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['ID'] = $tickets_data['id'];
$ticket_view_box_array['STATUS'] = $tickets_data['status'];
$ticket_view_box_array['STATUSMSG'] = $this->status($tickets_data['status']);
echo style::replaceVar("tpl/client/tickets/ticket-view-box.tpl", $ticket_view_box_array);
}
}
} 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();
if (!main::errors()) {
$time = time();
$tickets_insert = array("title" => $postvar['title'], "content" => $postvar['content'], "time" => $time, "userid" => $_SESSION['cuser'], "reply" => "1", "ticketid" => $getvar['do']);
$dbh->insert("tickets", $tickets_insert);
$last_ticket_data = $dbh->select("tickets", array("time", "=", $time), 0, "1");
$tickets_data = $dbh->fetch_array($tickets_query);
$client = $dbh->client($_SESSION['cuser']);
$template = email::emailTemplate("ticket-client-responded");
$newresponse_array['TITLE'] = $tickets_data['title'];
$newresponse_array['USER'] = $client['user'];
$newresponse_array['CONTENT'] = $postvar['content'];
$newresponse_array['LINK'] = $dbh->config("url") . ADMINDIR . "/?page=tickets&sub=view&do=" . $last_ticket_data['ticketid'];
email::staff($template['subject'], $template['content'], $newresponse_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":
//.........这里部分代码省略.........