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:  *
  6:  * @todo refactor documentation
  7:  *
  8:  * @package    Core
  9:  * @subpackage Backend
 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:      * Constructor to create an instance of this class.
 85:      *
 86:      * @param array $searchOptions
 87:      */
 88:     public function __construct($searchOptions) {
 89:         parent::__construct();
 90: 
 91:         $this->_elementPerPage = $searchOptions['elementPerPage'];
 92:         $this->_orderBy = $searchOptions['orderBy'];
 93:         $this->_sortOrder = $searchOptions['sortOrder'];
 94:         $this->_moduleType = $searchOptions['moduleType'];
 95:         $this->_filter = $searchOptions['filter'];
 96:         $this->_searchIn = $searchOptions['searchIn'];
 97:         $this->_selectedPage = $searchOptions['selectedPage'];
 98:     }
 99: 
100:     /**
101:      * Print a array.
102:      *
103:      * @param array $arg
104:      */
105:     private function _echo($arg) {
106:         echo '<pre>' . print_r($arg) . '</pre>';
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
121:      * output files).
122:      *
123:      * @return array
124:      */
125:     public function searchForAllModules() {
126:         global $cfg, $client;
127: 
128:         $idClient = $client;
129:         // first fetch all modules for client
130:         // then apply _filter on input and output from files
131:         // then use the whitelisted id's and search for additional filter matches on database
132:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s", $cfg['tab']['mod'], $idClient);
133: 
134: 
135:         $db = cRegistry::getDb();
136:         $db->query($sql);
137:         $moduleIds = array();
138: 
139:         // filter modules based on input and output
140:         while (($modul = $db->nextRecord()) !== false) {
141:             $this->initWithDatabaseRow($db);
142:             if (strlen(stripslashes($this->_filter)) === 0
143:                     || strpos($this->readInput(), stripslashes($this->_filter)) !== false
144:                     || strpos($this->readOutput(), stripslashes($this->_filter)) !== false) {
145:                     $moduleIds[] = $db->f('idmod');
146:             }
147:         }
148: 
149:         // build query using whitelisted id's
150:         $idFilter = "";
151:         foreach ($moduleIds as $moduleId) {
152:             $idFilter .= " OR idmod=" . (int) $moduleId;
153:         }
154:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s AND (
155:                             type LIKE '%s'
156:                             AND type LIKE '%s'
157:                             OR description LIKE '%s'
158:                             OR name LIKE  '%s'" . $idFilter . ")
159:                             ORDER BY %s %s", $cfg['tab']['mod'], $idClient, $this->_moduleType, '%' . $this->_filter . '%', '%' . $this->_filter . '%', '%' . $this->_filter . '%', $this->_orderBy, $this->_sortOrder);
160: 
161:         $db = cRegistry::getDb();
162:         $db->query($sql);
163:         $result = array();
164: 
165:         while (($modul = $db->nextRecord()) !== false) {
166:             $this->initWithDatabaseRow($db);
167:             $result[$db->f('idmod')] = array(
168:                     'name' => $db->f('name'),
169:                     'description' => $db->f('description'),
170:                     'error' => $db->f('error'),
171:                     'input' => $this->readInput(),
172:                     'output' => $this->readOutput()
173:             );
174:         }
175: 
176:         return $result;
177:     }
178: 
179:     /**
180:      * Main method for the class. Search for modules in db and in input and
181:      * outputs files.
182:      *
183:      * @return array
184:      */
185:     public function getModules() {
186:         $modules = array();
187: 
188:         switch ($this->_searchIn) {
189:             case 'all':
190:                 $modules = $this->searchForAllModules();
191:                 break;
192:             case 'name':
193:                 $modules = $this->findeModulWithName();
194:                 break;
195:             case 'description':
196:                 $modules = $this->findModuleWithDescription();
197:                 break;
198:             case 'type':
199:                 $modules = $this->findModuleWithType();
200:                 break;
201:             case 'input': // Search for modulname_input.php
202:                 $modules = $this->findModulWithInput();
203:                 break;
204:             case 'output': // Search fro modulname_output.php
205:                 $modules = $this->findModulWithOutput();
206:                 break;
207:         }
208: 
209:         $this->_result = $modules;
210:         if ($this->_elementPerPage > 0) {
211:             if (count($this->_result) < (($this->_page - 1) * $this->_elementPerPage)) {
212:                 $this->_page = 1;
213:             }
214: 
215:             if ($this->_elementPerPage * ($this->_page) >= count($this->_result) + $this->_elementPerPage && $this->_page != 1) {
216:                 $this->_page--;
217:             }
218:             return array_slice($modules, $this->_elementPerPage * ($this->_selectedPage - 1), $this->_elementPerPage, true);
219:         } else {
220:             return $modules;
221:         }
222:     }
223: 
224:     /**
225:      * Search for modules in "name" column of modul.
226:      *
227:      * @return array
228:      */
229:     public function findeModulWithName() {
230:         global $cfg, $client;
231:         $idClient = $client;
232: 
233:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s AND (type LIKE '%s' AND name LIKE '%s')
234:                         ORDER BY %s %s ", $cfg['tab']['mod'], $idClient, $this->_moduleType, '%' . $this->_filter . '%', $this->_orderBy, $this->_sortOrder);
235: 
236:         $db = cRegistry::getDb();
237:         $db->query($sql);
238:         $result = array();
239: 
240:         while (($module = $db->nextRecord()) !== false) {
241:             $this->initWithDatabaseRow($db);
242:             $result[$db->f('idmod')] = array(
243:                     'name' => $db->f('name'),
244:                     'description' => $db->f('description'),
245:                     'error' => $db->f('error'),
246:                     'input' => $this->readInput(),
247:                     'output' => $this->readOutput()
248:             );
249:         }
250:         return $result;
251:     }
252: 
253:     /**
254:      * Search for modules in input file of the module.
255:      *
256:      * @return array
257:      */
258:     public function findModulWithInput() {
259:         global $cfg, $client;
260: 
261:         $idClient = $client;
262:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s AND type LIKE '%s'
263:                         ORDER BY %s %s ", $cfg['tab']['mod'], $idClient, $this->_moduleType, $this->_orderBy, $this->_sortOrder);
264: 
265:         $db = cRegistry::getDb();
266:         $db->query($sql);
267:         $result = array();
268:         while (($module = $db->nextRecord()) !== false) {
269:             $this->initWithDatabaseRow($db);
270:             if (strlen(stripslashes($this->_filter)) === 0
271:                 || strpos($this->readInput(), stripslashes($this->_filter)) !== false) {
272:                 $result[$db->f('idmod')] = array(
273:                         'name' => $db->f('name'),
274:                         'description' => $db->f('description'),
275:                         'error' => $db->f('error'),
276:                         'input' => $this->readInput(),
277:                         'output' => $this->readOutput()
278:                 );
279:             }
280:         }
281: 
282:         return $result;
283:     }
284: 
285:     /**
286:      * Search for modules in output of modules of current client.
287:      *
288:      * @return array
289:      */
290:     public function findModulWithOutput() {
291:          global $cfg, $client;
292: 
293:         $result = array();
294: 
295:         $idClient = $client;
296:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s AND type LIKE '%s'
297:                         ORDER BY %s %s ", $cfg['tab']['mod'], $idClient, $this->_moduleType, $this->_orderBy, $this->_sortOrder);
298: 
299:         $db = cRegistry::getDb();
300:         $db->query($sql);
301:         $result = array();
302:         while (($module = $db->nextRecord()) !== false) {
303:             $this->initWithDatabaseRow($db);
304:             if (strlen(stripslashes($this->_filter)) === 0
305:                 || strpos($this->readOutput(), stripslashes($this->_filter)) !== false) {
306:                 $result[$db->f('idmod')] = array(
307:                         'name' => $db->f('name'),
308:                         'description' => $db->f('description'),
309:                         'error' => $db->f('error'),
310:                         'input' => $this->readInput(),
311:                         'output' => $this->readOutput()
312:                 );
313:             }
314:         }
315: 
316:         return $result;
317:     }
318: 
319:     /**
320:      * Search for modules in type column.
321:      *
322:      * @return array
323:      */
324:     public function findModuleWithType() {
325:         global $cfg, $client;
326:         $idClient = $client;
327: 
328:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s AND (
329:                             type LIKE '%s'
330:                             AND type LIKE '%s')
331:                             ORDER BY %s %s ", $cfg['tab']['mod'], $idClient, $this->_moduleType, '%' . $this->_filter . '%', $this->_orderBy, $this->_sortOrder);
332: 
333:         $db = cRegistry::getDb();
334:         $db->query($sql);
335:         $result = array();
336: 
337:         while (($module = $db->nextRecord()) !== false) {
338:             $this->initWithDatabaseRow($db);
339:             $result[$db->f('idmod')] = array(
340:                     'name' => $db->f('name'),
341:                     'description' => $db->f('description'),
342:                     'error' => $db->f('error'),
343:                     'input' => $this->readInput(),
344:                     'output' => $this->readOutput()
345:             );
346:         }
347:         return $result;
348:     }
349: 
350:     /**
351:      * Search for modules in description column of modules.
352:      *
353:      * @return array
354:      */
355:     public function findModuleWithDescription() {
356:         global $cfg, $client;
357:         $idClient = $client;
358: 
359:         $sql = sprintf("SELECT * FROM %s WHERE idclient = %s AND (
360:                             type LIKE '%s'
361:                             AND description LIKE '%s')
362:                             ORDER BY %s %s ", $cfg['tab']['mod'], $idClient, $this->_moduleType, '%' . $this->_filter . '%', $this->_orderBy, $this->_sortOrder);
363: 
364:         $db = cRegistry::getDb();
365:         $db->query($sql);
366:         $result = array();
367: 
368:         while (($module = $db->nextRecord()) !== false) {
369:             $this->initWithDatabaseRow($db);
370:             $result[$db->f('idmod')] = array(
371:                     'name' => $db->f('name'),
372:                     'description' => $db->f('description'),
373:                     'error' => $db->f('error'),
374:                     'input' => $this->readInput(),
375:                     'output' => $this->readOutput()
376:             );
377:         }
378: 
379:         return $result;
380:     }
381: 
382: }
383: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0