function _do($log) { global $form; // 라인개수 $lines = getvalue($form['lines'], $_SESSION['log_lines'], 30); if (!$lines) { $lines = 30; } $search = $form['search']; if ($search) { // 콤마가 포함되면 콤마로 나누어서 egrep 으로 처리 $items = preg_split("/,/", $search); $len = count($items); if ($len > 1) { $tmp = array(); foreach ($items as $k) { $tmp[] = trim($k); } $find = join("|", $tmp); $cmd = "egrep \"{$find}\" {$log} | tail -n {$lines}"; } else { $cmd = "grep {$search} {$log} | tail -n {$lines}"; } } else { $cmd = "tail -n {$lines} {$log}"; } $t1 = microtime(true); _exec($cmd, $output); //dd($output); $t2 = microtime(true); $diff = sprintf("%10.3f", $t2 - $t1); print <<<EOS <div class='title'> {$log} (elapsed {$diff}) </div> EOS; // reverse order if ($form['reod']) { $output = array_reverse($output); } // 최근 몇초까지의 로그만 출력함 $latest = getvalue($form['latest'], $_SESSION['log_latest'], 'unlimited'); _process($output, $mode, $latest); }
} } } /* bcc */ $emailBCC = $modx->getOption('emailBCC', $formit->config, ''); if (!empty($emailBCC)) { $emailBCCName = $modx->getOption('emailBCCName', $formit->config, ''); $emailBCC = explode(',', $emailBCC); $emailBCCName = explode(',', $emailBCCName); $numAddresses = count($emailBCC); for ($i = 0; $i < $numAddresses; $i++) { $etn = !empty($emailBCCName[$i]) ? $emailBCCName[$i] : ''; if (!empty($etn)) { $etn = _process($etn, $modx, $fields); } $emailBCC[$i] = _process($emailBCC[$i], $modx, $fields); if (!empty($emailBCC[$i])) { $modx->mail->address('bcc', $emailBCC[$i], $etn); } } } /* send email */ if (!$formit->inTestMode) { $sent = $modx->mail->send(); } else { $sent = true; } $modx->mail->reset(array(modMail::MAIL_CHARSET => $modx->getOption('mail_charset', null, 'UTF-8'), modMail::MAIL_ENCODING => $modx->getOption('mail_encoding', null, '8bit'))); if (!$sent) { $errors[] = $modx->lexicon('formit.email_not_sent') . ' ' . print_r($modx->mail->mailer->ErrorInfo, true); $modx->log(modX::LOG_LEVEL_ERROR, '[FormIt] ' . $modx->lexicon('formit.email_not_sent') . ' ' . print_r($modx->mail->mailer->ErrorInfo, true));
} function order_statuses() { global $db; $statuses = $db->Execute("select orders_status_id, orders_status_name\n from " . TABLE_ORDERS_STATUS . "\n where language_id = '" . (int) $_SESSION['languages_id'] . "'\n order by orders_status_id"); while (!$statuses->EOF) { $statuses_array[$statuses->fields['orders_status_id']] = array('id' => $statuses->fields['orders_status_id'], 'text' => $statuses->fields['orders_status_name'] . ' [' . $statuses->fields['orders_status_id'] . ']'); $statuses->MoveNext(); } return $statuses_array; } require DIR_WS_CLASSES . 'payment.php'; $checkoutapipayment_module = 'checkoutapipayment'; $payment_modules = new payment($checkoutapipayment_module); if (isset($_GET['chargeId'])) { $stringCharge = _process(); } else { $stringCharge = file_get_contents("php://input"); } if ($stringCharge) { $Api = CheckoutApi_Api::getApi(array('mode' => MODULE_PAYMENT_CHECKOUTAPIPAYMENT_TRANSACTION_SERVER)); $objectCharge = $Api->chargeToObj($stringCharge); $orderId = $objectCharge->getTrackId(); if ($orderId) { require DIR_WS_CLASSES . 'order.php'; $order = new order($orderId); $orderStatuses = order_statuses(); if ($order) { if ($objectCharge->getCaptured()) { if ($order->info['orders_status'] != 2) { echo "Order has #{$orderId} was set complete";
} function _onload() { setTimeout("_countdown()", 1000); var interval = parseInt(form.rftime.value); timer = interval; } if (window.addEventListener) { window.addEventListener("load", _onload, false); } else if (document.attachEvent) { window.attachEvent("onload", _onload); } </script> EOS; ## }} // ps -eo pid,ppid,user,etime,time,%cpu,%mem,state,cmd $cmd = "ps -eo pid,ppid,user,state,etime,time,%cpu,%mem,cmd | grep java"; _exec($cmd, $output); //print_r($output); _process($output); /* $str = join("\n", $output); print<<<EOS <pre> $str </pre> EOS; */ _health_graph(); pagetail(); exit;