Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cAjaxRequest
  • cAutoload
  • cBackend
  • cEffectiveSetting
  • cGuiScrollListAlltranslations
  • cHTMLValidator
  • cMailer
  • cModuleFileTranslation
  • cModuleHandler
  • cModuleSearch
  • cModuleSynchronizer
  • cModuleTemplateHandler
  • CodeMirror
  • cPasswordRequest
  • cPermission
  • cRegistry
  • cSystemPurge
  • cSystemtest
  • cTinymce4Configuration
  • cTinyMCE4Editor
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • TODOBackendList
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • addArtspec
  • addSortImages
  • backToMainArea
  • buildArticleSelect
  • buildCategorySelect
  • buildCategorySelectRights
  • buildHeapTable
  • buildStackString
  • buildTree
  • buildUserOrGroupPermsFromRequest
  • callPluginStore
  • cApiCatGetLevelNode
  • cApiImageCheckCachedImageValidity
  • cApiImageCheckImageEditingPosibility
  • cApiImageCheckImageEditingPossibility
  • cApiImageGetCacheFileName
  • cApiImageGetTargetDimensions
  • cApiImageIsAnimGif
  • cApiImgScale
  • cApiImgScaleGetMD5CacheFile
  • cApiImgScaleHQ
  • cApiImgScaleImageMagick
  • cApiImgScaleLQ
  • cApiIsImageMagickAvailable
  • cApiStrCleanURLCharacters
  • cApiStrNormalizeLineEndings
  • cApiStrRecodeString
  • cApiStrReplaceDiacritics
  • cApiStrTrimAfterWord
  • cApiStrTrimHard
  • cApiStrTrimSentence
  • cDeprecated
  • cDie
  • cError
  • checkLangInClients
  • checkPathInformation
  • cInclude
  • compareUrlStrings
  • conChangeTemplateForCat
  • conCopyArticle
  • conCopyArtLang
  • conCopyContainerConf
  • conCopyContent
  • conCopyMetaTags
  • conCopyTemplateConfiguration
  • conCreateLocationString
  • conDeeperCategoriesArray
  • conDeleteart
  • conEditArt
  • conEditFirstTime
  • conFetchCategoryTree
  • conFlagOnOffline
  • conGenerateCode
  • conGenerateCodeForAllArts
  • conGenerateCodeForAllArtsInCategory
  • conGenerateCodeForAllartsUsingLayout
  • conGenerateCodeForAllartsUsingMod
  • conGenerateCodeForAllArtsUsingTemplate
  • conGenerateCodeForArtInAllCategories
  • conGenerateCodeForClient
  • conGenerateKeywords
  • conGetAvailableMetaTagTypes
  • conGetCategoryArticleId
  • conGetCategoryAssignments
  • conGetContainerConfiguration
  • conGetContentFromArticle
  • conGetHtmlTranslationTable
  • conGetMetaValue
  • conGetTemplateConfigurationIdForArticle
  • conGetTemplateConfigurationIdForCategory
  • conGetTopmostCat
  • conGetUniqueArticleUrlname
  • conGetUsedModules
  • conHtmlentities
  • conHtmlEntityDecode
  • conHtmlSpecialChars
  • conIsArticleUrlnameUnique
  • conIsLocked
  • conLock
  • conLockBulkEditing
  • conMakeArticleIndex
  • conMakeCatOnline
  • conMakeInlineScript
  • conMakeOnline
  • conMakeOnlineBulkEditing
  • conMakePublic
  • conMakeStart
  • conMoveArticles
  • conPhp54Check
  • conRemoveOldCategoryArticle
  • conSaveContentEntry
  • conSetCodeFlag
  • conSetCodeFlagBulkEditing
  • conSetMetaValue
  • conSetStartArticle
  • consoleLog
  • conSyncArticle
  • copyRightsForElement
  • createBulkEditingFunction
  • createRandomName
  • createRightsForElement
  • cWarning
  • dbGetColumns
  • dbGetIndexes
  • dbGetPrimaryKeyName
  • dbTableExists
  • dbUpgradeTable
  • defineIfNotDefined
  • deleteArtspec
  • deleteRightsForElement
  • deleteSystemProperty
  • displayDatetime
  • emptyLogFile
  • endAndLogTiming
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • getAllClientsAndLanguages
  • getArtLang
  • getArtspec
  • getAvailableContentTypes
  • getCanonicalDay
  • getCanonicalMonth
  • getDirectorySize
  • getEffectiveSetting
  • getEffectiveSettingsByType
  • getEncodingByLanguage
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getJsHelpContext
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParentAreaId
  • getRightsList
  • getSearchResults
  • getStrExpandCollapseButton
  • getSystemProperties
  • getSystemPropertiesByType
  • getSystemProperty
  • getTemplateSelect
  • getUplExpandCollapseButton
  • htmldecode
  • htmlentities_iso88592
  • humanReadableSize
  • includePlugins
  • insertEmptyStrRow
  • ipMatch
  • isAlphanumeric
  • isArchive
  • isArtInMultipleUse
  • isFunctionDisabled
  • isGroup
  • isIPv4
  • isRunningFromWeb
  • isStartArticle
  • isUtf8
  • isValidMail
  • langActivateDeactivateLanguage
  • langDeleteLanguage
  • langEditLanguage
  • langGetTextDirection
  • langNewLanguage
  • langRenameLanguage
  • layDeleteLayout
  • layEditLayout
  • machineReadableSize
  • mailLogBulkEditingFunctions
  • mailLogDecodeAddresses
  • markSubMenuItem
  • mask
  • modDeleteModule
  • modEditModule
  • phpInfoToHtml
  • plugin_include
  • prCreateURLNameLocationString
  • prDeleteCacheFileContent
  • prGetCacheFileContent
  • prResolvePathViaCategoryNames
  • prResolvePathViaURLNames
  • prWriteCacheFileContent
  • recursiveCopy
  • removeFileInformation
  • renderBackendBreadcrumb
  • renderLabel
  • renderSelectProperty
  • renderTextProperty
  • saveGroupRights
  • saveRights
  • scanDirectory
  • scanPlugins
  • sendEncodingHeader
  • set_magic_quotes_gpc
  • setArtspecDefault
  • setArtspecOnline
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • strCheckAlias
  • strCheckTreeForErrors
  • strCopyCategory
  • strCopyTree
  • strDeeperCategoriesArray
  • strDeleteCategory
  • strHasArticles
  • strHasStartArticle
  • strMakePublic
  • strMakeVisible
  • strMoveCatTargetallowed
  • strMoveDownCategory
  • strMoveSubtree
  • strMoveUpCategory
  • strNewCategory
  • strNewTree
  • strNextBackwards
  • strNextDeeper
  • strNextDeeperAll
  • strNextPost
  • strOrderedPostTreeList
  • strRemakeTreeTable
  • strRenameCategory
  • strRenameCategoryAlias
  • strSortPrePost
  • strSyncCategory
  • systemHavePerm
  • tplAutoFillModules
  • tplBrowseLayoutForContainers
  • tplcfgDuplicate
  • tplDeleteTemplate
  • tplDuplicateTemplate
  • tplEditTemplate
  • tplGetContainerDefault
  • tplGetContainerMode
  • tplGetContainerName
  • tplGetContainerNumbersInLayout
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • tplProcessSendContainerConfiguration
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the backend page for search results in upload section.
  5:  *
  6:  * @package          Core
  7:  * @subpackage       Backend
  8:  * @author           Timo Hummel
  9:  * @copyright        four for business AG <www.4fb.de>
 10:  * @license          http://www.contenido.org/license/LIZENZ.txt
 11:  * @link             http://www.4fb.de
 12:  * @link             http://www.contenido.org
 13:  */
 14: 
 15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: cInclude('includes', 'api/functions.frontend.list.php');
 18: cInclude('includes', 'functions.upl.php');
 19: cInclude('includes', 'functions.file.php');
 20: 
 21: $appendparameters = $_REQUEST["appendparameters"];
 22: 
 23: /**
 24:  * Class UploadSearchResultList
 25:  */
 26: class UploadSearchResultList extends FrontendList {
 27:     /**
 28:      *
 29:      * @var string
 30:      */
 31:     private $_pathdata;
 32: 
 33:     /**
 34:      *
 35:      * @var string
 36:      */
 37:     private $_fileType;
 38: 
 39:     /**
 40:      *
 41:      * @var int
 42:      */
 43:     protected $_size;
 44: 
 45:     /**
 46:      * Field converting facility.
 47:      *
 48:      * @see FrontendList::convert()
 49:      *
 50:      * @param int $field
 51:      *         Field index
 52:      * @param     $data
 53:      *
 54:      * @return mixed
 55:      *
 56:      * @throws cDbException
 57:      * @throws cException
 58:      * @throws cInvalidArgumentException
 59:      */
 60:     public function convert($field, $data) {
 61:         global $cfg, $sess, $client, $cfgClient, $appendparameters;
 62: 
 63:         if ($field == 5) {
 64:             if ($data == "") {
 65:                 return i18n("None");
 66:             }
 67:         }
 68:         if ($field == 4) {
 69:             return humanReadableSize($data);
 70:         }
 71: 
 72:         if ($field == 3) {
 73:             if ($data == "") {
 74:                 return "&nbsp;";
 75:             } else {
 76:                 return $data;
 77:             }
 78:         }
 79: 
 80:         if ($field == 2) {
 81: 
 82:             // OK icon
 83:             $icon = "<img src=\"images/but_ok.gif\" alt=\"\" />&nbsp;";
 84: 
 85:             $vpath = str_replace($cfgClient[$client]["upl"]["path"], "", $this->_pathdata);
 86:             $slashpos = cString::findLastPos($vpath, "/");
 87:             if ($slashpos === false) {
 88:                 $file = $vpath;
 89:             } else {
 90:                 $path = cString::getPartOfString($vpath, 0, $slashpos + 1);
 91:                 $file = cString::getPartOfString($vpath, $slashpos + 1);
 92:             }
 93: 
 94:             if ($appendparameters == "imagebrowser" || $appendparameters == "filebrowser") {
 95:                 $mstr = '<a href="javascript://" onclick="javascript:Con.getFrame(\'left_top\').document.getElementById(\'selectedfile\').value= \'' . $cfgClient[$client]["upl"]["frontendpath"] . $path . $data . '\'; window.returnValue=\'' . $cfgClient[$client]["upl"]["frontendpath"] . $path . $data . '\'; window.close();">' . $icon . $data . '</a>';
 96:             } else if ('' !== $this->_fileType) {
 97:                 $markLeftPane = "Con.getFrame('left_bottom').upl.click(Con.getFrame('left_bottom').document.getElementById('$path'));";
 98: 
 99:                 $tmp_mstr = '<a onmouseover="this.style.cursor=\'pointer\'" href="javascript:Con.multiLink(\'%s\', \'%s\', \'%s\', \'%s\');' . $markLeftPane . '">%s</a>';
100:                 $mstr = sprintf($tmp_mstr, 'right_bottom', $sess->url("main.php?area=upl_edit&frame=4&path=$path&file=$file"), 'right_top', $sess->url("main.php?area=upl&frame=3&path=$path&file=$file"), $data);
101:             } else {
102:                 $markLeftPane = "Con.getFrame('left_bottom').upl.click(Con.getFrame('left_bottom').document.getElementById('$path'));";
103: 
104:                 $tmp_mstr = '<a onmouseover="this.style.cursor=\'pointer\'" href="javascript:Con.multiLink(\'%s\', \'%s\', \'%s\', \'%s\');' . $markLeftPane . '">%s</a>';
105:                 // concatinate path with folder name (file) for path parameter to access folder
106:                 $mstr = sprintf($tmp_mstr, 'right_bottom', $sess->url("main.php?area=upl&frame=4&path=$path$file/&file="), 'right_top', $sess->url("main.php?area=upl&frame=3&path=$path&file=$file"), $data);
107:             }
108:             return $mstr;
109:         }
110: 
111:         if ($field == 1) {
112:             $this->_pathdata = $data;
113: 
114:             // If this file is an image, try to open
115:             $this->_fileType = cString::toLowerCase(cFileHandler::getExtension($data));
116:             switch ($this->_fileType) {
117:                 case "png":
118:                 case "psd":
119:                 case "gif":
120:                 case "tiff":
121:                 case "bmp":
122:                 case "jpeg":
123:                 case "jpg":
124:                 case "iff":
125:                 case "xbm":
126:                 case "wbmp":
127:                     $frontendURL = cRegistry::getFrontendUrl();
128: 
129:                     $sCacheThumbnail = uplGetThumbnail($data, 150);
130:                     $sCacheName = cString::getPartOfString($sCacheThumbnail, cString::findLastPos($sCacheThumbnail, "/") + 1, cString::getStringLength($sCacheThumbnail) - (cString::findLastOccurrence($sCacheThumbnail, '/') + 1));
131:                     $sFullPath = $cfgClient[$client]['cache']['path'] . $sCacheName;
132:                     if (cFileHandler::exists($sFullPath)) {
133:                         $aDimensions = getimagesize($sFullPath);
134:                         $iWidth = $aDimensions[0];
135:                         $iHeight = $aDimensions[1];
136:                     } else {
137:                         $iWidth = 0;
138:                         $iHeight = 0;
139:                     }
140: 
141:                     if (cApiDbfs::isDbfs($data)) {
142:                         $retValue = '<a href="JavaScript:iZoom(\'' . $sess->url($frontendURL . "dbfs.php?file=" . $data) . '\');">
143:                                 <img class="hover" alt="" name="smallImage" src="' . $sCacheThumbnail . '">
144:                                 <img class="preview" alt="" name="prevImage" src="' . $sCacheThumbnail . '">
145:                             </a>';
146:                         return $retValue;
147:                     } else {
148:                         $retValue = '<a href="JavaScript:iZoom(\'' . $frontendURL . $cfgClient[$client]["upload"] . $data . '\');">
149:                                     <img class="hover" alt="" name="smallImage"  onMouseOver="correctPosition(this, ' . $iWidth . ', ' . $iHeight . ');" onmouseout="if (typeof(previewHideIe6) == \'function\') {previewHideIe6(this)}" src="' . $sCacheThumbnail . '">
150:                                     <img class="preview" alt="" name="prevImage" src="' . $sCacheThumbnail . '">
151:                                 </a>';
152:                         $retValue .= '<a href="JavaScript:iZoom(\'' . $frontendURL . $cfgClient[$client]["upload"] . $data . '\');"><img class="preview" alt="" name="prevImage" src="' . $sCacheThumbnail . '"></a>';
153:                         return $retValue;
154:                     }
155:                     break;
156:                 case '':
157:                     // folder has empty filetype column value
158:                     return '<img class="hover_none" name="smallImage" alt="" src="' . cRegistry::getBackendUrl() . 'images/grid_folder.gif' . '">';
159:                 default:
160:                     $sCacheThumbnail = uplGetThumbnail($data, 150);
161:                     return '<img class="hover_none" name="smallImage" alt="" src="' . $sCacheThumbnail . '">';
162:             }
163:         }
164: 
165:         return $data;
166:     }
167: 
168: 
169:     /**
170:      * @return int $size
171:      */
172:     public function getSize() {
173:         return $this->_size;
174:     }
175: 
176:     /**
177:      * @param int $size
178:      */
179:     public function setSize($size) {
180:         $this->_size = $size;
181:     }
182: }
183: 
184: if ($sortby == "") {
185:     $sortby = 7;
186:     $sortmode = "DESC";
187: }
188: 
189: if ($startpage == "") {
190:     $startpage = 1;
191: }
192: 
193: $thisfile = $sess->url("main.php?area=$area&frame=$frame&appendparameters=$appendparameters&searchfor=$searchfor&thumbnailmode=$thumbnailmode");
194: $scrollthisfile = $thisfile . "&sortmode=$sortmode&sortby=$sortby";
195: 
196: if ($sortby == 2 && $sortmode == "DESC") {
197:     $fnsort = '<a class="gray" href="' . $thisfile . '&sortby=2&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Filename / Description") . '<img src="images/sort_down.gif" alt="" border="0"></a>';
198: } else {
199:     if ($sortby == 2) {
200:         $fnsort = '<a class="gray" href="' . $thisfile . '&sortby=2&sortmode=DESC&startpage=' . $startpage . '">' . i18n("Filename / Description") . '<img src="images/sort_up.gif" alt="" border="0"></a>';
201:     } else {
202:         $fnsort = '<a class="gray" href="' . $thisfile . '&sortby=2&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Filename / Description") . '</a>';
203:     }
204: }
205: 
206: if ($sortby == 3 && $sortmode == "DESC") {
207:     $pathsort = '<a class="gray" href="' . $thisfile . '&sortby=3&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Path") . '<img src="images/sort_down.gif" alt="" border="0"></a>';
208: } else {
209:     if ($sortby == 3) {
210:         $pathsort = '<a class="gray" href="' . $thisfile . '&sortby=3&sortmode=DESC&startpage=' . $startpage . '">' . i18n("Path") . '<img src="images/sort_up.gif" alt="" border="0"></a>';
211:     } else {
212:         $pathsort = '<a class="gray" href="' . $thisfile . '&sortby=3&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Path") . "</a>";
213:     }
214: }
215: 
216: if ($sortby == 4 && $sortmode == "DESC") {
217:     $sizesort = '<a class="gray" href="' . $thisfile . '&sortby=4&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Size") . '<img src="images/sort_down.gif" alt="" border="0"></a>';
218: } else {
219:     if ($sortby == 4) {
220:         $sizesort = '<a class="gray" href="' . $thisfile . '&sortby=4&sortmode=DESC&startpage=' . $startpage . '">' . i18n("Size") . '<img src="images/sort_up.gif" alt="" border="0"></a>';
221:     } else {
222:         $sizesort = '<a class="gray" href="' . $thisfile . '&sortby=4&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Size") . "</a>";
223:     }
224: }
225: 
226: if ($sortby == 5 && $sortmode == "DESC") {
227:     $typesort = '<a class="gray" href="' . $thisfile . '&sortby=5&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Type") . '<img src="images/sort_down.gif" alt="" border="0"></a>';
228: } else {
229:     if ($sortby == 5) {
230:         $typesort = '<a class="gray" href="' . $thisfile . '&sortby=5&sortmode=DESC&startpage=' . $startpage . '">' . i18n("Type") . '<img src="images/sort_up.gif" alt="" border="0"></a>';
231:     } else {
232:         $typesort = '<a class="gray" href="' . $thisfile . '&sortby=5&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Type") . "</a>";
233:     }
234: }
235: 
236: if ($sortby == 6 && $sortmode == "DESC") {
237:     $srelevance = '<a class="gray" href="' . $thisfile . '&sortby=6&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Relevance") . '<img src="images/sort_down.gif" alt="" border="0"></a>';
238: } else {
239:     if ($sortby == 6) {
240:         $srelevance = '<a class="gray" href="' . $thisfile . '&sortby=6&sortmode=DESC&startpage=' . $startpage . '">' . i18n("Relevance") . '<img src="images/sort_up.gif" alt="" border="0"></a>';
241:     } else {
242:         $srelevance = '<a class="gray" href="' . $thisfile . '&sortby=6&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Relevance") . "</a>";
243:     }
244: }
245: 
246: $sToolsRow = '<tr class="textg_medium">
247:                   <th colspan="6" id="cat_navbar">
248:                       <div class="toolsRight">' . i18n("Searched for:") . " " . $searchfor . '</div>
249:                   </th>
250:               </tr>';
251: 
252: // List wraps
253: 
254: $sSpacedRow = '<tr height="10">
255:                     <td colspan="6" class="emptyCell"></td>
256:                </tr>';
257: 
258: $pagerwrap = '<tr>
259:                 <th colspan="6" id="cat_navbar" class="vAlignMiddle">
260:                     <div class="toolsRight">
261:                         <div class="vAlignMiddle">-C-SCROLLLEFT-</div>
262:                         <div class="vAlignMiddle">-C-PAGE-</div>
263:                         <div class="vAlignMiddle">-C-SCROLLRIGHT-</div>
264:                     </div>
265:                     ' . i18n("Files per Page") . ' -C-FILESPERPAGE-
266:                 </th>
267:             </tr>';
268: 
269: $startwrap = '<table class="hoverbox generic" cellspacing="0" cellpadding="2" border="0">
270:                 ' . $pagerwrap . $sSpacedRow . $sToolsRow . $sSpacedRow . '
271:                <tr>
272:                     <th>' . i18n("Preview") . '</th>
273:                     <th width="100%">' . $fnsort . '</th>
274:                     <th>' . $pathsort . '</th>
275:                     <th>' . $sizesort . '</th>
276:                     <th>' . $typesort . '</th>
277:                     <th>' . $srelevance . '</th>
278:                 </tr>';
279: $itemwrap = '<tr>
280:                     <td align="center">%s</td>
281:                     <td class="vAlignTop nowrap">%s</td>
282:                     <td class="vAlignTop nowrap">%s</td>
283:                     <td class="vAlignTop nowrap">%s</td>
284:                     <td class="vAlignTop nowrap">%s</td>
285:                     <td class="vAlignTop nowrap">%s</td>
286:                 </tr>';
287: $endwrap = $sSpacedRow . $sToolsRow . $sSpacedRow . $pagerwrap . '</table>';
288: 
289: // Object initializing
290: $page = new cGuiPage("upl_search_results");
291: $list2 = new UploadSearchResultList($startwrap, $endwrap, $itemwrap);
292: 
293: $uploads = new cApiUploadCollection();
294: 
295: // Fetch data
296: $files = uplSearch($searchfor);
297: 
298: if ($thumbnailmode == '') {
299:     $current_mode = $currentuser->getUserProperty('upload_folder_thumbnailmode', md5('search_results_num_per_page'));
300:     if ($current_mode != '') {
301:         $thumbnailmode = $current_mode;
302:     } else {
303:         $thumbnailmode = getEffectiveSetting('backend', 'thumbnailmode', 100);
304:     }
305: }
306: 
307: switch ($thumbnailmode) {
308:     case 25:
309:         $numpics = 25;
310:         break;
311:     case 50:
312:         $numpics = 50;
313:         break;
314:     case 100:
315:         $numpics = 100;
316:         break;
317:     case 200:
318:         $numpics = 200;
319:         break;
320:     default:
321:         $thumbnailmode = 100;
322:         $numpics = 15;
323:         break;
324: }
325: 
326: $currentuser->setUserProperty('upload_folder_thumbnailmode', md5('search_results_num_per_page'), $thumbnailmode);
327: 
328: $list2->setResultsPerPage($numpics);
329: 
330: $list2->setSize($thumbnailmode);
331: 
332: $rownum = 0;
333: if (!is_array($files)) {
334:     $files = array();
335: }
336: 
337: arsort($files, SORT_NUMERIC);
338: 
339: foreach ($files as $idupl => $rating) {
340:     $upl = new cApiUpload($idupl);
341: 
342:     $filename = $upl->get('filename');
343:     $dirname = $upl->get('dirname');
344:     $fullDirname = $cfgClient[$client]["upl"]["path"] . $upl->get('dirname');
345: 
346:     $filesize = $upl->get('size');
347:     if ($filesize == 0 && cFileHandler::exists($fullDirname . $filename)) {
348:         $filesize = filesize($fullDirname . $filename);
349:         $upl->set('size', $filesize);
350:         $upl->store();
351:     }
352:     $description = $upl->get('description');
353: 
354:     $fileType = cString::toLowerCase(cFileHandler::getExtension($filename));
355:     $list2->setData($rownum, $dirname . $filename, $filename, $dirname, $filesize, $fileType, $rating / 10, $dirname . $filename);
356: 
357:     $rownum++;
358: }
359: 
360: if ($rownum == 0) {
361:     $page->displayWarning(i18n("No files found"));
362:     $page->abortRendering();
363:     $page->render();
364:     return;
365: }
366: 
367: if ($sortmode == "ASC") {
368:     $list2->sort($sortby, SORT_ASC);
369: } else {
370:     $list2->sort($sortby, SORT_DESC);
371: }
372: 
373: if ($startpage < 1) {
374:     $startpage = 1;
375: }
376: 
377: if ($startpage > $list2->getNumPages()) {
378:     $startpage = $list2->getNumPages();
379: }
380: 
381: $list2->setListStart($startpage);
382: 
383: // Create scroller
384: if ($list2->getCurrentPage() > 1) {
385:     $prevpage = '<a href="' . $scrollthisfile . '&startpage=' . ($list2->getCurrentPage() - 1) . '" class="invert_hover">' . i18n("Previous Page") . '</a>';
386: } else {
387:     $nextpage = '&nbsp;';
388: }
389: 
390: if ($list2->getCurrentPage() < $list2->getNumPages()) {
391:     $nextpage = '<a href="' . $scrollthisfile . '&startpage=' . ($list2->getCurrentPage() + 1) . '" class="invert_hover">' . i18n("Next Page") . '</a>';
392: } else {
393:     $nextpage = '&nbsp;';
394: }
395: 
396: if ($list2->getNumPages() > 1) {
397:     $num_pages = $list2->getNumPages();
398: 
399:     $paging_form .= "<script type=\"text/javascript\">
400:         function jumpToPage(select) {
401:             var pagenumber = select.selectedIndex + 1;
402:             url = '" . $sess->url("main.php?area=$area&frame=$frame&appendparameters=$appendparameters&searchfor=$searchfor&thumbnailmode=$thumbnailmode") . "';
403:             document.location.href = url + '&startpage=' + pagenumber;
404:         }
405:     </script>";
406:     $paging_form .= "<select name=\"start_page\" class=\"text_medium\" onChange=\"jumpToPage(this);\">";
407:     for ($i = 1; $i <= $num_pages; $i++) {
408:         if ($i == $startpage) {
409:             $selected = " selected";
410:         } else {
411:             $selected = "";
412:         }
413:         $paging_form .= "<option value=\"$i\"$selected>$i</option>";
414:     }
415: 
416:     $paging_form .= "</select>";
417: } else {
418:     $paging_form = "1";
419: }
420: 
421: $curpage = $paging_form . " / " . $list2->getNumPages();
422: 
423: $scroller = $prevpage . $nextpage;
424: 
425: $output = $list2->output(true);
426: 
427: $output = str_replace("-C-SCROLLLEFT-", $prevpage, $output);
428: $output = str_replace("-C-SCROLLRIGHT-", $nextpage, $output);
429: $output = str_replace("-C-PAGE-", i18n("Page") . " " . $curpage, $output);
430: $output = str_replace("-C-THUMBNAILMODE-", $thumbnailmode, $output);
431: 
432: $form = new cHTMLForm("options");
433: $form->setVar("contenido", $sess->id);
434: $form->setVar("area", $area);
435: $form->setVar("frame", $frame);
436: $form->setVar("searchfor", $searchfor);
437: $form->setVar("sortmode", $sortmode);
438: $form->setVar("sortby", $sortby);
439: $form->setVar("startpage", $startpage);
440: $form->setVar("appendparameters", $appendparameters);
441: 
442: $select = new cHTMLSelectElement("thumbnailmode");
443: $select->setClass("vAlignMiddle tableElement");
444: $values = array(
445:     25 => "25",
446:     50 => "50",
447:     100 => "100",
448:     200 => "200"
449: );
450: 
451: $select->autoFill($values);
452: 
453: $select->setDefault($thumbnailmode);
454: $select->setEvent('change', "if (document.options.thumbnailmode[0] != 'undefined') document.options.thumbnailmode[0].value = this.value; if (document.options.thumbnailmode[1] != 'undefined') document.options.thumbnailmode[1].value = this.value;");
455: 
456: $topbar = $select->render() . '<input type="image" onmouseover="this.style.cursor=\'pointer\'" src="images/submit.gif" class="vAlignMiddle tableElement">';
457: 
458: $output = str_replace("-C-FILESPERPAGE-", $topbar, $output);
459: 
460: $page->addScript($sess->url("iZoom.js.php"));
461: 
462: $form->appendContent($output);
463: $page->set("s", "FORM", $form->render());
464: $page->render();
465: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0