示例#1
0
function InitUpload()
{
    global $sType, $sStyleName, $sCusDir, $sParamSYFlag, $sParamRnd;
    global $sAllowExt, $nAllowSize, $sUploadDir, $nUploadObject, $sAutoDir, $sBaseUrl, $sContentPath, $sSetContentPath;
    global $sFileExt, $sOriginalFileName, $sSaveFileName, $sPathFileName, $nFileNum;
    global $nSLTFlag, $nSLTMode, $nSLTCheckFlag, $nSLTMinSize, $nSLTOkSize, $nSYWZFlag, $sSYText, $sSYFontColor, $nSYFontSize, $sSYFontName, $sSYPicPath, $nSLTSYObject, $sSLTSYExt, $nSYWZMinWidth, $sSYShadowColor, $nSYShadowOffset, $nSYWZMinHeight, $nSYWZPosition, $nSYWZTextWidth, $nSYWZTextHeight, $nSYWZPaddingH, $nSYWZPaddingV, $nSYTPFlag, $nSYTPMinWidth, $nSYTPMinHeight, $nSYTPPosition, $nSYTPPaddingH, $nSYTPPaddingV, $nSYTPImageWidth, $nSYTPImageHeight, $nSYTPOpacity;
    global $sSpaceSize, $sSpacePath, $sMFUMode;
    global $sParamBlockFile, $sParamBlockFlag;
    global $sFileNameMode, $sFileNameSameFix, $sAutoDirOrderFlag, $sAutoTypeDir;
    global $sSYValidNormal, $sSYValidLocal, $sSYValidRemote;
    $sType = TrimGet("type");
    $sStyleName = TrimGet("style");
    $sCusDir = TrimGet("cusdir");
    $sParamSYFlag = TrimGet("syflag");
    $sParamRnd = TrimGet("rnd");
    $s_SKey = TrimGet("skey");
    $s_SParams = TrimGet("sparams");
    $sParamBlockFile = TrimGet("blockfile");
    $sParamBlockFlag = TrimGet("blockflag");
    if ($sParamBlockFile != "") {
        if (!IsFileNameFormat($sParamBlockFile)) {
            OutScript("blockfile");
            exit;
        }
    }
    $bValidStyle = false;
    $numElements = count($GLOBALS["aStyle"]);
    for ($i = 1; $i <= $numElements; $i++) {
        $aStyleConfig = explode("|||", $GLOBALS["aStyle"][$i]);
        if (strtolower($sStyleName) == strtolower($aStyleConfig[0])) {
            $bValidStyle = true;
            break;
        }
    }
    if ($bValidStyle == false) {
        OutScript("parent.UploadError('style')");
    }
    if ($aStyleConfig[61] != "1") {
        $sCusDir = "";
    }
    if ($aStyleConfig[61] == "2" && ($s_SKey != "" || IsOkSParams($s_SParams, $aStyleConfig[70]))) {
        $ss_FileSize = "";
        $ss_FileBrowse = "";
        $ss_SpaceSize = "";
        $ss_SpacePath = "";
        $ss_PathMode = "";
        $ss_PathUpload = "";
        $ss_PathCusDir = "";
        $ss_PathCode = "";
        $ss_PathView = "";
        if ($s_SKey != "") {
            $ss_FileSize = GetSAPIvalue($s_SKey, "FileSize");
            $ss_FileBrowse = GetSAPIvalue($s_SKey, "FileBrowse");
            $ss_SpaceSize = GetSAPIvalue($s_SKey, "SpaceSize");
            $ss_SpacePath = GetSAPIvalue($s_SKey, "SpacePath");
            $ss_PathMode = GetSAPIvalue($s_SKey, "PathMode");
            $ss_PathUpload = GetSAPIvalue($s_SKey, "PathUpload");
            $ss_PathCusDir = GetSAPIvalue($s_SKey, "PathCusDir");
            $ss_PathCode = GetSAPIvalue($s_SKey, "PathCode");
            $ss_PathView = GetSAPIvalue($s_SKey, "PathView");
        } else {
            $a_SParams = explode("|", $s_SParams);
            $ss_FileSize = $a_SParams[1];
            $ss_FileBrowse = $a_SParams[2];
            $ss_SpaceSize = $a_SParams[3];
            $ss_SpacePath = $a_SParams[4];
            $ss_PathMode = $a_SParams[5];
            $ss_PathUpload = $a_SParams[6];
            $ss_PathCusDir = $a_SParams[7];
            $ss_PathCode = $a_SParams[8];
            $ss_PathView = $a_SParams[9];
        }
        if (is_numeric($ss_FileSize)) {
            $aStyleConfig[11] = $ss_FileSize;
            $aStyleConfig[12] = $ss_FileSize;
            $aStyleConfig[13] = $ss_FileSize;
            $aStyleConfig[14] = $ss_FileSize;
            $aStyleConfig[15] = $ss_FileSize;
            $aStyleConfig[45] = $ss_FileSize;
        } else {
            $ss_FileSize = "";
        }
        if ($ss_FileBrowse == "0" || $ss_FileBrowse == "1") {
            $aStyleConfig[43] = $ss_FileBrowse;
        } else {
            $ss_FileBrowse = "";
        }
        if (is_numeric($ss_SpaceSize)) {
            $aStyleConfig[78] = $ss_SpaceSize;
        } else {
            $ss_SpaceSize = "";
        }
        if ($ss_PathMode != "") {
            $aStyleConfig[19] = $ss_PathMode;
        }
        if ($ss_PathUpload != "") {
            $aStyleConfig[3] = $ss_PathUpload;
        }
        if ($ss_PathCode != "") {
            $aStyleConfig[23] = $ss_PathCode;
        }
        if ($ss_PathView != "") {
            $aStyleConfig[22] = $ss_PathView;
        }
        $sCusDir = $ss_PathCusDir;
        $sSpacePath = $ss_SpacePath;
    } else {
        $sSpacePath = "";
    }
    $sBaseUrl = $aStyleConfig[19];
    $nUploadObject = (int) $aStyleConfig[20];
    $sAutoDir = $aStyleConfig[71];
    $sUploadDir = $aStyleConfig[3];
    if ($sBaseUrl != "3") {
        if (substr($sUploadDir, 0, 1) != "/") {
            $sUploadDir = "../" . $sUploadDir;
        }
    }
    switch ($sBaseUrl) {
        case "0":
        case "3":
            $sContentPath = $aStyleConfig[23];
            break;
        case "1":
            $sContentPath = RelativePath2RootPath($sUploadDir);
            break;
        case "2":
            $sContentPath = RootPath2DomainPath(RelativePath2RootPath($sUploadDir));
            break;
    }
    $sSetContentPath = $sContentPath;
    if ($sBaseUrl != "3") {
        $sUploadDir = realpath($sUploadDir);
    }
    if (substr($sUploadDir, -1) != "\\" && substr($sUploadDir, -1) != "/") {
        $sUploadDir .= "/";
    }
    switch (strtoupper($sType)) {
        case "REMOTE":
            $sAllowExt = $aStyleConfig[10];
            $nAllowSize = (int) $aStyleConfig[15];
            $sAutoTypeDir = $aStyleConfig[93];
            break;
        case "FILE":
            $sAllowExt = $aStyleConfig[6];
            $nAllowSize = (int) $aStyleConfig[11];
            $sAutoTypeDir = $aStyleConfig[92];
            break;
        case "MEDIA":
            $sAllowExt = $aStyleConfig[9];
            $nAllowSize = (int) $aStyleConfig[14];
            $sAutoTypeDir = $aStyleConfig[91];
            break;
        case "FLASH":
            $sAllowExt = $aStyleConfig[7];
            $nAllowSize = (int) $aStyleConfig[12];
            $sAutoTypeDir = $aStyleConfig[90];
            break;
        case "LOCAL":
            $sAllowExt = $aStyleConfig[44];
            $nAllowSize = (int) $aStyleConfig[45];
            $sAutoTypeDir = $aStyleConfig[94];
            break;
        default:
            $sAllowExt = $aStyleConfig[8];
            $nAllowSize = (int) $aStyleConfig[13];
            $sAutoTypeDir = $aStyleConfig[89];
            break;
    }
    $sAllowExt = strtoupper($sAllowExt);
    $nSLTFlag = (int) $aStyleConfig[29];
    $nSLTMode = (int) $aStyleConfig[69];
    $nSLTCheckFlag = (int) $aStyleConfig[77];
    $nSLTMinSize = (int) $aStyleConfig[30];
    $nSLTOkSize = (int) $aStyleConfig[31];
    $nSYWZFlag = (int) $aStyleConfig[32];
    $sSYText = $aStyleConfig[33];
    $sSYFontColor = $aStyleConfig[34];
    $nSYFontSize = (int) $aStyleConfig[35];
    $sSYFontName = $aStyleConfig[36];
    $sSYPicPath = $aStyleConfig[37];
    $nSLTSYObject = (int) $aStyleConfig[38];
    $sSLTSYExt = $aStyleConfig[39];
    $nSYWZMinWidth = (int) $aStyleConfig[40];
    $sSYShadowColor = $aStyleConfig[41];
    $nSYShadowOffset = (int) $aStyleConfig[42];
    $nSYWZMinHeight = (int) $aStyleConfig[46];
    $nSYWZPosition = (int) $aStyleConfig[47];
    $nSYWZTextWidth = (int) $aStyleConfig[48];
    $nSYWZTextHeight = (int) $aStyleConfig[49];
    $nSYWZPaddingH = (int) $aStyleConfig[50];
    $nSYWZPaddingV = (int) $aStyleConfig[51];
    $nSYTPFlag = (int) $aStyleConfig[52];
    $nSYTPMinWidth = (int) $aStyleConfig[53];
    $nSYTPMinHeight = (int) $aStyleConfig[54];
    $nSYTPPosition = (int) $aStyleConfig[55];
    $nSYTPPaddingH = (int) $aStyleConfig[56];
    $nSYTPPaddingV = (int) $aStyleConfig[57];
    $nSYTPImageWidth = (int) $aStyleConfig[58];
    $nSYTPImageHeight = (int) $aStyleConfig[59];
    $nSYTPOpacity = (double) $aStyleConfig[60];
    $sSpaceSize = $aStyleConfig[78];
    $sMFUMode = $aStyleConfig[79];
    $sFileNameMode = $aStyleConfig[68];
    $sFileNameSameFix = $aStyleConfig[87];
    $sAutoDirOrderFlag = $aStyleConfig[88];
    $sSYValidNormal = $aStyleConfig[99];
    $sSYValidLocal = $aStyleConfig[100];
    $sSYValidRemote = $aStyleConfig[101];
    if (($GLOBALS["sAction"] == "SAVE" || $GLOBALS["sAction"] == "MFU") && $sSYValidNormal != "1" || $GLOBALS["sAction"] == "LOCAL" && $sSYValidLocal != "1" || $GLOBALS["sAction"] == "REMOTE" && $sSYValidRemote != "1") {
        $nSYWZFlag = 0;
        $nSYTPFlag = 0;
    }
    if ($nSYWZFlag == 2) {
        if ($sParamSYFlag == "1") {
            $nSYWZFlag = 1;
        } else {
            $nSYWZFlag = 0;
        }
    }
    if ($nSYTPFlag == 2) {
        if ($sParamSYFlag == "1") {
            $nSYTPFlag = 1;
        } else {
            $nSYTPFlag = 0;
        }
    }
    if (!IsInt($sParamRnd)) {
        $sParamRnd = "";
    }
    if ($sCusDir != "") {
        $sCusDir = str_replace("\\", "/", $sCusDir);
        if (substr($sCusDir, 0, 1) == "/" || substr($sCusDir, 0, 1) == "." || substr($sCusDir, -1) == "." || strpos($sCusDir, "./") !== false || strpos($sCusDir, "/.") !== false || strpos($sCusDir, "//") !== false || strpos($sCusDir, "..") !== false) {
            $sCusDir = "";
        } else {
            if (substr($sCusDir, -1) != "/") {
                $sCusDir = $sCusDir . "/";
            }
        }
    }
}
示例#2
0
function InitUpload()
{
    global $sType, $sStyleName, $sCusDir, $sParamSYFlag;
    global $sAllowExt, $nAllowSize, $sUploadDir, $nUploadObject, $nAutoDir, $sBaseUrl, $sContentPath;
    global $sFileExt, $sOriginalFileName, $sSaveFileName, $sPathFileName, $nFileNum;
    global $nSLTFlag, $nSLTMinSize, $nSLTOkSize, $nSYWZFlag, $sSYText, $sSYFontColor, $nSYFontSize, $sSYFontName, $sSYPicPath, $nSLTSYObject, $sSLTSYExt, $nSYWZMinWidth, $sSYShadowColor, $nSYShadowOffset, $nSYWZMinHeight, $nSYWZPosition, $nSYWZTextWidth, $nSYWZTextHeight, $nSYWZPaddingH, $nSYWZPaddingV, $nSYTPFlag, $nSYTPMinWidth, $nSYTPMinHeight, $nSYTPPosition, $nSYTPPaddingH, $nSYTPPaddingV, $nSYTPImageWidth, $nSYTPImageHeight, $nSYTPOpacity, $nCusDirFlag;
    $sType = toTrim("type");
    $sStyleName = toTrim("style");
    $sCusDir = toTrim("cusdir");
    $sParamSYFlag = toTrim("syflag");
    $sCusDir = str_replace("\\", "/", $sCusDir);
    if (substr($sCusDir, 0, 1) == "/" || substr($sCusDir, 0, 1) == "." || substr($sCusDir, -1) == "." || strstr($sCusDir, "./") || strstr($sCusDir, "/.") || strstr($sCusDir, "//")) {
        $sCusDir = "";
    }
    $bValidStyle = false;
    $numElements = count($GLOBALS["aStyle"]);
    for ($i = 1; $i <= $numElements; $i++) {
        $aStyleConfig = explode("|||", $GLOBALS["aStyle"][$i]);
        if (strtolower($sStyleName) == strtolower($aStyleConfig[0])) {
            $bValidStyle = true;
            break;
        }
    }
    if ($bValidStyle == false) {
        OutScript("parent.UploadError('style')");
    }
    $sBaseUrl = $aStyleConfig[19];
    $nUploadObject = (int) $aStyleConfig[20];
    $nAutoDir = (int) $aStyleConfig[21];
    $sUploadDir = $aStyleConfig[3];
    if ($sBaseUrl != "3") {
        if (substr($sUploadDir, 0, 1) != "/") {
            $sUploadDir = "../" . $sUploadDir;
        }
    }
    switch ($sBaseUrl) {
        case "0":
        case "3":
            $sContentPath = $aStyleConfig[23];
            break;
        case "1":
            $sContentPath = RelativePath2RootPath($sUploadDir);
            break;
        case "2":
            $sContentPath = RootPath2DomainPath(RelativePath2RootPath($sUploadDir));
            break;
    }
    if ($sBaseUrl != "3") {
        $sUploadDir = realpath($sUploadDir);
    }
    if (substr($sUploadDir, -1) != "\\" && substr($sUploadDir, -1) != "/") {
        $sUploadDir .= "/";
    }
    switch (strtoupper($sType)) {
        case "REMOTE":
            $sAllowExt = $aStyleConfig[10];
            $nAllowSize = (int) $aStyleConfig[15];
            break;
        case "FILE":
            $sAllowExt = $aStyleConfig[6];
            $nAllowSize = (int) $aStyleConfig[11];
            break;
        case "MEDIA":
            $sAllowExt = $aStyleConfig[9];
            $nAllowSize = (int) $aStyleConfig[14];
            break;
        case "FLASH":
            $sAllowExt = $aStyleConfig[7];
            $nAllowSize = (int) $aStyleConfig[12];
            break;
        default:
            $sAllowExt = $aStyleConfig[8];
            $nAllowSize = (int) $aStyleConfig[13];
            break;
    }
    $sAllowExt = strtoupper($sAllowExt);
    $nSLTFlag = (int) $aStyleConfig[29];
    $nSLTMinSize = (int) $aStyleConfig[30];
    $nSLTOkSize = (int) $aStyleConfig[31];
    $nSYWZFlag = (int) $aStyleConfig[32];
    $sSYText = $aStyleConfig[33];
    $sSYFontColor = $aStyleConfig[34];
    $nSYFontSize = (int) $aStyleConfig[35];
    $sSYFontName = $aStyleConfig[36];
    $sSYPicPath = $aStyleConfig[37];
    $nSLTSYObject = (int) $aStyleConfig[38];
    $sSLTSYExt = $aStyleConfig[39];
    $nSYWZMinWidth = (int) $aStyleConfig[40];
    $sSYShadowColor = $aStyleConfig[41];
    $nSYShadowOffset = (int) $aStyleConfig[42];
    $nSYWZMinHeight = (int) $aStyleConfig[46];
    $nSYWZPosition = (int) $aStyleConfig[47];
    $nSYWZTextWidth = (int) $aStyleConfig[48];
    $nSYWZTextHeight = (int) $aStyleConfig[49];
    $nSYWZPaddingH = (int) $aStyleConfig[50];
    $nSYWZPaddingV = (int) $aStyleConfig[51];
    $nSYTPFlag = (int) $aStyleConfig[52];
    $nSYTPMinWidth = (int) $aStyleConfig[53];
    $nSYTPMinHeight = (int) $aStyleConfig[54];
    $nSYTPPosition = (int) $aStyleConfig[55];
    $nSYTPPaddingH = (int) $aStyleConfig[56];
    $nSYTPPaddingV = (int) $aStyleConfig[57];
    $nSYTPImageWidth = (int) $aStyleConfig[58];
    $nSYTPImageHeight = (int) $aStyleConfig[59];
    $nSYTPOpacity = (double) $aStyleConfig[60];
    $nCusDirFlag = (int) $aStyleConfig[61];
    if ($nSYWZFlag == 2) {
        if ($sParamSYFlag == "1") {
            $nSYWZFlag = 1;
        } else {
            $nSYWZFlag = 0;
        }
    }
    if ($nSYTPFlag == 2) {
        if ($sParamSYFlag == "1") {
            $nSYTPFlag = 1;
        } else {
            $nSYTPFlag = 0;
        }
    }
}