<?php cw_load('category', 'image', 'user', 'group_edit', 'attributes'); $saved_category =& cw_session_register('saved_category'); $file_upload_data =& cw_session_register('file_upload_data'); $top_message =& cw_session_register('top_message', array()); cw_image_clear(array('categories_images_thumb')); if ($ge_id && cw_group_edit_count($ge_id) == 0) { $ge_id = false; } if ($action == 'update') { $rules = array('category' => ''); $category_update['attributes'] = $attributes; $fillerror = cw_error_check($category_update, $rules, 'C'); if ($fillerror) { $top_message = array('content' => $fillerror, 'type' => 'E'); $saved_category = $category_update; if ($file_upload_data['categories_images_thumb']) { $file_upload_data['categories_images_thumb']['is_redirect'] = false; $saved_category['image'] = $file_upload_data['categories_images_thumb']; } cw_header_location("index.php?target={$target}&mode={$mode}&cat={$cat}&ge_id={$ge_id}"); } if ($mode == 'add') { $cat = cw_array2insert('categories', array('parent_id' => $cat)); cw_category_update_path($cat); } $update_fields = array('category', 'description', 'featured', 'order_by', 'short_list'); array_push($update_fields, 'meta_descr', 'meta_keywords'); if ($edited_language != $config['default_admin_language']) { cw_unset($update_fields, 'category', 'description');
<?php $presaved_content_section =& cw_session_register('presaved_content_section', array()); $file_upload_data =& cw_session_register('file_upload_data'); $top_message =& cw_session_register('top_message'); cw_load('category', 'image', 'attributes', 'files'); cw_image_clear(array('cms_images')); if ($REQUEST_METHOD == 'POST') { switch ($action) { case 'update_content_section': case 'add_new_content_section': if ($action == 'update_content_section' && empty($contentsection_id)) { cw_header_location('index.php?target=cms&mode=add'); } if (!empty($content_section) && is_array($content_section)) { //$content_section = array_map('trim', $content_section); cw_core_process_date_fields($content_section, array(0 => array('start_date' => 0, 'end_date' => 1))); $content_section['orderby'] = intval($content_section['orderby']); $content_section['display_on_404'] = empty($content_section['display_on_404']) ? 'N' : 'Y'; $content_section['active'] = empty($content_section['active']) ? 'N' : 'Y'; $content_section['parse_smarty_tags'] = !empty($content_section['parse_smarty_tags']); $presaved_content_section = $content_section; /* * Validation */ cw_include('include/lib/formvalidator/formvalidator.php', INCLUDE_NO_GLOBALS); // Errors $validator = new FormValidator(); $validator->addValidation("service_code", "req", cw_get_langvar_by_name('msg_ab_err_servicecode_is_empty')); $validator->addValidation("service_code", "varname", cw_get_langvar_by_name('msg_ab_err_wrong_servicecode_format')); if (!$validator->ValidateForm($content_section)) {
<?php cw_load('image', 'attributes'); $file_upload_data =& cw_session_register('file_upload_data'); $search_data =& cw_session_register('search_data', array()); $saved_manufacturer =& cw_session_register('saved_manufacturer', array()); cw_image_clear(array('manufacturer_images')); $top_message =& cw_session_register('top_message', array()); if ($action == 'search') { $search_data['manufacturers']['substring'] = $posted_data['substring']; cw_header_location('index.php?target=' . $target); } if ($action == 'details') { $rules = array('manufacturer' => ''); $manufacturer_update['attributes'] = $attributes; $fillerror = cw_error_check($manufacturer_update, $rules, 'M'); if ($fillerror) { $top_message = array('content' => $fillerror, 'type' => 'E'); $saved_manufacturer = $manufacturer_update; cw_header_location("index.php?target={$target}&" . ($manufacturer_id ? "manufacturer_id={$manufacturer_id}" : 'mode=add')); } $to_update = array('manufacturer' => $manufacturer_update['manufacturer'], 'url' => $manufacturer_update['url'], 'descr' => $manufacturer_update['descr'], 'featured' => $manufacturer_update['featured'], 'avail' => $manufacturer_update['avail'], 'orderby' => $manufacturer_update['orderby'], 'show_image' => $manufacturer_update['show_image']); $to_update_lng = array('manufacturer_id' => $manufacturer_id, 'code' => $edited_language, 'descr' => $manufacturer_update['descr'], 'manufacturer' => $manufacturer_update['manufacturer']); if ($edited_language != $config['default_admin_language'] && $manufacturer_id) { cw_unset($to_update, 'manufacturer', 'descr'); } if (!$manufacturer_id) { $top_message['content'] = cw_get_langvar_by_name("msg_adm_err_manufacturer_add"); $manufacturer_id = cw_array2insert('manufacturers', $to_update); $to_update_lng['manufacturer_id'] = $manufacturer_id; } else {
<?php global $action, $mode, $current_area; cw_load('image'); $file_upload_data =& cw_session_register('file_upload_data'); cw_image_clear(array('customers_images')); if ($action == 'delete_photos' && !empty($user_image_id)) { cw_image_delete($user_image_id, 'customers_images'); } if ($action == 'customer_images') { if (cw_image_check_posted($file_upload_data['customers_images'])) { $images = cw_image_get_list('customers_images', $user); if (is_array($images)) { foreach ($images as $image) { cw_image_delete($image['image_id'], 'customers_images'); } } cw_image_save($file_upload_data['customers_images'], array('id' => $user)); } } if ($current_area == 'C') { cw_header_location("index.php?target={$target}"); } else { cw_header_location("index.php?target={$target}&mode=modify&user={$user}"); }
global $mode, $offer_id, $bonus_id, $cond_id, $action; global $file_upload_data; $mode = (string) $mode; $action = (string) $action; $offer_id = (int) $offer_id; $bonus_id = (int) $bonus_id; $cond_id = (int) $cond_id; $addon_modes = array(); $addon_actions = array('update' => 'ps_update', 'add' => 'ps_modify', 'delete' => 'ps_delete', 'details' => 'ps_details', 'modify' => 'ps_modify', 'form' => 'ps_form', 'delete_image' => 'ps_delete_image', 'coupons' => 'ps_get_coupons_ajax', 'zones' => 'ps_get_zones_ajax', 'attributes' => 'ps_get_attr_ajax'); global $available_fields, $optional_fields, $skip_striptags_fields, $date_fields; $available_fields = array('offer_id' => 'int', 'title' => 'string', 'description' => 'string', 'position' => 'int', 'priority' => 'int', 'startdate' => 'int', 'enddate' => 'int', 'exclusive' => 'bool', 'active' => 'bool', 'repeatable' => 'int'); $optional_fields = array('image', 'active', 'position', 'exclusive', 'priority'); $date_fields = array('startdate', 'enddate'); $skip_striptags_fields = array('description'); cw_load('image', 'attributes'); cw_image_clear(array(PS_IMG_TYPE)); $location[] = array(cw_get_langvar_by_name('lbl_ps_manage_offers'), ''); $smarty->assign('main', 'promosuite'); $smarty->assign('mode', $mode); if (!function_exists('sort_zone_elements')) { function sort_zone_elements($a, $b) { static $sort_order; $sort_order = array_flip(array("C", "S", "G", "T", "Z", "A")); if ($sort_order[$a['element_type']] > $sort_order[$b['element_type']]) { return 1; } else { return 0; } } }
<?php require_once $app_main_dir . '/addons/detailed_product_images/func.php'; cw_image_clear(array('products_detailed_images')); global $file_upload_data, $product_id, $top_message, $image, $iids, $action, $image_id, $ge_id, $fields; if ($action == 'product_images' && is_array($file_upload_data['products_detailed_images'])) { foreach ($file_upload_data['products_detailed_images'] as $image) { $image_posted = cw_image_check_posted($image); if ($image_posted) { $image_id = cw_image_save($image, array('alt' => $alt, 'id' => $product_id)); if ($ge_id && $fields['new_d_image']) { $data = cw_query_first("select * from {$tables['products_detailed_images']} where id = '{$product_id}' AND image_id = '{$image_id}'"); unset($data['image_id']); $data = cw_array_map("addslashes", $data); while ($pid = cw_group_edit_each($ge_id, 1, $product_id)) { $id = cw_query_first_cell("select image_id FROM {$tables['products_detailed_images']} WHERE id = '{$pid}' AND md5 = '{$data['md5']}'"); if (!empty($id)) { cw_image_delete($id, 'products_detailed_images', true); } $data['id'] = $pid; cw_array2insert("products_detailed_images", $data); } } } } $top_message = array('content' => cw_get_langvar_by_name('msg_adm_product_images_add'), 'type' => 'I'); cw_dpi_refresh($product_id, 'dpi'); } $image = $_POST['image']; if ($action == 'update_availability' && !empty($image)) { foreach ($image as $key => $value) {
<?php cw_load('product'); $search_variants =& cw_session_register('search_variants'); cw_image_clear(array('products_images_var')); if ($action == 'product_variants_modify' && $vs) { // cw_log_add('mass_update_test',array($vids,$vs,$set_mass_apply,$mass_apply)); if (!empty($set_mass_apply) && !empty($vids)) { foreach ($set_mass_apply as $field2update => $digit_flg) { foreach ($vids as $sel_vid) { if (isset($vs[$sel_vid][$field2update])) { $vs[$sel_vid][$field2update] = $mass_apply[$field2update]; } } } } // cw_log_add('mass_update_test',array($vs)); if (is_array($vs)) { foreach ($vs as $k => $v) { if (AREA_TYPE == 'P') { $insert = array(); $insert['avail'] = cw_convert_number($v['avail']); $insert['warehouse_customer_id'] = $user_account['warehouse_customer_id']; $insert['variant_id'] = $k; $insert['product_id'] = $product_id; cw_warehouse_insert_avail($insert, true); continue; } $v['price'] = cw_convert_number($v['price']); $v['weight'] = cw_convert_number($v['weight']); $v['cost'] = cw_convert_number($v['cost']);
<?php cw_load('attributes', 'image'); $attribute_modified_data =& cw_session_register('attribute_modified_data'); $attribute_class_modified_data =& cw_session_register('attribute_class_modified_data'); $top_message =& cw_session_register('top_message'); $file_upload_data =& cw_session_register('file_upload_data'); $search_data =& cw_session_register('search_data', array()); cw_image_clear(array('attributes_images')); if ($action == 'modify_att') { $attribute = null; if ($posted_data['attribute_id']) { $attribute = cw_func_call('cw_attributes_get_attribute', array('attribute_id' => $posted_data['attribute_id'], 'language' => $edited_language)); } foreach ($attribute as $field => $value) { if (!is_array($value) && !isset($posted_data[$field])) { $posted_data[$field] = addslashes($value); } } if ($attribute['protection'] & ATTR_PROTECTION_FIELD) { $posted_data['field'] = $attribute['field']; } if ($attribute['protection'] & ATTR_PROTECTION_VALUES) { if ($attribute['default_value']) { foreach ($attribute['default_value'] as $k => $v) { $posted_data['default_value'][$k] = $v; } } // Protection of values means protection of type too $attribute['protection'] = $attribute['protection'] | ATTR_PROTECTION_TYPE; }
<?php $file_upload_data =& cw_session_register('file_upload_data'); cw_image_clear(array('magnifier_images')); if ($action == 'product_zoomer') { cw_load('magnifier'); foreach ($file_upload_data['magnifier_images'] as $image) { $image_posted = cw_image_check_posted($image); if ($image_posted) { $image_id = cw_image_save($image, array('id' => $product_id)); $image = cw_image_get('magnifier_images', $image_id); $dir_name = cw_magnifier_create($image['image_path'], $image_id); db_query("update {$tables['magnifier_images']} set image_path='{$dir_name}/TileGroup0/0-0-0.jpg' where image_id='{$image_id}'"); } } $top_message['content'] = cw_get_langvar_by_name('msg_adm_images_added_4zoomer'); cw_refresh($product_id, 'zoomer'); } if ($action == "zoomer_update_availability" && !empty($zoomer_image)) { # Update images foreach ($zoomer_image as $key => $value) { db_query("UPDATE {$tables['magnifier_images']} SET orderby='" . $value['orderby'] . "', avail='" . $value['avail'] . "' WHERE image_id='{$key}'"); } $top_message['content'] = cw_get_langvar_by_name("msg_adm_images_updated_4zoomer"); cw_refresh($product_id, 'zoomer'); } if ($action == "product_zoomer_delete") { if (!empty($iids)) { foreach ($iids as $image_id => $tmp) { cw_image_delete($image_id, 'magnifier_images'); }
<?php cw_load('in_images'); $file_upload_data =& cw_session_register('file_upload_data'); cw_image_clear(array('webmaster_images')); if ($action) { list($action, $id) = explode('_', $action, 2); } if ($action == 'delete') { cw_image_delete($id, 'webmaster_images'); cw_header_location('index.php?target=' . $target); } if ($action == 'update') { if (is_array($file_upload_data['webmaster_images'])) { foreach ($file_upload_data['webmaster_images'] as $image) { if (cw_image_check_posted($image)) { cw_image_save($image); } } } if (is_array($image_data)) { foreach ($image_data as $key => $val) { cw_array2update('webmaster_images', $val, "id='{$key}'"); } } cw_header_location('index.php?target=' . $target); } $images_to_upload = cw_in_images_get_list(); foreach ($images_to_upload as $key => $val) { $image_id = cw_in_images_get_id($key); $in_images[$val['name']] = cw_in_images_get_image_info($image_id, $val['name']);
<?php $last_added_product_type =& cw_session_register('last_added_product_type'); cw_load('category', 'image', 'product', 'warehouse', 'user', 'serials', 'group_edit', 'ean', 'xls', 'attributes', 'tags'); if (!$product_id && $current_area != 'A' && $current_area != 'V') { cw_header_location('index.php'); } $file_upload_data =& cw_session_register('file_upload_data'); cw_image_clear(array('products_images_det', 'products_images_thumb')); $__ge_res = false; $top_message =& cw_session_register('top_message', array()); $product_modified_data =& cw_session_register('product_modified_data'); function cw_refresh($product_id, $js_tab = '', $added = '') { global $ge_id, $target; if (!empty($js_tab)) { $js_tab = "&js_tab=" . $js_tab; } if (!empty($ge_id)) { $redirect_ge_id = "&ge_id=" . $ge_id; } if ($product_id) { cw_header_location("index.php?target={$target}&mode=details&product_id=" . $product_id . $redirect_ge_id . $js_tab . $added); } else { cw_header_location("index.php?target={$target}&mode=add"); } } if ($ge_id && cw_group_edit_count($ge_id) == 0) { $ge_id = false; } global $product_info;