Пример #1
0
function fn_exim_1c_clear_1c_dir()
{
    list($dir_1c, $dir_1c_url, $dir_1c_images) = fn_rus_exim_1c_get_dir_1c();
    if (is_dir($dir_1c)) {
        $dirHandle = opendir($dir_1c);
        while (false !== ($file = readdir($dirHandle))) {
            if ($file != '.' && $file != '..') {
                $tmp_path = $dir_1c . '/' . $file;
                chmod($tmp_path, 0777);
                if (is_dir($tmp_path)) {
                    fn_exim_1c_clear_1c_dir($tmp_path);
                } else {
                    if (file_exists($tmp_path)) {
                        unlink($tmp_path);
                    }
                }
            }
        }
        closedir($dirHandle);
    }
    return true;
}
Пример #2
0
}
if (isset($_REQUEST['mode'])) {
    $mode = $_REQUEST['mode'];
}
$filename = !empty($_REQUEST['filename']) ? fn_basename($_REQUEST['filename']) : '';
$lang_code = Registry::get('addons.rus_export_1c.exim_1c_lang');
if (empty($lang_code)) {
    $lang_code = CART_LANGUAGE;
}
if ($type == 'catalog') {
    if ($mode == 'checkauth') {
        fn_exim_1c_checkauth();
    } elseif ($mode == 'init') {
        fn_exim_1c_init();
        if (Registry::get('addons.rus_exim_1c.exim_1c_schema_version') == '2.05') {
            fn_exim_1c_clear_1c_dir();
        }
    } elseif ($mode == 'file') {
        if (fn_exim_1c_get_external_file($filename) === false) {
            fn_echo("failure");
            exit;
        }
        fn_echo("success\n");
    } elseif ($mode == 'import') {
        $fileinfo = pathinfo($filename);
        $xml = fn_exim_1c_get_xml($filename);
        if ($xml === false) {
            fn_echo("failure");
            exit;
        }
        if (strpos($fileinfo['filename'], 'import') == 0) {