function runner_delete_file($file) { if (myfile_exists($file)) { @unlink($file); } }
$ftype = "image/png"; } else { $fsFileName = $sessionFile["name"]; $fsize = $sessionFile["size"]; $ftype = $sessionFile["type"]; } } } } } if ($isDBFile && $value || $fsFileName != "") { if (!$isDBFile) { if (!$pSet->isAbsolute($field) || $iconShowed) { $fsFileName = getabspath($fsFileName); } if (!myfile_exists($fsFileName)) { $fsFileName = getabspath("images/no_image.gif"); $fsize = filesize($fsFileName); $ftype = "image/gif"; } } if ($isPDF) { if ($isDBFile) { $file = $value; } else { $file = myfile_get_contents($fsFileName); } return; } if (postvalue('norange') == 1) { header('Accept-Ranges: none');
if ($action == "downloadReport") { $logFilePath = $_SESSION[$pageObject->sessionPrefix . "_tempImportLogFilePath"]; if (!myfile_exists($logFilePath)) { $data = array("success" => false); echo printJSON($data); exit; } header("Content-Type: text/plain"); header("Content-Disposition: attachment;Filename=importLog.txt"); header("Cache-Control: private"); printfile($logFilePath); exit; } if ($action == "downloadUnprocessed") { $dataFilePath = $_SESSION[$pageObject->sessionPrefix . "_tempDataFilePath"]; if (!myfile_exists($dataFilePath)) { $data = array("success" => false); echo printJSON($data); exit; } header("Content-Type: application/csv"); header("Content-Disposition: attachment;Filename=unpocessedData.csv"); printfile($dataFilePath); exit; } // add button events if exist $pageObject->addButtonHandlers(); $pageObject->addCommonJs(); $pageObject->addCommonHtml(); $hiddenBricks = array("import_rawtext_control", "import_preview", "import_process", "import_results", "error_message"); $xt->displayBricksHidden($hiddenBricks);
public function showDBValue(&$data, $keylink) { if ($this->container->forExport && $this->container->forExport != "excel") { return "LONG BINARY DATA - CANNOT BE DISPLAYED"; } $value = $data[$this->field]; $result = $value; if (!CheckImageExtension($result)) { return ""; } if ($this->container->forExport == "excel") { return $result; } $uploadFolder = $this->container->pSet->getUploadFolder($this->field); $finalUploadFolder = $this->container->pSet->getFinalUploadFolder($this->field); $fileName = $value; if (!myfile_exists(getabspath($finalUploadFolder . $value))) { $value = "images/no_image.gif"; } else { $value = $uploadFolder . $value; } if ($this->container->pSet->showThumbnail($this->field)) { $thumbprefix = $this->container->pSet->getStrThumbnail($this->field); // show thumbnail $thumbname = $thumbprefix . $fileName; if (substr($uploadFolder, 0, 7) != "http://") { if (!myfile_exists($finalUploadFolder . $thumbname)) { $thumbname = $value; } else { $thumbname = $uploadFolder . $thumbname; } } $linkPrefix = ""; $result = "<a target=_blank href=\"" . htmlspecialchars($value) . "\" class='zoombox'>"; $result .= "<img"; if ($this->is508) { $result .= " alt=\"" . htmlspecialchars($data[$this->field]) . "\""; } $result .= " border=0"; $result .= " src=\"" . htmlspecialchars($thumbname) . "\"></a>"; } else { $imageSize = ""; $imgWidth = $this->container->pSet->getImageWidth($this->field); if ($imgWidth) { $imageSize .= " width=" . $imgWidth; } $imgHeight = $this->container->pSet->getImageHeight($this->field); if ($imgHeight) { $imageSize .= $imgHeight ? " height=" . $imgHeight : ""; } if ($divSize != "") { $divSize = 'style="' . $divSize . '"'; } if ($this->is508) { $result = '<img alt=\\"' . htmlspecialchars($data[$this->field]) . '\\" src="' . htmlspecialchars($value) . '" ' . $imageSize . ' border="0">'; } else { $result = '<img src="' . htmlspecialchars($value) . '" ' . $imageSize . ' border="0">'; } } return $result; }
public function showDBValue(&$data, $keylink) { if ($data[$this->field] == '') { return ''; } $this->upload_handler->tkeys = $keylink; $resultValues = array(); $arBigThumbnails = array(); $zoomboxRand = rand(11111, 99999); $filesArray = $this->getFilesArray($data[$this->field]); foreach ($filesArray as $imageFile) { $userFile = $this->upload_handler->buildUserFile($imageFile); if ($this->container->pageType == PAGE_EXPORT || $this->container->forExport != '') { $resultValues[] = $userFile["name"]; continue; } if (!CheckImageExtension($imageFile["name"])) { $resultValues[] = '<a href="' . runner_htmlspecialchars($userFile["url"]) . '">' . $userFile["name"] . '</a>'; continue; } $userFile["url"] .= "&nodisp=1"; if ($userFile["thumbnail_url"] != "") { $userFile["thumbnail_url"] .= "&nodisp=1"; } $imageValue = ''; $divSize = ''; $divBigThumbnailsSize = ''; $hasThumbnail = false; $imagePath = $this->getImagePath($imageFile["name"]); $hasBigImage = myfile_exists($imagePath); if ($this->showThumbnails) { $thumbPath = $this->getImagePath($imageFile["thumbnail"]); $hasThumbnail = myfile_exists($thumbPath); } if ($this->showThumbnails) { if ($hasThumbnail) { $imageValue .= '<img border="0"'; if ($this->is508) { $imageValue .= ' alt="' . runner_htmlspecialchars($userFile["name"]) . '"'; } $src = $userFile["thumbnail_url"] != "" ? $userFile["thumbnail_url"] : $userFile["url"]; if ($this->thumbWidth || $this->thumbHeight) { $imageValue .= $this->getSmallThumbnailStyle(); } $imageValue .= ' src="' . runner_htmlspecialchars($src) . '" />'; } else { if ($hasBigImage) { $imageValue .= '<img ' . $this->getImageSizeStyle(true) . ' border="0"'; if ($this->is508) { $imageValue .= ' alt="' . runner_htmlspecialchars($userFile["name"]) . '"'; } $imageValue .= ' src="' . runner_htmlspecialchars($userFile["url"]) . '">'; } } if ($hasBigImage && $imageValue != '') { $href = runner_htmlspecialchars($userFile["url"]); $smallThumbnailStyle = ''; $linkClass = !$this->setOfThumbnails ? "zoombox zgallery" . $zoomboxRand : ''; if ($this->thumbWidth && $this->thumbHeight) { $thumbFileUrl = $hasThumbnail ? $userFile["thumbnail_url"] : $userFile["url"]; $smallThumbnailStyle = $this->getSmallThumbnailStyle($thumbFileUrl, $hasThumbnail); $linkClass .= " background-picture"; } if ($linkClass) { $linkClass = "class='" . $linkClass . "'"; } $imageValue = '<a target="_blank" href="' . $href . '"' . $linkClass . $smallThumbnailStyle . '>' . $imageValue . '</a>'; if ($this->setOfThumbnails) { $bigThumbnailLinkStyle = $this->getBigThumbnailSizeStyles(); $bigThumbnailLink = '<a style="display: none;" href="' . $href . '" ' . ($bigThumbnailLinkStyle ? 'class="zoombox"' : '') . '>'; $bigThumbnailLink .= '<img src="' . $href . '" border="0"'; $bigThumbnailLink .= $this->getImageSizeStyle(true); $bigThumbnailLink .= '/></a>'; if (!$divBigThumbnailsSize) { $divBigThumbnailsSize = 'style="' . $bigThumbnailLinkStyle . '"'; } $arBigThumbnails[] = $bigThumbnailLink; } } } else { if ($hasBigImage) { $imageValue .= "<img"; if ($this->imageWidth) { $divSize = "width: " . $this->imageWidth . "px;"; } if ($this->imageHeight) { $divSize .= "height: " . $this->imageHeight . "px;"; } if ($divSize != "") { $divSize = 'style="' . $divSize . '"'; } $imageValue .= " border=0"; if ($this->is508) { $imageValue .= " alt=\"" . runner_htmlspecialchars($userFile["name"]) . "\""; } $imageValue .= $this->getImageSizeStyle(true) . ' src="' . runner_htmlspecialchars($userFile["url"]) . '">'; } } if ($imageValue != '') { $resultValues[] = $imageValue; } } if (count($resultValues) > 1 || count($resultValues) == 1 && $this->setOfThumbnails) { if ($this->container->pageType == PAGE_EXPORT || $this->container->forExport != '') { return implode(', ', $resultValues); } if ($this->container->pageType == PAGE_PRINT) { return implode('<br />', $resultValues); } for ($i = 0; $i < count($resultValues); $i++) { if ($i == 0) { $resultValues[$i] = '<li>' . $resultValues[$i] . '</li>'; } else { $resultValues[$i] = '<li style="display:none;">' . $resultValues[$i] . '</li>'; } } $divBigThumbnails = ''; if (count($arBigThumbnails)) { $divBigThumbnails = '<div class="big-thumbnails" ' . $divBigThumbnailsSize . '>' . implode('', $arBigThumbnails) . '</div>'; } if (!$divSize && !$this->setOfThumbnails) { $divSize = 'style="' . $this->getBigThumbnailSizeStyles(true) . '"'; } $presudoSlider = '<div class="presudoslider" ' . $divSize . '>' . $divBigThumbnails . '<ul class="viewimage-thumblist" style="list-style: none;">' . implode("", $resultValues) . '</ul>' . $hiddenFields . '</div>'; return '<div style="position:relative;" class="viewImage">' . $presudoSlider . '</div>'; } if (count($resultValues) == 1) { return $resultValues[0]; } return '<img src="' . GetRootPathForResources("images/no_image.gif") . '" />'; }
/** * Get the image or file link markup * @param String value * @param String fileName * @param Boolean newUploaderWasUsed * @param Array fileData * @return String */ function getFileOrImageMarkup($value, $fileName, $newUploaderWasUsed, $fileData) { $cachedValue = $value; if ($newUploaderWasUsed) { $finalFilePath = $filePath = $fileData["name"]; } else { $uploadFolder = $this->pageObject->pSetEdit->getUploadFolder($this->field); $filePath = $uploadFolder . $value; $finalUploadFolder = $this->pageObject->pSetEdit->getFinalUploadFolder($this->field); $finalFilePath = $finalUploadFolder . $value; } if (!CheckImageExtension($fileName)) { return "<a target=\"_blank\" href=\"" . GetRootPathForResources(runner_htmlspecialchars($filePath)) . "\">" . runner_htmlspecialchars($fileName) . "</a>"; } $altAttr = $this->is508 ? " alt=\"" . runner_htmlspecialchars($fileName) . "\"" : ""; if (!myfile_exists(getabspath($finalFilePath))) { $filePath = "images/no_image.gif"; } if ($this->pageObject->pSetEdit->showThumbnail($this->field)) { if ($newUploaderWasUsed) { $finalThumbPath = $thumbPath = $fileData["thumbnail"]; } else { $thumbprefix = $this->pageObject->pSetEdit->getStrThumbnail($this->field); $thumbPath = $uploadFolder . $thumbprefix . $fileName; $finalThumbPath = $finalUploadFolder . $thumbprefix . $fileName; } if (substr($thumbPath, 0, 7) != "http://") { if (!myfile_exists(getabspath($finalThumbPath))) { $thumbPath = $filePath; } } // show thumbnail return "<a target=\"_blank\" href=\"" . GetRootPathForResources(runner_htmlspecialchars($filePath)) . "\" class='zoombox zgallery'>" . "<img" . $altAttr . " border=0 src=\"" . GetRootPathForResources(runner_htmlspecialchars($thumbPath)) . "\"></a>"; } $imageValue = $filePath; if ($filePath != "images/no_image.gif" && !$newUploaderWasUsed) { if (filesize($finalUploadFolder . $fileName) > 51200) { $imageValue = "images/icons/jpg.png"; } } $disp = '<img ' . $altAttr . 'src="' . GetRootPathForResources(runner_htmlspecialchars($imageValue)) . '" border=0>'; if ($imageValue != "images/no_image.gif") { $disp = "<a target=\"_blank\" href=\"" . GetRootPathForResources(runner_htmlspecialchars($filePath)) . "\">" . $disp . "</a>"; } return $disp; }
function GetDataInt($value, $data, $field, $format) { global $strTableName; if ($format == FORMAT_CUSTOM && $data) { return CustomExpression($value, $data, $field, ""); } $ret = ""; // long binary data? if (IsBinaryType(GetFieldType($field))) { $ret = mlang_message("LONG_BINARY"); } else { $ret = $value; } if ($ret === false) { $ret = ""; } if ($format == FORMAT_DATE_SHORT) { $ret = format_shortdate(db2time($value)); } else { if ($format == FORMAT_DATE_LONG) { $ret = format_longdate(db2time($value)); } else { if ($format == FORMAT_DATE_TIME) { $ret = str_format_datetime(db2time($value)); } else { if ($format == FORMAT_TIME) { if (IsDateFieldType(GetFieldType($field))) { $ret = str_format_time(db2time($value)); } else { $numbers = parsenumbers($value); if (!count($numbers)) { return ""; } while (count($numbers) < 3) { $numbers[] = 0; } $ret = str_format_time(array(0, 0, 0, $numbers[0], $numbers[1], $numbers[2])); } } else { if ($format == FORMAT_NUMBER) { $ret = str_format_number($value, GetFieldData($strTableName, $field, "DecimalDigits", false)); } else { if ($format == FORMAT_CURRENCY) { $ret = str_format_currency($value); } else { if ($format == FORMAT_CHECKBOX) { $ret = "<img src=\"images/check_"; if ($value && $value != 0) { $ret .= "yes"; } else { $ret .= "no"; } $ret .= ".gif\" border=0"; if (isEnableSection508()) { $ret .= " alt=\" \""; } $ret .= ">"; } else { if ($format == FORMAT_PERCENT) { if ($value != "") { $ret = $value * 100 . "%"; } } else { if ($format == FORMAT_PHONE_NUMBER) { if (strlen($ret) == 7) { $ret = substr($ret, 0, 3) . "-" . substr($ret, 3); } else { if (strlen($ret) == 10) { $ret = "(" . substr($ret, 0, 3) . ") " . substr($ret, 3, 3) . "-" . substr($ret, 6); } } } else { if ($format == FORMAT_FILE_IMAGE) { if (!CheckImageExtension($ret)) { return ""; } $thumbnailed = false; $thumbprefix = ""; if ($thumbnailed) { // show thumbnail $thumbname = $thumbprefix . $ret; if (substr(GetLinkPrefix($field), 0, 7) != "http://" && !myfile_exists(getabspath(GetLinkPrefix($field) . $thumbname))) { $thumbname = $ret; } $ret = "<a target=_blank href=\"" . htmlspecialchars(AddLinkPrefix($field, $ret)) . "\">"; $ret .= "<img"; if (isEnableSection508()) { $ret .= " alt=\"" . htmlspecialchars($data[$field]) . "\""; } $ret .= " border=0"; $ret .= " src=\"" . htmlspecialchars(AddLinkPrefix($field, $thumbname)) . "\"></a>"; } else { if (isEnableSection508()) { $ret = '<img alt=\\"".htmlspecialchars($data[$field])."\\" src="' . AddLinkPrefix($field, $ret) . '" border=0>'; } else { $ret = '<img src="' . htmlspecialchars(AddLinkPrefix($field, $ret)) . '" border=0>'; } } } else { if ($format == FORMAT_HYPERLINK) { if ($data) { $ret = GetHyperlink($ret, $field, $data); } } else { if ($format == FORMAT_EMAILHYPERLINK) { $link = $ret; $title = $ret; if (substr($ret, 0, 7) == "mailto:") { $title = substr($ret, 8); } else { $link = "mailto:" . $link; } $ret = '<a href="' . $link . '">' . $title . '</a>'; } else { if ($format == FORMAT_FILE) { $iquery = "table=" . GetTableURL($strTableName) . "&field=" . rawurlencode($field); $arrKeys = GetTableKeys($strTableName); $keylink = ""; for ($j = 0; $j < count($arrKeys); $j++) { $keylink .= "&key" . ($j + 1) . "=" . rawurlencode($data[$arrKeys[$j]]); } $iquery .= $keylink; return '<a href="download.php?' . $iquery . '">' . htmlspecialchars($ret) . '</a>'; } else { if (GetEditFormat($field) == EDIT_FORMAT_CHECKBOX && $format == FORMAT_NONE) { if ($ret && $ret != 0) { $ret = mlang_message("YES"); } else { $ret = mlang_message("NO"); } } } } } } } } } } } } } } } return $ret; }
/** * Proccess record values * * @param array $record * @param array $data * @param string $keylink */ function proccessRecordValue(&$data, &$keylink, $listFieldInfo) { $value = ""; if ($listFieldInfo['viewFormat'] == FORMAT_DATABASE_IMAGE) { if (ShowThumbnail($listFieldInfo['fName'], $this->tName)) { $thumbPref = GetThumbnailPrefix($listFieldInfo['fName'], $this->tName); $value .= "<a"; if (IsUseiBox($listFieldInfo['fName'], $this->tName)) { $value .= " rel='ibox'"; } else { $value .= " target=_blank"; } $value .= " href='imager.php?table=" . $this->shortTableName . "&field=" . rawurlencode($listFieldInfo['fName']) . $keylink . "'>"; $value .= "<img border=0"; if ($this->is508) { $value .= " alt=\"Image from DB\""; } $value .= " src='imager.php?table=" . $this->shortTableName . "&field=" . rawurlencode($thumbPref) . "&alt=" . rawurlencode($listFieldInfo['fName']) . $keylink . "'>"; $value .= "</a>"; } else { $value = "<img"; if ($this->is508) { $value .= " alt=\"Image from DB\""; } $imgWidth = GetImageWidth($listFieldInfo['fName'], $this->tName); $value .= $imgWidth ? " width=" . $imgWidth : ""; $imgHeight = GetImageHeight($listFieldInfo['fName'], $this->tName); $value .= $imgHeight ? " height=" . $imgHeight : ""; $value .= " border=0"; $value .= " src='imager.php?table=" . $this->shortTableName . "&field=" . rawurlencode($listFieldInfo['fName']) . $keylink . "'>"; } } else { if ($listFieldInfo['viewFormat'] == FORMAT_FILE_IMAGE) { if (CheckImageExtension($data[$listFieldInfo['fName']])) { if (ShowThumbnail($listFieldInfo['fName'], $this->tName)) { // show thumbnail $thumbPref = GetThumbnailPrefix($listFieldInfo['fName'], $this->tName); $thumbname = $thumbPref . $data[$listFieldInfo['fName']]; if (substr(GetLinkPrefix($listFieldInfo['fName'], $this->tName), 0, 7) != "http://" && !myfile_exists(GetUploadFolder($listFieldInfo['fName']) . $thumbname)) { $thumbname = $data[$listFieldInfo['fName']]; } $value = "<a"; if (IsUseiBox($listFieldInfo['fName'], $this->tName)) { $value .= " rel='ibox'"; } else { $value .= " target=_blank"; } $value .= " href=\"" . htmlspecialchars(AddLinkPrefix($listFieldInfo['fName'], $data[$listFieldInfo['fName']])) . "\">"; $value .= "<img"; if ($thumbname == $data[$listFieldInfo['fName']]) { $imgWidth = GetImageWidth($listFieldInfo['fName'], $this->tName); $value .= $imgWidth ? " width=" . $imgWidth : ""; $imgHeight = GetImageHeight($listFieldInfo['fName'], $this->tName); $value .= $imgHeight ? " height=" . $imgHeight : ""; } $value .= " border=0"; if ($this->is508) { $value .= " alt=\"" . htmlspecialchars($data[$listFieldInfo['fName']]) . "\""; } $value .= " src=\"" . htmlspecialchars(AddLinkPrefix($listFieldInfo['fName'], $thumbname)) . "\"></a>"; } else { $value = "<img"; $imgWidth = GetImageWidth($listFieldInfo['fName'], $this->tName); $value .= $imgWidth ? " width=" . $imgWidth : ""; $imgHeight = GetImageHeight($listFieldInfo['fName'], $this->tName); $value .= $imgHeight ? " height=" . $imgHeight : ""; $value .= " border=0"; if ($this->is508) { $value .= " alt=\"" . htmlspecialchars($data[$listFieldInfo['fName']]) . "\""; } $value .= " src=\"" . htmlspecialchars(AddLinkPrefix($listFieldInfo['fName'], $data[$listFieldInfo['fName']])) . "\">"; } } } else { if ($listFieldInfo['viewFormat'] == FORMAT_DATABASE_FILE) { $fileNameF = GetFilenameField($listFieldInfo['fName'], $this->tName); if ($fileNameF) { $fileName = $data[$fileNameF]; if (!$fileName) { $fileName = "file.bin"; } } else { $fileName = "file.bin"; } if (strlen($data[$listFieldInfo['fName']])) { $value = "<a href='getfile.php?table=" . $this->shortTableName . "&filename=" . rawurlencode($fileName) . "&field=" . rawurlencode($listFieldInfo['fName']) . $keylink . "'>"; $value .= htmlspecialchars($fileName); $value .= "</a>"; } } else { if ($listFieldInfo['viewFormat'] == FORMAT_AUDIO) { $fileName = GetData($data, $listFieldInfo['fName'], FORMAT_NONE); $fieldIsUrl = GetFieldData($this->tName, $listFieldInfo['fName'], "fieldIsVideoUrl", false); if (strlen($fileName)) { $absFileName = ""; if (!$fieldIsUrl && GetFieldData($this->tName, $listFieldInfo['fName'], "Absolute", false)) { $absFileName = GetUploadFolder($listFieldInfo['fName']) . $fileName; } elseif (!$fieldIsUrl) { $absFileName = getabspath(GetUploadFolder($listFieldInfo['fName']) . $fileName); } // if file if ($fieldIsUrl || file_exists($absFileName)) { $titleField = GetFieldData($this->tName, $listFieldInfo['fName'], 'audioTitleField', ""); $title = ""; if ($titleField) { $title = htmlspecialchars(GetData($data, $titleField, ViewFormat($titleField, $titleField))); } if ($fieldIsUrl) { $href = $fileName; } else { $href = 'download.php?table=' . $this->shortTableName . '&field=' . rawurlencode($listFieldInfo['fName']) . $keylink; } $value = '<a class="htrack" type="audio/mpeg" title="' . $title . '" href="' . $href . '">' . $title . '</a>'; } } } else { if ($listFieldInfo['viewFormat'] == FORMAT_DATABASE_AUDIO) { $titleField = GetFieldData($this->tName, $listFieldInfo['fName'], 'audioTitleField', ""); $title = ""; if ($titleField) { $title = htmlspecialchars(GetData($data, $titleField, ViewFormat($titleField, $titleField))); } if (@$data[$listFieldInfo['fName']] != NULL) { $value = '<a class="htrack" type="audio/mpeg" title="' . $title . '" href="getfile.php?table=' . $this->shortTableName . '&field=' . rawurlencode($listFieldInfo['fName']) . $keylink . '">' . $title . '</a>'; } else { $value = $title; } } else { if ($listFieldInfo['viewFormat'] == FORMAT_VIDEO) { $value = ""; $fieldIsUrl = GetFieldData($this->tName, $listFieldInfo['fName'], "fieldIsVideoUrl", false); $fileName = GetData($data, $listFieldInfo['fName'], FORMAT_NONE); if (strlen($fileName)) { $absFileName = ""; if (!$fieldIsUrl && GetFieldData($this->tName, $listFieldInfo['fName'], "Absolute", false)) { $absFileName = GetUploadFolder($listFieldInfo['fName']) . $fileName; } elseif (!$fieldIsUrl) { $absFileName = getabspath(GetUploadFolder($listFieldInfo['fName']) . $fileName); } // if file if ($fieldIsUrl || file_exists($absFileName)) { $videoId = 'video_' . GoodFieldName(htmlspecialchars($listFieldInfo['fName'])) . '_' . $this->recId; if ($fieldIsUrl) { $href = $fileName; } else { $href = 'download.php?table=' . $this->shortTableName . '&field=' . rawurlencode($listFieldInfo['fName']) . $keylink; } $value = '<a href="' . $href . '" style="display:block;width:' . GetFieldData($this->tName, $listFieldInfo['fName'], 'videoWidth', "") . 'px;height:' . GetFieldData($this->tName, $listFieldInfo['fName'], 'videoHeight', "") . 'px;" id="' . $videoId . '"></a>'; $this->controlsMap['video'][] = $videoId; } } } else { if ($listFieldInfo['viewFormat'] == FORMAT_DATABASE_VIDEO) { if (@$data[$listFieldInfo['fName']] != NULL) { $videoId = 'video_' . GoodFieldName(htmlspecialchars($listFieldInfo['fName'])) . '_' . $this->recId; $value = '<a href="getfile.php?table=' . $this->shortTableName . '&field=' . rawurlencode($listFieldInfo['fName']) . $keylink . '" style="display:block;width:' . GetFieldData($this->tName, $listFieldInfo['fName'], 'videoWidth', 0) . 'px;height:' . GetFieldData($this->tName, $listFieldInfo['fName'], 'videoHeight', 0) . 'px;" id="' . $videoId . '"></a>'; $this->controlsMap['video'][] = $videoId; } } else { if ($listFieldInfo['viewFormat'] == FORMAT_MAP) { $value = '<div id="littleMap_' . GoodFieldName($listFieldInfo['fName']) . '_' . $this->recId . '" style="width: ' . $this->googleMapCfg['fieldsAsMap'][$listFieldInfo['fName']]['width'] . 'px; height: ' . $this->googleMapCfg['fieldsAsMap'][$listFieldInfo['fName']]['height'] . 'px;"></div>'; } else { if (($listFieldInfo['editFormat'] == EDIT_FORMAT_LOOKUP_WIZARD || $listFieldInfo['editFormat'] == EDIT_FORMAT_RADIO) && GetLookupType($listFieldInfo['fName'], $this->tName) == LT_LOOKUPTABLE && GetLWLinkField($listFieldInfo['fName'], $this->tName) != GetLWDisplayField($listFieldInfo['fName'], $this->tName)) { $value = DisplayLookupWizard($listFieldInfo['fName'], $data[$listFieldInfo['fName']], $data, $keylink, MODE_LIST); } else { if (NeedEncode($listFieldInfo['fName'], $this->tName)) { $value = ProcessLargeText(GetData($data, $listFieldInfo['fName'], $listFieldInfo['viewFormat']), "field=" . rawurlencode($listFieldInfo['fName']) . $keylink, "", MODE_LIST); } else { $value = GetData($data, $listFieldInfo['fName'], $listFieldInfo['viewFormat']); } } } } } } } } } } // create address field as center link $value = $this->addCenterLink($value, $listFieldInfo['fName']); return $value; }
function buildControl($value, $mode, $fieldNum = 0, $validate, $additionalCtrlParams, $data) { parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data); if ($this->pageObject->pageType == PAGE_SEARCH || $this->pageObject->pageType == PAGE_LIST) { echo '<input id="' . $this->cfield . '" ' . $this->inputStyle . ' type="text" ' . ($mode == MODE_SEARCH ? 'autocomplete="off" ' : '') . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . 'name="' . $this->cfield . '" ' . $this->pageObject->pSetEdit->getEditParams($this->field) . ' value="' . htmlspecialchars($value) . '">'; $this->buildControlEnd($validate); return; } if ($mode == MODE_SEARCH) { $this->format = ""; } $disp = ""; $strfilename = ""; $function = ""; if ($mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) { // show current file $fileName = $value; if ($this->pageObject->pSet->getViewFormat($this->field) == FORMAT_FILE || $this->pageObject->pSet->getViewFormat($this->field) == FORMAT_FILE_IMAGE) { $uploadFolder = $this->pageObject->pSet->getUploadFolder($this->field); if (!CheckImageExtension($value)) { $disp = "<a target=\"_blank\" href=\"" . htmlspecialchars($uploadFolder . $value) . "\">" . htmlspecialchars($value) . "</a>"; } else { $finalUploadFolder = $this->pageObject->pSet->getFinalUploadFolder($this->field); if (!myfile_exists(getabspath($finalUploadFolder . $value))) { $value = "images/no_image.gif"; } else { $value = $uploadFolder . $value; } if ($this->pageObject->pSet->showThumbnail($this->field)) { $thumbprefix = $this->pageObject->pSet->getStrThumbnail($this->field); // show thumbnail $thumbname = $thumbprefix . $fileName; if (substr($uploadFolder, 0, 7) != "http://") { if (!myfile_exists(getabspath($finalUploadFolder . $thumbname))) { $thumbname = $value; } else { $thumbname = $uploadFolder . $thumbname; } } $disp = "<a target=\"_blank\" href=\"" . htmlspecialchars($value) . "\" class='zoombox zgallery'>"; $disp .= "<img"; if (isEnableSection508()) { $disp .= " alt=\"" . htmlspecialchars($fileName) . "\""; } $disp .= " border=0"; $disp .= " src=\"" . htmlspecialchars($thumbname) . "\"></a>"; } else { if ($value != "images/no_image.gif") { if (filesize($finalUploadFolder . $fileName) > 51200) { $imageValue = "images/icons/jpg.png"; } else { $imageValue = $value; } } else { $imageValue = "images/no_image.gif"; } if (isEnableSection508()) { $disp = '<img alt=\\"' . htmlspecialchars($fileName) . '\\" src="' . htmlspecialchars($imageValue) . '" border=0>'; } else { $disp = '<img src="' . htmlspecialchars($imageValue) . '" border=0>'; } if ($imageValue != "images/no_image.gif") { $disp = "<a target=\"_blank\" href=\"" . htmlspecialchars($value) . "\">" . $disp . "</a>"; } } } $disp .= "<br />"; } // filename edit $filename_size = 30; if ($this->pageObject->pSet->isUseTimestamp($this->field)) { $filename_size = 50; } $strfilename = '<input type=hidden name="filenameHidden_' . $this->cfieldname . '" value="' . htmlspecialchars($fileName) . '"><br>' . "Filename" . ' <input type="text" style="background-color:gainsboro" disabled id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="' . $filename_size . '" maxlength="100" value="' . htmlspecialchars($fileName) . '">'; $strtype = '<br><input id="' . $this->ctype . '_keep" type="Radio" name="' . $this->ctype . '" value="upload0" checked class="runner-uploadtype">' . "Keep"; if ((strlen($value) || $mode == MODE_INLINE_EDIT) && !$this->pageObject->pSet->isRequired($this->field)) { $strtype .= '<input id="' . $this->ctype . '_delete" type="Radio" name="' . $this->ctype . '" value="upload1" class="runner-uploadtype">' . "Delete"; } $strtype .= '<input id="' . $this->ctype . '_update" type="Radio" name="' . $this->ctype . '" value="upload2" class="runner-uploadtype">' . "Update"; } else { // if Adding record $filename_size = 30; if ($this->pageObject->pSet->isUseTimestamp($this->field)) { $filename_size = 50; } $strtype = '<input id="' . $this->ctype . '" type="hidden" name="' . $this->ctype . '" value="upload2">'; $strfilename = '<br>' . "Filename" . ' <input type="text" id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="' . $filename_size . '" maxlength="100">'; } echo $disp . $strtype . $function; if ($mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) { echo '<br>'; } echo '<input type="File" id="' . $this->cfield . '" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . ' name="' . $this->cfield . '" >' . $strfilename; echo '<input type="Hidden" id="notempty_' . $this->cfieldname . '" value="' . (strlen($value) ? 1 : 0) . '">'; $this->buildControlEnd($validate); }
function getFormattedRow($value) { $row = array('row_data' => true); $keylink = ""; for ($i = 0; $i < count($this->tKeyFields); $i++) { $keylink .= "&key" . ($i + 1) . "=" . htmlspecialchars(rawurlencode(@$value[$this->tKeyFields[$i]])); } for ($i = 0; $i < count($this->fieldsArr); $i++) { // for change pseudo foreach with condition with PHP for // foreach Fields as @f filter @f.bReportPage && (@TABLE.bReportShowDetails || @TABLE.arrReportGroupFields[strGroupField==@f.strName && nGroupInterval==0].len) order nReportPageOrder $pass = false; for ($j = 0; $j < count($this->repGroupFields); $j++) { if (!$this->fieldsArr[$i]['repPage'] || !($this->repShowDet || $this->repGroupFields[$j]['strGroupField'] == $this->fieldsArr[$i]['name'] && $this->repGroupFields[$j]['groupInterval'] === 0)) { $pass = true; } } if ($pass) { continue; } if ($this->fieldsArr[$i]['viewFormat'] == FORMAT_DATABASE_IMAGE) { if (!$this->forExport) { if ($this->fieldsArr[$i]['showThumb']) { $val .= "<a "; if (IsUseiBox($this->fieldsArr[$i]['name'], $this->tName)) { $val .= " rel='ibox'"; } else { $val .= " target=_blank"; } $val .= " href=\"imager.php?table=" . $this->shortTName . "&field=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['name'])) . $keylink . "\">"; $val .= "<img border=0"; if (isEnableSection508()) { $val .= " alt=\"Image from DB\""; } $val .= " src=\"imager.php?table=" . $this->shortTName . "&field=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['thumbnail'])) . "&alt=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['repPage'])) . $keylink . "\">"; $val .= "</a>"; } else { $val = "<img"; if ($this->fieldsArr[$i]['imageWidth']) { $val .= " width=" . $this->fieldsArr[$i]['imageWidth']; } if ($this->fieldsArr[$i]['imageHeight']) { $val .= " height=" . $this->fieldsArr[$i]['imageHeight']; } $val .= " border=0"; if (isEnableSection508()) { $val .= " alt=\"Image from DB\""; } $val .= " src=\"imager.php?table=" . $this->shortTName . "&field=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['name'])) . $keylink . "\">"; } } else { $val = mlang_message("LONG_BINARY"); } } elseif ($this->fieldsArr[$i]['viewFormat'] == FORMAT_FILE_IMAGE) { if (!$this->forExport) { if (CheckImageExtension($value[$this->fieldsArr[$i]['name']])) { if ($this->fieldsArr[$i]['showThumb']) { // show thumbnail $thumbname = $this->fieldsArr[$i]['thumbnail'] . $value[$this->fieldsArr[$i]['name']]; if (substr($this->fieldsArr[$i]['strhlPrefix'], 0, 7) != "http://" && !myfile_exists(getabspath($this->fieldsArr[$i]['strhlPrefix'] . $thumbname))) { $thumbname = $value[$this->fieldsArr[$i]['name']]; } $val = "<a"; if (IsUseiBox($this->fieldsArr[$i]['name'], $this->tName)) { $val .= " rel='ibox'"; } else { $val .= " target=_blank"; } $val .= " href=\"" . htmlspecialchars(AddLinkPrefix($this->fieldsArr[$i]['name'], $value[$this->fieldsArr[$i]['name']])) . "\">"; $val .= "<img"; if ($thumbname == $value[$this->fieldsArr[$i]['name']]) { if ($this->fieldsArr[$i]['imageWidth']) { $val .= " width=" . $this->fieldsArr[$i]['imageWidth']; } if ($this->fieldsArr[$i]['imageHeight']) { $val .= " height=" . $this->fieldsArr[$i]['imageHeight']; } } $val .= " border=0"; if (isEnableSection508()) { $val .= " alt=\"" . htmlspecialchars($value[$this->fieldsArr[$i]['name']]) . "\""; } $val .= " src=\"" . htmlspecialchars(AddLinkPrefix($this->fieldsArr[$i]['name'], $thumbname)) . "\"></a>"; } else { $val = "<img"; if ($this->fieldsArr[$i]['imageWidth']) { $val .= " width=" . $this->fieldsArr[$i]['imageWidth']; } if ($this->fieldsArr[$i]['imageHeight']) { $val .= " height=" . $this->fieldsArr[$i]['imageHeight']; } $val .= " border=0"; if (isEnableSection508()) { $val .= " alt=\"" . htmlspecialchars($value[$this->fieldsArr[$i]['name']]) . "\""; } $val .= " src=\"" . htmlspecialchars(AddLinkPrefix($this->fieldsArr[$i]['name'], $value[$this->fieldsArr[$i]['name']])) . "\">"; } } } else { $val = mlang_message("LONG_BINARY"); } } elseif ($this->fieldsArr[$i]['viewFormat'] == FORMAT_DATABASE_FILE) { if (!$this->forExport) { if ($this->fieldsArr[$i]['fileName']) { $filename = $value[$this->fieldsArr[$i]['fileName']]; if (!$filename) { $filename = "file.bin"; } } else { $filename = "file.bin"; } if (strlen($value[$this->fieldsArr[$i]['name']])) { $val = "<a href=\"getfile.php?table=" . $this->shortTName . "&filename=" . rawurlencode($filename) . "&field=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['name'])) . $keylink . "\">"; $val .= htmlspecialchars($filename); $val .= "</a>"; } } else { $val = mlang_message("LONG_BINARY"); } } elseif (($this->fieldsArr[$i]['editFormat'] == EDIT_FORMAT_LOOKUP_WIZARD || $this->fieldsArr[$i]['editFormat'] == EDIT_FORMAT_RADIO) && GetLookupType($this->fieldsArr[$i]['name'], $this->tName) == LT_LOOKUPTABLE) { $val = DisplayLookupWizard($this->fieldsArr[$i]['name'], $value[$this->fieldsArr[$i]['name']], $value, $keylink, $this->mode); } elseif (NeedEncode($this->fieldsArr[$i]['name'], $this->tName)) { $val = ProcessLargeText(GetData($value, $this->fieldsArr[$i]['name'], $this->fieldsArr[$i]['viewFormat']), "field=" . rawurlencode($this->fieldsArr[$i]['name']) . $keylink, "", $this->mode); } else { //$val = GetData($value, $this->fieldsArr[$i]['name'], $this->fieldsArr[$i]['viewFormat']); if ($this->fieldsArr[$i]['viewFormat'] == FORMAT_CHECKBOX && $this->forExport) { $val = GetData($value, $this->fieldsArr[$i]['name'], FORMAT_NONE); } else { $val = GetData($value, $this->fieldsArr[$i]['name'], $this->fieldsArr[$i]['viewFormat']); } } $row[$this->fieldsArr[$i]['goodName'] . "_value"] = $val; } if ($this->repLayout == REPORT_BLOCK) { $row[GoodFieldName('nonewgroup')] = true; } return $row; }