本文整理汇总了PHP中main::money方法的典型用法代码示例。如果您正苦于以下问题:PHP main::money方法的具体用法?PHP main::money怎么用?PHP main::money使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main
的用法示例。
在下文中一共展示了main::money方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: content
//.........这里部分代码省略.........
}
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']);
$view_invoice_array['COUPONTOTAL'] = main::money($subtotal - coupons::get_discount("paid", $subtotal, $userid));
$invoice_transactions_array['TOTALAMOUNT'] = main::money($acct_balance);
$invoice_transactions_array['TOTALPAID'] = main::money($total_paid);
$admin_ops_array['TOTALAMT'] = main::money($acct_balance);
$admin_ops_array['DELRESET'] = "Delete";
$admin_ops_modify_array['CREDIT'] = $acct_balance;
$admin_ops_modify_array['CURRSYMBOL'] = main::money($acct_balance, "", 1) . " ";
$admin_ops_modify_array['POSTS'] = "";
}
$view_invoice_array['ID'] = $getvar['view'];
$view_invoice_array['DUE'] = $due . $due_text;
$view_invoice_array['PACKDUE'] = $due;
$view_invoice_array['CREATED'] = $created;
$view_invoice_array['UNAME'] = $userdata['user'];
$view_invoice_array['FNAME'] = $userdata['firstname'];
$view_invoice_array['LNAME'] = $userdata['lastname'];
$view_invoice_array['ADDRESS'] = $userdata['address'];
$view_invoice_array['CITY'] = $userdata['city'];
$view_invoice_array['STATE'] = $userdata['state'];
$view_invoice_array['ZIP'] = $userdata['zip'];
$view_invoice_array['COUNTRY'] = strtoupper($userdata['country']);
$view_invoice_array['DOMAIN'] = $upackage['domain'];
$view_invoice_array['PACKAGE'] = $package['name'];
$view_invoice_array['STATUS'] = $acct_balance == 0 ? "<font color = '#779500'>Paid</font>" : "<font color = '#FF7800'>Unpaid</font>";
if ($invoice_info['changed_plan'] && $invoice_info['hadcoupons']) {
$coupon_list = explode(",", $invoice_info['hadcoupons']);
$coupon_values = explode(",", $invoice_info['couponvals']);
if ($coupon_list) {
for ($i = 0; $i < count($coupon_list); $i++) {
$coupons_list_array['COUPONAMOUNT'] = main::money($coupon_values[$i]);
$coupons_list_array['COUPCODE'] = $coupon_list[$i];
$coupons_list_array['REMOVE'] = "";
示例3: validate_coupon
public function validate_coupon($coupcode, $areaused, $uname, $package)
{
global $dbh, $postvar, $getvar, $instance;
$userid = main::userid($uname);
$coupon_info = self::coupon_data($coupcode);
if (empty($coupon_info)) {
return false;
}
if ($coupon_info['expiredate'] != "99/99/9999") {
$today = time();
$coupon_expiry = explode("/", $coupon_info['expiredate']);
$expiry_time = mktime(date("H"), date("i"), date("s"), ltrim($coupon_expiry[0]), ltrim($coupon_expiry[1]), $coupon_expiry[2]);
if ($today >= $expiry_time) {
return false;
}
}
if ($coupon_info['area'] != "both" && $coupon_info['area'] != $areaused) {
return false;
}
if ($coupon_info['user'] != "all" && $coupon_info['user'] != $uname) {
return false;
}
if ($coupon_info['packages'] != "all") {
$available_packs = explode(",", $coupon_info['packages']);
if (!in_array($package, $available_packs)) {
return false;
}
}
if ($coupon_info['limited']) {
$coupons_used_query = $dbh->select("coupons_used", array("coupcode", "=", $coupcode), 0, 0, 1);
$coupons_used_rows = $dbh->num_rows($coupons_used_query);
if ($coupons_used_rows >= $coupon_info['limited']) {
return false;
}
}
$coupon_used = self::user_coupon_data($userid, 0, $coupcode);
if (!empty($coupon_used) && $coupon_used['disabled'] != '2') {
return false;
}
//All checks passed.
//
//Brok
// en
// Eng
// lish
// lol
$package_type = type::packagetype($package);
$package_info = type::additional($package);
$package_monthly = $package_info['monthly'];
$package_p2hinit = $package_info['signup'];
$paidtype = $coupon_info['paidtype'];
$p2hinittype = $coupon_info['p2hinittype'];
$p2hmonthlytype = $coupon_info['p2hmonthlytype'];
$coupon_info['paiddisc'] = self::percent_to_value("paid", $paidtype, $coupon_info['paiddisc'], $package_monthly);
$coupon_info['p2hinitdisc'] = self::percent_to_value("p2h", $p2hinittype, $coupon_info['p2hinitdisc'], $package_p2hinit);
$coupon_info['p2hmonthlydisc'] = self::percent_to_value("p2h", $p2hmonthlytype, $coupon_info['p2hmonthlydisc'], $package_monthly);
if ($package_type == "paid") {
if ($coupon_info['paiddisc'] >= $package_monthly) {
$coupon_text = "Free ";
} else {
$they_pay = $package_monthly - $coupon_info['paiddisc'];
$currency = main::money($they_pay);
$coupon_text = "Only pay " . $currency . " ";
$pay_per_month = "/month";
}
} else {
$init_required = $package_p2hinit - $coupon_info['p2hinitdisc'];
$monthly_required = $package_monthly - $coupon_info['p2hmonthlydisc'];
if ($init_required > 1) {
$s = "s";
}
if ($monthly_required > 1) {
$s2 = "s";
}
if ($coupon_info['p2hinitdisc'] >= $package_p2hinit) {
$coupon_p2hdisc = "0 Posts";
} else {
$coupon_p2hdisc = $init_required . " Post" . $s . " required";
}
if ($coupon_info['p2hmonthlydisc'] >= $package_monthly) {
$coupon_p2hmonth = "0 Posts";
} else {
$coupon_p2hmonth = $monthly_required . " Post" . $s2 . " required";
}
if ($coupon_info['p2hinitdisc'] > 0 && $coupon_info['p2hmonthlydisc'] > 0) {
$coupon_text = $coupon_p2hdisc . " to sign up and " . $coupon_p2hmonth . " for the month";
} else {
if ($coupon_info['p2hinitdisc'] > 0) {
$coupon_text = $coupon_p2hdisc . " to sign up";
$no_goodfor = "1";
//YOU! lol Good for nothing? lol
} else {
$coupon_text = $coupon_p2hmonth . " for the month";
}
}
}
if ($coupon_info['goodfor'] == "life") {
$coupon_text .= $pay_per_month . " for the lifetime of the account.";
}
if ($coupon_info['goodfor'] == "current") {
//.........这里部分代码省略.........
示例4: 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.
//.........这里部分代码省略.........
示例5: 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);
//.........这里部分代码省略.........