當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sqlTime函數代碼示例

本文整理匯總了PHP中sqlTime函數的典型用法代碼示例。如果您正苦於以下問題:PHP sqlTime函數的具體用法?PHP sqlTime怎麽用?PHP sqlTime使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了sqlTime函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onAfterRender

 function onAfterRender(Am_Event_AfterRender $event)
 {
     if ($this->done) {
         return;
     }
     if (preg_match('/thanks\\.phtml$/', $event->getTemplateName()) && $event->getView()->invoice && $event->getView()->payment) {
         $this->done += $event->replace("|</body>|i", $this->getHeader() . $this->getSaleCode($event->getView()->invoice, $event->getView()->payment) . "</body>", 1);
         if ($this->done) {
             $payment = $event->getView()->payment;
             $payment->data()->set(self::TRACKED_DATA_KEY, 1);
             $payment->save();
         }
     } elseif (preg_match('/signup\\/signup.*\\.phtml$/', $event->getTemplateName())) {
         $this->done += $event->replace("|</body>|i", $this->getHeader() . $this->getTrackingCode() . $this->getSignupCode() . "</body>", 1);
     } else {
         if ($user_id = $this->getDi()->auth->getUserId()) {
             $payments = $this->getDi()->invoicePaymentTable->findBy(array('user_id' => $user_id, 'dattm' => '>' . sqlTime('-5 days')));
             foreach ($payments as $payment) {
                 if ($payment->data()->get(self::TRACKED_DATA_KEY)) {
                     continue;
                 }
                 $this->done += $event->replace("|</body>|i", $this->getHeader() . $this->getSaleCode($payment->getInvoice(), $payment) . "</body>", 1);
                 if ($this->done) {
                     $payment->data()->set(self::TRACKED_DATA_KEY, 1);
                     $payment->save();
                 }
                 break;
             }
         }
         if (!$this->done && !(defined('AM_ADMIN') && AM_ADMIN) && !$this->getDi()->config->get("google_analytics_only_sales_code")) {
             $this->done += $event->replace("|</body>|i", $this->getHeader() . $this->getTrackingCode() . "</body>", 1);
         }
     }
 }
開發者ID:alexanderTsig,項目名稱:arabic,代碼行數:34,代碼來源:google-analytics.php

示例2: _set

 protected function _set($key, $value, $colName, $expires = null)
 {
     if ($expires && !preg_match('/^\\d+$/', $expires)) {
         $expires = sqlTime($expires);
     }
     $this->db->query("INSERT INTO ?_store\n            SET name=?, `value`=?, blob_value=?, `expires`=?\n            ON DUPLICATE KEY UPDATE `value`=VALUES(`value`), `blob_value`=VALUES(`blob_value`),\n                `expires`=VALUES(`expires`)\n            ", $key, $colName == self::VALUE ? $value : null, $colName == self::BLOB_VALUE ? $value : null, $expires);
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:7,代碼來源:Store.php

示例3: void

 public function void($amount)
 {
     $record = $this->grid->getRecord();
     if (!$record->is_voided) {
         Am_Di::getInstance()->affCommissionTable->void($record, sqlTime('now'), $amount);
     }
     $this->log();
     $this->grid->redirectBack();
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:9,代碼來源:Void.php

示例4: setArray

 public function setArray($keyValues, $expires = null)
 {
     if ($expires && !preg_match('/^\\d+$/', $expires)) {
         $expires = sqlTime($expires);
     }
     $vals = array();
     foreach ($keyValues as $k => $v) {
         $vals[] = sprintf("(%s, %s, '%s')", $this->db->escape($k), $this->db->escape($v), $expires == null ? 'NULL' : $expires);
     }
     if ($vals) {
         $this->db->query("INSERT INTO ?_store (name, value, expires) VALUES " . implode(",", $vals) . "\n                ON DUPLICATE KEY UPDATE `value`=VALUES(`value`), `expires`=VALUES(`expires`)");
     }
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:13,代碼來源:Store.php

示例5: setArray

 public function setArray($rebuildName, $sessionId, $users, $expires = null)
 {
     if ($expires && !preg_match('/^\\d+$/', $expires)) {
         $expires = sqlTime($expires);
     }
     $vals = array();
     foreach ($users as $user_id) {
         $vals[] = sprintf("('%s', '%s', %d, '%s')", $rebuildName, $sessionId, $user_id, $expires == null ? 'NULL' : $expires);
     }
     if ($vals) {
         $this->db->query("INSERT INTO ?_store_rebuild (rebuild_name, session_id, user_id, expires) VALUES " . implode(",", $vals) . "\n                ON DUPLICATE KEY UPDATE `expires`=VALUES(`expires`)");
     }
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:13,代碼來源:StoreRebuild.php

示例6: doSignup

 public function doSignup(array $vars)
 {
     $vars['name'] = preg_replace('/[^\\w\\s]+/u', '', $vars['name']);
     $rand = substr(sha1(mt_rand()), 0, 10);
     $link = ROOT_SURL . "/newsletter/subscribe/confirm/k/" . $rand;
     $this->getDi()->store->setBlob(self::STORE_KEY . $rand, serialize($vars), sqlTime('+48 hours'));
     /// send confirmation e-mail
     $et = Am_Mail_Template::load('verify_guest');
     if (!$et) {
         throw new Am_Exception_Configuration("No e-mail template found for [verify_guest]");
     }
     $et->setName($vars['name'])->setLink($link)->setCode($rand);
     $et->send($vars['email']);
     $this->_redirect('newsletter/subscribe/confirm');
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:15,代碼來源:SubscribeController.php

示例7: process

 function process(User $user, array $r)
 {
     $times = unserialize($r['wp_optimizemember_paid_registration_times']);
     $max = max($times);
     foreach ($times as $level => $time) {
         if (!($pid = $this->_translateProduct($level))) {
             continue;
         }
         $bpId = Am_Di::getInstance()->productTable->load($pid)->default_billing_plan_id;
         $fisrtPeriod = Am_Di::getInstance()->billingPlanTable->load($bpId)->first_period;
         $period = new Am_Period($fisrtPeriod);
         $this->payment[$pid] = array('start' => sqlTime($time), 'stop' => $period->addTo(sqlTime($time)));
         if ($time == $max) {
             $lastProduct = $pid;
         }
     }
     $this->payment[$lastProduct]['subscr_id'] = $r['wp_optimizemember_subscr_id'];
     $this->user = $user;
     return $this->doWork();
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:20,代碼來源:AdminImportWordpressOptimizeMemberController.php

示例8: validateInvoiceAndKey

 public function validateInvoiceAndKey()
 {
     $invoiceId = $this->getFiltered('id');
     if (!$invoiceId) {
         throw new Am_Exception_InputError("invoice_id is empty - seems you have followed wrong url, please return back to continue");
     }
     $this->invoice = $this->getDi()->invoiceTable->findBySecureId($invoiceId, $this->plugin->getId());
     if (!$this->invoice) {
         throw new Am_Exception_InputError('You have used wrong link for payment page, please return back and try again');
     }
     if ($this->invoice->isCompleted()) {
         throw new Am_Exception_InputError(sprintf(___('Payment is already processed, please go to %sMembership page%s'), "<a href='" . htmlentities($this->getDi()->config->get('root_url')) . "/member'>", "</a>"));
     }
     if ($this->invoice->paysys_id != $this->plugin->getId()) {
         throw new Am_Exception_InputError("You have used wrong link for payment page, please return back and try again");
     }
     if ($this->invoice->tm_added < sqlTime('-1 days')) {
         throw new Am_Exception_InputError("Invoice expired - you cannot open invoice after 24 hours elapsed");
     }
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:20,代碼來源:CreditCard.php

示例9: onBuildDemo

 function onBuildDemo(Am_Event $event)
 {
     $subjects = array('Please help', 'Urgent question', 'I have a problem', 'Important question', 'Pre-sale inquiry');
     $questions = array("My website is now working. Can you help?", "I have a problem with website script.\nWhere can I find documentation?", "I am unable to place an order, my credit card is not accepted.");
     $answers = array("Please call us to phone# 1-800-222-3334", "We are looking to your problem, and it will be resolved within 4 hours");
     $user = $event->getUser();
     /* @var $user User */
     while (rand(0, 10) < 4) {
         $ticket = $this->getDi()->helpdeskTicketRecord;
         $ticket->status = HelpdeskTicket::STATUS_AWAITING_ADMIN_RESPONSE;
         $ticket->subject = $subjects[rand(0, count($subjects) - 1)];
         $ticket->user_id = $user->pk();
         $ticket->created = sqlTime('now');
         $ticket->insert();
         //
         $msg = $this->getDi()->helpdeskMessageRecord;
         $msg->content = $questions[rand(0, count($questions) - 1)];
         $msg->type = 'message';
         $msg->ticket_id = $ticket->pk();
         $msg->dattm = $tm = sqlTime(time() - rand(3600, 3600 * 24 * 180));
         $msg->insert();
         //
         if (rand(0, 10) < 6) {
             $msg = $this->getDi()->helpdeskMessageRecord;
             $msg->content = $answers[rand(0, count($answers) - 1)];
             $msg->type = 'message';
             $msg->ticket_id = $ticket->pk();
             $msg->dattm = sqlTime(strtotime($tm) + rand(180, 3600 * 24));
             $msg->admin_id = $this->getDi()->adminTable->findFirstBy()->pk();
             $msg->insert();
             if (rand(0, 10) < 6) {
                 $ticket->status = HelpdeskTicket::STATUS_AWAITING_USER_RESPONSE;
             } else {
                 $ticket->status = HelpdeskTicket::STATUS_CLOSED;
             }
             $ticket->update();
         }
     }
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:39,代碼來源:Bootstrap.php

示例10: ccActionValidateSetInvoice

 protected function ccActionValidateSetInvoice(Am_Request $request, array $invokeArgs)
 {
     $invoiceId = $request->getFiltered('cc_id');
     if (!$invoiceId) {
         throw new Am_Exception_InputError("invoice_id is empty - seems you have followed wrong url, please return back to continue");
     }
     $invoice = $this->getDi()->invoiceTable->findBySecureId($invoiceId, $this->getId());
     if (!$invoice) {
         throw new Am_Exception_InputError('You have used wrong link for payment page, please return back and try again');
     }
     if ($invoice->isCompleted()) {
         throw new Am_Exception_InputError(sprintf(___('Payment is already processed, please go to %sMembership page%s'), "<a href='" . htmlentities($this->getDi()->config->get('root_url')) . "/member'>", "</a>"));
     }
     if ($invoice->paysys_id != $this->getId()) {
         throw new Am_Exception_InputError("You have used wrong link for payment page, please return back and try again");
     }
     if ($invoice->tm_added < sqlTime('-30 days')) {
         throw new Am_Exception_InputError("Invoice expired - you cannot open invoice after 30 days elapsed");
     }
     $this->invoice = $invoice;
     // set for reference
 }
開發者ID:alexanderTsig,項目名稱:arabic,代碼行數:22,代碼來源:braintree.php

示例11: lock

 public function lock(Admin $admin)
 {
     $this->updateQuick(array('lock_until' => sqlTime('+2 minutes'), 'lock_admin_id' => $admin->pk(), 'lock_admin' => sprintf('%s (%s %s)', $admin->login, $admin->name_f, $admin->name_l)));
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:4,代碼來源:HelpdeskTicket.php

示例12: sendSecurityCode

 private function sendSecurityCode(Admin $admin)
 {
     $security_code = $this->getDi()->app->generateRandomString(16);
     $securitycode_expire = sqlTime(time() + self::EXPIRATION_PERIOD * 60 * 60);
     $et = Am_Mail_Template::load('send_security_code_admin', null, true);
     $et->setUser($admin);
     $et->setUrl(sprintf('%s/admin-auth/change-pass/?s=%s', $this->getDi()->config->get('root_url'), $security_code));
     $et->setHours(self::EXPIRATION_PERIOD);
     $et->send($admin);
     $this->getDi()->store->set(self::SECURITY_CODE_STORE_PREFIX . $security_code, $admin->pk(), $securitycode_expire);
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:11,代碼來源:AdminAuthController.php

示例13: addInvoiceAction

    public function addInvoiceAction()
    {
        $this->getDi()->authAdmin->getUser()->checkPermission('grid_invoice', 'insert');
        $form = new Am_Form_Admin('add-invoice');
        $tm_added = $form->addDate('tm_added')->setLabel(___('Date'));
        $tm_added->setValue($this->getDi()->sqlDate);
        $tm_added->addRule('required');
        $comment = $form->addText('comment', array('class' => 'el-wide'))->setLabel(___("Comment\nfor your reference"));
        $form->addElement(new Am_Form_Element_ProductsWithQty('product_id'))->setLabel(___('Products'))->loadOptions($this->getDi()->billingPlanTable->selectAllSorted())->addRule('required');
        $form->addSelect('paysys_id')->setLabel(___('Payment System'))->setId('add-invoice-paysys_id')->loadOptions(array('' => '') + $this->getDi()->paysystemList->getOptions());
        $couponEdit = $form->addText('coupon')->setLabel(___('Coupon'))->setId('p-coupon');
        $action = $form->addAdvRadio('_action')->setLabel(___('Action'))->setId('add-invoice-action')->loadOptions(array('pending' => ___('Just Add Pending Invoice'), 'pending-payment' => ___('Add Invoice and Payment/Access Manually'), 'pending-send' => ___('Add Pending Invoice and Send Link to Pay It to Customer')))->setValue('pending');
        $receipt = $form->addText('receipt')->setLabel(___('Receipt#'))->setId('add-invoice-receipt');
        $tm_due = $form->addDate('tm_due')->setLabel(___('Due Date'));
        $tm_due->setValue(sqlDate('+7 days'));
        $tm_due->setId('add-invoice-due');
        $message = $form->addTextarea('message', array('class' => 'el-wide'))->setLabel(___("Message\nwill be included to email to user"));
        $message->setId('add-invoice-message');
        $form->addElement('email_link', 'invoice_pay_link')->setLabel(___('Email Template with Payment Link'));
        $form->addScript()->setScript('
            $("[name=_action]").change(function(){
                var val = $("[name=_action]:checked").val();
                $("#add-invoice-receipt").closest("div.row").toggle(val == "pending-payment")
                $("#add-invoice-due").closest("div.row").toggle(val == "pending-send")
                $("#add-invoice-message").closest("div.row").toggle(val == "pending-send")
                $("[name=invoice_pay_link]").closest("div.row").toggle(val == "pending-send")
            }).change();

        ');
        $script = <<<CUT
        \$("input#p-coupon").autocomplete({
                minLength: 2,
                source: window.rootUrl + "/admin-coupons/autocomplete"
        });
CUT;
        $form->addScript('script')->setScript($script);
        $form->addSaveButton();
        $form->setDataSources(array($this->getRequest()));
        do {
            if ($form->isSubmitted() && $form->validate()) {
                $vars = $form->getValue();
                $invoice = $this->getDi()->invoiceRecord;
                $invoice->setUser($this->getDi()->userTable->load($this->user_id));
                $invoice->tm_added = sqlTime($vars['tm_added']);
                if ($vars['coupon']) {
                    $invoice->setCouponCode($vars['coupon']);
                    $error = $invoice->validateCoupon();
                    if ($error) {
                        $couponEdit->setError($error);
                        break;
                    }
                }
                foreach ($vars['product_id'] as $plan_id => $qty) {
                    $p = $this->getDi()->billingPlanTable->load($plan_id);
                    $pr = $p->getProduct();
                    try {
                        $invoice->add($pr, $qty);
                    } catch (Am_Exception_InputError $e) {
                        $form->setError($e->getMessage());
                        break 2;
                    }
                }
                $invoice->comment = $vars['comment'];
                $invoice->calculate();
                switch ($vars['_action']) {
                    case 'pending':
                        if (!$this->_addPendingInvoice($invoice, $form, $vars)) {
                            break 2;
                        }
                        break;
                    case 'pending-payment':
                        if (!$this->_addPendingInvoiceAndPayment($invoice, $form, $vars)) {
                            break 2;
                        }
                        break;
                    case 'pending-send':
                        if (!$this->_addPendingInvoiceAndSend($invoice, $form, $vars)) {
                            break 2;
                        }
                        break;
                    default:
                        throw new Am_Exception_InternalError(sprintf('Unknown action [%s] as %s::%s', $vars['_action'], __CLASS__, __METHOD__));
                }
                $this->getDi()->adminLogTable->log("Add Invoice (#{$invoice->invoice_id}/{$invoice->public_id}, Billing Terms: " . new Am_TermsText($invoice) . ")", 'invoice', $invoice->invoice_id);
                return $this->redirectLocation(REL_ROOT_URL . '/admin-user-payments/index/user_id/' . $this->user_id);
            }
            // if
        } while (false);
        $this->view->content = '<h1>' . ___('Add Invoice') . ' (<a href="' . REL_ROOT_URL . '/admin-user-payments/index/user_id/' . $this->user_id . '">' . ___('return') . '</a>)</h1>' . (string) $form;
        $this->view->display('admin/user-layout.phtml');
    }
開發者ID:alexanderTsig,項目名稱:arabic,代碼行數:91,代碼來源:AdminUserPaymentsController.php

示例14: getAffStats

 /**
  * Return commission stats
  * @param type $startTm
  * @param type $endTm 
  * @return array with keys: count and amount
  */
 function getAffStats($aff_id, $startTm, $endTm)
 {
     // return sales count of this affiliate for period
     return $this->_db->selectRow("\n            SELECT \n                COUNT(DISTINCT(invoice_id)) AS `count`, \n                SUM((SELECT COUNT(*) FROM ?_invoice_item WHERE \n                    invoice_id=inv.invoice_id AND (first_total>0 OR second_total>0)))\n                    AS `items_count`,\n                SUM(p.amount) as `amount`\n            FROM ?_invoice inv\n                INNER JOIN ?_user u USING (user_id)\n                LEFT JOIN ?_invoice_payment p USING (invoice_id)\n            WHERE u.aff_id=?d \n                AND inv.tm_started BETWEEN ? AND ?\n        ", $aff_id, sqlTime($startTm), sqlTime($endTm . ' 23:59:59'));
 }
開發者ID:irovast,項目名稱:eyedock,代碼行數:11,代碼來源:AffCommission.php

示例15: setCancelled

 public function setCancelled($cancelled = true)
 {
     $this->updateQuick(array('tm_cancelled' => $cancelled ? sqlTime('now') : null, 'rebill_date' => null));
     if (!$cancelled) {
         $this->updateRebillDate();
     }
     $this->updateStatus();
     return $this;
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:9,代碼來源:Invoice.php


注:本文中的sqlTime函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。