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