function saveWizard()
 {
     global $toC_Json, $osC_Language, $osC_Database;
     $error = false;
     $configurations = $toC_Json->decode($_REQUEST['data']);
     foreach ($configurations as $index => $configurations) {
         $configuration = get_object_vars($configurations);
         foreach ($configuration as $key => $value) {
             $Qupdate = $osC_Database->query('update :table_configuration set configuration_value = :configuration_value, last_modified = now() where configuration_key = :configuration_key');
             $Qupdate->bindTable(':table_configuration', TABLE_CONFIGURATION);
             $Qupdate->bindValue(':configuration_value', $value);
             $Qupdate->bindValue(':configuration_key', $key);
             $Qupdate->execute();
             if ($osC_Database->isError()) {
                 $error = true;
                 break;
             }
         }
     }
     if ($error === false) {
         require_once 'includes/classes/desktop_settings.php';
         $toC_Desktop_Settings = new toC_Desktop_Settings();
         $toC_Desktop_Settings->setWizardComplete();
         $response = array('success' => true, 'feedback' => $osC_Language->get('ms_success_action_performed'));
         osC_Cache::clear('configuration');
     } else {
         $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed'));
     }
     echo $toC_Json->encode($response);
 }
Ejemplo n.º 2
0
 function saveData($data)
 {
     global $osC_Database;
     $error = false;
     foreach ($data['keywords'] as $key => $value) {
         $Qconfiguration = $osC_Database->query("update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key");
         $Qconfiguration->bindValue(":configuration_key", 'HOME_META_KEYWORD_' . $key);
         $Qconfiguration->bindValue(":configuration_value", $value);
         $Qconfiguration->bindTable(":table_configuration", TABLE_CONFIGURATION);
         $Qconfiguration->execute();
         if ($osC_Database->isError()) {
             $error = true;
             break;
         }
     }
     foreach ($data['descriptions'] as $key => $value) {
         $Qconfiguration = $osC_Database->query("update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key");
         $Qconfiguration->bindValue(":configuration_key", 'HOME_META_DESCRIPTION_' . $key);
         $Qconfiguration->bindValue(":configuration_value", $value);
         $Qconfiguration->bindTable(":table_configuration", TABLE_CONFIGURATION);
         $Qconfiguration->execute();
         if ($osC_Database->isError()) {
             $error = true;
             break;
         }
     }
     if ($error === false) {
         osC_Cache::clear("configuration");
         return true;
     }
     return false;
 }
 function remove()
 {
     global $osC_Database, $osC_Language;
     $Qdel = $osC_Database->query('delete from :table_templates_boxes where code = :code and modules_group = :modules_group');
     $Qdel->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
     $Qdel->bindValue(':code', $this->_code);
     $Qdel->bindValue(':modules_group', $this->_group);
     $Qdel->execute();
     if ($this->hasKeys()) {
         $Qdel = $osC_Database->query('delete from :table_configuration where configuration_key in (":configuration_key")');
         $Qdel->bindTable(':table_configuration', TABLE_CONFIGURATION);
         $Qdel->bindRaw(':configuration_key', implode('", "', $this->getKeys()));
         $Qdel->execute();
     }
     if (file_exists('../includes/languages/' . $osC_Language->getCode() . '/modules/' . $this->_group . '/' . $this->_code . '.xml')) {
         foreach ($osC_Language->extractDefinitions($osC_Language->getCode() . '/modules/' . $this->_group . '/' . $this->_code . '.xml') as $def) {
             $Qdel = $osC_Database->query('delete from :table_languages_definitions where definition_key = :definition_key and content_group = :content_group');
             $Qdel->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
             $Qdel->bindValue(':definition_key', $def['key']);
             $Qdel->bindValue(':content_group', $def['group']);
             $Qdel->execute();
         }
         osC_Cache::clear('languages');
     }
 }
Ejemplo n.º 4
0
 public static function save($id = null, $data, $default = false)
 {
     global $osC_Database, $osC_Language;
     if (is_numeric($id)) {
         $group_id = $id;
     } else {
         $Qgroup = $osC_Database->query('select max(id) as id from :table_products_images_groups');
         $Qgroup->bindTable(':table_products_images_groups', TABLE_PRODUCTS_IMAGES_GROUPS);
         $Qgroup->execute();
         $group_id = $Qgroup->valueInt('id') + 1;
     }
     $error = false;
     $osC_Database->startTransaction();
     foreach ($osC_Language->getAll() as $l) {
         if (is_numeric($id)) {
             $Qgroup = $osC_Database->query('update :table_products_images_groups set title = :title, code = :code, size_width = :size_width, size_height = :size_height, force_size = :force_size where id = :id and language_id = :language_id');
         } else {
             $Qgroup = $osC_Database->query('insert into :table_products_images_groups (id, language_id, title, code, size_width, size_height, force_size) values (:id, :language_id, :title, :code, :size_width, :size_height, :force_size)');
         }
         $Qgroup->bindTable(':table_products_images_groups', TABLE_PRODUCTS_IMAGES_GROUPS);
         $Qgroup->bindInt(':id', $group_id);
         $Qgroup->bindValue(':title', $data['title'][$l['id']]);
         $Qgroup->bindValue(':code', $data['code']);
         $Qgroup->bindInt(':size_width', $data['width']);
         $Qgroup->bindInt(':size_height', $data['height']);
         $Qgroup->bindInt(':force_size', $data['force_size'] === true ? 1 : 0);
         $Qgroup->bindInt(':language_id', $l['id']);
         $Qgroup->setLogging($_SESSION['module'], $group_id);
         $Qgroup->execute();
         if ($osC_Database->isError()) {
             $error = true;
             break;
         }
     }
     if ($error === false) {
         if ($default === true) {
             $Qupdate = $osC_Database->query('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
             $Qupdate->bindTable(':table_configuration', TABLE_CONFIGURATION);
             $Qupdate->bindInt(':configuration_value', $group_id);
             $Qupdate->bindValue(':configuration_key', 'DEFAULT_IMAGE_GROUP_ID');
             $Qupdate->setLogging($_SESSION['module'], $group_id);
             $Qupdate->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         osC_Cache::clear('images_groups');
         if ($default === true) {
             osC_Cache::clear('configuration');
         }
         return true;
     }
     $osC_Database->rollbackTransaction();
     return false;
 }
 function save($id = null, $data, $default = false)
 {
     global $osC_Database, $osC_Language;
     $error = false;
     $osC_Database->startTransaction();
     if (is_numeric($id)) {
         $orders_status_id = $id;
     } else {
         $Qstatus = $osC_Database->query('select max(orders_status_id) as orders_status_id from :table_orders_status');
         $Qstatus->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
         $Qstatus->execute();
         $orders_status_id = $Qstatus->valueInt('orders_status_id') + 1;
     }
     foreach ($osC_Language->getAll() as $l) {
         if (is_numeric($id)) {
             $Qstatus = $osC_Database->query('update :table_orders_status set orders_status_name = :orders_status_name, public_flag = :public_flag, downloads_flag = :downloads_flag, returns_flag = :returns_flag, gift_certificates_flag = :gift_certificates_flag where orders_status_id = :orders_status_id and language_id = :language_id');
         } else {
             $Qstatus = $osC_Database->query('insert into :table_orders_status (orders_status_id, language_id, orders_status_name, public_flag, downloads_flag, returns_flag, gift_certificates_flag) values (:orders_status_id, :language_id, :orders_status_name, :public_flag, :downloads_flag, :returns_flag, :gift_certificates_flag)');
         }
         $Qstatus->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
         $Qstatus->bindInt(':orders_status_id', $orders_status_id);
         $Qstatus->bindValue(':orders_status_name', $data['name'][$l['id']]);
         $Qstatus->bindInt(':public_flag', $data['public_flag']);
         $Qstatus->bindInt(':downloads_flag', $data['downloads_flag']);
         $Qstatus->bindInt(':returns_flag', $data['returns_flag']);
         $Qstatus->bindInt(':gift_certificates_flag', $data['gift_certificates_flag']);
         $Qstatus->bindInt(':language_id', $l['id']);
         $Qstatus->setLogging($_SESSION['module'], $orders_status_id);
         $Qstatus->execute();
         if ($osC_Database->isError()) {
             $error = true;
             break;
         }
     }
     if ($error === false) {
         if ($default === true) {
             $Qupdate = $osC_Database->query('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
             $Qupdate->bindTable(':table_configuration', TABLE_CONFIGURATION);
             $Qupdate->bindInt(':configuration_value', $orders_status_id);
             $Qupdate->bindValue(':configuration_key', 'DEFAULT_ORDERS_STATUS_ID');
             $Qupdate->setLogging($_SESSION['module'], $orders_status_id);
             $Qupdate->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         if ($default === true) {
             osC_Cache::clear('configuration');
         }
         return true;
     }
     $osC_Database->rollbackTransaction();
     return false;
 }
Ejemplo n.º 6
0
 function deleteCaches()
 {
     global $toC_Json, $osC_Language;
     $ids = explode(',', $_REQUEST['batch']);
     foreach ($ids as $id) {
         osC_Cache::clear($id);
     }
     $response = array('success' => true, 'feedback' => $osC_Language->get('ms_success_action_performed'));
     echo $toC_Json->encode($response);
 }
Ejemplo n.º 7
0
 function save($id = null, $data, $default = false)
 {
     global $osC_Database, $osC_Language;
     $error = false;
     $osC_Database->startTransaction();
     if (is_numeric($id)) {
         $unit_class_id = $id;
     } else {
         $Qunit = $osC_Database->query('select max(quantity_unit_class_id) as quantity_unit_class_id from :table_quantity_unit_classes');
         $Qunit->bindTable(':table_quantity_unit_classes', TABLE_QUANTITY_UNIT_CLASSES);
         $Qunit->execute();
         $unit_class_id = $Qunit->valueInt('quantity_unit_class_id') + 1;
     }
     foreach ($osC_Language->getAll() as $l) {
         if (is_numeric($id)) {
             $Qunit = $osC_Database->query('update :table_quantity_unit_classes set quantity_unit_class_title = :quantity_unit_class_title where quantity_unit_class_id = :quantity_unit_class_id and language_id = :language_id');
         } else {
             $Qunit = $osC_Database->query('insert into :table_quantity_unit_classes (quantity_unit_class_id, language_id, quantity_unit_class_title) values (:quantity_unit_class_id, :language_id, :quantity_unit_class_title)');
         }
         $Qunit->bindTable(':table_quantity_unit_classes', TABLE_QUANTITY_UNIT_CLASSES);
         $Qunit->bindInt(':quantity_unit_class_id', $unit_class_id);
         $Qunit->bindValue(':quantity_unit_class_title', $data['unit_class_title'][$l['id']]);
         $Qunit->bindInt(':language_id', $l['id']);
         $Qunit->setLogging($_SESSION['module'], $unit_class_id);
         $Qunit->execute();
         if ($osC_Database->isError()) {
             $error = true;
             break;
         }
     }
     if ($error === false) {
         if ($default === true) {
             $Qupdate = $osC_Database->query('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
             $Qupdate->bindTable(':table_configuration', TABLE_CONFIGURATION);
             $Qupdate->bindInt(':configuration_value', $unit_class_id);
             $Qupdate->bindValue(':configuration_key', 'DEFAULT_UNIT_CLASSES');
             $Qupdate->setLogging($_SESSION['module'], $unit_class_id);
             $Qupdate->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         if ($default === true) {
             osC_Cache::clear('configuration');
         }
         return true;
     }
     return false;
 }
Ejemplo n.º 8
0
 function setStatus($id, $status)
 {
     global $osC_Database;
     $Qcc = $osC_Database->query('update :table_credit_cards set credit_card_status = :credit_card_status where id = :id');
     $Qcc->bindTable(':table_credit_cards', TABLE_CREDIT_CARDS);
     $Qcc->bindInt(':credit_card_status', $status === true ? 1 : 0);
     $Qcc->bindInt(':id', $id);
     $Qcc->setLogging($_SESSION['module'], $id);
     $Qcc->execute();
     if ($Qcc->affectedRows()) {
         osC_Cache::clear('credit-cards');
         return true;
     }
 }
 function delete($id)
 {
     global $osC_Database;
     $QguestBook = $osC_Database->query('delete from :table_guest_books where guest_books_id = :guest_books_id');
     $QguestBook->bindTable(':table_guest_books', TABLE_GUEST_BOOKS);
     $QguestBook->bindInt(':guest_books_id', $id);
     $QguestBook->setLogging($_SESSION['module'], $id);
     $QguestBook->execute();
     if (!$osC_Database->isError()) {
         osC_Cache::clear('box-guest-book');
         return true;
     }
     return false;
 }
Ejemplo n.º 10
0
 function save($id, $value)
 {
     global $osC_Database;
     $Qstatus = $osC_Database->query('update :table_products_frontpage set sort_order = :sort_order where products_id = :products_id');
     $Qstatus->bindTable(':table_products_frontpage', TABLE_PRODUCTS_FRONTPAGE);
     $Qstatus->bindInt(':products_id', $id);
     $Qstatus->bindInt(':sort_order', $value);
     $Qstatus->setLogging($_SESSION['module'], $id);
     $Qstatus->execute();
     if (!$osC_Database->isError()) {
         osC_Cache::clear('feature-products');
         return true;
     }
     return false;
 }
 function save($id, $value)
 {
     global $osC_Database;
     $Qupdate = $osC_Database->query('update :table_configuration set configuration_value = :configuration_value, last_modified = now() where configuration_id = :configuration_id');
     $Qupdate->bindTable(':table_configuration', TABLE_CONFIGURATION);
     $Qupdate->bindValue(':configuration_value', $value);
     $Qupdate->bindInt(':configuration_id', $id);
     $Qupdate->setLogging($_SESSION['module'], $id);
     $Qupdate->execute();
     if ($Qupdate->affectedRows()) {
         osC_Cache::clear('configuration');
         return true;
     }
     return false;
 }
Ejemplo n.º 12
0
 function save($id, $data)
 {
     global $osC_Database;
     $Qreview = $osC_Database->query('update :table_reviews set reviews_text = :reviews_text, reviews_rating = :reviews_rating, last_modified = now() where reviews_id = :reviews_id');
     $Qreview->bindTable(':table_reviews', TABLE_REVIEWS);
     $Qreview->bindValue(':reviews_text', $data['review']);
     $Qreview->bindInt(':reviews_rating', $data['rating']);
     $Qreview->bindInt(':reviews_id', $id);
     $Qreview->setLogging($_SESSION['module'], $id);
     $Qreview->execute();
     if (!$osC_Database->isError()) {
         osC_Cache::clear('reviews');
         return true;
     }
     return false;
 }
Ejemplo n.º 13
0
 function uninstall()
 {
     global $toC_Json, $osC_Language;
     $key = $_REQUEST['module_code'];
     if (file_exists('includes/modules/geoip/' . $key . '.php')) {
         include 'includes/modules/geoip/' . $key . '.php';
         $module = 'osC_GeoIP_' . $key;
         $module = new $module();
         $module->remove();
         osC_Cache::clear('modules-geoip');
         osC_Cache::clear('configuration');
         $response['success'] = true;
         $response['feedback'] = $osC_Language->get('ms_success_action_performed');
     } else {
         $response['success'] = false;
         $response['feedback'] = $osC_Language->get('ms_error_action_not_performed');
     }
     echo $toC_Json->encode($response);
 }
Ejemplo n.º 14
0
 public static function save($parameter)
 {
     global $osC_Database;
     $Qcfg = $osC_Database->query('select configuration_id from :table_configuration where configuration_key = :configuration_key');
     $Qcfg->bindTable(':table_configuration', TABLE_CONFIGURATION);
     $Qcfg->bindValue(':configuration_key', key($parameter));
     $Qcfg->execute();
     if ($Qcfg->numberOfRows() === 1) {
         $Qupdate = $osC_Database->query('update :table_configuration set configuration_value = :configuration_value, last_modified = now() where configuration_key = :configuration_key');
         $Qupdate->bindTable(':table_configuration', TABLE_CONFIGURATION);
         $Qupdate->bindValue(':configuration_value', $parameter[key($parameter)]);
         $Qupdate->bindValue(':configuration_key', key($parameter));
         $Qupdate->setLogging($_SESSION['module'], $Qcfg->valueInt('configuration_id'));
         $Qupdate->execute();
         if ($Qupdate->affectedRows()) {
             osC_Cache::clear('configuration');
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 15
0
 function __construct()
 {
     global $osC_Language, $osC_MessageStack;
     $this->_page_title = $osC_Language->get('heading_title');
     if (!isset($_GET['action'])) {
         $_GET['action'] = '';
     }
     // check if the cache directory exists
     if (is_dir(DIR_FS_WORK)) {
         if (!is_writeable(DIR_FS_WORK)) {
             $osC_MessageStack->add('header', sprintf($osC_Language->get('ms_error_cache_directory_not_writable'), DIR_FS_WORK), 'error');
         }
     } else {
         $osC_MessageStack->add('header', sprintf($osC_Language->get('ms_error_cache_directory_non_existant'), DIR_FS_WORK), 'error');
     }
     if (!empty($_GET['action'])) {
         switch ($_GET['action']) {
             case 'delete':
                 /*HPDL
                             if ( osC_Cache::clear($_GET['block']) ) {
                               $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
                             } else {
                               $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
                             }
                 */
                 osC_Cache::clear($_GET['block']);
                 osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module));
                 break;
             case 'batchDelete':
                 if (isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch'])) {
                     foreach ($_POST['batch'] as $id) {
                         osC_Cache::clear($id);
                     }
                     osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module));
                 }
                 break;
         }
     }
 }
Ejemplo n.º 16
0
 function setStatus($id, $flag, $product_flag)
 {
     global $osC_Database;
     $error = false;
     $Qstatus = $osC_Database->query('update :table_categories set categories_status = :categories_status where categories_id = :categories_id');
     $Qstatus->bindTable(':table_categories', TABLE_CATEGORIES);
     $Qstatus->bindInt(":categories_id", $id);
     $Qstatus->bindValue(":categories_status", $flag);
     $Qstatus->execute();
     if (!$osC_Database->isError()) {
         if ($flag == 0 && $product_flag == 1) {
             $Qupdate = $osC_Database->query('update :table_products set products_status = 0 where products_id in (select products_id from :table_products_to_categories where categories_id = :categories_id)');
             $Qupdate->bindTable(':table_products', TABLE_PRODUCTS);
             $Qupdate->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
             $Qupdate->bindInt(":categories_id", $id);
             $Qupdate->execute();
         }
     }
     if (!$osC_Database->isError()) {
         osC_Cache::clear('categories');
         osC_Cache::clear('category_tree');
         osC_Cache::clear('also_purchased');
         osC_Cache::clear('sefu-products');
         osC_Cache::clear('new_products');
         return true;
     }
     return false;
 }
Ejemplo n.º 17
0
 function uninstall()
 {
     global $toC_Json, $osC_Language;
     $module_name = $_REQUEST['module_code'];
     $set = $_REQUEST['set'];
     if (file_exists('../includes/modules/' . $set . '/' . $module_name . '.php')) {
         include '../includes/modules/' . $set . '/' . $module_name . '.php';
         $osC_Language->injectDefinitions('modules/' . $set . '/' . $module_name . '.xml');
         $class = 'osC_' . ucfirst($set) . '_' . $module_name;
         $module = new $class();
         $module->remove();
         osC_Cache::clear('configuration');
         osC_Cache::clear('modules_' . $set);
         osC_Cache::clear('templates_' . $set . '_layout');
         $response = array('success' => true, 'feedback' => $osC_Language->get('ms_success_action_performed'));
     } else {
         $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed'));
     }
     echo $toC_Json->encode($response);
 }
Ejemplo n.º 18
0
 function deleteDefinitions($language_id, $group, $keys)
 {
     global $osC_Database;
     $error = false;
     $osC_Database->startTransaction();
     foreach ($keys as $id) {
         $Qdel = $osC_Database->query('delete from :table_languages_definitions where id = :id');
         $Qdel->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
         $Qdel->bindValue(':id', $id);
         $Qdel->setLogging($_SESSION['module'], $id);
         $Qdel->execute();
         if ($osC_Database->isError()) {
             $error = true;
             break;
         }
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         osC_Cache::clear('languages-' . osC_Language_Admin::getData($language_id, 'code') . '-' . $group);
         return true;
     }
     $osC_Database->rollbackTransaction();
     return false;
 }
Ejemplo n.º 19
0
 public static function delete($id)
 {
     global $osC_Database, $osC_Image;
     $Qim = $osC_Database->query('select id from :table_products_images where products_id = :products_id');
     $Qim->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
     $Qim->bindInt(':products_id', $id);
     $Qim->execute();
     while ($Qim->next()) {
         $osC_Image->delete($Qim->valueInt('id'));
     }
     $Qp = $osC_Database->query('delete from :table_products where products_id = :products_id');
     $Qp->bindTable(':table_products', TABLE_PRODUCTS);
     $Qp->bindInt(':products_id', $id);
     $Qp->setLogging($_SESSION['module'], $id);
     $Qp->execute();
     if (!$osC_Database->isError()) {
         osC_Cache::clear('categories');
         osC_Cache::clear('category_tree');
         osC_Cache::clear('also_purchased');
         osC_Cache::clear('box-whats_new');
         return true;
     }
     return false;
 }
Ejemplo n.º 20
0
 function setStatus($id, $flag)
 {
     global $osC_Database;
     $Qstatus = $osC_Database->query('update :table_products set products_status = :products_status where products_id = :products_id');
     $Qstatus->bindTable(':table_products', TABLE_PRODUCTS);
     $Qstatus->bindInt(":products_id", $id);
     $Qstatus->bindValue(":products_status", $flag);
     $Qstatus->execute();
     if (!$osC_Database->isError()) {
         osC_Cache::clear('categories');
         osC_Cache::clear('category_tree');
         osC_Cache::clear('also_purchased');
         osC_Cache::clear('sefu-products');
         osC_Cache::clear('new_products');
         osC_Cache::clear('feature_products');
         return true;
     }
     return false;
 }
Ejemplo n.º 21
0
 function delete($id)
 {
     global $osC_Database, $osC_Image;
     $error = false;
     $osC_Database->startTransaction();
     $osC_Image->deleteArticlesImage($id);
     $Qad = $osC_Database->query('delete from :table_articles_description where articles_id = :articles_id');
     $Qad->bindTable(':table_articles_description', TABLE_ARTICLES_DESCRIPTION);
     $Qad->bindInt(':articles_id', $id);
     $Qad->setLogging($_SESSION['module'], $id);
     $Qad->execute();
     if ($osC_Database->isError()) {
         $error = true;
     }
     if ($error === false) {
         $Qarticles = $osC_Database->query('delete from :table_articles where articles_id = :articles_id');
         $Qarticles->bindTable(':table_articles', TABLE_ARTICLES);
         $Qarticles->bindInt(':articles_id', $id);
         $Qarticles->setLogging($_SESSION['module'], $id);
         $Qarticles->execute();
         if ($osC_Database->isError()) {
             $error = true;
         }
         if ($error === false) {
             $osC_Database->commitTransaction();
             osC_Cache::clear('sefu-articles');
             return true;
         }
     }
     $osC_Database->rollbackTransaction();
     return false;
 }
Ejemplo n.º 22
0
 public static function delete($id, $categories = null)
 {
     global $osC_Database, $osC_Image;
     $delete_product = true;
     $error = false;
     $osC_Database->startTransaction();
     if (is_array($categories) && !empty($categories)) {
         $Qpc = $osC_Database->query('delete from :table_products_to_categories where products_id = :products_id and categories_id in :categories_id');
         $Qpc->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
         $Qpc->bindInt(':products_id', $id);
         $Qpc->bindRaw(':categories_id', '("' . implode('", "', $categories) . '")');
         $Qpc->setLogging($_SESSION['module'], $id);
         $Qpc->execute();
         if (!$osC_Database->isError()) {
             $Qcheck = $osC_Database->query('select products_id from :table_products_to_categories where products_id = :products_id limit 1');
             $Qcheck->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
             $Qcheck->bindInt(':products_id', $id);
             $Qcheck->execute();
             if ($Qcheck->numberOfRows() > 0) {
                 $delete_product = false;
             }
         } else {
             $error = true;
         }
     }
     if ($error === false && $delete_product === true) {
         $Qvariants = $osC_Database->query('select products_id from :table_products where parent_id = :parent_id');
         $Qvariants->bindTable(':table_products', TABLE_PRODUCTS);
         $Qvariants->bindInt(':parent_id', $id);
         $Qvariants->execute();
         while ($Qvariants->next()) {
             $Qsc = $osC_Database->query('delete from :table_shopping_carts where products_id = :products_id');
             $Qsc->bindTable(':table_shopping_carts', TABLE_SHOPPING_CARTS);
             $Qsc->bindInt(':products_id', $Qvariants->valueInt('products_id'));
             $Qsc->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
             if ($error === false) {
                 $Qsccvv = $osC_Database->query('delete from :table_shopping_carts_custom_variants_values where products_id = :products_id');
                 $Qsccvv->bindTable(':table_shopping_carts_custom_variants_values', TABLE_SHOPPING_CARTS_CUSTOM_VARIANTS_VALUES);
                 $Qsccvv->bindInt(':products_id', $Qvariants->valueInt('products_id'));
                 $Qsccvv->execute();
                 if ($osC_Database->isError()) {
                     $error = true;
                 }
             }
             if ($error === false) {
                 $Qpa = $osC_Database->query('delete from :table_products_variants where products_id = :products_id');
                 $Qpa->bindTable(':table_products_variants', TABLE_PRODUCTS_VARIANTS);
                 $Qpa->bindInt(':products_id', $Qvariants->valueInt('products_id'));
                 $Qpa->setLogging($_SESSION['module'], $id);
                 $Qpa->execute();
                 if ($osC_Database->isError()) {
                     $error = true;
                 }
             }
             if ($error === false) {
                 $Qp = $osC_Database->query('delete from :table_products where products_id = :products_id');
                 $Qp->bindTable(':table_products', TABLE_PRODUCTS);
                 $Qp->bindInt(':products_id', $Qvariants->valueInt('products_id'));
                 $Qp->setLogging($_SESSION['module'], $id);
                 $Qp->execute();
                 if ($osC_Database->isError()) {
                     $error = true;
                 }
             }
         }
         if ($error === false) {
             $Qr = $osC_Database->query('delete from :table_reviews where products_id = :products_id');
             $Qr->bindTable(':table_reviews', TABLE_REVIEWS);
             $Qr->bindInt(':products_id', $id);
             $Qr->setLogging($_SESSION['module'], $id);
             $Qr->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $Qsc = $osC_Database->query('delete from :table_shopping_carts where products_id = :products_id');
             $Qsc->bindTable(':table_shopping_carts', TABLE_SHOPPING_CARTS);
             $Qsc->bindInt(':products_id', $id);
             $Qsc->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $Qsccvv = $osC_Database->query('delete from :table_shopping_carts_custom_variants_values where products_id = :products_id');
             $Qsccvv->bindTable(':table_shopping_carts_custom_variants_values', TABLE_SHOPPING_CARTS_CUSTOM_VARIANTS_VALUES);
             $Qsccvv->bindInt(':products_id', $id);
             $Qsccvv->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $Qp2c = $osC_Database->query('delete from :table_products_to_categories where products_id = :products_id');
             $Qp2c->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
             $Qp2c->bindInt(':products_id', $id);
             $Qp2c->setLogging($_SESSION['module'], $id);
             $Qp2c->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $Qs = $osC_Database->query('delete from :table_specials where products_id = :products_id');
             $Qs->bindTable(':table_specials', TABLE_SPECIALS);
             $Qs->bindInt(':products_id', $id);
             $Qs->setLogging($_SESSION['module'], $id);
             $Qs->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $Qpa = $osC_Database->query('delete from :table_products_variants where products_id = :products_id');
             $Qpa->bindTable(':table_products_variants', TABLE_PRODUCTS_VARIANTS);
             $Qpa->bindInt(':products_id', $id);
             $Qpa->setLogging($_SESSION['module'], $id);
             $Qpa->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $Qpd = $osC_Database->query('delete from :table_products_description where products_id = :products_id');
             $Qpd->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
             $Qpd->bindInt(':products_id', $id);
             $Qpd->setLogging($_SESSION['module'], $id);
             $Qpd->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $Qp = $osC_Database->query('delete from :table_products where products_id = :products_id');
             $Qp->bindTable(':table_products', TABLE_PRODUCTS);
             $Qp->bindInt(':products_id', $id);
             $Qp->setLogging($_SESSION['module'], $id);
             $Qp->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $Qim = $osC_Database->query('select id from :table_products_images where products_id = :products_id');
             $Qim->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
             $Qim->bindInt(':products_id', $id);
             $Qim->execute();
             while ($Qim->next()) {
                 $osC_Image->delete($Qim->valueInt('id'));
             }
         }
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         osC_Cache::clear('categories');
         osC_Cache::clear('category_tree');
         osC_Cache::clear('also_purchased');
         osC_Cache::clear('box-whats_new');
         return true;
     }
     $osC_Database->rollbackTransaction();
     return false;
 }
Ejemplo n.º 23
0
function tep_remove_product($product_id)
{
    global $osC_Database;
    $error = false;
    $Qimage = $osC_Database->query('select products_image from :table_products where products_id = :products_id');
    $Qimage->bindTable(':table_products', TABLE_PRODUCTS);
    $Qimage->bindInt(':products_id', $product_id);
    $Qimage->execute();
    $osC_Database->startTransaction();
    $Qr = $osC_Database->query('delete from :table_reviews where products_id = :products_id');
    $Qr->bindTable(':table_reviews', TABLE_REVIEWS);
    $Qr->bindInt(':products_id', $product_id);
    $Qr->execute();
    if ($osC_Database->isError() === true) {
        $error = true;
    }
    if ($error === false) {
        $Qcba = $osC_Database->query('delete from :table_customers_basket_attributes where products_id = :products_id');
        $Qcba->bindTable(':table_customers_basket_attributes', TABLE_CUSTOMERS_BASKET_ATTRIBUTES);
        $Qcba->bindInt(':products_id', $product_id);
        $Qcba->execute();
        if ($osC_Database->isError() === true) {
            $error = true;
        }
    }
    if ($error === false) {
        $Qcb = $osC_Database->query('delete from :table_customers_basket where products_id = :products_id');
        $Qcb->bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET);
        $Qcb->bindInt(':products_id', $product_id);
        $Qcb->execute();
        if ($osC_Database->isError() === true) {
            $error = true;
        }
    }
    if ($error === false) {
        $Qp2c = $osC_Database->query('delete from :table_products_to_categories where products_id = :products_id');
        $Qp2c->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
        $Qp2c->bindInt(':products_id', $product_id);
        $Qp2c->execute();
        if ($osC_Database->isError() === true) {
            $error = true;
        }
    }
    if ($error === false) {
        $Qs = $osC_Database->query('delete from :table_specials where products_id = :products_id');
        $Qs->bindTable(':table_specials', TABLE_SPECIALS);
        $Qs->bindInt(':products_id', $product_id);
        $Qs->execute();
        if ($osC_Database->isError() === true) {
            $error = true;
        }
    }
    if ($error === false) {
        $Qpa = $osC_Database->query('delete from :table_products_attributes where products_id = :products_id');
        $Qpa->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
        $Qpa->bindInt(':products_id', $product_id);
        $Qpa->execute();
        if ($osC_Database->isError() === true) {
            $error = true;
        }
    }
    if ($error === false) {
        $Qpd = $osC_Database->query('delete from :table_products_description where products_id = :products_id');
        $Qpd->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
        $Qpd->bindInt(':products_id', $product_id);
        $Qpd->execute();
        if ($osC_Database->isError() === true) {
            $error = true;
        }
    }
    if ($error === false) {
        $Qp = $osC_Database->query('delete from :table_products where products_id = :products_id');
        $Qp->bindTable(':table_products', TABLE_PRODUCTS);
        $Qp->bindInt(':products_id', $product_id);
        $Qp->execute();
        if ($osC_Database->isError() === true) {
            $error = true;
        }
    }
    if ($error === false) {
        $osC_Database->commitTransaction();
        osC_Cache::clear('categories');
        osC_Cache::clear('category_tree');
        osC_Cache::clear('also_purchased');
        if (tep_not_null($Qimage->value('products_image'))) {
            $Qcheck = $osC_Database->query('select count(*) as total from :table_products where products_image = :products_image');
            $Qcheck->bindTable(':table_products', TABLE_PRODUCTS);
            $Qcheck->bindValue(':products_image', $Qimage->value('products_image'));
            $Qcheck->execute();
            if ($Qcheck->numberOfRows() === 0) {
                if (file_exists(realpath('../images/' . $Qimage->value('products_image')))) {
                    @unlink(realpath('../images/' . $Qimage->value('products_image')));
                }
            }
        }
    } else {
        $osC_Database->rollbackTransaction();
    }
}
Ejemplo n.º 24
0
 function assignLocalImages()
 {
     global $toC_Json, $osC_Database, $osC_Language, $osC_Session;
     if (isset($_REQUEST['localimages'])) {
         $localimages = explode(',', $_REQUEST['localimages']);
         if (isset($_REQUEST['products_id']) && is_numeric($_REQUEST['products_id'])) {
             $osC_Image = new osC_Image_Admin();
             $default_flag = 1;
             $Qcheck = $osC_Database->query('select id from :table_products_images where products_id = :products_id and default_flag = :default_flag limit 1');
             $Qcheck->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
             $Qcheck->bindInt(':products_id', $_REQUEST['products_id']);
             $Qcheck->bindInt(':default_flag', 1);
             $Qcheck->execute();
             if ($Qcheck->numberOfRows() === 1) {
                 $default_flag = 0;
             }
             foreach ($localimages as $image) {
                 $image = basename($image);
                 if (file_exists('../images/products/_upload/' . $image)) {
                     copy('../images/products/_upload/' . $image, '../images/products/originals/' . $image);
                     @unlink('../images/products/_upload/' . $image);
                     if (isset($_REQUEST['products_id'])) {
                         $Qimage = $osC_Database->query('insert into :table_products_images (products_id, image, default_flag, sort_order, date_added) values (:products_id, :image, :default_flag, :sort_order, :date_added)');
                         $Qimage->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
                         $Qimage->bindInt(':products_id', $_REQUEST['products_id']);
                         $Qimage->bindValue(':image', $image);
                         $Qimage->bindInt(':default_flag', $default_flag);
                         $Qimage->bindInt(':sort_order', 0);
                         $Qimage->bindRaw(':date_added', 'now()');
                         $Qimage->execute();
                         if (!$osC_Database->isError()) {
                             $image_id = $osC_Database->nextID();
                             $new_image_name = $_REQUEST['products_id'] . '_' . $image_id . '_' . $image;
                             @rename('../images/products/originals/' . $image, '../images/products/originals/' . $new_image_name);
                             $Qupdate = $osC_Database->query('update :table_products_images set image = :image where id = :id');
                             $Qupdate->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES);
                             $Qupdate->bindValue(':image', $new_image_name);
                             $Qupdate->bindInt(':id', $image_id);
                             $Qupdate->execute();
                         }
                         foreach ($osC_Image->getGroups() as $group) {
                             if ($group['id'] != '1') {
                                 $osC_Image->resize($new_image_name, $group['id']);
                             }
                         }
                         //clear product cache
                         osC_Cache::clear('product-' . $_REQUEST['products_id']);
                     }
                 }
             }
         } else {
             foreach ($localimages as $image) {
                 $image = basename($image);
                 $image_path = '../images/products/_upload/' . $osC_Session->getID() . '/';
                 toc_mkdir($image_path);
                 if (file_exists('../images/products/_upload/' . $image)) {
                     copy('../images/products/_upload/' . $image, $image_path . $image);
                 }
             }
         }
     }
     $response['success'] = true;
     $response['feedback'] = $osC_Language->get('ms_success_action_performed');
     echo $toC_Json->encode($response);
 }
 function save()
 {
     global $toC_Json, $osC_Database, $osC_Language;
     $error = false;
     $osC_Database->startTransaction();
     $data = array('configuration' => $_POST['configuration']);
     foreach ($data['configuration'] as $key => $value) {
         $Qupdate = $osC_Database->query('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
         $Qupdate->bindTable(':table_configuration', TABLE_CONFIGURATION);
         $Qupdate->bindValue(':configuration_value', is_array($data['configuration'][$key]) ? implode(',', $data['configuration'][$key]) : $value);
         $Qupdate->bindValue(':configuration_key', $key);
         $Qupdate->setLogging($_SESSION['module']);
         $Qupdate->execute();
         if ($osC_Database->isError()) {
             $error = true;
             break;
         }
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         osC_Cache::clear('configuration');
         $response['success'] = true;
         $response['feedback'] = $osC_Language->get('ms_success_action_performed');
     } else {
         $osC_Database->rollbackTransaction();
         $response['success'] = false;
         $response['feedback'] = $osC_Language->get('ms_error_action_not_performed');
     }
     echo $toC_Json->encode($response);
 }
Ejemplo n.º 26
0
 function remove($id)
 {
     global $osC_Database;
     $Qcheck = $osC_Database->query('select code from :table_languages where languages_id = :languages_id');
     $Qcheck->bindTable(':table_languages', TABLE_LANGUAGES);
     $Qcheck->bindInt(':languages_id', $id);
     $Qcheck->execute();
     if ($Qcheck->value('code') != DEFAULT_LANGUAGE) {
         $error = false;
         $osC_Database->startTransaction();
         $Qcategories = $osC_Database->query('delete from :table_categories_description where language_id = :language_id');
         $Qcategories->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
         $Qcategories->bindInt(':language_id', $id);
         $Qcategories->execute();
         if ($osC_Database->isError()) {
             $error = true;
         }
         if ($error === false) {
             $Qproducts = $osC_Database->query('delete from :table_products_description where language_id = :language_id');
             $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
             $Qproducts->bindInt(':language_id', $id);
             $Qproducts->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $Qproducts = $osC_Database->query('delete from :table_products_options where language_id = :language_id');
             $Qproducts->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
             $Qproducts->bindInt(':language_id', $id);
             $Qproducts->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $Qproducts = $osC_Database->query('delete from :table_products_options_values where language_id = :language_id');
             $Qproducts->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
             $Qproducts->bindInt(':language_id', $id);
             $Qproducts->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $Qmanufacturers = $osC_Database->query('delete from :table_manufacturers_info where languages_id = :languages_id');
             $Qmanufacturers->bindTable(':table_manufacturers_info', TABLE_MANUFACTURERS_INFO);
             $Qmanufacturers->bindInt(':languages_id', $id);
             $Qmanufacturers->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $Qstatus = $osC_Database->query('delete from :table_orders_status where language_id = :language_id');
             $Qstatus->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
             $Qstatus->bindInt(':language_id', $id);
             $Qstatus->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $Qlanguages = $osC_Database->query('delete from :table_languages where languages_id = :languages_id');
             $Qlanguages->bindTable(':table_languages', TABLE_LANGUAGES);
             $Qlanguages->bindInt(':languages_id', $id);
             $Qlanguages->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
         if ($error === false) {
             $osC_Database->commitTransaction();
             osC_Cache::clear('languages');
             return true;
         } else {
             $osC_Database->rollbackTransaction();
         }
     }
     return false;
 }
Ejemplo n.º 27
0
 function _save($module_name, $data, $default = false)
 {
     global $osC_Database;
     $error = false;
     $osC_Database->startTransaction();
     if (!empty($data['configuration'])) {
         if ($default === true) {
             $data['configuration']['DEFAULT_TEMPLATE'] = $module_name;
         }
         foreach ($data['configuration'] as $key => $value) {
             $Qupdate = $osC_Database->query('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
             $Qupdate->bindTable(':table_configuration', TABLE_CONFIGURATION);
             $Qupdate->bindValue(':configuration_value', $value);
             $Qupdate->bindValue(':configuration_key', $key);
             $Qupdate->setLogging($_SESSION['module']);
             $Qupdate->execute();
             if ($osC_Database->isError()) {
                 $error = true;
                 break;
             }
         }
     } elseif ($default === true) {
         $Qupdate = $osC_Database->query('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
         $Qupdate->bindTable(':table_configuration', TABLE_CONFIGURATION);
         $Qupdate->bindValue(':configuration_value', $module_name);
         $Qupdate->bindValue(':configuration_key', 'DEFAULT_TEMPLATE');
         $Qupdate->setLogging($_SESSION['module']);
         $Qupdate->execute();
         if ($osC_Database->isError()) {
             $error = true;
         }
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         osC_Cache::clear('configuration');
         return true;
     }
     $osC_Database->rollbackTransaction();
     return false;
 }
Ejemplo n.º 28
0
 function _uninstall($module_key)
 {
     global $osC_Database;
     include 'includes/modules/services/' . $module_key . '.php';
     $class = 'osC_Services_' . $module_key . '_Admin';
     $module = new $class();
     $module->remove();
     unset($this->_installed[array_search($module_key, $this->_installed)]);
     $Qsu = $osC_Database->query('update :table_configuration set configuration_value = :configuration_value where configuration_key = :configuration_key');
     $Qsu->bindTable(':table_configuration', TABLE_CONFIGURATION);
     $Qsu->bindValue(':configuration_value', implode(';', $this->_installed));
     $Qsu->bindValue(':configuration_key', 'MODULE_SERVICES_INSTALLED');
     $Qsu->execute();
     if (!$osC_Database->isError()) {
         osC_Cache::clear('configuration');
         return true;
     }
     return false;
 }
Ejemplo n.º 29
0
 function delete($id = null)
 {
     global $osC_Database;
     $Qimage = $osC_Database->query('select * from :table_slide_images where image_id = :image_id');
     $Qimage->bindTable(':table_slide_images', TABLE_SLIDE_IMAGES);
     $Qimage->bindInt(':image_id', $id);
     $Qimage->execute();
     if ($Qimage->numberOfRows() > 0) {
         @unlink(DIR_FS_CATALOG . 'images/' . $Qimage->value('image'));
     }
     $Qdelete = $osC_Database->query('delete from :table_slide_images where image_id = :image_id');
     $Qdelete->bindTable(':table_slide_images', TABLE_SLIDE_IMAGES);
     $Qdelete->bindInt(':image_id', $id);
     $Qdelete->setLogging($_SESSION['module'], $id);
     $Qdelete->execute();
     if ($osC_Database->isError()) {
         return false;
     } else {
         osC_Cache::clear('slide-images');
         return true;
     }
 }
Ejemplo n.º 30
0
 function install()
 {
     global $osC_Database, $osC_Language;
     $Qinstall = $osC_Database->query('insert into :table_templates_boxes (title, code, author_name, author_www, modules_group) values (:title, :code, :author_name, :author_www, :modules_group)');
     $Qinstall->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
     $Qinstall->bindValue(':title', $this->_title);
     $Qinstall->bindValue(':code', $this->_code);
     $Qinstall->bindValue(':author_name', $this->_author_name);
     $Qinstall->bindValue(':author_www', $this->_author_www);
     $Qinstall->bindValue(':modules_group', $this->_group);
     $Qinstall->execute();
     foreach ($osC_Language->getAll() as $key => $value) {
         if (file_exists(dirname(__FILE__) . '/../languages/' . $key . '/modules/' . $this->_group . '/' . $this->_code . '.xml')) {
             foreach ($osC_Language->extractDefinitions($key . '/modules/' . $this->_group . '/' . $this->_code . '.xml') as $def) {
                 $Qcheck = $osC_Database->query('select id from :table_languages_definitions where definition_key = :definition_key and content_group = :content_group and languages_id = :languages_id limit 1');
                 $Qcheck->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                 $Qcheck->bindValue(':definition_key', $def['key']);
                 $Qcheck->bindValue(':content_group', $def['group']);
                 $Qcheck->bindInt(':languages_id', $value['id']);
                 $Qcheck->execute();
                 if ($Qcheck->numberOfRows() === 1) {
                     $Qdef = $osC_Database->query('update :table_languages_definitions set definition_value = :definition_value where definition_key = :definition_key and content_group = :content_group and languages_id = :languages_id');
                 } else {
                     $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)');
                 }
                 $Qdef->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
                 $Qdef->bindInt(':languages_id', $value['id']);
                 $Qdef->bindValue(':content_group', $def['group']);
                 $Qdef->bindValue(':definition_key', $def['key']);
                 $Qdef->bindValue(':definition_value', $def['value']);
                 $Qdef->execute();
             }
         }
     }
     osC_Cache::clear('languages');
 }