function Page_Main() { global $conn; $GLOBALS["Page"] =& $this; //***$conn = ew_Connect(); // Get fn / table name parameters $key = EW_RANDOM_KEY . session_id(); $fn = @$_GET["fn"] != "" ? ew_StripSlashes($_GET["fn"]) : ""; if ($fn != "" && EW_ENCRYPT_FILE_PATH) { $fn = ew_Decrypt($fn, $key); } $table = @$_GET["t"] != "" ? ew_StripSlashes($_GET["t"]) : ""; if ($table != "" && EW_ENCRYPT_FILE_PATH) { $table = ew_Decrypt($table, $key); } // Global Page Loading event (in userfn*.php) //***Page_Loading(); // Get resize parameters $resize = @$_GET["resize"] != ""; $width = @$_GET["width"] != "" ? $_GET["width"] : 0; $height = @$_GET["height"] != "" ? $_GET["height"] : 0; if (@$_GET["width"] == "" && @$_GET["height"] == "") { $width = EW_THUMBNAIL_DEFAULT_WIDTH; $height = EW_THUMBNAIL_DEFAULT_HEIGHT; } // Resize image from physical file if ($fn != "") { $fn = str_replace("", "", $fn); $fn = ew_IncludeTrailingDelimiter(ew_AppRoot(), TRUE) . $fn; if (file_exists($fn) || @fopen($fn, "rb") !== FALSE) { // Allow remote file if (ob_get_length()) { ob_end_clean(); } $pathinfo = pathinfo($fn); $ext = strtolower(@$pathinfo["extension"]); $ct = ew_ContentType("", $fn); if ($ct != "") { header("Content-type: " . $ct); } if (in_array($ext, explode(",", EW_IMAGE_ALLOWED_FILE_EXT))) { $size = @getimagesize($fn); if ($size) { header("Content-type: {$size['mime']}"); } if ($width > 0 || $height > 0) { echo ew_ResizeFileToBinary($fn, $width, $height); } else { echo file_get_contents($fn); } } elseif (in_array($ext, explode(",", EW_DOWNLOAD_ALLOWED_FILE_EXT))) { echo file_get_contents($fn); } } } // Global Page Unloaded event (in userfn*.php) //***Page_Unloaded(); // Close connection //***ew_CloseConn(); }
include_once "ewcfg11.php"; include_once "adodb5/adodb.inc.php"; include_once "phpfn11.php"; // Get resize parameters $resize = @$_GET["resize"] != ""; $width = @$_GET["width"] != "" ? $_GET["width"] : 0; $height = @$_GET["height"] != "" ? $_GET["height"] : 0; if (@$_GET["width"] == "" && @$_GET["height"] == "") { $width = EW_THUMBNAIL_DEFAULT_WIDTH; $height = EW_THUMBNAIL_DEFAULT_HEIGHT; } $quality = @$_GET["quality"] != "" ? $_GET["quality"] : EW_THUMBNAIL_DEFAULT_QUALITY; // Resize image from physical file if (@$_GET["fn"] != "") { $fn = ew_StripSlashes($_GET["fn"]); $fn = str_replace("", "", $fn); $fn = ew_IncludeTrailingDelimiter(ew_AppRoot(), TRUE) . $fn; if (file_exists($fn) || fopen($fn, "rb") !== FALSE) { // Allow remote file $pathinfo = pathinfo($fn); $ext = strtolower(@$pathinfo["extension"]); if (in_array($ext, explode(",", EW_IMAGE_ALLOWED_FILE_EXT))) { $size = @getimagesize($fn); if ($size) { header("Content-type: {$size['mime']}"); } echo ew_ResizeFileToBinary($fn, $width, $height, $quality); } } exit; }
function ew_TmpFile(&$file) { global $gTmpImages; if (file_exists($file)) { // Copy only // $f = tempnam(ew_TmpFolder(), "tmp"); $folder = ew_AppRoot() . EW_UPLOAD_DEST_PATH; $f = tempnam($folder, "tmp"); @unlink($f); $info = pathinfo($file); if ($info["extension"] != "") { $f .= "." . $info["extension"]; } copy($file, $f); $tmpimage = basename($f); $gTmpImages[] = $tmpimage; return EW_UPLOAD_DEST_PATH . $tmpimage; } else { return ""; } }
function ew_DeleteTmpImages() { global $gTmpImages; foreach ($gTmpImages as $tmpimage) { @unlink(ew_AppRoot() . EW_UPLOAD_DEST_PATH . $tmpimage); } }
include_once "ewmysql9.php"; include_once "phpfn9.php"; // Get resize parameters $resize = @$_GET["resize"] != ""; $width = @$_GET["width"] != "" ? $_GET["width"] : 0; $height = @$_GET["height"] != "" ? $_GET["height"] : 0; if (@$_GET["width"] == "" && @$_GET["height"] == "") { $width = EW_THUMBNAIL_DEFAULT_WIDTH; $height = EW_THUMBNAIL_DEFAULT_HEIGHT; } $quality = @$_GET["quality"] != "" ? $_GET["quality"] : EW_THUMBNAIL_DEFAULT_QUALITY; // Resize image from physical file if (@$_GET["fn"] != "") { $fn = ew_StripSlashes($_GET["fn"]); $fn = str_replace("", "", $fn); $fn = ew_PathCombine(ew_AppRoot(), $fn, TRUE); // P7 if (file_exists($fn) || fopen($fn, "rb") !== FALSE) { // Allow remote file $pathinfo = pathinfo($fn); $ext = strtolower($pathinfo['extension']); if (in_array($ext, explode(',', EW_IMAGE_ALLOWED_FILE_EXT))) { $size = getimagesize($fn); if ($size) { header("Content-type: {$size['mime']}"); } echo ew_ResizeFileToBinary($fn, $width, $height, $quality); } } exit; } else {
function ew_TmpFolder() { $tmpfolder = NULL; $folders = array(); if (EW_IS_WINDOWS) { $folders[] = ew_ServerVar("TEMP"); $folders[] = ew_ServerVar("TMP"); } else { if (EW_UPLOAD_TMP_PATH != "") { $folders[] = ew_AppRoot() . str_replace("/", EW_PATH_DELIMITER, EW_UPLOAD_TMP_PATH); } $folders[] = '/tmp'; } if (ini_get('upload_tmp_dir')) { $folders[] = ini_get('upload_tmp_dir'); } foreach ($folders as $folder) { if (!$tmpfolder && is_dir($folder)) { $tmpfolder = $folder; } } //if ($tmpfolder) $tmpfolder = ew_IncludeTrailingDelimiter($tmpfolder, TRUE); return $tmpfolder; }
function ew_UploadPathEx($PhyPath, $DestPath) { if ($PhyPath) { $Path = ew_AppRoot(); $Path .= str_replace("/", EW_PATH_DELIMITER, $DestPath); } else { $Path = EW_ROOT_RELATIVE_PATH; $Path = str_replace("\\\\", "/", $Path); $Path = str_replace("\\", "/", $Path); $Path = ew_IncludeTrailingDelimiter($Path, FALSE) . $DestPath; } return ew_IncludeTrailingDelimiter($Path, $PhyPath); }
function ExportValueBy(&$fld, $col, $row) { $val = ""; if ($fld->FldViewTag == "IMAGE") { // Image $imagefn = $fld->GetTempImage(); if (!$fld->UploadMultiple || strpos($imagefn, ',') === FALSE) { $fn = ew_AppRoot() . $imagefn; if ($imagefn != "" && file_exists($fn) && !is_dir($fn)) { $sheet = $this->phpexcel->getActiveSheet(); $objDrawing = new PHPExcel_Worksheet_Drawing(); $objDrawing->setWorksheet($sheet); $objDrawing->setPath($fn); $size = getimagesize($fn); // Get image size $letter = PHPExcel_Cell::stringFromColumnIndex($col); if ($size[0] > 0) { // Width $sheet->getColumnDimension($letter)->setWidth($size[0] * 0.3); } // Set column width, adjust the multiplying factor if necessary if ($size[1] > 0) { // Height $sheet->getRowDimension($row)->setRowHeight($size[1]); } // Set row height $objDrawing->setCoordinates($letter . strval($row)); } } else { $ar = explode(",", $imagefn); $totalW = 0; $maxH = 0; foreach ($ar as $imagefn) { $fn = ew_AppRoot() . $imagefn; if (!file_exists($fn) || is_dir($fn)) { continue; } $sheet = $this->phpexcel->getActiveSheet(); $objDrawing = new PHPExcel_Worksheet_Drawing(); $objDrawing->setWorksheet($sheet); $objDrawing->setPath($fn); $size = getimagesize($fn); // Get image size $letter = PHPExcel_Cell::stringFromColumnIndex($col); $objDrawing->setOffsetX($totalW); $objDrawing->setCoordinates($letter . strval($row)); if ($size[0] > 0) { // Width $totalW += $size[0]; } if ($size[1] > 0 && $size[1] > $maxH) { // Height $maxH = $size[1]; } } if ($totalW > 0) { // Width $sheet->getColumnDimension($letter)->setWidth($totalW * 0.3); } // Set column width, adjust the multiplying factor if necessary if ($maxH > 0) { // Height $sheet->getRowDimension($row)->setRowHeight($maxH); } // Set row height } } elseif (is_array($fld->HrefValue2)) { // Export custom view tag $ar = $fld->HrefValue2; $fn = is_array($ar) ? @$ar["exportfn"] : ""; // Get export function name if (is_callable($fn)) { $imagefn = $fn($ar); if ($imagefn != "") { $fn = ew_AppRoot() . $imagefn; if ($imagefn != "" && file_exists($fn) && !is_dir($fn)) { $sheet = $this->phpexcel->getActiveSheet(); $objDrawing = new PHPExcel_Worksheet_Drawing(); $objDrawing->setWorksheet($sheet); $objDrawing->setPath($fn); $size = getimagesize($fn); // Get image size $letter = PHPExcel_Cell::stringFromColumnIndex($col); if ($size[0] > 0) { // Width $sheet->getColumnDimension($letter)->setWidth($size[0] * 0.3); } // Set column width, adjust the multiplying factor if necessary if ($size[1] > 0) { // Height $sheet->getRowDimension($row)->setRowHeight($size[1]); } // Set row height $objDrawing->setCoordinates($letter . strval($row)); } } } else { $val = ew_ConvertToUtf8($fld->ExportValue()); $this->SetCellValueByColumnAndRow($col, $row, $val); } } else { // Formatted Text $val = ew_ConvertToUtf8($fld->ExportValue()); if ($this->rowtype > 0) { // Not table header/footer if (in_array($fld->FldType, array(4, 5, 6, 14, 131))) { // If float or currency $val = ew_ConvertToUtf8($fld->CurrentValue); } // Use original value instead of formatted value } $this->SetCellValueByColumnAndRow($col, $row, $val); } }