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
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • 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
  • 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
  • conGetUsedModules
  • conHtmlentities
  • conHtmlEntityDecode
  • conHtmlSpecialChars
  • conIsLocked
  • conLock
  • conLockBulkEditing
  • conMakeArticleIndex
  • conMakeCatOnline
  • conMakeInlineScript
  • conMakeOnline
  • conMakeOnlineBulkEditing
  • conMakePublic
  • conMakeStart
  • conMoveArticles
  • conPhp54Check
  • conRemoveOldCategoryArticle
  • conSaveContentEntry
  • conSetCodeFlag
  • conSetCodeFlagBulkEditing
  • conSetMetaValue
  • 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
  • getFileContents
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getJsHelpContext
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParam
  • getParentAreaId
  • 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
  • putFileContents
  • 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
  • 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:  *
 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:      * @param int $field
 50:      *         Field index
 51:      * @param mixed $value
 52:      *         Field value
 53:      * @return mixed
 54:      */
 55:     public function convert($field, $data) {
 56:         global $cfg, $sess, $client, $cfgClient, $appendparameters;
 57: 
 58:         if ($field == 5) {
 59:             if ($data == "") {
 60:                 return i18n("None");
 61:             }
 62:         }
 63:         if ($field == 4) {
 64:             return humanReadableSize($data);
 65:         }
 66: 
 67:         if ($field == 3) {
 68:             if ($data == "") {
 69:                 return "&nbsp;";
 70:             } else {
 71:                 return $data;
 72:             }
 73:         }
 74: 
 75:         if ($field == 2) {
 76: 
 77:             // OK icon
 78:             $icon = "<img src=\"images/but_ok.gif\" alt=\"\" />&nbsp;";
 79: 
 80:             $vpath = str_replace($cfgClient[$client]["upl"]["path"], "", $this->_pathdata);
 81:             $slashpos = strrpos($vpath, "/");
 82:             if ($slashpos === false) {
 83:                 $file = $vpath;
 84:             } else {
 85:                 $path = substr($vpath, 0, $slashpos + 1);
 86:                 $file = substr($vpath, $slashpos + 1);
 87:             }
 88: 
 89:             if ($appendparameters == "imagebrowser" || $appendparameters == "filebrowser") {
 90:                 $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>';
 91:             } else if ('' !== $this->_fileType) {
 92:                 $markLeftPane = "Con.getFrame('left_bottom').upl.click(Con.getFrame('left_bottom').document.getElementById('$path'));";
 93: 
 94:                 $tmp_mstr = '<a onmouseover="this.style.cursor=\'pointer\'" href="javascript:Con.multiLink(\'%s\', \'%s\', \'%s\', \'%s\');' . $markLeftPane . '">%s</a>';
 95:                 $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);
 96:             } else {
 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:                 // concatinate path with folder name (file) for path parameter to access folder
101:                 $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);
102:             }
103:             return $mstr;
104:         }
105: 
106:         if ($field == 1) {
107:             $this->_pathdata = $data;
108: 
109:             // If this file is an image, try to open
110:             $this->_fileType = strtolower(cFileHandler::getExtension($data));
111:             switch ($this->_fileType) {
112:                 case "png":
113:                 case "psd":
114:                 case "gif":
115:                 case "tiff":
116:                 case "bmp":
117:                 case "jpeg":
118:                 case "jpg":
119:                 case "iff":
120:                 case "xbm":
121:                 case "wbmp":
122:                     $frontendURL = cRegistry::getFrontendUrl();
123: 
124:                     $sCacheThumbnail = uplGetThumbnail($data, 150);
125:                     $sCacheName = substr($sCacheThumbnail, strrpos($sCacheThumbnail, "/") + 1, strlen($sCacheThumbnail) - (strrchr($sCacheThumbnail, '/') + 1));
126:                     $sFullPath = $cfgClient[$client]['cache']['path'] . $sCacheName;
127:                     if (cFileHandler::exists($sFullPath)) {
128:                         $aDimensions = getimagesize($sFullPath);
129:                         $iWidth = $aDimensions[0];
130:                         $iHeight = $aDimensions[1];
131:                     } else {
132:                         $iWidth = 0;
133:                         $iHeight = 0;
134:                     }
135: 
136:                     if (cApiDbfs::isDbfs($data)) {
137:                         $retValue = '<a href="JavaScript:iZoom(\'' . $sess->url($frontendURL . "dbfs.php?file=" . $data) . '\');">
138:                                 <img class="hover" alt="" name="smallImage" src="' . $sCacheThumbnail . '">
139:                                 <img class="preview" alt="" name="prevImage" src="' . $sCacheThumbnail . '">
140:                             </a>';
141:                         return $retValue;
142:                     } else {
143:                         $retValue = '<a href="JavaScript:iZoom(\'' . $frontendURL . $cfgClient[$client]["upload"] . $data . '\');">
144:                                     <img class="hover" alt="" name="smallImage"  onMouseOver="correctPosition(this, ' . $iWidth . ', ' . $iHeight . ');" onmouseout="if (typeof(previewHideIe6) == \'function\') {previewHideIe6(this)}" src="' . $sCacheThumbnail . '">
145:                                     <img class="preview" alt="" name="prevImage" src="' . $sCacheThumbnail . '">
146:                                 </a>';
147:                         $retValue .= '<a href="JavaScript:iZoom(\'' . $frontendURL . $cfgClient[$client]["upload"] . $data . '\');"><img class="preview" alt="" name="prevImage" src="' . $sCacheThumbnail . '"></a>';
148:                         return $retValue;
149:                     }
150:                     break;
151:                 case '':
152:                     // folder has empty filetype column value
153:                     return '<img class="hover_none" name="smallImage" alt="" src="' . cRegistry::getBackendUrl() . 'images/grid_folder.gif' . '">';
154:                 default:
155:                     $sCacheThumbnail = uplGetThumbnail($data, 150);
156:                     return '<img class="hover_none" name="smallImage" alt="" src="' . $sCacheThumbnail . '">';
157:             }
158:         }
159: 
160:         return $data;
161:     }
162: 
163: 
164:     /**
165:      * @return int $size
166:      */
167:     public function getSize() {
168:         return $this->_size;
169:     }
170: 
171:     /**
172:      * @param int $size
173:      */
174:     public function setSize($size) {
175:         $this->_size = $size;
176:     }
177: 
178: }
179: 
180: if ($sortby == "") {
181:     $sortby = 7;
182:     $sortmode = "DESC";
183: }
184: 
185: if ($startpage == "") {
186:     $startpage = 1;
187: }
188: 
189: $thisfile = $sess->url("main.php?area=$area&frame=$frame&appendparameters=$appendparameters&searchfor=$searchfor&thumbnailmode=$thumbnailmode");
190: $scrollthisfile = $thisfile . "&sortmode=$sortmode&sortby=$sortby";
191: 
192: if ($sortby == 2 && $sortmode == "DESC") {
193:     $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>';
194: } else {
195:     if ($sortby == 2) {
196:         $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>';
197:     } else {
198:         $fnsort = '<a class="gray" href="' . $thisfile . '&sortby=2&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Filename / Description") . '</a>';
199:     }
200: }
201: 
202: if ($sortby == 3 && $sortmode == "DESC") {
203:     $pathsort = '<a class="gray" href="' . $thisfile . '&sortby=3&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Path") . '<img src="images/sort_down.gif" alt="" border="0"></a>';
204: } else {
205:     if ($sortby == 3) {
206:         $pathsort = '<a class="gray" href="' . $thisfile . '&sortby=3&sortmode=DESC&startpage=' . $startpage . '">' . i18n("Path") . '<img src="images/sort_up.gif" alt="" border="0"></a>';
207:     } else {
208:         $pathsort = '<a class="gray" href="' . $thisfile . '&sortby=3&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Path") . "</a>";
209:     }
210: }
211: 
212: if ($sortby == 4 && $sortmode == "DESC") {
213:     $sizesort = '<a class="gray" href="' . $thisfile . '&sortby=4&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Size") . '<img src="images/sort_down.gif" alt="" border="0"></a>';
214: } else {
215:     if ($sortby == 4) {
216:         $sizesort = '<a class="gray" href="' . $thisfile . '&sortby=4&sortmode=DESC&startpage=' . $startpage . '">' . i18n("Size") . '<img src="images/sort_up.gif" alt="" border="0"></a>';
217:     } else {
218:         $sizesort = '<a class="gray" href="' . $thisfile . '&sortby=4&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Size") . "</a>";
219:     }
220: }
221: 
222: if ($sortby == 5 && $sortmode == "DESC") {
223:     $typesort = '<a class="gray" href="' . $thisfile . '&sortby=5&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Type") . '<img src="images/sort_down.gif" alt="" border="0"></a>';
224: } else {
225:     if ($sortby == 5) {
226:         $typesort = '<a class="gray" href="' . $thisfile . '&sortby=5&sortmode=DESC&startpage=' . $startpage . '">' . i18n("Type") . '<img src="images/sort_up.gif" alt="" border="0"></a>';
227:     } else {
228:         $typesort = '<a class="gray" href="' . $thisfile . '&sortby=5&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Type") . "</a>";
229:     }
230: }
231: 
232: if ($sortby == 6 && $sortmode == "DESC") {
233:     $srelevance = '<a class="gray" href="' . $thisfile . '&sortby=6&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Relevance") . '<img src="images/sort_down.gif" alt="" border="0"></a>';
234: } else {
235:     if ($sortby == 6) {
236:         $srelevance = '<a class="gray" href="' . $thisfile . '&sortby=6&sortmode=DESC&startpage=' . $startpage . '">' . i18n("Relevance") . '<img src="images/sort_up.gif" alt="" border="0"></a>';
237:     } else {
238:         $srelevance = '<a class="gray" href="' . $thisfile . '&sortby=6&sortmode=ASC&startpage=' . $startpage . '">' . i18n("Relevance") . "</a>";
239:     }
240: }
241: 
242: $sToolsRow = '<tr class="textg_medium">
243:                   <th colspan="6" id="cat_navbar">
244:                       <div class="toolsRight">' . i18n("Searched for:") . " " . $searchfor . '</div>
245:                   </th>
246:               </tr>';
247: 
248: // List wraps
249: 
250: $sSpacedRow = '<tr height="10">
251:                     <td colspan="6" class="emptyCell"></td>
252:                </tr>';
253: 
254: $pagerwrap = '<tr>
255:                 <th colspan="6" id="cat_navbar" class="vAlignMiddle">
256:                     <div class="toolsRight">
257:                         <div class="vAlignMiddle">-C-SCROLLLEFT-</div>
258:                         <div class="vAlignMiddle">-C-PAGE-</div>
259:                         <div class="vAlignMiddle">-C-SCROLLRIGHT-</div>
260:                     </div>
261:                     ' . i18n("Files per Page") . ' -C-FILESPERPAGE-
262:                 </th>
263:             </tr>';
264: 
265: $startwrap = '<table class="hoverbox generic" cellspacing="0" cellpadding="2" border="0">
266:                 ' . $pagerwrap . $sSpacedRow . $sToolsRow . $sSpacedRow . '
267:                <tr>
268:                     <th>' . i18n("Preview") . '</th>
269:                     <th width="100%">' . $fnsort . '</th>
270:                     <th>' . $pathsort . '</th>
271:                     <th>' . $sizesort . '</th>
272:                     <th>' . $typesort . '</th>
273:                     <th>' . $srelevance . '</th>
274:                 </tr>';
275: $itemwrap = '<tr>
276:                     <td align="center">%s</td>
277:                     <td class="vAlignTop nowrap">%s</td>
278:                     <td class="vAlignTop nowrap">%s</td>
279:                     <td class="vAlignTop nowrap">%s</td>
280:                     <td class="vAlignTop nowrap">%s</td>
281:                     <td class="vAlignTop nowrap">%s</td>
282:                 </tr>';
283: $endwrap = $sSpacedRow . $sToolsRow . $sSpacedRow . $pagerwrap . '</table>';
284: 
285: // Object initializing
286: $page = new cGuiPage("upl_search_results");
287: $list2 = new UploadSearchResultList($startwrap, $endwrap, $itemwrap);
288: 
289: $uploads = new cApiUploadCollection();
290: 
291: // Fetch data
292: $files = uplSearch($searchfor);
293: 
294: if ($thumbnailmode == '') {
295:     $current_mode = $currentuser->getUserProperty('upload_folder_thumbnailmode', md5('search_results_num_per_page'));
296:     if ($current_mode != '') {
297:         $thumbnailmode = $current_mode;
298:     } else {
299:         $thumbnailmode = getEffectiveSetting('backend', 'thumbnailmode', 100);
300:     }
301: }
302: 
303: switch ($thumbnailmode) {
304:     case 25:
305:         $numpics = 25;
306:         break;
307:     case 50:
308:         $numpics = 50;
309:         break;
310:     case 100:
311:         $numpics = 100;
312:         break;
313:     case 200:
314:         $numpics = 200;
315:         break;
316:     default:
317:         $thumbnailmode = 100;
318:         $numpics = 15;
319:         break;
320: }
321: 
322: $currentuser->setUserProperty('upload_folder_thumbnailmode', md5('search_results_num_per_page'), $thumbnailmode);
323: 
324: $list2->setResultsPerPage($numpics);
325: 
326: $list2->setSize($thumbnailmode);
327: 
328: $rownum = 0;
329: if (!is_array($files)) {
330:     $files = array();
331: }
332: 
333: arsort($files, SORT_NUMERIC);
334: 
335: foreach ($files as $idupl => $rating) {
336:     $upl = new cApiUpload($idupl);
337: 
338:     $filename = $upl->get('filename');
339:     $dirname = $upl->get('dirname');
340:     $fullDirname = $cfgClient[$client]["upl"]["path"] . $upl->get('dirname');
341: 
342:     $filesize = $upl->get('size');
343:     if ($filesize == 0 && cFileHandler::exists($fullDirname . $filename)) {
344:         $filesize = filesize($fullDirname . $filename);
345:         $upl->set('size', $filesize);
346:         $upl->store();
347:     }
348:     $description = $upl->get('description');
349: 
350:     $fileType = strtolower(cFileHandler::getExtension($filename));
351:     $list2->setData($rownum, $dirname . $filename, $filename, $dirname, $filesize, $fileType, $rating / 10, $dirname . $filename);
352: 
353:     $rownum++;
354: }
355: 
356: if ($rownum == 0) {
357:     $page->displayWarning(i18n("No files found"));
358:     $page->abortRendering();
359:     $page->render();
360:     return;
361: }
362: 
363: if ($sortmode == "ASC") {
364:     $list2->sort($sortby, SORT_ASC);
365: } else {
366:     $list2->sort($sortby, SORT_DESC);
367: }
368: 
369: if ($startpage < 1) {
370:     $startpage = 1;
371: }
372: 
373: if ($startpage > $list2->getNumPages()) {
374:     $startpage = $list2->getNumPages();
375: }
376: 
377: $list2->setListStart($startpage);
378: 
379: // Create scroller
380: if ($list2->getCurrentPage() > 1) {
381:     $prevpage = '<a href="' . $scrollthisfile . '&startpage=' . ($list2->getCurrentPage() - 1) . '" class="invert_hover">' . i18n("Previous Page") . '</a>';
382: } else {
383:     $nextpage = '&nbsp;';
384: }
385: 
386: if ($list2->getCurrentPage() < $list2->getNumPages()) {
387:     $nextpage = '<a href="' . $scrollthisfile . '&startpage=' . ($list2->getCurrentPage() + 1) . '" class="invert_hover">' . i18n("Next Page") . '</a>';
388: } else {
389:     $nextpage = '&nbsp;';
390: }
391: 
392: if ($list2->getNumPages() > 1) {
393:     $num_pages = $list2->getNumPages();
394: 
395:     $paging_form .= "<script type=\"text/javascript\">
396:         function jumpToPage(select) {
397:             var pagenumber = select.selectedIndex + 1;
398:             url = '" . $sess->url("main.php?area=$area&frame=$frame&appendparameters=$appendparameters&searchfor=$searchfor&thumbnailmode=$thumbnailmode") . "';
399:             document.location.href = url + '&startpage=' + pagenumber;
400:         }
401:     </script>";
402:     $paging_form .= "<select name=\"start_page\" class=\"text_medium\" onChange=\"jumpToPage(this);\">";
403:     for ($i = 1; $i <= $num_pages; $i++) {
404:         if ($i == $startpage) {
405:             $selected = " selected";
406:         } else {
407:             $selected = "";
408:         }
409:         $paging_form .= "<option value=\"$i\"$selected>$i</option>";
410:     }
411: 
412:     $paging_form .= "</select>";
413: } else {
414:     $paging_form = "1";
415: }
416: 
417: $curpage = $paging_form . " / " . $list2->getNumPages();
418: 
419: $scroller = $prevpage . $nextpage;
420: 
421: $output = $list2->output(true);
422: 
423: $output = str_replace("-C-SCROLLLEFT-", $prevpage, $output);
424: $output = str_replace("-C-SCROLLRIGHT-", $nextpage, $output);
425: $output = str_replace("-C-PAGE-", i18n("Page") . " " . $curpage, $output);
426: $output = str_replace("-C-THUMBNAILMODE-", $thumbnailmode, $output);
427: 
428: $form = new cHTMLForm("options");
429: $form->setVar("contenido", $sess->id);
430: $form->setVar("area", $area);
431: $form->setVar("frame", $frame);
432: $form->setVar("searchfor", $searchfor);
433: $form->setVar("sortmode", $sortmode);
434: $form->setVar("sortby", $sortby);
435: $form->setVar("startpage", $startpage);
436: $form->setVar("appendparameters", $appendparameters);
437: 
438: $select = new cHTMLSelectElement("thumbnailmode");
439: $select->setClass("vAlignMiddle tableElement");
440: $values = array(
441:     25 => "25",
442:     50 => "50",
443:     100 => "100",
444:     200 => "200"
445: );
446: 
447: $select->autoFill($values);
448: 
449: $select->setDefault($thumbnailmode);
450: $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;");
451: 
452: $topbar = $select->render() . '<input type="image" onmouseover="this.style.cursor=\'pointer\'" src="images/submit.gif" class="vAlignMiddle tableElement">';
453: 
454: $output = str_replace("-C-FILESPERPAGE-", $topbar, $output);
455: 
456: $page->addScript($sess->url("iZoom.js.php"));
457: 
458: $form->appendContent($output);
459: $page->set("s", "FORM", $form->render());
460: $page->render();
461: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0