function import($file, $type)
 {
     global $osC_Database, $osC_Currencies;
     if (file_exists('../includes/languages/' . $file . '.xml')) {
         $osC_XML = new osC_XML(file_get_contents('../includes/languages/' . $file . '.xml'));
         $source = $osC_XML->toArray();
         $language = array('name' => $source['language']['data']['title'], 'code' => $source['language']['data']['code'], 'locale' => $source['language']['data']['locale'], 'charset' => $source['language']['data']['character_set'], 'date_format_short' => $source['language']['data']['date_format_short'], 'date_format_long' => $source['language']['data']['date_format_long'], 'time_format' => $source['language']['data']['time_format'], 'text_direction' => $source['language']['data']['text_direction'], 'currency' => $source['language']['data']['default_currency'], 'numeric_separator_decimal' => $source['language']['data']['numerical_decimal_separator'], 'numeric_separator_thousands' => $source['language']['data']['numerical_thousands_separator'], 'parent_language_code' => $source['language']['data']['parent_language_code'], 'parent_id' => 0);
         if (!$osC_Currencies->exists($language['currency'])) {
             $language['currency'] = DEFAULT_CURRENCY;
         }
         if (!empty($language['parent_language_code'])) {
             $Qlanguage = $osC_Database->query('select languages_id from :table_languages where code = :code');
             $Qlanguage->bindTable(':table_languages', TABLE_LANGUAGES);
             $Qlanguage->bindValue(':code', $language['parent_language_code']);
             $Qlanguage->execute();
             if ($Qlanguage->numberOfRows() === 1) {
                 $language['parent_id'] = $Qlanguage->valueInt('languages_id');
             }
         }
         $definitions = array();
         if (isset($source['language']['definitions']['definition'])) {
             $definitions = $source['language']['definitions']['definition'];
             if (isset($definitions['key']) && isset($definitions['value']) && isset($definitions['group'])) {
                 $definitions = array(array('key' => $definitions['key'], 'value' => $definitions['value'], 'group' => $definitions['group']));
             }
         }
         $tables = array();
         if (isset($source['language']['tables']['table'])) {
             $tables = $source['language']['tables']['table'];
         }
         unset($source);
         $error = false;
         $add_category_and_product_placeholders = true;
         $osC_Database->startTransaction();
         $Qcheck = $osC_Database->query('select languages_id from :table_languages where code = :code');
         $Qcheck->bindTable(':table_languages', TABLE_LANGUAGES);
         $Qcheck->bindValue(':code', $language['code']);
         $Qcheck->execute();
         if ($Qcheck->numberOfRows() === 1) {
             $add_category_and_product_placeholders = false;
             $language_id = $Qcheck->valueInt('languages_id');
             $Qlanguage = $osC_Database->query('update :table_languages set name = :name, code = :code, locale = :locale, charset = :charset, date_format_short = :date_format_short, date_format_long = :date_format_long, time_format = :time_format, text_direction = :text_direction, currencies_id = :currencies_id, numeric_separator_decimal = :numeric_separator_decimal, numeric_separator_thousands = :numeric_separator_thousands, parent_id = :parent_id where languages_id = :languages_id');
             $Qlanguage->bindInt(':languages_id', $language_id);
         } else {
             $Qlanguage = $osC_Database->query('insert into :table_languages (name, code, locale, charset, date_format_short, date_format_long, time_format, text_direction, currencies_id, numeric_separator_decimal, numeric_separator_thousands, parent_id) values (:name, :code, :locale, :charset, :date_format_short, :date_format_long, :time_format, :text_direction, :currencies_id, :numeric_separator_decimal, :numeric_separator_thousands, :parent_id)');
         }
         $Qlanguage->bindTable(':table_languages', TABLE_LANGUAGES);
         $Qlanguage->bindValue(':name', $language['name']);
         $Qlanguage->bindValue(':code', $language['code']);
         $Qlanguage->bindValue(':locale', $language['locale']);
         $Qlanguage->bindValue(':charset', $language['charset']);
         $Qlanguage->bindValue(':date_format_short', $language['date_format_short']);
         $Qlanguage->bindValue(':date_format_long', $language['date_format_long']);
         $Qlanguage->bindValue(':time_format', $language['time_format']);
         $Qlanguage->bindValue(':text_direction', $language['text_direction']);
         $Qlanguage->bindInt(':currencies_id', $osC_Currencies->getID($language['currency']));
         $Qlanguage->bindValue(':numeric_separator_decimal', $language['numeric_separator_decimal']);
         $Qlanguage->bindValue(':numeric_separator_thousands', $language['numeric_separator_thousands']);
         $Qlanguage->bindInt(':parent_id', $language['parent_id']);
         $Qlanguage->setLogging($_SESSION['module'], $Qcheck->numberOfRows() === 1 ? $language_id : null);
         $Qlanguage->execute();
         if ($osC_Database->isError()) {
             $error = true;
         } else {
             if ($Qcheck->numberOfRows() !== 1) {
                 $language_id = $osC_Database->nextID();
             }
             $default_language_id = osC_Language_Admin::getData(osC_Language_Admin::getID(DEFAULT_LANGUAGE), 'languages_id');
             if ($type == 'replace') {
                 $Qdel = $osC_Database->query('delete from :table_languages_definitions where languages_id = :languages_id');
                 $Qdel->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                 $Qdel->bindInt(':languages_id', $language_id);
                 $Qdel->execute();
                 if ($osC_Database->isError()) {
                     $error = true;
                 }
             }
         }
         if ($error === false) {
             $osC_DirectoryListing = new osC_DirectoryListing('../includes/languages/' . $file);
             $osC_DirectoryListing->setRecursive(true);
             $osC_DirectoryListing->setIncludeDirectories(false);
             $osC_DirectoryListing->setAddDirectoryToFilename(true);
             $osC_DirectoryListing->setCheckExtension('xml');
             foreach ($osC_DirectoryListing->getFiles() as $files) {
                 $definitions = array_merge($definitions, osC_Language_Admin::extractDefinitions($file . '/' . $files['name']));
             }
             foreach ($definitions as $def) {
                 $insert = false;
                 $update = false;
                 if ($type == 'replace') {
                     $insert = true;
                 } else {
                     $Qcheck = $osC_Database->query('select definition_key, content_group from :table_languages_definitions where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
                     $Qcheck->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                     $Qcheck->bindValue(':definition_key', $def['key']);
                     $Qcheck->bindInt(':languages_id', $language_id);
                     $Qcheck->bindValue(':content_group', $def['group']);
                     $Qcheck->execute();
                     if ($Qcheck->numberOfRows() > 0) {
                         if ($type == 'update') {
                             $update = true;
                         }
                     } elseif ($type == 'add') {
                         $insert = true;
                     }
                 }
                 if ($insert === true || $update === true) {
                     if ($insert === true) {
                         $Qdef = $osC_Database->query('insert into :table_languages_definitions (languages_id, content_group, definition_key, definition_value) values (:languages_id, :content_group, :definition_key, :definition_value)');
                     } else {
                         $Qdef = $osC_Database->query('update :table_languages_definitions set content_group = :content_group, definition_key = :definition_key, definition_value = :definition_value where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
                         $Qdef->bindValue(':definition_key', $def['key']);
                         $Qdef->bindValue(':content_group', $def['group']);
                     }
                     $Qdef->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                     $Qdef->bindInt(':languages_id', $language_id);
                     $Qdef->bindValue(':content_group', $def['group']);
                     $Qdef->bindValue(':definition_key', $def['key']);
                     $Qdef->bindValue(':definition_value', $def['value']);
                     $Qdef->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
         }
         if ($add_category_and_product_placeholders === true) {
             if (!empty($tables)) {
                 foreach ($tables as $table) {
                     $table_name = str_replace('toc_', DB_TABLE_PREFIX, $table['meta']['name']);
                     $key_field = $table['meta']['key_field'];
                     $language_field = $table['meta']['language_field'];
                     $Qcheck = $osC_Database->query('select * from :table_name where ' . $language_field . ' = :language_id');
                     $Qcheck->bindTable(':table_name', $table_name);
                     $Qcheck->bindInt(':language_id', $default_language_id);
                     $Qcheck->execute();
                     while ($Qcheck->next()) {
                         $data = $Qcheck->toArray();
                         $data[$language_field] = $language_id;
                         $insert = false;
                         foreach ($table['definition'] as $definition) {
                             if ($data[$key_field] == $definition['key']) {
                                 $insert = true;
                                 foreach ($definition as $key => $value) {
                                     if ($key != 'key' && array_key_exists($key, $data)) {
                                         $data[$key] = $osC_Database->escapeString($value);
                                     }
                                 }
                             }
                         }
                         if ($insert === true) {
                             $fields = array_keys($data);
                             $values = array();
                             foreach ($fields as $field) {
                                 $values[] = "'" . $data[$field] . "'";
                             }
                             $Qinsert = $osC_Database->query('insert into :table_name (' . implode(', ', $fields) . ') values (' . implode(', ', $values) . ')');
                             $Qinsert->bindTable(':table_name', $table_name);
                             $Qinsert->execute();
                         }
                     }
                 }
             }
             if ($error === false) {
                 $Qcategories = $osC_Database->query('select categories_id, categories_name, categories_url, categories_page_title, categories_meta_keywords, categories_meta_description from :table_categories_description where language_id = :language_id');
                 $Qcategories->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
                 $Qcategories->bindInt(':language_id', $default_language_id);
                 $Qcategories->execute();
                 while ($Qcategories->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_categories_description (categories_id, language_id, categories_name, categories_url, categories_page_title, categories_meta_keywords, categories_meta_description) values (:categories_id, :language_id, :categories_name, :categories_url, :categories_page_title, :categories_meta_keywords, :categories_meta_description)');
                     $Qinsert->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
                     $Qinsert->bindInt(':categories_id', $Qcategories->valueInt('categories_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':categories_name', $Qcategories->value('categories_name'));
                     $Qinsert->bindValue(':categories_url', $Qcategories->value('categories_url'));
                     $Qinsert->bindValue(':categories_page_title', $Qcategories->value('categories_page_title'));
                     $Qinsert->bindValue(':categories_meta_keywords', $Qcategories->value('categories_meta_keywords'));
                     $Qinsert->bindValue(':categories_meta_description', $Qcategories->value('categories_meta_description'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qproducts = $osC_Database->query('select products_id, products_name, products_description, products_keyword, products_tags, products_url, products_friendly_url, products_page_title, products_meta_keywords, products_meta_description, products_viewed from :table_products_description where language_id = :language_id');
                 $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
                 $Qproducts->bindInt(':language_id', $default_language_id);
                 $Qproducts->execute();
                 while ($Qproducts->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_description (products_id, language_id, products_name, products_description, products_keyword, products_tags, products_url, products_friendly_url, products_page_title, products_meta_keywords, products_meta_description, products_viewed) values (:products_id, :language_id, :products_name, :products_description, :products_keyword, :products_tags, :products_url, :products_friendly_url, :products_page_title, :products_meta_keywords, :products_meta_description, :products_viewed)');
                     $Qinsert->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
                     $Qinsert->bindInt(':products_id', $Qproducts->valueInt('products_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':products_name', $Qproducts->value('products_name'));
                     $Qinsert->bindValue(':products_description', $Qproducts->value('products_description'));
                     $Qinsert->bindValue(':products_keyword', $Qproducts->value('products_keyword'));
                     $Qinsert->bindValue(':products_tags', $Qproducts->value('products_tags'));
                     $Qinsert->bindValue(':products_url', $Qproducts->value('products_url'));
                     $Qinsert->bindValue(':products_friendly_url', $Qproducts->value('products_friendly_url'));
                     $Qinsert->bindValue(':products_page_title', $Qproducts->value('products_page_title'));
                     $Qinsert->bindValue(':products_meta_keywords', $Qproducts->value('products_meta_keywords'));
                     $Qinsert->bindValue(':products_meta_description', $Qproducts->value('products_meta_description'));
                     $Qinsert->bindInt(':products_viewed', $Qproducts->valueInt('products_viewed'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $QcustomizationFields = $osC_Database->query('select customization_fields_id, languages_id, name from :table_customization_fields_description where languages_id = :languages_id');
                 $QcustomizationFields->bindTable(':table_customization_fields_description', TABLE_CUSTOMIZATION_FIELDS_DESCRIPTION);
                 $QcustomizationFields->bindInt(':languages_id', $default_language_id);
                 $QcustomizationFields->execute();
                 while ($QcustomizationFields->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_customization_fields_description (customization_fields_id, languages_id, name) values (:customization_fields_id, :languages_id, :name)');
                     $Qinsert->bindTable(':table_customization_fields_description', TABLE_CUSTOMIZATION_FIELDS_DESCRIPTION);
                     $Qinsert->bindInt(':customization_fields_id', $QcustomizationFields->valueInt('customization_fields_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':name', $QcustomizationFields->value('name'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qvariants = $osC_Database->query('select products_variants_groups_id, products_variants_groups_name from :table_products_variants_groups where language_id = :language_id');
                 $Qvariants->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
                 $Qvariants->bindInt(':language_id', $default_language_id);
                 $Qvariants->execute();
                 while ($Qvariants->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_variants_groups (products_variants_groups_id, language_id, products_variants_groups_name) values (:products_variants_groups_id, :language_id, :products_variants_groups_name)');
                     $Qinsert->bindTable(':table_products_variants_groups', TABLE_PRODUCTS_VARIANTS_GROUPS);
                     $Qinsert->bindInt(':products_variants_groups_id', $Qvariants->valueInt('products_variants_groups_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':products_variants_groups_name', $Qvariants->value('products_variants_groups_name'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qvalues = $osC_Database->query('select products_variants_values_id, products_variants_values_name from :table_products_variants_values where language_id = :language_id');
                 $Qvalues->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
                 $Qvalues->bindInt(':language_id', $default_language_id);
                 $Qvalues->execute();
                 while ($Qvalues->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_variants_values (products_variants_values_id, language_id, products_variants_values_name) values (:products_variants_values_id, :language_id, :products_variants_values_name)');
                     $Qinsert->bindTable(':table_products_variants_values', TABLE_PRODUCTS_VARIANTS_VALUES);
                     $Qinsert->bindInt(':products_variants_values_id', $Qvalues->valueInt('products_variants_values_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':products_variants_values_name', $Qvalues->value('products_variants_values_name'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qmanufacturers = $osC_Database->query('select manufacturers_id, manufacturers_url, manufacturers_friendly_url from :table_manufacturers_info where languages_id = :languages_id');
                 $Qmanufacturers->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
                 $Qmanufacturers->bindInt(':languages_id', $default_language_id);
                 $Qmanufacturers->execute();
                 while ($Qmanufacturers->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_manufacturers_info (manufacturers_id, languages_id, manufacturers_url, manufacturers_friendly_url) values (:manufacturers_id, :languages_id, :manufacturers_url, :manufacturers_friendly_url)');
                     $Qinsert->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
                     $Qinsert->bindInt(':manufacturers_id', $Qmanufacturers->valueInt('manufacturers_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':manufacturers_url', $Qmanufacturers->value('manufacturers_url'));
                     $Qinsert->bindValue(':manufacturers_friendly_url', $Qmanufacturers->value('manufacturers_friendly_url'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qimages = $osC_Database->query('select image_id, description, image, image_url, sort_order, status from :table_slide_images where language_id = :language_id');
                 $Qimages->bindTable(':table_slide_images', TABLE_SLIDE_IMAGES);
                 $Qimages->bindInt(':language_id', $default_language_id);
                 $Qimages->execute();
                 while ($Qimages->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_slide_images (image_id, language_id, description, image, image_url, sort_order, status) values (:image_id, :language_id, :description, :image, :image_url, :sort_order, :status)');
                     $Qinsert->bindTable(':table_slide_images', TABLE_SLIDE_IMAGES);
                     $Qinsert->bindInt(':image_id', $Qimages->valueInt('image_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':description', $Qimages->value('description'));
                     $Qinsert->bindValue(':image', $Qimages->value('image'));
                     $Qinsert->bindValue(':image_url', $Qimages->value('image_url'));
                     $Qinsert->bindInt(':sort_order', $Qimages->valueInt('sort_order'));
                     $Qinsert->bindInt(':status', $Qimages->valueInt('status'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qattributes = $osC_Database->query('select products_attributes_values_id, products_attributes_groups_id, name, module, value, status, sort_order from :table_products_attributes_values where language_id = :language_id');
                 $Qattributes->bindTable(':table_products_attributes_values', TABLE_PRODUCTS_ATTRIBUTES_VALUES);
                 $Qattributes->bindInt(':language_id', $default_language_id);
                 $Qattributes->execute();
                 while ($Qattributes->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_attributes_values (products_attributes_values_id, products_attributes_groups_id, language_id, name, module, value, status, sort_order) values (:products_attributes_values_id, :products_attributes_groups_id, :language_id, :name, :module, :value, :status, :sort_order)');
                     $Qinsert->bindTable(':table_products_attributes_values', TABLE_PRODUCTS_ATTRIBUTES_VALUES);
                     $Qinsert->bindInt(':products_attributes_values_id', $Qattributes->valueInt('products_attributes_values_id'));
                     $Qinsert->bindInt(':products_attributes_groups_id', $Qattributes->valueInt('products_attributes_groups_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':name', $Qattributes->value('name'));
                     $Qinsert->bindValue(':module', $Qattributes->value('module'));
                     $Qinsert->bindValue(':value', $Qattributes->value('value'));
                     $Qinsert->bindInt(':status', $Qattributes->valueInt('status'));
                     $Qinsert->bindInt(':sort_order', $Qattributes->valueInt('sort_order'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qattributes = $osC_Database->query('select products_id, products_attributes_values_id, value from :table_products_attributes where language_id = :language_id');
                 $Qattributes->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
                 $Qattributes->bindInt(':language_id', $default_language_id);
                 $Qattributes->execute();
                 while ($Qattributes->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_attributes (products_id, products_attributes_values_id, value, language_id) values (:products_id, :products_attributes_values_id, :value, :language_id)');
                     $Qinsert->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
                     $Qinsert->bindInt(':products_id', $Qattributes->valueInt('products_id'));
                     $Qinsert->bindInt(':products_attributes_values_id', $Qattributes->valueInt('products_attributes_values_id'));
                     $Qinsert->bindValue(':value', $Qattributes->value('value'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qfaqs = $osC_Database->query('select faqs_id, faqs_question, faqs_url, faqs_answer from :table_faqs_description where language_id = :language_id');
                 $Qfaqs->bindTable(':table_faqs_description', TABLE_FAQS_DESCRIPTION);
                 $Qfaqs->bindInt(':language_id', $default_language_id);
                 $Qfaqs->execute();
                 while ($Qfaqs->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_faqs_description (faqs_id, language_id, faqs_question, faqs_answer, faqs_url) values (:faqs_id, :language_id, :faqs_question, :faqs_answer, :faqs_url)');
                     $Qinsert->bindTable(':table_faqs_description', TABLE_FAQS_DESCRIPTION);
                     $Qinsert->bindInt(':faqs_id', $Qfaqs->valueInt('faqs_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':faqs_question', $Qfaqs->value('faqs_question'));
                     $Qinsert->bindValue(':faqs_answer', $Qfaqs->value('faqs_answer'));
                     $Qinsert->bindValue(':faqs_url', $Qfaqs->value('faqs_url'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qcoupons = $osC_Database->query('select coupons_id, coupons_name, coupons_description from :table_coupons_description where language_id = :language_id');
                 $Qcoupons->bindTable(':table_coupons_description', TABLE_COUPONS_DESCRIPTION);
                 $Qcoupons->bindInt(':language_id', $default_language_id);
                 $Qcoupons->execute();
                 while ($Qcoupons->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_coupons_description (coupons_id, language_id, coupons_name, coupons_description) values (:coupons_id, :language_id, :coupons_name, :coupons_description)');
                     $Qinsert->bindTable(':table_coupons_description', TABLE_COUPONS_DESCRIPTION);
                     $Qinsert->bindInt(':coupons_id', $Qcoupons->valueInt('coupons_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':coupons_name', $Qcoupons->value('coupons_name'));
                     $Qinsert->bindValue(':coupons_description', $Qcoupons->value('coupons_description'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qarticles = $osC_Database->query('select articles_id, articles_name, articles_description, articles_url, articles_page_title, articles_meta_keywords, articles_meta_description from :table_articles_description where language_id = :language_id');
                 $Qarticles->bindTable(':table_articles_description', TABLE_ARTICLES_DESCRIPTION);
                 $Qarticles->bindInt(':language_id', $default_language_id);
                 $Qarticles->execute();
                 while ($Qarticles->next()) {
                     $Qcheck = $osC_Database->query('select * from :table_articles_description where articles_id = :articles_id and language_id = :language_id');
                     $Qcheck->bindTable(':table_articles_description', TABLE_ARTICLES_DESCRIPTION);
                     $Qcheck->bindInt(':articles_id', $Qarticles->valueInt('articles_id'));
                     $Qcheck->bindInt(':language_id', $language_id);
                     $Qcheck->execute();
                     if ($Qcheck->numberOfRows() === 0) {
                         $Qinsert = $osC_Database->query('insert into :table_articles_description (articles_id, language_id, articles_name, articles_description, articles_url, articles_page_title, articles_meta_keywords, articles_meta_description) values (:articles_id, :language_id, :articles_name, :articles_description, :articles_url, :articles_page_title, :articles_meta_keywords, :articles_meta_description)');
                         $Qinsert->bindTable(':table_articles_description', TABLE_ARTICLES_DESCRIPTION);
                         $Qinsert->bindInt(':articles_id', $Qarticles->valueInt('articles_id'));
                         $Qinsert->bindInt(':language_id', $language_id);
                         $Qinsert->bindValue(':articles_name', $Qarticles->value('articles_name'));
                         $Qinsert->bindValue(':articles_description', $Qarticles->value('articles_description'));
                         $Qinsert->bindValue(':articles_url', $Qarticles->value('articles_url'));
                         $Qinsert->bindValue(':articles_page_title', $Qarticles->value('articles_page_title'));
                         $Qinsert->bindValue(':articles_meta_keywords', $Qarticles->value('articles_meta_keywords'));
                         $Qinsert->bindValue(':articles_meta_description', $Qarticles->value('articles_meta_description'));
                         $Qinsert->execute();
                         if ($osC_Database->isError()) {
                             $error = true;
                             break;
                         }
                     }
                 }
             }
             if ($error === false) {
                 $Qcategories = $osC_Database->query('select articles_categories_id, articles_categories_name, articles_categories_url, articles_categories_page_title, articles_categories_meta_keywords, articles_categories_meta_description from :table_articles_categories_description where language_id = :language_id');
                 $Qcategories->bindTable(':table_articles_categories_description', TABLE_ARTICLES_CATEGORIES_DESCRIPTION);
                 $Qcategories->bindInt(':language_id', $default_language_id);
                 $Qcategories->execute();
                 while ($Qcategories->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_articles_categories_description (articles_categories_id, language_id, articles_categories_name, articles_categories_url, articles_categories_page_title, articles_categories_meta_keywords, articles_categories_meta_description) values (:articles_categories_id, :language_id, :articles_categories_name, :articles_categories_url, :articles_categories_page_title, :articles_categories_meta_keywords, :articles_categories_meta_description )');
                     $Qinsert->bindTable(':table_articles_categories_description', TABLE_ARTICLES_CATEGORIES_DESCRIPTION);
                     $Qinsert->bindInt(':articles_categories_id', $Qcategories->valueInt('articles_categories_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':articles_categories_name', $Qcategories->value('articles_categories_name'));
                     $Qinsert->bindValue(':articles_categories_url', $Qcategories->value('articles_categories_url'));
                     $Qinsert->bindValue(':articles_categories_page_title', $Qcategories->value('articles_categories_page_title'));
                     $Qinsert->bindValue(':articles_categories_meta_keywords', $Qcategories->value('articles_categories_meta_keywords'));
                     $Qinsert->bindValue(':articles_categories_meta_description', $Qcategories->value('articles_categories_meta_description'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qgroups = $osC_Database->query('select customers_groups_id, customers_groups_name from :table_customers_groups_description where language_id = :language_id');
                 $Qgroups->bindTable(':table_customers_groups_description', TABLE_CUSTOMERS_GROUPS_DESCRIPTION);
                 $Qgroups->bindInt(':language_id', $default_language_id);
                 $Qgroups->execute();
                 while ($Qgroups->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_customers_groups_description (customers_groups_id, language_id, customers_groups_name) values (:customers_groups_id, :language_id, :customers_groups_name)');
                     $Qinsert->bindTable(':table_customers_groups_description', TABLE_CUSTOMERS_GROUPS_DESCRIPTION);
                     $Qinsert->bindInt(':customers_groups_id', $Qgroups->valueInt('customers_groups_id'));
                     $Qinsert->bindInt(':language_id', $language_id);
                     $Qinsert->bindValue(':customers_groups_name', $Qgroups->value('customers_groups_name'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qratings = $osC_Database->query('select ratings_id, ratings_text from :table_ratings_description where languages_id = :languages_id');
                 $Qratings->bindTable(':table_ratings_description', TABLE_RATINGS_DESCRIPTION);
                 $Qratings->bindInt(':languages_id', $default_language_id);
                 $Qratings->execute();
                 while ($Qratings->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_ratings_description (ratings_id, languages_id, ratings_text) values (:ratings_id, :languages_id, :ratings_text)');
                     $Qinsert->bindTable(':table_ratings_description', TABLE_RATINGS_DESCRIPTION);
                     $Qinsert->bindInt(':ratings_id', $Qratings->valueInt('ratings_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':ratings_text', $Qratings->value('ratings_text'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qpolls = $osC_Database->query('select polls_id, polls_title from :table_polls_description where languages_id = :languages_id');
                 $Qpolls->bindTable(':table_polls_description', TABLE_POLLS_DESCRIPTION);
                 $Qpolls->bindInt(':languages_id', $default_language_id);
                 $Qpolls->execute();
                 while ($Qpolls->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_polls_description (polls_id, languages_id, polls_title) values (:polls_id, :languages_id, :polls_title)');
                     $Qinsert->bindTable(':table_polls_description', TABLE_POLLS_DESCRIPTION);
                     $Qinsert->bindInt(':polls_id', $Qpolls->valueInt('polls_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':polls_title', $Qpolls->value('polls_title'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qanswers = $osC_Database->query('select polls_answers_id, answers_title from :table_polls_answers_description where languages_id = :languages_id');
                 $Qanswers->bindTable(':table_polls_answers_description', TABLE_POLLS_ANSWERS_DESCRIPTION);
                 $Qanswers->bindInt(':languages_id', $default_language_id);
                 $Qanswers->execute();
                 while ($Qanswers->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_polls_answers_description (polls_answers_id, languages_id, answers_title) values (:polls_answers_id, :languages_id, :answers_title)');
                     $Qinsert->bindTable(':table_polls_answers_description', TABLE_POLLS_ANSWERS_DESCRIPTION);
                     $Qinsert->bindInt(':polls_answers_id', $Qanswers->valueInt('polls_answers_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':answers_title', $Qanswers->value('answers_title'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qattachments = $osC_Database->query('select attachments_id, attachments_name, attachments_description from :table_products_attachments_description where languages_id = :language_id');
                 $Qattachments->bindTable(':table_products_attachments_description', TABLE_PRODUCTS_ATTACHMENTS_DESCRIPTION);
                 $Qattachments->bindInt(':language_id', $default_language_id);
                 $Qattachments->execute();
                 while ($Qattachments->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_products_attachments_description (attachments_id, languages_id, attachments_name, attachments_description) values (:attachments_id, :languages_id, :attachments_name, :attachments_description)');
                     $Qinsert->bindTable(':table_products_attachments_description', TABLE_PRODUCTS_ATTACHMENTS_DESCRIPTION);
                     $Qinsert->bindInt(':attachments_id', $Qattachments->valueInt('attachments_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':attachments_name', $Qattachments->value('attachments_name'));
                     $Qinsert->bindValue(':attachments_description', $Qattachments->value('attachments_description'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
             if ($error === false) {
                 $Qdepart = $osC_Database->query('select departments_id, departments_title, departments_description from :table_departments_description where languages_id = :language_id');
                 $Qdepart->bindTable(':table_departments_description', TABLE_DEPARTMENTS_DESCRIPTION);
                 $Qdepart->bindInt(':language_id', $default_language_id);
                 $Qdepart->execute();
                 while ($Qdepart->next()) {
                     $Qinsert = $osC_Database->query('insert into :table_departments_description (departments_id, languages_id, departments_title, departments_description) values (:departments_id, :languages_id, :departments_title, :departments_description)');
                     $Qinsert->bindTable(':table_departments_description', TABLE_DEPARTMENTS_DESCRIPTION);
                     $Qinsert->bindInt(':departments_id', $Qdepart->valueInt('departments_id'));
                     $Qinsert->bindInt(':languages_id', $language_id);
                     $Qinsert->bindValue(':departments_title', $Qdepart->value('departments_title'));
                     $Qinsert->bindValue(':departments_description', $Qdepart->value('departments_description'));
                     $Qinsert->execute();
                     if ($osC_Database->isError()) {
                         $error = true;
                         break;
                     }
                 }
             }
         }
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         osC_Cache::clear('languages');
         return true;
     } else {
         $osC_Database->rollbackTransaction();
     }
     return false;
 }
Esempio n. 2
0
  buildForm: function() {
    dsLanguages = new Ext.data.Store({
      url:Toc.CONF.CONN_URL,
      baseParams: {
        module: 'guest_book',
        action: 'get_languages'
      },
      reader: new Ext.data.JsonReader({
        fields: ['id', 'text'],
        root: Toc.CONF.JSON_READER_ROOT
      }),
      autoLoad: true,
      listeners: {
        load: function() {this.cboLanguages.setValue('<?php 
echo osC_Language_Admin::getID(DEFAULT_LANGUAGE);
?>
');},
        scope: this
      }
    });
    
    this.frmGuestBook = new Ext.form.FormPanel({ 
      url: Toc.CONF.CONN_URL,
      baseParams: {  
        action: 'save_guest_book',
        module: 'guest_book',
      }, 
      labelSeparator: ': ',
      style: 'padding: 10px;',
      border: false,