Beispiel #1
0
     if ($err) {
         echo "parent.save_err('{$out}');";
     } else {
         if ($_POST['encode'] != $_POST['encodeto']) {
             echo "alert('{$out}');";
         }
     }
     echo "parent.save_suc('{$out}');</script>";
     die;
 } else {
     if ($action == "savefromurl" && $user["savefromurl"]) {
         if (!$path || !$url) {
             exitme("notice(lang.var_error)", "eval");
         }
         if (!$filename) {
             $filename = basename1($url);
         }
         if ($filename != checkfilename($filename)) {
             exitme("notice(lang.download+lang.fail)", "eval");
         }
         checktype($filename);
         if (!is_writeable($path)) {
             exitme("notice(lang.cannot_write)", "eval");
         }
         if (file_exists($path . $filename)) {
             exitme("notice(lang.alreadyExist+':{$filename}')", "eval");
         }
         $filename = dealpath($path . $filename);
         if (@copy($url, $filename)) {
             exitme("notice(lang.download+lang.success+': {$filename} ');reloaddata();", "eval");
         } else {
Beispiel #2
0
function getext($filename)
{
    $filename = trim(strtolower($filename));
    $filename = basename1($filename);
    $arr = explode('.', $filename);
    $type = $arr[count($arr) - 1];
    return $type;
}
Beispiel #3
0
            }
            $out_str .= "<body style='backgroud-color:#ffffff;'>\n";
            $out_str .= "<script language=javascript src=\"js/edit.js\"></script>\n";
            $out_str .= "<script language=javascript src=\"js/hash.js\"></script>\n";
            $line = @file($path);
            $content = "";
            $lines = "";
            $n = count($line);
            for ($i = 0; $i < $n; $i++) {
                $content .= htmlspecialchars($line[$i]);
            }
            $n += 1000;
            for ($i = 0; $i < $n; $i++) {
                $lines .= $i + 1 . "\n";
            }
            $main = deal_temp("js/editor.htm", array("path" => $path, "titleback" => $icon["titleback"], "width" => $sitewidth - 60, "filename" => basename1($path), "size" => dealsize(filesize($path)), "selected_gb2312" => $selected_gb2312, "selected_utf8" => $selected_utf8, "encode" => $encode));
            $main = deal_temp("temp/{$tempname}/main.htm", array("sitewidth" => $sitewidth, "title" => "编辑文件 " . basename1($path), "logout" => "<a href='login.php?action=logout' target=_top>退出</a>", "main" => $main, "currentpath" => " ", "username" => $user["name"], "footer" => ""));
            $encode2 = get_encode("temp/{$tempname}/main.htm");
            if ($encode != $encode2) {
                $s1 = @iconv($encode2, $encode, $out_str);
                $out_str = $s1 ? $s1 : $out_str;
                $s1 = @iconv($encode2, $encode, $main);
                $main = $s1 ? $s1 : $main;
            }
            echo $out_str;
            echo str_replace(array("{lines}", "{content}"), array($lines, $content), $main);
            echo "<script>RoundCorner('titlediv');RoundCorner('maindiv');</script>";
            exit;
        }
    }
}
Beispiel #4
0
        }
    }
    $path = str_replace("|", "", $path);
    if (!file_exists($path)) {
        exit("<script>alert('文件不存在!!');</script>");
    }
    $filename = basename1($path);
    header('Content-type: application/force-download');
    header("Content-Disposition: attachment; filename={$filename}");
    header("Content-length: " . filesize($path));
    readfile($path);
    die;
} else {
    if ($action == "downfiles") {
        $sfile = urldecode($_GET["files"]);
        $sdir = urldecode($_GET["dirs"]);
        if (!($content = zippack($path, $sdir, $sfile))) {
            die("<script>alert('下载时出错!');</script>");
        }
        $filename = substr($path, 0, strlen($path) - 1) . ".zip";
        $filename = basename1($filename);
        if ($filename == "..zip" || $filename == "...zip") {
            $filename = "root.zip";
        }
        header('Content-type: application/force-download');
        header("Content-Disposition: attachment; filename={$filename}");
        header("Content-length:" . strlen($content));
        echo $content;
        die;
    }
}