本文整理汇总了PHP中saveToLog函数的典型用法代码示例。如果您正苦于以下问题:PHP saveToLog函数的具体用法?PHP saveToLog怎么用?PHP saveToLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了saveToLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkTransaction
function checkTransaction($params, $order, $act)
{
$order->order_total = $this->fixOrderTotal($order);
if ($params['user_id'] != $_POST['user_id']) {
return array(0, 'Error user_id. Order ID ' . $order->order_id);
}
if ($order->order_total != $_POST['amount']) {
return array(0, 'Error amount. Order ID ' . $order->order_id);
}
if ($order->currency_code_iso != $_POST['currency_id']) {
return array(0, 'Error currency_id. Order ID ' . $order->order_id);
}
if ($params['notify_password']) {
$params['project_password'] = $params['notify_password'];
}
$data = array('transaction' => $_POST['transaction'], 'user_id' => $_POST['user_id'], 'project_id' => $_POST['project_id'], 'sender_holder' => $_POST['sender_holder'], 'sender_account_number' => $_POST['sender_account_number'], 'sender_bank_code' => $_POST['sender_bank_code'], 'sender_bank_name' => $_POST['sender_bank_name'], 'sender_bank_bic' => $_POST['sender_bank_bic'], 'sender_iban' => $_POST['sender_iban'], 'sender_country_id' => $_POST['sender_country_id'], 'recipient_holder' => $_POST['recipient_holder'], 'recipient_account_number' => $_POST['recipient_account_number'], 'recipient_bank_code' => $_POST['recipient_bank_code'], 'recipient_bank_name' => $_POST['recipient_bank_name'], 'recipient_bank_bic' => $_POST['recipient_bank_bic'], 'recipient_iban' => $_POST['recipient_iban'], 'recipient_country_id' => $_POST['recipient_country_id'], 'international_transaction' => $_POST['international_transaction'], 'amount' => $_POST['amount'], 'currency_id' => $_POST['currency_id'], 'reason_1' => $_POST['reason_1'], 'reason_2' => $_POST['reason_2'], 'security_criteria' => $_POST['security_criteria'], 'user_variable_0' => $_POST['user_variable_0'], 'user_variable_1' => $_POST['user_variable_1'], 'user_variable_2' => $_POST['user_variable_2'], 'user_variable_3' => $_POST['user_variable_3'], 'user_variable_4' => $_POST['user_variable_4'], 'user_variable_5' => $_POST['user_variable_5'], 'created' => $_POST['created'], 'project_password' => $params['project_password']);
$data_implode = implode('|', $data);
$hash = sha1($data_implode);
$return = 0;
if ($_POST['security_criteria']) {
if ($_POST['hash'] == $hash) {
$return = 1;
} else {
saveToLog("paymentdata.log", "Error hash. " . $hash);
}
}
return array($return, "");
}
示例2: checkTransaction
function checkTransaction($pmconfigs, $order, $act)
{
$jshopConfig =& JSFactory::getConfig();
if ($order->order_total != $_POST['amount']) {
return array(0, 'Error amount. Order ID ' . $order->order_id);
}
if (strtolower($pmconfigs['email_received']) != strtolower($_POST['pay_to_email'])) {
return array(0, 'Error pay_to_email. Order ID ' . $order->order_id);
}
if ($order->currency_code_iso != $_POST['currency']) {
return array(0, 'Error currency. Order ID ' . $order->order_id);
}
$status = trim(stripslashes($_POST['status']));
$merchant_id = $pmconfigs['merchant_id'];
$transaction_id = trim(stripslashes($_POST['transaction_id']));
$mb_amount = trim(stripslashes($_POST['mb_amount']));
$mb_currency = trim(stripslashes($_POST['mb_currency']));
$secretword = $pmconfigs['secretword'];
if ($secretword == "") {
$string = $merchant_id . $transaction_id . $mb_amount . $mb_currency . $status;
} else {
$string = $merchant_id . $transaction_id . strtoupper(md5($secretword)) . $mb_amount . $mb_currency . $status;
}
$check_md5 = strtoupper(md5($string));
if ($check_md5 != $_POST['md5sig']) {
return array(0, 'Error md5sig ' . $_POST['md5sig'] . '. Order ID ' . $order->order_id);
}
if ($status == 2) {
return array(1, '');
} elseif ($status == 0) {
saveToLog("payment.log", "Status pending. Order ID " . $order->order_id . ".");
return array(2, "Status pending");
} elseif ($status == -1) {
saveToLog("payment.log", "Status cancelled. Order ID " . $order->order_id . ".");
return array(3, "Status cancelled");
} elseif ($status == -2) {
saveToLog("payment.log", "Status failed. Order ID " . $order->order_id . ".");
return array(3, "Status failed");
} elseif ($status == -3) {
saveToLog("payment.log", "Status Chargeback. Order ID " . $order->order_id . ".");
return array(3, "Status Chargeback");
} else {
saveToLog("payment.log", "Status " . $status . ". Order ID " . $order->order_id . ".");
return array(0, "Status " . $status);
}
}
示例3: checkTransaction
function checkTransaction($pmconfigs, $order, $act)
{
$jshopConfig =& JSFactory::getConfig();
$item_name = sprintf(_JSHOP_PAYMENT_NUMBER, $order->order_number);
$pymentparamsdata = $order->getPaymentParamsData();
$lang =& JSFactory::getLang();
$field_country_name = $lang->get("name");
$_country =& JTable::getInstance('country', 'jshop');
$_country->load($order->country);
$country = $_country->{$field_country_name};
if ($pmconfigs['testserver']) {
$post_url = "https://test.authorize.net/gateway/transact.dll";
} else {
$post_url = "https://secure.authorize.net/gateway/transact.dll";
}
$post_values = array("x_login" => $pmconfigs['login'], "x_tran_key" => $pmconfigs['tran_key'], "x_version" => "3.1", "x_delim_data" => "TRUE", "x_delim_char" => "|", "x_relay_response" => "FALSE", "x_type" => "AUTH_CAPTURE", "x_method" => "CC", "x_card_num" => $pymentparamsdata['card_number'], "x_exp_date" => $pymentparamsdata['month'] . $pymentparamsdata['year'], "x_amount" => $order->order_total, "x_description" => $item_name, "x_first_name" => $order->f_name, "x_last_name" => $order->l_name, "x_address" => $order->street, "x_state" => $order->state, "x_zip" => $order->zip, "x_city" => $order->city, "x_country" => $country, "x_invoice_num" => $order->order_number);
if ($pmconfigs['testmode']) {
$post_values['x_test_request'] = "TRUE";
}
$post_string = "";
foreach ($post_values as $key => $value) {
$post_string .= "{$key}=" . urlencode($value) . "&";
}
$post_string = rtrim($post_string, "& ");
$request = curl_init($post_url);
curl_setopt($request, CURLOPT_HEADER, 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
$post_response = curl_exec($request);
curl_close($request);
if ($jshopConfig->savelog && $jshopConfig->savelogpaymentdata) {
saveToLog("paymentdata.log", $post_response);
}
$response_array = explode($post_values["x_delim_char"], $post_response);
if ($response_array[0] == 1) {
return array(1, '');
} else {
saveToLog("payment.log", "Error. Order ID " . $order->order_id . ". " . $response_array[3]);
return array(3, $response_array[3]);
}
}
示例4: checkTransaction
function checkTransaction($pmconfigs, $order, $act)
{
$lang = JFactory::getLanguage();
require_once dirname(dirname(__DIR__)) . '/lang/' . __CLASS__ . '/' . $lang->getTag() . '.php';
$jshopConfig = JSFactory::getConfig();
if ($this->payment_status > 0 && $this->err === false) {
$status = constant('_JSHOP_PAGSEGURO_STATUS_' . $this->payment_status);
$num = _JSHOP_ORDER_NUMBER . ': ' . $order->order_id;
if ($this->payment_status == 3 || $this->payment_status == 4) {
return array(1, $status, $transaction, $transactiondata);
} elseif ($this->payment_status < 3) {
saveToLog("payment.log", "Status pending. ({$num}, Reason: {$status})");
return array(2, "{$status} ({$num})", $transaction, $transactiondata);
} else {
return array(3, "{$status} ({$num})", $transaction, $transactiondata);
}
} else {
return array(0, "Error: {$err}", $transaction, $transactiondata);
}
}
示例5: resize
function resize()
{
$mainframe =& JFactory::getApplication();
$jshopConfig =& JSFactory::getConfig();
require_once $jshopConfig->path . 'lib/image.lib.php';
JPluginHelper::importPlugin('jshoppingadmin');
$dispatcher =& JDispatcher::getInstance();
$filelist = glob($jshopConfig->image_product_path . '/' . 'full_*');
foreach ($filelist as $key => $value) {
$url = $value;
$url_parts = pathinfo($url);
//filenames
$name_full = $url_parts['basename'];
$name_image = substr($url_parts['basename'], 5);
$name_thumb = "thumb_" . $name_image;
//file path
$path_image = $jshopConfig->image_product_path . '/' . $name_image;
$path_thumb = $jshopConfig->image_product_path . '/' . $name_thumb;
$path_full = $jshopConfig->image_product_path . '/' . $name_full;
//resize thumb
$product_width_image = $jshopConfig->image_product_width;
$product_height_image = $jshopConfig->image_product_height;
if (!ImageLib::resizeImageMagic($path_full, $product_width_image, $product_height_image, $jshopConfig->image_cut, $jshopConfig->image_fill, $path_thumb, $jshopConfig->image_quality, $jshopConfig->image_fill_color)) {
JError::raiseWarning("", _JSHOP_ERROR_CREATE_THUMBAIL . " " . $name_thumb);
saveToLog("error.log", "Resize Product Image - Error create thumbail " . $name_thumb);
$error = 1;
}
//resize image
$product_full_width_image = $jshopConfig->image_product_full_width;
$product_full_height_image = $jshopConfig->image_product_full_height;
if (!ImageLib::resizeImageMagic($path_full, $product_full_width_image, $product_full_height_image, $jshopConfig->image_cut, $jshopConfig->image_fill, $path_image, $jshopConfig->image_quality, $jshopConfig->image_fill_color)) {
JError::raiseWarning("", _JSHOP_ERROR_CREATE_THUMBAIL . " " . $name_image);
saveToLog("error.log", "Resize Product Image - Error create image " . $name_image);
$error = 1;
}
$dispatcher->trigger('onAfterSaveProductImage', array($product_id, $name_image));
}
if (!JRequest::getInt("noredirect")) {
$mainframe->redirect("index.php?option=com_jshopping&controller=resize&task=view", _JSHOP_COMPLETED);
}
}
示例6: doRegAdv
public function doRegAdv($adv_user, $user, $return_to_task = 'step2')
{
$session = JFactory::getSession();
//сохраняем указанный метод оплаты в сессию
$payment_method = JRequest::getVar('payment_method', '');
//class payment method
if ($payment_method != '') {
$session->set("payment_method", $payment_method);
}
$order_add_info = JRequest::getVar('order_add_info', '');
if ($order_add_info != '') {
$session->set("order_add_info", $order_add_info);
}
//проверяем, есть ли такой мейл в базе и редиректим на логин если нужно
if ($this->checkThisEmail($adv_user->email) == false) {
$this->checkUserLogin($return_to_task);
}
require_once JPATH_ROOT . "/components/com_jshopping/lib/functions.php";
//echo'<pre>';print_r($_POST);echo'</pre>';die;
$mainframe = JFactory::getApplication();
$jshopConfig = JSFactory::getConfig();
$config = JFactory::getConfig();
$db = JFactory::getDBO();
$params = JComponentHelper::getParams('com_users');
$lang = JFactory::getLanguage();
$lang->load('com_users');
//$post = JRequest::get('post');
// if ($user->guest) {
// $redirecturl = base64_encode("index.php?option=com_hostorder");
// $joomlaLoginUrl = 'index.php?option=com_user&view=login&return=';
// $finalUrl = $joomlaLoginUrl.$redirecturl;
//
// global $mainframe;
// $mainframe->redirect($finalUrl);
//echo'<pre>';print_r($adv_user);echo'</pre>';die;
$usergroup = JSFactory::getTable('usergroup', 'jshop');
$default_usergroup = $usergroup->getDefaultUsergroup();
$post = array();
$post['email'] = $adv_user->email;
$post['phone'] = $adv_user->phone;
$post['username'] = $post['email'];
$post['f_name'] = $adv_user->f_name;
$post['l_name'] = $adv_user->l_name;
$post['u_name'] = $adv_user->email;
$post['country'] = JRequest::getVar('country', 20);
$post['lang'] = $jshopConfig->getLang();
$post["password"] = substr(md5('up' . time()), 0, 8);
$row = JSFactory::getTable('userShop', 'jshop');
$row->bind($post);
$row->user_id = 0;
$row->usergroup_id = $default_usergroup;
$row->password = $post['password'];
$row->password2 = $post['password'];
//echo'<pre>';print_r($row);echo'</pre>';die;
$row->check("register");
$adv_user->bind($post);
$user = new JUser();
$data = array();
$data['groups'][] = $params->get('new_usertype', 2);
$data['email'] = $post['email'];
$data['password'] = $post['password'];
$data['password2'] = $post['password'];
$data['name'] = $post['f_name'] . ' ' . $post['l_name'];
$data['username'] = $post["u_name"];
$useractivation = $params->get('useractivation');
$sendpassword = $params->get('sendpassword', 1);
$user->bind($data);
if (!$user->save()) {
JError::raiseWarning('', $user->getError());
saveToLog('error.log', 'Error registration-' . $user->getError());
$mainframe->redirect(SEFLink("index.php?option=com_jshopping&controller=user&task=register", 1, 1, $jshopConfig->use_ssl));
return 0;
}
$row->user_id = $user->id;
$row->number = $row->getNewUserNumber();
unset($row->password);
unset($row->password2);
if (!$db->insertObject($row->getTableName(), $row, $row->getKeyName())) {
saveToLog('error.log', $db->getErrorMsg());
JError::raiseWarning('', "Error insert in table " . $row->getTableName());
$mainframe->redirect(SEFLink("index.php?option=com_jshopping&controller=user&task=register", 1, 1, $jshopConfig->use_ssl));
return 0;
}
//echo'<pre>';print_r($adv_user);echo'</pre>';die;
$adv_user->store();
//echo'<pre>';print_r($adv_user);echo'</pre>';die;
$session = JFactory::getSession();
$session->set("order_user_id", $user->id);
$data = $user->getProperties();
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$data['siteurl'] = JUri::base();
$emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
if ($sendpassword) {
$emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_BODY', $data['name'], $data['sitename'], $data['siteurl'], $data['username'], $data['password_clear']);
} else {
$emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_BODY_NOPW', $data['name'], $data['sitename'], $data['siteurl']);
}
$mailer = JFactory::getMailer();
//.........这里部分代码省略.........
示例7: uploadImage
function uploadImage($post)
{
$jshopConfig = JSFactory::getConfig();
$dispatcher = JDispatcher::getInstance();
$upload = new UploadFile($_FILES['category_image']);
$upload->setAllowFile(array('jpeg', 'jpg', 'gif', 'png'));
$upload->setDir($jshopConfig->image_category_path);
$upload->setFileNameMd5(0);
$upload->setFilterName(1);
if ($upload->upload()) {
$name = $upload->getName();
if ($post['old_image'] && $name != $post['old_image']) {
@unlink($jshopConfig->image_category_path . "/" . $post['old_image']);
}
@chmod($jshopConfig->image_category_path . "/" . $name, 0777);
if ($post['size_im_category'] < 3) {
if ($post['size_im_category'] == 1) {
$category_width_image = $jshopConfig->image_category_width;
$category_height_image = $jshopConfig->image_category_height;
} else {
$category_width_image = JRequest::getInt('category_width_image');
$category_height_image = JRequest::getInt('category_height_image');
}
$path_full = $jshopConfig->image_category_path . "/" . $name;
$path_thumb = $jshopConfig->image_category_path . "/" . $name;
if ($category_width_image || $category_height_image) {
if (!ImageLib::resizeImageMagic($path_full, $category_width_image, $category_height_image, $jshopConfig->image_cut, $jshopConfig->image_fill, $path_thumb, $jshopConfig->image_quality, $jshopConfig->image_fill_color)) {
JError::raiseWarning("", _JSHOP_ERROR_CREATE_THUMBAIL);
saveToLog("error.log", "SaveCategory - Error create thumbail");
}
}
@chmod($jshopConfig->image_category_path . "/" . $name, 0777);
}
$category_image = $name;
$dispatcher->trigger('onAfterSaveCategoryImage', array(&$post, &$category_image, &$path_full, &$path_thumb));
} else {
$category_image = '';
if ($upload->getError() != 4) {
JError::raiseWarning("", _JSHOP_ERROR_UPLOADING_IMAGE);
saveToLog("error.log", "SaveCategory - Error upload image. code: " . $upload->getError());
}
}
return $category_image;
}
示例8: registersave
function registersave()
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$mainframe = JFactory::getApplication();
$jshopConfig = JSFactory::getConfig();
$config = JFactory::getConfig();
$db = JFactory::getDBO();
$params = JComponentHelper::getParams('com_users');
$lang = JFactory::getLanguage();
$lang->load('com_users');
$post = JRequest::get('post');
$dispatcher = JDispatcher::getInstance();
if ($params->get('allowUserRegistration') == 0) {
JError::raiseError(403, JText::_('Access Forbidden'));
return;
}
$usergroup = JSFactory::getTable('usergroup', 'jshop');
$default_usergroup = $usergroup->getDefaultUsergroup();
$post['username'] = $post['u_name'];
$post['password2'] = $post['password_2'];
if ($post['f_name'] == "") {
$post['f_name'] = $post['email'];
}
$post['name'] = $post['f_name'] . ' ' . $post['l_name'];
if ($post['birthday']) {
$post['birthday'] = getJsDateDB($post['birthday'], $jshopConfig->field_birthday_format);
}
$post['lang'] = $jshopConfig->getLang();
$dispatcher->trigger('onBeforeRegister', array(&$post, &$default_usergroup));
$row = JSFactory::getTable('userShop', 'jshop');
$row->bind($post);
$row->usergroup_id = $default_usergroup;
$row->password = $post['password'];
$row->password2 = $post['password2'];
if (!$row->check("register")) {
$session = JFactory::getSession();
$registrationdata = JRequest::get('post');
$session->set('registrationdata', $registrationdata);
JError::raiseWarning('', $row->getError());
$this->setRedirect(SEFLink("index.php?option=com_jshopping&controller=user&task=register&lrd=1", 1, 1, $jshopConfig->use_ssl));
return 0;
}
if ($post["u_name"] == "") {
$post["u_name"] = $post['email'];
$row->u_name = $post["u_name"];
}
if ($post["password"] == "") {
$post["password"] = substr(md5('up' . time()), 0, 8);
}
$user = new JUser();
$data = array();
$data['groups'][] = $params->get('new_usertype', 2);
$data['email'] = $post['email'];
$data['password'] = $post['password'];
$data['password2'] = $post['password2'];
$data['name'] = $post['f_name'] . ' ' . $post['l_name'];
$data['username'] = $post["u_name"];
$useractivation = $params->get('useractivation');
$sendpassword = $params->get('sendpassword', 1);
if ($useractivation == 1 || $useractivation == 2) {
jimport('joomla.user.helper');
$data['activation'] = JApplication::getHash(JUserHelper::genRandomPassword());
$data['block'] = 1;
}
$user->bind($data);
if (!$user->save()) {
JError::raiseWarning('', $user->getError());
saveToLog('error.log', 'Error registration-' . $user->getError());
$this->setRedirect(SEFLink("index.php?option=com_jshopping&controller=user&task=register", 1, 1, $jshopConfig->use_ssl));
return 0;
}
$row->user_id = $user->id;
$row->number = $row->getNewUserNumber();
unset($row->password);
unset($row->password2);
if (!$db->insertObject($row->getTableName(), $row, $row->getKeyName())) {
saveToLog('error.log', $db->getErrorMsg());
JError::raiseWarning('', "Error insert in table " . $row->getTableName());
$this->setRedirect(SEFLink("index.php?option=com_jshopping&controller=user&task=register", 1, 1, $jshopConfig->use_ssl));
return 0;
}
$data = $user->getProperties();
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$data['siteurl'] = JUri::base();
if ($useractivation == 2) {
$uri = JURI::getInstance();
$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
$data['activate'] = $base . JRoute::_('index.php?option=com_jshopping&controller=user&task=activate&token=' . $data['activation'], false);
$emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
if ($sendpassword) {
$emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_jshopping&controller=user&task=activate&token=' . $data['activation'], $data['siteurl'], $data['username'], $data['password_clear']);
} else {
$emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY_NOPW', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_jshopping&controller=user&task=activate&token=' . $data['activation'], $data['siteurl'], $data['username']);
}
} else {
if ($useractivation == 1) {
$uri = JURI::getInstance();
$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
//.........这里部分代码省略.........
示例9: get_search_results
function get_search_results($query, $start, $category, $searchtype, $results, $domain)
{
global $sph_messages, $results_per_page, $links_to_next, $show_query_scores, $mysql_table_prefix, $desc_length;
if ($results != "") {
$results_per_page = $results;
}
if ($searchtype == "phrase") {
$query = str_replace('"', '', $query);
$query = "\"" . $query . "\"";
}
$starttime = getmicrotime();
// catch " if only one time entered
if (substr_count($query, '"') == 1) {
$query = str_replace('"', '', $query);
}
$words = makeboollist($query);
$ignorewords = $words['ignore'];
$full_result['ignore_words'] = $words['ignore'];
if ($start == 0) {
$start = 1;
}
$result = search($words, $category, $start, $results_per_page, $searchtype, $domain);
$query = stripslashes($query);
$entitiesQuery = htmlspecialchars($query);
$full_result['ent_query'] = $entitiesQuery;
$endtime = getmicrotime() - $starttime;
$rows = $result['results'];
$time = round($endtime * 100) / 100;
$full_result['time'] = $time;
$did_you_mean = "";
if (isset($result['did_you_mean'])) {
$did_you_mean_b = $entitiesQuery;
$did_you_mean = $entitiesQuery;
while (list($key, $val) = each($result['did_you_mean'])) {
if ($key != $val) {
$did_you_mean_b = str_replace($key, "<b>{$val}</b>", $did_you_mean_b);
$did_you_mean = str_replace($key, "{$val}", $did_you_mean);
}
}
}
$full_result['did_you_mean'] = $did_you_mean;
$full_result['did_you_mean_b'] = $did_you_mean_b;
$matchword = $sph_messages["matches"];
if ($rows == 1) {
$matchword = $sph_messages["match"];
}
$num_of_results = count($result) - 2;
$full_result['num_of_results'] = $num_of_results;
if ($start < 2) {
saveToLog(addslashes($query), $time, $rows);
}
$from = ($start - 1) * $results_per_page + 1;
$to = min($start * $results_per_page, $rows);
$full_result['from'] = $from;
$full_result['to'] = $to;
$full_result['total_results'] = $rows;
if ($rows > 0) {
$maxweight = $result['maxweight'];
$i = 0;
while ($i < $num_of_results && $i < $results_per_page) {
$title = $result[$i]['title'];
$url = $result[$i]['url'];
$fulltxt = $result[$i]['fulltxt'];
$page_size = $result[$i]['size'];
$domain = $result[$i]['domain'];
if ($page_size != "") {
$page_size = number_format($page_size, 1) . "kb";
}
$txtlen = strlen($fulltxt);
if ($txtlen > $desc_length) {
$places = array();
foreach ($words['hilight'] as $word) {
$tmp = strtolower($fulltxt);
$found_in = strpos($tmp, $word);
$sum = -strlen($word);
while (!($found_in == '')) {
$pos = $found_in + strlen($word);
$sum += $pos;
//FIX!!
$tmp = substr($tmp, $pos);
$places[] = $sum;
$found_in = strpos($tmp, $word);
}
}
sort($places);
$x = 0;
$begin = 0;
$end = 0;
while (list($id, $place) = each($places)) {
while ($places[$id + $x] - $place < $desc_length && $x + $id < count($places) && $place < strlen($fulltxt) - $desc_length) {
$x++;
$begin = $id;
$end = $id + $x;
}
}
$begin_pos = max(0, $places[$begin] - 30);
$fulltxt = substr($fulltxt, $begin_pos, $desc_length);
if ($places[$begin] > 0) {
$begin_pos = strpos($fulltxt, " ");
}
//.........这里部分代码省略.........
示例10: checkTransaction
function checkTransaction($pmconfigs, $order, $act)
{
$jshopConfig = JSFactory::getConfig();
if ($pmconfigs['testmode']) {
$host = "www.sandbox.paypal.com";
} else {
$host = "www.paypal.com";
}
$hostname = $host;
if ($pmconfigs['use_ssl']) {
$host = "ssl://" . $host;
}
$order->order_total = $this->fixOrderTotal($order);
$email_received = $_POST['business'];
if ($email_received == "") {
$email_received = $_POST['receiver_email'];
}
if ($order->order_total != $_POST['mc_gross']) {
return array(0, 'Error mc_gross. Order ID ' . $order->order_id);
}
if (strtolower($pmconfigs['email_received']) != strtolower($email_received)) {
return array(0, 'Error email received. Order ID ' . $order->order_id);
}
if ($order->currency_code_iso != $_POST['mc_currency']) {
return array(0, 'Error currency. Order ID ' . $order->order_id);
}
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&{$key}={$value}";
}
$payment_status = trim(stripslashes($_POST['payment_status']));
$header = '';
$header .= "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Host: " . $hostname . "\r\n";
$header .= "Connection: close\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$debug = "";
$port = 80;
if ($pmconfigs['use_ssl']) {
$port = 443;
}
$fp = fsockopen($host, $port, $errno, $errstr, 30);
if (!$fp) {
return array(0, 'Http error. Order number ' . $order->order_id);
} else {
@fputs($fp, $header . $req);
while (!@feof($fp)) {
$res = @fgets($fp, 1024);
$res = trim($res);
$debug .= $res . "\n";
if (strcmp($res, "VERIFIED") == 0) {
if ($payment_status == 'Completed') {
return array(1, '');
} elseif ($payment_status == 'Pending') {
saveToLog("payment.log", "Status pending. Order ID " . $order->order_id . ". Reason: " . $_POST['pending_reason']);
return array(2, trim(stripslashes($_POST['pending_reason'])));
} elseif ($payment_status == 'Failed') {
return array(3, 'Status Failed. Order ID ' . $order->order_id);
} elseif ($payment_status == 'Refunded') {
return array(3, "Status Refunded. Order ID " . $order->order_id);
} else {
return array(0, "Order number " . $order->order_id . "\nPaypal error\nPayment status - {$payment_status}.");
}
} else {
if (strcmp($res, "INVALID") == 0) {
return array(0, 'Invalid response. Order ID ' . $order->order_id);
}
}
}
fclose($fp);
if ($jshopConfig->savelog && $jshopConfig->savelogpaymentdata) {
saveToLog("paymentdata.log", $debug);
}
return array(0, "Error response. Order ID " . $order->order_id);
}
}
示例11: saveToLogPaymentData
public function saveToLogPaymentData()
{
$str = "url: " . $_SERVER['REQUEST_URI'] . "\n";
foreach ($_POST as $k => $v) {
$str .= $k . "=" . $v . "\n";
}
saveToLog("paymentdata.log", $str);
}
示例12: step7
function step7()
{
$checkout = JSFactory::getModel('checkout', 'jshop');
$wmiframe = JRequest::getInt("wmiframe");
$mainframe = JFactory::getApplication();
$jshopConfig = JSFactory::getConfig();
$session = JFactory::getSession();
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onLoadStep7', array());
$pm_method = JSFactory::getTable('paymentMethod', 'jshop');
$str = "url: " . $_SERVER['REQUEST_URI'] . "\n";
foreach ($_POST as $k => $v) {
$str .= $k . "=" . $v . "\n";
}
saveToLog("paymentdata.log", $str);
$act = JRequest::getVar("act");
$payment_method = JRequest::getVar("js_paymentclass");
$pm_method->loadFromClass($payment_method);
$paymentsysdata = $pm_method->getPaymentSystemData();
$payment_system = $paymentsysdata->paymentSystem;
if ($paymentsysdata->paymentSystemVerySimple) {
if (JRequest::getInt('no_lang')) {
JSFactory::loadLanguageFile();
}
saveToLog("payment.log", "#001 - Error payment method file. PM " . $payment_method);
JError::raiseWarning(500, _JSHOP_ERROR_PAYMENT);
return 0;
}
if ($paymentsysdata->paymentSystemError) {
if (JRequest::getInt('no_lang')) {
JSFactory::loadLanguageFile();
}
saveToLog("payment.log", "#002 - Error payment. CLASS " . $payment_method);
JError::raiseWarning(500, _JSHOP_ERROR_PAYMENT);
return 0;
}
$pmconfigs = $pm_method->getConfigs();
$urlParamsPS = $payment_system->getUrlParams($pmconfigs);
$order_id = $urlParamsPS['order_id'];
$hash = $urlParamsPS['hash'];
$checkHash = $urlParamsPS['checkHash'];
$checkReturnParams = $urlParamsPS['checkReturnParams'];
$session->set('jshop_send_end_form', 0);
if ($act == "cancel") {
$this->cancelPayOrder($order_id);
return 0;
}
if ($act == "return" && !$checkReturnParams) {
$checkout->setMaxStep(10);
if (!$wmiframe) {
$this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=finish', 0, 1, $jshopConfig->use_ssl));
} else {
$this->iframeRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=finish', 0, 1, $jshopConfig->use_ssl));
}
return 1;
}
$order = JSFactory::getTable('order', 'jshop');
$order->load($order_id);
if (JRequest::getInt('no_lang')) {
JSFactory::loadLanguageFile($order->getLang());
$lang = JSFactory::getLang($order->getLang());
}
if ($checkHash && $order->order_hash != $hash) {
saveToLog("payment.log", "#003 - Error order hash. Order id " . $order_id);
JError::raiseWarning("", _JSHOP_ERROR_ORDER_HASH);
return 0;
}
if (!$order->payment_method_id) {
saveToLog("payment.log", "#004 - Error payment method id. Order id " . $order_id);
JError::raiseWarning("", _JSHOP_ERROR_PAYMENT);
return 0;
}
if ($order->payment_method_id != $pm_method->payment_id) {
saveToLog("payment.log", "#005 - Error payment method set url. Order id " . $order_id);
JError::raiseWarning("", _JSHOP_ERROR_PAYMENT);
return 0;
}
$res = $payment_system->checkTransaction($pmconfigs, $order, $act);
$rescode = $res[0];
$restext = $res[1];
$transaction = $res[2];
$transactiondata = $res[3];
$status = $payment_system->getStatusFromResCode($rescode, $pmconfigs);
$order->transaction = $transaction;
$order->store();
$order->saveTransactionData($rescode, $status, $transactiondata);
if ($restext != '') {
saveToLog("payment.log", $restext);
}
if ($status && !$order->order_created) {
$order->order_created = 1;
$order->order_status = $status;
$dispatcher->trigger('onStep7OrderCreated', array(&$order, &$res, &$checkout, &$pmconfigs));
$order->store();
if ($jshopConfig->send_order_email) {
$checkout->sendOrderEmail($order->order_id);
}
if ($jshopConfig->order_stock_removed_only_paid_status) {
$product_stock_removed = in_array($status, $jshopConfig->payment_status_enable_download_sale_file);
} else {
//.........这里部分代码省略.........
示例13: showEndForm
function showEndForm($pmconfigs, $order)
{
$mainframe =& JFactory::getApplication();
$jshopConfig =& JSFactory::getConfig();
$item_name = sprintf(_JSHOP_PAYMENT_NUMBER, $order->order_number);
$notify_url = JURI::root() . "index.php?option=com_jshopping&controller=checkout&task=step7&act=notify&js_paymentclass=pm_ideal&no_lang=1";
$return = JURI::root() . "index.php?option=com_jshopping&controller=checkout&task=step7&act=return&js_paymentclass=pm_ideal";
$cancel_return = JURI::root() . "index.php?option=com_jshopping&controller=checkout&task=step7&act=cancel&js_paymentclass=pm_ideal";
$params_data = $order->getPaymentParamsData();
$bank_id = $params_data['bank_id'];
$amount = intval($order->order_total * 100);
$iDEAL = new iDEAL_Payment($pmconfigs['partnerid']);
if ($pmconfigs['testmode']) {
$iDEAL->setTestMode();
}
if ($iDEAL->createPayment($bank_id, $amount, $item_name, $return, $notify_url)) {
$order1 =& JTable::getInstance('order', 'jshop');
$order1->load($order->order_id);
$order1->transaction = $iDEAL->getTransactionId();
$order1->store();
header("Location: " . $iDEAL->getBankURL());
exit;
} else {
saveToLog("payment.log", "Error: Order ID " . $order->order_id . ". CODE: " . $iDEAL->getErrorCode() . ". MSG: " . $iDEAL->getErrorMessage());
JError::raiseWarning("", $iDEAL->getErrorMessage());
$mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step5', 0, 1, $jshopConfig->use_ssl));
exit;
}
}
示例14: copyFiles
function copyFiles($startdir, $subdir = "")
{
if ($subdir != "" && !file_exists(JPATH_ROOT . $subdir)) {
@mkdir(JPATH_ROOT . $subdir, 0755);
}
$files = JFolder::files($startdir . $subdir, '', false, false, array(), array());
foreach ($files as $file) {
if ($subdir == "" && ($file == "update.sql" || $file == "update.php" || $file == "checkupdate.php")) {
continue;
}
if (@copy($startdir . $subdir . "/" . $file, JPATH_ROOT . $subdir . "/" . $file)) {
//JError::raiseWarning( 500, "Copy file: ".$subdir."/".$file." OK");
} else {
JError::raiseWarning("", "Copy file: " . $subdir . "/" . $file . " ERROR");
saveToLog("error.log", "Update - Copy file: " . $subdir . "/" . $file . " ERROR");
}
}
$folders = JFolder::folders($startdir . $subdir, '');
foreach ($folders as $folder) {
$dir = $subdir . "/" . $folder;
$this->copyFiles($startdir, $dir);
}
}
示例15: sendToLog
static function sendToLog($message)
{
saveToLog("payment.log", $message);
}