function process($file) { // include needed functions include 'includes/classes/' . FILENAME_IMAGEMANIPULATOR; @vam_set_time_limit(0); // action // get images in original_images folder $files = array(); // BOF Subdirectory support require_once DIR_WS_FUNCTIONS . 'trumbnails_add_funcs.php'; $files = vam_get_files_in_dir(DIR_FS_CATALOG_ORIGINAL_IMAGES); // echo '<pre>';var_dump($files);echo '</pre>'; /* if ($dir= opendir(DIR_FS_CATALOG_ORIGINAL_IMAGES)){ while ($file = readdir($dir)) { if (is_file(DIR_FS_CATALOG_ORIGINAL_IMAGES.$file) and ($file !="index.html") and (strtolower($file) != "thumbs.db")){ $files[]=array( 'id' => $file, 'text' =>$file); } } closedir($dir); } */ // EOF Subdirectory support for ($i = 0; $n = sizeof($files), $i < $n; $i++) { $products_image_name = $files[$i]['text']; if ($files[$i]['text'] != 'Thumbs.db' && $files[$i]['text'] != 'Index.html') { require DIR_WS_INCLUDES . 'product_thumbnail_images.php'; require DIR_WS_INCLUDES . 'product_info_images.php'; require DIR_WS_INCLUDES . 'product_popup_images.php'; } } }
require 'includes/application_top.php'; require DIR_WS_CLASSES . 'currencies.php'; $currencies = new currencies(); require_once DIR_FS_CATALOG . DIR_WS_INCLUDES . 'external/phpmailer/class.phpmailer.php'; require_once DIR_FS_INC . 'vam_php_mail.inc.php'; $payments_statuses = array(); $payments_status_array = array(); $payments_status_query = vam_db_query("select affiliate_payment_status_id, affiliate_payment_status_name from " . TABLE_AFFILIATE_PAYMENT_STATUS . " where affiliate_language_id = '" . $_SESSION['languages_id'] . "'"); while ($payments_status = vam_db_fetch_array($payments_status_query)) { $payments_statuses[] = array('id' => $payments_status['affiliate_payment_status_id'], 'text' => $payments_status['affiliate_payment_status_name']); $payments_status_array[$payments_status['affiliate_payment_status_id']] = $payments_status['affiliate_payment_status_name']; } switch ($_GET['action']) { case 'start_billing': // Billing can be a lengthy process vam_set_time_limit(0); // We are only billing orders which are AFFILIATE_BILLING_TIME days old $time = mktime(1, 1, 1, date("m"), date("d") - AFFILIATE_BILLING_TIME, date("Y")); $oldday = date("Y-m-d", $time); // Select all affiliates who earned enough money since last payment $sql = "\n SELECT a.affiliate_id, sum(a.affiliate_payment) \n FROM " . TABLE_AFFILIATE_SALES . " a, " . TABLE_ORDERS . " o \n WHERE a.affiliate_billing_status != 1 and a.affiliate_orders_id = o.orders_id and o.orders_status >= " . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . " and a.affiliate_date <= '" . $oldday . "' \n GROUP by a.affiliate_id \n having sum(a.affiliate_payment) >= '" . AFFILIATE_THRESHOLD . "'\n "; $affiliate_payment_query = vam_db_query($sql); // Start Billing: while ($affiliate_payment = vam_db_fetch_array($affiliate_payment_query)) { // mysql does not support joins in update (planned in 4.x) // Get all orders which are AFFILIATE_BILLING_TIME days old $sql = "\n SELECT a.affiliate_orders_id \n FROM " . TABLE_AFFILIATE_SALES . " a, " . TABLE_ORDERS . " o \n WHERE a.affiliate_billing_status!=1 and a.affiliate_orders_id=o.orders_id and o.orders_status>=" . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . " and a.affiliate_id='" . $affiliate_payment['affiliate_id'] . "' and a.affiliate_date <= '" . $oldday . "'\n "; $affiliate_orders_query = vam_db_query($sql); $orders_id = "("; while ($affiliate_orders = vam_db_fetch_array($affiliate_orders_query)) { $orders_id .= $affiliate_orders['affiliate_orders_id'] . ",";
function sql_backup() { vam_set_time_limit(0); $backup_file = DIR_FS_ADMIN_BACKUP . $this->cip_name . '.sql'; // From original admin/backup.php: $fp = fopen($backup_file, 'w'); $schema = '# Contrib Installer.' . "\n" . '# Makes customizing VaM Shop "simple".' . "\n" . '# Copyright (c) ' . date('Y') . ' Vlad Savitsky' . "\n" . '# http://vamshop.ru' . "\n" . '#' . "\n" . '# Database Backup For ' . STORE_NAME . "\n" . '#' . "\n" . '# Database: ' . DB_DATABASE . "\n" . '# Database Server: ' . DB_SERVER . "\n" . '#' . "\n" . '# Backup Date: ' . date(PHP_DATE_TIME_FORMAT) . "\n\n"; fputs($fp, $schema); $tables_query = cip_db_query('show tables'); while ($tables = vam_db_fetch_array($tables_query)) { list(, $table) = each($tables); $schema = 'drop table if exists `' . $table . '`;' . "\n" . 'create table `' . $table . '` (' . "\n"; $table_list = array(); $fields_query = cip_db_query("show fields from `" . $table . "`"); while ($fields = vam_db_fetch_array($fields_query)) { $table_list[] = $fields['Field']; $schema .= ' `' . $fields['Field'] . '` ' . $fields['Type']; if (strlen($fields['Default']) > 0) { $schema .= ' default \'' . $fields['Default'] . '\''; } if ($fields['Null'] != 'YES') { $schema .= ' not null'; } if (isset($fields['Extra'])) { $schema .= ' ' . $fields['Extra']; } $schema .= ',' . "\n"; } $schema = preg_replace("/,\n\$/", '', $schema); // add the keys $index = array(); $keys_query = cip_db_query("show keys from `" . $table . "`"); while ($keys = vam_db_fetch_array($keys_query)) { $kname = $keys['Key_name']; if (!isset($index[$kname])) { $index[$kname] = array('unique' => !$keys['Non_unique'], 'columns' => array()); } $index[$kname]['columns'][] = $keys['Column_name']; $index[$kname]['sub_part'][] = $keys['Sub_part']; } while (list($kname, $info) = each($index)) { $schema .= ',' . "\n"; $columns = ''; foreach ($info['columns'] as $id => $col) { if ($columns == '') { $columns .= "`" . $col . "`"; } else { $columns .= ",`" . $col . "`"; } if ($info['sub_part'][$id] != NULL && $info['sub_part'][$id] != 'NULL') { $columns .= "(" . $info['sub_part'][$id] . ")"; } } if ($kname == 'PRIMARY') { $schema .= ' PRIMARY KEY (' . $columns . ')'; } elseif ($info['unique']) { $schema .= ' UNIQUE `' . $kname . '` (' . $columns . ')'; } else { $schema .= ' KEY `' . $kname . '` (' . $columns . ')'; } } $schema .= "\n" . ');' . "\n\n"; fputs($fp, $schema); // dump the data $rows_query = cip_db_query("SELECT `" . implode('`, `', $table_list) . "` from `" . $table . "`"); while ($rows = vam_db_fetch_array($rows_query)) { $schema = 'insert into `' . $table . '` (`' . implode('`, `', $table_list) . '`) values ('; reset($table_list); while (list(, $i) = each($table_list)) { if (!isset($rows[$i])) { $schema .= 'NULL, '; } elseif (vam_not_null($rows[$i])) { $row = addslashes($rows[$i]); $row = preg_replace("/\n#/", "\n" . '\\#', $row); $schema .= '\'' . $row . '\', '; } else { $schema .= '\'\', '; } } $schema = preg_replace('/, $/', '', $schema) . ');' . "\n"; fputs($fp, $schema); } } fclose($fp); gzcompressfile($backup_file); if (is_file($backup_file)) { //chmod($backup_file, 0777); ci_remove($backup_file); } if (file_exists($backup_file . '.gz')) { chmod($backup_file . '.gz', 0777); } }