Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • 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
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • SimpleXMLExtended
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

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