/** * */ function readWebValue(&$avalues, &$blobfields, $legacy1, $legacy2, &$filename_values) { $this->getPostValueAndType(); if (FieldSubmitted($this->goodFieldName . "_" . $this->id)) { $fileNameForPrepareFunc = securityCheckFileName(postvalue("filename_" . $this->goodFieldName . "_" . $this->id)); if ($this->pageObject->pageType != PAGE_EDIT) { $this->webValue = prepare_upload($this->field, "upload2", $fileNameForPrepareFunc, $fileNameForPrepareFunc, "", $this->id, $this->pageObject); } else { if (substr($this->webType, 0, 4) == "file") { $prepearedFile = prepare_file($this->webValue, $this->field, $this->webType, $fileNameForPrepareFunc, $this->id); if ($prepearedFile !== false) { $this->webValue = $prepearedFile["value"]; $filename = $prepearedFile["filename"]; } else { $this->webValue = false; } } else { if (substr($this->webType, 0, 6) == "upload") { if ($fileNameForPrepareFunc) { $this->webValue = $fileNameForPrepareFunc; } if ($this->webType == "upload1") { // file deletion, read filename from the database $oldValues = $this->pageObject->getOldRecordData(); $fileNameForPrepareFunc = $oldValues[$this->field]; } $this->webValue = prepare_upload($this->field, $this->webType, $fileNameForPrepareFunc, $this->webValue, "", $this->id, $this->pageObject); } } } } else { $this->webValue = false; } if (!($this->webValue === false)) { if ($this->webValue && $this->pageObject->pSetEdit->getCreateThumbnail($this->field)) { $contents = GetUploadedFileContents("value_" . $this->goodFieldName . "_" . $this->id); $ext = CheckImageExtension(GetUploadedFileName("value_" . $this->goodFieldName . "_" . $this->id)); $thumb = CreateThumbnail($contents, $this->pageObject->pSetEdit->getThumbnailSize($this->field), $ext); $this->pageObject->filesToSave[] = new SaveFile($thumb, $this->pageObject->pSetEdit->GetStrThumbnail($this->field) . $this->webValue, $this->pageObject->pSetEdit->getUploadFolder($this->field), $this->pageObject->pSetEdit->isAbsolute($this->field)); } $avalues[$this->field] = $this->webValue; } }
function readWebValue(&$avalues, &$blobfields, $strWhereClause, $oldValuesRead, &$filename_values) { $filename = ""; $this->getPostValueAndType(); if (FieldSubmitted($this->goodFieldName . "_" . $this->id)) { $fileNameForPrepareFunc = securityCheckFileName(postvalue("filename_" . $this->goodFieldName . "_" . $this->id)); if ($this->pageObject->pageType != PAGE_EDIT) { $prepearedFile = prepare_file($this->webValue, $this->field, "file2", $fileNameForPrepareFunc, $this->id); if ($prepearedFile !== false) { $this->webValue = $prepearedFile["value"]; $filename = $prepearedFile["filename"]; } else { $this->webValue = false; } } else { if (substr($this->webType, 0, 4) == "file") { $prepearedFile = prepare_file($this->webValue, $this->field, $this->webType, $fileNameForPrepareFunc, $this->id); if ($prepearedFile !== false) { $this->webValue = $prepearedFile["value"]; $filename = $prepearedFile["filename"]; } else { $this->webValue = false; } } else { if (substr($this->webType, 0, 6) == "upload") { if ($this->webType == "upload1") { // file deletion, read filename from the database if (!$oldValuesRead) { $rsold = db_query($this->pageObject->gQuery->gSQLWhere($strWhereClause), $this->conn); $dataold = db_fetch_array($rsold); $oldValuesRead = true; } $fileNameForPrepareFunc = $dataold[$this->field]; } $this->webValue = prepare_upload($this->field, $this->webType, $fileNameForPrepareFunc, $this->webValue, "", $this->id, $this->pageObject); } } } } else { $this->webValue = false; } if (!($this->webValue === false)) { if ($this->webValue) { if ($this->pageObject->pSetEdit->getCreateThumbnail($this->field)) { $ext = CheckImageExtension(GetUploadedFileName("value_" . $this->goodFieldName . "_" . $this->id)); $thumb = CreateThumbnail($this->webValue, $this->pageObject->pSetEdit->getThumbnailSize($this->field), $ext); $blobfields[] = $this->pageObject->pSetEdit->getStrThumbnail($this->field); $avalues[$blobfields[count($blobfields) - 1]] = $thumb; } if ($this->pageObject->pSetEdit->getResizeOnUpload($this->field)) { $ext = CheckImageExtension(GetUploadedFileName("value_" . $this->goodFieldName . "_" . $this->id)); $this->webValue = CreateThumbnail($this->webValue, $this->pageObject->pSetEdit->getNewImageSize($this->field), $ext); } } else { if ($this->pageObject->pageType == PAGE_EDIT && $this->pageObject->pSetEdit->getCreateThumbnail($this->field)) { $blobfields[] = $this->pageObject->pSetEdit->getStrThumbnail($this->field); $avalues[$blobfields[count($blobfields) - 1]] = ""; } } $blobfields[] = $this->field; $avalues[$this->field] = $this->webValue; } if ($filename && $this->pageObject->pSetEdit->getStrFilename($this->field)) { $filename_values[$this->pageObject->pSetEdit->getStrFilename($this->field)] = $filename; } }
function readWebValue(&$avalues, &$blobfields, $strWhereClause, $oldValuesRead, &$filename_values = null) { $this->getPostValueAndType(); if (FieldSubmitted($this->goodFieldName . "_" . $this->id)) { $fileNameForPrepareFunc = securityCheckFileName(postvalue("filename_" . $this->goodFieldName . "_" . $this->id)); if ($this->pageObject->pageType != PAGE_EDIT) { $this->webValue = prepare_upload($this->field, "upload2", $fileNameForPrepareFunc, $fileNameForPrepareFunc, "", $this->id, $this->pageObject); } else { if (substr($this->webType, 0, 4) == "file") { $prepearedFile = prepare_file($this->webValue, $this->field, $this->webType, $fileNameForPrepareFunc, $this->id); if ($prepearedFile !== false) { $this->webValue = $prepearedFile["value"]; $filename = $prepearedFile["filename"]; } else { $this->webValue = false; } } else { if (substr($this->webType, 0, 6) == "upload") { if ($fileNameForPrepareFunc) { $this->webValue = $fileNameForPrepareFunc; } if ($this->webType == "upload1") { // file deletion, read filename from the database if (!$oldValuesRead) { $rsold = db_query($this->pageObject->gQuery->gSQLWhere($strWhereClause), $this->conn); $dataold = db_fetch_array($rsold); $oldValuesRead = true; } $fileNameForPrepareFunc = $dataold[$this->field]; } $this->webValue = prepare_upload($this->field, $this->webType, $fileNameForPrepareFunc, $this->webValue, "", $this->id, $this->pageObject); } } } } else { $this->webValue = false; } if (!($this->webValue === false)) { if ($this->pageObject->pSet->getResizeOnUpload($this->field) || $this->pageObject->pSet->getCreateThumbnail($this->field)) { $contents = GetUploadedFileContents("value_" . $this->goodFieldName . "_" . $this->id); } if ($this->webValue && $this->pageObject->pSet->getCreateThumbnail($this->field)) { $ext = CheckImageExtension(GetUploadedFileName("value_" . $this->goodFieldName . "_" . $this->id)); $thumb = CreateThumbnail($contents, $this->pageObject->pSet->getThumbnailSize($this->field), $ext); $this->pageObject->filesToSave[] = new SaveFile($thumb, $this->pageObject->pSet->GetStrThumbnail($this->goodFieldName) . $this->webValue, $this->pageObject->pSet->getUploadFolder($this->field), $this->pageObject->pSet->isAbsolute($this->field)); } $avalues[$this->field] = $this->webValue; } }