function GetFileList() { $s_ReturnFlag = TrimGet("returnflag"); $s_FolderType = TrimGet("foldertype"); $s_Dir = TrimGet("dir"); $s_CurrDir = ""; $s_Dir = UTF8_to_Pagecode($s_Dir, true); switch ($s_FolderType) { case "upload": $s_CurrDir = $GLOBALS["sUploadDir"]; break; case "shareimage": $GLOBALS["sAllowExt"] = ""; $s_CurrDir = $GLOBALS["sPathShareImage"]; break; case "shareflash": $GLOBALS["sAllowExt"] = ""; $s_CurrDir = $GLOBALS["sPathShareFlash"]; break; case "sharemedia": $GLOBALS["sAllowExt"] = ""; $s_CurrDir = $GLOBALS["sPathShareMedia"]; break; default: $s_FolderType = "shareother"; $GLOBALS["sAllowExt"] = ""; $s_CurrDir = $GLOBALS["sPathShareOther"]; break; } $s_Dir = str_replace("\\", "/", $s_Dir); if (substr($s_Dir, 0, 1) == "/" || substr($s_Dir, 0, 1) == "." || substr($s_Dir, -1) == "." || strpos($s_Dir, "./") !== false || strpos($s_Dir, "/.") !== false || strpos($s_Dir, "//") !== false || strpos($s_Dir, "..") !== false) { $s_Dir = ""; } if ($s_Dir != "") { $ss_Dir = $s_CurrDir . Syscode2Pagecode($s_Dir, false); if (is_dir($ss_Dir)) { $s_CurrDir = $ss_Dir; } else { $s_Dir = ""; } } $s_List = ""; if (is_dir($s_CurrDir)) { if ($handle = opendir($s_CurrDir)) { while (false !== ($file = readdir($handle))) { $sFileType = filetype($s_CurrDir . $file); if ($sFileType == "file") { $oFiles[] = $file; } } } $i = -1; if (isset($oFiles)) { foreach ($oFiles as $oFile) { if (CheckValidExt($oFile)) { $i = $i + 1; $sFileName = $s_CurrDir . $oFile; $s_List = $s_List . "arr[" . $i . "]=new Array(\"" . Syscode2Pagecode($oFile, true) . "\", \"" . GetSizeUnit(filesize($sFileName)) . "\",\"" . date("Y-m-d H:i:s", filemtime($sFileName)) . "\");\n"; } } } } $s_List = "var arr = new Array();\n" . $s_List . "parent.setFileList('" . $s_ReturnFlag . "', '" . $s_FolderType . "', '" . $s_Dir . "', arr);"; return $s_List; }
function makeImageSY($s_Path, $s_File) { if ($GLOBALS["nSYWZFlag"] == 0 && $GLOBALS["nSYTPFlag"] == 0) { return false; } if (!isValidSLTSYExt($s_File)) { return false; } switch ($GLOBALS["nSLTSYObject"]) { case 0: $groundImage = $s_Path . $s_File; if (!file_exists($groundImage)) { return false; } $ground_info = getimagesize($groundImage); $ground_w = $ground_info[0]; $ground_h = $ground_info[1]; switch ($ground_info[2]) { case 1: $ground_im = imagecreatefromgif($groundImage); break; case 2: $ground_im = imagecreatefromjpeg($groundImage); break; case 3: $ground_im = imagecreatefrompng($groundImage); break; default: return false; } imagealphablending($ground_im, true); if ($GLOBALS["nSYWZFlag"] == 1) { if ($ground_w < $GLOBALS["nSYWZMinWidth"] || $ground_h < $GLOBALS["nSYWZMinHeight"]) { return false; } $posX = getSYPosX($GLOBALS["nSYWZPosition"], $ground_w, $GLOBALS["nSYWZTextWidth"] + $GLOBALS["nSYShadowOffset"], $GLOBALS["nSYWZPaddingH"]); $posY = getSYPosY($GLOBALS["nSYWZPosition"], $ground_h, $GLOBALS["nSYWZTextHeight"] + $GLOBALS["nSYShadowOffset"], $GLOBALS["nSYWZPaddingV"]); if ($GLOBALS["sSYFontName"]) { $s_SYText = UTF8_to_Pagecode($GLOBALS["sSYText"], false); $fontSize = imagettfbbox($GLOBALS["nSYFontSize"], 0, $GLOBALS["sSYFontName"], $s_SYText); $n_SYWidth = $fontSize[2] - $fontSize[0]; $n_SYHeight = $fontSize[1] - $fontSize[7]; } if ($GLOBALS["sSYShadowColor"] == "") { $GLOBALS["sSYShadowColor"] = "ffffff"; } $R = hexdec(substr($GLOBALS["sSYShadowColor"], 0, 2)); $G = hexdec(substr($GLOBALS["sSYShadowColor"], 2, 2)); $B = hexdec(substr($GLOBALS["sSYShadowColor"], 4)); $textcolor = imagecolorallocate($ground_im, $R, $G, $B); if ($GLOBALS["sSYFontName"]) { imagettftext($ground_im, $GLOBALS["nSYFontSize"], 0, $posX + $GLOBALS["nSYShadowOffset"], $posY + $n_SYHeight + $GLOBALS["nSYShadowOffset"], $textcolor, $GLOBALS["sSYFontName"], $s_SYText); } else { imagestring($ground_im, $GLOBALS["nSYFontSize"], $posX + $GLOBALS["nSYShadowOffset"], $posY + $GLOBALS["nSYShadowOffset"], $GLOBALS["sSYText"], $textcolor); } if ($GLOBALS["sSYFontColor"] == "") { $GLOBALS["sSYFontColor"] = "000000"; } $R = hexdec(substr($GLOBALS["sSYFontColor"], 0, 2)); $G = hexdec(substr($GLOBALS["sSYFontColor"], 2, 2)); $B = hexdec(substr($GLOBALS["sSYFontColor"], 4)); $textcolor = imagecolorallocate($ground_im, $R, $G, $B); if ($GLOBALS["sSYFontName"]) { imagettftext($ground_im, $GLOBALS["nSYFontSize"], 0, $posX, $posY + $n_SYHeight, $textcolor, $GLOBALS["sSYFontName"], $s_SYText); } else { imagestring($ground_im, $GLOBALS["nSYFontSize"], $posX, $posY, $GLOBALS["sSYText"], $textcolor); } } if ($GLOBALS["nSYTPFlag"] == 1) { $waterImage = $GLOBALS["sSYPicPath"]; if (!file_exists($waterImage)) { return false; } $water_info = getimagesize($waterImage); $water_w = $water_info[0]; $water_h = $water_info[1]; switch ($water_info[2]) { case 1: $water_im = imagecreatefromgif($waterImage); break; case 2: $water_im = imagecreatefromjpeg($waterImage); break; case 3: $water_im = imagecreatefrompng($waterImage); break; default: return false; } //if(($ground_w<$water_w)||($ground_h<$water_h)){return false;} if ($ground_w < $GLOBALS["nSYTPMinWidth"] || $ground_h < $GLOBALS["nSYTPMinHeight"]) { return false; } $posX = getSYPosX($GLOBALS["nSYTPPosition"], $ground_w, $GLOBALS["nSYTPImageWidth"], $GLOBALS["nSYTPPaddingH"]); $posY = getSYPosY($GLOBALS["nSYTPPosition"], $ground_h, $GLOBALS["nSYTPImageHeight"], $GLOBALS["nSYTPPaddingV"]); imagecopymerge($ground_im, $water_im, $posX, $posY, 0, 0, $water_w, $water_h, $GLOBALS["nSYTPOpacity"] * 100); } //@unlink($groundImage); switch ($ground_info[2]) { case 1: imagegif($ground_im, $groundImage); break; case 2: imagejpeg($ground_im, $groundImage); break; case 3: imagepng($ground_im, $groundImage); break; } if (isset($water_info)) { unset($water_info); } if (isset($water_im)) { imagedestroy($water_im); } unset($ground_info); imagedestroy($ground_im); break; default: break; } return true; }