Jump to content

martina

Members
  • Content count

    13
  • Joined

  • Last visited

1 Follower

About martina

  • Birthday 09/15/1947

Profile Information

  • Real Name
    Martina di Vertacollini
  • Website
  1. martina

    Database Optimizer

    Thanks Jack, I optimized my database and the result is great: Store database has been optimized. Database was optimized. Initial size was 26809745. Final, optimized, size is 5486202!! Regards, Martina
  2. Hi Mike, By accident I wrote a "reply" yesterday but is was done with the "report"-button, and is now lost; so again: I managed to find an unprintable/invisible character in the line where the content is shown (tep_draw_textarea_field etc etc. : it is located just after tep_get_products_description($pInfo->products_id, $languages[$i . It occurs in your provided categories.php and in the install.txt. When I replace this whole line of code with the one I had, the content shows up and is editable and can be saved. So this problem is solved. But two more problems arise: these are error messages at the bottom of the screen: 1. Notice: Use of undefined constant ENABLE_SSL - assumed 'ENABLE_SSL' in /var/www/sleepcool/admin/includes/functions/html_output.php on line 58 (just above the two buttons on the bottom) 2. Notice: Unknown: Skipping numeric key 0 in Unknown on line 0 (right at the bottom of the screen) 1. is strange because ENABLE_SSL is defined in configure.php and 2. is totally vague to me. Also I have a question: how can i make the tab-content-height the same height as the content? I tried everything but to no avail. Thanks in advance. Martina
  3. martina

    Contribution: Auto Backup Database

    I have been busy creating something myself and am happy with it. Maybe it is of value to others. I added a few lines in the beginning of auto_backup_db.php so it get the path that is needed when you call the file from cron: // Include the neccesary files and settings // Set the path to the osCommerce ADMIN catalog from this file if (!isset($PHP_SELF)) $PHP_SELF = $_SERVER['PHP_SELF']; $path = dirname($PHP_SELF); $base = explode( "automatic",$PHP_SELF); $path_rel = $base[0] . 'admin/'; and added a few lines at the end to purge the old files: $dbfiles = 'db_' . DB_DATABASE. '*'; $execprgold = 'find '. $path_rel . ' -name ' . $dbfiles . ' -type f -mtime +' . BACKUP_KEEP . ' -exec rm -v {} \; >> ' . $path_rel . 'backups/purgebackups.log' ; exec($execprgold); Furthermore a new configuration item is needed: BACKUP_KEEP which says the number of days to keep backups (default 3): INSERT INTO `configuration` ( `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ( 'Auto Backup Keep', 'BACKUP_KEEP', '3', 'How many days you wnat to keep bakcups', 12956, 4, '2009-11-09 17:13:33', '0000-00-00 00:00:00', NULL, NULL); I put the auto_backup_db.php in a separate directory where exists an .htaccess file with only the ip adresses that can access this directory (my ipadresses, owner and hosting service). The complete file to call with cron becomes: <?php /* $Id: auto_backup_db.php, v 3.0 24/09/2009 13:00:00 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ // Include the neccesary files and settings // Set the path to the osCommerce ADMIN catalog from this file if (!isset($PHP_SELF)) $PHP_SELF = $_SERVER['PHP_SELF']; $path = dirname($PHP_SELF); $base = explode( "automatic",$PHP_SELF); $path_rel = $base[0] . 'admin/'; // initialise database etc if cron job if(!defined('DB_DATABASE')) { $cron = true; require ($path_rel . 'includes/configure.php'); require ($path_rel . 'includes/functions/database.php'); tep_db_connect() or die('Unable to connect to database server!'); require($path_rel.'includes/functions/general.php'); require($path_rel.'includes/database_tables.php'); include($path_rel.'includes/languages/dutch.php'); $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION); while ($configuration = tep_db_fetch_array($configuration_query)) { define($configuration['cfgKey'], $configuration['cfgValue']); } } include($path_rel.'includes/languages/dutch/backup.php'); // set vars for php4 $at_backup_db = NULL;$saving = NULL;$zip = NULL;$gzip = NULL;$at_total = 0; // check if the backup directory exists $at_dir_ok = false; if (is_dir(DIR_FS_BACKUP)) { if (is_writeable(DIR_FS_BACKUP)) { $at_dir_ok = true; } else { if ($cron) { echo ERROR_BACKUP_DIRECTORY_NOT_WRITEABLE; } else { $messageStack->add_session('', 'none'); $messageStack->add(ERROR_BACKUP_DIRECTORY_NOT_WRITEABLE, 'error'); } } } else { if ($cron) { echo ERROR_BACKUP_DIRECTORY_DOES_NOT_EXIST; } else { $messageStack->add_session('', 'none'); $messageStack->add(ERROR_BACKUP_DIRECTORY_DOES_NOT_EXIST, 'error'); } } // comment out if you cant get library installed //if (BACKUP_ZIP == 'true') { //require_once('PEAR.php'); //include ('Archive/Zip.php'); //} // comment out if you cant get library installed //create sort func function Comp($a, $B) { return (strstr($a, DB_DATABASE) < strstr($b, DB_DATABASE)) ? -1 : 1; } // time function microtime_float() { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } //format function str_format_number($String, $Format){ if ($Format == '') return $String; if ($String == '') return $String; $Result = ''; $FormatPos = 0; $StringPos = 0; While ((strlen($Format) - 1) >= $FormatPos){ //If its a number => stores it if (is_numeric(substr($Format, $FormatPos, 1))){ $Result .= substr($String, $StringPos, 1); $StringPos++; //If it is not a number => stores the caracter } Else { $Result .= substr($Format, $FormatPos, 1); } //Next caracter at the mask. $FormatPos++; } return $Result; } if ($at_dir_ok == true) { $at_dir = dir(DIR_FS_BACKUP); $at_contents = array(); while ($at_file = $at_dir->read()) { if (!is_dir(DIR_FS_BACKUP . $at_file)) { $at_contents[]=$at_file; } } if (sizeof($at_contents)) { usort($at_contents, 'Comp'); $at_total = sizeof($at_contents)-1; $at_entry = $at_contents[$at_total]; $at_last = ($at_total ? $at_contents[$at_total-1] : 0); $at_ref_entry = $at_entry; $at_entry = strstr($at_entry, DB_DATABASE); $at_entry = eregi_replace(DB_DATABASE . '[_-]', '', $at_entry); $at_entry = eregi_replace('[.a-z]', '', $at_entry); $at_last = strstr($at_last, DB_DATABASE); $at_last = eregi_replace(DB_DATABASE . '[_-]', '', $at_last); $at_last = eregi_replace('[.a-z]', '', $at_last); $at_current_date = strtotime(date('Y-m-d H:i')); $at_entry =($at_entry ? $at_entry : '200001010000'); $at_last =($at_last ? $at_last : '200001010000'); $format = '0000-00-00 00:00'; $at_entry = str_format_number($at_entry, $format); $at_last = str_format_number($at_last, $format); $at_dif_date = ($at_current_date - strtotime($at_entry))/60; $at_last_date = ($at_current_date - strtotime($at_last))/60; $at_dir->close(); //Autobackup DB Calculo de hora FIN //$messageStack->add_session('', 'none'); //$messageStack->add_session('Last backup ' . $at_dif_date . ' Minutes Ago, Previous backup ' . $at_last_date . ' Minutes Ago, Last file date read as ' . date("d-m-Y H:i", strtotime($at_entry)), 'success'); if($at_dif_date>BACKUP_INTERVAL) { $at_backup_db = 'at_backupnow';$hr_dif = (int)($at_dif_date/60);$mn_dif = $at_dif_date-($hr_dif*60); $saving = 'ATTENTION: Making a Auto-Backup of your Database ... ( ' . ($hr_dif ? $hr_dif . ' Hrs ' : '') . $mn_dif . ' minutes since last backup ).'; if ($at_dif_date<(BACKUP_SAVE_INTERVAL * 60) && $at_last_date <(BACKUP_SAVE_INTERVAL * 60)) {$filename = DIR_FS_BACKUP . $at_ref_entry; if ($at_ref_entry <> '') { unlink($filename); if ($cron) { echo 'Deleted expired backup from ' . $filename . " \n\n"; } else {$messageStack->add('', 'none'); $messageStack->add('Deleted expired backup from ' . $filename, 'warning'); } } } } } else { $at_backup_db = 'at_backupnow';$saving = 'ATTENTION: Making the first Auto-Backup of your Database.';} } if (tep_not_null($at_backup_db)) { if ($cron) { echo date(PHP_DATE_TIME_FORMAT) . ' ' . $saving . " \n\n"; } else { $messageStack->add('', 'none'); $messageStack->add($saving, 'warning'); } switch ($at_backup_db) { case 'at_backupnow': tep_set_time_limit(0);$startSave = (float)microtime_float(); $at_backup_file = 'db_' . DB_DATABASE . '_' . date('YmdHi') . '.sql';//BACKUP SAVE INTERVAL BACKUP_INTERVAL if ($at_fp = fopen(DIR_FS_BACKUP . $at_backup_file, 'w')) { $tables_query = tep_db_query('show tables'); while ($tables_result = tep_db_fetch_array($tables_query)) { foreach ($tables_result as $table_results_name) { $tables.= $table_results_name . ', ' ; } } $tables = substr_replace($tables, '', -2, 2); $at_schema = '#'. "\n" . '# Database Backup For ' . STORE_NAME . "\n" . '# Copyright (c) ' . date('Y') . ' ' . STORE_OWNER . "\n" . '#' . "\n" . '# Database: ' . DB_DATABASE . "\n" . '# Database Server: ' . DB_SERVER . "\n" . '#' . "\n" . '# Backup Date: ' . date(PHP_DATE_TIME_FORMAT) . "\n" . '# Backed up tables: ' . $tables . "\n\n"; fputs($at_fp, $at_schema); $at_tables_query = tep_db_query('show tables'); while ($at_tables = tep_db_fetch_array($at_tables_query)) { list(,$at_table) = each($at_tables); $at_schema = 'drop table if exists ' . $at_table . ';' . "\n" . 'create table ' . $at_table . ' (' . "\n"; $at_table_list = array(); $at_fields_query = tep_db_query("show fields from " . $at_table); while ($at_fields = tep_db_fetch_array($at_fields_query)) { $at_table_list[] = $at_fields['Field']; $at_schema .= ' ' . $at_fields['Field'] . ' ' . $at_fields['Type']; if (strlen($at_fields['Default']) > 0) $at_schema .= ' default \'' . $at_fields['Default'] . '\''; if ($at_fields['Null'] != 'YES') $at_schema .= ' not null'; if (isset($at_fields['Extra'])) $at_schema .= ' ' . $at_fields['Extra']; $at_schema .= ',' . "\n"; } $at_schema = ereg_replace(",\n$", '', $at_schema); // add the keys $at_index = array(); $at_keys_query = tep_db_query("show keys from " . $at_table); while ($at_keys = tep_db_fetch_array($at_keys_query)) { $at_kname = $at_keys['Key_name']; if (!isset($at_index[$at_kname])) { $at_index[$at_kname] = array('unique' => !$at_keys['Non_unique'], 'columns' => array()); } $at_index[$at_kname]['columns'][] = $at_keys['Column_name']; } while (list($at_kname, $at_info) = each($at_index)) { $at_schema .= ',' . "\n"; $at_columns = implode($at_info['columns'], ', '); if ($at_kname == 'PRIMARY') { $at_schema .= ' PRIMARY KEY (' . $at_columns . ')'; } elseif ($at_info['unique']) { $at_schema .= ' UNIQUE ' . $at_kname . ' (' . $at_columns . ')'; } else { $at_schema .= ' KEY ' . $at_kname . ' (' . $at_columns . ')'; } } $at_schema .= "\n" . ');' . "\n\n"; fputs($at_fp, $at_schema); // dump the data $at_rows_query = tep_db_query("select " . implode(',', $at_table_list) . " from " . $at_table); while ($at_rows = tep_db_fetch_array($at_rows_query)) { $at_schema = 'insert into ' . $at_table . ' (' . implode(', ', $at_table_list) . ') values ('; reset($at_table_list); while (list(,$at_i) = each($at_table_list)) { if (!isset($at_rows[$at_i])) { $at_schema .= 'NULL, '; } elseif (tep_not_null($at_rows[$at_i])) { $at_row = addslashes($at_rows[$at_i]); $at_row = ereg_replace("\n#", "\n".'\#', $at_row); $at_schema .= '\'' . $at_row . '\', '; } else { $at_schema .= '\'\', '; } } $at_schema = ereg_replace(', $', '', $at_schema) . ');' . "\n"; fputs($at_fp, $at_schema); } } fclose($at_fp);$endSave = (float)microtime_float();$backuptime = round($endSave - $startSave, 2); } else { if ($cron) { echo 'Error opening backup file for write, please check backup directory permissions.'; } else { $messageStack->add('', 'none'); $messageStack->add('Error opening backup file for write, please check backup directory permissions.', 'warning'); } } break; } if(file_exists(DIR_FS_BACKUP.$at_backup_file)){ if (BACKUP_ZIP == 'gzip') bu_gzip (DIR_FS_BACKUP, $at_backup_file, true); if (method_exists('Archive_Zip','create')) { $archive = New Archive_Zip(DIR_FS_BACKUP.$at_backup_file.'.zip'); $archive->create(DIR_FS_BACKUP.$at_backup_file); } if(file_exists(DIR_FS_BACKUP.$at_backup_file.'.zip')) { unlink(DIR_FS_BACKUP.$at_backup_file); $zip=true; $at_backup_file.='.zip';} if(file_exists(DIR_FS_BACKUP.$at_backup_file.'.gz')) { $gzip=true; $at_backup_file.='.gz';} $at_backup_db="ok";$ziptime= round((float)microtime_float() - $endSave, 2); } } if($at_backup_db=="ok"){ $database_saved =' Database Backup completed in ' . $backuptime . ' secs' . ($zip ? ' and zipped in ' . $ziptime .' secs.' : ($gzip ? ' and gzipped in ' . $ziptime .' secs.' : '.')); if ($cron) { echo $database_saved; } else { $messageStack->add_session('', 'none'); $messageStack->add_session($database_saved.': <a href="backups/'.$at_backup_file.'" target="_blank"><blink><b>Check SQL</b></blink></a>', 'success'); } } elseif ($cron) { echo date(PHP_DATE_TIME_FORMAT) . ' No chron job backup made, last backup made less than ' . BACKUP_SAVE_INTERVAL . ' mins ago.'; } //AUTOBACKUP DB FIN $dbfiles = 'db_' . DB_DATABASE. '*'; $execprgold = 'find '. $path_rel . ' -name ' . $dbfiles . ' -type f -mtime +' . BACKUP_KEEP . ' -exec rm -v {} \; >> ' . $path_rel . 'backups/purgebackups.log' ; exec($execprgold); ?> It works for me. Have fun. Martine
  4. martina

    Contribution: Auto Backup Database

    Hi Sam, Thanks for this excellent contribution; it works like a charm. Is there any possibility to define the number of backups or the expiation dat of the backups that will be kept? I would like to keep 3 backups at all times. Regards, Martina
  5. THX for your speedy reply; I should have known but did not entirely know where to put the line. Because I have several images per product which reflect actually the attributes of a product I name the images, eg duchess-blue.jpg, so for the benefit of customers I changed the line in product_info.php a little bit to show the name of the image as well as the name of the product. "echo '<a rel="image_group" title="'.$product_info['products_name'].'" href="' . ($source ? $source : DIR_WS_IMAGES . $product_info['products_image']) . '" alt="' . $product_info['products_name'] . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"', false, 5) . '<br />' . '</a>'; " becomes: echo '<a rel="image_group" title="'.$product_info['products_name'].'-' .$product_info['products_image'].'" href="' . ($source ? $source : DIR_WS_IMAGES . $product_info['products_image']) . '" alt="' . $product_info['products_name'] . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"', false, 5) . '<br />' . '</a>'; and a little bit further on (twice): echo '<a rel="image_group" title="'.$product_info['products_name'].'" href="' . tep_href_link($source ? $source : DIR_WS_IMAGES . $value) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $value, $product_info['products_name'], TINY_IMAGE_WIDTH, TINY_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>'; becomes: echo '<a rel="image_group" title="'.$product_info['products_name'].'-' .$value.'" href="' . tep_href_link($source ? $source : DIR_WS_IMAGES . $value) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $value, $product_info['products_name'], TINY_IMAGE_WIDTH, TINY_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>'; Maybe other persons might like this too. Thx again.
  6. I like this contribution that I installed yesterday and got working like a charm, without any problems. Many thanks to the developer! I have a question for an enhancement: would it be possible to change the popup script so that the popup disappears automatically when you klick on another area in the webshop? That would be better because now you have to click the cross in the upper right corner of the popup to have it disappear. If you don't, you are left with many openstanding browser-screens. THX
  7. Hi folks, When customers of my shop use IE they cannot get the continu-button to work in checkout_payment: when the chckbox is not done, the line of MATC truns red as it should, but when checked the continu button does nothing and when you look at the properties of the button, it shows just checkout_payment. In Safari, Firefox and Flock is works like a dream! There are no error msgs to be found, it just doen not work and the strange thing is, on december 7 it worked oké while the file was last changed om december 3. Any takers? Martine
  8. THX. I now understand that it is all my fault: the quotes are all mixed up and sometimes spaces do matter... Sorry about the trouble. I should be more careful.
  9. Hi, I have the same [problem. It is maybe something to do with languages: English works but Dutch does not. There is an error to be found in the javascript console: <b>Parse error</b>: syntax error, unexpected '"' in <b>/sites/sleepcool.nl/www/admin/includes/modules/standard_order_comments.php(49) : eval()'d code</b> on line <b>3</b><br /> Hope this helps to sort out the problem. Regards,martina
  10. martina

    [Contribution] U HTML Emails

    Hi, I have been trying to implement both contributions U HTML (works fine, I love it) and the Edit Orders contribution, also a great contribution but for the email notifications. The problem is that Edit Orders only creates text-emails and there are many places in the code where emails are created. I would like that contribution to use Utml emails but I cannot get it to work. Has anyone created an integration of the two? I would like to see how you did that. THX Martina (I also wrote this as a separate topic but this might be a better place)
  11. Hi, I have been trying to implement both contributions U HTML (works fine, I love it) and the Edit Orders contribution, also a great contribution but for the email notifications. The problem is that Edit Orders only creates text-emails and there are many places in the code where emails are created. I would like that contribution to use Utml emails but I cannot get it to work. Has anyone created an integration of the two? I would like to see how you did that. THX Martina
×