Esempio n. 1
0
     tep_redirect(tep_href_link($g_script));
     break;
 case 'restorenow':
     $file = basename($_GET['file']);
     $extension = substr($file, -3);
     if ($extension != 'zip' && $extension != 'sql') {
         $messageStack->add_session(ERROR_CANNOT_OPEN_FILE);
         tep_redirect(tep_href_link($g_script));
     }
     if (!is_file(DIR_FS_BACKUP . $file)) {
         $messageStack->add_session(ERROR_CANNOT_OPEN_FILE);
         tep_redirect(tep_href_link($g_script));
     }
     $files_array = array($file);
     if ($extension == 'zip') {
         $result_array = tep_decompress(DIR_FS_BACKUP . $file, DIR_FS_BACKUP);
         if (count($result_array['messages'])) {
             for ($i = 0, $j = count($result_array['messages']); $i < $j; $i++) {
                 $messageStack->add_session($result_array['messages'][$i]);
             }
             tep_redirect(tep_href_link($g_script));
         } else {
             $files_array = $result_array['files'];
         }
         $file = 'tmp_zip_' . basename($file, '.zip') . '.sql';
         $fp = fopen(DIR_FS_BACKUP . $file, 'w');
         if (!$fp) {
             $messageStack->add_session(ERROR_CANNOT_CREATE_FILE);
             tep_redirect(tep_href_link($g_script));
         }
         for ($i = 0, $j = count($files_array); $i < $j; $i++) {
Esempio n. 2
0
 case 'set_options':
     if (!$plugin->is_installed() || !method_exists($plugin, 'set_options')) {
         $messageStack->add_session(WARNING_PLUGIN_NOT_CONFIGURABLE, 'warning');
         tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action')));
     }
     break;
 case 'process_options':
     if (!$plugin->is_installed() || !method_exists($plugin, 'process_options')) {
         $messageStack->add_session(WARNING_PLUGIN_NOT_CONFIGURABLE, 'warning');
         tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action')));
     }
     $plugin->process_options();
     tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action')));
     break;
 case 'decompress_confirm':
     $result_array = tep_decompress($plugins_compressed_array[$cplgID]['file'], $plugins_compressed_array[$cplgID]['path']);
     for ($i = 0, $j = count($result_array['messages']); $i < $j; $i++) {
         $messageStack->add_session($result_array['messages'][$i]);
     }
     tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action', 'plgID', 'cplgID') . 'plgID=' . $cplgID));
     break;
 case 'archive_confirm':
     $pdir = DIR_FS_PLUGINS . tep_trail_path($plugin->key);
     $zip_file = $pdir . $plugin->key . '.zip';
     $cZip = new pkzip();
     if (isset($_POST['store'])) {
         $cZip->addDir($pdir);
     } else {
         $cZip->addDir($pdir, '', array());
     }
     $contents = $cZip->file();