本文整理汇总了PHP中ew_UploadPathEx函数的典型用法代码示例。如果您正苦于以下问题:PHP ew_UploadPathEx函数的具体用法?PHP ew_UploadPathEx怎么用?PHP ew_UploadPathEx使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ew_UploadPathEx函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: EditRow
function EditRow()
{
global $conn, $Security, $Items;
$sFilter = $Items->KeyFilter();
$Items->CurrentFilter = $sFilter;
$sSql = $Items->SQL();
$conn->raiseErrorFn = 'ew_ErrorFn';
$rs = $conn->Execute($sSql);
$conn->raiseErrorFn = '';
if ($rs === FALSE) {
return FALSE;
}
if ($rs->EOF) {
$EditRow = FALSE;
// Update Failed
} else {
// Save old values
$rsold =& $rs->fields;
$rsnew = array();
// Field ItemID
// Field MenuID
$Items->MenuID->SetDbValueDef($Items->MenuID->CurrentValue, 0);
$rsnew['MenuID'] =& $Items->MenuID->DbValue;
// Field ItemName
$Items->ItemName->SetDbValueDef($Items->ItemName->CurrentValue, "");
$rsnew['ItemName'] =& $Items->ItemName->DbValue;
// Field Description
$Items->Description->SetDbValueDef($Items->Description->CurrentValue, "");
$rsnew['Description'] =& $Items->Description->DbValue;
// Field Price
$Items->Price->SetDbValueDef($Items->Price->CurrentValue, NULL);
$rsnew['Price'] =& $Items->Price->DbValue;
// Field Image
$Items->Image->Upload->SaveToSession();
// Save file value to Session
if ($Items->Image->Upload->Action == "2" || $Items->Image->Upload->Action == "3") {
// Update/Remove
$Items->Image->Upload->DbValue = $rs->fields('Image');
// Get original value
if (is_null($Items->Image->Upload->Value)) {
$rsnew['Image'] = NULL;
} else {
$rsnew['Image'] = ew_UploadFileNameEx(ew_UploadPathEx(True, "../images/items/"), $Items->Image->Upload->FileName);
}
}
// Field Vegetarian
$Items->Vegetarian->SetDbValueDef($Items->Vegetarian->CurrentValue, "");
$rsnew['Vegetarian'] =& $Items->Vegetarian->DbValue;
// Field Vegetarian_Price
$Items->Vegetarian_Price->SetDbValueDef($Items->Vegetarian_Price->CurrentValue, NULL);
$rsnew['Vegetarian_Price'] =& $Items->Vegetarian_Price->DbValue;
// Field Color
$Items->Color->SetDbValueDef($Items->Color->CurrentValue, NULL);
$rsnew['Color'] =& $Items->Color->DbValue;
// Field Sequence
$Items->Sequence->SetDbValueDef($Items->Sequence->CurrentValue, 0);
$rsnew['Sequence'] =& $Items->Sequence->DbValue;
// Field PDF
$Items->PDF->Upload->SaveToSession();
// Save file value to Session
if ($Items->PDF->Upload->Action == "2" || $Items->PDF->Upload->Action == "3") {
// Update/Remove
$Items->PDF->Upload->DbValue = $rs->fields('PDF');
// Get original value
if (is_null($Items->PDF->Upload->Value)) {
$rsnew['PDF'] = NULL;
} else {
$rsnew['PDF'] = ew_UploadFileNameEx(ew_UploadPathEx(True, "../recipes/"), $Items->PDF->Upload->FileName);
}
}
// Field Active
$Items->Active->SetDbValueDef($Items->Active->CurrentValue, "");
$rsnew['Active'] =& $Items->Active->DbValue;
// Call Row Updating event
$bUpdateRow = $Items->Row_Updating($rsold, $rsnew);
if ($bUpdateRow) {
// Field Image
if (!is_null($Items->Image->Upload->Value)) {
$Items->Image->Upload->SaveToFile("../images/items/", $rsnew['Image'], FALSE);
}
// Field PDF
if (!is_null($Items->PDF->Upload->Value)) {
$Items->PDF->Upload->SaveToFile("../recipes/", $rsnew['PDF'], FALSE);
}
$conn->raiseErrorFn = 'ew_ErrorFn';
$EditRow = $conn->Execute($Items->UpdateSQL($rsnew));
$conn->raiseErrorFn = '';
} else {
if ($Items->CancelMessage != "") {
$this->setMessage($Items->CancelMessage);
$Items->CancelMessage = "";
} else {
$this->setMessage("Update cancelled");
}
$EditRow = FALSE;
}
}
// Call Row_Updated event
if ($EditRow) {
$Items->Row_Updated($rsold, $rsnew);
//.........这里部分代码省略.........
示例2: EditRow
function EditRow()
{
global $conn, $Security, $Language;
$sFilter = $this->KeyFilter();
$this->CurrentFilter = $sFilter;
$sSql = $this->SQL();
$conn->raiseErrorFn = 'ew_ErrorFn';
$rs = $conn->Execute($sSql);
$conn->raiseErrorFn = '';
if ($rs === FALSE) {
return FALSE;
}
if ($rs->EOF) {
$EditRow = FALSE;
// Update Failed
} else {
// Begin transaction
if ($this->getCurrentDetailTable() != "") {
$conn->BeginTrans();
}
// Save old values
$rsold =& $rs->fields;
$this->LoadDbValues($rsold);
$rsnew = array();
// Titulo
$this->Titulo->SetDbValueDef($rsnew, $this->Titulo->CurrentValue, NULL, $this->Titulo->ReadOnly);
// Descripcion
$this->Descripcion->SetDbValueDef($rsnew, $this->Descripcion->CurrentValue, NULL, $this->Descripcion->ReadOnly);
// archivo
if (!$this->archivo->ReadOnly && !$this->archivo->Upload->KeepFile) {
$this->archivo->Upload->DbValue = $rsold['archivo'];
// Get original value
if ($this->archivo->Upload->FileName == "") {
$rsnew['archivo'] = NULL;
} else {
$rsnew['archivo'] = $this->archivo->Upload->FileName;
}
}
// estado
$this->estado->SetDbValueDef($rsnew, $this->estado->CurrentValue, NULL, $this->estado->ReadOnly);
if (!$this->archivo->Upload->KeepFile) {
$OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->DbValue);
if (!ew_Empty($this->archivo->Upload->FileName)) {
$NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->FileName);
$FileCount = count($NewFiles);
for ($i = 0; $i < $FileCount; $i++) {
$fldvar = $this->archivo->Upload->Index < 0 ? $this->archivo->FldVar : substr($this->archivo->FldVar, 0, 1) . $this->archivo->Upload->Index . substr($this->archivo->FldVar, 1);
if ($NewFiles[$i] != "") {
$file = $NewFiles[$i];
if (file_exists(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file)) {
if (!in_array($file, $OldFiles)) {
$file1 = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->archivo->UploadPath), $file);
// Get new file name
if ($file1 != $file) {
// Rename temp file
while (file_exists(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file1)) {
// Make sure did not clash with existing upload file
$file1 = ew_UniqueFilename(ew_UploadPathEx(TRUE, $this->archivo->UploadPath), $file1, TRUE);
}
// Use indexed name
rename(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file, ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file1);
$NewFiles[$i] = $file1;
}
}
}
}
}
$this->archivo->Upload->FileName = implode(EW_MULTIPLE_UPLOAD_SEPARATOR, $NewFiles);
$rsnew['archivo'] = $this->archivo->Upload->FileName;
} else {
$NewFiles = array();
}
}
// Call Row Updating event
$bUpdateRow = $this->Row_Updating($rsold, $rsnew);
if ($bUpdateRow) {
$conn->raiseErrorFn = 'ew_ErrorFn';
if (count($rsnew) > 0) {
$EditRow = $this->Update($rsnew, "", $rsold);
} else {
$EditRow = TRUE;
}
// No field to update
$conn->raiseErrorFn = '';
if ($EditRow) {
if (!$this->archivo->Upload->KeepFile) {
$OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->DbValue);
if (!ew_Empty($this->archivo->Upload->FileName)) {
$NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->FileName);
$NewFiles2 = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $rsnew['archivo']);
$FileCount = count($NewFiles);
for ($i = 0; $i < $FileCount; $i++) {
$fldvar = $this->archivo->Upload->Index < 0 ? $this->archivo->FldVar : substr($this->archivo->FldVar, 0, 1) . $this->archivo->Upload->Index . substr($this->archivo->FldVar, 1);
if ($NewFiles[$i] != "") {
$file = ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $NewFiles[$i];
if (file_exists($file)) {
$this->archivo->Upload->SaveToFile($this->archivo->UploadPath, @$NewFiles2[$i] != "" ? $NewFiles2[$i] : $NewFiles[$i], TRUE, $i);
// Just replace
}
}
//.........这里部分代码省略.........
示例3: elseif
" border=0<?php
echo $Items->Image->ViewAttributes();
?>
>
<?php
} elseif (!in_array($Items->CurrentAction, array("I", "edit", "gridedit"))) {
?>
<?php
}
} else {
if (!is_null($Items->Image->Upload->DbValue)) {
?>
<img src="<?php
echo ew_UploadPathEx(FALSE, "../images/items/") . $Items->Image->Upload->DbValue;
?>
" border=0<?php
echo $Items->Image->ViewAttributes();
?>
>
<?php
} elseif (!in_array($Items->CurrentAction, array("I", "edit", "gridedit"))) {
?>
<?php
}
}
?>
</td>
示例4: SaveToFile
function SaveToFile($Path, $NewFileName, $OverWrite)
{
if (!ew_Empty($this->Value)) {
$Path = ew_UploadPathEx(TRUE, $Path);
if (trim(strval($NewFileName)) == "") {
$NewFileName = $this->FileName;
}
if ($OverWrite) {
return ew_SaveFile($Path, $NewFileName, $this->Value);
} else {
return ew_SaveFile($Path, ew_UploadFileNameEx($Path, $NewFileName), $this->Value);
}
}
return FALSE;
}
示例5: RenderRow
//.........这里部分代码省略.........
}
$Items->Image->CssStyle = "";
$Items->Image->CssClass = "";
$Items->Image->ViewCustomAttributes = "";
// Vegetarian
if (strval($Items->Vegetarian->CurrentValue) != "") {
switch ($Items->Vegetarian->CurrentValue) {
case "0":
$Items->Vegetarian->ViewValue = "No";
break;
case "1":
$Items->Vegetarian->ViewValue = "Yes";
break;
default:
$Items->Vegetarian->ViewValue = $Items->Vegetarian->CurrentValue;
}
} else {
$Items->Vegetarian->ViewValue = NULL;
}
$Items->Vegetarian->CssStyle = "";
$Items->Vegetarian->CssClass = "";
$Items->Vegetarian->ViewCustomAttributes = "";
// Vegetarian_Price
$Items->Vegetarian_Price->ViewValue = $Items->Vegetarian_Price->CurrentValue;
$Items->Vegetarian_Price->ViewValue = ew_FormatCurrency($Items->Vegetarian_Price->ViewValue, 2, -2, 0, -2);
$Items->Vegetarian_Price->CssStyle = "";
$Items->Vegetarian_Price->CssClass = "";
$Items->Vegetarian_Price->ViewCustomAttributes = "";
// Color
$Items->Color->ViewValue = $Items->Color->CurrentValue;
$Items->Color->CssStyle = "";
$Items->Color->CssClass = "";
$Items->Color->ViewCustomAttributes = "";
// Sequence
$Items->Sequence->ViewValue = $Items->Sequence->CurrentValue;
$Items->Sequence->CssStyle = "";
$Items->Sequence->CssClass = "";
$Items->Sequence->ViewCustomAttributes = "";
// PDF
if (!is_null($Items->PDF->Upload->DbValue)) {
$Items->PDF->ViewValue = $Items->PDF->Upload->DbValue;
} else {
$Items->PDF->ViewValue = "";
}
$Items->PDF->CssStyle = "";
$Items->PDF->CssClass = "";
$Items->PDF->ViewCustomAttributes = "";
// Active
if (strval($Items->Active->CurrentValue) != "") {
switch ($Items->Active->CurrentValue) {
case "0":
$Items->Active->ViewValue = "No";
break;
case "1":
$Items->Active->ViewValue = "Yes";
break;
default:
$Items->Active->ViewValue = $Items->Active->CurrentValue;
}
} else {
$Items->Active->ViewValue = NULL;
}
$Items->Active->CssStyle = "";
$Items->Active->CssClass = "";
$Items->Active->ViewCustomAttributes = "";
// ItemID
$Items->ItemID->HrefValue = "";
// MenuID
$Items->MenuID->HrefValue = "";
// ItemName
$Items->ItemName->HrefValue = "";
// Description
$Items->Description->HrefValue = "";
// Price
$Items->Price->HrefValue = "";
// Image
$Items->Image->HrefValue = "";
// Vegetarian
$Items->Vegetarian->HrefValue = "";
// Vegetarian_Price
$Items->Vegetarian_Price->HrefValue = "";
// Color
$Items->Color->HrefValue = "";
// Sequence
$Items->Sequence->HrefValue = "";
// PDF
if (!is_null($Items->PDF->Upload->DbValue)) {
$Items->PDF->HrefValue = ew_UploadPathEx(FALSE, "../recipes/") . (!empty($Items->PDF->ViewValue) ? $Items->PDF->ViewValue : $Items->PDF->CurrentValue);
if ($Items->Export != "") {
$Items->PDF->HrefValue = ew_ConvertFullUrl($Items->PDF->HrefValue);
}
} else {
$Items->PDF->HrefValue = "";
}
// Active
$Items->Active->HrefValue = "";
}
// Call Row Rendered event
$Items->Row_Rendered();
}
示例6: cUpload
}
// Get session
$obj = new cUpload($tbl, $fld);
$obj->Index = $idx;
if ($restoreDb) {
$obj->RestoreDbFromSession();
$obj->Value = $obj->DbValue;
} else {
$obj->RestoreFromSession();
}
if (is_null($obj->Value)) {
exit;
}
// Restore db file
if ($restoreDbFile) {
$fn = ew_UploadPathEx(TRUE, @$_GET["path"]) . $obj->Value;
if (file_exists($fn)) {
$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);
}
}
} else {
// If not IE, get the content type
if (strpos(ew_ServerVar("HTTP_USER_AGENT"), "MSIE") === FALSE) {
$tmpfname = tempnam(ew_TmpFolder(), 'tmp');
示例7: SaveToFile
function SaveToFile($Path, $NewFileName, $OverWrite, $idx = -1)
{
if (!ew_Empty($this->Value)) {
$Path = ew_UploadPathEx(TRUE, $Path);
if (trim(strval($NewFileName)) == "") {
$NewFileName = $this->FileName;
}
if (!$OverWrite) {
$NewFileName = ew_UploadFileNameEx($Path, $NewFileName);
}
return ew_SaveFile($Path, $NewFileName, $this->Value);
} elseif ($idx >= 0) {
// Use file from upload temp folder
$file = $this->GetTempFile($idx);
if (file_exists($file)) {
if (!$OverWrite) {
$NewFileName = ew_UploadFileNameEx($Path, $NewFileName);
}
return ew_CopyFile($Path, $NewFileName, $file);
}
}
return FALSE;
}
示例8: EditRow
function EditRow()
{
global $Security, $Language;
$sFilter = $this->KeyFilter();
$sFilter = $this->ApplyUserIDFilters($sFilter);
$conn =& $this->Connection();
$this->CurrentFilter = $sFilter;
$sSql = $this->SQL();
$conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
$rs = $conn->Execute($sSql);
$conn->raiseErrorFn = '';
if ($rs === FALSE) {
return FALSE;
}
if ($rs->EOF) {
$this->setFailureMessage($Language->Phrase("NoRecord"));
// Set no record message
$EditRow = FALSE;
// Update Failed
} else {
// Save old values
$rsold =& $rs->fields;
$this->LoadDbValues($rsold);
$this->s_image->OldUploadPath = "/uploads/";
$this->s_image->UploadPath = $this->s_image->OldUploadPath;
$this->s_images->OldUploadPath = "/uploads/";
$this->s_images->UploadPath = $this->s_images->OldUploadPath;
$rsnew = array();
// s_title
$this->s_title->SetDbValueDef($rsnew, $this->s_title->CurrentValue, "", $this->s_title->ReadOnly);
// s_image
if (!$this->s_image->ReadOnly && !$this->s_image->Upload->KeepFile) {
$this->s_image->Upload->DbValue = $rsold['s_image'];
// Get original value
if ($this->s_image->Upload->FileName == "") {
$rsnew['s_image'] = NULL;
} else {
$rsnew['s_image'] = $this->s_image->Upload->FileName;
}
}
// s_desc
$this->s_desc->SetDbValueDef($rsnew, $this->s_desc->CurrentValue, "", $this->s_desc->ReadOnly);
// s_longdesc
$this->s_longdesc->SetDbValueDef($rsnew, $this->s_longdesc->CurrentValue, "", $this->s_longdesc->ReadOnly);
// s_images
if (!$this->s_images->ReadOnly && !$this->s_images->Upload->KeepFile) {
$this->s_images->Upload->DbValue = $rsold['s_images'];
// Get original value
if ($this->s_images->Upload->FileName == "") {
$rsnew['s_images'] = NULL;
} else {
$rsnew['s_images'] = $this->s_images->Upload->FileName;
}
}
// s_caption
$this->s_caption->SetDbValueDef($rsnew, $this->s_caption->CurrentValue, "", $this->s_caption->ReadOnly);
if (!$this->s_image->Upload->KeepFile) {
$this->s_image->UploadPath = "/uploads/";
if (!ew_Empty($this->s_image->Upload->Value)) {
$rsnew['s_image'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->s_image->UploadPath), $rsnew['s_image']);
// Get new file name
}
}
if (!$this->s_images->Upload->KeepFile) {
$this->s_images->UploadPath = "/uploads/";
$OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->s_images->Upload->DbValue);
if (!ew_Empty($this->s_images->Upload->FileName)) {
$NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->s_images->Upload->FileName);
$FileCount = count($NewFiles);
for ($i = 0; $i < $FileCount; $i++) {
$fldvar = $this->s_images->Upload->Index < 0 ? $this->s_images->FldVar : substr($this->s_images->FldVar, 0, 1) . $this->s_images->Upload->Index . substr($this->s_images->FldVar, 1);
if ($NewFiles[$i] != "") {
$file = $NewFiles[$i];
if (file_exists(ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $file)) {
if (!in_array($file, $OldFiles)) {
$file1 = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->s_images->UploadPath), $file);
// Get new file name
if ($file1 != $file) {
// Rename temp file
while (file_exists(ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $file1)) {
// Make sure did not clash with existing upload file
$file1 = ew_UniqueFilename(ew_UploadPathEx(TRUE, $this->s_images->UploadPath), $file1, TRUE);
}
// Use indexed name
rename(ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $file, ew_UploadTempPath($fldvar, $this->s_images->TblVar) . EW_PATH_DELIMITER . $file1);
$NewFiles[$i] = $file1;
}
}
}
}
}
$this->s_images->Upload->FileName = implode(EW_MULTIPLE_UPLOAD_SEPARATOR, $NewFiles);
$rsnew['s_images'] = $this->s_images->Upload->FileName;
} else {
$NewFiles = array();
}
}
// Call Row Updating event
$bUpdateRow = $this->Row_Updating($rsold, $rsnew);
if ($bUpdateRow) {
//.........这里部分代码省略.........
示例9: EditRow
function EditRow()
{
global $Security, $Language;
$sFilter = $this->KeyFilter();
$sFilter = $this->ApplyUserIDFilters($sFilter);
$conn =& $this->Connection();
$this->CurrentFilter = $sFilter;
$sSql = $this->SQL();
$conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
$rs = $conn->Execute($sSql);
$conn->raiseErrorFn = '';
if ($rs === FALSE) {
return FALSE;
}
if ($rs->EOF) {
$this->setFailureMessage($Language->Phrase("NoRecord"));
// Set no record message
$EditRow = FALSE;
// Update Failed
} else {
// Save old values
$rsold =& $rs->fields;
$this->LoadDbValues($rsold);
$this->vl_media_file_custom->OldUploadPath = "uploads_custom/";
$this->vl_media_file_custom->UploadPath = $this->vl_media_file_custom->OldUploadPath;
$rsnew = array();
// vl_media_type
$this->vl_media_type->SetDbValueDef($rsnew, $this->vl_media_type->CurrentValue, NULL, $this->vl_media_type->ReadOnly);
// vl_media_name
$this->vl_media_name->SetDbValueDef($rsnew, $this->vl_media_name->CurrentValue, NULL, $this->vl_media_name->ReadOnly);
// vl_media_file
if ($this->vl_media_file->Visible && !$this->vl_media_file->ReadOnly && !$this->vl_media_file->Upload->KeepFile) {
$this->vl_media_file->Upload->DbValue = $rsold['vl_media_file'];
// Get original value
if ($this->vl_media_file->Upload->FileName == "") {
$rsnew['vl_media_file'] = NULL;
} else {
$rsnew['vl_media_file'] = $this->vl_media_file->Upload->FileName;
}
}
// vl_media_file_custom
if ($this->vl_media_file_custom->Visible && !$this->vl_media_file_custom->ReadOnly && !$this->vl_media_file_custom->Upload->KeepFile) {
$this->vl_media_file_custom->Upload->DbValue = $rsold['vl_media_file_custom'];
// Get original value
if ($this->vl_media_file_custom->Upload->FileName == "") {
$rsnew['vl_media_file_custom'] = NULL;
} else {
$rsnew['vl_media_file_custom'] = $this->vl_media_file_custom->Upload->FileName;
}
}
if ($this->vl_media_file->Visible && !$this->vl_media_file->Upload->KeepFile) {
if (!ew_Empty($this->vl_media_file->Upload->Value)) {
$rsnew['vl_media_file'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->vl_media_file->UploadPath), $rsnew['vl_media_file']);
// Get new file name
}
}
if ($this->vl_media_file_custom->Visible && !$this->vl_media_file_custom->Upload->KeepFile) {
$this->vl_media_file_custom->UploadPath = "uploads_custom/";
if (!ew_Empty($this->vl_media_file_custom->Upload->Value)) {
$rsnew['vl_media_file_custom'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->vl_media_file_custom->UploadPath), $rsnew['vl_media_file_custom']);
// Get new file name
}
}
// Call Row Updating event
$bUpdateRow = $this->Row_Updating($rsold, $rsnew);
if ($bUpdateRow) {
$conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
if (count($rsnew) > 0) {
$EditRow = $this->Update($rsnew, "", $rsold);
} else {
$EditRow = TRUE;
}
// No field to update
$conn->raiseErrorFn = '';
if ($EditRow) {
if ($this->vl_media_file->Visible && !$this->vl_media_file->Upload->KeepFile) {
if (!ew_Empty($this->vl_media_file->Upload->Value)) {
$this->vl_media_file->Upload->SaveToFile($this->vl_media_file->UploadPath, $rsnew['vl_media_file'], TRUE);
}
}
if ($this->vl_media_file_custom->Visible && !$this->vl_media_file_custom->Upload->KeepFile) {
if (!ew_Empty($this->vl_media_file_custom->Upload->Value)) {
$this->vl_media_file_custom->Upload->SaveToFile($this->vl_media_file_custom->UploadPath, $rsnew['vl_media_file_custom'], TRUE);
}
}
}
} else {
if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
// Use the message, do nothing
} elseif ($this->CancelMessage != "") {
$this->setFailureMessage($this->CancelMessage);
$this->CancelMessage = "";
} else {
$this->setFailureMessage($Language->Phrase("UpdateCancelled"));
}
$EditRow = FALSE;
}
}
// Call Row_Updated event
if ($EditRow) {
//.........这里部分代码省略.........
示例10: EditRow
function EditRow()
{
global $conn, $Security, $Language;
$sFilter = $this->KeyFilter();
$this->CurrentFilter = $sFilter;
$sSql = $this->SQL();
$conn->raiseErrorFn = 'ew_ErrorFn';
$rs = $conn->Execute($sSql);
$conn->raiseErrorFn = '';
if ($rs === FALSE) {
return FALSE;
}
if ($rs->EOF) {
$EditRow = FALSE;
// Update Failed
} else {
// Save old values
$rsold =& $rs->fields;
$this->LoadDbValues($rsold);
$this->g_image->OldUploadPath = "/gallery";
$this->g_image->UploadPath = $this->g_image->OldUploadPath;
$this->gd_images->OldUploadPath = "/gallery";
$this->gd_images->UploadPath = $this->gd_images->OldUploadPath;
$rsnew = array();
// g_name
$this->g_name->SetDbValueDef($rsnew, $this->g_name->CurrentValue, "", $this->g_name->ReadOnly);
// g_image
if (!$this->g_image->ReadOnly && !$this->g_image->Upload->KeepFile) {
$this->g_image->Upload->DbValue = $rs->fields('g_image');
// Get original value
if ($this->g_image->Upload->FileName == "") {
$rsnew['g_image'] = NULL;
} else {
$rsnew['g_image'] = $this->g_image->Upload->FileName;
}
}
// gd_images
if (!$this->gd_images->ReadOnly && !$this->gd_images->Upload->KeepFile) {
$this->gd_images->Upload->DbValue = $rs->fields('gd_images');
// Get original value
if ($this->gd_images->Upload->FileName == "") {
$rsnew['gd_images'] = NULL;
} else {
$rsnew['gd_images'] = $this->gd_images->Upload->FileName;
}
}
if (!$this->g_image->Upload->KeepFile) {
$this->g_image->UploadPath = "/gallery";
if (!ew_Empty($this->g_image->Upload->Value)) {
$rsnew['g_image'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->g_image->UploadPath), $rsnew['g_image']);
// Get new file name
}
}
if (!$this->gd_images->Upload->KeepFile) {
$this->gd_images->UploadPath = "/gallery";
$OldFiles = explode(",", $this->gd_images->Upload->DbValue);
if (!ew_Empty($this->gd_images->Upload->FileName)) {
$NewFiles = explode(",", $this->gd_images->Upload->FileName);
$FileCount = count($NewFiles);
for ($i = 0; $i < $FileCount; $i++) {
$fldvar = $this->gd_images->Upload->Index < 0 ? $this->gd_images->FldVar : substr($this->gd_images->FldVar, 0, 1) . $this->gd_images->Upload->Index . substr($this->gd_images->FldVar, 1);
if ($NewFiles[$i] != "") {
$file = ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $NewFiles[$i];
if (file_exists($file)) {
if (!in_array($NewFiles[$i], $OldFiles)) {
$NewFiles[$i] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->gd_images->UploadPath), $NewFiles[$i]);
// Get new file name
$file1 = ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $NewFiles[$i];
if ($file1 != $file) {
// Rename temp file
rename($file, $file1);
}
}
}
}
}
$this->gd_images->Upload->FileName = implode(",", $NewFiles);
$rsnew['gd_images'] = $this->gd_images->Upload->FileName;
} else {
$NewFiles = array();
}
}
// Call Row Updating event
$bUpdateRow = $this->Row_Updating($rsold, $rsnew);
if ($bUpdateRow) {
$conn->raiseErrorFn = 'ew_ErrorFn';
if (count($rsnew) > 0) {
$EditRow = $this->Update($rsnew, "", $rsold);
} else {
$EditRow = TRUE;
}
// No field to update
$conn->raiseErrorFn = '';
if ($EditRow) {
if (!$this->g_image->Upload->KeepFile) {
if (!ew_Empty($this->g_image->Upload->Value)) {
$this->g_image->Upload->SaveToFile($this->g_image->UploadPath, $rsnew['g_image'], TRUE);
}
}
if (!$this->gd_images->Upload->KeepFile) {
//.........这里部分代码省略.........
示例11: EditRow
function EditRow()
{
global $Security, $Language;
$sFilter = $this->KeyFilter();
$conn =& $this->Connection();
$this->CurrentFilter = $sFilter;
$sSql = $this->SQL();
$conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
$rs = $conn->Execute($sSql);
$conn->raiseErrorFn = '';
if ($rs === FALSE) {
return FALSE;
}
if ($rs->EOF) {
$EditRow = FALSE;
// Update Failed
} else {
// Begin transaction
if ($this->getCurrentDetailTable() != "") {
$conn->BeginTrans();
}
// Save old values
$rsold =& $rs->fields;
$this->LoadDbValues($rsold);
$this->images->OldUploadPath = "/uploads";
$this->images->UploadPath = $this->images->OldUploadPath;
$rsnew = array();
// title
$this->title->SetDbValueDef($rsnew, $this->title->CurrentValue, "", $this->title->ReadOnly);
// images
if (!$this->images->ReadOnly && !$this->images->Upload->KeepFile) {
$this->images->Upload->DbValue = $rsold['images'];
// Get original value
if ($this->images->Upload->FileName == "") {
$rsnew['images'] = NULL;
} else {
$rsnew['images'] = $this->images->Upload->FileName;
}
}
// intro
$this->intro->SetDbValueDef($rsnew, $this->intro->CurrentValue, "", $this->intro->ReadOnly);
// full_intro
$this->full_intro->SetDbValueDef($rsnew, $this->full_intro->CurrentValue, "", $this->full_intro->ReadOnly);
// details
$this->details->SetDbValueDef($rsnew, $this->details->CurrentValue, "", $this->details->ReadOnly);
// livelink
$this->livelink->SetDbValueDef($rsnew, $this->livelink->CurrentValue, NULL, $this->livelink->ReadOnly);
if (!$this->images->Upload->KeepFile) {
$this->images->UploadPath = "/uploads";
if (!ew_Empty($this->images->Upload->Value)) {
$rsnew['images'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->images->UploadPath), $rsnew['images']);
// Get new file name
}
}
// Call Row Updating event
$bUpdateRow = $this->Row_Updating($rsold, $rsnew);
if ($bUpdateRow) {
$conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
if (count($rsnew) > 0) {
$EditRow = $this->Update($rsnew, "", $rsold);
} else {
$EditRow = TRUE;
}
// No field to update
$conn->raiseErrorFn = '';
if ($EditRow) {
if (!$this->images->Upload->KeepFile) {
if (!ew_Empty($this->images->Upload->Value)) {
$this->images->Upload->SaveToFile($this->images->UploadPath, $rsnew['images'], TRUE);
}
}
}
// Update detail records
if ($EditRow) {
$DetailTblVar = explode(",", $this->getCurrentDetailTable());
if (in_array("images", $DetailTblVar) && $GLOBALS["images"]->DetailEdit) {
if (!isset($GLOBALS["images_grid"])) {
$GLOBALS["images_grid"] = new cimages_grid();
}
// Get detail page object
$EditRow = $GLOBALS["images_grid"]->GridUpdate();
}
}
// Commit/Rollback transaction
if ($this->getCurrentDetailTable() != "") {
if ($EditRow) {
$conn->CommitTrans();
// Commit transaction
} else {
$conn->RollbackTrans();
// Rollback transaction
}
}
} else {
if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
// Use the message, do nothing
} elseif ($this->CancelMessage != "") {
$this->setFailureMessage($this->CancelMessage);
$this->CancelMessage = "";
} else {
//.........这里部分代码省略.........
示例12: Page_Main
function Page_Main()
{
global $conn, $uploadid, $uploadtable;
$GLOBALS["Page"] =& $this;
$Language = new cLanguage();
//**$conn = ew_Connect();
// Global Page Loading event (in userfn*.php)
//**Page_Loading();
// Set up upload parameters
$uploadid = @$_GET["id"] != "" ? $_GET["id"] : (@$_POST["id"] != "" ? $_POST["id"] : "");
$uploadtable = @$_GET["table"] != "" ? $_GET["table"] : (@$_POST["table"] != "" ? $_POST["table"] : "");
$exts = @$_POST["exts"] != "" ? $_POST["exts"] : "";
$filetypes = $exts == "" ? '/.+$/i' : '/\\.(' . str_replace(",", "|", $exts) . ')$/i';
$maxsize = @$_POST["maxsize"] != "" ? intval($_POST["maxsize"]) : NULL;
$maxfilecount = @$_POST["maxfilecount"] != "" && @$_POST["maxfilecount"] != "0" ? intval($_POST["maxfilecount"]) : NULL;
$url = ew_FullUrl() . "?rnd=" . ew_Random() . ($uploadid != "" ? "&id=" . $uploadid : "") . ($uploadtable != "" ? "&table=" . $uploadtable : "");
// Add id/table for display and delete
$options = array("param_name" => $uploadid, "delete_type" => "POST", "user_dirs" => TRUE, "download_via_php" => TRUE, "script_url" => $url, "upload_dir" => EW_UPLOAD_TEMP_PATH ? ew_IncludeTrailingDelimiter(EW_UPLOAD_TEMP_PATH, TRUE) : ew_UploadPathEx(TRUE, EW_UPLOAD_DEST_PATH), "upload_url" => ew_UploadPathEx(FALSE, EW_UPLOAD_DEST_PATH), "max_file_size" => $maxsize, "max_number_of_files" => $maxfilecount, "accept_file_types" => $filetypes, "image_versions" => array(EW_UPLOAD_THUMBNAIL_FOLDER => array("max_width" => EW_UPLOAD_THUMBNAIL_WIDTH, "max_height" => EW_UPLOAD_THUMBNAIL_HEIGHT, "jpeg_quality" => EW_THUMBNAIL_DEFAULT_QUALITY, "png_quality" => 9)));
$error_messages = array(1 => $Language->Phrase("UploadErrMsg1"), 2 => $Language->Phrase("UploadErrMsg2"), 3 => $Language->Phrase("UploadErrMsg3"), 4 => $Language->Phrase("UploadErrMsg4"), 6 => $Language->Phrase("UploadErrMsg6"), 7 => $Language->Phrase("UploadErrMsg7"), 8 => $Language->Phrase("UploadErrMsg8"), 'post_max_size' => $Language->Phrase("UploadErrMsgPostMaxSize"), 'max_file_size' => $Language->Phrase("UploadErrMsgMaxFileSize"), 'min_file_size' => $Language->Phrase("UploadErrMsgMinFileSize"), 'accept_file_types' => $Language->Phrase("UploadErrMsgAcceptFileTypes"), 'max_number_of_files' => $Language->Phrase("UploadErrMsgMaxNumberOfFiles"), 'max_width' => $Language->Phrase("UploadErrMsgMaxWidth"), 'min_width' => $Language->Phrase("UploadErrMsgMinWidth"), 'max_height' => $Language->Phrase("UploadErrMsgMaxHeight"), 'min_height' => $Language->Phrase("UploadErrMsgMinHeight"));
ob_end_clean();
$upload_handler = new cUploadHandler($options, TRUE, $error_messages);
// Global Page Unloaded event (in userfn*.php)
//**Page_Unloaded();
// Close connection
//**ew_CloseConn();
}
示例13: AddRow
function AddRow($rsold = NULL)
{
global $conn, $Language, $Security;
// Load db values from rsold
if ($rsold) {
$this->LoadDbValues($rsold);
$this->cat_file->OldUploadPath = "/catalogues/";
$this->cat_file->UploadPath = $this->cat_file->OldUploadPath;
}
$rsnew = array();
// cat_name
$this->cat_name->SetDbValueDef($rsnew, $this->cat_name->CurrentValue, "", FALSE);
// cat_file
if (!$this->cat_file->Upload->KeepFile) {
if ($this->cat_file->Upload->FileName == "") {
$rsnew['cat_file'] = NULL;
} else {
$rsnew['cat_file'] = $this->cat_file->Upload->FileName;
}
$this->cat_file->ImageWidth = EW_THUMBNAIL_DEFAULT_WIDTH;
// Resize width
$this->cat_file->ImageHeight = EW_THUMBNAIL_DEFAULT_HEIGHT;
// Resize height
}
// cat_date
$this->cat_date->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->cat_date->CurrentValue, 5), ew_CurrentDate(), FALSE);
if (!$this->cat_file->Upload->KeepFile) {
$this->cat_file->UploadPath = "/catalogues/";
if (!ew_Empty($this->cat_file->Upload->Value)) {
$rsnew['cat_file'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->cat_file->UploadPath), $rsnew['cat_file']);
// Get new file name
}
}
// Call Row Inserting event
$rs = $rsold == NULL ? NULL : $rsold->fields;
$bInsertRow = $this->Row_Inserting($rs, $rsnew);
if ($bInsertRow) {
$conn->raiseErrorFn = 'ew_ErrorFn';
$AddRow = $this->Insert($rsnew);
$conn->raiseErrorFn = '';
if ($AddRow) {
if (!$this->cat_file->Upload->KeepFile) {
if (!ew_Empty($this->cat_file->Upload->Value)) {
$this->cat_file->Upload->Resize($this->cat_file->ImageWidth, $this->cat_file->ImageHeight, EW_THUMBNAIL_DEFAULT_QUALITY);
$this->cat_file->Upload->SaveToFile($this->cat_file->UploadPath, $rsnew['cat_file'], TRUE);
}
}
}
} else {
if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
// Use the message, do nothing
} elseif ($this->CancelMessage != "") {
$this->setFailureMessage($this->CancelMessage);
$this->CancelMessage = "";
} else {
$this->setFailureMessage($Language->Phrase("InsertCancelled"));
}
$AddRow = FALSE;
}
// Get insert id if necessary
if ($AddRow) {
$this->cat_id->setDbValue($conn->Insert_ID());
$rsnew['cat_id'] = $this->cat_id->DbValue;
}
if ($AddRow) {
// Call Row Inserted event
$rs = $rsold == NULL ? NULL : $rsold->fields;
$this->Row_Inserted($rs, $rsnew);
}
// cat_file
ew_CleanUploadTempPath($this->cat_file, $this->cat_file->Upload->Index);
return $AddRow;
}
示例14: RenderListRow
function RenderListRow()
{
global $conn, $Security;
// Call Row Rendering event
$this->Row_Rendering();
// Common render codes
// cat_id
$this->cat_id->CellCssStyle = "white-space: nowrap;";
// cat_name
// cat_file
// cat_date
// cat_id
$this->cat_id->ViewValue = $this->cat_id->CurrentValue;
$this->cat_id->ViewCustomAttributes = "";
// cat_name
$this->cat_name->ViewValue = $this->cat_name->CurrentValue;
$this->cat_name->ViewCustomAttributes = "";
// cat_file
$this->cat_file->UploadPath = "/catalogues/";
if (!ew_Empty($this->cat_file->Upload->DbValue)) {
$this->cat_file->ViewValue = $this->cat_file->Upload->DbValue;
} else {
$this->cat_file->ViewValue = "";
}
$this->cat_file->ViewCustomAttributes = "";
// cat_date
$this->cat_date->ViewValue = $this->cat_date->CurrentValue;
$this->cat_date->ViewValue = ew_FormatDateTime($this->cat_date->ViewValue, 5);
$this->cat_date->ViewCustomAttributes = "";
// cat_id
$this->cat_id->LinkCustomAttributes = "";
$this->cat_id->HrefValue = "";
$this->cat_id->TooltipValue = "";
// cat_name
$this->cat_name->LinkCustomAttributes = "";
$this->cat_name->HrefValue = "";
$this->cat_name->TooltipValue = "";
// cat_file
$this->cat_file->LinkCustomAttributes = "";
$this->cat_file->UploadPath = "/catalogues/";
if (!ew_Empty($this->cat_file->Upload->DbValue)) {
$this->cat_file->HrefValue = ew_UploadPathEx(FALSE, $this->cat_file->UploadPath) . $this->cat_file->Upload->DbValue;
// Add prefix/suffix
$this->cat_file->LinkAttrs["target"] = "";
// Add target
if ($this->Export != "") {
$this->cat_file->HrefValue = ew_ConvertFullUrl($this->cat_file->HrefValue);
}
} else {
$this->cat_file->HrefValue = "";
}
$this->cat_file->HrefValue2 = $this->cat_file->UploadPath . $this->cat_file->Upload->DbValue;
$this->cat_file->TooltipValue = "";
// cat_date
$this->cat_date->LinkCustomAttributes = "";
$this->cat_date->HrefValue = "";
$this->cat_date->TooltipValue = "";
// Call Row Rendered event
$this->Row_Rendered();
}
示例15: AddRow
function AddRow($rsold = NULL)
{
global $conn, $Language, $Security;
// Load db values from rsold
if ($rsold) {
$this->LoadDbValues($rsold);
$this->g_image->OldUploadPath = "/gallery";
$this->g_image->UploadPath = $this->g_image->OldUploadPath;
$this->gd_images->OldUploadPath = "/gallery";
$this->gd_images->UploadPath = $this->gd_images->OldUploadPath;
}
$rsnew = array();
// g_name
$this->g_name->SetDbValueDef($rsnew, $this->g_name->CurrentValue, "", FALSE);
// g_image
if (!$this->g_image->Upload->KeepFile) {
if ($this->g_image->Upload->FileName == "") {
$rsnew['g_image'] = NULL;
} else {
$rsnew['g_image'] = $this->g_image->Upload->FileName;
}
}
if (!$this->g_image->Upload->KeepFile) {
$this->g_image->UploadPath = "/gallery";
if (!ew_Empty($this->g_image->Upload->Value)) {
$rsnew['g_image'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->g_image->UploadPath), $rsnew['g_image']);
// Get new file name
}
}
// Call Row Inserting event
$rs = $rsold == NULL ? NULL : $rsold->fields;
$bInsertRow = $this->Row_Inserting($rs, $rsnew);
if ($bInsertRow) {
$conn->raiseErrorFn = 'ew_ErrorFn';
$AddRow = $this->Insert($rsnew);
$conn->raiseErrorFn = '';
if ($AddRow) {
if (!$this->g_image->Upload->KeepFile) {
if (!ew_Empty($this->g_image->Upload->Value)) {
$this->g_image->Upload->SaveToFile($this->g_image->UploadPath, $rsnew['g_image'], TRUE);
}
}
}
} else {
if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
// Use the message, do nothing
} elseif ($this->CancelMessage != "") {
$this->setFailureMessage($this->CancelMessage);
$this->CancelMessage = "";
} else {
$this->setFailureMessage($Language->Phrase("InsertCancelled"));
}
$AddRow = FALSE;
}
// Get insert id if necessary
if ($AddRow) {
$this->gd_id->setDbValue($conn->Insert_ID());
$rsnew['gd_id'] = $this->gd_id->DbValue;
}
if ($AddRow) {
// Call Row Inserted event
$rs = $rsold == NULL ? NULL : $rsold->fields;
$this->Row_Inserted($rs, $rsnew);
}
// g_image
ew_CleanUploadTempPath($this->g_image, $this->g_image->Upload->Index);
return $AddRow;
}