Execute("delete from " . TABLE_ADMIN_ACTIVITY_LOG);
$db->Execute("optimize table " . TABLE_ADMIN_ACTIVITY_LOG);
$messageStack->add_session(SUCCESS_CLEAN_ADMIN_ACTIVITY_LOG, 'success');
unset($_SESSION['reset_admin_activity_log']);
zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
break;
// update all products in catalog
case ('update_all_products_attributes_sort_order'):
$all_products_attributes= $db->Execute("select p.products_id, pa.products_attributes_id from " .
TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_ATTRIBUTES . " pa " . "
where p.products_id= pa.products_id"
);
while (!$all_products_attributes->EOF) {
$count++;
$product_id_updated .= ' - ' . $all_products_attributes->fields['products_id'] . ':' . $all_products_attributes->fields['products_attributes_id'];
zen_update_attributes_products_option_values_sort_order($all_products_attributes->fields['products_id']);
$all_products_attributes->MoveNext();
}
$messageStack->add_session(SUCCESS_PRODUCT_UPDATE_SORT_ALL, 'success');
$action='';
zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
break;
case ('update_all_products_price_sorter'):
// reset products_price_sorter for searches etc.
$sql = "select products_id from " . TABLE_PRODUCTS;
$update_prices = $db->Execute($sql);
while (!$update_prices->EOF) {
zen_update_products_price_sorter($update_prices->fields['products_id']);
$update_prices->MoveNext();
}
$messageStack->add_session(SUCCESS_PRODUCT_UPDATE_PRODUCTS_PRICE_SORTER, 'success');
$action='';
zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
break;
case ('update_all_products_viewed'):
// reset products_viewed to 0
$sql = "update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed= '0'";
$update_viewed = $db->Execute($sql);
$messageStack->add_session(SUCCESS_PRODUCT_UPDATE_PRODUCTS_VIEWED, 'success');
$action='';
zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
break;
case ('update_all_products_ordered'):
// reset products_ordered to 0
$sql = "update " . TABLE_PRODUCTS . " set products_ordered= '0'";
$update_viewed = $db->Execute($sql);
$messageStack->add_session(SUCCESS_PRODUCT_UPDATE_PRODUCTS_ORDERED, 'success');
$action='';
zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
break;
case ('update_counter'):
// reset products_viewed to 0
$sql = "update " . TABLE_COUNTER . " set counter= '" . (int)$_POST['new_counter'] . "'";
$update_counter = $db->Execute($sql);
$messageStack->add_session(SUCCESS_UPDATE_COUNTER . (int)$_POST['new_counter'], 'success');
$action='';
zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
break;
case ('optimize_db'):
// clean out unused space in database
$sql = "SHOW TABLE STATUS FROM " . DB_DATABASE;
$tables = $db->Execute($sql);
while(!$tables->EOF) {
$db->Execute("OPTIMIZE TABLE " . $tables->fields['Name']);
$i++;
$tables->MoveNext();
}
$messageStack->add_session(SUCCESS_DB_OPTIMIZE . ' ' . $i, 'success');
$action='';
zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
break;
case ('update_all_master_categories_id'):
// reset products master categories ID
$sql = "select products_id from " . TABLE_PRODUCTS;
$check_products = $db->Execute($sql);
while (!$check_products->EOF) {
$sql = "select products_id, categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id='" . $check_products->fields['products_id'] . "'";
$check_category = $db->Execute($sql);
$sql = "update " . TABLE_PRODUCTS . " set master_categories_id='" . $check_category->fields['categories_id'] . "' where products_id='" . $check_products->fields['products_id'] . "'";
$update_viewed = $db->Execute($sql);
$check_products->MoveNext();
}
$messageStack->add_session(SUCCESS_UPDATE_ALL_MASTER_CATEGORIES_ID, 'success');
$action='';
zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
break;
case ('update_orders_id'):
$old_orders_id = zen_db_prepare_input((int)$_POST['old_orders_id']);
$new_orders_id = zen_db_prepare_input((int)$_POST['new_orders_id']);
$db->Execute("update " . TABLE_ORDERS . " set orders_id='" . $new_orders_id . "' where orders_id='" . $old_orders_id . "'");
$db->Execute("update " . TABLE_ORDERS_PRODUCTS . " set orders_id='" . $new_orders_id . "' where orders_id='" . $old_orders_id . "'");
$db->Execute("update " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " set orders_id='" . $new_orders_id . "' where orders_id='" . $old_orders_id . "'");
$db->Execute("update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set orders_id='" . $new_orders_id . "' where orders_id='" . $old_orders_id . "'");
$db->Execute("update " . TABLE_ORDERS_STATUS_HISTORY . " set orders_id='" . $new_orders_id . "' where orders_id='" . $old_orders_id . "'");
$db->Execute("update " . TABLE_ORDERS_TOTAL . " set orders_id='" . $new_orders_id . "' where orders_id='" . $old_orders_id . "'");
break;
case ('locate_configuration'):
if ($_POST['configuration_key'] == '') {
$messageStack->add_session(ERROR_CONFIGURATION_KEY_NOT_ENTERED, 'caution');
zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
}
$found = 'false';
$language_files_group = $_POST['language_files'];
// build filenames to search
switch ($language_files_group) {
case (0): // none
$filename_listing = '';
break;
case (1): // all english.php files
$check_directory = array();
$check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/';
$check_directory[] = DIR_FS_CATALOG_LANGUAGES . $template_dir . '/' . $_SESSION['language'] . '/';
$check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/' . $template_dir . '/';
$check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language']. '/extra_definitions/';
$check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language']. '/extra_definitions/' . $template_dir . '/';
$check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language']. '/modules/payment/';
$check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language']. '/modules/shipping/';
$check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language']. '/modules/order_total/';
$check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language']. '/modules/product_types/';
$check_directory[] = DIR_FS_ADMIN . DIR_WS_LANGUAGES . $_SESSION['language'] . '/';
$check_directory[] = DIR_FS_ADMIN . DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/newsletters/';
break;
case (2): // all catalog /language/*.php
$check_directory = array();
$check_directory[] = DIR_FS_CATALOG_LANGUAGES;
break;
case (3): // all catalog /language/english/*.php
$check_directory = array();
$check_directory[] = DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/';
break;
case (4): // all admin /language/*.php
$check_directory = array();
$check_directory[] = DIR_FS_ADMIN . DIR_WS_LANGUAGES;
break;
case (5): // all admin /language/english/*.php
// set directories and files names
$check_directory = array();
$check_directory[] = DIR_FS_ADMIN . DIR_WS_LANGUAGES . $_SESSION['language'] . '/';
break;
} // eof: switch
// Check for new databases and filename in extra_datafiles directory
for ($i = 0, $n = sizeof($check_directory); $i < $n; $i++) {
//echo 'I SEE ' . $check_directory[$i] . '
';
$dir_check = $check_directory[$i];
$file_extension = '.php';
if ($dir = @dir($dir_check)) {
while ($file = $dir->read()) {
if (!is_dir($dir_check . $file)) {
if (substr($file, strrpos($file, '.')) == $file_extension) {
$directory_array[] = $dir_check . $file;
}
}
}
if (sizeof($directory_array)) {
sort($directory_array);
}
$dir->close();
}
}
// show path and filename
echo '
' . ' ' . 'Searching ' . sizeof($directory_array) . ' files ...' . ' |
' . "\n"; $show_file .= ' |
'; $show_file .= '' . $file . ''; $show_file .= ' |
';
// put file into an array to be scanned
$lines = file($file);
$found_line = 'false';
// loop through the array, show line and line numbers
foreach ($lines as $line_num => $line) {
$cnt_lines++;
if (strstr(strtoupper($line), strtoupper($configuration_key_lookup))) {
$found_line= 'true';
$found = 'true';
$show_file .= " Line #{$line_num} : " . htmlspecialchars($line) . " \n"; } else { if ($cnt_lines >= 5) { // $show_file .= ' .'; $cnt_lines=0; } } } } $show_file .= ' |
' . zen_draw_separator('pixel_black.gif', '100%', '2') . ' |
' . zen_draw_separator('pixel_black.gif', '100%', '2') . ' |
|