예제 #1
0
 function create_zip_plugin()
 {
     $result = false;
     $pdir = DIR_FS_PLUGINS . $this->key . '/';
     $zip_file = $pdir . $this->key . '.zip';
     $cZip = new pkzip();
     $cZip->addDir($pdir);
     if (tep_write_contents($zip_file, $cZip->file())) {
         $result = true;
     }
     return $result;
 }
예제 #2
0
         $config_name = isset($_POST['config_name'][$key]) ? strtolower(tep_create_safe_string($_POST['config_name'][$key], '_', $multi_filter)) : '';
         if (empty($config_name)) {
             continue;
         }
         $http_server = isset($_POST['http_server'][$key]) ? $g_db->prepare_input($_POST['http_server'][$key]) : '';
         $https_server = isset($_POST['https_server'][$key]) ? $g_db->prepare_input($_POST['https_server'][$key]) : '';
         $site_ssl = isset($_POST['site_ssl'][$key]) ? 'true' : 'false';
         $ws_path = isset($_POST['ws_path'][$key]) ? $g_db->prepare_input($_POST['ws_path'][$key]) : '';
         $fs_path = isset($_POST['fs_path'][$key]) ? $g_db->prepare_input($_POST['fs_path'][$key]) : '';
         $db_server = isset($_POST['db_server'][$key]) ? $g_db->prepare_input($_POST['db_server'][$key]) : '';
         $db_username = isset($_POST['db_username'][$key]) ? $g_db->prepare_input($_POST['db_username'][$key]) : '';
         $db_password = isset($_POST['db_password'][$key]) ? $g_db->prepare_input($_POST['db_password'][$key]) : '';
         $db_database = isset($_POST['db_database'][$key]) ? $g_db->prepare_input($_POST['db_database'][$key]) : '';
         $contents = '<?php' . $copyright_string . "\n" . '  $http_server = \'' . $http_server . '\';' . "\n" . '  $https_server = \'' . $https_server . '\';' . "\n" . '  $site_ssl = \'' . $site_ssl . '\';' . "\n" . '  $ws_path = \'' . $ws_path . '\';' . "\n" . '  $fs_path = \'' . $fs_path . '\';' . "\n" . '  $db_server = \'' . $db_server . '\';' . "\n" . '  $db_username = \'' . $db_username . '\';' . "\n" . '  $db_password = \'' . $db_password . '\';' . "\n" . '  $db_database = \'' . $db_database . '\';' . "\n" . '?>' . "\n";
         $config_name = DIR_FS_MODULES . $multi_prefix . $config_name . '.php';
         if (!tep_write_contents($config_name, $contents)) {
             $messageStack->add_session(sprintf(ERROR_SITE_CONFIG_WRITE, DIR_FS_ADMIN . $config_name));
             continue;
         }
         $result = true;
     }
     if ($result) {
         $messageStack->add_session(SUCCESS_ENTRY_UPDATED, 'success');
     }
     tep_redirect(tep_href_link($g_script));
     break;
 default:
     $config_name = strtolower(tep_create_safe_string(STORE_NAME, '_', $multi_filter));
     $http_server = HTTP_CATALOG_SERVER;
     $https_server = HTTPS_CATALOG_SERVER;
     $site_ssl = ENABLE_SSL_CATALOG;
예제 #3
0
         $messageStack->add_session(sprintf(ERROR_CREATE_DIR_EXISTS, $current_file_path));
         tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action', 'info', 'goto') . 'goto=' . $new_file_path));
     }
     $result = tep_mkdir($sub_dir);
     if (!$result) {
         $messageStack->add_session(sprintf(ERROR_CREATE_DIR, $current_file_path));
     } else {
         $messageStack->add_session(sprintf(SUCCESS_DIR_CREATED, $new_file_path), 'success');
     }
     break;
 case 'save':
     if (empty($current_file)) {
         $messageStack->add_session(ERROR_FILE_INVALID);
         tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action')));
     }
     $result = tep_write_contents($current_path_file, $g_db->prepare_input($_POST['file_contents']));
     if (!$result) {
         $messageStack->add_session(WARNING_FILE_LENGTH, 'warning');
     }
     tep_redirect(tep_href_link($g_script, tep_get_all_get_params('action')));
     break;
 case 'processuploads':
     for ($i = 1; $i < 6; $i++) {
         if (isset($GLOBALS['file_' . $i]) && tep_not_null($GLOBALS['file_' . $i])) {
             new upload('file_' . $i, $current_path);
         }
     }
     tep_redirect(tep_href_link($g_script));
     break;
 case 'download':
     $filename = tep_create_safe_string(basename($_GET['filename']), '', "/[^0-9a-z_\\-\\.]+/i");
예제 #4
0
            $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();
        if (isset($_POST['store'])) {
            tep_write_contents($zip_file, $contents);
        }
        $archive = $plugin->key;
        $filename = $plugin->key . '.zip';
        header('Content-type: application/x-octet-stream');
        header('Content-disposition: attachment; filename=' . $filename);
        echo $contents;
        $g_session->close();
        break;
    case 'info':
        break;
    default:
        break;
}
require DIR_FS_OBJECTS . 'html_start_sub1.php';
if ($last_id > 0) {
예제 #5
0
 function delete_table($def_table)
 {
     extract(tep_load('database'));
     $error = false;
     $fs_includes = tep_front_physical_path(DIR_WS_CATALOG_INCLUDES);
     $tables_array = tep_get_file_array($fs_includes . 'database_language.php');
     $update_language_file = isset($tables_array[$def_table]) ? true : false;
     $language_tables = $this->get_language_tables_detailed($def_table);
     if (empty($language_tables) || !isset($language_tables['default'])) {
         $table = constant($def_table);
     } else {
         $table = $language_tables['default'];
     }
     foreach ($this->languages as $language_id => $language_array) {
         $new_table = $table;
         if (empty($language_array['language_code'])) {
             continue;
         }
         $new_table .= '_' . $language_array['language_code'];
         $db->query("drop table if exists " . $new_table);
     }
     if ($update_language_file) {
         $old_contents = $header_string = '';
         $result = tep_read_contents($fs_includes . 'database_language.php', $old_contents);
         $matches = array();
         if ($result && !empty($old_contents) && preg_match('!/\\*.*?\\*/!s', $old_contents, $matches)) {
             $header_string = $matches[0];
         }
         unset($tables_array[$def_table]);
         $contents = '<?php' . "\r\n" . $header_string . "\r\n\r\n";
         foreach ($tables_array as $key => $value) {
             $contents .= '$' . $key . ' = \'' . $value . '\';' . "\r\n";
         }
         $contents .= '?>' . "\r\n";
         $result = tep_write_contents($fs_includes . 'database_language.php', $contents);
         if (!$result) {
             $error = sprintf(ERROR_WRITING_FILE, $fs_includes . 'database_language.php');
         }
     }
     return $error;
 }
예제 #6
0
function tep_copy_dir($src, $dst)
{
    extract(tep_load('message_stack'));
    //closedir(opendir($src));
    //closedir(opendir($dst));
    $src = rtrim($src, '/');
    $dst = rtrim($dst, '/');
    if (empty($src) || empty($dst) || !is_dir($src)) {
        return;
    }
    $result = tep_mkdir($dst);
    if (!$result) {
        $msg->add_session(sprintf(ERROR_CREATE_DIR, $dst));
        return;
    }
    $sub_array = glob($src . '/*');
    if (empty($sub_array)) {
        return;
    }
    foreach ($sub_array as $sub) {
        $entry = basename($sub);
        if (is_file($sub)) {
            $contents = '';
            if (!tep_read_contents($src . '/' . $entry, $contents)) {
                $msg->add_session(sprintf(ERROR_INVALID_FILE, $src . '/' . $entry));
                continue;
            }
            if (!tep_write_contents($dst . '/' . $entry, $contents)) {
                $msg->add_session(sprintf(ERROR_WRITING_FILE, $src . '/' . $entry));
                continue;
            }
        } else {
            tep_copy_dir($src . '/' . $entry, $dst . '/' . $entry);
        }
    }
    closedir(opendir($src));
    closedir(opendir($dst));
}