function InitParam() { global $sType, $sStyleName, $sCusDir, $sAction; global $nTreeIndex; global $sAllowExt, $sUploadDir, $sBaseUrl, $sContentPath, $nAllowBrowse, $nCusDirFlag; global $sPathShareImage, $sPathShareFlash, $sPathShareMedia, $sPathShareOther; $sType = strtoupper(toTrim("type")); $sStyleName = toTrim("style"); $sCusDir = toTrim("cusdir"); $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("alert('Invalid Style!')"); } $sBaseUrl = $aStyleConfig[19]; $nAllowBrowse = (int) $aStyleConfig[43]; $nCusDirFlag = (int) $aStyleConfig[61]; if ($nAllowBrowse != 1) { OutScript("alert('Do not allow browse!')"); } if ($nCusDirFlag != 1) { $sCusDir = ""; } else { $sCusDir = str_replace("\\", "/", $sCusDir); if (substr($sCusDir, 0, 1) == "/" || substr($sCusDir, 0, 1) == "." || substr($sCusDir, -1) == "." || strstr($sCusDir, "./") || strstr($sCusDir, "/.") || strstr($sCusDir, "//")) { $sCusDir = ""; } else { if (substr($sCusDir, -1) != "/") { $sCusDir = $sCusDir . "/"; } } } $sUploadDir = $aStyleConfig[3]; if ($sBaseUrl != "3") { if (substr($sUploadDir, 0, 1) != "/") { $sUploadDir = "../" . $sUploadDir; } $sUploadDir = realpath($sUploadDir); } $sUploadDir = GetSlashPath($sUploadDir); $sUploadDir = $sUploadDir . $sCusDir; switch ($sType) { case "FILE": $sAllowExt = ""; break; case "MEDIA": $sAllowExt = "rm|mp3|wav|mid|midi|ra|avi|mpg|mpeg|asf|asx|wma|mov"; break; case "FLASH": $sAllowExt = "swf"; break; default: $sAllowExt = "bmp|jpg|jpeg|png|gif"; break; } $sAllowExt = strtoupper($sAllowExt); $sPathShareImage = GetSlashPath(realpath("../sharefile/image/")); $sPathShareFlash = GetSlashPath(realpath("../sharefile/flash/")); $sPathShareMedia = GetSlashPath(realpath("../sharefile/media/")); $sPathShareOther = GetSlashPath(realpath("../sharefile/other/")); }
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; } } }