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 module search class.
  5:  * TODO: Rework comments of this class.
  6:  *
  7:  * @package    Core
  8:  * @subpackage Backend
  9:  * @version    SVN Revision $Rev:$
 10:  *
 11:  * @author     Rusmir Jusufovic
 12:  * @copyright  four for business AG <www.4fb.de>
 13:  * @license    http://www.contenido.org/license/LIZENZ.txt
 14:  * @link       http://www.4fb.de
 15:  * @link       http://www.contenido.org
 16:  */
 17: 
 18: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 19: 
 20: /**
 21:  * This class performs the module search.
 22:  *
 23:  * @package    Core
 24:  * @subpackage Backend
 25:  */
 26: class cModuleSearch extends cModuleHandler {
 27: 
 28:     /**
 29:      * Items/Element per page
 30:      *
 31:      * @var int
 32:      */
 33:     protected $_elementPerPage = '';
 34: 
 35:     /**
 36:      * Order by
 37:      *
 38:      * @var string
 39:      */
 40:     protected $_orderBy = '';
 41: 
 42:     /**
 43:      * Sort order
 44:      *
 45:      * @var string
 46:      */
 47:     protected $_sortOrder = '';
 48: 
 49:     /**
 50:      * Module type
 51:      *
 52:      * @var string
 53:      */
 54:     protected $_moduleType = '';
 55: 
 56:     /**
 57:      * Filter string
 58:      *
 59:      * @var string
 60:      */
 61:     protected $_filter = '';
 62: 
 63:     /**
 64:      * Where should be searched (all, description, type, input, output)
 65:      *
 66:      * @var string
 67:      */
 68:     protected $_searchIn = '';
 69: 
 70:     /**
 71:      * Selected page
 72:      *
 73:      * @var int
 74:      */
 75:     protected $_selectedPage = 1;
 76: 
 77:     /**
 78:      * Result saved in a array
 79:      *
 80:      * @var array
 81:      */
 82:     protected $_result = array();
 83: 
 84:     /**
 85:      * Print a array
 86:      *
 87:      * @param array $arg
 88:      */
 89:     private function _echo($arg) {
 90:         echo '<pre>' . print_r($arg) . '</pre>';
 91:     }
 92: 
 93:     /**
 94:      *
 95:      * @param array $searchOptions
 96:      */
 97:     public function __construct($searchOptions) {
 98:         parent::__construct();
 99: 
100:         $this->_elementPerPage = $searchOptions['elementPerPage'];
101:         $this->_orderBy = $searchOptions['orderBy'];
102:         $this->_sortOrder = $searchOptions['sortOrder'];
103:         $this->_moduleType = $searchOptions['moduleType'];
104:         $this->_filter = $searchOptions['filter'];
105:         $this->_searchIn = $searchOptions['searchIn'];
106:         $this->_selectedPage = $searchOptions['selectedPage'];
107:     }
108: 
109:     /**
110:      * Count result
111:      *
112:      * @return int
113:      *         count in result
114:      */
115:     public function getModulCount() {
116:         return count($this->_result);
117:     }
118: 
119:     /**
120:      * Search for modules in db columns and in filesystem (input and output
121:      * files)
122:      *
123:      * @return array
124:      *         result
125:      */
126:     public function searchForAllModules() {
127:         global $cfg, $client;
128: 
129:         $idClient = $client;
130:         // first fetch all modules for client
131:         // then apply _filter on input and output from files
132:         // then use the whitelisted id's and search for additional filter matches on database
133:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s", $cfg['tab']['mod'], $idClient);
134: 
135: 
136:         $db = cRegistry::getDb();
137:         $db->query($sql);
138:         $moduleIds = array();
139: 
140:         // filter modules based on input and output
141:         while (($modul = $db->nextRecord()) !== false) {
142:             $this->initWithDatabaseRow($db);
143:             if (strlen(stripslashes($this->_filter)) === 0
144:                     || strpos($this->readInput(), stripslashes($this->_filter)) !== false
145:                     || strpos($this->readOutput(), stripslashes($this->_filter)) !== false) {
146:                     $moduleIds[] = $db->f('idmod');
147:             }
148:         }
149: 
150:         // build query using whitelisted id's
151:         $idFilter = "";
152:         foreach ($moduleIds as $moduleId) {
153:             $idFilter .= " OR idmod=" . (int) $moduleId;
154:         }
155:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s AND (
156:                             type LIKE '%s'
157:                             AND type LIKE '%s'
158:                             OR description LIKE '%s'
159:                             OR name LIKE  '%s'" . $idFilter . ")
160:                             ORDER BY %s %s", $cfg['tab']['mod'], $idClient, $this->_moduleType, '%' . $this->_filter . '%', '%' . $this->_filter . '%', '%' . $this->_filter . '%', $this->_orderBy, $this->_sortOrder);
161: 
162:         $db = cRegistry::getDb();
163:         $db->query($sql);
164:         $result = array();
165: 
166:         while (($modul = $db->nextRecord()) !== false) {
167:             $this->initWithDatabaseRow($db);
168:             $result[$db->f('idmod')] = array(
169:                     'name' => $db->f('name'),
170:                     'description' => $db->f('description'),
171:                     'error' => $db->f('error'),
172:                     'input' => $this->readInput(),
173:                     'output' => $this->readOutput()
174:             );
175:         }
176: 
177:         return $result;
178:     }
179: 
180:     /**
181:      * Main method for the class. Search for modules in db and in input and
182:      * outputs files.
183:      *
184:      * @return array
185:      *         result
186:      */
187:     public function getModules() {
188:         $modules = array();
189: 
190:         switch ($this->_searchIn) {
191:             case 'all':
192:                 $modules = $this->searchForAllModules();
193:                 break;
194:             case 'name':
195:                 $modules = $this->findeModulWithName();
196:                 break;
197:             case 'description':
198:                 $modules = $this->findModuleWithDescription();
199:                 break;
200:             case 'type':
201:                 $modules = $this->findModuleWithType();
202:                 break;
203:             case 'input': // Search for modulname_input.php
204:                 $modules = $this->findModulWithInput();
205:                 break;
206:             case 'output': // Search fro modulname_output.php
207:                 $modules = $this->findModulWithOutput();
208:                 break;
209:         }
210: 
211:         $this->_result = $modules;
212:         if ($this->_elementPerPage > 0) {
213:             if (count($this->_result) < (($this->_page - 1) * $this->_elementPerPage)) {
214:                 $this->_page = 1;
215:             }
216: 
217:             if ($this->_elementPerPage * ($this->_page) >= count($this->_result) + $this->_elementPerPage && $this->_page != 1) {
218:                 $this->_page--;
219:             }
220:             return array_slice($modules, $this->_elementPerPage * ($this->_selectedPage - 1), $this->_elementPerPage, true);
221:         } else {
222:             return $modules;
223:         }
224:     }
225: 
226:     /**
227:      * Search for modules in "name" column of modul
228:      *
229:      * @return array
230:      *         result
231:      */
232:     public function findeModulWithName() {
233:         global $cfg, $client;
234:         $idClient = $client;
235: 
236:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s AND (type LIKE '%s' AND name LIKE '%s')
237:                         ORDER BY %s %s ", $cfg['tab']['mod'], $idClient, $this->_moduleType, '%' . $this->_filter . '%', $this->_orderBy, $this->_sortOrder);
238: 
239:         $db = cRegistry::getDb();
240:         $db->query($sql);
241:         $result = array();
242: 
243:         while (($module = $db->nextRecord()) !== false) {
244:             $this->initWithDatabaseRow($db);
245:             $result[$db->f('idmod')] = array(
246:                     'name' => $db->f('name'),
247:                     'description' => $db->f('description'),
248:                     'error' => $db->f('error'),
249:                     'input' => $this->readInput(),
250:                     'output' => $this->readOutput()
251:             );
252:         }
253:         return $result;
254:     }
255: 
256:     /**
257:      * Search for modules in input file of the module
258:      *
259:      * @return array
260:      *         result
261:      */
262:     public function findModulWithInput() {
263:         global $cfg, $client;
264: 
265:         $idClient = $client;
266:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s AND type LIKE '%s'
267:                         ORDER BY %s %s ", $cfg['tab']['mod'], $idClient, $this->_moduleType, $this->_orderBy, $this->_sortOrder);
268: 
269:         $db = cRegistry::getDb();
270:         $db->query($sql);
271:         $result = array();
272:         while (($module = $db->nextRecord()) !== false) {
273:             $this->initWithDatabaseRow($db);
274:             if (strlen(stripslashes($this->_filter)) === 0
275:                 || strpos($this->readInput(), stripslashes($this->_filter)) !== false) {
276:                 $result[$db->f('idmod')] = array(
277:                         'name' => $db->f('name'),
278:                         'description' => $db->f('description'),
279:                         'error' => $db->f('error'),
280:                         'input' => $this->readInput(),
281:                         'output' => $this->readOutput()
282:                 );
283:             }
284:         }
285: 
286:         return $result;
287:     }
288: 
289:     /**
290:      * Search for modules in output of modules of current client
291:      *
292:      * @return array
293:      *         result
294:      */
295:     public function findModulWithOutput() {
296:          global $cfg, $client;
297: 
298:         $result = array();
299: 
300:         $idClient = $client;
301:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s AND type LIKE '%s'
302:                         ORDER BY %s %s ", $cfg['tab']['mod'], $idClient, $this->_moduleType, $this->_orderBy, $this->_sortOrder);
303: 
304:         $db = cRegistry::getDb();
305:         $db->query($sql);
306:         $result = array();
307:         while (($module = $db->nextRecord()) !== false) {
308:             $this->initWithDatabaseRow($db);
309:             if (strlen(stripslashes($this->_filter)) === 0
310:                 || strpos($this->readOutput(), stripslashes($this->_filter)) !== false) {
311:                 $result[$db->f('idmod')] = array(
312:                         'name' => $db->f('name'),
313:                         'description' => $db->f('description'),
314:                         'error' => $db->f('error'),
315:                         'input' => $this->readInput(),
316:                         'output' => $this->readOutput()
317:                 );
318:             }
319:         }
320: 
321:         return $result;
322:     }
323: 
324:     /**
325:      * Search for modules in type column
326:      *
327:      * @return array
328:      *         result
329:      */
330:     public function findModuleWithType() {
331:         global $cfg, $client;
332:         $idClient = $client;
333: 
334:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s AND (
335:                             type LIKE '%s'
336:                             AND type LIKE '%s')
337:                             ORDER BY %s %s ", $cfg['tab']['mod'], $idClient, $this->_moduleType, '%' . $this->_filter . '%', $this->_orderBy, $this->_sortOrder);
338: 
339:         $db = cRegistry::getDb();
340:         $db->query($sql);
341:         $result = array();
342: 
343:         while (($module = $db->nextRecord()) !== false) {
344:             $this->initWithDatabaseRow($db);
345:             $result[$db->f('idmod')] = array(
346:                     'name' => $db->f('name'),
347:                     'description' => $db->f('description'),
348:                     'error' => $db->f('error'),
349:                     'input' => $this->readInput(),
350:                     'output' => $this->readOutput()
351:             );
352:         }
353:         return $result;
354:     }
355: 
356:     /**
357:      * Search for modules in description column of modules
358:      *
359:      * @return array
360:      *         result
361:      */
362:     public function findModuleWithDescription() {
363:         global $cfg, $client;
364:         $idClient = $client;
365: 
366:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s AND (
367:                             type LIKE '%s'
368:                             AND description LIKE '%s')
369:                             ORDER BY %s %s ", $cfg['tab']['mod'], $idClient, $this->_moduleType, '%' . $this->_filter . '%', $this->_orderBy, $this->_sortOrder);
370: 
371:         $db = cRegistry::getDb();
372:         $db->query($sql);
373:         $result = array();
374: 
375:         while (($module = $db->nextRecord()) !== false) {
376:             $this->initWithDatabaseRow($db);
377:             $result[$db->f('idmod')] = array(
378:                     'name' => $db->f('name'),
379:                     'description' => $db->f('description'),
380:                     'error' => $db->f('error'),
381:                     'input' => $this->readInput(),
382:                     'output' => $this->readOutput()
383:             );
384:         }
385: 
386:         return $result;
387:     }
388: 
389: }
390: 
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0