示例#1
0
 $language_array = explode(',', smn_language_info());
 $name = smn_db_prepare_input($language_array[0]);
 $code = smn_db_prepare_input($language_array[1]);
 $image = smn_db_prepare_input($language_array[2]);
 $directory = smn_db_prepare_input($language_array[3]);
 $sort_order_query = smn_db_query("select MAX(sort_order) from " . TABLE_LANGUAGES);
 $sort_order = smn_db_fetch_array($sort_order_query);
 $sort_order = (int) $sort_order['sort_order'] + 1;
 smn_db_query("insert into " . TABLE_LANGUAGES . " (store_id, name, code, image, directory, sort_order) values ('" . smn_db_input($store_id) . "', '" . smn_db_input($name) . "', '" . smn_db_input($code) . "', '" . smn_db_input($image) . "', '" . smn_db_input($directory) . "', '" . smn_db_input($sort_order) . "')");
 $insert_id = smn_db_insert_id();
 if (ALLOW_STORE_SITE_TEXT == 'true') {
     $prefix = $store_id;
 } else {
     $prefix = 1;
 }
 smn_install_language($insert_id, $prefix);
 // create additional categories_description records
 $categories_query = smn_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c left join " . TABLE_CATEGORIES_DESCRIPTION . " cd on c.categories_id = cd.categories_id where cd.language_id = '" . (int) $languages_id . "' and c.store_id = '" . $store_id . "' and cd.store_id = '" . $store_id . "'");
 while ($categories = smn_db_fetch_array($categories_query)) {
     smn_db_query("insert into " . TABLE_CATEGORIES_DESCRIPTION . " (store_id, categories_id, language_id, categories_name) values ('" . $store_id . "', '" . (int) $categories['categories_id'] . "', '" . (int) $insert_id . "', '" . smn_db_input($categories['categories_name']) . "')");
 }
 // create additional products_description records
 $products_query = smn_db_query("select p.products_id, pd.products_name, pd.products_description, pd.products_url from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where pd.language_id = '" . (int) $languages_id . "' and p.store_id = '" . $store_id . "'");
 while ($products = smn_db_fetch_array($products_query)) {
     smn_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url) values ('" . (int) $products['products_id'] . "', '" . (int) $insert_id . "', '" . smn_db_input($products['products_name']) . "', '" . smn_db_input($products['products_description']) . "', '" . smn_db_input($products['products_url']) . "')");
 }
 // create additional products_options records
 $products_options_query = smn_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int) $languages_id . "'");
 while ($products_options = smn_db_fetch_array($products_options_query)) {
     smn_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (store_id, products_options_id, language_id, products_options_name) values ('" . (int) $store_id . "', '" . (int) $products_options['products_options_id'] . "', '" . (int) $insert_id . "', '" . smn_db_input($products_options['products_options_name']) . "')");
 }
示例#2
0
 function put_store_language($language_type = 'english')
 {
     require DIR_WS_LANGUAGES . 'install/' . $language_type . '_install.php';
     $language_array = explode(',', smn_language_info());
     $name = smn_db_prepare_input($language_array[0]);
     $code = smn_db_prepare_input($language_array[1]);
     $image = smn_db_prepare_input($language_array[2]);
     $directory = smn_db_prepare_input($language_array[3]);
     $new_language_id = 1;
     $sort_order = 1;
     smn_db_query("insert into languages (store_id, languages_id, name, code, image, directory, sort_order) values ('" . smn_db_input($prefix) . "', '" . smn_db_input($new_language_id) . "', '" . smn_db_input($name) . "', '" . smn_db_input($code) . "', '" . smn_db_input($image) . "', '" . smn_db_input($directory) . "', '" . smn_db_input($sort_order) . "')");
     smn_install_language($new_language_id, $prefix);
 }