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
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the CONTENIDO path resolver functions.
  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: /**
 18:  * Resolves a path using some fuzzy logic.
 19:  *
 20:  * Warning: If you use this function, try to pass a 'good' path. This function
 21:  *          doesn't guarantee that the matches are logically best-matches.
 22:  *
 23:  * This function operates on the category aliases. It compares the given path with the
 24:  * urlpaths generated by function prCreateURLNameLocationString() based on category aliases.
 25:  *
 26:  * @param string $path
 27:  *         Path to resolve
 28:  *
 29:  * @return int
 30:  *         Closest matching category ID (idcat)
 31:  * 
 32:  * @throws cDbException
 33:  * @throws cException
 34:  * @throws cInvalidArgumentException
 35:  */
 36: function prResolvePathViaURLNames($path) {
 37:     global $cfg, $lang, $client;
 38: 
 39:     $handle = startTiming('prResolvePathViaURLNames', array($path));
 40: 
 41:     // Initialize variables
 42:     $db = cRegistry::getDb();
 43:     $categories = array();
 44:     $results = array();
 45: 
 46:     // Pre-process path
 47:     $path = cString::toLowerCase(str_replace(' ', '', $path));
 48:     $pathresolveHeapcacheEnabled = cRegistry::getConfigValue('pathresolve_heapcache');
 49: 
 50:     // Delete outdated entry in heapcache table, if enabled.
 51:     if ($pathresolveHeapcacheEnabled === true) {
 52:         $oPathresolveCacheColl = new cApiPathresolveCacheCollection();
 53:         $oPathresolveCache = $oPathresolveCacheColl->fetchLatestByPathAndLanguage($path, $lang);
 54:         if (is_object($oPathresolveCache)) {
 55:             if ($oPathresolveCache->isCacheTimeExpired()) {
 56:                 $cacheIdcat = $oPathresolveCache->get('idcat');
 57:                 $oPathresolveCacheColl->delete($oPathresolveCache->get('idpathresolvecache'));
 58:                 return $cacheIdcat;
 59:             }
 60:         }
 61:     }
 62: 
 63:     // Fetch all category names, build path strings
 64:     // @todo change the where statement for get all languages
 65:     $sql = "SELECT * FROM " . $cfg["tab"]["cat_tree"] . " AS A, " . $cfg["tab"]["cat"] . " AS B, " . $cfg["tab"]["cat_lang"] . " AS C WHERE A.idcat=B.idcat AND B.idcat=C.idcat AND C.idlang=" . (int) $lang . "
 66:             AND C.visible = 1 AND B.idclient=" . (int) $client . " ORDER BY A.idtree";
 67:     $db->query($sql);
 68: 
 69:     $catpath = array();
 70:     while ($db->nextRecord()) {
 71:         $cat_str = '';
 72:         prCreateURLNameLocationString($db->f('idcat'), '/', $cat_str, false, '', 0, 0, true, true);
 73: 
 74:         // Store path
 75:         $catpath[$db->f('idcat')] = $cat_str;
 76:         $catnames[$db->f('idcat')] = $db->f('name');
 77:         $catlevels[$db->f('idcat')] = $db->f('level');
 78:     }
 79: 
 80:     // Compare strings using the similar_text algorithm
 81:     $percent = 0;
 82:     foreach ($catpath as $key => $value) {
 83:         $value = cString::toLowerCase(str_replace(' ', '', $value));
 84: 
 85:         similar_text($value, $path, $percent);
 86: 
 87:         $firstpath = cString::findFirstPos($value, '/');
 88: 
 89:         if ($firstpath !== 0) {
 90:             $xpath = cString::getPartOfString($value, $firstpath);
 91:             $ypath = cString::getPartOfString($path, 0, cString::getStringLength($path) - 1);
 92:             if ($xpath == $ypath) {
 93:                 $results[$key] = 100;
 94:             } else {
 95:                 $results[$key] = $percent;
 96:             }
 97:         } else {
 98:             $results[$key] = $percent;
 99:         }
100:     }
101: 
102:     arsort($results, SORT_NUMERIC);
103:     reset($results);
104: 
105:     endAndLogTiming($handle);
106: 
107:     if ($pathresolveHeapcacheEnabled === true) {
108:         $oPathresolveCacheColl = new cApiPathresolveCacheCollection();
109:         $oPathresolveCache = $oPathresolveCacheColl->create($path, key($results), $lang, time());
110:     }
111: 
112:     return (int) key($results);
113: }
114: 
115: /**
116:  * Resolves a path using some fuzzy logic.
117:  *
118:  * Warning: If you use this function, try to pass a 'good' path. This function
119:  *          doesn't guarantee that the matches are logically best-matches.
120:  *
121:  * This function operates on the actual category names.
122:  *
123:  * @param string $path
124:  *         Path to resolve
125:  * @param string $iLangCheck
126:  *
127:  * @return int
128:  *         Closest matching category ID (idcat)
129:  *
130:  * @throws cDbException
131:  * @throws cException
132:  * @throws cInvalidArgumentException
133:  */
134: function prResolvePathViaCategoryNames($path, &$iLangCheck) {
135:     global $cfg, $lang, $client;
136: 
137:     $handle = startTiming('prResolvePathViaCategoryNames', array($path));
138: 
139:     // Initialize variables
140:     $db = cRegistry::getDb();
141:     $categories = array();
142:     $results = array();
143:     $iLangCheckOrg = $iLangCheck;
144: 
145:     // To take only path body
146:     if (preg_match('/^\/(.*)\/$/', $path, $aResults)) {
147:         $aResult = explode('/', $aResults[1]);
148:     } elseif (preg_match('/^\/(.*)$/', $path, $aResults)) {
149:         $aResult = explode('/', $aResults[1]);
150:     } else {
151:         $aResults[1] = $path;
152:     }
153: 
154:     $aResults[1] = cString::toLowerCase(preg_replace('/-/', ' ', $aResults[1]));
155: 
156:     // Init to Compare, save path in array
157:     $aPathsToCompare = explode('/', $aResults[1]);
158:     $iCountPath = count($aPathsToCompare);
159: 
160:     // init lang id
161:     $iLangCheck = 0;
162: 
163:     // Pre-process path
164:     $path = cString::toLowerCase(str_replace(' ', '', $path));
165: 
166:     // Fetch all category names, build path strings
167:     // @todo change the where statement for get all languages
168:     $sql = "SELECT * FROM " . $cfg["tab"]["cat_tree"] . " AS A, " . $cfg["tab"]["cat"] . " AS B, " . $cfg["tab"]["cat_lang"] . " AS C WHERE A.idcat=B.idcat AND B.idcat=C.idcat
169:             AND C.visible = 1 AND B.idclient= " . (int) $client . " ORDER BY A.idtree";
170:     $db->query($sql);
171: 
172:     $catpath = array();
173:     $arrLangMatches = array();
174: 
175:     while ($db->nextRecord()) {
176:         $cat_str = '';
177:         $aTemp = '';
178:         $iFor = 0;
179:         $bLang = false;
180: 
181:         // $level is changeless 0!!!
182:         conCreateLocationString($db->f('idcat'), '/', $cat_str, false, '', 0, $db->f('idlang'));
183:         // Store path
184:         $catpath[$db->f('idcat')] = $cat_str;
185:         $catnames[$db->f('idcat')] = $db->f('name');
186:         $catlevels[$db->f('idcat')] = $db->f('level');
187: 
188:         // Init variables for take a language id
189:         $aTemp = cString::toLowerCase($cat_str);
190:         $aDBToCompare = explode('/', $aTemp);
191:         $iCountDB = count($aDBToCompare);
192:         $iCountDBFor = $iCountDB - 1;
193:         // take min. count of two arrays
194:         ($iCountDB > $iCountPath) ? $iFor = $iCountPath : $iFor = $iCountDB;
195:         $iCountM = $iFor - 1;
196: 
197:         for ($i = 0; $i < $iFor; $i++) {
198:             if ($aPathsToCompare[$iCountM] == $aDBToCompare[$iCountDBFor]) {
199:                 $bLang = true;
200:             } else {
201:                 $bLang = false;
202:             }
203:             $iCountM--;
204:             $iCountDBFor--;
205:             // compare, only if current element is lastone and we are in true path
206:             if ($i == $iFor - 1 && $bLang) {
207:                 $iLangCheck = $db->f('idlang');
208:                 $arrLangMatches[] = $iLangCheck;
209:             }
210:         }
211:     }
212: 
213:     // Suppress wrongly language change if url name can be found in current language
214:     if ($iLangCheckOrg == 0) {
215:         if (in_array($lang, $arrLangMatches)) {
216:             $iLangCheck = $lang;
217:         }
218:     }
219: 
220:     // Compare strings using the similar_text algorithm
221:     $percent = 0;
222:     foreach ($catpath as $key => $value) {
223:         $value = cString::toLowerCase(str_replace(' ', '', $value));
224:         similar_text($value, $path, $percent);
225:         $results[$key] = $percent;
226:     }
227: 
228:     foreach ($catnames as $key => $value) {
229:         $value = cString::toLowerCase(str_replace(' ', '', $value));
230:         similar_text($value, $path, $percent);
231: 
232:         // Apply weight
233:         $percent = $percent * $catlevels[$key];
234: 
235:         if ($results[$key] > $percent) {
236:             $results[$key] = $percent;
237:         }
238:     }
239: 
240:     arsort($results, SORT_NUMERIC);
241:     reset($results);
242: 
243:     endAndLogTiming($handle);
244:     return (int) key($results);
245: }
246: 
247: /**
248:  * Recursive function to create an URL name location string.
249:  *
250:  * @param int    $idcat
251:  *         ID of the starting category
252:  * @param string $seperator
253:  *         Seperation string
254:  * @param string $cat_str
255:  *         Category location string (by reference)
256:  * @param bool   $makeLink
257:  *         create location string with links
258:  * @param string $linkClass
259:  *         stylesheet class for the links
260:  * @param int    $firstTreeElementToUse
261:  *         first navigation level location string should be printed out (first level = 0!!)
262:  * @param int    $uselang
263:  * @param bool   $final
264:  * @param bool   $usecache
265:  *
266:  * @return string
267:  *         location string
268:  * 
269:  * @throws cDbException
270:  * @throws cException
271:  */
272: function prCreateURLNameLocationString($idcat, $seperator, & $cat_str, $makeLink = false, $linkClass = '', $firstTreeElementToUse = 0, $uselang = 0, $final = true, $usecache = false) {
273:     global $cfg, $client, $cfgClient, $lang, $sess, $_URLlocationStringCache;
274: 
275:     if ($final == true) {
276:         $cat_str = '';
277:     }
278: 
279:     if ($idcat == 0) {
280:         $cat_str = i18n("Lost and found");
281:         return;
282:     }
283: 
284:     if ($uselang == 0) {
285:         $uselang = $lang;
286:     }
287: 
288:     if ($final == true && $usecache == true) {
289:         if (!is_array($_URLlocationStringCache)) {
290:             $_URLlocationStringCache = prGetCacheFileContent($client, $uselang);
291:         }
292: 
293:         if (array_key_exists($idcat, $_URLlocationStringCache)) {
294:             if ($_URLlocationStringCache[$idcat]['expires'] > time()) {
295:                 $cat_str = $_URLlocationStringCache[$idcat]['name'];
296:                 return;
297:             }
298:         }
299:     }
300: 
301:     $db = cRegistry::getDb();
302: 
303:     $sql = "SELECT
304:                 a.urlname AS urlname,
305:                 a.name    AS name,
306:                 a.idcat AS idcat,
307:                 b.parentid AS parentid,
308:                 c.level as level,
309:                 d.idtpl as idtpl
310:             FROM
311:                 " . $cfg["tab"]["cat_lang"] . " AS a
312:                 LEFT JOIN " . $cfg["tab"]["tpl_conf"] . " AS d on a.idtplcfg  = d.idtplcfg,
313:                 " . $cfg["tab"]["cat"] . " AS b,
314:                 " . $cfg["tab"]["cat_tree"] . " AS c
315:             WHERE
316:                 a.idlang    = " . (int) $uselang . " AND
317:                 b.idclient  = " . (int) $client . " AND
318:                 b.idcat     = " . (int) $idcat . " AND
319:                 a.idcat     = b.idcat AND
320:                 c.idcat     = b.idcat";
321: 
322:     $db->query($sql);
323:     $db->nextRecord();
324: 
325:     if ($db->f('level') >= $firstTreeElementToUse) {
326:         $name = $db->f('urlname');
327: 
328:         if (trim($name) == '') {
329:             $name = $db->f('name');
330:         }
331: 
332:         $parentid = $db->f('parentid');
333:         $idtpl = (int) $db->f('idtpl');
334: 
335:         //create link
336: 
337:         if ($makeLink == true) {
338:             $linkUrl = $sess->url("front_content.php?idcat=$idcat&idtpl=$idtpl");
339:             $name = '<a href="' . $linkUrl . '" class="' . $linkClass . '">' . $name . '</a>';
340:         }
341: 
342:         $tmp_cat_str = $name . $seperator . $cat_str;
343:         $cat_str = $tmp_cat_str;
344:     }
345: 
346:     if ($parentid != 0) {
347:         prCreateURLNameLocationString($parentid, $seperator, $cat_str, $makeLink, $linkClass, $firstTreeElementToUse, $uselang, false, $usecache);
348:     } else {
349:         $sep_length = cString::getStringLength($seperator);
350:         $str_length = cString::getStringLength($cat_str);
351:         $tmp_length = $str_length - $sep_length;
352:         $cat_str = cString::getPartOfString($cat_str, 0, $tmp_length);
353:     }
354: 
355:     if ($final == true && $usecache == true) {
356:         $_URLlocationStringCache[$idcat]['name'] = $cat_str;
357:         $_URLlocationStringCache[$idcat]['expires'] = time() + 3600;
358: 
359:         prWriteCacheFileContent($_URLlocationStringCache, $client, $uselang);
360:     }
361: }
362: 
363: /**
364:  * Writes path location string cache data file.
365:  *
366:  * @param array  $data
367:  * @param int    $client
368:  * @param int    $lang
369:  *
370:  * @return bool
371:  * 
372:  * @throws cInvalidArgumentException
373:  * 
374:  * @global array $cfgClient
375:  */
376: function prWriteCacheFileContent($data, $client, $lang) {
377:     global $cfgClient;
378: 
379:     $path = $cfgClient[$client]['cache']['path'];
380:     $filename = "locationstring-url-cache-$lang.txt";
381: 
382:     $res = false;
383:     if (is_writable($path)) {
384:         $res = cFileHandler::write($path . $filename, serialize($data));
385:     }
386: 
387:     return ($res) ? true : false;
388: }
389: 
390: /**
391:  * Get path location string cache data file content.
392:  *
393:  * @param int    $client
394:  * @param int    $lang
395:  *
396:  * @return array $data
397:  *               
398:  * @throws cInvalidArgumentException
399:  * 
400:  * @global array $cfgClient
401:  */
402: function prGetCacheFileContent($client, $lang) {
403:     global $cfgClient;
404: 
405:     $path = $cfgClient[$client]['cache']['path'];
406:     $filename = "locationstring-url-cache-$lang.txt";
407: 
408:     if (cFileHandler::exists($path . $filename)) {
409:         $data = unserialize(cFileHandler::read($path . $filename));
410:     } else {
411:         $data = array();
412:     }
413: 
414:     return (is_array($data)) ? $data : array();
415: }
416: 
417: /**
418:  * Deletes path location string cache data file.
419:  *
420:  * @global array $cfgClient
421:  * @param int $client
422:  * @param int $lang
423:  * @return bool
424:  */
425: function prDeleteCacheFileContent($client, $lang) {
426:     global $cfgClient;
427: 
428:     $path = $cfgClient[$client]['cache']['path'];
429:     $filename = "locationstring-url-cache-$lang.txt";
430: 
431:     $res = false;
432:     if (is_writable($path . $filename)) {
433:         $res = @unlink($path . $filename);
434:     }
435: 
436:     return ($res) ? true : false;
437: }
438: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0