[ Index ]
 

Code source de osCommerce 2.2ms2-060817

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/catalog/admin/ -> backup.php (source)

   1  <?php
   2  /*
   3    $Id: backup.php,v 1.60 2003/06/29 22:50:51 hpdl Exp $
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 2003 osCommerce
   9  
  10    Released under the GNU General Public License
  11  */
  12  
  13    require ('includes/application_top.php');
  14  
  15    $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
  16  
  17    if (tep_not_null($action)) {
  18      switch ($action) {
  19        case 'forget':
  20          tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'DB_LAST_RESTORE'");
  21  
  22          $messageStack->add_session(SUCCESS_LAST_RESTORE_CLEARED, 'success');
  23  
  24          tep_redirect(tep_href_link(FILENAME_BACKUP));
  25          break;
  26        case 'backupnow':
  27          tep_set_time_limit(0);
  28          $backup_file = 'db_' . DB_DATABASE . '-' . date('YmdHis') . '.sql';
  29          $fp = fopen(DIR_FS_BACKUP . $backup_file, 'w');
  30  
  31          $schema = '# osCommerce, Open Source E-Commerce Solutions' . "\n" .
  32                    '# http://www.oscommerce.com' . "\n" .
  33                    '#' . "\n" .
  34                    '# Database Backup For ' . STORE_NAME . "\n" .
  35                    '# Copyright (c) ' . date('Y') . ' ' . STORE_OWNER . "\n" .
  36                    '#' . "\n" .
  37                    '# Database: ' . DB_DATABASE . "\n" .
  38                    '# Database Server: ' . DB_SERVER . "\n" .
  39                    '#' . "\n" .
  40                    '# Backup Date: ' . date(PHP_DATE_TIME_FORMAT) . "\n\n";
  41          fputs($fp, $schema);
  42  
  43          $tables_query = tep_db_query('show tables');
  44          while ($tables = tep_db_fetch_array($tables_query)) {
  45            list(,$table) = each($tables);
  46  
  47            $schema = 'drop table if exists ' . $table . ';' . "\n" .
  48                      'create table ' . $table . ' (' . "\n";
  49  
  50            $table_list = array();
  51            $fields_query = tep_db_query("show fields from " . $table);
  52            while ($fields = tep_db_fetch_array($fields_query)) {
  53              $table_list[] = $fields['Field'];
  54  
  55              $schema .= '  ' . $fields['Field'] . ' ' . $fields['Type'];
  56  
  57              if (strlen($fields['Default']) > 0) $schema .= ' default \'' . $fields['Default'] . '\'';
  58  
  59              if ($fields['Null'] != 'YES') $schema .= ' not null';
  60  
  61              if (isset($fields['Extra'])) $schema .= ' ' . $fields['Extra'];
  62  
  63              $schema .= ',' . "\n";
  64            }
  65  
  66            $schema = ereg_replace(",\n$", '', $schema);
  67  
  68  // add the keys
  69            $index = array();
  70            $keys_query = tep_db_query("show keys from " . $table);
  71            while ($keys = tep_db_fetch_array($keys_query)) {
  72              $kname = $keys['Key_name'];
  73  
  74              if (!isset($index[$kname])) {
  75                $index[$kname] = array('unique' => !$keys['Non_unique'],
  76                                       'columns' => array());
  77              }
  78  
  79              $index[$kname]['columns'][] = $keys['Column_name'];
  80            }
  81  
  82            while (list($kname, $info) = each($index)) {
  83              $schema .= ',' . "\n";
  84  
  85              $columns = implode($info['columns'], ', ');
  86  
  87              if ($kname == 'PRIMARY') {
  88                $schema .= '  PRIMARY KEY (' . $columns . ')';
  89              } elseif ($info['unique']) {
  90                $schema .= '  UNIQUE ' . $kname . ' (' . $columns . ')';
  91              } else {
  92                $schema .= '  KEY ' . $kname . ' (' . $columns . ')';
  93              }
  94            }
  95  
  96            $schema .= "\n" . ');' . "\n\n";
  97            fputs($fp, $schema);
  98  
  99  // dump the data
 100            $rows_query = tep_db_query("select " . implode(',', $table_list) . " from " . $table);
 101            while ($rows = tep_db_fetch_array($rows_query)) {
 102              $schema = 'insert into ' . $table . ' (' . implode(', ', $table_list) . ') values (';
 103  
 104              reset($table_list);
 105              while (list(,$i) = each($table_list)) {
 106                if (!isset($rows[$i])) {
 107                  $schema .= 'NULL, ';
 108                } elseif (tep_not_null($rows[$i])) {
 109                  $row = addslashes($rows[$i]);
 110                  $row = ereg_replace("\n#", "\n".'\#', $row);
 111  
 112                  $schema .= '\'' . $row . '\', ';
 113                } else {
 114                  $schema .= '\'\', ';
 115                }
 116              }
 117  
 118              $schema = ereg_replace(', $', '', $schema) . ');' . "\n";
 119              fputs($fp, $schema);
 120  
 121            }
 122          }
 123  
 124          fclose($fp);
 125  
 126          if (isset($HTTP_POST_VARS['download']) && ($HTTP_POST_VARS['download'] == 'yes')) {
 127            switch ($HTTP_POST_VARS['compress']) {
 128              case 'gzip':
 129                exec(LOCAL_EXE_GZIP . ' ' . DIR_FS_BACKUP . $backup_file);
 130                $backup_file .= '.gz';
 131                break;
 132              case 'zip':
 133                exec(LOCAL_EXE_ZIP . ' -j ' . DIR_FS_BACKUP . $backup_file . '.zip ' . DIR_FS_BACKUP . $backup_file);
 134                unlink(DIR_FS_BACKUP . $backup_file);
 135                $backup_file .= '.zip';
 136            }
 137            header('Content-type: application/x-octet-stream');
 138            header('Content-disposition: attachment; filename=' . $backup_file);
 139  
 140            readfile(DIR_FS_BACKUP . $backup_file);
 141            unlink(DIR_FS_BACKUP . $backup_file);
 142  
 143            exit;
 144          } else {
 145            switch ($HTTP_POST_VARS['compress']) {
 146              case 'gzip':
 147                exec(LOCAL_EXE_GZIP . ' ' . DIR_FS_BACKUP . $backup_file);
 148                break;
 149              case 'zip':
 150                exec(LOCAL_EXE_ZIP . ' -j ' . DIR_FS_BACKUP . $backup_file . '.zip ' . DIR_FS_BACKUP . $backup_file);
 151                unlink(DIR_FS_BACKUP . $backup_file);
 152            }
 153  
 154            $messageStack->add_session(SUCCESS_DATABASE_SAVED, 'success');
 155          }
 156  
 157          tep_redirect(tep_href_link(FILENAME_BACKUP));
 158          break;
 159        case 'restorenow':
 160        case 'restorelocalnow':
 161          tep_set_time_limit(0);
 162  
 163          if ($action == 'restorenow') {
 164            $read_from = $HTTP_GET_VARS['file'];
 165  
 166            if (file_exists(DIR_FS_BACKUP . $HTTP_GET_VARS['file'])) {
 167              $restore_file = DIR_FS_BACKUP . $HTTP_GET_VARS['file'];
 168              $extension = substr($HTTP_GET_VARS['file'], -3);
 169  
 170              if ( ($extension == 'sql') || ($extension == '.gz') || ($extension == 'zip') ) {
 171                switch ($extension) {
 172                  case 'sql':
 173                    $restore_from = $restore_file;
 174                    $remove_raw = false;
 175                    break;
 176                  case '.gz':
 177                    $restore_from = substr($restore_file, 0, -3);
 178                    exec(LOCAL_EXE_GUNZIP . ' ' . $restore_file . ' -c > ' . $restore_from);
 179                    $remove_raw = true;
 180                    break;
 181                  case 'zip':
 182                    $restore_from = substr($restore_file, 0, -4);
 183                    exec(LOCAL_EXE_UNZIP . ' ' . $restore_file . ' -d ' . DIR_FS_BACKUP);
 184                    $remove_raw = true;
 185                }
 186  
 187                if (isset($restore_from) && file_exists($restore_from) && (filesize($restore_from) > 15000)) {
 188                  $fd = fopen($restore_from, 'rb');
 189                  $restore_query = fread($fd, filesize($restore_from));
 190                  fclose($fd);
 191                }
 192              }
 193            }
 194          } elseif ($action == 'restorelocalnow') {
 195            $sql_file = new upload('sql_file');
 196  
 197            if ($sql_file->parse() == true) {
 198              $restore_query = fread(fopen($sql_file->tmp_filename, 'r'), filesize($sql_file->tmp_filename));
 199              $read_from = $sql_file->filename;
 200            }
 201          }
 202  
 203          if (isset($restore_query)) {
 204            $sql_array = array();
 205            $sql_length = strlen($restore_query);
 206            $pos = strpos($restore_query, ';');
 207            for ($i=$pos; $i<$sql_length; $i++) {
 208              if ($restore_query[0] == '#') {
 209                $restore_query = ltrim(substr($restore_query, strpos($restore_query, "\n")));
 210                $sql_length = strlen($restore_query);
 211                $i = strpos($restore_query, ';')-1;
 212                continue;
 213              }
 214              if ($restore_query[($i+1)] == "\n") {
 215                for ($j=($i+2); $j<$sql_length; $j++) {
 216                  if (trim($restore_query[$j]) != '') {
 217                    $next = substr($restore_query, $j, 6);
 218                    if ($next[0] == '#') {
 219  // find out where the break position is so we can remove this line (#comment line)
 220                      for ($k=$j; $k<$sql_length; $k++) {
 221                        if ($restore_query[$k] == "\n") break;
 222                      }
 223                      $query = substr($restore_query, 0, $i+1);
 224                      $restore_query = substr($restore_query, $k);
 225  // join the query before the comment appeared, with the rest of the dump
 226                      $restore_query = $query . $restore_query;
 227                      $sql_length = strlen($restore_query);
 228                      $i = strpos($restore_query, ';')-1;
 229                      continue 2;
 230                    }
 231                    break;
 232                  }
 233                }
 234                if ($next == '') { // get the last insert query
 235                  $next = 'insert';
 236                }
 237                if ( (eregi('create', $next)) || (eregi('insert', $next)) || (eregi('drop t', $next)) ) {
 238                  $next = '';
 239                  $sql_array[] = substr($restore_query, 0, $i);
 240                  $restore_query = ltrim(substr($restore_query, $i+1));
 241                  $sql_length = strlen($restore_query);
 242                  $i = strpos($restore_query, ';')-1;
 243                }
 244              }
 245            }
 246  
 247            tep_db_query("drop table if exists address_book, address_format, banners, banners_history, categories, categories_description, configuration, configuration_group, counter, counter_history, countries, currencies, customers, customers_basket, customers_basket_attributes, customers_info, languages, manufacturers, manufacturers_info, orders, orders_products, orders_status, orders_status_history, orders_products_attributes, orders_products_download, products, products_attributes, products_attributes_download, prodcts_description, products_options, products_options_values, products_options_values_to_products_options, products_to_categories, reviews, reviews_description, sessions, specials, tax_class, tax_rates, geo_zones, whos_online, zones, zones_to_geo_zones");
 248  
 249            for ($i=0, $n=sizeof($sql_array); $i<$n; $i++) {
 250              tep_db_query($sql_array[$i]);
 251            }
 252  
 253            tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'DB_LAST_RESTORE'");
 254            tep_db_query("insert into " . TABLE_CONFIGURATION . " values ('', 'Last Database Restore', 'DB_LAST_RESTORE', '" . $read_from . "', 'Last database restore file', '6', '', '', now(), '', '')");
 255  
 256            if (isset($remove_raw) && ($remove_raw == true)) {
 257              unlink($restore_from);
 258            }
 259  
 260            $messageStack->add_session(SUCCESS_DATABASE_RESTORED, 'success');
 261          }
 262  
 263          tep_redirect(tep_href_link(FILENAME_BACKUP));
 264          break;
 265        case 'download':
 266          $extension = substr($HTTP_GET_VARS['file'], -3);
 267  
 268          if ( ($extension == 'zip') || ($extension == '.gz') || ($extension == 'sql') ) {
 269            if ($fp = fopen(DIR_FS_BACKUP . $HTTP_GET_VARS['file'], 'rb')) {
 270              $buffer = fread($fp, filesize(DIR_FS_BACKUP . $HTTP_GET_VARS['file']));
 271              fclose($fp);
 272  
 273              header('Content-type: application/x-octet-stream');
 274              header('Content-disposition: attachment; filename=' . $HTTP_GET_VARS['file']);
 275  
 276              echo $buffer;
 277  
 278              exit;
 279            }
 280          } else {
 281            $messageStack->add(ERROR_DOWNLOAD_LINK_NOT_ACCEPTABLE, 'error');
 282          }
 283          break;
 284        case 'deleteconfirm':
 285          if (strstr($HTTP_GET_VARS['file'], '..')) tep_redirect(tep_href_link(FILENAME_BACKUP));
 286  
 287          tep_remove(DIR_FS_BACKUP . '/' . $HTTP_GET_VARS['file']);
 288  
 289          if (!$tep_remove_error) {
 290            $messageStack->add_session(SUCCESS_BACKUP_DELETED, 'success');
 291  
 292            tep_redirect(tep_href_link(FILENAME_BACKUP));
 293          }
 294          break;
 295      }
 296    }
 297  
 298  // check if the backup directory exists
 299    $dir_ok = false;
 300    if (is_dir(DIR_FS_BACKUP)) {
 301      if (is_writeable(DIR_FS_BACKUP)) {
 302        $dir_ok = true;
 303      } else {
 304        $messageStack->add(ERROR_BACKUP_DIRECTORY_NOT_WRITEABLE, 'error');
 305      }
 306    } else {
 307      $messageStack->add(ERROR_BACKUP_DIRECTORY_DOES_NOT_EXIST, 'error');
 308    }
 309  ?>
 310  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
 311  <html <?php echo HTML_PARAMS; ?>>
 312  <head>
 313  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
 314  <title><?php echo TITLE; ?></title>
 315  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
 316  <script language="javascript" src="includes/general.js"></script>
 317  </head>
 318  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
 319  <!-- header //-->
 320  <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
 321  <!-- header_eof //-->
 322  
 323  <!-- body //-->
 324  <table border="0" width="100%" cellspacing="2" cellpadding="2">
 325    <tr>
 326      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
 327  <!-- left_navigation //-->
 328  <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
 329  <!-- left_navigation_eof //-->
 330      </table></td>
 331  <!-- body_text //-->
 332      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 333        <tr>
 334          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 335            <tr>
 336              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 337              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 338            </tr>
 339          </table></td>
 340        </tr>
 341        <tr>
 342          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 343            <tr>
 344              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 345                <tr class="dataTableHeadingRow">
 346                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TITLE; ?></td>
 347                  <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_FILE_DATE; ?></td>
 348                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_FILE_SIZE; ?></td>
 349                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
 350                </tr>
 351  <?php
 352    if ($dir_ok == true) {
 353      $dir = dir(DIR_FS_BACKUP);
 354      $contents = array();
 355      while ($file = $dir->read()) {
 356        if (!is_dir(DIR_FS_BACKUP . $file)) {
 357          $contents[] = $file;
 358        }
 359      }
 360      sort($contents);
 361  
 362      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
 363        $entry = $contents[$i];
 364  
 365        $check = 0;
 366  
 367        if ((!isset($HTTP_GET_VARS['file']) || (isset($HTTP_GET_VARS['file']) && ($HTTP_GET_VARS['file'] == $entry))) && !isset($buInfo) && ($action != 'backup') && ($action != 'restorelocal')) {
 368          $file_array['file'] = $entry;
 369          $file_array['date'] = date(PHP_DATE_TIME_FORMAT, filemtime(DIR_FS_BACKUP . $entry));
 370          $file_array['size'] = number_format(filesize(DIR_FS_BACKUP . $entry)) . ' bytes';
 371          switch (substr($entry, -3)) {
 372            case 'zip': $file_array['compression'] = 'ZIP'; break;
 373            case '.gz': $file_array['compression'] = 'GZIP'; break;
 374            default: $file_array['compression'] = TEXT_NO_EXTENSION; break;
 375          }
 376  
 377          $buInfo = new objectInfo($file_array);
 378        }
 379  
 380        if (isset($buInfo) && is_object($buInfo) && ($entry == $buInfo->file)) {
 381          echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n";
 382          $onclick_link = 'file=' . $buInfo->file . '&action=restore';
 383        } else {
 384          echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n";
 385          $onclick_link = 'file=' . $entry;
 386        }
 387  ?>
 388                  <td class="dataTableContent" onclick="document.location.href='<?php echo tep_href_link(FILENAME_BACKUP, $onclick_link); ?>'"><?php echo '<a href="' . tep_href_link(FILENAME_BACKUP, 'action=download&file=' . $entry) . '">' . tep_image(DIR_WS_ICONS . 'file_download.gif', ICON_FILE_DOWNLOAD) . '</a>&nbsp;' . $entry; ?></td>
 389                  <td class="dataTableContent" align="center" onclick="document.location.href='<?php echo tep_href_link(FILENAME_BACKUP, $onclick_link); ?>'"><?php echo date(PHP_DATE_TIME_FORMAT, filemtime(DIR_FS_BACKUP . $entry)); ?></td>
 390                  <td class="dataTableContent" align="right" onclick="document.location.href='<?php echo tep_href_link(FILENAME_BACKUP, $onclick_link); ?>'"><?php echo number_format(filesize(DIR_FS_BACKUP . $entry)); ?> bytes</td>
 391                  <td class="dataTableContent" align="right"><?php if (isset($buInfo) && is_object($buInfo) && ($entry == $buInfo->file)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_BACKUP, 'file=' . $entry) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
 392                </tr>
 393  <?php
 394      }
 395      $dir->close();
 396    }
 397  ?>
 398                <tr>
 399                  <td class="smallText" colspan="3"><?php echo TEXT_BACKUP_DIRECTORY . ' ' . DIR_FS_BACKUP; ?></td>
 400                  <td align="right" class="smallText"><?php if ( ($action != 'backup') && (isset($dir)) ) echo '<a href="' . tep_href_link(FILENAME_BACKUP, 'action=backup') . '">' . tep_image_button('button_backup.gif', IMAGE_BACKUP) . '</a>'; if ( ($action != 'restorelocal') && isset($dir) ) echo '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_BACKUP, 'action=restorelocal') . '">' . tep_image_button('button_restore.gif', IMAGE_RESTORE) . '</a>'; ?></td>
 401                </tr>
 402  <?php
 403    if (defined('DB_LAST_RESTORE')) {
 404  ?>
 405                <tr>
 406                  <td class="smallText" colspan="4"><?php echo TEXT_LAST_RESTORATION . ' ' . DB_LAST_RESTORE . ' <a href="' . tep_href_link(FILENAME_BACKUP, 'action=forget') . '">' . TEXT_FORGET . '</a>'; ?></td>
 407                </tr>
 408  <?php
 409    }
 410  ?>
 411              </table></td>
 412  <?php
 413    $heading = array();
 414    $contents = array();
 415  
 416    switch ($action) {
 417      case 'backup':
 418        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_BACKUP . '</b>');
 419  
 420        $contents = array('form' => tep_draw_form('backup', FILENAME_BACKUP, 'action=backupnow'));
 421        $contents[] = array('text' => TEXT_INFO_NEW_BACKUP);
 422  
 423        $contents[] = array('text' => '<br>' . tep_draw_radio_field('compress', 'no', true) . ' ' . TEXT_INFO_USE_NO_COMPRESSION);
 424        if (file_exists(LOCAL_EXE_GZIP)) $contents[] = array('text' => '<br>' . tep_draw_radio_field('compress', 'gzip') . ' ' . TEXT_INFO_USE_GZIP);
 425        if (file_exists(LOCAL_EXE_ZIP)) $contents[] = array('text' => tep_draw_radio_field('compress', 'zip') . ' ' . TEXT_INFO_USE_ZIP);
 426  
 427        if ($dir_ok == true) {
 428          $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('download', 'yes') . ' ' . TEXT_INFO_DOWNLOAD_ONLY . '*<br><br>*' . TEXT_INFO_BEST_THROUGH_HTTPS);
 429        } else {
 430          $contents[] = array('text' => '<br>' . tep_draw_radio_field('download', 'yes', true) . ' ' . TEXT_INFO_DOWNLOAD_ONLY . '*<br><br>*' . TEXT_INFO_BEST_THROUGH_HTTPS);
 431        }
 432  
 433        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_backup.gif', IMAGE_BACKUP) . '&nbsp;<a href="' . tep_href_link(FILENAME_BACKUP) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 434        break;
 435      case 'restore':
 436        $heading[] = array('text' => '<b>' . $buInfo->date . '</b>');
 437  
 438        $contents[] = array('text' => tep_break_string(sprintf(TEXT_INFO_RESTORE, DIR_FS_BACKUP . (($buInfo->compression != TEXT_NO_EXTENSION) ? substr($buInfo->file, 0, strrpos($buInfo->file, '.')) : $buInfo->file), ($buInfo->compression != TEXT_NO_EXTENSION) ? TEXT_INFO_UNPACK : ''), 35, ' '));
 439        $contents[] = array('align' => 'center', 'text' => '<br><a href="' . tep_href_link(FILENAME_BACKUP, 'file=' . $buInfo->file . '&action=restorenow') . '">' . tep_image_button('button_restore.gif', IMAGE_RESTORE) . '</a>&nbsp;<a href="' . tep_href_link(FILENAME_BACKUP, 'file=' . $buInfo->file) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 440        break;
 441      case 'restorelocal':
 442        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_RESTORE_LOCAL . '</b>');
 443  
 444        $contents = array('form' => tep_draw_form('restore', FILENAME_BACKUP, 'action=restorelocalnow', 'post', 'enctype="multipart/form-data"'));
 445        $contents[] = array('text' => TEXT_INFO_RESTORE_LOCAL . '<br><br>' . TEXT_INFO_BEST_THROUGH_HTTPS);
 446        $contents[] = array('text' => '<br>' . tep_draw_file_field('sql_file'));
 447        $contents[] = array('text' => TEXT_INFO_RESTORE_LOCAL_RAW_FILE);
 448        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_restore.gif', IMAGE_RESTORE) . '&nbsp;<a href="' . tep_href_link(FILENAME_BACKUP) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 449        break;
 450      case 'delete':
 451        $heading[] = array('text' => '<b>' . $buInfo->date . '</b>');
 452  
 453        $contents = array('form' => tep_draw_form('delete', FILENAME_BACKUP, 'file=' . $buInfo->file . '&action=deleteconfirm'));
 454        $contents[] = array('text' => TEXT_DELETE_INTRO);
 455        $contents[] = array('text' => '<br><b>' . $buInfo->file . '</b>');
 456        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_BACKUP, 'file=' . $buInfo->file) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 457        break;
 458      default:
 459        if (isset($buInfo) && is_object($buInfo)) {
 460          $heading[] = array('text' => '<b>' . $buInfo->date . '</b>');
 461  
 462          $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_BACKUP, 'file=' . $buInfo->file . '&action=restore') . '">' . tep_image_button('button_restore.gif', IMAGE_RESTORE) . '</a> <a href="' . tep_href_link(FILENAME_BACKUP, 'file=' . $buInfo->file . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
 463          $contents[] = array('text' => '<br>' . TEXT_INFO_DATE . ' ' . $buInfo->date);
 464          $contents[] = array('text' => TEXT_INFO_SIZE . ' ' . $buInfo->size);
 465          $contents[] = array('text' => '<br>' . TEXT_INFO_COMPRESSION . ' ' . $buInfo->compression);
 466        }
 467        break;
 468    }
 469  
 470    if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
 471      echo '            <td width="25%" valign="top">' . "\n";
 472  
 473      $box = new box;
 474      echo $box->infoBox($heading, $contents);
 475  
 476      echo '            </td>' . "\n";
 477    }
 478  ?>
 479            </tr>
 480          </table></td>
 481        </tr>
 482      </table></td>
 483  <!-- body_text_eof //-->
 484    </tr>
 485  </table>
 486  <!-- body_eof //-->
 487  
 488  <!-- footer //-->
 489  <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
 490  <!-- footer_eof //-->
 491  <br>
 492  </body>
 493  </html>
 494  <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Généré le : Mon Nov 26 19:48:25 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics