function delete($id) { global $osC_Session, $osC_Database; osC_Session_Admin::delete($id); $Qwho = $osC_Database->query('delete from :table_whos_online where session_id = :session_id'); $Qwho->bindTable(':table_whos_online', TABLE_WHOS_ONLINE); $Qwho->bindValue(':session_id', $id); $Qwho->setLogging($_SESSION['module'], $id); $Qwho->execute(); if (!$osC_Database->isError()) { return true; } return false; }
$Qcfg = $osC_Database->query('select configuration_key as cfgKey, configuration_value as cfgValue from :table_configuration'); $Qcfg->bindTable(':table_configuration', TABLE_CONFIGURATION); $Qcfg->setCache('configuration'); $Qcfg->execute(); while ($Qcfg->next()) { define($Qcfg->value('cfgKey'), $Qcfg->value('cfgValue')); } $Qcfg->freeResult(); // define our general functions used application-wide require '../includes/functions/general.php'; require 'includes/functions/general.php'; require '../includes/functions/html_output.php'; require 'includes/functions/html_output.php'; // include session class include 'includes/classes/session.php'; $osC_Session = new osC_Session_Admin('toCAdminID'); $osC_Session->start(); require 'includes/classes/directory_listing.php'; require 'includes/classes/access.php'; require '../includes/classes/address.php'; require '../includes/classes/weight.php'; require '../includes/classes/xml.php'; require '../includes/classes/datetime.php'; // set the language require 'includes/classes/language.php'; $osC_Language = new osC_Language_Admin(); if (isset($_GET['language']) && !empty($_GET['language'])) { $osC_Language->set($_GET['language']); } $osC_Language->loadIniFile(); header('Content-Type: text/html; charset=' . $osC_Language->getCharacterSet());
function delete($id, $delete_reviews = true) { global $osC_Database; $error = false; $osC_Database->startTransaction(); if ($delete_reviews === true) { $Qreviews = $osC_Database->query('delete from :table_reviews where customers_id = :customers_id'); $Qreviews->bindTable(':table_reviews', TABLE_REVIEWS); $Qreviews->bindInt(':customers_id', $id); $Qreviews->setLogging($_SESSION['module'], $id); $Qreviews->execute(); if ($osC_Database->isError()) { $error = true; } } else { $Qcheck = $osC_Database->query('select reviews_id from :table_reviews where customers_id = :customers_id limit 1'); $Qcheck->bindTable(':table_reviews', TABLE_REVIEWS); $Qcheck->bindInt(':customers_id', $id); $Qcheck->execute(); if ($Qcheck->numberOfRows() > 0) { $Qreviews = $osC_Database->query('update :table_reviews set customers_id = null where customers_id = :customers_id'); $Qreviews->bindTable(':table_reviews', TABLE_REVIEWS); $Qreviews->bindInt(':customers_id', $id); $Qreviews->setLogging($_SESSION['module'], $id); $Qreviews->execute(); if ($osC_Database->isError()) { $error = true; } } } if ($error === false) { $Qab = $osC_Database->query('delete from :table_address_book where customers_id = :customers_id'); $Qab->bindTable(':table_address_book', TABLE_ADDRESS_BOOK); $Qab->bindInt(':customers_id', $id); $Qab->setLogging($_SESSION['module'], $id); $Qab->execute(); if ($osC_Database->isError()) { $error = true; } } if ($error === false) { $Qcch = $osC_Database->query('delete from :table_customers_credits_history where customers_id = :customers_id'); $Qcch->bindTable(':table_customers_credits_history', TABLE_CUSTOMERS_CREDITS_HISTORY); $Qcch->bindInt(':customers_id', $id); $Qcch->setLogging($_SESSION['module'], $id); $Qcch->execute(); if ($osC_Database->isError()) { $error = true; } } if ($error === false) { $Qwp = $osC_Database->query('delete from :table_wishlists_products where wishlists_id = (select wishlists_id from :table_wishlists where customers_id = :customers_id)'); $Qwp->bindTable(':table_wishlists_products', TABLE_WISHLISTS_PRODUCTS); $Qwp->bindTable(':table_wishlists', TABLE_WISHLISTS); $Qwp->bindInt(':customers_id', $id); $Qwp->setLogging($_SESSION['module'], $id); $Qwp->execute(); if ($osC_Database->isError()) { $error = true; } } if ($error === false) { $Qw = $osC_Database->query('delete from :table_wishlists where customers_id = :customers_id'); $Qw->bindTable(':table_wishlists', TABLE_WISHLISTS); $Qw->bindInt(':customers_id', $id); $Qw->setLogging($_SESSION['module'], $id); $Qw->execute(); if ($osC_Database->isError()) { $error = true; } } if ($error === false) { $Qcb = $osC_Database->query('delete from :table_customers_basket where customers_id = :customers_id'); $Qcb->bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET); $Qcb->bindInt(':customers_id', $id); $Qcb->execute(); if ($osC_Database->isError()) { $error = true; } } if ($error === false) { $Qpn = $osC_Database->query('delete from :table_products_notifications where customers_id = :customers_id'); $Qpn->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS); $Qpn->bindInt(':customers_id', $id); $Qpn->setLogging($_SESSION['module'], $id); $Qpn->execute(); if ($osC_Database->isError()) { $error = true; } } if ($error === false) { $Qcheck = $osC_Database->query('select session_id from :table_whos_online where customer_id = :customer_id'); $Qcheck->bindTable(':table_whos_online', TABLE_WHOS_ONLINE); $Qcheck->bindInt(':customer_id', $id); $Qcheck->execute(); if ($Qcheck->numberOfRows() > 0) { osC_Session_Admin::delete($Qcheck->value('session_id')); $Qwho = $osC_Database->query('delete from :table_whos_online where customer_id = :customer_id'); $Qwho->bindTable(':table_whos_online', TABLE_WHOS_ONLINE); $Qwho->bindInt(':customer_id', $id); $Qwho->execute(); if ($osC_Database->isError()) { $error = true; } } } if ($error === false) { $Qcustomers = $osC_Database->query('delete from :table_customers where customers_id = :customers_id'); $Qcustomers->bindTable(':table_customers', TABLE_CUSTOMERS); $Qcustomers->bindInt(':customers_id', $id); $Qcustomers->setLogging($_SESSION['module'], $id); $Qcustomers->execute(); if ($osC_Database->isError()) { $error = true; } } if ($error === false) { $osC_Database->commitTransaction(); return true; } $osC_Database->rollbackTransaction(); return false; }