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


PHP toMySQLDate函数代码示例

本文整理汇总了PHP中toMySQLDate函数的典型用法代码示例。如果您正苦于以下问题:PHP toMySQLDate函数的具体用法?PHP toMySQLDate怎么用?PHP toMySQLDate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: unset

 echo "<s";
 echo "elect name=\"status\"><option>New<option>Pending<option>In Progress<option>Completed<option>Postponed</select></td></tr>\n</table>\n\n<img src=\"images/spacer.gif\" height=\"10\" width=\"1\"><br>\n<DIV ALIGN=\"center\"><input type=\"submit\" value=\"";
 echo $aInt->lang("todolist", "addtodoitem");
 echo "\" class=\"button\"></DIV>\n</form>\n\n  </div>\n</div>\n\n<br />\n\n";
 $aInt->sortableTableInit("duedate", "ASC");
 unset($where);
 if ($status == "Incomplete" || $status == "") {
     $where['status'] = array("sqltype" => "NEQ", "value" => "Completed");
 } else {
     $where['status'] = $status;
 }
 if ($date) {
     $where['date'] = toMySQLDate($date);
 }
 if ($duedate) {
     $where['duedate'] = toMySQLDate($duedate);
 }
 if ($title) {
     $where['title'] = array("sqltype" => "LIKE", "value" => $title);
 }
 if ($description) {
     $where['description'] = array("sqltype" => "LIKE", "value" => $description);
 }
 if ($admin) {
     $where['admin'] = $admin;
 }
 $table = "tbltodolist";
 $result = select_query($table, "COUNT(*)", $where, $orderby, $order);
 $data = mysql_fetch_array($result);
 $numrows = $data[0];
 $AdminsArray = array();
开发者ID:billyprice1,项目名称:whmcs,代码行数:31,代码来源:todolist.php

示例2: die

<?php

use WHMCS\Input\Sanitize;
if (!defined("WHMCS")) {
    die("This file cannot be accessed directly");
}
if (!function_exists('getRegistrarsDropdownMenu')) {
    require ROOTDIR . '/includes/registrarfunctions.php';
}
$whmcs = App::self();
$reportdata["title"] = $aInt->lang('reports', 'domainRenewalEmailsTitle');
$userID = $whmcs->get_req_var('client');
$domain = $whmcs->get_req_var('domain');
$dateFrom = $whmcs->get_req_var('dateFrom') ? toMySQLDate($whmcs->get_req_var('dateFrom')) : '';
$dateTo = $whmcs->get_req_var('dateTo') ? toMySQLDate($whmcs->get_req_var('dateTo')) : '';
$formDateFrom = $dateFrom ? fromMySQLDate($dateFrom) : '';
$formDateTo = $dateTo ? fromMySQLDate($dateTo) : '';
$registrar = $whmcs->get_req_var('registrar');
$print = $whmcs->get_req_var('print');
/**
 * Replace the "None" string with the "Any" string
 */
$registrarList = str_replace($aInt->lang('global', 'none'), $aInt->lang('global', 'any'), getRegistrarsDropdownMenu($registrar));
$reportdata["description"] = $aInt->lang('reports', 'domainRenewalEmailsDescription');
$reportHeader = '';
if (!$print) {
    $reportHeader = <<<REPORT_HEADER
<form method="post" action="reports.php?report=domain_renewal_emails">
{$aInt->lang('fields', 'clientid')}: {$aInt->clientsDropDown($userID, '', 'client', true)}
{$aInt->lang('fields', 'domain')}: <input type="text" name="domain" value="{$domain}" size="30" />
{$aInt->lang('fields', 'registrar')}: {$registrarList}
开发者ID:MarcelaGotta,项目名称:Webty,代码行数:31,代码来源:domain_renewal_emails.php

示例3: select_query

$result = select_query("tbladmins", "id,firstname,lastname", "", "firstname` ASC,`lastname", "ASC");
while ($data = mysql_fetch_array($result)) {
    $aid = $data['id'];
    $admindropdown .= "<option value=\"" . $aid . "\"";
    if ($aid == $adminid) {
        echo " selected";
    }
    $admindropdown .= ">" . $data['firstname'] . " " . $data['lastname'] . "</option>";
}
$admindropdown .= "</select>";
$reportdata['headertext'] = "<form method=\"post\" action=\"reports.php?report=" . $report . "\">\n<table align=\"center\">\n<tr><td>Due Date Range - From</td><td><input type=\"text\" name=\"datefrom\" value=\"" . $datefrom . "\" class=\"datepick\" /></td><td width=\"20\"></td><td>To</td><td><input type=\"text\" name=\"dateto\" value=\"" . $dateto . "\" class=\"datepick\" /></td><td width=\"20\"></td><td>Filter by Status</td><td>" . $statusdropdown . "</td><td width=\"20\"></td><td>Filter by Staff Member</td><td>" . $admindropdown . "</td><td width=\"20\"></td><td><input type=\"submit\" value=\"Submit\" /></tr>\n</table>\n</form>";
$reportdata['tableheadings'] = array("ID", "Created", "Project Title", "Assigned Staff", "Associated Client", "Due Date", "Total Invoiced", "Total Paid", "Total Time", "Status");
$totalprojectstime = $i = 0;
$adminquery = $adminid ? " AND adminid='" . (int) $adminid . "'" : "";
$statusquery = $status ? " AND status='" . db_escape_string($status) . "'" : "";
$result = select_query("mod_project", "", "duedate>='" . toMySQLDate($datefrom) . "' AND duedate<='" . toMySQLDate($dateto) . "'" . $adminquery . $statusquery);
while ($data = mysql_fetch_array($result)) {
    $totaltaskstime = 0;
    $projectid = $data['id'];
    $projectname = $data['title'];
    $adminid = $data['adminid'];
    $userid = $data['userid'];
    $created = $data['created'];
    $duedate = $data['duedate'];
    $ticketids = $data['ticketids'];
    $projectstatus = $data['status'];
    $created = fromMySQLDate($created);
    $duedate = fromMySQLDate($duedate);
    $admin = $adminid ? getAdminName($adminid) : "None";
    if ($userid) {
        $clientsdetails = getClientsDetails($userid);
开发者ID:billyprice1,项目名称:whmcs,代码行数:31,代码来源:project_summary.php

示例4: Render


//.........这里部分代码省略.........
                     }
                     // test for date/time fields
                     $tries = 0;
                     $isDateTime = FALSE;
                     $isDate = FALSE;
                     $fieldName = str_replace('`', '', $this->QueryFieldsIndexed[$FilterField[$i + $j]]);
                     list($tn, $fn) = explode('.', $fieldName);
                     while (!($res = sql("show columns from `{$tn}` like '{$fn}'", $eo)) && $tries < 2) {
                         $tn = substr($tn, 0, -1);
                         $tries++;
                     }
                     if ($row = @db_fetch_array($res)) {
                         if ($row['Type'] == 'date' || $row['Type'] == 'time') {
                             $isDateTime = TRUE;
                             if ($row['Type'] == 'date') {
                                 $isDate = True;
                             }
                         }
                     }
                     // end of test
                     if ($FilterOperator[$i + $j] == 'is-empty' && !$isDateTime) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " (" . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . "='' or " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " is NULL) </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'is-not-empty' && !$isDateTime) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . "!='' </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'is-empty' && $isDateTime) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " (" . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . "=0 or " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " is NULL) </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'is-not-empty' && $isDateTime) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . "!=0 </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'like' && !strstr($FilterValue[$i + $j], "%") && !strstr($FilterValue[$i + $j], "_")) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " like '%" . makeSafe($FilterValue[$i + $j]) . "%' </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'not-like' && !strstr($FilterValue[$i + $j], "%") && !strstr($FilterValue[$i + $j], "_")) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " not like '%" . makeSafe($FilterValue[$i + $j]) . "%' </FilterItem>";
                     } elseif ($isDate) {
                         $dateValue = toMySQLDate($FilterValue[$i + $j]);
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " " . $GLOBALS['filter_operators'][$FilterOperator[$i + $j]] . " '{$dateValue}' </FilterItem>";
                     } else {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " " . $GLOBALS['filter_operators'][$FilterOperator[$i + $j]] . " '" . makeSafe($FilterValue[$i + $j]) . "' </FilterItem>";
                     }
                 }
             }
             $this->QueryWhere .= ") </FilterGroup>";
             $WhereNeedsClosing = 1;
         }
     }
     if ($WhereNeedsClosing) {
         $this->QueryWhere .= ")";
     }
     // set query sort
     if (!stristr($this->QueryOrder, "order by ") && $SortField != '' && $this->AllowSorting) {
         $actualSortField = $SortField;
         foreach ($this->SortFields as $fieldNum => $fieldSort) {
             $actualSortField = str_replace(" {$fieldNum} ", " {$fieldSort} ", " {$actualSortField} ");
             $actualSortField = str_replace(",{$fieldNum} ", ",{$fieldSort} ", " {$actualSortField} ");
         }
         $this->QueryOrder = "order by {$actualSortField} {$SortDirection}";
     }
     // clean up query
     $this->QueryWhere = str_replace('( <FilterGroup> and ', '( ', $this->QueryWhere);
     $this->QueryWhere = str_replace('( <FilterGroup> or ', '( ', $this->QueryWhere);
     $this->QueryWhere = str_replace('( <FilterItem> and ', '( ', $this->QueryWhere);
     $this->QueryWhere = str_replace('( <FilterItem> or ', '( ', $this->QueryWhere);
     $this->QueryWhere = str_replace('<FilterGroup>', '', $this->QueryWhere);
     $this->QueryWhere = str_replace('</FilterGroup>', '', $this->QueryWhere);
     $this->QueryWhere = str_replace('<FilterItem>', '', $this->QueryWhere);
     $this->QueryWhere = str_replace('</FilterItem>', '', $this->QueryWhere);
     // if no 'order by' clause found, apply default sorting if specified
开发者ID:ahmedandroid1980,项目名称:appgini,代码行数:67,代码来源:datalist.php

示例5: toMySQLDate

 }
 if ($type != "Server") {
     $server = 0;
 }
 if (!$type) {
     $errormessage = "You must choose a type for the issue";
 }
 if (!$title) {
     $errormessage = "A title is required summarising the issue";
 }
 if ($errormessage) {
     $action = "manage";
 } else {
     $startdate = toMySQLDate($startdate);
     if ($enddate) {
         $enddate = toMySQLDate($enddate);
     } else {
         $enddate = "NULL";
     }
     $updatearray = array("startdate" => $startdate, "enddate" => $enddate, "title" => $title, "description" => html_entity_decode($description), "type" => $type, "server" => $server, "affecting" => $affecting, "priority" => $priority, "status" => $status, "lastupdate" => "now()");
     if ($id) {
         update_query("tblnetworkissues", $updatearray, array("id" => $id));
         run_hook("NetworkIssueEdit", array_merge(array("id" => $id), $updatearray));
         if ($status == "Resolved") {
             run_hook("NetworkIssueClose", array("id" => $id));
         }
     } else {
         $nwid = insert_query("tblnetworkissues", $updatearray);
         run_hook("NetworkIssueAdd", array_merge(array("id" => $nwid), $updatearray));
     }
     redir();
开发者ID:billyprice1,项目名称:whmcs,代码行数:31,代码来源:networkissues.php

示例6: recalcPromoAmount

         $recurringamount += $domainemailforwardingprice;
     }
     if ($idprotection) {
         $recurringamount += $domainidprotectionprice;
     }
     if ($promoid) {
         $recurringamount -= recalcPromoAmount("D." . $domainparts[1], $userid, $id, $regperiod . "Years", $recurringamount, $promoid);
     }
 }
 if (!$olddonotrenew && $donotrenew) {
     disableAutoRenew($id);
 }
 $table = "tbldomains";
 $array = array("registrationdate" => toMySQLDate($regdate), "domain" => $domain, "firstpaymentamount" => $firstpaymentamount, "recurringamount" => $recurringamount, "paymentmethod" => $paymentmethod, "registrar" => $registrar, "registrationperiod" => $regperiod, "expirydate" => toMySQLDate($expirydate), "nextduedate" => toMySQLDate($nextduedate), "subscriptionid" => $subscriptionid, "promoid" => $promoid, "additionalnotes" => $additionalnotes, "status" => $status, "dnsmanagement" => $dnsmanagement, "emailforwarding" => $emailforwarding, "idprotection" => $idprotection, "donotrenew" => $donotrenew);
 if ($oldnextduedate != $nextduedate) {
     $array['nextinvoicedate'] = toMySQLDate($nextduedate);
 }
 $where = array("id" => $id);
 update_query($table, $array, $where);
 logActivity("Domain Modified - User ID: " . $userid . " - Domain ID: " . $id, $userid);
 if ($additionaldomainfield) {
     $domainparts = explode(".", $domain, 2);
     $tld = "." . $domainparts[1];
     $tempdomainfields = $additionaldomainfields[$tld];
     foreach ($tempdomainfields as $key => $value) {
         $key = $value['Name'];
         $value = $additionaldomainfield[$key];
         $table = "tbldomainsadditionalfields";
         $where = array("domainid" => $id, "name" => $key);
         $result = select_query($table, "COUNT(*)", $where);
         $data = mysql_fetch_array($result);
开发者ID:billyprice1,项目名称:whmcs,代码行数:31,代码来源:clientsdomains.php

示例7: getTodaysDate

    $todate = getTodaysDate();
}
$reportdata["headertext"] = "<form method=\"post\" action=\"{$PHP_SELF}?" . (isset($_REQUEST['module']) ? 'module=' . $_REQUEST['module'] . '&' : '') . "report={$report}&currencyid={$currencyid}&calculate=true\"><center>Staff Name: <select name=\"staffid\"><option value=\"0\">- Any -</option>";
$result = select_query("tbladmins", "id,CONCAT(firstname,' ',lastname)", "", "firstname", "ASC");
while ($data = mysql_fetch_array($result)) {
    $reportdata["headertext"] .= "<option value=\"" . $data[0] . "\"" . ($data[0] == $staffid ? " selected" : "") . ">" . $data[1] . "</option>";
}
$reportdata["headertext"] .= "</select> &nbsp;&nbsp;&nbsp; Start Date: <input type=\"text\" name=\"fromdate\" value=\"{$fromdate}\" class=\"datepick\" /> &nbsp;&nbsp;&nbsp; End Date: <input type=\"text\" name=\"todate\" value=\"{$todate}\" class=\"datepick\" /> &nbsp;&nbsp;&nbsp; <input type=\"submit\" value=\"Generate Report\" /></form>";
$reportdata["tableheadings"][] = "Ticket ID";
$reportdata["tableheadings"][] = "Staff Name";
$reportdata["tableheadings"][] = "Subject";
$reportdata["tableheadings"][] = "Feedback Left";
$reportdata["tableheadings"][] = "Rating";
$reportdata["tableheadings"][] = "Comments";
$reportdata["tableheadings"][] = "IP Address";
$result = select_query("tblticketfeedback", "tblticketfeedback.*,(SELECT CONCAT(firstname,' ',lastname) FROM tbladmins WHERE tbladmins.id=tblticketfeedback.adminid) AS adminname,(SELECT CONCAT(tid,'|||',title) FROM tbltickets WHERE tbltickets.id=tblticketfeedback.ticketid) AS ticketinfo", "datetime>='" . toMySQLDate($fromdate) . "' AND datetime<='" . toMySQLDate($todate . ' 23:59:59') . "'" . ($staffid ? " AND adminid=" . (int) $staffid : ""), "datetime", "ASC");
while ($data = mysql_fetch_array($result)) {
    $id = $data['id'];
    $ticketid = $data['ticketid'];
    $ticketinfo = $data['ticketinfo'];
    $adminid = $data['adminid'];
    $adminname = $data['adminname'];
    $rating = $data['rating'];
    $comments = $data['comments'];
    $datetime = $data['datetime'];
    $ip = $data['ip'];
    if ($adminid == 0) {
        $adminname = 'Generic Feedback';
    } elseif (!trim($adminname)) {
        $adminname = 'Deleted Admin';
    }
开发者ID:carriercomm,项目名称:whmcs-5,代码行数:31,代码来源:ticket_feedback_comments.php

示例8: array

<form method="post" action="reports.php?report={$report}">
<table align="center">
<tr><td>Date From:</td><td><input type="text" name="datefrom" value="{$datefrom}" class="datepick" /></td><td width="20"></td><td>Date To:</td><td><input type="text" name="dateto" value="{$dateto}" class="datepick" /></td><td width="20"></td><td><input type="submit" value="Submit" /></tr>
</table>
</form>
EOF;
$reportdata["tableheadings"] = array("Coupon Code", "Discount Type", "Value", "Recurring", "Notes", "Usage Count", "Total Revenue");
$i = 0;
$result = select_query("tblpromotions", "", "", "code", "ASC");
while ($data = mysql_fetch_array($result)) {
    $code = $data["code"];
    $type = $data["type"];
    $value = $data["value"];
    $recurring = $data["recurring"];
    $notes = $data["notes"];
    $rowcount = $rowtotal = 0;
    $reportdata["drilldown"][$i]["tableheadings"] = array("Order ID", "Order Date", "Order Number", "Order Total", "Order Status");
    $result2 = select_query("tblorders", "", "promocode='" . db_escape_string($code) . "' AND date>='" . toMySQLDate($datefrom) . "' AND date<='" . toMySQLDate($dateto) . "'", "id", "ASC");
    while ($data = mysql_fetch_array($result2)) {
        $orderid = $data['id'];
        $ordernum = $data['ordernum'];
        $orderdate = $data['date'];
        $ordertotal = $data['amount'];
        $orderstatus = $data['status'];
        $rowcount++;
        $rowtotal += $ordertotal;
        $reportdata["drilldown"][$i]["tablevalues"][] = array('<a href="orders.php?action=view&id=' . $orderid . '">' . $orderid . '</a>', fromMySQLDate($orderdate), $ordernum, $ordertotal, $orderstatus);
    }
    $reportdata["tablevalues"][$i] = array($code, $type, $value, $recurring, $notes, $rowcount, format_as_currency($rowtotal));
    $i++;
}
开发者ID:carriercomm,项目名称:whmcs-5,代码行数:31,代码来源:promotions_usage.php

示例9: array

 $where = array();
 if ($show == "received") {
     $where[] = "tblaccounts.amountin>0";
 } else {
     if ($show == "sent") {
         $where[] = "tblaccounts.amountout>0";
     }
 }
 if ($amount) {
     $where[] = "(tblaccounts.amountin='" . db_escape_string($amount) . "' OR tblaccounts.amountout='" . db_escape_string($amount) . "')";
 }
 if ($startdate) {
     $where[] = "tblaccounts.date>='" . toMySQLDate($startdate) . " 00:00:00'";
 }
 if ($enddate) {
     $where[] = "tblaccounts.date<='" . toMySQLDate($enddate) . " 23:59:59'";
 }
 if (!$startdate && !$enddate) {
     if ($within == "week") {
         $lastweek = date("Ymd", mktime(0, 0, 0, date("m"), date("d") - 7, date("Y")));
         $where[] = "tblaccounts.date>=" . $lastweek;
     } else {
         if ($within == "month") {
             $lastmonth = date("Ymd", mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")));
             $where[] = "tblaccounts.date>=" . $lastmonth;
         } else {
             if ($within == "year") {
                 $lastyear = date("Ymd", mktime(0, 0, 0, date("m"), date("d"), date("Y") - 1));
                 $where[] = "tblaccounts.date>=" . $lastyear;
             }
         }
开发者ID:billyprice1,项目名称:whmcs,代码行数:31,代码来源:transactions.php

示例10: Render


//.........这里部分代码省略.........
                     }
                     // test for date/time fields
                     $tries = 0;
                     $isDateTime = FALSE;
                     $isDate = FALSE;
                     $fieldName = str_replace('`', '', $this->QueryFieldsIndexed[$FilterField[$i + $j]]);
                     list($tn, $fn) = explode('.', $fieldName);
                     while (!($res = sql("show columns from `{$tn}` like '{$fn}'")) && $tries < 2) {
                         $tn = substr($tn, 0, -1);
                         $tries++;
                     }
                     if ($row = @mysql_fetch_array($res)) {
                         if ($row['Type'] == 'date' || $row['Type'] == 'time') {
                             $isDateTime = TRUE;
                             if ($row['Type'] == 'date') {
                                 $isDate = True;
                             }
                         }
                     }
                     // end of test
                     if ($FilterOperator[$i + $j] == 'isEmpty' && !$isDateTime) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " (" . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . "='' or " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " is NULL) </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'isNotEmpty' && !$isDateTime) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . "!='' </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'isEmpty' && $isDateTime) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " (" . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . "=0 or " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " is NULL) </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'isNotEmpty' && $isDateTime) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . "!=0 </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'like' && !strstr($FilterValue[$i + $j], "%") && !strstr($FilterValue[$i + $j], "_")) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " " . $FilterOperator[$i + $j] . " '%" . makeSafe($FilterValue[$i + $j]) . "%' </FilterItem>";
                     } elseif ($FilterOperator[$i + $j] == 'not like' && !strstr($FilterValue[$i + $j], "%") && !strstr($FilterValue[$i + $j], "_")) {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " " . $FilterOperator[$i + $j] . " '%" . makeSafe($FilterValue[$i + $j]) . "%' </FilterItem>";
                     } elseif ($isDate) {
                         $dateValue = toMySQLDate($FilterValue[$i + $j]);
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " " . $FilterOperator[$i + $j] . " '{$dateValue}' </FilterItem>";
                     } else {
                         $this->QueryWhere .= " <FilterItem> " . $FilterAnd[$i + $j] . " " . $this->QueryFieldsIndexed[$FilterField[$i + $j]] . " " . $FilterOperator[$i + $j] . " '" . makeSafe($FilterValue[$i + $j]) . "' </FilterItem>";
                     }
                 }
             }
             $this->QueryWhere .= ") </FilterGroup>";
             $WhereNeedsClosing = 1;
         }
     }
     if ($WhereNeedsClosing) {
         $this->QueryWhere .= ")";
     }
     // set query sort
     if (!stristr($this->QueryOrder, "order by ") && $SortField != "" && $this->AllowSorting) {
         $this->QueryOrder = "order by {$SortField} {$SortDirection}";
     }
     // clean up query
     $this->QueryWhere = str_replace("( <FilterGroup> and ", "( ", $this->QueryWhere);
     $this->QueryWhere = str_replace("( <FilterGroup> or ", "( ", $this->QueryWhere);
     $this->QueryWhere = str_replace("( <FilterItem> and ", "( ", $this->QueryWhere);
     $this->QueryWhere = str_replace("( <FilterItem> or ", "( ", $this->QueryWhere);
     $this->QueryWhere = str_replace("<FilterGroup>", "", $this->QueryWhere);
     $this->QueryWhere = str_replace("</FilterGroup>", "", $this->QueryWhere);
     $this->QueryWhere = str_replace("<FilterItem>", "", $this->QueryWhere);
     $this->QueryWhere = str_replace("</FilterItem>", "", $this->QueryWhere);
     // if no 'order by' clause found, apply default sorting if specified
     if ($this->DefaultSortField != "" && $this->QueryOrder == '') {
         $this->QueryOrder = "order by " . $this->DefaultSortField . " " . $this->DefaultSortDirection;
     }
     // get count of matching records ...
     $TempQuery = 'SELECT count(1) from ' . $this->QueryFrom . ' ' . $this->QueryWhere;
开发者ID:bigprof,项目名称:Symptoms-and-diseases-database,代码行数:67,代码来源:datalist.php

示例11: select_query

}
if ($userid) {
    $result = select_query("tblclients", "id", array("id" => $userid));
    $data = mysql_fetch_array($result);
    if (!$data['id']) {
        $apiresults = array("result" => "error", "message" => "Client ID Not Found");
        return null;
    }
}
if ($invoiceid = (int) $_POST['invoiceid']) {
    $query = "SELECT * FROM tblinvoices WHERE id='" . $invoiceid . "'";
    $result = full_query($query);
    $data = mysql_fetch_array($result);
    if (!$data['id']) {
        $apiresults = array("result" => "error", "message" => "Invoice ID Not Found");
        return null;
    }
}
if (!$paymentmethod) {
    $apiresults = array("result" => "error", "message" => "Payment Method is required");
    return null;
}
addTransaction($userid, $currencyid, $description, $amountin, $fees, $amountout, $paymentmethod, $transid, $invoiceid, $date, "", $rate);
if ($userid && $credit) {
    if ($transid) {
        $description .= " (Trans ID: " . $transid . ")";
    }
    insert_query("tblcredit", array("clientid" => $userid, "date" => toMySQLDate($date), "description" => $description, "amount" => $amountin));
    update_query("tblclients", array("credit" => "+=" . $amountin), array("id" => (int) $userid));
}
$apiresults = array("result" => "success");
开发者ID:billyprice1,项目名称:whmcs,代码行数:31,代码来源:addtransaction.php

示例12: buildCriteria

 private function buildCriteria($criteria)
 {
     $filters = array();
     if ($criteria['clientid']) {
         $filters[] = "userid=" . (int) $criteria['clientid'];
     }
     if ($criteria['clientname']) {
         $filters[] = "concat(firstname,' ',lastname) LIKE '%" . db_escape_string($criteria['clientname']) . "%'";
     }
     if ($criteria['invoicenum']) {
         $filters[] = "(tblinvoices.id='" . db_escape_string($criteria['invoicenum']) . "' OR tblinvoices.invoicenum='" . db_escape_string($criteria['invoicenum']) . "')";
     }
     if ($criteria['lineitem']) {
         $filters[] = "tblinvoices.id IN (SELECT invoiceid FROM tblinvoiceitems WHERE description LIKE '%" . db_escape_string($criteria['lineitem']) . "%')";
     }
     if ($criteria['paymentmethod']) {
         $filters[] = "tblinvoices.paymentmethod='" . db_escape_string($criteria['paymentmethod']) . "'";
     }
     if ($criteria['invoicedate']) {
         $filters[] = "tblinvoices.date='" . toMySQLDate($criteria['invoicedate']) . "'";
     }
     if ($criteria['duedate']) {
         $filters[] = "tblinvoices.duedate='" . toMySQLDate($criteria['duedate']) . "'";
     }
     if ($criteria['datepaid']) {
         $filters[] = "tblinvoices.datepaid>='" . toMySQLDate($criteria['datepaid']) . "' AND tblinvoices.datepaid<='" . toMySQLDate($criteria['datepaid']) . "235959'";
     }
     if ($criteria['totalfrom']) {
         $filters[] = "tblinvoices.total>='" . db_escape_string($criteria['totalfrom']) . "'";
     }
     if ($criteria['totalto']) {
         $filters[] = "tblinvoices.total<='" . db_escape_string($criteria['totalto']) . "'";
     }
     if ($criteria['status']) {
         if ($criteria['status'] == "Overdue") {
             $filters[] = "tblinvoices.status='Unpaid' AND tblinvoices.duedate<'" . date("Ymd") . "'";
         } else {
             $filters[] = "tblinvoices.status='" . db_escape_string($criteria['status']) . "'";
         }
     }
     return $filters;
 }
开发者ID:billyprice1,项目名称:whmcs,代码行数:42,代码来源:class.invoices.php

示例13: convertQuotetoInvoice

function convertQuotetoInvoice($id, $invoicetype, $invoiceduedate, $depositpercent, $depositduedate, $finalduedate, $sendemail)
{
    global $CONFIG;
    global $_LANG;
    $result = select_query("tblquotes", "", array("id" => $id));
    $data = mysql_fetch_array($result);
    $userid = $data['userid'];
    $firstname = $data['firstname'];
    $lastname = $data['lastname'];
    $companyname = $data['companyname'];
    $email = $data['email'];
    $address1 = $data['address1'];
    $address2 = $data['address2'];
    $city = $data['city'];
    $state = $data['state'];
    $postcode = $data['postcode'];
    $country = $data['country'];
    $phonenumber = $data['phonenumber'];
    $currency = $data['currency'];
    if ($userid) {
        getUsersLang($userid);
        $clientsdetails = getClientsDetails($userid);
        $state = $clientsdetails['state'];
        $country = $clientsdetails['country'];
    } else {
        if (!function_exists("addClient")) {
            require ROOTDIR . "/clientfunctions.php";
        }
        $_SESSION['currency'] = $currency;
        $userid = addClient($firstname, $lastname, $companyname, $email, $address1, $address2, $city, $state, $postcode, $country, $phonenumber, substr(md5($id), 0, 10), 0, "", "on");
    }
    if ($CONFIG['TaxEnabled'] == "on") {
        $taxlevel1 = getTaxRate(1, $state, $country);
        $taxlevel2 = getTaxRate(2, $state, $country);
        $taxrate = $taxlevel1['rate'];
        $taxrate2 = $taxlevel2['rate'];
    }
    $subtotal = $data['subtotal'];
    $tax1 = $data['tax1'];
    $tax2 = $data['tax2'];
    $total = $data['total'];
    $result = select_query("tblpaymentgateways", "gateway", array("setting" => "name"), "order", "ASC");
    $data = mysql_fetch_array($result);
    $gateway = $data['gateway'];
    $duedate = $finaldate = "";
    if ($invoicetype == "deposit") {
        if ($depositduedate) {
            $duedate = toMySQLDate($depositduedate);
        }
        $finaldate = $finalduedate ? toMySQLDate($finalduedate) : date("Y-m-d");
    } else {
        if ($invoiceduedate) {
            $duedate = toMySQLDate($invoiceduedate);
        }
    }
    if (!$duedate) {
        $duedate = date("Y-m-d");
    }
    $invoiceid = insert_query("tblinvoices", array("date" => "now()", "duedate" => $duedate, "userid" => $userid, "status" => "Unpaid", "paymentmethod" => $gateway, "taxrate" => $taxrate, "taxrate2" => $taxrate2, "subtotal" => $subtotal, "tax" => $tax1, "tax2" => $tax2, "total" => $total, "notes" => $_LANG['quoteref'] . $id));
    if ($finaldate) {
        $finalinvoiceid = insert_query("tblinvoices", array("date" => "now()", "duedate" => $finaldate, "userid" => $userid, "status" => "Unpaid", "paymentmethod" => $gateway, "taxrate" => $taxrate, "taxrate2" => $taxrate2, "subtotal" => $subtotal, "tax" => $tax1, "tax2" => $tax2, "total" => $total, "notes" => $_LANG['quoteref'] . $id));
    }
    $result = select_query("tblquoteitems", "", array("quoteid" => $id), "id", "ASC");
    while ($data = mysql_fetch_array($result)) {
        $line_id = $data['id'];
        $line_desc = $data['description'];
        $line_qty = $data['quantity'];
        $line_unitprice = $data['unitprice'];
        $line_discount = $data['discount'];
        $line_taxable = $data['taxable'];
        $line_total = format_as_currency($line_qty * $line_unitprice * (1 - $line_discount / 100));
        $lineitemdesc = "" . $line_qty . " x " . $line_desc . " @ " . $line_unitprice;
        if (0 < $line_discount) {
            $lineitemdesc .= " - " . $line_discount . "% " . $_LANG['orderdiscount'];
        }
        if ($finalinvoiceid) {
            $originalamount = $line_total;
            $line_total = $originalamount * ($depositpercent / 100);
            $final_amount = $originalamount - $line_total;
            insert_query("tblinvoiceitems", array("invoiceid" => $finalinvoiceid, "userid" => $userid, "description" => $lineitemdesc . " (" . (100 - $depositpercent) . "% " . $_LANG['quotefinalpayment'] . ")", "amount" => $final_amount, "taxed" => $line_taxable));
            $lineitemdesc .= " (" . $depositpercent . "% " . $_LANG['quotedeposit'] . ")";
        }
        insert_query("tblinvoiceitems", array("invoiceid" => $invoiceid, "userid" => $userid, "description" => $lineitemdesc, "amount" => $line_total, "taxed" => $line_taxable));
    }
    if (!function_exists("updateInvoiceTotal")) {
        require ROOTDIR . "/includes/invoicefunctions.php";
    }
    updateInvoiceTotal($invoiceid);
    if ($finalinvoiceid) {
        updateInvoiceTotal($finalinvoiceid);
    }
    run_hook("InvoiceCreationPreEmail", array("invoiceid" => $invoiceid));
    if ($finalinvoiceid) {
        run_hook("InvoiceCreationPreEmail", array("invoiceid" => $finalinvoiceid));
    }
    if ($sendemail) {
        sendMessage("Invoice Created", $invoiceid);
        if ($finalinvoiceid) {
            sendMessage("Invoice Created", $finalinvoiceid);
        }
//.........这里部分代码省略.........
开发者ID:billyprice1,项目名称:whmcs,代码行数:101,代码来源:quotefunctions.php

示例14: generate_token

            $tbl->addRow(array("<input type=\"checkbox\" name=\"selectedinvoices[]\" value=\"" . $invoice['id'] . "\" class=\"checkall\">", $linkopen . $invoice['invoicenum'] . $linkclose, $invoice['clientname'], $invoice['date'], $invoice['duedate'], "<a href=\"invoices.php?action=invtooltip&id=" . $invoice['id'] . "&userid=" . $invoice['userid'] . generate_token("link") . "\" class=\"invtooltip\" lang=\"\">" . $invoice['totalformatted'] . "</a>", $invoice['paymentmethod'], $invoice['statusformatted'], $linkopen . "<img src=\"images/edit.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"Edit\">" . $linkclose, "<a href=\"#\" onClick=\"doDelete('" . $invoice['id'] . "');return false\"><img src=\"images/delete.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"Delete\"></a>"));
        }
        $tbl->setMassActionBtns("<input type=\"submit\" value=\"" . $aInt->lang("invoices", "markpaid") . "\" class=\"btn-success\" name=\"markpaid\" onclick=\"return confirm('" . $aInt->lang("invoices", "markpaidconfirm", "1") . "')\" /> <input type=\"submit\" value=\"" . $aInt->lang("invoices", "markunpaid") . "\" name=\"markunpaid\" onclick=\"return confirm('" . $aInt->lang("invoices", "markunpaidconfirm", "1") . "')\" /> <input type=\"submit\" value=\"" . $aInt->lang("invoices", "markcancelled") . "\" name=\"markcancelled\" onclick=\"return confirm('" . $aInt->lang("invoices", "markcancelledconfirm", "1") . "')\" /> <input type=\"submit\" value=\"" . $aInt->lang("invoices", "duplicateinvoice") . "\" name=\"duplicateinvoice\" onclick=\"return confirm('" . $aInt->lang("invoices", "duplicateinvoiceconfirm", "1") . "')\" /> <input type=\"submit\" value=\"" . $aInt->lang("invoices", "sendreminder") . "\" name=\"paymentreminder\" onclick=\"return confirm('" . $aInt->lang("invoices", "sendreminderconfirm", "1") . "')\" /> <input type=\"submit\" value=\"" . $aInt->lang("global", "delete") . "\" class=\"btn-danger\" name=\"massdelete\"  onclick=\"return confirm('" . $aInt->lang("invoices", "massdeleteconfirm", "1") . "')\" />");
        echo $tbl->output();
        unset($clientlist);
        unset($invoicesModel);
    }
} else {
    if ($action == "edit") {
        $result = select_query("tblinvoices", "userid,paymentmethod", array("id" => $id));
        $data = mysql_fetch_array($result);
        $userid = $data[0];
        $oldpaymentmethod = $data[1];
        if ($saveoptions) {
            check_token("WHMCS.admin.default");
            update_query("tblinvoices", array("date" => toMySQLDate($invoicedate), "duedate" => toMySQLDate($datedue), "paymentmethod" => $paymentmethod, "invoicenum" => $invoicenum, "taxrate" => $taxrate, "taxrate2" => $taxrate2, "status" => $status), array("id" => $id));
            updateInvoiceTotal($id);
            if ($oldpaymentmethod != $paymentmethod) {
                run_hook("InvoiceChangeGateway", array("invoiceid" => $id, "paymentmethod" => $paymentmethod));
            }
            logActivity("Modified Invoice Options - Invoice ID: " . $id, $userid);
            redir("action=edit&id=" . $id);
            exit;
        }
        if ($save == "notes") {
            check_token("WHMCS.admin.default");
            update_query("tblinvoices", array("notes" => $notes), array("id" => $id));
            logActivity("Modified Invoice Notes - Invoice ID: " . $id, $userid);
            redir("action=edit&id=" . $id);
            exit;
        }
开发者ID:billyprice1,项目名称:whmcs,代码行数:31,代码来源:invoices.php

示例15: namecheap_ssl_output

function namecheap_ssl_output($vars)
{
    if (!empty($_REQUEST['action'])) {
        $action = $_REQUEST['action'];
    } else {
        $action = 'default';
    }
    global $_LANG;
    namecheapssl_initlang();
    $view = array('global' => array('mod_url' => '?module=namecheap_ssl', 'module' => 'namecheap_ssl'));
    if ('log' == $action) {
        // prepare data for actions filters
        // actions
        $view['filter_action_options'] = array();
        $sql = "SELECT DISTINCT action FROM mod_namecheapssl_log";
        $r = mysql_query($sql);
        if (mysql_numrows($r)) {
            while ($row = mysql_fetch_assoc($r)) {
                if (!empty($row['action'])) {
                    $view['filter_action_options'][] = $row['action'];
                }
            }
        }
        // detect selected action
        if (!empty($_REQUEST['filter_action']) && in_array($_REQUEST['filter_action'], $view['filter_action_options'])) {
            $view['filter_action_value'] = $_REQUEST['filter_action'];
        } else {
            $view['filter_action_value'] = '';
        }
        //
        $view['filter_date_from_value'] = empty($_REQUEST['filter_date_from']) ? '' : $_REQUEST['filter_date_from'];
        $view['filter_date_to_value'] = empty($_REQUEST['filter_date_to']) ? '' : $_REQUEST['filter_date_to'];
        $view['filter_user_value'] = empty($_REQUEST['filter_user']) ? '' : $_REQUEST['filter_user'];
        // prepare query for page items
        $iOffset = empty($vars['log_items_per_page']) ? 50 : (int) $vars['log_items_per_page'];
        $page = !empty($_REQUEST['page']) ? (int) $_REQUEST['page'] : 1;
        $iLimit = $page <= 1 ? 0 : ($page - 1) * $iOffset;
        // create WHERE for sql query
        $sqlWhereArray = array();
        // action value
        if (!empty($view['filter_action_value'])) {
            $sqlWhereArray[] = sprintf(" action='%s' ", mysql_real_escape_string($view['filter_action_value']));
        }
        // date from value
        if (!empty($view['filter_date_from_value'])) {
            $sqlWhereArray[] = sprintf("date>='%s'", toMySQLDate($view['filter_date_from_value']));
        }
        // date to value
        if (!empty($view['filter_date_to_value'])) {
            $sqlWhereArray[] = sprintf("date<='%s'", toMySQLDate($view['filter_date_to_value']) . ' 23:59:59');
        }
        // admin / client filter
        if (!empty($view['filter_user_value'])) {
            if (false !== strpos($view['filter_user_value'], '@')) {
                $sqlWhereArray[] = sprintf("c.email = '%s'", mysql_real_escape_string($view['filter_user_value']));
            } else {
                $sqlWhereArray[] = sprintf("log.user LIKE '%s%%'", mysql_real_escape_string($view['filter_user_value']));
            }
        }
        if (!empty($sqlWhereArray)) {
            $sqlWhere = ' WHERE ' . implode(' AND ', $sqlWhereArray);
        } else {
            $sqlWhere = '';
        }
        $sql = "SELECT log.*,c.email FROM mod_namecheapssl_log log LEFT JOIN tblclients AS c ON (log.userid=c.id AND user='client') {$sqlWhere} ORDER BY log.id DESC LIMIT {$iLimit},{$iOffset}";
        $view['log_items'] = array();
        $r = mysql_query($sql);
        if (mysql_numrows($r)) {
            while ($row = mysql_fetch_assoc($r)) {
                $view['log_items'][] = $row;
            }
        }
        // query for count
        $sql = "SELECT COUNT(log.id) FROM mod_namecheapssl_log log LEFT JOIN tblclients AS c ON (log.userid=c.id AND user='client') {$sqlWhere}";
        $r = mysql_query($sql);
        $row = mysql_fetch_array($r);
        $iCountOfLogItems = array_shift($row);
        $iCountOfPages = (int) ceil($iCountOfLogItems / $iOffset);
        $view['log_items_count'] = $iCountOfLogItems;
        $view['log_items_count_of_pages'] = $iCountOfPages;
        $view['log_items_current_page'] = $page <= 1 ? 1 : $page;
    } else {
        if ('sync' == $action) {
            if (!empty($_REQUEST['hostingid'])) {
                $view['hostingid'] = (int) $_REQUEST['hostingid'];
                // search product
                $r = mysql_query('SELECT orderid, tblhosting.domain, tblproducts.name AS productname FROM tblhosting JOIN tblproducts ON tblhosting.packageid=tblproducts.id WHERE tblhosting.id=' . (int) $_REQUEST['hostingid']);
                $row = mysql_fetch_assoc($r);
                // check san certificate
                // get config options
                $certHasSanOption = false;
                $r = mysql_query('SELECT tblproductconfigoptions.optionname FROM tblproductconfigoptions JOIN tblhostingconfigoptions ON (tblhostingconfigoptions.configid=tblproductconfigoptions.id) WHERE tblhostingconfigoptions.relid=' . (int) $_REQUEST['hostingid']);
                $optionNames = array();
                while (false !== ($optionsRow = mysql_fetch_assoc($r))) {
                    $optionNames[] = $optionsRow['optionname'];
                    if ('san' == substr($optionsRow['optionname'], 0, 3)) {
                        $certHasSanOption = true;
                    }
                }
                $view['cert_has_san_option'] = $certHasSanOption;
//.........这里部分代码省略.........
开发者ID:cengjing,项目名称:ssl-whmcs,代码行数:101,代码来源:namecheap_ssl.php


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