function zaikorobot_add_post_log($post, $server) { // ログ機能が有効な場合のみ if (ZAIKOROBOT_LOG != "true") { return; } $sql_data_array = array("from_zaikorobot" => print_r($post, true) . "\n" . print_r($server, true), "to_zaikorobot" => "", "date_added" => "now()"); zen_db_perform(FILENAME_ZAIKOROBOT_LOGS, $sql_data_array); }
function zen_visitors_update_visitors_data($customers_id, $customers_email_address) { global $db; $customers_id = zen_db_prepare_input($customers_id); $customers_email_address = zen_db_prepare_input($customers_email_address); $check_email = $db->Execute("select customers_email_address\r\n from " . TABLE_CUSTOMERS . "\r\n where customers_email_address = '" . zen_db_input($customers_email_address) . "'\r\n and customers_id != '" . (int) $customers_id . "'"); if (!$check_email->RecordCount()) { $sql_data_array = array('visitors_email_address' => $customers_email_address, 'visitors_info_date_account_last_modified' => 'now()'); zen_db_perform(TABLE_VISITORS, $sql_data_array, 'update', "visitors_id = '" . (int) $customers_id . "'"); } }
function _set_breadcrumb_block($template, $css_selector) { global $db; $sql = "SELECT * FROM " . TABLE_BLOCKS . "\n WHERE module = 'super_products_list'\n AND block = 'block_breadcrumb'\n AND template = '" . $template . "'"; $check = $db->Execute($sql); if ($check->EOF) { $mode = 'insert'; } else { $mode = 'update'; $id = $check->fields['id']; } $sql_data_array = array('module' => 'super_products_list', 'block' => 'block_breadcrumb', 'template' => $template, 'location' => 'main', 'status' => 1, 'sort_order' => 0, 'visible' => 1, 'pages' => implode("\n", array('product_free_shipping_info', 'product_info', 'product_music_info', 'index_products', 'super_products_list#page_results')), 'css_selector' => $css_selector, 'insert_position' => 'replaceWith'); if ($mode == 'insert') { zen_db_perform(TABLE_BLOCKS, $sql_data_array); } else { zen_db_perform(TABLE_BLOCKS, $sql_data_array, 'update', "id = '" . (int) $id . "'"); } }
/** * Complete the step2 phase by creating accounts if needed, linking data, placing order, etc. */ function ec_step2_finish($paypal_ec_payer_info, $new_acct_notify) { global $db, $order; // register the payer_info in the session $_SESSION['paypal_ec_payer_info'] = $paypal_ec_payer_info; // debug $this->zcLog('ec_step2_finish - 1', 'START: paypal_ec_payer_info= ' . print_r($_SESSION['paypal_ec_payer_info'], true)); /** * Building customer zone/address from returned data */ // set some defaults, which will be updated later: $country_id = '223'; $address_format_id = 2; $state_id = 0; $acct_exists = false; // store default address id for later use/reference $original_default_address_id = $_SESSION['customer_default_address_id']; // Get the customer's country ID based on name or ISO code $sql = "SELECT countries_id, address_format_id, countries_iso_code_2, countries_iso_code_3\r\n FROM " . TABLE_COUNTRIES . "\r\n WHERE countries_iso_code_2 = :countryId\r\n OR countries_name = :countryId\r\n LIMIT 1"; $sql1 = $db->bindVars($sql, ':countryId', $paypal_ec_payer_info['ship_country_name'], 'string'); $country1 = $db->Execute($sql1); $sql2 = $db->bindVars($sql, ':countryId', $paypal_ec_payer_info['ship_country_code'], 'string'); $country2 = $db->Execute($sql2); // see if we found a record, if yes, then use it instead of default American format if ($country1->RecordCount() > 0) { $country_id = $country1->fields['countries_id']; if (!isset($paypal_ec_payer_info['ship_country_code']) || $paypal_ec_payer_info['ship_country_code'] == '') { $paypal_ec_payer_info['ship_country_code'] = $country1->fields['countries_iso_code_2']; } $country_code3 = $country1->fields['countries_iso_code_3']; $address_format_id = (int) $country1->fields['address_format_id']; } elseif ($country2->RecordCount() > 0) { // if didn't find it based on name, check using ISO code (ie: in case of no-shipping-address required/supplied) $country_id = $country2->fields['countries_id']; $country_code3 = $country2->fields['countries_iso_code_3']; $address_format_id = (int) $country2->fields['address_format_id']; } // Need to determine zone, based on zone name first, and then zone code if name fails check. Otherwise uses 0. $sql = "SELECT zone_id\r\n FROM " . TABLE_ZONES . "\r\n WHERE zone_country_id = :zCountry\r\n AND zone_code = :zoneCode\r\n OR zone_name = :zoneCode\r\n LIMIT 1"; $sql = $db->bindVars($sql, ':zCountry', $country_id, 'integer'); $sql = $db->bindVars($sql, ':zoneCode', $paypal_ec_payer_info['ship_state'], 'string'); $states = $db->Execute($sql); if ($states->RecordCount() > 0) { $state_id = $states->fields['zone_id']; } /** * Using the supplied data from PayPal, set the data into the order record */ // customer $order->customer['name'] = $paypal_ec_payer_info['payer_firstname'] . ' ' . $paypal_ec_payer_info['payer_lastname']; $order->customer['company'] = $paypal_ec_payer_info['payer_business']; $order->customer['street_address'] = $paypal_ec_payer_info['ship_street_1']; $order->customer['suburb'] = $paypal_ec_payer_info['ship_street_2']; $order->customer['city'] = $paypal_ec_payer_info['ship_city']; $order->customer['postcode'] = $paypal_ec_payer_info['ship_postal_code']; $order->customer['state'] = $paypal_ec_payer_info['ship_state']; $order->customer['country'] = array('id' => $country_id, 'title' => $paypal_ec_payer_info['ship_country_name'], 'iso_code_2' => $paypal_ec_payer_info['ship_country_code'], 'iso_code_3' => $country_code3); $order->customer['country']['id'] = $country_id; $order->customer['country']['iso_code_2'] = $paypal_ec_payer_info['ship_country_code']; $order->customer['format_id'] = $address_format_id; $order->customer['email_address'] = $paypal_ec_payer_info['payer_email']; $order->customer['telephone'] = $paypal_ec_payer_info['ship_phone']; $order->customer['zone_id'] = $state_id; // billing $order->billing['name'] = $paypal_ec_payer_info['payer_firstname'] . ' ' . $paypal_ec_payer_info['payer_lastname']; $order->billing['company'] = $paypal_ec_payer_info['payer_business']; $order->billing['street_address'] = $paypal_ec_payer_info['ship_street_1']; $order->billing['suburb'] = $paypal_ec_payer_info['ship_street_2']; $order->billing['city'] = $paypal_ec_payer_info['ship_city']; $order->billing['postcode'] = $paypal_ec_payer_info['ship_postal_code']; $order->billing['state'] = $paypal_ec_payer_info['ship_state']; $order->billing['country'] = array('id' => $country_id, 'title' => $paypal_ec_payer_info['ship_country_name'], 'iso_code_2' => $paypal_ec_payer_info['ship_country_code'], 'iso_code_3' => $country_code3); $order->billing['country']['id'] = $country_id; $order->billing['country']['iso_code_2'] = $paypal_ec_payer_info['ship_country_code']; $order->billing['format_id'] = $address_format_id; $order->billing['zone_id'] = $state_id; // delivery if ($_SESSION['paypal_ec_payer_info']['ship_address_status'] != 'None') { $order->delivery['name'] = $paypal_ec_payer_info['payer_firstname'] . ' ' . $paypal_ec_payer_info['payer_lastname']; $order->delivery['company'] = $paypal_ec_payer_info['payer_business']; $order->delivery['street_address'] = $paypal_ec_payer_info['ship_street_1']; $order->delivery['suburb'] = $paypal_ec_payer_info['ship_street_2']; $order->delivery['city'] = $paypal_ec_payer_info['ship_city']; $order->delivery['postcode'] = $paypal_ec_payer_info['ship_postal_code']; $order->delivery['state'] = $paypal_ec_payer_info['ship_state']; $order->delivery['country'] = array('id' => $country_id, 'title' => $paypal_ec_payer_info['ship_country_name'], 'iso_code_2' => $paypal_ec_payer_info['ship_country_code'], 'iso_code_3' => $country_code3); $order->delivery['country_id'] = $country_id; $order->delivery['format_id'] = $address_format_id; $order->delivery['zone_id'] = $state_id; } // debug $this->zcLog('ec_step2_finish - 2', 'country_id = ' . $country_id . ' ' . $paypal_ec_payer_info['ship_country_name'] . ' ' . $paypal_ec_payer_info['ship_country_code'] . "\naddress_format_id = " . $address_format_id . "\nstate_id = " . $state_id . ' (original state tested: ' . $paypal_ec_payer_info['ship_state'] . ')' . "\ncountry1->fields['countries_id'] = " . $country1->fields['countries_id'] . "\ncountry2->fields['countries_id'] = " . $country2->fields['countries_id'] . "\n" . '$order = ' . print_r($order, true)); // check to see whether PayPal should still be offered to this customer, based on the zone of their address: $this->update_status(); if (!$this->enabled) { $this->terminateEC(MODULE_PAYMENT_PAYPALWPP_TEXT_INVALID_ZONE_ERROR, true, FILENAME_SHOPPING_CART); } // see if the user is logged in if (!empty($_SESSION['customer_first_name']) && !empty($_SESSION['customer_id'])) { // They're logged in, so forward them straight to checkout stages, depending on address needs etc $order->customer['id'] = $_SESSION['customer_id']; // set the session value for express checkout temp $_SESSION['paypal_ec_temp'] = false; // if no address required for shipping, leave shipping portion alone if ($_SESSION['paypal_ec_payer_info']['ship_address_status'] != 'None' && $_SESSION['paypal_ec_payer_info']['ship_street_1'] != '') { // set the session info for the sendto $_SESSION['sendto'] = $_SESSION['customer_default_address_id']; // This is the address matching section // try to match it first // note: this is by no means 100% $address_book_id = $this->findMatchingAddressBookEntry($_SESSION['customer_id'], $order->delivery); // no match, so add the record if (!$address_book_id) { $address_book_id = $this->addAddressBookEntry($_SESSION['customer_id'], $order->delivery, false); } // set the address for use $_SESSION['sendto'] = $address_book_id; } // set the users billto information (default address) if (!isset($_SESSION['billto'])) { $_SESSION['billto'] = $_SESSION['customer_default_address_id']; } // debug $this->zcLog('ec_step2_finish - 3', 'Exiting ec_step2_finish logged-in mode.' . "\n" . 'Selected address: ' . $address_book_id . "\nOriginal was: " . $original_default_address_id); // select a shipping method, based on cheapest available option if (MODULE_PAYMENT_PAYPALWPP_AUTOSELECT_CHEAPEST_SHIPPING == 'Yes') { $this->setShippingMethod(); } // send the user on if ($_SESSION['paypal_ec_markflow'] == 1) { $this->terminateEC('', false, FILENAME_CHECKOUT_PROCESS); } else { $this->terminateEC('', false, FILENAME_CHECKOUT_CONFIRMATION); } } else { // They're not logged in. Create an account if necessary, and then log them in. // First, see if they're an existing customer, and log them in automatically // If Paypal didn't supply us an email address, something went wrong if (trim($paypal_ec_payer_info['payer_email']) == '') { $this->terminateEC(MODULE_PAYMENT_PAYPALWPP_INVALID_RESPONSE, true); } // attempt to obtain the user information using the payer_email from the info returned from PayPal, via email address $sql = "SELECT customers_id, customers_firstname, customers_lastname, customers_paypal_payerid, customers_paypal_ec\r\n FROM " . TABLE_CUSTOMERS . "\r\n WHERE customers_email_address = :emailAddress "; $sql = $db->bindVars($sql, ':emailAddress', $paypal_ec_payer_info['payer_email'], 'string'); $check_customer = $db->Execute($sql); // debug $this->zcLog('ec_step2_finish - 4', 'Not logged in. Looking for account.' . "\n" . $sql . "\n" . print_r($check_customer, true)); if (!$check_customer->EOF) { $acct_exists = true; // see if this was only a temp account -- if so, remove it if ($check_customer->fields['customers_paypal_ec'] == '1') { // Delete the existing temporary account $this->ec_delete_user($check_customer->fields['customers_id']); $acct_exists = false; // debug $this->zcLog('ec_step2_finish - 5', 'Found temporary account - deleting it.'); } } // Create an account, if the account does not exist if (!$acct_exists) { // debug $this->zcLog('ec_step2_finish - 6', 'No ZC account found for this customer. Creating new account.' . "\n" . '$this->new_acct_notify =' . $this->new_acct_notify); // Generate a random 8-char password $password = zen_create_random_value(8); $sql_data_array = array(); // set the customer information in the array for the table insertion $sql_data_array = array('customers_firstname' => $paypal_ec_payer_info['payer_firstname'], 'customers_lastname' => $paypal_ec_payer_info['payer_lastname'], 'customers_email_address' => $paypal_ec_payer_info['payer_email'], 'customers_telephone' => $paypal_ec_payer_info['ship_phone'], 'customers_fax' => '', 'customers_gender' => $paypal_ec_payer_info['payer_gender'], 'customers_newsletter' => '0', 'customers_password' => zen_encrypt_password($password), 'customers_paypal_payerid' => $_SESSION['paypal_ec_payer_id']); // insert the data $result = zen_db_perform(TABLE_CUSTOMERS, $sql_data_array); // grab the customer_id (last insert id) $customer_id = $db->Insert_ID(); // set the Guest customer ID -- for PWA purposes $_SESSION['customer_guest_id'] = $customer_id; // set the customer address information in the array for the table insertion $sql_data_array = array('customers_id' => $customer_id, 'entry_gender' => $paypal_ec_payer_info['payer_gender'], 'entry_firstname' => $paypal_ec_payer_info['payer_firstname'], 'entry_lastname' => $paypal_ec_payer_info['payer_lastname'], 'entry_street_address' => $paypal_ec_payer_info['ship_street_1'], 'entry_suburb' => $paypal_ec_payer_info['ship_street_2'], 'entry_city' => $paypal_ec_payer_info['ship_city'], 'entry_zone_id' => $state_id, 'entry_postcode' => $paypal_ec_payer_info['ship_postal_code'], 'entry_country_id' => $country_id); if ($state_id > 0) { $sql_data_array['entry_zone_id'] = $state_id; $sql_data_array['entry_state'] = ''; } else { $sql_data_array['entry_zone_id'] = 0; $sql_data_array['entry_state'] = $paypal_ec_payer_info['ship_state']; } // insert the data zen_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); // grab the address_id (last insert id) $address_id = $db->Insert_ID(); // set the address id lookup for the customer $sql = "UPDATE " . TABLE_CUSTOMERS . "\r\n SET customers_default_address_id = :addrID\r\n WHERE customers_id = :custID"; $sql = $db->bindVars($sql, ':addrID', $address_id, 'integer'); $sql = $db->bindVars($sql, ':custID', $customer_id, 'integer'); $db->Execute($sql); // insert the new customer_id into the customers info table for consistency $sql = "INSERT INTO " . TABLE_CUSTOMERS_INFO . "\r\n (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created)\r\n VALUES (:custID, 0, now())"; $sql = $db->bindVars($sql, ':custID', $customer_id, 'integer'); $db->Execute($sql); // send Welcome Email if appropriate if ($this->new_acct_notify == 'Yes') { // require the language file global $language_page_directory, $template_dir; if (!isset($language_page_directory)) { $language_page_directory = DIR_WS_LANGUAGES . $_SESSION['language'] . '/'; } if (file_exists($language_page_directory . $template_dir . '/create_account.php')) { $template_dir_select = $template_dir . '/'; } else { $template_dir_select = ''; } require $language_page_directory . $template_dir_select . '/create_account.php'; // set the mail text $email_text = sprintf(EMAIL_GREET_NONE, $paypal_ec_payer_info['payer_firstname']) . EMAIL_WELCOME . EMAIL_TEXT; $email_text .= "\n\n" . EMAIL_EC_ACCOUNT_INFORMATION . "\nUsername: "******"\nPassword: "******"\n\n"; $email_text .= EMAIL_CONTACT; // send the mail zen_mail($paypal_ec_payer_info['payer_firstname'] . " " . $paypal_ec_payer_info['payer_lastname'], $paypal_ec_payer_info['payer_email'], EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => nl2br($email_text)), 'welcome'); // set the express checkout temp -- false means the account is no longer "only" for EC ... it'll be permanent $_SESSION['paypal_ec_temp'] = false; } else { // Make it a temporary account that'll be deleted once they've checked out $sql = "UPDATE " . TABLE_CUSTOMERS . "\r\n SET customers_paypal_ec = 1\r\n WHERE customers_id = :custID "; $sql = $db->bindVars($sql, ':custID', $customer_id, 'integer'); $db->Execute($sql); // set the boolean ec temp value since we created account strictly for EC purposes $_SESSION['paypal_ec_temp'] = true; } // hook notifier class vis a vis account-creation $this->notify('NOTIFY_LOGIN_SUCCESS_VIA_CREATE_ACCOUNT'); } else { // set the boolean ec temp value for the account to false, since we didn't have to create one $_SESSION['paypal_ec_temp'] = false; } // log the user in with the email sent back from paypal response $this->user_login($_SESSION['paypal_ec_payer_info']['payer_email'], false); // debug $this->zcLog('ec_step2_finish - 7', 'Auto-Logged customer in. (' . $_SESSION['paypal_ec_payer_info']['payer_email'] . ') (' . $_SESSION['customer_id'] . ')' . "\n" . '$_SESSION[paypal_ec_temp]=' . $_SESSION['paypal_ec_temp']); // This is the address matching section // try to match it first // note: this is by no means 100% $address_book_id = $this->findMatchingAddressBookEntry($_SESSION['customer_id'], $order->delivery); // no match add the record if (!$address_book_id) { $address_book_id = $this->addAddressBookEntry($_SESSION['customer_id'], $order->delivery, false); if (!$address_book_id) { $address_book_id = $_SESSION['customer_default_address_id']; } } // set the sendto to the address $_SESSION['sendto'] = $address_book_id; // set billto in the session $_SESSION['billto'] = $_SESSION['customer_default_address_id']; // select a shipping method, based on cheapest available option if (MODULE_PAYMENT_PAYPALWPP_AUTOSELECT_CHEAPEST_SHIPPING == 'Yes') { $this->setShippingMethod(); } // debug $this->zcLog('ec_step2_finish - 8', 'Exiting via terminateEC (from originally-not-logged-in mode).' . "\n" . 'Selected address: ' . $address_book_id . "\nOriginal was: " . $original_default_address_id . "\nprepared data: " . print_r($order->delivery, true)); // send the user on if ($_SESSION['paypal_ec_markflow'] == 1) { $this->terminateEC('', false, FILENAME_CHECKOUT_PROCESS); } else { $this->terminateEC('', false, FILENAME_CHECKOUT_CONFIRMATION); } } }
function after_process() { global $insert_id, $db; $comments = 'trade_no: ' . $_GET['trade_no'] . "\r\n" . 'out_trade_no: ' . $_GET['out_trade_no'] . "\r\n" . 'is_success: ' . $_GET['is_success'] . ' (T:success, F:failed)' . "\r\n" . 'trade_status: ' . $_GET['trade_status'] . "\r\n" . 'forex_total_fee: ' . $_GET['forex_total_fee'] . ' ' . $_GET['currency'] . "\r\n" . 'total_fee: ' . $_GET['total_fee'] . ' RMB' . "\r\n"; $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => $this->order_status, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => $comments); zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); return true; }
$languages = zen_get_languages(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $language_id = $languages[$i]['id']; $check = $db->Execute("select *\n from " . TABLE_METATAGS_CATEGORIES_DESCRIPTION . "\n where categories_id = '" . (int) $categories_id . "'\n and language_id = '" . (int) $language_id . "'"); if ($check->RecordCount() > 0) { $action = 'update_category_meta_tags'; } else { $action = 'insert_categories_meta_tags'; } $sql_data_array = array('metatags_title' => zen_db_prepare_input($_POST['metatags_title'][$language_id]), 'metatags_keywords' => zen_db_prepare_input($_POST['metatags_keywords'][$language_id]), 'metatags_description' => zen_db_prepare_input($_POST['metatags_description'][$language_id])); if ($action == 'insert_categories_meta_tags') { $insert_sql_data = array('categories_id' => $categories_id, 'language_id' => $language_id); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array); } elseif ($action == 'update_category_meta_tags') { zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int) $categories_id . "' and language_id = '" . (int) $language_id . "'"); } } zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id)); break; // eof: categories meta tags // eof: categories meta tags case 'delete_category_confirm_old': // demo active test if (zen_admin_demo()) { $_GET['action'] = ''; $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath)); } if (isset($_POST['categories_id'])) { $categories_id = zen_db_prepare_input($_POST['categories_id']);
} unset($f); } // endif $save_to_file } //end if $records for processing not 0 zen_redirect(zen_href_link(FILENAME_ADMIN_ACTIVITY)); break; // clean out the admin_activity_log // clean out the admin_activity_log case 'clean_admin_activity_log': if (isset($_POST['confirm']) && $_POST['confirm'] == 'yes') { $db->Execute("truncate table " . TABLE_ADMIN_ACTIVITY_LOG); $admname = '{' . preg_replace('/[^\\w]/', '*', zen_get_admin_name()) . '[' . (int) $_SESSION['admin_id'] . ']}'; $sql_data_array = array('access_date' => 'now()', 'admin_id' => isset($_SESSION['admin_id']) ? (int) $_SESSION['admin_id'] : 0, 'page_accessed' => 'Log reset by ' . $admname . '.', 'page_parameters' => '', 'ip_address' => substr($_SERVER['REMOTE_ADDR'], 0, 45)); zen_db_perform(TABLE_ADMIN_ACTIVITY_LOG, $sql_data_array); $messageStack->add_session(SUCCESS_CLEAN_ADMIN_ACTIVITY_LOG, 'success'); unset($_SESSION['reset_admin_activity_log']); zen_redirect(zen_href_link(FILENAME_ADMIN_ACTIVITY)); } else { $confirmation_needed = TRUE; } break; } //end switch / case } //endif $action ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS;
zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, 'action=edit&oID=' . $oID, $request_type)); break; case 'reopen': $so->reopen(); $messageStack->add_session(sprintf(WARNING_ORDER_REOPEN, $oID), 'warning'); zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, 'action=edit&oID=' . $oID, $request_type)); break; case 'add_note': $oID = $_POST['oID']; $new_admin_note = array(); $new_admin_note['customers_id'] = $_POST['cID']; $new_admin_note['date_added'] = 'now()'; $new_admin_note['admin_id'] = $_SESSION['admin_id']; $new_admin_note['notes'] = zen_db_scrub_in($_POST['notes']); $new_admin_note['karma'] = $_POST['karma']; zen_db_perform(TABLE_CUSTOMERS_ADMIN_NOTES, $new_admin_note); $messageStack->add_session(SUCCESS_NEW_ADMIN_NOTE, 'success'); zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, 'oID=' . $oID . '&action=edit', $request_type)); break; case 'edit': // reset single download to on if ($_GET['download_reset_on'] > 0) { // adjust download_maxdays based on current date $check_status = $db->Execute("select customers_name, customers_email_address, orders_status,\r\n date_purchased from " . TABLE_ORDERS . "\r\n where orders_id = '" . $_GET['oID'] . "'"); $zc_max_days = date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + DOWNLOAD_MAX_DAYS; $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . DOWNLOAD_MAX_COUNT . "' where orders_id='" . $_GET['oID'] . "' and orders_products_download_id='" . $_GET['download_reset_on'] . "'"; $db->Execute($update_downloads_query); unset($_GET['download_reset_on']); $messageStack->add_session(SUCCESS_ORDER_UPDATED_DOWNLOAD_ON, 'success'); zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', $request_type)); }
$layout_page = $_GET['layout_page']; } if ($_GET['action']) { switch ($_GET['action']) { case 'add': // check if (zen_not_null($layout_page) == false) { $messageStack->add_session('layout page is empty.', 'error'); zen_redirect(zen_href_link(FILENAME_LAYOUT_CONTROLLER, 'template_dir=' . $template_dir)); } // get default setting $default_setting = $db->Execute("SELECT * FROM " . TABLE_LAYOUT_BOXES . " WHERE layout_template='" . zen_db_prepare_input($template_dir) . "' and layout_page =''"); // duplicate setting while (!$default_setting->EOF) { $sql_data_array = array('layout_template' => $default_setting->fields['layout_template'], 'layout_box_name' => $default_setting->fields['layout_box_name'], 'layout_box_status' => $default_setting->fields['layout_box_status'], 'layout_box_location' => $default_setting->fields['layout_box_location'], 'layout_box_sort_order' => $default_setting->fields['layout_box_sort_order'], 'layout_box_sort_order_single' => $default_setting->fields['layout_box_sort_order_single'], 'layout_box_status_single' => $default_setting->fields['layout_box_status_single'], 'layout_page' => $layout_page); zen_db_perform(TABLE_LAYOUT_BOXES, $sql_data_array); $default_setting->MoveNext(); } $messageStack->add_session(LAYOUT_PAGE_WAS_ADDED, 'success'); zen_redirect(zen_href_link(FILENAME_LAYOUT_CONTROLLER, 'template_dir=' . $template_dir . '&layout_page=' . $layout_page)); break; } } ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?> > <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php
zen_db_perform(TABLE_COUPONS, $sql_data_array, 'update', "coupon_id='" . $_GET['cid'] . "'"); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $language_id = $languages[$i]['id']; $sql_data_desc_array = array('coupon_name' => zen_db_prepare_input($_POST['coupon_name'][$language_id]), 'coupon_description' => zen_db_prepare_input($_POST['coupon_desc'][$language_id])); zen_db_perform(TABLE_COUPONS_DESCRIPTION, $sql_data_desc_array, 'update', "coupon_id = '" . $_GET['cid'] . "' and language_id = '" . $languages[$i]['id'] . "'"); } } else { zen_db_perform(TABLE_COUPONS, $sql_data_array); $insert_id = $db->Insert_ID(); $cid = $insert_id; $_GET['cid'] = $cid; for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $language_id = $languages[$i]['id']; $sql_data_marray[$i]['coupon_id'] = $insert_id; $sql_data_marray[$i]['language_id'] = $language_id; zen_db_perform(TABLE_COUPONS_DESCRIPTION, $sql_data_marray[$i]); } } } zen_redirect(zen_href_link(FILENAME_COUPON_ADMIN, 'cid=' . $_GET['cid'] . (isset($_GET['status']) ? '&status=' . $_GET['status'] : '') . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''))); } ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?> > <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>
if (isset($_POST[$k]) && !empty($_POST[$k])) { $new_data[$k] = $_POST[$k]; if (isset($call_backs[$k])) { $new_data[$k] = $call_backs[$k]($new_data[$k]); } } //else // unset($new_data[$k]); } switch ($_POST['oper']) { case 'add': zen_db_perform(TABLE_LINKS_ALIASES, $new_data, 'insert'); SSUManager::resetCacheTimer(); break; case 'edit': zen_db_perform(TABLE_LINKS_ALIASES, $new_data, 'update', "id = '{$_POST['id']}'"); SSUManager::removeCache($_POST['id']); break; case 'del': $db->Execute('DELETE FROM ' . TABLE_LINKS_ALIASES . " WHERE id IN ({$_POST['id']})"); SSUManager::removeCache($_POST['id']); break; } $response = array('affected_row_count' => mysql_affected_rows($db->link)); } else { $page = $_REQUEST['page']; // get the requested page $limit = $_REQUEST['rows']; // get how many rows we want to have into the grid $sidx = $_REQUEST['sidx']; // get index row - i.e. user click to sort
$media_id = zen_db_prepare_input($_GET['mID']); } $media_name = zen_db_prepare_input($_POST['media_name']); $sql_data_array = array('media_name' => $media_name); if ($media_name == '') { $messageStack->add_session(ERROR_UNKNOWN_DATA, 'caution'); } else { if ($action == 'insert') { $insert_sql_data = array('date_added' => 'now()'); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); zen_db_perform(TABLE_MEDIA_MANAGER, $sql_data_array); $media_id = zen_db_insert_id(); } elseif ($action == 'save') { $update_sql_data = array('last_modified' => 'now()'); $sql_data_array = array_merge($sql_data_array, $update_sql_data); zen_db_perform(TABLE_MEDIA_MANAGER, $sql_data_array, 'update', "media_id = '" . (int) $media_id . "'"); } } zen_redirect(zen_href_link(FILENAME_MEDIA_MANAGER, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . ($media_id != '' ? 'mID=' . $media_id : ''))); break; case 'deleteconfirm': // demo active test if (zen_admin_demo()) { $_GET['action'] = ''; $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link(FILENAME_MEDIA_MANAGER, 'page=' . $_GET['page'])); } $media_id = zen_db_prepare_input($_GET['mID']); $db->Execute("delete from " . TABLE_MEDIA_MANAGER . "\n where media_id = '" . (int) $media_id . "'"); if (isset($_POST['delete_products']) && $_POST['delete_products'] == 'on') { // while (!$products->EOF) {
} if ($links_image->filename != '') { $db->Execute("update " . TABLE_LINKS . "\n set links_image_url = '" . $links_image_name . "'\n where links_id = '" . (int) $links_id . "'"); } else { // Use default image if form field is left blank $links_image_name = LINK_IMAGE_DIRECTORY . DEFAULT_LINK_IMAGE; $db->Execute("update " . TABLE_LINKS . "\n set links_image_url = '" . $links_image_name . "'\n where links_id = '" . (int) $links_id . "'"); $messageStack->add_session('header', WARNING_DEFAULT_FILE_UPLOADED, 'success'); } } $categories = $db->Execute("select link_categories_id from " . TABLE_LINK_CATEGORIES_DESCRIPTION . " where link_categories_name = '" . $links_category . "' and language_id = '" . (int) $_SESSION['languages_id'] . "' "); $link_categories_id = $categories->fields['link_categories_id']; $db->Execute("insert into " . TABLE_LINKS_TO_LINK_CATEGORIES . " (links_id, link_categories_id) values ('" . (int) $links_id . "', '" . (int) $link_categories_id . "')"); $language_id = (int) $_SESSION['languages_id']; $sql_data_array = array('links_id' => $links_id, 'language_id' => $language_id, 'links_title' => $links_title, 'links_description' => $links_description); zen_db_perform(TABLE_LINKS_DESCRIPTION, $sql_data_array); // build the message content $name = $links_contact_name; $email_text = sprintf(EMAIL_GREET_NONE, $name); $email_text .= EMAIL_WELCOME; $email_text .= EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING; $email_store_text = EMAIL_OWNER_TEXT . $links_title . "\n\n" . $links_url . "\n\n" . $links_description; // Prepare HTML-portion of message $html_msg['EMAIL_GREETING'] = str_replace('\\n', '', $email_text); $html_msg['EMAIL_WELCOME'] = str_replace('\\n', '', EMAIL_WELCOME); $html_msg['EMAIL_MESSAGE_HTML'] = str_replace('\\n', '', EMAIL_TEXT); $html_msg['CONTACT_US_OFFICE_FROM'] = OFFICE_FROM . ' ' . $name . '<br />' . OFFICE_EMAIL . '(' . $links_contact_email . ')'; $html_msg['EXTRA_INFO'] = $extra_info['HTML']; zen_mail($name, $links_contact_email, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $html_msg, 'Link Exchange'); zen_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_OWNER_SUBJECT, $email_store_text, $name, $links_contact_email, $html_msg, 'Link Exchange'); zen_redirect(zen_href_link(FILENAME_LINKS_SUBMIT, 'action=success'));
/** * Post-processing activities * * @return boolean */ function after_process() { global $insert_id, $db, $order; $sql_data_array = array(array('fieldName' => 'orders_id', 'value' => $insert_id, 'type' => 'integer'), array('fieldName' => 'orders_status_id', 'value' => $this->order_status, 'type' => 'integer'), array('fieldName' => 'date_added', 'value' => 'now()', 'type' => 'noquotestring'), array('fieldName' => 'customer_notified', 'value' => 0, 'type' => 'integer')); $db->perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); $sql_data_array = array('order_id' => $insert_id, 'first_name' => $order->billing['firstname'], 'last_name' => $order->billing['lastname'], 'payer_business_name' => $order->billing['company'], 'address_street' => $order->billing['street_address'], 'address_city' => $order->billing['city'], 'address_state' => $order->billing['state'], 'address_zip' => $order->billing['postcode'], 'address_country' => $order->customer['country'], 'email' => $order->customer['email_address'], 'date_added' => 'now()', 'cnResult' => $_POST['result'], 'cnRespMessage' => $_POST['respmessage'], 'cnBatchNo' => $_POST['batchno'], 'cnTx' => $_POST['tx'], 'cnAmount' => $_POST['amount1'], 'cnPmtType' => $_POST['pmttype']); zen_db_perform(TABLE_CASHNET, $sql_data_array); }
function verify_ccpay_records() { $ccpay_data = array(); $auto_payment = array(); $so_data = array(); global $db; // get order record for this order $ccpay_data = $db->Execute("select * from " . TABLE_ORDERS . " where orders_id = '" . $this->oID . "'"); // for each Credit Card paid order, find a matching SO payment record. If can't find, create one while (!$ccpay_data->EOF) { if ($ccpay_data->fields['payment_module_code'] == 'authorizenet_aim' || $ccpay_data->fields['payment_method'] == 'Credit Card') { $auto_payment['orders_id'] = $this->oID; $auto_payment['payment_number'] = $auto_payment['payment_number'] = $ccpay_data->fields['orders_id'] . "-" . $ccpay_data->fields['cc_number']; $auto_payment['payment_name'] = $ccpay_data->fields['customers_name']; $auto_payment['payment_amount'] = $ccpay_data->fields['order_total']; $auto_payment['payment_type'] = $ccpay_data->fields['cc_type']; $auto_payment['date_posted'] = $ccpay_data->fields['date_purchased']; $auto_payment['last_modified'] = $ccpay_data->fields['last_modified']; // check to see if this record already exists in SO_Payments $so_data = $db->Execute("select * from " . TABLE_SO_PAYMENTS . " where orders_id = '" . $this->oID . "'"); // if not yet recorded, enter into the table if ($so_data->EOF) { zen_db_perform(TABLE_SO_PAYMENTS, $auto_payment); } } // payment_status check $ccpay_data->MoveNext(); } // while }
if (ACCOUNT_COMPANY == 'true') { $sql_data_array['entry_company'] = $company; } if (ACCOUNT_SUBURB == 'true') { $sql_data_array['entry_suburb'] = $suburb; } if (ACCOUNT_STATE == 'true') { if ($zone_id > 0) { $sql_data_array['entry_zone_id'] = $zone_id; $sql_data_array['entry_state'] = ''; } else { $sql_data_array['entry_zone_id'] = '0'; $sql_data_array['entry_state'] = $state; } } zen_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); $address_id = $db->Insert_ID(); $zco_notifier->notify('NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_ADDRESS_BOOK_RECORD', array_merge(array('address_id' => $address_id), $sql_data_array)); $sql = "update " . TABLE_CUSTOMERS . "\n set customers_default_address_id = '" . (int) $address_id . "'\n where customers_id = '" . (int) $_SESSION['customer_id'] . "'"; $db->Execute($sql); $sql = "insert into " . TABLE_CUSTOMERS_INFO . "\n (customers_info_id, customers_info_number_of_logons,\n customers_info_date_account_created, customers_info_date_of_last_logon)\n values ('" . (int) $_SESSION['customer_id'] . "', '1', now(), now())"; $db->Execute($sql); // phpBB create account if ($phpBB->phpBB['installed'] == true) { $phpBB->phpbb_create_account($nick, $password, $email_address); } // End phppBB create account if (SESSION_RECREATE == 'True') { zen_session_recreate(); } $_SESSION['customer_first_name'] = $firstname;
$sql_data_array = array('metatags_title_status' => zen_db_prepare_input($_POST['metatags_title_status']), 'metatags_products_name_status' => zen_db_prepare_input($_POST['metatags_products_name_status']), 'metatags_model_status' => zen_db_prepare_input($_POST['metatags_model_status']), 'metatags_price_status' => zen_db_prepare_input($_POST['metatags_price_status']), 'metatags_title_tagline_status' => zen_db_prepare_input($_POST['metatags_title_tagline_status'])); if ($action == 'new_product_meta_tags') { $insert_sql_data = array('products_id' => $products_id); $insert_sql_data = array('products_date_added' => 'now()'); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); zen_db_perform(TABLE_PRODUCTS, $sql_data_array); } elseif ($action == 'update_product_meta_tags') { $update_sql_data = array('products_last_modified' => 'now()'); $sql_data_array = array_merge($sql_data_array, $update_sql_data); //die('UPDATE PRODUCTS ID:' . (int)$products_id . ' - ' . sizeof($sql_data_array)); zen_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int) $products_id . "'"); } // check if new meta tags or existing $check_meta_tags_description = $db->Execute("select products_id from " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " where products_id='" . $products_id . "'"); if ($check_meta_tags_description->RecordCount() <= 0) { $action = 'new_product_meta_tags'; } $languages = zen_get_languages(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $language_id = $languages[$i]['id']; $sql_data_array = array('metatags_title' => zen_db_prepare_input($_POST['metatags_title'][$language_id]), 'metatags_keywords' => zen_db_prepare_input($_POST['metatags_keywords'][$language_id]), 'metatags_description' => zen_db_prepare_input($_POST['metatags_description'][$language_id])); if ($action == 'new_product_meta_tags') { $insert_sql_data = array('products_id' => $products_id, 'language_id' => $language_id); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); zen_db_perform(TABLE_META_TAGS_PRODUCTS_DESCRIPTION, $sql_data_array); } elseif ($action == 'update_product_meta_tags') { zen_db_perform(TABLE_META_TAGS_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int) $products_id . "' and language_id = '" . (int) $language_id . "'"); } } zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''))); }
$store_credit = new storeCredit(); $store_credit->store_pending_rewards(); $action = isset($_GET['action']) ? $_GET['action'] : ''; $error = false; $processed = false; if (zen_not_null($action)) { switch ($action) { case 'update': $customers_id = zen_db_prepare_input($_GET['cID']); $amount = zen_db_prepare_input($_POST['customers_balance']); $sql_data_array = array('customers_id' => $customers_id, 'amount' => $amount); $check = $db->execute('select count(*) as count from ' . TABLE_STORE_CREDIT . ' WHERE customers_id=' . (int) $customers_id); if ($check->fields['count'] == 0) { zen_db_perform(TABLE_STORE_CREDIT, $sql_data_array, 'insert', ''); } else { zen_db_perform(TABLE_STORE_CREDIT, $sql_data_array, 'update', "customers_id = '" . (int) $customers_id . "'"); } zen_redirect(zen_href_link(FILENAME_STORE_CREDIT, 'cID=' . $_GET['cID'], 'NONSSL')); break; case 'award': $customers_id = zen_db_prepare_input($_GET['cID']); $store_credit->award_pending_rewards($customers_id); zen_redirect(zen_href_link(FILENAME_STORE_CREDIT, 'cID=' . $_GET['cID'], 'NONSSL')); break; default: $customers = $db->Execute("select c.customers_id, c.customers_firstname, c.customers_lastname, sc.amount from " . TABLE_CUSTOMERS . " c left join " . TABLE_STORE_CREDIT . " sc on c.customers_id = sc.customers_id where c.customers_id = '" . (int) $_GET['cID'] . "'"); $cInfo = new objectInfo($customers->fields); break; } } ?>
$messageStack->add(ERROR_BANNER_IMAGE_REQUIRED, 'error'); $banner_error = true; } } } if ($banner_error == false) { $db_image_location = zen_not_null($banners_image_local) ? $banners_image_local : $banners_image_target . $banners_image->filename; $sql_data_array = array('banners_title' => $banners_title, 'banners_url' => $banners_url, 'banners_image' => $db_image_location, 'banners_group' => $banners_group, 'banners_html_text' => $banners_html_text, 'status' => $status, 'banners_open_new_windows' => $banners_open_new_windows, 'banners_on_ssl' => $banners_on_ssl, 'banners_sort_order' => (int) $banners_sort_order); if ($action == 'insert') { $insert_sql_data = array('date_added' => 'now()', 'status' => '1'); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); zen_db_perform(TABLE_BANNERS, $sql_data_array); $banners_id = zen_db_insert_id(); $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success'); } elseif ($action == 'update') { zen_db_perform(TABLE_BANNERS, $sql_data_array, 'update', "banners_id = '" . (int) $banners_id . "'"); $messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success'); } // NOTE: status will be reset by the /functions/banner.php // build new update sql for date_scheduled, expires_date and expires_impressions $sql = "UPDATE " . TABLE_BANNERS . "\n SET\n date_scheduled = :scheduledDate,\n expires_date = DATE_ADD(:expiresDate, INTERVAL '23:59:59' HOUR_SECOND),\n expires_impressions = " . ($expires_impressions == 0 ? "null" : ":expiresImpressions") . "\n WHERE banners_id = :bannersID"; if ($expires_impressions > 0) { $sql = $db->bindVars($sql, ':expiresImpressions', $expires_impressions, 'integer'); } if ($date_scheduled != '') { $sql = $db->bindVars($sql, ':scheduledDate', $date_scheduled, 'date'); } if ($expires_date != '') { $sql = $db->bindVars($sql, ':expiresDate', $expires_date, 'date'); } $sql = $db->bindVars($sql, ':bannersID', $banners_id, 'integer');
} else { $db->Execute("update " . TABLE_MANUFACTURERS . "\n set manufacturers_image = ''\n where manufacturers_id = '" . (int) $manufacturers_id . "'"); } } } $languages = zen_get_languages(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $manufacturers_url_array = $_POST['manufacturers_url']; $language_id = $languages[$i]['id']; $sql_data_array = array('manufacturers_url' => zen_db_prepare_input($manufacturers_url_array[$language_id])); if ($action == 'insert') { $insert_sql_data = array('manufacturers_id' => $manufacturers_id, 'languages_id' => $language_id); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); zen_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array); } elseif ($action == 'save') { zen_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array, 'update', "manufacturers_id = '" . (int) $manufacturers_id . "' and languages_id = '" . (int) $language_id . "'"); } } zen_redirect(zen_href_link(FILENAME_MANUFACTURERS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'mID=' . $manufacturers_id)); break; case 'deleteconfirm': // demo active test if (zen_admin_demo()) { $_GET['action'] = ''; $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link(FILENAME_MANUFACTURERS, 'page=' . $_GET['page'])); } $manufacturers_id = zen_db_prepare_input($_POST['mID']); if (isset($_POST['delete_image']) && $_POST['delete_image'] == 'on') { $manufacturer = $db->Execute("select manufacturers_image\n from " . TABLE_MANUFACTURERS . "\n where manufacturers_id = '" . (int) $manufacturers_id . "'"); $image_location = DIR_FS_CATALOG_IMAGES . $manufacturer->fields['manufacturers_image'];
/** * Write order-history update to ZC tables denoting the update supplied by the IPN */ function ipn_update_orders_status_and_history($ordersID, $new_status = 1, $txn_type) { global $db; ipn_debug_email('IPN NOTICE :: Updating order #' . (int) $ordersID . ' to status: ' . (int) $new_status . ' (txn_type: ' . $txn_type . ')'); $db->Execute("update " . TABLE_ORDERS . "\n set orders_status = '" . (int) $new_status . "'\n where orders_id = '" . (int) $ordersID . "'"); $sql_data_array = array('orders_id' => (int) $ordersID, 'orders_status_id' => (int) $new_status, 'date_added' => 'now()', 'comments' => 'PayPal status: ' . $_POST['payment_status'] . ' ' . ' @ ' . $_POST['payment_date'] . ($_POST['parent_txn_id'] != '' ? "\n" . ' Parent Trans ID:' . $_POST['parent_txn_id'] : '') . "\n" . ' Trans ID:' . $_POST['txn_id'] . "\n" . ' Amount: ' . $_POST['mc_gross'] . ' ' . $_POST['mc_currency'], 'customer_notified' => false); zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); ipn_debug_email('IPN NOTICE :: Update complete.'); /** * Activate any downloads associated with an order which has now been cleared */ if ($txn_type == 'echeck-cleared' || $txn_type == 'express-checkout-cleared' || substr($txn_type, 0, 8) == 'cleared-') { $check_status = $db->Execute("select date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int) $ordersID . "'"); $zc_max_days = date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + (int) DOWNLOAD_MAX_DAYS; ipn_debug_email('IPN NOTICE :: Updating order #' . (int) $ordersID . ' downloads. New max days: ' . (int) $zc_max_days . ', New count: ' . (int) DOWNLOAD_MAX_COUNT); $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . (int) $zc_max_days . "', download_count='" . (int) DOWNLOAD_MAX_COUNT . "' where orders_id='" . (int) $ordersID . "'"; $db->Execute($update_downloads_query); } }
} if ($pages_html_text != '' and strlen(trim($pages_html_text)) > 6) { $zv_link_method_cnt++; } if ($zv_link_method_cnt > 1) { $messageStack->add(ERROR_MULTIPLE_HTML_URL, 'error'); $page_error = true; } if ($page_error == false) { $sql_data_array = array('pages_title' => $pages_title, 'page_open_new_window' => $page_open_new_window, 'page_is_ssl' => $page_is_ssl, 'alt_url' => $alt_url, 'alt_url_external' => $alt_url_external, 'status_header' => $status_header, 'status_sidebox' => $status_sidebox, 'status_footer' => $status_footer, 'status_toc' => $status_toc, 'header_sort_order' => $pages_header_sort_order, 'sidebox_sort_order' => $pages_sidebox_sort_order, 'footer_sort_order' => $pages_footer_sort_order, 'toc_sort_order' => $pages_toc_sort_order, 'toc_chapter' => $toc_chapter, 'pages_html_text' => $pages_html_text); if ($action == 'insert') { zen_db_perform(TABLE_EZPAGES, $sql_data_array); $pages_id = $db->insert_ID(); $messageStack->add(SUCCESS_PAGE_INSERTED, 'success'); } elseif ($action == 'update') { zen_db_perform(TABLE_EZPAGES, $sql_data_array, 'update', "pages_id = '" . (int) $pages_id . "'"); $messageStack->add(SUCCESS_PAGE_UPDATED, 'success'); } zen_redirect(zen_href_link(FILENAME_EZPAGES_ADMIN, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'ezID=' . $pages_id)); } else { if ($page_error == false) { $action = 'new'; } else { $_GET['pages_id'] = $pages_id; $_GET['ezID'] = $pages_id; $_GET['action'] = 'new'; $action = 'new'; $ezID = $pages_id; $page = $_GET['page']; } }
function updateOrderStatus($method, $orderId) { global $db; $order_status_id = constant('MODULE_PAYMENT_PAYNL_' . $method . '_TRANSACTION_ORDER_STATUS_ID') > 0 ? (int) constant('MODULE_PAYMENT_PAYNL_' . $method . '_TRANSACTION_ORDER_STATUS_ID') : (int) DEFAULT_ORDERS_STATUS_ID; $db->Execute("update " . TABLE_ORDERS . " set orders_status = '" . $order_status_id . "', last_modified = now() where orders_id = '" . (int) $orderId . "'"); $sql_data_array = array('orders_id' => $orderId, 'orders_status_id' => $order_status_id, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => 'Pay.nl Transaction [VERIFIED]'); zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); }
$symbol_right = zen_db_prepare_input($_POST['symbol_right']); $decimal_point = zen_db_prepare_input($_POST['decimal_point']); $thousands_point = zen_db_prepare_input($_POST['thousands_point']); $decimal_places = zen_db_prepare_input((int) $_POST['decimal_places']); $value = zen_db_prepare_input((double) $_POST['value']); // special handling for currencies which don't support decimal places if ($decimal_point == '0' || in_array($code, array('JPY', 'HUF', 'TWD'))) { $value = (int) $value; $decimal_places = 0; } $sql_data_array = array('title' => $title, 'code' => $code, 'symbol_left' => $symbol_left, 'symbol_right' => $symbol_right, 'decimal_point' => $decimal_point, 'thousands_point' => $thousands_point, 'decimal_places' => $decimal_places, 'value' => $value); if ($action == 'insert') { zen_db_perform(TABLE_CURRENCIES, $sql_data_array); $currency_id = zen_db_insert_id(); } elseif ($action == 'save') { zen_db_perform(TABLE_CURRENCIES, $sql_data_array, 'update', "currencies_id = '" . (int) $currency_id . "'"); } zen_record_admin_activity('Currency code ' . $code . ' added/updated.', 'info'); if (isset($_POST['default']) && $_POST['default'] == 'on') { $db->Execute("update " . TABLE_CONFIGURATION . "\r\n set configuration_value = '" . zen_db_input($code) . "'\r\n where configuration_key = 'DEFAULT_CURRENCY'"); zen_record_admin_activity('Default currency code changed to ' . $code, 'info'); } zen_redirect(zen_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page'] . '&cID=' . $currency_id)); break; case 'deleteconfirm': // demo active test if (zen_admin_demo()) { $_GET['action'] = ''; $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page'])); }
function update_refund($refund_id, $payment_id = false, $refund_number = false, $refund_name = false, $refund_amount = false, $refund_type = false, $orders_id = false) { $update_refund = array(); $update_refund['last_modified'] = 'now()'; if (is_numeric($payment_id)) { $update_refund['payment_id'] = (int) $payment_id; } if ($refund_number && $refund_number != '') { $update_refund['refund_number'] = zen_db_prepare_input($refund_number); } if ($refund_name && $refund_name != '') { $update_refund['refund_name'] = zen_db_prepare_input($refund_name); } if ($refund_amount && $refund_amount != '') { $update_refund['refund_amount'] = zen_db_prepare_input($refund_amount); } if ($refund_type && $refund_type != '') { $update_refund['refund_type'] = zen_db_prepare_input($refund_type); } if ($orders_id && $orders_id != '') { $update_refund['orders_id'] = (int) $orders_id; } zen_db_perform(TABLE_SO_REFUNDS, $update_refund, 'update', "refund_id = '" . $refund_id . "'"); }
$messageStack->add(ERROR_NEWSLETTER_TITLE, 'error'); $newsletter_error = true; } if (empty($newsletter_module)) { $messageStack->add(ERROR_NEWSLETTER_MODULE, 'error'); $newsletter_error = true; } if ($newsletter_error == false) { $sql_data_array = array('title' => $title, 'content' => $content, 'content_html' => $content_html, 'module' => $newsletter_module); if ($action == 'insert') { $sql_data_array['date_added'] = 'now()'; $sql_data_array['status'] = '0'; zen_db_perform(TABLE_NEWSLETTERS, $sql_data_array); $newsletter_id = zen_db_insert_id(); } elseif ($action == 'update') { zen_db_perform(TABLE_NEWSLETTERS, $sql_data_array, 'update', "newsletters_id = '" . (int) $newsletter_id . "'"); } zen_redirect(zen_href_link(FILENAME_NEWSLETTERS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'nID=' . $newsletter_id)); } else { $action = 'new'; } break; case 'deleteconfirm': $newsletter_id = zen_db_prepare_input($_GET['nID']); $db->Execute("delete from " . TABLE_NEWSLETTERS . "\n where newsletters_id = '" . (int) $newsletter_id . "'"); zen_redirect(zen_href_link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'])); break; case 'delete': case 'new': if (!isset($_GET['nID'])) { break;
if (isset($_GET['gID'])) { $group_id = zen_db_prepare_input($_GET['gID']); } $group_name = zen_db_prepare_input($_POST['group_name']); $group_percentage = zen_db_prepare_input((double) $_POST['group_percentage']); if ($group_name) { $sql_data_array = array('group_name' => $group_name, 'group_percentage' => $group_percentage); if ($action == 'insert') { $insert_sql_data = array('date_added' => 'now()'); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); zen_db_perform(TABLE_GROUP_PRICING, $sql_data_array); $group_id = $db->insert_ID(); } elseif ($action == 'save') { $update_sql_data = array('last_modified' => 'now()'); $sql_data_array = array_merge($sql_data_array, $update_sql_data); zen_db_perform(TABLE_GROUP_PRICING, $sql_data_array, 'update', "group_id = '" . (int) $group_id . "'"); } } zen_redirect(zen_href_link(FILENAME_GROUP_PRICING, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'gID=' . $group_id)); break; case 'deleteconfirm': if (zen_admin_demo()) { $_GET['action'] = ''; $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'])); } $delete_cust_confirmed = isset($_POST['delete_customers']) && $_POST['delete_customers'] == 'on' ? true : false; $group_id = zen_db_prepare_input($_GET['gID']); $customers_query = $db->Execute("select customers_id from " . TABLE_CUSTOMERS . " where customers_group_pricing = '" . (int) $group_id . "'"); if ($customers_query->RecordCount() > 0 && $delete_cust_confirmed == true) { $db->Execute("delete from " . TABLE_GROUP_PRICING . " where group_id = '" . (int) $group_id . "'");
/** * Updates the configuration option in the database using the supplied * configuration data. If the configuration option does not exist this method * will do nothing. A new key to use for the option can be specified in the * data array (using 'configuration_key'). If not specified in the data array * the title and description for the option will be updated using the defined * language constants for the key. * * The language constants for the key are determined by taking the key and * appending _TITLE and _DESCRIPTION respectively. * * @param string $key the configuration key to update. * @param array $data the array of configuration settings. */ protected function updateConfigurationOption($key, $data = array()) { global $db; // If a new key was sent, make sure we use the new key $new_key = array_key_exists('configuration_key', $data) ? $data['configuration_key'] : $key; $check = $db->Execute('SELECT `configuration_id` FROM `' . TABLE_CONFIGURATION . '` ' . 'WHERE `configuration_key`=\'' . $key . '\''); if (!$check->EOF) { $sql_data_array = array('configuration_key' => $new_key, 'configuration_title' => @constant($new_key . '_TITLE'), 'configuration_description' => @constant($new_key . '_DESCRIPTION'), 'last_modified' => 'now()'); zen_db_perform(TABLE_CONFIGURATION, array_merge($sql_data_array, $data), 'update', '`configuration_id`=\'' . $check->fields['configuration_id'] . '\''); } }
function create_add_products($zf_insert_id, $zf_mode = false) { global $db, $currencies, $order_total_modules, $order_totals; // initialized for the email confirmation $this->products_ordered = ''; $this->products_ordered_html = ''; $this->subtotal = 0; $this->total_tax = 0; // lowstock email report $this->email_low_stock = ''; for ($i = 0, $n = sizeof($this->products); $i < $n; $i++) { $custom_insertable_text = ''; $this->doStockDecrement = STOCK_LIMITED == 'true'; $this->notify('NOTIFY_ORDER_PROCESSING_STOCK_DECREMENT_INIT', array('i' => $i), $this->products[$i], $i); // Stock Update - Joao Correia if ($this->doStockDecrement) { if (DOWNLOAD_ENABLED == 'true') { $stock_query_raw = "select p.products_quantity, pad.products_attributes_filename, p.product_is_always_free_shipping\n from " . TABLE_PRODUCTS . " p\n left join " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n on p.products_id=pa.products_id\n left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n on pa.products_attributes_id=pad.products_attributes_id\n WHERE p.products_id = '" . zen_get_prid($this->products[$i]['id']) . "'"; // Will work with only one option for downloadable products // otherwise, we have to build the query dynamically with a loop $products_attributes = $this->products[$i]['attributes']; if (is_array($products_attributes)) { $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'"; } $stock_values = $db->Execute($stock_query_raw, false, false, 0, true); } else { $stock_values = $db->Execute("select * from " . TABLE_PRODUCTS . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'", false, false, 0, true); } $this->notify('NOTIFY_ORDER_PROCESSING_STOCK_DECREMENT_BEGIN', $i, $stock_values); if ($stock_values->RecordCount() > 0) { // do not decrement quantities if products_attributes_filename exists if (DOWNLOAD_ENABLED != 'true' || $stock_values->fields['product_is_always_free_shipping'] == 2 || !$stock_values->fields['products_attributes_filename']) { $stock_left = $stock_values->fields['products_quantity'] - $this->products[$i]['qty']; $this->products[$i]['stock_reduce'] = $this->products[$i]['qty']; } else { $stock_left = $stock_values->fields['products_quantity']; } // $this->products[$i]['stock_value'] = $stock_values->fields['products_quantity']; $db->Execute("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'"); // if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) { if ($stock_left <= 0) { // only set status to off when not displaying sold out if (SHOW_PRODUCTS_SOLD_OUT == '0') { $db->Execute("update " . TABLE_PRODUCTS . " set products_status = 0 where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'"); } } // for low stock email if ($stock_left <= STOCK_REORDER_LEVEL) { // WebMakers.com Added: add to low stock email $this->email_low_stock .= 'ID# ' . zen_get_prid($this->products[$i]['id']) . "\t\t" . $this->products[$i]['model'] . "\t\t" . $this->products[$i]['name'] . "\t\t" . ' Qty Left: ' . $stock_left . "\n"; } } } // Update products_ordered (for bestsellers list) $this->bestSellersUpdate = TRUE; $this->notify('NOTIFY_ORDER_PROCESSING_BESTSELLERS_UPDATE', array(), $this->products[$i], $i); if ($this->bestSellersUpdate) { $db->Execute("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%f', $this->products[$i]['qty']) . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'"); } $this->notify('NOTIFY_ORDER_PROCESSING_STOCK_DECREMENT_END', $i); $sql_data_array = array('orders_id' => $zf_insert_id, 'products_id' => zen_get_prid($this->products[$i]['id']), 'products_model' => $this->products[$i]['model'], 'products_name' => $this->products[$i]['name'], 'products_price' => $this->products[$i]['price'], 'final_price' => $this->products[$i]['final_price'], 'onetime_charges' => $this->products[$i]['onetime_charges'], 'products_tax' => $this->products[$i]['tax'], 'products_quantity' => $this->products[$i]['qty'], 'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'], 'product_is_free' => $this->products[$i]['product_is_free'], 'products_discount_type' => $this->products[$i]['products_discount_type'], 'products_discount_type_from' => $this->products[$i]['products_discount_type_from'], 'products_prid' => $this->products[$i]['id']); zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $order_products_id = $db->Insert_ID(); $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_PRODUCT_LINE_ITEM', array_merge(array('orders_products_id' => $order_products_id, 'i' => $i), $sql_data_array), $order_products_id); $this->notify('NOTIFY_ORDER_PROCESSING_CREDIT_ACCOUNT_UPDATE_BEGIN'); $order_total_modules->update_credit_account($i); //ICW ADDED FOR CREDIT CLASS SYSTEM $this->notify('NOTIFY_ORDER_PROCESSING_ATTRIBUTES_BEGIN'); //------ bof: insert customer-chosen options to order-------- $attributes_exist = '0'; $this->products_ordered_attributes = ''; if (isset($this->products[$i]['attributes'])) { $attributes_exist = '1'; for ($j = 0, $n2 = sizeof($this->products[$i]['attributes']); $j < $n2; $j++) { if (DOWNLOAD_ENABLED == 'true') { $attributes_query = "select popt.products_options_name, poval.products_options_values_name,\n pa.options_values_price, pa.price_prefix,\n pa.product_attribute_is_free, pa.products_attributes_weight, pa.products_attributes_weight_prefix,\n pa.attributes_discounted, pa.attributes_price_base_included, pa.attributes_price_onetime,\n pa.attributes_price_factor, pa.attributes_price_factor_offset,\n pa.attributes_price_factor_onetime, pa.attributes_price_factor_onetime_offset,\n pa.attributes_qty_prices, pa.attributes_qty_prices_onetime,\n pa.attributes_price_words, pa.attributes_price_words_free,\n pa.attributes_price_letters, pa.attributes_price_letters_free,\n pad.products_attributes_maxdays, pad.products_attributes_maxcount, pad.products_attributes_filename\n from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n on pa.products_attributes_id=pad.products_attributes_id\n where pa.products_id = '" . zen_db_input($this->products[$i]['id']) . "'\n and pa.options_id = '" . $this->products[$i]['attributes'][$j]['option_id'] . "'\n and pa.options_id = popt.products_options_id\n and pa.options_values_id = '" . $this->products[$i]['attributes'][$j]['value_id'] . "'\n and pa.options_values_id = poval.products_options_values_id\n and popt.language_id = '" . $_SESSION['languages_id'] . "'\n and poval.language_id = '" . $_SESSION['languages_id'] . "'"; $attributes_values = $db->Execute($attributes_query); } else { $attributes_values = $db->Execute("select popt.products_options_name, poval.products_options_values_name,\n pa.options_values_price, pa.price_prefix,\n pa.product_attribute_is_free, pa.products_attributes_weight, pa.products_attributes_weight_prefix,\n pa.attributes_discounted, pa.attributes_price_base_included, pa.attributes_price_onetime,\n pa.attributes_price_factor, pa.attributes_price_factor_offset,\n pa.attributes_price_factor_onetime, pa.attributes_price_factor_onetime_offset,\n pa.attributes_qty_prices, pa.attributes_qty_prices_onetime,\n pa.attributes_price_words, pa.attributes_price_words_free,\n pa.attributes_price_letters, pa.attributes_price_letters_free\n from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n where pa.products_id = '" . $this->products[$i]['id'] . "' and pa.options_id = '" . (int) $this->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int) $this->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'"); } //clr 030714 update insert query. changing to use values form $order->products for products_options_values. $sql_data_array = array('orders_id' => $zf_insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values->fields['products_options_name'], 'products_options_values' => $this->products[$i]['attributes'][$j]['value'], 'options_values_price' => $attributes_values->fields['options_values_price'], 'price_prefix' => $attributes_values->fields['price_prefix'], 'product_attribute_is_free' => $attributes_values->fields['product_attribute_is_free'], 'products_attributes_weight' => $attributes_values->fields['products_attributes_weight'], 'products_attributes_weight_prefix' => $attributes_values->fields['products_attributes_weight_prefix'], 'attributes_discounted' => $attributes_values->fields['attributes_discounted'], 'attributes_price_base_included' => $attributes_values->fields['attributes_price_base_included'], 'attributes_price_onetime' => $attributes_values->fields['attributes_price_onetime'], 'attributes_price_factor' => $attributes_values->fields['attributes_price_factor'], 'attributes_price_factor_offset' => $attributes_values->fields['attributes_price_factor_offset'], 'attributes_price_factor_onetime' => $attributes_values->fields['attributes_price_factor_onetime'], 'attributes_price_factor_onetime_offset' => $attributes_values->fields['attributes_price_factor_onetime_offset'], 'attributes_qty_prices' => $attributes_values->fields['attributes_qty_prices'], 'attributes_qty_prices_onetime' => $attributes_values->fields['attributes_qty_prices_onetime'], 'attributes_price_words' => $attributes_values->fields['attributes_price_words'], 'attributes_price_words_free' => $attributes_values->fields['attributes_price_words_free'], 'attributes_price_letters' => $attributes_values->fields['attributes_price_letters'], 'attributes_price_letters_free' => $attributes_values->fields['attributes_price_letters_free'], 'products_options_id' => (int) $this->products[$i]['attributes'][$j]['option_id'], 'products_options_values_id' => (int) $this->products[$i]['attributes'][$j]['value_id'], 'products_prid' => $this->products[$i]['id']); zen_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array); $opa_insert_id = $db->insert_ID(); $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_LINE_ITEM', array_merge(array('orders_products_attributes_id' => $opa_insert_id), $sql_data_array), $opa_insert_id); if (DOWNLOAD_ENABLED == 'true' && isset($attributes_values->fields['products_attributes_filename']) && zen_not_null($attributes_values->fields['products_attributes_filename'])) { $sql_data_array = array('orders_id' => $zf_insert_id, 'orders_products_id' => $order_products_id, 'orders_products_filename' => $attributes_values->fields['products_attributes_filename'], 'download_maxdays' => $attributes_values->fields['products_attributes_maxdays'], 'download_count' => $attributes_values->fields['products_attributes_maxcount'], 'products_prid' => $this->products[$i]['id']); zen_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array); $opd_insert_id = $db->insert_ID(); $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_DOWNLOAD_LINE_ITEM', $sql_data_array, $opd_insert_id); } $this->products_ordered_attributes .= "\n\t" . $attributes_values->fields['products_options_name'] . ' ' . zen_decode_specialchars($this->products[$i]['attributes'][$j]['value']); } } //------eof: insert customer-chosen options ---- $this->notify('NOTIFY_ORDER_PROCESSING_ATTRIBUTES_EXIST', $attributes_exist); $this->notify('NOTIFY_ORDER_DURING_CREATE_ADD_PRODUCTS', $i, $custom_insertable_text); /* START: ADD MY CUSTOM DETAILS * 1. calculate/prepare custom information to be added to this product entry in order-confirmation, perhaps as a function call to custom code to build a serial number etc: * Possible parameters to pass to custom functions at this point: * Product ID ordered (for this line item): $this->products[$i]['id'] * Quantity ordered (of this line-item): $this->products[$i]['qty'] * Order number: $zf_insert_id * Attribute Option Name ID: (int)$this->products[$i]['attributes'][$j]['option_id'] * Attribute Option Value ID: (int)$this->products[$i]['attributes'][$j]['value_id'] * Attribute Filename: $attributes_values->fields['products_attributes_filename'] * * 2. Add that data to the $this->products_ordered_attributes variable, using this sort of format: * $this->products_ordered_attributes .= {INSERT CUSTOM INFORMATION HERE}; */ $this->products_ordered_attributes .= $custom_insertable_text; /* END: ADD MY CUSTOM DETAILS */ // update totals counters $this->total_weight += $this->products[$i]['qty'] * $this->products[$i]['weight']; $this->total_tax += zen_calculate_tax($this->products[$i]['final_price'] * $this->products[$i]['qty'], $this->products[$i]['tax']); $this->total_cost += $this->products[$i]['final_price'] + $this->products[$i]['onetime_charges']; $this->notify('NOTIFY_ORDER_PROCESSING_ONE_TIME_CHARGES_BEGIN', $i); // build output for email notification $this->products_ordered .= $this->products[$i]['qty'] . ' x ' . $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' . $currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) . ($this->products[$i]['onetime_charges'] != 0 ? "\n" . TEXT_ONETIME_CHARGES_EMAIL . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') . $this->products_ordered_attributes . "\n"; $this->products_ordered_html .= '<tr>' . "\n" . '<td class="product-details" align="right" valign="top" width="30">' . $this->products[$i]['qty'] . ' x</td>' . "\n" . '<td class="product-details" valign="top">' . nl2br($this->products[$i]['name']) . ($this->products[$i]['model'] != '' ? ' (' . nl2br($this->products[$i]['model']) . ') ' : '') . "\n" . '<nobr>' . '<small><em> ' . nl2br($this->products_ordered_attributes) . '</em></small>' . '</nobr>' . '</td>' . "\n" . '<td class="product-details-num" valign="top" align="right">' . $currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) . ($this->products[$i]['onetime_charges'] != 0 ? '</td></tr>' . "\n" . '<tr><td class="product-details">' . nl2br(TEXT_ONETIME_CHARGES_EMAIL) . '</td>' . "\n" . '<td>' . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') . '</td></tr>' . "\n"; } $order_total_modules->apply_credit(); //ICW ADDED FOR CREDIT CLASS SYSTEM $this->notify('NOTIFY_ORDER_AFTER_ORDER_CREATE_ADD_PRODUCTS'); }
/** * Used to void a given previously-authorized transaction. */ function _doVoid($oID, $note = '') { global $db, $messageStack; $new_order_status = (int) MODULE_PAYMENT_AUTHORIZENET_ECHECK_REFUNDED_ORDER_STATUS_ID; if ($new_order_status == 0) { $new_order_status = 1; } $voidNote = strip_tags(zen_db_input($_POST['voidnote'] . $note)); $voidAuthID = trim(strip_tags(zen_db_input($_POST['voidauthid']))); $proceedToVoid = true; if (isset($_POST['ordervoid']) && $_POST['ordervoid'] == MODULE_PAYMENT_AUTHORIZENET_ECHECK_ENTRY_VOID_BUTTON_TEXT) { if (isset($_POST['voidconfirm']) && $_POST['voidconfirm'] != 'on') { $messageStack->add_session(MODULE_PAYMENT_AUTHORIZENET_ECHECK_TEXT_VOID_CONFIRM_ERROR, 'error'); $proceedToVoid = false; } } if ($voidAuthID == '') { $messageStack->add_session(MODULE_PAYMENT_AUTHORIZENET_ECHECK_TEXT_TRANS_ID_REQUIRED_ERROR, 'error'); $proceedToVoid = false; } // Populate an array that contains all of the data to be sent to gateway $submit_data = array('x_type' => 'VOID', 'x_trans_id' => trim($voidAuthID)); /** * Submit void request to Gateway */ if ($proceedToVoid) { $response = $this->_sendRequest($submit_data); $response_code = $response[0]; $response_text = $response[3]; $response_alert = $response_text . ($this->commError == '' ? '' : ' Communications Error - Please notify webmaster.'); $this->reportable_submit_data['Note'] = $voidNote; $this->_debugActions($response); if ($response_code != '1' || $response[0] == 1 && $response[2] == 310) { $messageStack->add_session($response_alert, 'error'); } else { // Success, so save the results $sql_data_array = array('orders_id' => (int) $oID, 'orders_status_id' => (int) $new_order_status, 'date_added' => 'now()', 'comments' => 'VOIDED. Trans ID: ' . $response[6] . ' ' . $response[4] . "\n" . $voidNote, 'customer_notified' => 0); zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); $db->Execute("update " . TABLE_ORDERS . "\n set orders_status = '" . (int) $new_order_status . "'\n where orders_id = '" . (int) $oID . "'"); $messageStack->add_session(sprintf(MODULE_PAYMENT_AUTHORIZENET_ECHECK_TEXT_VOID_INITIATED, $response[6], $response[4]), 'success'); return true; } } return false; }