[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> backup.php (source)

   1  <?php
   2  /*

   3  $Id: backup.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   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 = '# osCMax Power E-Commerce' . "\n" .
  32                    '# http://oscdox.com' . "\n" .
  33                    '#' . "\n" .
  34                    '# Database Backup For ' . STORE_NAME . "\n" .
  35                    '# Copyright (c) osCMax ' . 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                                       'fulltext' => ($keys['Index_type'] == 'FULLTEXT' ? '1' : '0'),
  77                                       'columns' => array());
  78              }
  79  
  80              $index[$kname]['columns'][] = $keys['Column_name'];
  81            }
  82  
  83            while (list($kname, $info) = each($index)) {
  84              $schema .= ',' . "\n";
  85  
  86              $columns = implode($info['columns'], ', ');
  87  
  88              if ($kname == 'PRIMARY') {
  89                $schema .= '  PRIMARY KEY (' . $columns . ')';
  90              } elseif ( $info['fulltext'] == '1' ) {
  91                $schema .= '  FULLTEXT ' . $kname . ' (' . $columns . ')';
  92              } elseif ($info['unique']) {
  93                $schema .= '  UNIQUE ' . $kname . ' (' . $columns . ')';
  94              } else {
  95                $schema .= '  KEY ' . $kname . ' (' . $columns . ')';
  96              }
  97            }
  98  
  99            $schema .= "\n" . ');' . "\n\n";
 100            fputs($fp, $schema);
 101  
 102  // dump the data

 103            if ( ($table != TABLE_SESSIONS ) && ($table != TABLE_WHOS_ONLINE) ) {
 104              $rows_query = tep_db_query("select " . implode(',', $table_list) . " from " . $table);
 105              while ($rows = tep_db_fetch_array($rows_query)) {
 106                $schema = 'insert into ' . $table . ' (' . implode(', ', $table_list) . ') values (';
 107  
 108                reset($table_list);
 109                while (list(,$i) = each($table_list)) {
 110                  if (!isset($rows[$i])) {
 111                    $schema .= 'NULL, ';
 112                  } elseif (tep_not_null($rows[$i])) {
 113                    $row = addslashes($rows[$i]);
 114                    $row = ereg_replace("\n#", "\n".'\#', $row);
 115  
 116                    $schema .= '\'' . $row . '\', ';
 117                  } else {
 118                    $schema .= '\'\', ';
 119                  }
 120                }
 121  
 122                $schema = ereg_replace(', $', '', $schema) . ');' . "\n";
 123                fputs($fp, $schema);
 124              }
 125            }
 126          }
 127  
 128          fclose($fp);
 129  
 130          if (isset($HTTP_POST_VARS['download']) && ($HTTP_POST_VARS['download'] == 'yes')) {
 131            switch ($HTTP_POST_VARS['compress']) {
 132              case 'gzip':
 133                exec(LOCAL_EXE_GZIP . ' ' . DIR_FS_BACKUP . $backup_file);
 134                $backup_file .= '.gz';
 135                break;
 136              case 'zip':
 137                exec(LOCAL_EXE_ZIP . ' -j ' . DIR_FS_BACKUP . $backup_file . '.zip ' . DIR_FS_BACKUP . $backup_file);
 138                unlink(DIR_FS_BACKUP . $backup_file);
 139                $backup_file .= '.zip';
 140            }
 141            header('Content-type: application/x-octet-stream');
 142            header('Content-disposition: attachment; filename=' . $backup_file);
 143  
 144            readfile(DIR_FS_BACKUP . $backup_file);
 145            unlink(DIR_FS_BACKUP . $backup_file);
 146  
 147            exit;
 148          } else {
 149            switch ($HTTP_POST_VARS['compress']) {
 150              case 'gzip':
 151                exec(LOCAL_EXE_GZIP . ' ' . DIR_FS_BACKUP . $backup_file);
 152                break;
 153              case 'zip':
 154                exec(LOCAL_EXE_ZIP . ' -j ' . DIR_FS_BACKUP . $backup_file . '.zip ' . DIR_FS_BACKUP . $backup_file);
 155                unlink(DIR_FS_BACKUP . $backup_file);
 156            }
 157  
 158            $messageStack->add_session(SUCCESS_DATABASE_SAVED, 'success');
 159          }
 160  
 161          tep_redirect(tep_href_link(FILENAME_BACKUP));
 162          break;
 163        case 'restorenow':
 164        case 'restorelocalnow':
 165          tep_set_time_limit(0);
 166  
 167          if ($action == 'restorenow') {
 168            $read_from = $HTTP_GET_VARS['file'];
 169  
 170            if (file_exists(DIR_FS_BACKUP . $HTTP_GET_VARS['file'])) {
 171              $restore_file = DIR_FS_BACKUP . $HTTP_GET_VARS['file'];
 172              $extension = substr($HTTP_GET_VARS['file'], -3);
 173  
 174              if ( ($extension == 'sql') || ($extension == '.gz') || ($extension == 'zip') ) {
 175                switch ($extension) {
 176                  case 'sql':
 177                    $restore_from = $restore_file;
 178                    $remove_raw = false;
 179                    break;
 180                  case '.gz':
 181                    $restore_from = substr($restore_file, 0, -3);
 182                    exec(LOCAL_EXE_GUNZIP . ' ' . $restore_file . ' -c > ' . $restore_from);
 183                    $remove_raw = true;
 184                    break;
 185                  case 'zip':
 186                    $restore_from = substr($restore_file, 0, -4);
 187                    exec(LOCAL_EXE_UNZIP . ' ' . $restore_file . ' -d ' . DIR_FS_BACKUP);
 188                    $remove_raw = true;
 189                }
 190  
 191                if (isset($restore_from) && file_exists($restore_from) && (filesize($restore_from) > 15000)) {
 192                  $fd = fopen($restore_from, 'rb');
 193                  $restore_query = fread($fd, filesize($restore_from));
 194                  fclose($fd);
 195                }
 196              }
 197            }
 198          } elseif ($action == 'restorelocalnow') {
 199            $sql_file = new upload('sql_file');
 200  
 201            if ($sql_file->parse() == true) {
 202              $restore_query = fread(fopen($sql_file->tmp_filename, 'r'), filesize($sql_file->tmp_filename));
 203              $read_from = $sql_file->filename;
 204            }
 205          }
 206  
 207          if (isset($restore_query)) {
 208            $sql_array = array();
 209            $drop_table_names = array();
 210            $sql_length = strlen($restore_query);
 211            $pos = strpos($restore_query, ';');
 212            for ($i=$pos; $i<$sql_length; $i++) {
 213              if ($restore_query[0] == '#') {
 214                $restore_query = ltrim(substr($restore_query, strpos($restore_query, "\n")));
 215                $sql_length = strlen($restore_query);
 216                $i = strpos($restore_query, ';')-1;
 217                continue;
 218              }
 219              if ($restore_query[($i+1)] == "\n") {
 220                for ($j=($i+2); $j<$sql_length; $j++) {
 221                  if (trim($restore_query[$j]) != '') {
 222                    $next = substr($restore_query, $j, 6);
 223                    if ($next[0] == '#') {
 224  // find out where the break position is so we can remove this line (#comment line)

 225                      for ($k=$j; $k<$sql_length; $k++) {
 226                        if ($restore_query[$k] == "\n") break;
 227                      }
 228                      $query = substr($restore_query, 0, $i+1);
 229                      $restore_query = substr($restore_query, $k);
 230  // join the query before the comment appeared, with the rest of the dump

 231                      $restore_query = $query . $restore_query;
 232                      $sql_length = strlen($restore_query);
 233                      $i = strpos($restore_query, ';')-1;
 234                      continue 2;
 235                    }
 236                    break;
 237                  }
 238                }
 239                if ($next == '') { // get the last insert query
 240                  $next = 'insert';
 241                }
 242                if ( (eregi('create', $next)) || (eregi('insert', $next)) || (eregi('drop t', $next)) ) {
 243                  $query = substr($restore_query, 0, $i);
 244  
 245                  $next = '';
 246                  $sql_array[] = $query;
 247                  $restore_query = ltrim(substr($restore_query, $i+1));
 248                  $sql_length = strlen($restore_query);
 249                  $i = strpos($restore_query, ';')-1;
 250  
 251                  if (eregi('^create*', $query)) {
 252                    $table_name = trim(substr($query, stripos($query, 'table ')+6));
 253                    $table_name = substr($table_name, 0, strpos($table_name, ' '));
 254  
 255                    $drop_table_names[] = $table_name;
 256                  }
 257                }
 258              }
 259            }
 260  
 261  // BOF: Mod - QT Pro

 262            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_stock, products_to_categories, reviews, reviews_description, sessions, specials, tax_class, tax_rates, geo_zones, whos_online, zones, zones_to_geo_zones");
 263  // EOF: Mod - QT Pro

 264            tep_db_query('drop table if exists ' . implode(', ', $drop_table_names));
 265            for ($i=0, $n=sizeof($sql_array); $i<$n; $i++) {
 266              tep_db_query($sql_array[$i]);
 267            }
 268  
 269            tep_session_close();
 270  
 271            tep_db_query("delete from " . TABLE_WHOS_ONLINE);
 272            tep_db_query("delete from " . TABLE_SESSIONS);
 273  
 274            tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'DB_LAST_RESTORE'");
 275            tep_db_query("insert into " . TABLE_CONFIGURATION . " values (null, 'Last Database Restore', 'DB_LAST_RESTORE', '" . $read_from . "', 'Last database restore file', '6', '0', null, now(), '', '')");
 276  
 277            if (isset($remove_raw) && ($remove_raw == true)) {
 278              unlink($restore_from);
 279            }
 280  
 281            $messageStack->add_session(SUCCESS_DATABASE_RESTORED, 'success');
 282          }
 283  
 284          tep_redirect(tep_href_link(FILENAME_BACKUP));
 285          break;
 286        case 'download':
 287          $extension = substr($HTTP_GET_VARS['file'], -3);
 288  
 289          if ( ($extension == 'zip') || ($extension == '.gz') || ($extension == 'sql') ) {
 290            if ($fp = fopen(DIR_FS_BACKUP . $HTTP_GET_VARS['file'], 'rb')) {
 291              $buffer = fread($fp, filesize(DIR_FS_BACKUP . $HTTP_GET_VARS['file']));
 292              fclose($fp);
 293  
 294              header('Content-type: application/x-octet-stream');
 295              header('Content-disposition: attachment; filename=' . $HTTP_GET_VARS['file']);
 296  
 297              echo $buffer;
 298  
 299              exit;
 300            }
 301          } else {
 302            $messageStack->add(ERROR_DOWNLOAD_LINK_NOT_ACCEPTABLE, 'error');
 303          }
 304          break;
 305        case 'deleteconfirm':
 306          if (strstr($HTTP_GET_VARS['file'], '..')) tep_redirect(tep_href_link(FILENAME_BACKUP));
 307  
 308          tep_remove(DIR_FS_BACKUP . '/' . $HTTP_GET_VARS['file']);
 309  
 310          if (!$tep_remove_error) {
 311            $messageStack->add_session(SUCCESS_BACKUP_DELETED, 'success');
 312  
 313            tep_redirect(tep_href_link(FILENAME_BACKUP));
 314          }
 315          break;
 316      }
 317    }
 318  
 319  // check if the backup directory exists

 320    $dir_ok = false;
 321    if (is_dir(DIR_FS_BACKUP)) {
 322      if (is_writeable(DIR_FS_BACKUP)) {
 323        $dir_ok = true;
 324      } else {
 325        $messageStack->add(ERROR_BACKUP_DIRECTORY_NOT_WRITEABLE, 'error');
 326      }
 327    } else {
 328      $messageStack->add(ERROR_BACKUP_DIRECTORY_DOES_NOT_EXIST, 'error');
 329    }
 330  ?>
 331  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
 332  <html <?php echo HTML_PARAMS; ?>>
 333  <head>
 334  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
 335  <title><?php echo TITLE; ?></title>
 336  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
 337  <script language="javascript" src="includes/general.js"></script>
 338  </head>
 339  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
 340  <!-- header //-->
 341  <?php require (DIR_WS_INCLUDES . 'header.php'); ?>
 342  <!-- header_eof //-->
 343  
 344  <!-- body //-->
 345  <table border="0" width="100%" cellspacing="2" cellpadding="2">
 346    <tr>
 347      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
 348  <!-- left_navigation //-->
 349  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
 350  <!-- left_navigation_eof //-->
 351      </table></td>
 352  <!-- body_text //-->
 353      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 354        <tr>
 355          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 356            <tr>
 357              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 358              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 359            </tr>
 360          </table></td>
 361        </tr>
 362        <tr>
 363          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 364            <tr>
 365              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 366                <tr class="dataTableHeadingRow">
 367                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TITLE; ?></td>
 368                  <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_FILE_DATE; ?></td>
 369                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_FILE_SIZE; ?></td>
 370                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
 371                </tr>
 372  <?php
 373    if ($dir_ok == true) {
 374      $dir = dir(DIR_FS_BACKUP);
 375      $contents = array();
 376      while ($file = $dir->read()) {
 377        if (!is_dir(DIR_FS_BACKUP . $file) && in_array(substr($file, -3), array('zip', 'sql', '.gz'))) {
 378          $contents[] = $file;
 379        }
 380      }
 381      sort($contents);
 382  
 383      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
 384        $entry = $contents[$i];
 385  
 386        $check = 0;
 387  
 388        if ((!isset($HTTP_GET_VARS['file']) || (isset($HTTP_GET_VARS['file']) && ($HTTP_GET_VARS['file'] == $entry))) && !isset($buInfo) && ($action != 'backup') && ($action != 'restorelocal')) {
 389          $file_array['file'] = $entry;
 390          $file_array['date'] = date(PHP_DATE_TIME_FORMAT, filemtime(DIR_FS_BACKUP . $entry));
 391          $file_array['size'] = number_format(filesize(DIR_FS_BACKUP . $entry)) . ' bytes';
 392          switch (substr($entry, -3)) {
 393            case 'zip': $file_array['compression'] = 'ZIP'; break;
 394            case '.gz': $file_array['compression'] = 'GZIP'; break;
 395            default: $file_array['compression'] = TEXT_NO_EXTENSION; break;
 396          }
 397  
 398          $buInfo = new objectInfo($file_array);
 399        }
 400  
 401        if (isset($buInfo) && is_object($buInfo) && ($entry == $buInfo->file)) {
 402          echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n";
 403          $onclick_link = 'file=' . $buInfo->file . '&action=restore';
 404        } else {
 405          echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n";
 406          $onclick_link = 'file=' . $entry;
 407        }
 408  ?>
 409                  <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>
 410                  <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>
 411                  <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>
 412                  <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>
 413                </tr>
 414  <?php
 415      }
 416      $dir->close();
 417    }
 418  ?>
 419                <tr>
 420                  <td class="smallText" colspan="3"><?php echo TEXT_BACKUP_DIRECTORY . ' ' . DIR_FS_BACKUP; ?></td>
 421                  <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>
 422                </tr>
 423  <?php
 424    if (defined('DB_LAST_RESTORE')) {
 425  ?>
 426                <tr>
 427                  <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>
 428                </tr>
 429  <?php
 430    }
 431  ?>
 432              </table></td>
 433  <?php
 434    $heading = array();
 435    $contents = array();
 436  
 437    switch ($action) {
 438      case 'backup':
 439        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_BACKUP . '</b>');
 440  
 441        $contents = array('form' => tep_draw_form('backup', FILENAME_BACKUP, 'action=backupnow'));
 442        $contents[] = array('text' => TEXT_INFO_NEW_BACKUP);
 443  
 444        $contents[] = array('text' => '<br>' . tep_draw_radio_field('compress', 'no', true) . ' ' . TEXT_INFO_USE_NO_COMPRESSION);
 445        if (file_exists(LOCAL_EXE_GZIP)) $contents[] = array('text' => '<br>' . tep_draw_radio_field('compress', 'gzip') . ' ' . TEXT_INFO_USE_GZIP);
 446        if (file_exists(LOCAL_EXE_ZIP)) $contents[] = array('text' => tep_draw_radio_field('compress', 'zip') . ' ' . TEXT_INFO_USE_ZIP);
 447  
 448        if ($dir_ok == true) {
 449          $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('download', 'yes') . ' ' . TEXT_INFO_DOWNLOAD_ONLY . '*<br><br>*' . TEXT_INFO_BEST_THROUGH_HTTPS);
 450        } else {
 451          $contents[] = array('text' => '<br>' . tep_draw_radio_field('download', 'yes', true) . ' ' . TEXT_INFO_DOWNLOAD_ONLY . '*<br><br>*' . TEXT_INFO_BEST_THROUGH_HTTPS);
 452        }
 453  
 454        $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>');
 455        break;
 456      case 'restore':
 457        $heading[] = array('text' => '<b>' . $buInfo->date . '</b>');
 458  
 459        $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, ' '));
 460        $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>');
 461        break;
 462      case 'restorelocal':
 463        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_RESTORE_LOCAL . '</b>');
 464  
 465        $contents = array('form' => tep_draw_form('restore', FILENAME_BACKUP, 'action=restorelocalnow', 'post', 'enctype="multipart/form-data"'));
 466        $contents[] = array('text' => TEXT_INFO_RESTORE_LOCAL . '<br><br>' . TEXT_INFO_BEST_THROUGH_HTTPS);
 467        $contents[] = array('text' => '<br>' . tep_draw_file_field('sql_file'));
 468        $contents[] = array('text' => TEXT_INFO_RESTORE_LOCAL_RAW_FILE);
 469        $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>');
 470        break;
 471      case 'delete':
 472        $heading[] = array('text' => '<b>' . $buInfo->date . '</b>');
 473  
 474        $contents = array('form' => tep_draw_form('delete', FILENAME_BACKUP, 'file=' . $buInfo->file . '&action=deleteconfirm'));
 475        $contents[] = array('text' => TEXT_DELETE_INTRO);
 476        $contents[] = array('text' => '<br><b>' . $buInfo->file . '</b>');
 477        $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>');
 478        break;
 479      default:
 480        if (isset($buInfo) && is_object($buInfo)) {
 481          $heading[] = array('text' => '<b>' . $buInfo->date . '</b>');
 482  
 483          $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>');
 484          $contents[] = array('text' => '<br>' . TEXT_INFO_DATE . ' ' . $buInfo->date);
 485          $contents[] = array('text' => TEXT_INFO_SIZE . ' ' . $buInfo->size);
 486          $contents[] = array('text' => '<br>' . TEXT_INFO_COMPRESSION . ' ' . $buInfo->compression);
 487        }
 488        break;
 489    }
 490  
 491    if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
 492      echo '            <td width="25%" valign="top">' . "\n";
 493  
 494      $box = new box;
 495      echo $box->infoBox($heading, $contents);
 496  
 497      echo '            </td>' . "\n";
 498    }
 499  ?>
 500            </tr>
 501          </table></td>
 502        </tr>
 503      </table></td>
 504  <!-- body_text_eof //-->
 505    </tr>
 506  </table>
 507  <!-- body_eof //-->
 508  
 509  <!-- footer //-->
 510  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 511  <!-- footer_eof //-->
 512  <br>
 513  </body>
 514  </html>
 515  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7