Example #1
0
/**
 * START check for existance of various mods
 */
// $ep_supported_mods['psd'] = ep_field_name_exists(TABLE_PRODUCTS_DESCRIPTION,'products_short_desc') ? 'Product Short Descriptions' : NULL; // this will mean if isset, we have it, and the array has the name for html display
$ep_supported_mods['psd'] = ep_field_name_exists(TABLE_PRODUCTS_DESCRIPTION, 'products_short_desc');
// others go here..
/**
 * END check for existance of various mods
 */
if (EASYPOPULATE_CONFIG_ADV_SMART_TAGS == 'true') {
    $smart_tags = array_merge($advanced_smart_tags, $smart_tags);
}
// maximum length for a category in this database
$category_strlen_max = zen_field_length(TABLE_CATEGORIES_DESCRIPTION, 'categories_name');
// model name length error handling
$model_varchar = zen_field_length(TABLE_PRODUCTS, 'products_model');
if (!isset($model_varchar)) {
    $messageStack->add(EASYPOPULATE_MSGSTACK_MODELSIZE_DETECT_FAIL, 'warning');
    $modelsize = 32;
} else {
    $modelsize = $model_varchar;
}
// echo $modelsize;
/**
 * Pre-flight checks finish here
 */
// now to create the file layout for each download type..
// VJ product attributes begin
// this creates our attributes array
$attribute_options_array = array();
if (is_array($attribute_options_select) && count($attribute_options_select) > 0) {
Example #2
0
function zen_set_field_length($tbl, $fld, $max = 70)
{
    $field_length = zen_field_length($tbl, $fld);
    switch (true) {
        case $field_length > $max:
            $length = 'size = "' . ($max + 1) . '" maxlength= "' . $field_length . '"';
            break;
        default:
            $length = 'size = "' . ($field_length + 1) . '" maxlength = "' . $field_length . '"';
            break;
    }
    return $length;
}
        } else {
            $custom_field_check[] = FALSE;
        }
    }
}
// maximum length for a category in this database
$category_strlen_max = zen_field_length(TABLE_CATEGORIES_DESCRIPTION, 'categories_name');
// maximum length for important fields
$categories_name_max_len = zen_field_length(TABLE_CATEGORIES_DESCRIPTION, 'categories_name');
$manufacturers_name_max_len = zen_field_length(TABLE_MANUFACTURERS, 'manufacturers_name');
$products_model_max_len = zen_field_length(TABLE_PRODUCTS, 'products_model');
$products_name_max_len = zen_field_length(TABLE_PRODUCTS_DESCRIPTION, 'products_name');
$products_url_max_len = zen_field_length(TABLE_PRODUCTS_DESCRIPTION, 'products_url');
$artists_name_max_len = zen_field_length(TABLE_RECORD_ARTISTS, 'artists_name');
$record_company_name_max_len = zen_field_length(TABLE_RECORD_COMPANY, 'record_company_name');
$music_genre_name_max_len = zen_field_length(TABLE_MUSIC_GENRE, 'music_genre_name');
$project = PROJECT_VERSION_MAJOR . '.' . PROJECT_VERSION_MINOR;
if ($ep_uses_mysqli) {
    $collation = mysqli_character_set_name($db->link);
    // should be either latin1 or utf8
} else {
    $collation = mysql_client_encoding();
    // should be either latin1 or utf8
}
if ($collation == 'utf8') {
    mb_internal_encoding("UTF-8");
}
if ($collation == 'utf8' && (substr($project, 0, 5) == "1.3.8" || substr($project, 0, 5) == "1.3.9")) {
    //mb_internal_encoding("UTF-8");
    $category_strlen_max = $category_strlen_max / 3;
    $categories_name_max_len = $categories_name_max_len / 3;
// | license@zen-cart.com so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
//  $Id: manufacturers.php 1969 2005-09-13 06:57:21Z drbyte $
//
require 'includes/application_top.php';
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (zen_not_null($action)) {
    switch ($action) {
        case 'insert':
        case 'save':
            if (isset($_GET['mID'])) {
                $manufacturers_id = zen_db_prepare_input($_GET['mID']);
            }
            $manufacturers_name_array = array();
            foreach ($_POST['manufacturers_name'] as $key => $value) {
                $manufacturers_name_array[$key] = zen_db_prepare_input(mb_strimwidth($value, 0, zen_field_length(TABLE_MANUFACTURERS, 'manufacturers_name')));
            }
            $sql_data_array = array('manufacturers_name' => $manufacturers_name_array[(int) $_SESSION['languages_id']]);
            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_MANUFACTURERS, $sql_data_array);
                $manufacturers_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_MANUFACTURERS, $sql_data_array, 'update', "manufacturers_id = '" . (int) $manufacturers_id . "'");
            }
            $manufacturers_image = new upload('manufacturers_image');
            $manufacturers_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
            if ($manufacturers_image->parse() && $manufacturers_image->save()) {
     ///////////////////////////////////////////////////////
 } elseif ($action == 'update_product') {
     $update_sql_data = array('products_last_modified' => 'now()', 'master_categories_id' => $_POST['master_category'] > 0 ? zen_db_prepare_input($_POST['master_category']) : zen_db_prepare_input($_POST['master_categories_id']));
     $sql_data_array = array_merge($sql_data_array, $update_sql_data);
     zen_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int) $products_id . "'");
     // reset products_price_sorter for searches etc.
     zen_update_products_price_sorter((int) $products_id);
     ///////////////////////////////////////////////////////
     //// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////
     ////    *END OF PRODUCT-TYPE-SPECIFIC UPDATES* ////////
     ///////////////////////////////////////////////////////
 }
 $languages = zen_get_languages();
 for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
     $language_id = $languages[$i]['id'];
     $sql_data_array = array('products_name' => zen_db_prepare_input(mb_strimwidth($_POST['products_name'][$language_id], 0, zen_field_length(TABLE_PRODUCTS_DESCRIPTION, 'products_name'))), 'products_description' => zen_db_prepare_input($_POST['products_description'][$language_id]), 'products_url' => zen_db_prepare_input($_POST['products_url'][$language_id]));
     if ($action == 'insert_product') {
         $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_PRODUCTS_DESCRIPTION, $sql_data_array);
     } elseif ($action == 'update_product') {
         zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int) $products_id . "' and language_id = '" . (int) $language_id . "'");
     }
 }
 // add 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 == 'insert_product_meta_tags') {
         $insert_sql_data = array('products_id' => $products_id, 'language_id' => $language_id);
Example #6
0
                 zen_db_perform(TABLE_PRODUCT_TYPES_TO_CATEGORY, $insert_sql_data);
             }
         }
     }
 } elseif ($action == 'update_category') {
     $update_sql_data = array('last_modified' => 'now()');
     $sql_data_array = array_merge($sql_data_array, $update_sql_data);
     zen_db_perform(TABLE_CATEGORIES, $sql_data_array, 'update', "categories_id = '" . (int) $categories_id . "'");
 }
 $languages = zen_get_languages();
 for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
     $categories_name_array = $_POST['categories_name'];
     $categories_description_array = $_POST['categories_description'];
     $language_id = $languages[$i]['id'];
     // clean $categories_description when blank or just <p /> left behind
     $sql_data_array = array('categories_name' => zen_db_prepare_input(mb_strimwidth($categories_name_array[$language_id], 0, zen_field_length(TABLE_CATEGORIES_DESCRIPTION, 'categories_name'))), 'categories_description' => $categories_description_array[$language_id] == '<p />' ? '' : zen_db_prepare_input($categories_description_array[$language_id]));
     if ($action == 'insert_category') {
         $insert_sql_data = array('categories_id' => $categories_id, 'language_id' => $languages[$i]['id']);
         $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
         zen_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array);
     } elseif ($action == 'update_category') {
         zen_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int) $categories_id . "' and language_id = '" . (int) $languages[$i]['id'] . "'");
     }
 }
 if ($categories_image = new upload('categories_image')) {
     $categories_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
     if ($categories_image->parse() && $categories_image->save()) {
         $categories_image_name = $_POST['img_dir'] . $categories_image->filename;
     }
     if ($categories_image->filename != 'none' && $categories_image->filename != '') {
         // save filename when not set to none and not blank
Example #7
0
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | license@zen-cart.com so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
//  $Id: manufacturers.php 1969 2005-09-13 06:57:21Z drbyte $
//
require 'includes/application_top.php';
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (zen_not_null($action)) {
    switch ($action) {
        case 'insert':
        case 'save':
            if (isset($_GET['mID'])) {
                $manufacturers_id = zen_db_prepare_input($_GET['mID']);
            }
            $manufacturers_name = zen_db_prepare_input(mb_strimwidth($_POST['manufacturers_name'], 0, zen_field_length(TABLE_MANUFACTURERS, 'manufacturers_name')));
            $sql_data_array = array('manufacturers_name' => $manufacturers_name);
            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_MANUFACTURERS, $sql_data_array);
                $manufacturers_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_MANUFACTURERS, $sql_data_array, 'update', "manufacturers_id = '" . (int) $manufacturers_id . "'");
            }
            $manufacturers_image = new upload('manufacturers_image');
            $manufacturers_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
            if ($manufacturers_image->parse() && $manufacturers_image->save()) {
                // remove image from database if none