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
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the CONTENIDO language functions.
  5:  *
  6:  * @package Core
  7:  * @subpackage Backend
  8:  * @author Jan Lengowski
  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', 'functions.con.php');
 18: cInclude('includes', 'functions.str.php');
 19: 
 20: /**
 21:  * Edit a language
 22:  *
 23:  * @param int $idlang
 24:  * @param string $langname
 25:  *         Name of the language
 26:  * @param string $encoding
 27:  * @param int $active
 28:  *         Flag for active state, 1 or 0
 29:  * @param string $direction
 30:  * @return bool
 31:  */
 32: function langEditLanguage($idlang, $langname, $encoding, $active, $direction = 'ltr') {
 33:     $oLang = new cApiLanguage();
 34:     if ($oLang->loadByPrimaryKey((int) $idlang)) {
 35:         if ('' === $langname) {
 36:             $langname = "-- ".i18n("New language")." --";
 37:         }
 38:         $oLang->set('name', $langname, false);
 39:         $oLang->set('encoding', $encoding, false);
 40:         $oLang->set('active', $active, false);
 41:         $oLang->set('direction', $direction, false);
 42:         return $oLang->store();
 43:     }
 44:     return false;
 45: }
 46: 
 47: /**
 48:  * Create a new language
 49:  *
 50:  * @param string $name
 51:  *         Name of the language
 52:  * @param int $client
 53:  *         Id of client
 54:  * @return int
 55:  *         New language id
 56:  */
 57: function langNewLanguage($name, $client) {
 58:     global $cfgClient, $notification;
 59: 
 60:     // Add new language to database
 61:     $oLangCol = new cApiLanguageCollection();
 62:     $oLangItem = $oLangCol->create($name, 0, 'utf-8', 'ltr');
 63:     // Add new client language to database
 64:     $oClientLangCol = new cApiClientLanguageCollection();
 65:     $oClientLangItem = $oClientLangCol->create($client, $oLangItem->get('idlang'));
 66: 
 67:     // Ab hyr seynd Drachen
 68:     $destPath = $cfgClient[$client]['config']['path'];
 69: 
 70:     if (cFileHandler::exists($destPath) && cFileHandler::exists($destPath . 'config.php')) {
 71:         $buffer = cFileHandler::read($destPath . 'config.php');
 72:         $outbuf = str_replace('!LANG!', $oLangItem->get('idlang'), $buffer);
 73:         cFileHandler::write($destPath . 'config.php.new', $outbuf);
 74:         if (cFileHandler::exists($destPath . 'config.php')) {
 75:             cFileHandler::remove($destPath . 'config.php');
 76:         }
 77: 
 78:         cFileHandler::rename($destPath . 'config.php.new', 'config.php');
 79:     } else {
 80:         $notification->displayNotification('error', i18n("Could not set the language-ID in the file 'config.php'. Please set the language manually."));
 81:     }
 82: 
 83:     return $oLangItem->get('idlang');
 84: }
 85: 
 86: /**
 87:  * Rename a language
 88:  *
 89:  * @param int $idlang
 90:  *         Id of the language
 91:  * @param string $name
 92:  *         Name of the language
 93:  * @return bool
 94:  */
 95: function langRenameLanguage($idlang, $name) {
 96:     $oLang = new cApiLanguage();
 97:     if ($oLang->loadByPrimaryKey(cSecurity::toInteger($idlang))) {
 98:         $oLang->set('name', $name, false);
 99:         return $oLang->store();
100:     }
101:     return false;
102: }
103: 
104: /**
105:  * Delete a language
106:  *
107:  * @param int $iIdLang
108:  *         Id of the language
109:  * @param int $iIdClient
110:  *         Id of the client, uses global client id by default
111:  * @return void|string
112:  */
113: function langDeleteLanguage($iIdLang, $iIdClient = 0) {
114:     global $db, $sess, $client, $cfg, $notification, $cfgClient;
115: 
116:     $deleteok = 1;
117:     $iIdLang = (int) $iIdLang;
118:     $iIdClient = (int) $iIdClient;
119: 
120:     // Bugfix: New idclient parameter introduced, as Administration -> Languages
121:     // is used for different clients to delete the language
122:     // Use global client id, if idclient not specified (former behaviour)
123:     // Note, that this check also have been added for the action in the database
124:     // - just to be equal to langNewLanguage
125:     if ($iIdClient == 0) {
126:         $iIdClient = $client;
127:     }
128: 
129:     // ************ check if there are still arts online
130:     $sql = "SELECT * FROM " . $cfg['tab']['art_lang'] . " AS A, " . $cfg['tab']['art'] . " AS B " . "WHERE A.idart=B.idart AND B.idclient=" . $iIdClient . " AND A.idlang=" . $iIdLang;
131:     $db->query($sql);
132:     if ($db->nextRecord()) {
133:         conDeleteArt($db->f('idart'));
134:     }
135: 
136:     // ************ check if there are visible categories
137:     $sql = "SELECT * FROM " . $cfg['tab']['cat_lang'] . " AS A, " . $cfg['tab']['cat'] . " AS B " . "WHERE A.idcat=B.idcat AND B.idclient=" . $iIdClient . " AND A.idlang=" . $iIdLang;
138:     $db->query($sql);
139:     if ($db->nextRecord()) {
140:         strDeleteCategory($db->f('idcat'));
141:     }
142: 
143:     $aIdArtLang = array();
144:     $aIdArt = array();
145:     $aIdCatLang = array();
146:     $aIdCat = array();
147:     $aIdTplCfg = array();
148: 
149:     if ($deleteok == 1) {
150:         // ********* check if this is the clients last language to be deleted,
151:         // if yes delete from art, cat, and cat_art as well
152:         $lastlanguage = 0;
153:         $sql = "SELECT COUNT(*) FROM " . $cfg['tab']['clients_lang'] . " WHERE idclient=" . $iIdClient;
154:         $db->query($sql);
155:         $db->nextRecord();
156:         if ($db->f(0) == 1) {
157:             $lastlanguage = 1;
158:         }
159: 
160:         // ********** delete from 'art_lang'-table
161:         $sql = "SELECT A.idtplcfg AS idtplcfg, idartlang, A.idart FROM " . $cfg['tab']['art_lang'] . " AS A, " . $cfg['tab']['art'] . " AS B WHERE A.idart=B.idart AND B.idclient=" . $iIdClient . "
162:                 AND idlang!=0 AND idlang=" . $iIdLang;
163:         $db->query($sql);
164:         while ($db->nextRecord()) {
165:             $aIdArtLang[] = $db->f('idartlang');
166:             $aIdArt[] = $db->f('idart');
167:             $aIdTplCfg[] = $db->f('idtplcfg');
168:         }
169:         foreach ($aIdArtLang as $value) {
170:             $value = (int) $value;
171:             $sql = "DELETE FROM " . $cfg['tab']['art_lang'] . " WHERE idartlang=" . $value;
172:             $db->query($sql);
173:             $sql = "DELETE FROM " . $cfg['tab']['content'] . " WHERE idartlang=" . $value;
174:             $db->query($sql);
175:         }
176: 
177:         if ($lastlanguage == 1) {
178:             foreach ($aIdArt as $value) {
179:                 $value = (int) $value;
180:                 $sql = "DELETE FROM " . $cfg['tab']['art'] . " WHERE idart=" . $value;
181:                 $db->query($sql);
182:                 $sql = "DELETE FROM " . $cfg['tab']['cat_art'] . " WHERE idart=" . $value;
183:                 $db->query($sql);
184:             }
185:         }
186: 
187:         // ********** delete from 'cat_lang'-table
188:         $sql = "SELECT A.idtplcfg AS idtplcfg, idcatlang, A.idcat FROM " . $cfg['tab']['cat_lang'] . " AS A, " . $cfg['tab']['cat'] . " AS B WHERE A.idcat=B.idcat AND B.idclient=" . $iIdClient . "
189:                 AND idlang!=0 AND idlang=" . $iIdLang;
190:         $db->query($sql);
191:         while ($db->nextRecord()) {
192:             $aIdCatLang[] = $db->f('idcatlang');
193:             $aIdCat[] = $db->f('idcat');
194:             $aIdTplCfg[] = $db->f('idtplcfg'); // added
195:         }
196:         foreach ($aIdCatLang as $value) {
197:             $sql = "DELETE FROM " . $cfg['tab']['cat_lang'] . " WHERE idcatlang=" . (int) $value;
198:             $db->query($sql);
199:         }
200:         if ($lastlanguage == 1) {
201:             foreach ($aIdCat as $value) {
202:                 $value = (int) $value;
203:                 $sql = "DELETE FROM " . $cfg['tab']['cat'] . " WHERE idcat=" . $value;
204:                 $db->query($sql);
205:                 $sql = "DELETE FROM " . $cfg['tab']["cat_tree"] . " WHERE idcat=" . $value;
206:                 $db->query($sql);
207:             }
208:         }
209: 
210:         // ********** delete from 'stat'-table
211:         $sql = "DELETE FROM " . $cfg['tab']['stat'] . " WHERE idlang=" . $iIdLang . " AND idclient=" . $iIdClient;
212:         $db->query($sql);
213: 
214:         // ********** delete from 'code'-cache
215:         if (cFileHandler::exists($cfgClient[$iIdClient]['code']['path'])) {
216:             /* @var $file SplFileInfo */
217:             foreach (new DirectoryIterator($cfgClient[$iIdClient]['code']['path']) as $file) {
218:                 if ($file->isFile() === false) {
219:                     continue;
220:                 }
221: 
222:                 $extension = substr($file, strrpos($file->getBasename(), '.') + 1);
223:                 if ($extension != 'php') {
224:                     continue;
225:                 }
226: 
227:                 if (preg_match('/' . $iIdClient . '.' . $iIdLang . '.[0-9*]/s', $file->getBasename())) {
228:                     cFileHandler::remove($cfgClient[$iIdClient]['code']['path'] . '/' . $file->getFilename());
229:                 }
230:             }
231:         }
232: 
233:         foreach ($aIdTplCfg as $tplcfg) {
234:             $tplcfg = (int) $tplcfg;
235:             if ($tplcfg != 0) {
236:                 // ********** delete from 'tpl_conf'-table
237:                 $sql = "DELETE FROM " . $cfg['tab']['tpl_conf'] . " WHERE idtplcfg=" . $tplcfg;
238:                 $db->query($sql);
239:                 // ********** delete from 'container_conf'-table
240:                 $sql = "DELETE FROM " . $cfg['tab']['container_conf'] . " WHERE idtplcfg=" . $tplcfg;
241:                 $db->query($sql);
242:             }
243:         }
244: 
245:         // *********** delete from 'clients_lang'-table
246:         $sql = "DELETE FROM " . $cfg['tab']['clients_lang'] . " WHERE idclient=" . $iIdClient . " AND idlang=" . $iIdLang;
247:         $db->query($sql);
248: 
249:         // *********** delete from 'lang'-table
250:         $sql = "DELETE FROM " . $cfg['tab']['lang'] . " WHERE idlang=" . $iIdLang;
251:         $db->query($sql);
252: 
253:         // *********** delete from 'properties'-table
254:         $oPropertyColl = new cApiPropertyCollection($iIdClient);
255:         $oPropertyColl->deleteProperties('idlang', $iIdLang);
256:     } else {
257:         return $notification->returnMessageBox('error', i18n("Could not delete language"), 0);
258:     }
259: }
260: 
261: /**
262:  * Deactivate a language
263:  *
264:  * @param int $idlang
265:  * @param int $active
266:  * @return bool
267:  */
268: function langActivateDeactivateLanguage($idlang, $active) {
269:     $oLang = new cApiLanguage();
270:     if ($oLang->loadByPrimaryKey((int) $idlang)) {
271:         $oLang->set('active', (int) $active, false);
272:         return $oLang->store();
273:     }
274:     return false;
275: }
276: 
277: /**
278:  * Returns the base direction of text (ltr = left to right, rtl = right to left)
279:  * by language id
280:  *
281:  * @param int $idlang
282:  * @param cDb $db
283:  *         Is not in use
284:  * @return string
285:  *         'ltr' or 'rtl'
286:  */
287: function langGetTextDirection($idlang, $db = NULL) {
288:     static $oLang;
289:     if (!isset($oLang)) {
290:         $oLang = new cApiLanguage();
291:     }
292:     $direction = '';
293:     if ($oLang->loadByPrimaryKey((int) $idlang)) {
294:         $direction = $oLang->get('direction');
295:     }
296:     if ($direction != 'ltr' && $direction != 'rtl') {
297:         $direction = 'ltr';
298:     }
299:     return $direction;
300: }
301: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0