本文整理汇总了PHP中ew_AppRoot函数的典型用法代码示例。如果您正苦于以下问题:PHP ew_AppRoot函数的具体用法?PHP ew_AppRoot怎么用?PHP ew_AppRoot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ew_AppRoot函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Page_Main
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();
}
示例2: ew_StripSlashes
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;
}
示例3: ew_TmpFile
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 "";
}
}
示例4: ew_DeleteTmpImages
function ew_DeleteTmpImages()
{
global $gTmpImages;
foreach ($gTmpImages as $tmpimage) {
@unlink(ew_AppRoot() . EW_UPLOAD_DEST_PATH . $tmpimage);
}
}
示例5: ew_StripSlashes
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 {
示例6: ew_TmpFolder
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;
}
示例7: ew_UploadPathEx
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);
}
示例8: ExportValueBy
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);
}
//.........这里部分代码省略.........