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
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • _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
  • 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
  • getAktuellType
  • 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
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • xmlFileToArray
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the backend page for displaying all content of an article.
  4:  *
  5:  * @package Core
  6:  * @subpackage Backend
  7:  * @version SVN Revision $Rev:$
  8:  *
  9:  * @author Fulai Zhang
 10:  * @copyright four for business AG <www.4fb.de>
 11:  * @license http://www.contenido.org/license/LIZENZ.txt
 12:  * @link http://www.4fb.de
 13:  * @link http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: $backendPath = cRegistry::getBackendPath();
 19: $backendUrl = cRegistry::getBackendUrl();
 20: 
 21: cInclude('includes', 'functions.str.php');
 22: cInclude('includes', 'functions.pathresolver.php');
 23: 
 24: if (!isset($idcat)) {
 25:     cRegistry::shutdown();
 26:     return;
 27: }
 28: 
 29: $edit = 'true';
 30: $scripts = '';
 31: 
 32: $page = new cGuiPage("con_content_list");
 33: 
 34: if (!($perm->have_perm_area_action("con", "savecontype") || $perm->have_perm_area_action_item("con", "savecontype", $idcat) || $perm->have_perm_area_action("con", "deletecontype") || $perm->have_perm_area_action_item("con", "deletecontype", $idcat))) {
 35:     // $page->displayCriticalError(i18n("Permission denied")); (Apparently one of the action files already displays this error message)
 36:     $page->abortRendering();
 37:     $page->render();
 38:     die();
 39: }
 40: 
 41: // save / set value
 42: if (($action == 'savecontype' || $action == 10)) {
 43:     if ($perm->have_perm_area_action("con", "savecontype") || $perm->have_perm_area_action_item("con", "savecontype", $idcat)) {
 44:         if ($data != '') {
 45:             $data = explode('||', substr($data, 0, -2));
 46:             foreach ($data as $value) {
 47:                 $value = explode('|', $value);
 48:                 if ($value[3] == '%$%EMPTY%$%') {
 49:                     $value[3] = '';
 50:                 } else {
 51:                     $value[3] = str_replace('%$%SEPERATOR%$%', '|', $value[3]);
 52:                 }
 53:                 conSaveContentEntry($value[0], 'CMS_' . $value[1], $value[2], $value[3]);
 54:             }
 55: 
 56:             conMakeArticleIndex($idartlang, $idart);
 57: 
 58:             // restore orginal values
 59:             $data = $_REQUEST['data'];
 60:             $value = $_REQUEST['value'];
 61: 
 62:             $notification->displayNotification("info", i18n("Changes saved"));
 63:         }
 64: 
 65:         conGenerateCodeForArtInAllCategories($idart);
 66:     } else {
 67:         $page->displayError(i18n("Permission denied"));
 68:     }
 69: } else if ($action == 'deletecontype') {
 70:     if ($perm->have_perm_area_action("con", "deletecontype") || $perm->have_perm_area_action_item("con", "deletecontype", $idcat)) {
 71:        if (isset($_REQUEST['idcontent']) && is_numeric($_REQUEST['idcontent'])) {
 72:             $oContentColl = new cApiContentCollection();
 73: 
 74:             $linkedTypes = array(
 75:                 4 => 22, // if a CMS_IMG is deleted, the corresponding
 76:                          // CMS_IMAGEEDITOR will be deleted too
 77:                 22 => 4 // the same goes for the other way round
 78:             );
 79: 
 80:             $contentItem = new cApiContent((int) $_REQUEST["idcontent"]);
 81:             if (isset($linkedTypes[$contentItem->get("idtype")])) {
 82:                 $linkedIds = $oContentColl->getIdsByWhereClause("`idartlang`='" . $idartlang . "' AND `idtype`='" . $linkedTypes[$contentItem->get("idtype")] . "' AND `value`='" . $contentItem->get("value") . "'");
 83:                 foreach ($linkedIds as $linkedId) {
 84:                     $oContentColl->delete($linkedId);
 85:                 }
 86:             }
 87:             $oContentColl->delete((int) $_REQUEST['idcontent']);
 88:             $notification->displayNotification("info", i18n("Changes saved"));
 89: 
 90:             conGenerateCodeForArtInAllCategories($idart);
 91:         }
 92:     } else {
 93:         $page->displayError(i18n("Permission denied"));
 94:     }
 95: }
 96: 
 97: // get active value
 98: 
 99: $result = array();
100: $aList = array();
101: $typeAktuell = array();
102: $sortID = array(
103:     "CMS_HTMLHEAD",
104:     "CMS_HEAD",
105:     "CMS_HTML",
106:     "CMS_TEXT",
107:     "CMS_IMG",
108:     "CMS_IMGDESCR",
109:     "CMS_IMGEDITOR",
110:     "CMS_LINK",
111:     "CMS_LINKTARGET",
112:     "CMS_LINKDESCR",
113:     "CMS_LINKEDITOR",
114:     "CMS_DATE",
115:     "CMS_TEASER",
116:     "CMS_FILELIST"
117: );
118: 
119: $aIdtype = array();
120: $sql = "SELECT DISTINCT typeid FROM %s WHERE idartlang = %d ORDER BY typeid";
121: $db->query($sql, $cfg["tab"]["content"], $_REQUEST["idartlang"]);
122: while ($db->nextRecord()) {
123:     $aIdtype[] = $db->f("typeid");
124: }
125: 
126: foreach ($sortID as $name) {
127:     // $sql = "SELECT b.idtype as idtype, b.type as name, a.typeid as id,
128:     // a.value as value FROM " . $cfg["tab"]["content"] . " as a, " .
129:     // $cfg["tab"]["type"] . " as b WHERE a.idartlang = " .
130:     // cSecurity::toInteger($_REQUEST["idartlang"]) . " AND a.idtype = b.idtype
131:     // AND b.type = '" . cSecurity::toString($name) . "' ORDER BY idtype,
132:     // typeid, idcontent";
133:     $sql = "SELECT b.idtype as idtype, b.type as name, a.typeid as id, a.value as value FROM %s AS a, %s AS b " . "WHERE a.idartlang = %d AND a.idtype = b.idtype AND b.type = '%s' ORDER BY idtype, typeid, idcontent";
134:     $db->query($sql, $cfg["tab"]["content"], $cfg["tab"]["type"], $_REQUEST["idartlang"], $name);
135:     while ($db->nextRecord() && $db->f("value") != '') {
136:         $result[$db->f("name")][$db->f("id")] = $db->f("value");
137:         if (!in_array($db->f("name"), $aList)) {
138:             $aList[$db->f("idtype")] = $db->f("name");
139:         }
140:     }
141: }
142: 
143: $typeAktuell = getAktuellType($typeAktuell, $aList);
144: // print_r($typeAktuell);
145: // create Layoutcode
146: // if ($action == 'con_content') {
147: // @fulai.zhang: Mark submenuitem 'Editor' in the CONTENIDO Backend (Area:
148: // Contenido --> Articles --> Editor)
149: $markSubItem = markSubMenuItem(5, true);
150: 
151: // Include tiny class
152: include ($backendPath . 'external/wysiwyg/tinymce3/editorclass.php');
153: $oEditor = new cTinyMCEEditor('', '');
154: $oEditor->setToolbar('inline_edit');
155: 
156: // Get configuration for popup und inline tiny
157: $sConfigInlineEdit = $oEditor->getConfigInlineEdit();
158: $sConfigFullscreen = $oEditor->getConfigFullscreen();
159: 
160: // Replace vars in Script
161: 
162: $page->set('s', 'CONTENIDO_FULLHTML', $backendUrl);
163: 
164: // Set urls to file browsers
165: $page->set('s', 'IMAGE', $backendUrl . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
166: $page->set('s', 'FILE', $backendUrl . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=filebrowser');
167: $page->set('s', 'FLASH', $backendUrl . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
168: $page->set('s', 'MEDIA', $backendUrl . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
169: $page->set('s', 'FRONTEND', cRegistry::getFrontendUrl());
170: 
171: // Add tiny options and fill function leave_check()
172: $page->set('s', 'TINY_OPTIONS', $sConfigInlineEdit);
173: $page->set('s', 'TINY_FULLSCREEN', $sConfigFullscreen);
174: $page->set('s', 'IDARTLANG', $idartlang);
175: $page->set('s', 'CON_PATH', $backendUrl);
176: $page->set('s', 'CLOSE', i18n('Close editor'));
177: $page->set('s', 'SAVE', i18n('Close editor and save changes'));
178: $page->set('s', 'QUESTION', i18n('Do you want to save changes?'));
179: 
180: if (getEffectiveSetting('system', 'insite_editing_activated', 'true') == 'false') {
181:     $page->set('s', 'USE_TINY', '');
182: } else {
183:     $page->set('s', 'USE_TINY', 'swapTiny(this);');
184: }
185: 
186: // Show path of selected category to user
187: $breadcrumb = renderBackendBreadcrumb($syncoptions, true, true);
188: $page->set('s', 'CATEGORY', $breadcrumb);
189: 
190: if (count($result) <= 0) {
191:     $page->displayInfo(i18n("Article has no raw data"));
192:     $page->abortRendering();
193:     // $layoutcode .= '<div>--- ' . i18n("none") . ' ---</div>';
194: } else {
195:     foreach ($aIdtype as $idtype) {
196:         foreach ($sortID as $name) {
197:             if (in_array($name, array_keys($result)) && $result[$name][$idtype] != '') {
198:                 if (in_array($name . "[" . $idtype . "]", $typeAktuell)) {
199:                     $class = '';
200:                 } else {
201:                     $class = ' noactive';
202:                 }
203:                 $page->set("d", "EXTRA_CLASS", $class);
204:                 $page->set("d", "NAME", $name);
205:                 $page->set("d", "ID_TYPE", $idtype);
206:                 $page->next();
207:             }
208:         }
209:     }
210: }
211: 
212: // breadcrumb onclick
213: if (!isset($syncfrom)) {
214:     $syncfrom = -1;
215: }
216: $syncoptions = $syncfrom;
217: $page->set("s", "SYNCHOPTIONS", $syncoptions);
218: 
219: $page->set("s", "IDART", $idart);
220: $page->set("s", "IDCAT", $idcat);
221: $page->set("s", "IDLANG", $lang);
222: $page->set("s", "IDARTLANG", $idartlang);
223: $page->set("s", "IDCLIENT", $client);
224: 
225: // generate code
226: $code = _processCmsTags($aList, $result, true, $page->render(NULL, true));
227: ;
228: 
229: if ($code == "0601") {
230:     markSubMenuItem("1");
231:     $code = "<script type='text/javascript'>location.href = '" . $backendUrl . "main.php?frame=4&area=con_content_list&action=con_content&idart=" . $idart . "&idcat=" . $idcat . "&contenido=" . $contenido . "'; /*console.log(location.href);*/</script>";
232: } else {
233:     // inject some additional markup
234:     $code = cString::iReplaceOnce("</head>", "$markSubItem $scripts\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$encoding[$lang]\"></head>", $code);
235: }
236: 
237: if ($cfg["debug"]["codeoutput"]) {
238:     cDebug::out(conHtmlSpecialChars($code));
239: }
240: 
241: // show ContentTypeList
242: chdir(cRegistry::getFrontendPath());
243: eval("?>\n" . $code . "\n<?php\n");
244: // }
245: 
246: cRegistry::shutdown();
247: 
248: /**
249:  * Processes replacements of all existing CMS_...
250:  * tags within passed code
251:  *
252:  * @param array $aList CMS_...tags list
253:  * @param array $contentList all CMS variables
254:  * @param bool $saveKeywords Flag to save collected keywords during replacement
255:  *        process.
256:  * @param array $contentList Assoziative list of CMS variables
257:  */
258: function _processCmsTags($aList, $contentList, $saveKeywords = true, $layoutCode) {
259:     // #####################################################################
260:     // NOTE: Variables below are required in included/evaluated content type
261:     // codes!
262:     global $db, $db2, $sess, $cfg, $code, $cfgClient, $encoding, $notification;
263: 
264:     // NOTE: Variables below are additionally required in included/evaluated
265:     // content type codes within backend edit mode!
266:     global $edit, $editLink, $belang;
267: 
268:     $idcat = $_REQUEST['idcat'];
269:     $idart = $_REQUEST['idart'];
270:     $lang = $_REQUEST['lang'];
271:     $client = $_REQUEST['client'];
272:     $idartlang = $_REQUEST['idartlang'];
273:     $contenido = $_REQUEST['contenido'];
274: 
275:     // Get locked status (article freeze)
276:     $cApiArticleLanguage = new cApiArticleLanguage(cSecurity::toInteger($idartlang));
277:     $locked = $cApiArticleLanguage->getField('locked');
278: 
279:     // If article is locked show notification
280:     if ($locked == 1) {
281:         $notification->displayNotification('warning', i18n('This article is currently frozen and can not be edited!'));
282:     }
283: 
284:     if (!is_object($db2)) {
285:         $db2 = cRegistry::getDb();
286:     }
287:     // End: Variables required in content type codes
288:     // #####################################################################
289: 
290:     $match = array();
291:     $keycode = array();
292: 
293:     // $a_content is used by included/evaluated content type codes below
294:     $a_content = $contentList;
295: 
296:     // Select all cms_type entries
297:     $_typeList = array();
298:     $oTypeColl = new cApiTypeCollection();
299:     $oTypeColl->select();
300:     while ($oType = $oTypeColl->next()) {
301:         $_typeList[] = $oType->toObject();
302:     }
303: 
304:     // Replace all CMS_TAGS[]
305:     foreach ($_typeList as $_typeItem) {
306:         $key = strtolower($_typeItem->type);
307:         $type = $_typeItem->type;
308:         if (in_array($type, $aList)) {
309:             // Try to find all CMS_{type}[{number}] values, e. g. CMS_HTML[1]
310:             // $tmp = preg_match_all('/(' . $type . ')\[+([a-z0-9_]+)+\]/i',
311:             // $this->_layoutCode, $match);
312:             $tmp = preg_match_all('/(' . $type . '\[+(\d)+\])/i', $layoutCode, $match);
313: 
314:             $a_[$key] = $match[0];
315: 
316:             $success = array_walk($a_[$key], 'extractNumber');
317: 
318:             $search = array();
319:             $replacements = array();
320: 
321:             $backendPath = cRegistry::getBackendPath();
322: 
323:             $typeCodeFile = $backendPath . 'includes/type/code/include.' . $type . '.code.php';
324:             $cTypeClassFile = $backendPath . 'classes/content_types/class.content.type.' . strtolower(str_replace('CMS_', '', $type)) . '.php';
325:             // classname format: CMS_HTMLHEAD -> cContentTypeHtmlhead
326:             $className = 'cContentType' . ucfirst(strtolower(str_replace('CMS_', '', $type)));
327: 
328:             foreach ($a_[$key] as $val) {
329:                 if (cFileHandler::exists($cTypeClassFile)) {
330:                     $tmp = $a_content[$_typeItem->type][$val];
331:                     $cTypeObject = new $className($tmp, $val, $a_content);
332:                     if (cRegistry::isBackendEditMode() && $locked == 0) {
333:                         $tmp = $cTypeObject->generateEditCode();
334:                     } else {
335:                         $tmp = $cTypeObject->generateViewCode();
336:                     }
337:                 } else if (cFileHandler::exists($typeCodeFile)) {
338:                     // include CMS type code
339:                     include ($typeCodeFile);
340:                 } elseif (!empty($_typeItem->code)) {
341:                     // old version, evaluate CMS type code
342:                     cDeprecated("Move code for $type from table into file system (contenido/includes/cms/code/)");
343:                     eval($_typeItem->code);
344:                 }
345:                 $sql = "SELECT a.idcontent
346:                     FROM " . $cfg["tab"]["content"] . " as a, " . $cfg["tab"]["type"] . " as b
347:                     WHERE a.idartlang=" . cSecurity::toInteger($_REQUEST["idartlang"]) . " AND a.idtype=b.idtype AND a.typeid = " . cSecurity::toInteger($val) . " AND b.type = '" . cSecurity::toString($type) . "'
348:                     ORDER BY a.idartlang, a.idtype, a.typeid";
349:                 $db->query($sql);
350:                 while ($db->nextRecord()) {
351:                     $idcontent = $db->f("idcontent");
352:                 }
353:                 $backendUrl = cRegistry::getBackendUrl();
354: 
355:                 $search[$val] = sprintf('%s[%s]', $type, $val);
356:                 $path = $backendUrl . 'main.php?area=con_content_list&action=deletecontype&changeview=edit&idart=' . $idart . '&idartlang=' . $idartlang . '&idcat=' . $idcat . '&client=' . $client . '&lang=' . $lang . '&frame=4&contenido=' . $contenido . '&idcontent=' . $idcontent;
357:                 if ($_typeItem->idtype == 20 || $_typeItem->idtype == 21) {
358:                     $tmp = str_replace('";?>', '', $tmp);
359:                     $tmp = str_replace('<?php echo "', '', $tmp);
360:                     // echo
361:                     // "<textarea>"."?".">\n".stripslashes($tmp)."\n\";?"."><"."?php\n"."</textarea>";
362:                 }
363: 
364:                 if ($locked == 0) { // No freeze
365:                     $replacements[$val] = $tmp . '<a href="#" onclick="showConfirmation(\'' . i18n("Are you sure you want to delete this content type from this article?") . '\', function() { setcontent(\'1\',\'' . $path . '\'); });">
366:                 <img border="0" src="' . $backendUrl . 'images/delete.gif">
367:                 </a>';
368:                     $keycode[$type][$val] = $tmp . '<a href="#" onclick="showConfirmation(\'' . i18n("Are you sure you want to delete this content type from this article?") . '\', function() { setcontent(\'1\',\'' . $path . '\'); });">
369:                 <img border="0" src="' . $backendUrl . 'images/delete.gif">
370:                 </a>';
371:                 } else { // Freeze status
372:                     $replacements[$val] = $tmp;
373:                     $keycode[$type][$val] = $tmp;
374:                 }
375:             }
376: 
377:             $code = str_ireplace($search, $replacements, $layoutCode);
378:             // execute CEC hook
379:             $code = cApiCecHook::executeAndReturn('Contenido.Content.conGenerateCode', $code);
380:             $layoutCode = stripslashes($code);
381:         }
382:     }
383:     $layoutCode = str_ireplace("<<", "[", $layoutCode);
384:     $layoutCode = str_ireplace(">>", "]", $layoutCode);
385:     return $layoutCode;
386: }
387: 
388: /**
389:  * Processes get all existing active CMS_...
390:  * tags within passed code
391:  *
392:  * @param array $r active CMS variables
393:  * @param array $aList CMS_...tags list
394:  */
395: function getAktuellType($r, $aList) {
396:     $idcat = $_REQUEST['idcat'];
397:     $idart = $_REQUEST['idart'];
398:     $lang = $_REQUEST['lang'];
399:     $client = $_REQUEST['client'];
400:     global $db, $db2, $sess, $cfg, $code, $cfgClient, $encoding;
401: 
402:     // Select all cms_type entries
403:     $_typeList = array();
404:     $oTypeColl = new cApiTypeCollection();
405:     $oTypeColl->select();
406:     while ($oType = $oTypeColl->next()) {
407:         $_typeList[] = $oType->toObject();
408:     }
409: 
410:     // generate code
411:     $code = conGenerateCode($idcat, $idart, $lang, $client, false, false, false);
412:     foreach ($_typeList as $_typeItem) {
413:         $type = $_typeItem->type;
414:         if (in_array($type, $aList)) {
415:             // Try to find all CMS_{type}[{number}] values, e. g. CMS_HTML[1]
416:             $tmp = preg_match_all('/(' . $type . '\[+(\d)+\])/i', $code, $match);
417:             foreach ($match[0] as $s) {
418:                 if (!in_array($s, $r)) {
419:                     array_push($r, $s);
420:                 }
421:             }
422:         }
423:     }
424:     return $r;
425: }
426: 
CMS CONTENIDO 4.9.2 API documentation generated by ApiGen 2.8.0