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

Functions

  • _getCurrentTypes
  • _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
  • 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
  • endsWith
  • 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
  • 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
  • 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:  * 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: // export only these content types
 32: $allowedContentTypes = array(
 33:     "CMS_HTMLHEAD",
 34:     "CMS_HTML",
 35:     "CMS_TEXT",
 36:     "CMS_LINK",
 37:     "CMS_LINKTARGET",
 38:     "CMS_LINKDESCR",
 39:     "CMS_HEAD",
 40:     "CMS_DATE"
 41: );
 42: 
 43: $page = new cGuiPage("con_content_list");
 44: 
 45: if (!($perm->have_perm_area_action($area, "savecontype") || $perm->have_perm_area_action_item($area, "savecontype", $idcat) || $perm->have_perm_area_action("con", "deletecontype") || $perm->have_perm_area_action_item("con", "deletecontype", $idcat))) {
 46:     // $page->displayCriticalError(i18n("Permission denied")); (Apparently one of the action files already displays this error message)
 47:     $page->abortRendering();
 48:     $page->render();
 49:     die();
 50: }
 51: 
 52: // save / set value
 53: if (($action == 'savecontype' || $action == 10)) {
 54:     if ($perm->have_perm_area_action($area, "savecontype") || $perm->have_perm_area_action_item($area, "savecontype", $idcat)) {
 55:         if ($data != '') {
 56:             $data = explode('||', substr($data, 0, -2));
 57:             foreach ($data as $value) {
 58:                 $value = explode('|', $value);
 59:                 if ($value[3] == '%$%EMPTY%$%') {
 60:                     $value[3] = '';
 61:                 } else {
 62:                     $value[3] = str_replace('%$%SEPERATOR%$%', '|', $value[3]);
 63:                 }
 64:                 conSaveContentEntry($value[0], 'CMS_' . $value[1], $value[2], $value[3]);
 65:             }
 66: 
 67:             conMakeArticleIndex($idartlang, $idart);
 68: 
 69:             // restore orginal values
 70:             $data = $_REQUEST['data'];
 71:             $value = $_REQUEST['value'];
 72: 
 73:             $notification->displayNotification("info", i18n("Changes saved"));
 74:         }
 75: 
 76:         conGenerateCodeForArtInAllCategories($idart);
 77:     } else {
 78:         $page->displayError(i18n("Permission denied"));
 79:     }
 80: } else if ($action == 'deletecontype') {
 81:     if ($perm->have_perm_area_action($Area, "deletecontype") || $perm->have_perm_area_action_item($area, "deletecontype", $idcat)) {
 82:        if (isset($_REQUEST['idcontent']) && is_numeric($_REQUEST['idcontent'])) {
 83:             $oContentColl = new cApiContentCollection();
 84: 
 85:             $linkedTypes = array(
 86:                 4 => 22, // if a CMS_IMG is deleted, the corresponding
 87:                          // CMS_IMAGEEDITOR will be deleted too
 88:                 22 => 4 // the same goes for the other way round
 89:             );
 90: 
 91:             $contentItem = new cApiContent((int) $_REQUEST["idcontent"]);
 92:             if (isset($linkedTypes[$contentItem->get("idtype")])) {
 93:                 $linkedIds = $oContentColl->getIdsByWhereClause("`idartlang`='" . $idartlang . "' AND `idtype`='" . $linkedTypes[$contentItem->get("idtype")] . "' AND `value`='" . $contentItem->get("value") . "'");
 94:                 foreach ($linkedIds as $linkedId) {
 95:                     $oContentColl->delete($linkedId);
 96:                 }
 97:             }
 98:             $oContentColl->delete((int) $_REQUEST['idcontent']);
 99:             $notification->displayNotification("info", i18n("Changes saved"));
100: 
101:             conGenerateCodeForArtInAllCategories($idart);
102:         }
103:     } else {
104:         $page->displayError(i18n("Permission denied"));
105:     }
106: } else if ($action == 'exportrawcontent') {
107: 
108:     // extended class to add CDATA to content
109:     class SimpleXMLExtended extends SimpleXMLElement{
110:         public function addCData($cdata_text){
111:             $node= dom_import_simplexml($this);
112:             $no = $node->ownerDocument;
113:             $node->appendChild($no->createCDATASection($cdata_text));
114:         }
115:     }
116: 
117:     // load article language object
118:     $cApiArticleLanguage = new cApiArticleLanguage(cSecurity::toInteger($idartlang));
119:     // create xml element articles
120:     $articleElement = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><articles></articles>');
121: 
122:     // add child element article
123:     $articleNode = $articleElement->addChild("article");
124:     $articleNode->addAttribute("id", $cApiArticleLanguage->get('idart'));
125: 
126:     // add seo infos to xml
127:     $titleNode = $articleNode->addChild("title");
128:     $titleNode->addCData($cApiArticleLanguage->get('title'));
129: 
130:     $summaryNode = $articleNode->addChild("shortdesc");
131:     $summaryNode->addCData($cApiArticleLanguage->get('summary'));
132: 
133:     $pageTitleNode = $articleNode->addChild("seo_title");
134:     $pageTitleNode->addCData($cApiArticleLanguage->get('pagetitle'));
135: 
136:     $seoDescrNode = $articleNode->addChild("seo_description");
137:     $seoDescrNode->addCData(conGetMetaValue($cApiArticleLanguage->get('idartlang'), 3));
138: 
139:     $keywordsNode = $articleNode->addChild("seo_keywords");
140:     $keywordsNode->addCData(conGetMetaValue($cApiArticleLanguage->get('idartlang'), 5));
141: 
142:     $copyrightNode = $articleNode->addChild("seo_copyright");
143:     $copyrightNode->addCData(conGetMetaValue($cApiArticleLanguage->get('idartlang'), 8));
144: 
145:     $seoauthorNode = $articleNode->addChild("seo_author");
146:     $seoauthorNode->addCData(conGetMetaValue($cApiArticleLanguage->get('idartlang'), 1));
147: 
148:     // load content id's for article
149:     $conColl = new cApiContentCollection();
150:     $contentIds = $conColl->getIdsByWhereClause('idartlang="'. $cApiArticleLanguage->get("idartlang") .'"');
151: 
152:     // iterate through content and add get data
153:     foreach ($contentIds as $contentId) {
154:         //load content object
155:         $content = new cApiContent($contentId);
156:         // if loaded get data and add to xml
157:         if($content->isLoaded()) {
158:             $type = new cApiType($content->get("idtype"));
159: 
160:             if($type->isLoaded() && in_array($type->get("type"), $allowedContentTypes)) {
161:                 foreach ($_POST as $key => $contentType) {
162:                     if($key == $type->get("type") && $contentType == $content->get("typeid")) {
163:                         //create content element
164:                         $contentNode = $articleNode->addChild("content");
165:                         $contentNode->addCData($content->get("value"));
166:                         $contentNode->addAttribute("type", $type->get("type"));
167:                         $contentNode->addAttribute("id", $content->get("typeid"));
168:                     }
169:                 }
170:             }
171: 
172:         }
173:     }
174:     // output data as xml
175:     header('Content-Type: application/xml;');
176:     header('Content-Disposition: attachment; filename='.$cApiArticleLanguage->get('title').';');
177:     ob_clean();
178:     echo $articleElement->asXML();
179:     exit;
180: } else if ($action == "importrawcontent") {
181:     // import raw data into article
182: 
183:     // init vars
184:     $error = false;
185: 
186:     //get file from request
187:     $rawDataFile = $_FILES['rawfile']['tmp_name'];
188: 
189:     // check file exist
190:     if(strlen($rawDataFile) > 0 && isset($_FILES['rawfile'])) {
191: 
192:         // read file from tmp upload folder
193:         $rawData = file_get_contents($rawDataFile);
194: 
195:         // try init xml and import data
196:         try {
197:             $xmlDocument = new SimpleXMLElement($rawData);
198: 
199:             foreach ($xmlDocument->children() as $articleNode) {
200:                 $articleId = $articleNode->attributes()->id;
201: 
202:                 // check article id exists in xml
203:                 if($articleId > 0) {
204: 
205:                     // load article by artice id and language
206:                     $articleLanguage = new cApiArticleLanguage();
207:                     $articleLanguage->loadByMany(array("idart" => $articleId, "idlang" => cRegistry::getLanguageId()));
208: 
209:                     // check is article loaded
210:                     if($articleLanguage->isLoaded()) {
211: 
212:                         // read xml childrens
213:                         foreach ($articleNode->children() as $key => $child) {
214: 
215:                             // switch xml tag and exec business logic
216:                             switch ($key) {
217:                                 case 'title':
218:                                     $articleLanguage->set("title", $child);
219:                                     $articleLanguage->store();
220: 
221:                                     break;
222:                                 case 'shortdesc':
223:                                     $articleLanguage->set("summary", $child);
224:                                     $articleLanguage->store();
225: 
226:                                     break;
227:                                 case 'seo_title':
228:                                     $articleLanguage->set("pagetitle", $child);
229:                                     $articleLanguage->store();
230: 
231:                                     break;
232:                                 case 'seo_description':
233:                                     conSetMetaValue($articleLanguage->get('idartlang'), 3, $child);
234: 
235:                                     break;
236:                                 case 'seo_keywords':
237:                                     conSetMetaValue($articleLanguage->get('idartlang'), 5, $child);
238: 
239:                                     break;
240:                                 case 'seo_copyright':
241:                                     conSetMetaValue($articleLanguage->get('idartlang'), 8, $child);
242: 
243:                                     break;
244:                                 case 'seo_author':
245:                                     conSetMetaValue($articleLanguage->get('idartlang'), 1, $child);
246: 
247:                                     break;
248:                                 case 'content':
249:                                     $type = $child->attributes()->type;
250:                                     $typeid  = $child->attributes()->id;
251: 
252:                                     $typeEntry = new cApiType();
253:                                     $typeEntry->loadBy("type", $type);
254: 
255:                                     if(strlen($type) > 0 && $typeid > 0 && in_array($typeEntry->get("type"), $allowedContentTypes)) {
256:                                         if(isset($_POST['overwritecontent']) && $_POST['overwritecontent'] == 1) {
257:                                             conSaveContentEntry($articleLanguage->get('idartlang'), $type, $typeid, $child);
258:                                         } else {
259: 
260:                                             $contentEntry = new cApiContent();
261: 
262:                                             $contentEntry->loadByMany(array("idtype" => $typeEntry->get("idtype"), "typeid" => $typeid, "idartlang" => $articleLanguage->get('idartlang')));
263:                                             if(!$contentEntry->isLoaded()) {
264:                                                 conSaveContentEntry($articleLanguage->get('idartlang'), $type, $typeid, $child);
265:                                             }
266:                                         }
267:                                     } else {
268: 
269:                                     }
270: 
271:                                     break;
272:                                 case 'default':
273:                                     break;
274:                             }
275: 
276:                         }
277: 
278:                     } else {
279:                         $page->displayError(i18n("Can not load article"));
280:                         $error = true;
281:                     }
282:                 } else {
283:                     $page->displayError(i18n("Can not find article"));
284:                     $error = true;
285: 
286:                 }
287:             }
288:             if($error === false) {
289:                 $page->displayInfo(i18n("Raw data was imported successfully"));
290:             }
291: 
292:         } catch (Exception $e) {
293:             $page->displayError(i18n("Error: The XML file is not valid"));
294:         }
295:     } else {
296:         $page->displayWarning(i18n("Please choose a file"));
297:     }
298: 
299: }
300: 
301: // get active value
302: 
303: $result = array();
304: $aList = array();
305: $currentTypes = array();
306: $sortID = array(
307:     "CMS_HTMLHEAD",
308:     "CMS_HEAD",
309:     "CMS_HTML",
310:     "CMS_TEXT",
311:     "CMS_IMG",
312:     "CMS_IMGDESCR",
313:     "CMS_IMGEDITOR",
314:     "CMS_LINK",
315:     "CMS_LINKTARGET",
316:     "CMS_LINKDESCR",
317:     "CMS_LINKEDITOR",
318:     "CMS_DATE",
319:     "CMS_TEASER",
320:     "CMS_FILELIST"
321: );
322: 
323: $aIdtype = array();
324: $sql = "SELECT DISTINCT typeid FROM %s WHERE idartlang = %d ORDER BY typeid";
325: $db->query($sql, $cfg["tab"]["content"], $_REQUEST["idartlang"]);
326: while ($db->nextRecord()) {
327:     $aIdtype[] = $db->f("typeid");
328: }
329: 
330: foreach ($sortID as $name) {
331:     // $sql = "SELECT b.idtype as idtype, b.type as name, a.typeid as id,
332:     // a.value as value FROM " . $cfg["tab"]["content"] . " as a, " .
333:     // $cfg["tab"]["type"] . " as b WHERE a.idartlang = " .
334:     // cSecurity::toInteger($_REQUEST["idartlang"]) . " AND a.idtype = b.idtype
335:     // AND b.type = '" . cSecurity::toString($name) . "' ORDER BY idtype,
336:     // typeid, idcontent";
337:     $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";
338:     $db->query($sql, $cfg["tab"]["content"], $cfg["tab"]["type"], $_REQUEST["idartlang"], $name);
339:     while ($db->nextRecord() && $db->f("value") != '') {
340:         $result[$db->f("name")][$db->f("id")] = $db->f("value");
341:         if (!in_array($db->f("name"), $aList)) {
342:             $aList[$db->f("idtype")] = $db->f("name");
343:         }
344:     }
345: }
346: 
347: $currentTypes = _getCurrentTypes($currentTypes, $aList);
348: // print_r($currentTypes);
349: // create Layoutcode
350: // if ($action == 'con_content') {
351: // @fulai.zhang: Mark submenuitem 'Editor' in the CONTENIDO Backend (Area:
352: // Contenido --> Articles --> Editor)
353: $markSubItem = markSubMenuItem(4, true);
354: 
355: // Include tiny class
356: include($backendPath . 'external/wysiwyg/tinymce3/editorclass.php');
357: $oEditor = new cTinyMCEEditor('', '');
358: $oEditor->setToolbar('inline_edit');
359: 
360: // Get configuration for popup und inline tiny
361: $sConfigInlineEdit = $oEditor->getConfigInlineEdit();
362: $sConfigFullscreen = $oEditor->getConfigFullscreen();
363: 
364: // Replace vars in Script
365: 
366: // Set urls to file browsers
367: $page->set('s', 'IMAGE', $backendUrl . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
368: $page->set('s', 'FILE', $backendUrl . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=filebrowser');
369: $page->set('s', 'FLASH', $backendUrl . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
370: $page->set('s', 'MEDIA', $backendUrl . 'frameset.php?area=upl&contenido=' . $sess->id . '&appendparameters=imagebrowser');
371: $page->set('s', 'FRONTEND', cRegistry::getFrontendUrl());
372: 
373: // Add tiny options
374: $page->set('s', 'TINY_OPTIONS', $sConfigInlineEdit);
375: $page->set('s', 'TINY_FULLSCREEN', $sConfigFullscreen);
376: $page->set('s', 'IDARTLANG', $idartlang);
377: $page->set('s', 'CLOSE', i18n('Close editor'));
378: $page->set('s', 'SAVE', i18n('Close editor and save changes'));
379: $page->set('s', 'QUESTION', i18n('Do you want to save changes?'));
380: 
381: // Add export and import tarnslations
382: $page->set('s', 'EXPORT_RAWDATA', i18n("Export raw data"));
383: $page->set('s', 'IMPORT_RAWDATA', i18n("Import raw data"));
384: $page->set('s', 'EXPORT_LABEL', i18n("Raw data export"));
385: $page->set('s', 'IMPORT_LABEL', i18n("Raw data import"));
386: $page->set('s', 'OVERWRITE_DATA_LABEL', i18n("Overwrite data"));
387: 
388: 
389: if (getEffectiveSetting('system', 'insite_editing_activated', 'true') == 'false') {
390:     $page->set('s', 'USE_TINY', '');
391: } else {
392:     $page->set('s', 'USE_TINY', '1');
393: }
394: 
395: // Show path of selected category to user
396: $breadcrumb = renderBackendBreadcrumb($syncoptions, true, true);
397: $page->set('s', 'CATEGORY', $breadcrumb);
398: 
399: if (count($result) <= 0) {
400:     $page->displayInfo(i18n("Article has no raw data"));
401:     $page->abortRendering();
402:     // $layoutcode .= '<div>--- ' . i18n("none") . ' ---</div>';
403: } else {
404:     foreach ($aIdtype as $idtype) {
405:         foreach ($sortID as $name) {
406:             if (in_array($name, array_keys($result)) && $result[$name][$idtype] != '') {
407:                 if (in_array($name . "[" . $idtype . "]", $currentTypes)) {
408:                     $class = '';
409:                 } else {
410:                     $class = ' noactive';
411:                 }
412:                 $page->set("d", "EXTRA_CLASS", $class);
413:                 $page->set("d", "NAME", $name);
414:                 $page->set("d", "ID_TYPE", $idtype);
415:                 if(in_array($name, $allowedContentTypes)) {
416:                     $page->set("d", "EXPORT_CONTENT",  '<input type="checkbox" class="rawtypes" name="' . $name .'" value="' .$idtype .'" checked="checked">');
417:                     $page->set('d', 'EXPORT_CONTENT_LABEL', i18n("Export"));
418:                 } else {
419:                     $page->set("d", "EXPORT_CONTENT", '');
420:                     $page->set('d', 'EXPORT_CONTENT_LABEL', '');
421:                 }
422:                 $page->next();
423:             }
424:         }
425:     }
426: }
427: 
428: // breadcrumb onclick
429: if (!isset($syncfrom)) {
430:     $syncfrom = -1;
431: }
432: $syncoptions = $syncfrom;
433: $page->set("s", "SYNCHOPTIONS", $syncoptions);
434: 
435: $page->set("s", "IDART", $idart);
436: $page->set("s", "IDCAT", $idcat);
437: $page->set("s", "IDLANG", $lang);
438: $page->set("s", "IDARTLANG", $idartlang);
439: $page->set("s", "IDCLIENT", $client);
440: 
441: // generate code
442: $code = _processCmsTags($aList, $result, true, $page->render(NULL, true));
443: 
444: if ($code == "0601") {
445:     markSubMenuItem("1");
446:     $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>";
447: } else {
448:     // inject some additional markup
449:     $code = cString::iReplaceOnce("</head>", "$markSubItem $scripts\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$encoding[$lang]\"></head>", $code);
450: }
451: 
452: if ($cfg["debug"]["codeoutput"]) {
453:     cDebug::out(conHtmlSpecialChars($code));
454: }
455: 
456: // show ContentTypeList
457: chdir(cRegistry::getFrontendPath());
458: eval("?>\n" . $code . "\n<?php\n");
459: // }
460: 
461: cRegistry::shutdown();
462: 
463: /**
464:  * Processes replacements of all existing CMS_...
465:  * tags within passed code
466:  *
467:  * @param array $aList CMS_...tags list
468:  * @param array $contentList all CMS variables
469:  * @param bool $saveKeywords Flag to save collected keywords during replacement
470:  *        process.
471:  * @param array $contentList Assoziative list of CMS variables
472:  */
473: function _processCmsTags($aList, $contentList, $saveKeywords = true, $layoutCode) {
474:     // #####################################################################
475:     // NOTE: Variables below are required in included/evaluated content type
476:     // codes!
477:     global $db, $db2, $sess, $cfg, $code, $cfgClient, $encoding, $notification;
478: 
479:     // NOTE: Variables below are additionally required in included/evaluated
480:     // content type codes within backend edit mode!
481:     global $edit, $editLink, $belang;
482: 
483:     $idcat = $_REQUEST['idcat'];
484:     $idart = $_REQUEST['idart'];
485:     $lang = $_REQUEST['lang'];
486:     $client = $_REQUEST['client'];
487:     $idartlang = $_REQUEST['idartlang'];
488:     $contenido = $_REQUEST['contenido'];
489: 
490:     // Get locked status (article freeze)
491:     $cApiArticleLanguage = new cApiArticleLanguage(cSecurity::toInteger($idartlang));
492:     $locked = $cApiArticleLanguage->getField('locked');
493: 
494:     // If article is locked show notification
495:     if ($locked == 1) {
496:         $notification->displayNotification('warning', i18n('This article is currently frozen and can not be edited!'));
497:     }
498: 
499:     if (!is_object($db2)) {
500:         $db2 = cRegistry::getDb();
501:     }
502:     // End: Variables required in content type codes
503:     // #####################################################################
504: 
505:     $match = array();
506:     $keycode = array();
507: 
508:     // $a_content is used by included/evaluated content type codes below
509:     $a_content = $contentList;
510: 
511:     // Select all cms_type entries
512:     $_typeList = array();
513:     $oTypeColl = new cApiTypeCollection();
514:     $oTypeColl->select();
515:     while ($oType = $oTypeColl->next()) {
516:         $_typeList[] = $oType->toObject();
517:     }
518: 
519:     // Replace all CMS_TAGS[]
520:     foreach ($_typeList as $_typeItem) {
521:         $key = strtolower($_typeItem->type);
522:         $type = $_typeItem->type;
523:         if (in_array($type, $aList)) {
524:             // Try to find all CMS_{type}[{number}] values, e. g. CMS_HTML[1]
525:             // $tmp = preg_match_all('/(' . $type . ')\[+([a-z0-9_]+)+\]/i',
526:             // $this->_layoutCode, $match);
527:             $tmp = preg_match_all('/(' . $type . '\[+(\d)+\])/i', $layoutCode, $match);
528: 
529:             $a_[$key] = $match[0];
530: 
531:             $success = array_walk($a_[$key], 'extractNumber');
532: 
533:             $search = array();
534:             $replacements = array();
535: 
536:             $backendPath = cRegistry::getBackendPath();
537: 
538:             $typeCodeFile = $backendPath . 'includes/type/code/include.' . $type . '.code.php';
539:             $cTypeClassFile = $backendPath . 'classes/content_types/class.content.type.' . strtolower(str_replace('CMS_', '', $type)) . '.php';
540:             // classname format: CMS_HTMLHEAD -> cContentTypeHtmlhead
541:             $className = 'cContentType' . ucfirst(strtolower(str_replace('CMS_', '', $type)));
542: 
543:             foreach ($a_[$key] as $val) {
544:                 if (cFileHandler::exists($cTypeClassFile)) {
545:                     $tmp = $a_content[$_typeItem->type][$val];
546:                     $cTypeObject = new $className($tmp, $val, $a_content);
547:                     if (cRegistry::isBackendEditMode() && $locked == 0) {
548:                         $tmp = $cTypeObject->generateEditCode();
549:                     } else {
550:                         $tmp = $cTypeObject->generateViewCode();
551:                     }
552:                 } else if (cFileHandler::exists($typeCodeFile)) {
553:                     // include CMS type code
554:                     include($typeCodeFile);
555:                 } elseif (!empty($_typeItem->code)) {
556:                     // old version, evaluate CMS type code
557:                     cDeprecated("Move code for $type from table into file system (contenido/includes/type/code/)");
558:                     eval($_typeItem->code);
559:                 }
560:                 $sql = "SELECT a.idcontent
561:                     FROM " . $cfg["tab"]["content"] . " as a, " . $cfg["tab"]["type"] . " as b
562:                     WHERE a.idartlang=" . cSecurity::toInteger($_REQUEST["idartlang"]) . " AND a.idtype=b.idtype AND a.typeid = " . cSecurity::toInteger($val) . " AND b.type = '" . cSecurity::toString($type) . "'
563:                     ORDER BY a.idartlang, a.idtype, a.typeid";
564:                 $db->query($sql);
565:                 while ($db->nextRecord()) {
566:                     $idcontent = $db->f("idcontent");
567:                 }
568:                 $backendUrl = cRegistry::getBackendUrl();
569: 
570:                 $search[$val] = sprintf('%s[%s]', $type, $val);
571:                 $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;
572:                 if ($_typeItem->idtype == 20 || $_typeItem->idtype == 21) {
573:                     $tmp = str_replace('";?>', '', $tmp);
574:                     $tmp = str_replace('<?php echo "', '', $tmp);
575:                     // echo
576:                     // "<textarea>"."?".">\n".stripslashes($tmp)."\n\";?"."><"."?php\n"."</textarea>";
577:                 }
578: 
579:                 if ($locked == 0) { // No freeze
580:                     $replacements[$val] = $tmp . '<a href="#" onclick="Con.showConfirmation(\'' . i18n("Are you sure you want to delete this content type from this article?") . '\', function() { Con.Tiny.setContent(\'1\',\'' . $path . '\'); });">
581:                 <img border="0" src="' . $backendUrl . 'images/delete.gif">
582:                 </a>';
583:                     $keycode[$type][$val] = $tmp . '<a href="#" onclick="Con.showConfirmation(\'' . i18n("Are you sure you want to delete this content type from this article?") . '\', function() { Con.Tiny.setContent(\'1\',\'' . $path . '\'); });">
584:                 <img border="0" src="' . $backendUrl . 'images/delete.gif">
585:                 </a>';
586:                 } else { // Freeze status
587:                     $replacements[$val] = $tmp;
588:                     $keycode[$type][$val] = $tmp;
589:                 }
590:             }
591: 
592:             $code = str_ireplace($search, $replacements, $layoutCode);
593:             // execute CEC hook
594:             $code = cApiCecHook::executeAndReturn('Contenido.Content.conGenerateCode', $code);
595:             $layoutCode = stripslashes($code);
596:         }
597:     }
598:     $layoutCode = str_ireplace("<<", "[", $layoutCode);
599:     $layoutCode = str_ireplace(">>", "]", $layoutCode);
600:     return $layoutCode;
601: }
602: 
603: /**
604:  * Processes get all existing active CMS_... tags within passed code
605:  *
606:  * @param array $r active CMS variables
607:  * @param array $aList CMS_...tags list
608:  */
609: function _getCurrentTypes($r, $aList) {
610:     $idcat = $_REQUEST['idcat'];
611:     $idart = $_REQUEST['idart'];
612:     $lang = $_REQUEST['lang'];
613:     $client = $_REQUEST['client'];
614:     global $db, $db2, $sess, $cfg, $code, $cfgClient, $encoding;
615: 
616:     // Select all cms_type entries
617:     $_typeList = array();
618:     $oTypeColl = new cApiTypeCollection();
619:     $oTypeColl->select();
620:     while ($oType = $oTypeColl->next()) {
621:         $_typeList[] = $oType->toObject();
622:     }
623: 
624:     // generate code
625:     $code = conGenerateCode($idcat, $idart, $lang, $client, false, false, false);
626:     foreach ($_typeList as $_typeItem) {
627:         $type = $_typeItem->type;
628:         if (in_array($type, $aList)) {
629:             // Try to find all CMS_{type}[{number}] values, e. g. CMS_HTML[1]
630:             $tmp = preg_match_all('/(' . $type . '\[+(\d)+\])/i', $code, $match);
631:             foreach ($match[0] as $s) {
632:                 if (!in_array($s, $r)) {
633:                     array_push($r, $s);
634:                 }
635:             }
636:         }
637:     }
638:     return $r;
639: }
640: 
CMS CONTENIDO 4.9.4 API documentation generated by ApiGen 2.8.0