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


PHP main::isint方法代码示例

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


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

示例1: content

 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     if (main::isint(str_replace("P2H-", "", $getvar['view']))) {
         //Display the invoice
         if (substr_count($getvar['view'], "P2H-")) {
             $p2hid = str_replace("P2H-", "", $getvar['view']);
             $userid = $dbh->select("users", array("id", "=", $p2hid));
             $userid = $userid['id'];
             $userdata = coupons::admin_userdata($userid);
         } else {
             $invoiceid = $getvar['view'];
             $invoice_data_top = $dbh->select("invoices", array("id", "=", $invoiceid));
             $pid = $invoice_data_top['pid'];
             $userid = $invoice_data_top['uid'];
             $uidtopack = main::uidtopack($userid, $pid);
             if (!$pid) {
                 $dbh->update("invoices", array("pid" => $uidtopack['pid']), array("id", "=", $invoice_data_top['id']));
             }
             $userdata = coupons::admin_userdata($userid);
         }
         if ($_POST['submitaddcoupon']) {
             if (!$postvar['addcoupon']) {
                 main::errors("Please enter a coupon code.");
             } else {
                 $coupcode = $postvar['addcoupon'];
                 $user = main::uname($userid);
                 $pack_data = main::uidtopack($userid, $pid);
                 $packid = $pack_data['packages']['id'];
                 $multi_coupons = $dbh->config("multicoupons");
                 if ($p2hid) {
                     $monthly = $pack_data['additional']['monthly'];
                     $monthly = coupons::get_discount("p2hmonthly", $monthly, $userid);
                     $total_posted = coupons::totalposts($userid);
                     $amt_owed = max(0, $monthly - $total_posted);
                 } else {
                     $invoice_info = $dbh->select("invoices", array("id", "=", $invoiceid));
                     if ($invoice_info['pid'] != $pack_data['pid']) {
                         $pack_data = upgrade::pidtobak($invoice_info['pid'], $invoice_info["uid"]);
                     }
                     $total_paid = coupons::totalpaid($invoiceid);
                     $amt_owed = max(0, $invoice_info['amount'] - $total_paid);
                 }
                 if ($amt_owed == 0) {
                     main::errors("The user's balance is already paid in full, so you can't add another coupon.");
                 } else {
                     $coupon_info = coupons::coupon_data($coupcode);
                     $coupid = $coupon_info['id'];
                     $use_coupon = coupons::use_coupon($coupid, $packid, $invoiceid, $userid);
                     if (!$use_coupon) {
                         if (!$multi_coupons) {
                             main::errors("Coupon code entered was invalid or user is already using a coupon.  You can give them a credit instead.");
                         } else {
                             main::errors("Coupon code entered was invalid or the user is already using this coupon.");
                         }
                     } else {
                         main::redirect("?page=invoices&view=" . $getvar['view']);
                     }
                 }
             }
         }
         if ($_POST['submitcredit']) {
             $postvar['credit'] = str_replace(array(" ", ","), array("", "."), $postvar['credit']);
             if (!is_numeric($postvar['credit'])) {
                 main::errors("Please enter the amount to be credited or debited.");
             } else {
                 if ($postvar['creditreason']) {
                     $creditreason = $postvar['creditreason'];
                     $creditreason = ' <a title="' . $creditreason . '" class="tooltip"><img src="<URL>themes/icons/information.png"></a>';
                     $creditreason = str_replace(",", "", $creditreason);
                     //Can't have commas, no way no how!  ;)  lol  We need to be able to explode(",", $invoice_info['txn']);
                 }
                 if ($p2hid) {
                     $credit_fee = $postvar['credit'];
                 } else {
                     $credit_fee = main::addzeros($postvar['credit']);
                 }
                 if ($credit_fee != 0) {
                     if (substr_count($credit_fee, "-")) {
                         $creditfee_lable = "CHARGE";
                     } else {
                         $creditfee_lable = "CREDIT";
                     }
                     $packinfo = main::uidtopack($userid, $pid);
                     if (!$packinfo['user_data']['pid'] && !$p2hid) {
                         $packinfo = upgrade::pidtobak($pid, $userid);
                     }
                     $monthly = $packinfo['additional']['monthly'];
                     if ($p2hid) {
                         $amt_owed = max(0, $monthly - coupons::totalposts($userid));
                     } else {
                         $amt_owed = max(0, $monthly - coupons::totalpaid($invoiceid));
                     }
                     if ($amt_owed == 0 && $creditfee_lable == "CREDIT") {
                         main::errors("The user's balance is already paid in full, so you can't add a credit.");
                     } else {
                         if ($p2hid) {
                             $p2h_info = $dbh->select("coupons_p2h", array("uid", "=", $userid));
                             if ($p2h_info['datepaid']) {
                                 $comma = ",";
//.........这里部分代码省略.........
开发者ID:cozylife,项目名称:tht-reworked,代码行数:101,代码来源:invoices.php

示例2: validate_admin_form

 public function validate_admin_form($add_edit)
 {
     global $dbh, $postvar, $getvar, $instance;
     $no_check_fields = array("monthsgoodfor", "expiredate", "limitedcoupons", "unlimitedcoupons", "neverexpire", "username", "paiddisc", "p2hinitdisc", "p2hmonthlydisc", "coupid");
     check::empty_fields($no_check_fields);
     if (!main::errors()) {
         $postvar = $postvar;
         $coupon_code_check = self::coupon_data($postvar['coupcode']);
         if (!empty($coupon_code_check) && $add_edit == 'add') {
             $error = "The coupon code already exists in the database.<br>";
         }
         if (is_numeric($postvar['coupcode'])) {
             $error = "The coupon code cannot be fully numeric.<br>";
         }
         if ($postvar['unlimitedcoupons']) {
             $postvar['limitedcoupons'] = "";
         } else {
             if (!main::isint($postvar['limitedcoupons'])) {
                 $error = "Please enter the number of times the coupon may be used or check unlimited.<br>";
             } elseif ($postvar['limitedcoupons'] <= 0) {
                 $error = "Please enter a number greater than 0 for the number of times the coupon may be used or check unlimited.<br>";
             }
         }
         if ($postvar['goodfor'] == 'months' && (!$postvar['monthsgoodfor'] || !main::isint($postvar['monthsgoodfor']))) {
             $error .= "Please specify the number of months the coupon is good for when applied.  The months must not be specified as a decimal.<br>";
         } else {
             if ($postvar['goodfor'] != 'months') {
                 unset($postvar['monthsgoodfor']);
             }
         }
         if (!$postvar['expiredate'] && !$postvar['neverexpire']) {
             $error .= "Please enter an expiration date or check the box for never expire.<br>";
         }
         if (!$postvar['packages'] && !$postvar['allpacks']) {
             $error .= "Please choose packages for this coupon or check the box for all packages.<br>";
         }
         if ($postvar['expiredate'] && !$postvar['neverexpire']) {
             $date_blowed_up = explode("/", $postvar['expiredate']);
             if (count($date_blowed_up) != 3 || !main::isint($date_blowed_up[0]) || !main::isint($date_blowed_up[1]) || !main::isint($date_blowed_up[2]) || strlen($date_blowed_up[0]) != 2 || strlen($date_blowed_up[1]) != 2 || strlen($date_blowed_up[2]) != 4 || $date_blowed_up[0] > 12 || $date_blowed_up[1] > 31) {
                 $error .= "Please enter a valid expiration date in the format MM/DD/YYYY or check the box to have the coupon never expire.<br>";
             }
         }
         if ($postvar['userselect'] == 'newuser' && !$postvar['username']) {
             $error .= "Please enter the new user's username who should be allowed to use this coupon.<br>";
         }
         if (!$postvar['paiddisc'] && !$postvar['p2hinitdisc'] && !$postvar['p2hmonthlydisc']) {
             $error .= "You must enter the paid discount amount or you must enter the P2H initial discount and/or the P2H monthly discount.<br>";
         } else {
             if (!$postvar['paiddisc']) {
                 $postvar['paiddisc'] = "0";
                 $postvar['paidtype'] = "0";
             }
             if (!$postvar['p2hinitdisc']) {
                 $postvar['p2hinitdisc'] = "0";
                 $postvar['p2hinittype'] = "0";
             }
             if (!$postvar['p2hmonthlydisc']) {
                 $postvar['p2hmonthlydisc'] = "0";
                 $postvar['p2hmonthlytype'] = "0";
             }
             $postvar['paiddisc'] = str_replace(array(" ", ","), array("", "."), $postvar['paiddisc']);
             if (!is_numeric($postvar['paiddisc'])) {
                 $error .= "The paid discount amount must be given as a number for paid packages.  (Ex. 1.99)<br>";
             }
             if (!main::isint($postvar['p2hinitdisc']) || !main::isint($postvar['p2hmonthlydisc'])) {
                 $error .= "The P2H post discounts must be given as a whole number for p2h packages.<br>";
             }
         }
         if (!$error) {
             if ($postvar['neverexpire']) {
                 $postvar['expiredate'] = "99/99/9999";
             }
             if ($postvar['userselect'] == 'newuser') {
                 $postvar['userselect'] = $postvar['username'];
             }
             if ($postvar['allpacks']) {
                 $postvar['packages'] = "all";
                 $packages_query = $dbh->select("packages", array("type", "!=", "free"), 0, 0, 1);
                 while ($packages_data = $dbh->fetch_array($packages_query)) {
                     $packtype .= $packages_data['type'] . ",";
                 }
             } else {
                 foreach ($postvar['packages'] as $key => $val) {
                     $packs .= $val . ",";
                     $packtype .= type::packagetype($val) . ",";
                 }
                 $postvar['packages'] = substr($packs, 0, -1);
             }
             if (substr_count($packtype, "paid") && $postvar['paiddisc'] == "0") {
                 $error .= "You selected at least one paid package.  Please enter a discount amount greater than 0 for the paid discount field.<br>";
             }
             if (substr_count($packtype, "p2h") && $postvar['p2hinitdisc'] == "0" && $postvar['p2hmonthlydisc'] == "0") {
                 $error .= "You selected at least one p2h package.  Please enter a discount amount greater than 0 for at least one of the post discount fields.<br>";
             }
             if (substr_count($packtype, "paid") && !substr_count($packtype, "p2h")) {
                 $postvar['p2hinitdisc'] = "0";
                 $postvar['p2hmonthlydisc'] = "0";
                 $postvar['p2hinittype'] = "0";
                 $postvar['p2hmonthlytype'] = "0";
             }
//.........这里部分代码省略.........
开发者ID:cozylife,项目名称:tht-reworked,代码行数:101,代码来源:class_coupons.php

示例3: edit_article

 private function edit_article()
 {
     global $dbh, $postvar, $getvar, $instance;
     $cats_query = $dbh->select("cats");
     if (!$dbh->num_rows($cats_query)) {
         echo "You need to add a category before you add an article.";
         return;
     }
     if ($_POST['edit']) {
         check::empty_fields();
         if (!main::errors()) {
             $articles_update = array("name" => $postvar['editname'], "content" => $postvar['editdescription'], "catid" => $postvar['catid']);
             $dbh->update("articles", $articles_update, array("id", "=", $getvar['id']));
             main::errors("Article Edited!");
         }
     }
     if ($getvar['del']) {
         $dbh->delete("articles", array("id", "=", $getvar['del']));
         main::errors("Article Deleted!");
     }
     if (main::isint($getvar['categoryid'])) {
         $show_cat[] = array("catid", "=", $getvar['categoryid']);
     }
     if (!main::isint($getvar['id'])) {
         $list_articles_array['BOXES'] = "";
         $articles_query = $dbh->select("articles", $show_cat, 0, 0, 1);
         if ($dbh->num_rows($articles_query)) {
             while ($articles_data = $dbh->fetch_array($articles_query)) {
                 $edit_article_box_array['NAME'] = $articles_data['name'];
                 $edit_article_box_array['ID'] = $articles_data['id'];
                 $list_articles_array['BOXES'] .= style::replaceVar("tpl/admin/kb/edit-article-box.tpl", $edit_article_box_array);
             }
         }
         echo style::replaceVar("tpl/admin/kb/list-articles.tpl", $list_articles_array);
     } else {
         $cats_query = $dbh->select("cats");
         while ($cat = $dbh->fetch_array($cats_query)) {
             $values[] = array($cat['name'], $cat['id']);
         }
         $article_data = $dbh->select("articles", array("id", "=", $getvar['id']), 0, "1");
         $edit_article_array['NAME'] = $article_data['name'];
         $edit_article_array['DESCRIPTION'] = $article_data['content'];
         $edit_article_array['DROPDOWN'] = main::dropDown("catid", $values, $article_data['catid']);
         echo style::replaceVar("tpl/admin/kb/edit-article.tpl", $edit_article_array);
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:46,代码来源:kb.php

示例4: EditEmailTemplates

 private function EditEmailTemplates()
 {
     global $dbh, $postvar, $getvar, $instance;
     if (main::isint($getvar['do'])) {
         if ($postvar['edittpl']) {
             check::empty_fields();
             if (!main::errors()) {
                 $dbh->update("templates", array("subject" => $postvar['subject']), array("id", "=", $getvar['do']));
                 $template_info = $dbh->select("templates", array("id", "=", $getvar['do']));
                 $tmpl_file_base = INC . "/tpl/email/" . $template_info['dir'] . "/" . $template_info['name'];
                 if (!is_writable($tmpl_file_base . ".tpl")) {
                     main::errors("In order to make changes to this file (" . $tmpl_file_base . ".tpl), please make it writable.");
                 } else {
                     $contents = stripslashes($postvar['emailcontent']);
                     if ($contents) {
                         $filetochangeOpen = fopen($tmpl_file_base . ".tpl", "w");
                         if (!fputs($filetochangeOpen, $contents)) {
                             main::errors("Could not write the template file, " . $tmpl_file_base . ".tpl");
                         }
                         fclose($filetochangeOpen);
                     }
                     if (!main::errors()) {
                         main::errors("Template edited!");
                     }
                 }
             }
         }
         $template_data = $dbh->select("templates", array("id", "=", $getvar['do']));
         if (!$template_data['id']) {
             $error_array['Error'] = "Template not found.";
             $error_array['Template ID'] = $getvar['do'];
             main::error($error_array);
         } else {
             $tmpl_file_base = INC . "/tpl/email/" . $template_data['dir'] . "/" . $template_data['name'];
             $tmpl_content_file = @file_get_contents($tmpl_file_base . ".tpl");
             $tmpl_descrip_file = @file_get_contents($tmpl_file_base . ".desc.tpl");
             if (!$tmpl_content_file && !$tmpl_descrip_file) {
                 $error_array['Error'] = "One of the template files don't exist.<br>";
                 $error_array['Template Locations'] = "<br>" . $tmpl_file_base . ".tpl<br>" . $tmpl_file_base . ".desc.tpl";
                 main::error($error_array);
             } else {
                 $edit_email_template_array['SUBJECT'] = $template_data['subject'];
                 $edit_email_template_array['DESCRIPTION'] = $tmpl_descrip_file;
                 $edit_email_template_array['TEMPLATE'] = $tmpl_content_file;
             }
         }
         echo style::replaceVar("tpl/admin/mail/edit-email-template.tpl", $edit_email_template_array);
         return;
     }
     if (main::isint($postvar['template'])) {
         main::redirect("?page=email&sub=templates&do=" . $postvar['template']);
     }
     $templates_query = $dbh->select("templates", 0, array("acpvisual", "ASC"));
     while ($templates_data = $dbh->fetch_array($templates_query)) {
         $values[] = array($templates_data['acpvisual'], $templates_data['id']);
     }
     $select_email_template_array['TEMPLATES'] = main::dropDown("template", $values, 0, 1);
     echo style::replaceVar("tpl/admin/mail/select-email-template.tpl", $select_email_template_array);
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:59,代码来源:email.php


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