本文整理汇总了PHP中smn_db_perform函数的典型用法代码示例。如果您正苦于以下问题:PHP smn_db_perform函数的具体用法?PHP smn_db_perform怎么用?PHP smn_db_perform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smn_db_perform函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: affiliate_insert
function affiliate_insert($sql_data_array, $affiliate_parent = 0)
{
// LOCK TABLES
smn_db_query("LOCK TABLES " . TABLE_AFFILIATE . " WRITE");
if ($affiliate_parent > 0) {
$affiliate_root_query = smn_db_query("select affiliate_root, affiliate_rgt, affiliate_lft�from " . TABLE_AFFILIATE . " where affiliate_id = '" . $affiliate_parent . "' ");
// Check if we have a parent affiliate
if ($affiliate_root_array = smn_db_fetch_array($affiliate_root_query)) {
smn_db_query("update " . TABLE_AFFILIATE . " SET affiliate_lft = affiliate_lft + 2 WHERE affiliate_root = '" . $affiliate_root_array['affiliate_root'] . "' and affiliate_lft > " . $affiliate_root_array['affiliate_rgt'] . " AND affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " ");
smn_db_query("update " . TABLE_AFFILIATE . " SET affiliate_rgt = affiliate_rgt + 2 WHERE affiliate_root = '" . $affiliate_root_array['affiliate_root'] . "' and affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " ");
$sql_data_array['affiliate_root'] = $affiliate_root_array['affiliate_root'];
$sql_data_array['affiliate_lft'] = $affiliate_root_array['affiliate_rgt'];
$sql_data_array['affiliate_rgt'] = $affiliate_root_array['affiliate_rgt'] + 1;
smn_db_perform(TABLE_AFFILIATE, $sql_data_array);
$affiliate_id = smn_db_insert_id();
}
// no parent -> new root
} else {
$sql_data_array['affiliate_lft'] = '1';
$sql_data_array['affiliate_rgt'] = '2';
smn_db_perform(TABLE_AFFILIATE, $sql_data_array);
$affiliate_id = smn_db_insert_id();
smn_db_query("update " . TABLE_AFFILIATE . " set affiliate_root = '" . $affiliate_id . "' where affiliate_id = '" . $affiliate_id . "' ");
}
// UNLOCK TABLES
smn_db_query("UNLOCK TABLES");
return $affiliate_id;
}
示例2: create
function create($customers_id = 0)
{
//if customer is 0, then is a new account...(needs to be added in for editing)
//add data for table customers which hold most of the primary customers info
$sql_data_array = array('customers_firstname' => $this->firstname, 'customers_lastname' => $this->lastname, 'customers_email_address' => $this->email_address, 'customers_telephone' => $this->telephone, 'customers_fax' => $this->fax, 'customers_newsletter' => $this->newsletter, 'customers_gender' => $this->gender, 'customers_dob' => $this->dob);
if ($customers_id == 0) {
$sql_data_array['customers_password'] = $this->password;
smn_db_perform(TABLE_CUSTOMERS, $sql_data_array);
$this->customer_id = smn_db_insert_id();
//primary KEY for customer
} else {
smn_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', 'customers_id=' . (int) $customers_id);
$this->customer_id = (int) $customers_id;
}
//start building array for adress book entries using the default address given on sign up
$sql_data_array = array('customers_id' => $this->customer_id, 'entry_firstname' => $this->firstname, 'entry_lastname' => $this->lastname, 'entry_company' => $this->company, 'entry_street_address' => $this->street_address, 'entry_postcode' => $this->postcode, 'entry_city' => $this->city, 'entry_country_id' => $this->country_id, 'entry_gender' => $this->gender, 'entry_zone_id' => $this->zone_id, 'entry_state' => $this->state);
if ($customers_id == 0) {
smn_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
$this->address_id = smn_db_insert_id();
smn_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int) $this->address_id . "' where customers_id = '" . (int) $this->customer_id . "'");
smn_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int) $this->customer_id . "', '0', now())");
} else {
smn_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', 'customers_id=' . (int) $customers_id);
smn_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int) $customer_id . "'");
}
if (SESSION_RECREATE == 'True') {
smn_session_recreate();
}
return $this->customer_id;
}
示例3: store_category
function store_category($action)
{
if (isset($_POST['store_categories_id'])) {
$store_categories_id = smn_db_prepare_input($_POST['store_categories_id']);
}
$sort_order = smn_db_prepare_input($_POST['sort_order']);
$sql_data_array = array('sort_order' => $sort_order);
if ($action == 'insert_store_category') {
$insert_sql_data = array('store_parent_id' => (int) $current_store_category_id, 'date_added' => 'now()');
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
smn_db_perform(TABLE_STORE_CATEGORIES, $sql_data_array);
$store_categories_id = smn_db_insert_id();
} elseif ($action == 'update_store_category') {
$update_sql_data = array('last_modified' => 'now()');
$sql_data_array = array_merge($sql_data_array, $update_sql_data);
smn_db_perform(TABLE_STORE_CATEGORIES, $sql_data_array, 'update', "store_categories_id = '" . (int) $store_categories_id . "'");
}
$languages = smn_get_languages();
$sizeof_languages = sizeof($languages);
$store_categories_name_array = $_POST['store_categories_name'];
$store_categories_description_array = $_POST['store_categories_description'];
for ($i = 0, $n = $sizeof_languages; $i < $n; $i++) {
$language_id = $languages[$i]['id'];
$sql_data_array = array('store_categories_description' => smn_db_prepare_input($store_categories_description_array[$language_id]), 'store_categories_name' => smn_db_prepare_input($store_categories_name_array[$language_id]));
if ($action == 'insert_store_category') {
$insert_sql_data = array('store_categories_id' => (int) $store_categories_id, 'language_id' => $languages[$i]['id']);
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
smn_db_perform(TABLE_STORE_CATEGORIES_DESCRIPTION, $sql_data_array);
} elseif ($action == 'update_store_category') {
smn_db_perform(TABLE_STORE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "store_categories_id = '" . (int) $store_categories_id . "' and language_id = '" . (int) $languages[$i]['id'] . "'");
}
}
if (isset($_FILES['store_categories_image']) && is_array($_FILES['store_categories_image']) && $_FILES['store_categories_image']['size'] > 0) {
if ($store_categories_image = new upload('store_categories_image', DIR_FS_CATALOG_IMAGES)) {
smn_db_query("update " . TABLE_STORE_CATEGORIES . " set store_categories_image = '" . smn_db_input($store_categories_image->filename) . "' where store_categories_id = '" . (int) $store_categories_id . "'");
}
}
if (USE_CACHE == 'true') {
smn_reset_cache_block('store_categories');
smn_reset_cache_block('also_purchased');
}
smn_redirect(smn_href_link(FILENAME_MANAGEMENT, 'sPath=' . $sPath . '&cID=' . $store_categories_id));
}
示例4: array
$entry_state = '';
}
$sql_data_array = array('entry_firstname' => $customers_firstname, 'entry_lastname' => $customers_lastname, 'entry_street_address' => $entry_street_address, 'entry_postcode' => $entry_postcode, 'entry_city' => $entry_city, 'entry_country_id' => $entry_country_id);
if (ACCOUNT_COMPANY == 'true') {
$sql_data_array['entry_company'] = $entry_company;
}
if (ACCOUNT_STATE == 'true') {
if ($entry_zone_id > 0) {
$sql_data_array['entry_zone_id'] = $entry_zone_id;
$sql_data_array['entry_state'] = '';
} else {
$sql_data_array['entry_zone_id'] = '0';
$sql_data_array['entry_state'] = $entry_state;
}
}
smn_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int) $customers_id . "' and address_book_id = '" . (int) $default_address_id . "'");
smn_redirect(smn_href_link(FILENAME_CUSTOMERS, smn_get_all_get_params(array('cID', 'action')) . 'cID=' . $customers_id));
} else {
if ($error == true) {
$cInfo = new objectInfo($_POST);
$processed = true;
}
}
break;
case 'cvs_set':
$customers_id_query = smn_db_query("select count(*) as last_value from " . TABLE_CUSTOMERS);
$customers_id_total = smn_db_fetch_array($customers_id_query);
$last_customers_id = $customers_id_total['last_value'];
$orders_statuses = array();
$orders_status_array = array();
$orders_status_query = smn_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . $languages_id . "'");
示例5: smn_db_prepare_input
$currency_id = smn_db_prepare_input($_GET['cID']);
}
$title = smn_db_prepare_input($_POST['title']);
$code = smn_db_prepare_input($_POST['code']);
$symbol_left = smn_db_prepare_input($_POST['symbol_left']);
$symbol_right = smn_db_prepare_input($_POST['symbol_right']);
$decimal_point = smn_db_prepare_input($_POST['decimal_point']);
$thousands_point = smn_db_prepare_input($_POST['thousands_point']);
$decimal_places = smn_db_prepare_input($_POST['decimal_places']);
$value = smn_db_prepare_input($_POST['value']);
$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') {
smn_db_perform(TABLE_CURRENCIES, $sql_data_array);
$currency_id = smn_db_insert_id();
} elseif ($action == 'save') {
smn_db_perform(TABLE_CURRENCIES, $sql_data_array, 'update', "currencies_id = '" . (int) $currency_id . "'");
}
if (isset($_POST['default']) && $_POST['default'] == 'on') {
smn_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . smn_db_input($code) . "' where configuration_key = 'DEFAULT_CURRENCY'");
}
smn_redirect(smn_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page'] . '&cID=' . $currency_id));
break;
case 'deleteconfirm':
$currencies_id = smn_db_prepare_input($_GET['cID']);
$currency_query = smn_db_query("select currencies_id from " . TABLE_CURRENCIES . " where code = '" . DEFAULT_CURRENCY . "'");
$currency = smn_db_fetch_array($currency_query);
if ($currency['currencies_id'] == $currencies_id) {
smn_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '' where configuration_key = 'DEFAULT_CURRENCY'");
}
smn_db_query("delete from " . TABLE_CURRENCIES . " where currencies_id = '" . (int) $currencies_id . "'");
smn_redirect(smn_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page']));
示例6: smn_not_null
if ($banners_image->parse() == false || $banners_image->save() == false) {
$banner_error = true;
}
}
}
if ($banner_error == false) {
$db_image_location = smn_not_null($banners_image_local) && $_POST['delete_current_image'] != 1 ? $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, 'categories_id' => $categories_id, 'banners_html_text' => $banners_html_text);
if ($action == 'insert') {
$insert_sql_data = array('date_added' => 'now()', 'status' => '1');
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
smn_db_perform(TABLE_BANNERS, $sql_data_array);
$banners_id = smn_db_insert_id();
$messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success');
} elseif ($action == 'update') {
smn_db_perform(TABLE_BANNERS, $sql_data_array, 'update', "banners_id = '" . (int) $banners_id . "'");
$messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success');
}
if (smn_not_null($expires_date)) {
list($day, $month, $year) = explode('/', $expires_date);
$expires_date = $year . (strlen($month) == 1 ? '0' . $month : $month) . (strlen($day) == 1 ? '0' . $day : $day);
smn_db_query("update " . TABLE_BANNERS . " set expires_date = '" . smn_db_input($expires_date) . "', expires_impressions = null where banners_id = '" . (int) $banners_id . "'");
} elseif (smn_not_null($expires_impressions)) {
smn_db_query("update " . TABLE_BANNERS . " set expires_impressions = '" . smn_db_input($expires_impressions) . "', expires_date = null where banners_id = '" . (int) $banners_id . "'");
}
if (smn_not_null($date_scheduled)) {
list($day, $month, $year) = explode('/', $date_scheduled);
$date_scheduled = $year . (strlen($month) == 1 ? '0' . $month : $month) . (strlen($day) == 1 ? '0' . $day : $day);
smn_db_query("update " . TABLE_BANNERS . " set status = '0', date_scheduled = '" . smn_db_input($date_scheduled) . "' where banners_id = '" . (int) $banners_id . "'");
}
smn_redirect(smn_href_link(FILENAME_BANNER_MANAGER, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'bID=' . $banners_id));
示例7: smn_get_languages
$languages = smn_get_languages();
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$language_id = $languages[$i]['id'];
$sql_data_array = array('products_name' => smn_db_prepare_input($_POST['products_name'][$language_id]),
'products_description' => $_POST['products_description'][$language_id],
'products_url' => smn_db_prepare_input($_POST['products_url'][$language_id]),
'products_head_title_tag' => $_POST['products_head_title_tag'][$language_id],
'products_head_desc_tag' => $_POST['products_head_desc_tag'][$language_id],
'products_head_keywords_tag' => $_POST['products_head_keywords_tag'][$language_id]);
if (($action == 'insert_product') && ($allow_insert == 'true')) {
$insert_sql_data = array('products_id' => $products_id,
'language_id' => $language_id);
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
smn_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
} elseif ($action == 'update_store_product') {
smn_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
}
}
if (USE_CACHE == 'true') {
smn_reset_cache_block('categories');
smn_reset_cache_block('also_purchased');
}
smn_redirect(html_entity_decode(smn_href_link(FILENAME_STORE_PRODUCT_CATEGORIES, 'cPath=' . $cPath . '&ID='.$store_id.'&pID=' . $products_id)));
}
}
break;
case 'copy_to_confirm':
if (isset($_POST['products_id']) && isset($_POST['categories_id'])) {
$products_id = smn_db_prepare_input($_POST['products_id']);
$categories_id = smn_db_prepare_input($_POST['categories_id']);
if ($_POST['copy_as'] == 'link') {
示例8: sum
$sql = "\n SELECT sum(affiliate_payment) as affiliate_payment\n FROM " . TABLE_AFFILIATE_SALES . " \n WHERE affiliate_id='" . $affiliate_payment['affiliate_id'] . "' and affiliate_billing_status=99 \n ";
$affiliate_billing_query = smn_db_query($sql);
$affiliate_billing = smn_db_fetch_array($affiliate_billing_query);
// Get affiliate Informations
$sql = "\n SELECT a.*, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id \n from " . TABLE_AFFILIATE . " a \n left join " . TABLE_ZONES . " z on (a.affiliate_zone_id = z.zone_id) \n left join " . TABLE_COUNTRIES . " c on (a.affiliate_country_id = c.countries_id)\n WHERE affiliate_id = '" . $affiliate_payment['affiliate_id'] . "' \n ";
$affiliate_query = smn_db_query($sql);
$affiliate = smn_db_fetch_array($affiliate_query);
// Get need tax informations for the affiliate
$affiliate_tax_rate = smn_get_affiliate_tax_rate(AFFILIATE_TAX_ID, $affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id']);
$affiliate_tax = smn_round($affiliate_billing['affiliate_payment'] * $affiliate_tax_rate / 100, 2);
// Netto-Provision
$affiliate_payment_total = $affiliate_billing['affiliate_payment'] + $affiliate_tax;
// Bill the order
$affiliate['affiliate_state'] = smn_get_zone_code($affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id'], $affiliate['affiliate_state']);
$sql_data_array = array('affiliate_id' => $affiliate_payment['affiliate_id'], 'affiliate_payment' => $affiliate_billing['affiliate_payment'], 'affiliate_payment_tax' => $affiliate_tax, 'affiliate_payment_total' => $affiliate_payment_total, 'affiliate_payment_date' => 'now()', 'affiliate_payment_status' => '0', 'affiliate_firstname' => $affiliate['affiliate_firstname'], 'affiliate_lastname' => $affiliate['affiliate_lastname'], 'affiliate_street_address' => $affiliate['affiliate_street_address'], 'affiliate_suburb' => $affiliate['affiliate_suburb'], 'affiliate_city' => $affiliate['affiliate_city'], 'affiliate_country' => $affiliate['countries_name'], 'affiliate_postcode' => $affiliate['affiliate_postcode'], 'affiliate_company' => $affiliate['affiliate_company'], 'affiliate_state' => $affiliate['affiliate_state'], 'affiliate_address_format_id' => $affiliate['address_format_id']);
smn_db_perform(TABLE_AFFILIATE_PAYMENT, $sql_data_array);
$insert_id = smn_db_insert_id();
// Set the Sales to Final State
smn_db_query("update " . TABLE_AFFILIATE_SALES . " set affiliate_payment_id = '" . $insert_id . "', affiliate_billing_status = 1, affiliate_payment_date = now() where affiliate_id = '" . $affiliate_payment['affiliate_id'] . "' and affiliate_billing_status = 99");
// Notify Affiliate
if (AFFILIATE_NOTIFY_AFTER_BILLING == 'true') {
$check_status_query = smn_db_query("select af.affiliate_email_address, ap.affiliate_lastname, ap.affiliate_firstname, ap.affiliate_payment_status, ap.affiliate_payment_date, ap.affiliate_payment_date from " . TABLE_AFFILIATE_PAYMENT . " ap, " . TABLE_AFFILIATE . " af where affiliate_payment_id = '" . $insert_id . "' and af.affiliate_id = ap.affiliate_id ");
$check_status = smn_db_fetch_array($check_status_query);
$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_AFFILIATE_PAYMENT_NUMBER . ' ' . $insert_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . smn_catalog_href_link(FILENAME_CATALOG_AFFILIATE_PAYMENT_INFO, 'payment_id=' . $insert_id, 'NONSSL') . "\n" . EMAIL_TEXT_PAYMENT_BILLED . ' ' . smn_date_long($check_status['affiliate_payment_date']) . "\n\n" . EMAIL_TEXT_NEW_PAYMENT;
smn_mail($check_status['affiliate_firstname'] . ' ' . $check_status['affiliate_lastname'], $check_status['affiliate_email_address'], EMAIL_TEXT_SUBJECT, nl2br($email), STORE_OWNER, AFFILIATE_EMAIL_ADDRESS);
}
}
$messageStack->add_session(SUCCESS_BILLING, 'success');
smn_redirect(smn_href_link(FILENAME_AFFILIATE_PAYMENT, smn_get_all_get_params(array('action')) . 'action=edit'));
break;
case 'update_payment':
示例9: foreach
} else {
if (smn_not_null(MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL)) {
$email_body = '$_POST:' . "\n\n";
foreach ($_POST as $key => $value) {
$email_body .= $key . '=' . $value . "\n";
}
$email_body .= "\n" . '$_GET:' . "\n\n";
foreach ($_GET as $key => $value) {
$email_body .= $key . '=' . $value . "\n";
}
smn_mail('', MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL, 'PayPal IPN Invalid Process', $email_body, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}
if (isset($_POST['invoice']) && is_numeric($_POST['invoice']) && $_POST['invoice'] > 0) {
$invoice_query = smn_db_query("select orders_id from " . TABLE_ORDERS_INVOICE . " where orders_invoice_id = '" . $_POST['invoice'] . "'");
while ($invoice_id = smn_db_fetch_array($invoice_query)) {
$check_query = smn_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . $invoice_id . "' and customers_id = '" . (int) $_POST['custom'] . "'");
if (smn_db_num_rows($check_query) > 0) {
$comment_status = $_POST['payment_status'];
if ($_POST['payment_status'] == 'Pending') {
$comment_status .= '; ' . $_POST['pending_reason'];
} elseif ($_POST['payment_status'] == 'Reversed' || $_POST['payment_status'] == 'Refunded') {
$comment_status .= '; ' . $_POST['reason_code'];
}
smn_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID > 0 ? MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID : DEFAULT_ORDERS_STATUS_ID) . "', last_modified = now() where orders_id = '" . $invoice_id . "'");
$sql_data_array = array('orders_id' => $invoice_id, 'orders_status_id' => MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID > 0 ? MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID : DEFAULT_ORDERS_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => 'PayPal IPN Invalid [' . $comment_status . ']');
smn_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
}
}
}
}
require 'includes/application_bottom.php';
示例10: array
}
$sql_data_array = array('affiliate_banners_title' => $affiliate_banners_title, 'affiliate_products_id' => $affiliate_products_id, 'affiliate_banners_image' => $db_image_location, 'affiliate_banners_group' => $affiliate_banners_group);
if ($_GET['action'] == 'insert') {
$insert_sql_data = array('affiliate_date_added' => 'now()', 'affiliate_status' => '1');
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
smn_db_perform(TABLE_AFFILIATE_BANNERS, $sql_data_array);
$affiliate_banners_id = smn_db_insert_id();
// Banner ID 1 is generic Product Banner
if ($affiliate_banners_id == 1) {
smn_db_query("update " . TABLE_AFFILIATE_BANNERS . " set affiliate_banners_id = affiliate_banners_id + 1");
}
$messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success');
} elseif ($_GET['action'] == 'update') {
$insert_sql_data = array('affiliate_date_status_change' => 'now()');
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
smn_db_perform(TABLE_AFFILIATE_BANNERS, $sql_data_array, 'update', 'affiliate_banners_id = \'' . $affiliate_banners_id . '\'');
$messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success');
}
smn_redirect(smn_href_link(FILENAME_AFFILIATE_BANNER_MANAGER, 'selected_box=affiliate&page=' . $_GET['page'] . '&abID=' . $affiliate_banners_id));
} else {
$_GET['action'] = 'new';
}
break;
case 'deleteconfirm':
$affiliate_banners_id = smn_db_prepare_input($_GET['abID']);
$delete_image = smn_db_prepare_input($_POST['delete_image']);
if ($delete_image == 'on') {
$affiliate_banner_query = smn_db_query("select affiliate_banners_image from " . TABLE_AFFILIATE_BANNERS . " where affiliate_banners_id = '" . smn_db_input($affiliate_banners_id) . "'");
$affiliate_banner = smn_db_fetch_array($affiliate_banner_query);
if (is_file(DIR_FS_CATALOG_IMAGES . $affiliate_banner['affiliate_banners_image'])) {
if (is_writeable(DIR_FS_CATALOG_IMAGES . $affiliate_banner['affiliate_banners_image'])) {
示例11: smn_redirect
if (!smn_validate_password($_POST['password_confirmation'], $check_pass['confirm_password'])) {
smn_redirect(smn_href_link(FILENAME_ADMIN_ACCOUNT, 'action=check_account&error=password'));
} else {
//$confirm = 'confirm_account';
smn_session_register('confirm_account');
$confirm_account = '1';
smn_redirect(smn_href_link(FILENAME_ADMIN_ACCOUNT, 'action=edit_process'));
}
break;
case 'save_account':
$admin_id = smn_db_prepare_input($_POST['id_info']);
$admin_email_address = smn_db_prepare_input($_POST['admin_email_address']);
$stored_email[] = 'NONE';
$check_email_query = smn_db_query("select admin_email_address from " . TABLE_ADMIN . " where admin_id <> " . $admin_id . "");
while ($check_email = smn_db_fetch_array($check_email_query)) {
$stored_email[] = $check_email['admin_email_address'];
}
if (in_array($_POST['admin_email_address'], $stored_email)) {
smn_redirect(smn_href_link(FILENAME_ADMIN_ACCOUNT, 'action=edit_process&error=email'));
} else {
$sql_data_array = array('admin_firstname' => smn_db_prepare_input($_POST['admin_firstname']), 'admin_lastname' => smn_db_prepare_input($_POST['admin_lastname']), 'admin_email_address' => smn_db_prepare_input($_POST['admin_email_address']), 'admin_password' => smn_encrypt_password(smn_db_prepare_input($_POST['admin_password'])), 'admin_modified' => 'now()');
smn_db_perform(TABLE_ADMIN, $sql_data_array, 'update', 'admin_id = \'' . $admin_id . '\'');
smn_mail($_POST['admin_firstname'] . ' ' . $_POST['admin_lastname'], $_POST['check_email_address'], ADMIN_EMAIL_SUBJECT, sprintf(ADMIN_EMAIL_TEXT, $hiddenPassword), $_POST['check_firstname'] . ' ' . $_POST['admin_lastname'], $_POST['check_email_address']);
smn_redirect(smn_href_link(FILENAME_ADMIN_ACCOUNT, 'page=' . $_GET['page'] . '&mID=' . $admin_id));
}
break;
}
}
$content_page = basename($_SERVER['PHP_SELF']);
require 'templates/default/layout.php';
require DIR_WS_INCLUDES . 'application_bottom.php';
示例12: array
$coupon_type = 'S';
$coupon_amount = 0;
}
$sql_data_array = array('coupon_active' => smn_db_prepare_input($_POST['coupon_status']), 'coupon_code' => smn_db_prepare_input($_POST['coupon_code']), 'store_id' => $store_id, 'coupon_amount' => smn_db_prepare_input($coupon_amount), 'coupon_type' => smn_db_prepare_input($coupon_type), 'uses_per_coupon' => smn_db_prepare_input($_POST['coupon_uses_coupon']), 'uses_per_user' => smn_db_prepare_input($_POST['coupon_uses_user']), 'coupon_minimum_order' => smn_db_prepare_input($_POST['coupon_min_order']), 'restrict_to_products' => smn_db_prepare_input($_POST['coupon_products']), 'restrict_to_categories' => smn_db_prepare_input($_POST['coupon_categories']), 'coupon_start_date' => $_POST['coupon_startdate'], 'coupon_expire_date' => $_POST['coupon_finishdate'], 'date_created' => $_POST['date_created'] != '0' ? $_POST['date_created'] : 'now()', 'date_modified' => 'now()');
$languages = smn_get_languages();
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
$language_id = $languages[$i]['id'];
$sql_data_marray[$i] = array('coupon_name' => smn_db_prepare_input($_POST['coupon_name'][$language_id]), 'coupon_description' => smn_db_prepare_input($_POST['coupon_desc'][$language_id]));
}
if ($_GET['oldaction'] == 'voucheredit') {
smn_db_perform(TABLE_COUPONS, $sql_data_array, 'update', "store_id = '" . $store_id . "' and coupon_id='" . (int) $coupon_id . "'");
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
$language_id = $languages[$i]['id'];
$update = smn_db_query("update " . TABLE_COUPONS_DESCRIPTION . " set coupon_name = '" . smn_db_prepare_input($_POST['coupon_name'][$language_id]) . "', coupon_description = '" . smn_db_prepare_input($_POST['coupon_desc'][$language_id]) . "' where coupon_id = '" . (int) $coupon_id . "' and store_id = '" . $store_id . "' and language_id = '" . $language_id . "'");
}
} else {
$query = smn_db_perform(TABLE_COUPONS, $sql_data_array);
$insert_id = smn_db_insert_id($query);
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;
$sql_data_marray[$i]['store_id'] = $store_id;
smn_db_perform(TABLE_COUPONS_DESCRIPTION, $sql_data_marray[$i]);
}
}
}
}
$content_page = basename($_SERVER['PHP_SELF']);
require 'templates/default/layout.php';
require DIR_WS_INCLUDES . 'application_bottom.php';
示例13: smn_db_perform
smn_db_perform(TABLE_MANUFACTURERS, $sql_data_array, 'update', "manufacturers_id = '" . (int) $manufacturers_id . "'");
}
if ($manufacturers_image = new upload('manufacturers_image', DIR_FS_CATALOG_IMAGES)) {
smn_db_query("update " . TABLE_MANUFACTURERS . " set manufacturers_image = '" . $manufacturers_image->filename . "' where manufacturers_id = '" . (int) $manufacturers_id . "'");
}
$languages = smn_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' => smn_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);
smn_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array);
} elseif ($action == 'save') {
smn_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array, 'update', "manufacturers_id = '" . (int) $manufacturers_id . "' and languages_id = '" . (int) $language_id . "'");
}
}
if (USE_CACHE == 'true') {
smn_reset_cache_block('manufacturers');
}
smn_redirect(smn_href_link(FILENAME_MANUFACTURERS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'mID=' . $manufacturers_id));
break;
case 'deleteconfirm':
$manufacturers_id = smn_db_prepare_input($_GET['mID']);
if (isset($_POST['delete_image']) && $_POST['delete_image'] == 'on') {
$manufacturer_query = smn_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int) $manufacturers_id . "'");
$manufacturer = smn_db_fetch_array($manufacturer_query);
$image_location = DIR_FS_DOCUMENT_ROOT . DIR_WS_CATALOG_IMAGES . $manufacturer['manufacturers_image'];
if (file_exists($image_location)) {
@unlink($image_location);
示例14: smn_db_perform
smn_db_perform(TABLE_AFFILIATE_NEWS, $sql_data_array);
$news_id = smn_db_insert_id();*/
//not actually used ATM -- just there in case $sql_data_array = array('date_added' => 'now()', //uses the inbuilt mysql function 'now'
$sql_data_array = array('date_added' => 'now()', 'news_status' => '1');
smn_db_perform(TABLE_AFFILIATE_NEWS, $sql_data_array);
$news_id = smn_db_insert_id();
//not actually used ATM -- just there in case
$sql_data_array = array('affiliate_news_id' => $news_id, 'affiliate_news_languages_id' => $languages_id, 'affiliate_news_headlines' => $_POST['headline'], 'affiliate_news_contents' => $_POST['content']);
smn_db_perform(TABLE_AFFILIATE_NEWS_CONTENTS, $sql_data_array);
}
smn_redirect(smn_href_link(FILENAME_AFFILIATE_NEWS));
break;
case 'update_affiliate_news':
//user wants to modify a news article.
if ($_GET['affiliate_news_id']) {
/*Changed the update query to update the news details to affiliate_news_content table by Cimi */
/* $sql_data_array = array('headline' => smn_db_prepare_input($_POST['headline']),
'content' => smn_db_prepare_input($_POST['content']) );
smn_db_perform(TABLE_AFFILIATE_NEWS, $sql_data_array, 'update', "news_id = '" . smn_db_prepare_input($_GET['affiliate_news_id']) . "'");*/
$sql_data_array = array('affiliate_news_headlines' => smn_db_prepare_input($_POST['headline']), 'affiliate_news_contents' => smn_db_prepare_input($_POST['content']));
smn_db_perform(TABLE_AFFILIATE_NEWS_CONTENTS, $sql_data_array, 'update', "affiliate_news_id = '" . smn_db_prepare_input($_GET['affiliate_news_id']) . "'");
}
smn_redirect(smn_href_link(FILENAME_AFFILIATE_NEWS));
break;
}
}
$content_page = basename($_SERVER['PHP_SELF']);
require 'templates/default/layout.php';
require DIR_WS_INCLUDES . 'application_bottom.php';
示例15: array
if (isset($_GET['masterFileID'])) {
$sql_data_array = array('admin_files_name' => smn_db_prepare_input($_GET['fileName']), 'admin_tabs_to_files' => smn_db_prepare_input($_GET['masterFileID']), 'admin_files_is_tab' => '1', 'admin_files_to_boxes' => smn_db_prepare_input($_GET['boxID']));
} else {
$sql_data_array = array('admin_files_name' => smn_db_prepare_input($_GET['fileName']), 'admin_files_to_boxes' => smn_db_prepare_input($_GET['boxID']));
}
smn_db_perform(TABLE_ADMIN_FILES, $sql_data_array);
$masterFileID = smn_db_insert_id();
$tabDir = str_replace('.php', '', $_GET['fileName']);
$directory = DIR_FS_TEMPLATES . 'content/tabs/' . $tabDir . '/';
$tabs = array();
if (is_dir($directory)) {
$dir = dir($directory);
while (($file = $dir->read()) !== false) {
if ($file != '.' && $file != '..' && is_file($directory . $file)) {
$sql_data_array = array('admin_files_name' => smn_db_prepare_input($file), 'admin_files_is_tab' => '1', 'admin_tabs_to_files' => $masterFileID, 'admin_files_to_boxes' => smn_db_prepare_input($_GET['boxID']));
smn_db_perform(TABLE_ADMIN_FILES, $sql_data_array);
$fileID = smn_db_insert_id();
$tabs[] = '["' . $fileID . '", "' . $file . '"]';
}
}
}
echo '{
success: true,
file_id: "' . $masterFileID . '",
tabs: [' . implode(',', $tabs) . ']
}';
} else {
$admin_files_name = smn_db_prepare_input($_GET['fileName']);
$admin_boxes_id = smn_db_prepare_input($_GET['boxID']);
$Qcheck = smn_db_query('select admin_files_id from ' . TABLE_ADMIN_FILES . ' where admin_files_is_boxes = "0" and admin_files_to_boxes = "' . $admin_boxes_id . '" and admin_files_name = "' . $admin_files_name . '"');
if (smn_db_num_rows($Qcheck)) {