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
    • NavigationMain
    • 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
  • generateInfoButton
  • generateJs
  • getAktuellType
  • getAllClientsAndLanguages
  • getArtLang
  • getArtspec
  • getAvailableContentTypes
  • getCanonicalDay
  • getCanonicalMonth
  • getDirectorySize
  • getEffectiveSetting
  • getEffectiveSettingsByType
  • getEncodingByLanguage
  • getFileContents
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParam
  • getParentAreaId
  • getSearchResults
  • getStrExpandCollapseButton
  • getSystemProperties
  • getSystemPropertiesByType
  • getSystemProperty
  • getTemplateSelect
  • getUplExpandCollapseButton
  • htmldecode
  • htmlentities_iso88592
  • humanReadableSize
  • includePlugins
  • insertEmptyStrRow
  • ipMatch
  • isAlphanumeric
  • isArchive
  • isArtInMultipleUse
  • 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
  • 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
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the backend ajax handler class.
  4:  *
  5:  * @package    Core
  6:  * @subpackage Backend
  7:  * @version    SVN Revision $Rev:$
  8:  *
  9:  * @author     Timo Trautmann
 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: /**
 19:  * Class for outputting some content for Ajax use
 20:  *
 21:  * @package    Core
 22:  * @subpackage Backend
 23:  */
 24: class cAjaxRequest {
 25: 
 26:     /**
 27:      * Function for handling requested ajax data
 28:      *
 29:      * @param string $action - name of requested ajax action
 30:      */
 31:     public function handle($action) {
 32:         $backendPath = cRegistry::getBackendPath();
 33:         $string = '';
 34: 
 35:         $frontendURL = cRegistry::getFrontendUrl();
 36:         $frontendPath = cRegistry::getFrontendPath();
 37: 
 38:         switch ($action) {
 39:             // case to get an article select box param name value and idcat were
 40:             // neded (name= name of select box value=selected item)
 41:             case 'artsel':
 42:                 $name = (string) $_REQUEST['name'];
 43:                 $value = (int) $_REQUEST['value'];
 44:                 $idCat = (int) $_REQUEST['idcat'];
 45:                 $string = buildArticleSelect($name, $idCat, $value);
 46:                 break;
 47: 
 48:             case 'dirlist':
 49:                 global $cfgClient, $client;
 50: 
 51:                 $dirName = (string) $_REQUEST['dir'];
 52:                 $fileListId = (int) $_REQUEST['id'];
 53:                 $idArtLang = (int) $_REQUEST['idartlang'];
 54: 
 55:                 $art = new cApiArticleLanguage($idArtLang, true);
 56:                 $artReturn = $art->getContent('CMS_FILELIST', $fileListId);
 57:                 $fileList = new cContentTypeFilelist($artReturn, $fileListId, array());
 58: 
 59:                 $string = $fileList->generateDirectoryList($fileList->buildDirectoryList($cfgClient[$client]['upl']['path'] . $dirName));
 60:                 break;
 61: 
 62:             case 'filelist':
 63:                 $dirName = (string) $_REQUEST['dir'];
 64:                 $fileListId = (int) $_REQUEST['id'];
 65:                 $idArtLang = (int) $_REQUEST['idartlang'];
 66: 
 67:                 $art = new cApiArticleLanguage($idArtLang, true);
 68:                 $artReturn = $art->getContent('CMS_FILELIST', $fileListId);
 69:                 $fileList = new cContentTypeFilelist($artReturn, $fileListId, array());
 70: 
 71:                 $string = $fileList->generateFileSelect($dirName);
 72:                 break;
 73: 
 74:             case 'inused_layout':
 75:                 // list of used templates for a layout
 76:                 global $cfg;
 77:                 if ((int) $_REQUEST['id'] > 0) {
 78:                     $layout = new cApiLayout((int) $_REQUEST['id']);
 79:                     if ($layout->isInUse(true)) {
 80:                         $template = new cTemplate();
 81:                         $usedTemplates = $layout->getUsedTemplates();
 82:                         if (count($usedTemplates) > 0) {
 83:                             $response = '<br />';
 84:                             foreach ($usedTemplates as $i => $usedTemplate) {
 85:                                 if ($i%2 == 0) {
 86:                                     $template->set('d', 'CLASS', 'grey');
 87:                                 } else {
 88:                                     $template->set('d', 'CLASS', 'white');
 89:                                 }
 90:                                 $template->set('d', 'NAME', $usedTemplate['tpl_name']);
 91:                                 $template->next();
 92:                             }
 93: 
 94:                             $string = '<div class="inuse_info" >' . $template->generate($backendPath . $cfg['path']['templates'] . $cfg['templates']['inuse_lay_mod'], true) . '</div>';
 95:                         } else {
 96:                             $string = i18n('No data found!');
 97:                         }
 98:                     }
 99:                 }
100:                 break;
101: 
102:             case 'inused_module':
103:                 // list of used templates for a module
104:                 global $cfg;
105:                 $module = new cApiModule();
106:                 if ((int) $_REQUEST['id'] > 0 && $module->moduleInUse((int) $_REQUEST['id'], true)) {
107:                     $template = new cTemplate();
108:                     $usedTemplates = $module->getUsedTemplates();
109:                     if (count($usedTemplates) > 0) {
110:                         foreach ($usedTemplates as $i => $usedTemplate) {
111:                             if ($i%2 == 0) {
112:                                 $template->set('d', 'CLASS', 'grey');
113:                             } else {
114:                                 $template->set('d', 'CLASS', 'white');
115:                             }
116: 
117:                             $template->set('d', 'NAME', $usedTemplate['tpl_name']);
118:                             $template->next();
119:                         }
120: 
121:                         $string = '<div class="inuse_info" >' . $template->generate($backendPath . $cfg['path']['templates'] . $cfg['templates']['inuse_lay_mod'], true) . '</div>';
122:                     } else {
123:                         $string = i18n('No data found!');
124:                     }
125:                 }
126:                 break;
127: 
128:             case 'inused_template':
129:                 // list of used category and art
130:                 global $cfg;
131:                 cInclude('backend', 'includes/functions.tpl.php');
132: 
133:                 if ((int) $_REQUEST['id'] > 0) {
134:                     $template = new cTemplate();
135:                     $template->reset();
136:                     $usedData = tplGetInUsedData((int) $_REQUEST['id']);
137: 
138:                     if (isset($usedData['cat'])) {
139:                         $template->set('s', 'HEAD_TYPE', i18n('Category'));
140:                         foreach ($usedData['cat'] as $i => $cat) {
141:                             $template->set('d', 'ID', $cat['idcat']);
142:                             $template->set('d', 'LANG', $cat['lang']);
143:                             $template->set('d', 'NAME', $cat['name']);
144:                             $template->next();
145:                         }
146:                         $template->set('s', 'HEAD_ID', i18n('idcat'));
147:                         $template->set('s', 'HEAD_LANG', i18n('idlang'));
148:                         $template->set('s', 'HEAD_NAME', i18n('Name'));
149:                         $response = $template->generate($backendPath . $cfg['path']['templates'] . $cfg['templates']['inuse_tpl'], true);
150:                     }
151: 
152:                     $template->reset();
153: 
154:                     if (isset($usedData['art'])) {
155:                         $template->set('s', 'HEAD_TYPE', i18n('Article'));
156:                         foreach ($usedData['art'] as $i => $aArt) {
157:                             $template->set('d', 'ID', $aArt['idart']);
158:                             $template->set('d', 'LANG', $aArt['lang']);
159:                             $template->set('d', 'NAME', $aArt['title']);
160:                             $template->next();
161:                         }
162:                         $template->set('s', 'HEAD_ID', i18n('idart'));
163:                         $template->set('s', 'HEAD_LANG', i18n('idlang'));
164:                         $template->set('s', 'HEAD_NAME', i18n('Name'));
165:                         $response .= $template->generate($backendPath . $cfg['path']['templates'] . $cfg['templates']['inuse_tpl'], true);
166:                     }
167: 
168:                     $string = '<div class="inuse_info" >' . $response . '</div>';
169:                 } else {
170:                     $string = i18n('No data found!');
171:                 }
172: 
173:                 break;
174: 
175:             case 'scaleImage':
176:                 $filename_a = $_REQUEST['url'];
177:                 $filename = str_replace($frontendURL, $frontendPath, $filename_a);
178:                 // $filename muss not url path(http://) sondern globale PC
179:                 // Path(c:/) sein.
180:                 $filetype = substr($filename, strlen($filename) - 4, 4);
181:                 switch (strtolower($filetype)) {
182:                     case '.gif':
183:                         $string = cApiImgScale($filename, 428, 210);
184:                         break;
185:                     case '.png':
186:                         $string = cApiImgScale($filename, 428, 210);
187:                         break;
188:                     case '.jpg':
189:                         $string = cApiImgScale($filename, 428, 210);
190:                         break;
191:                     case 'jpeg':
192:                         $string = cApiImgScale($filename, 428, 210);
193:                         break;
194:                     default:
195:                         $string = $filename_a;
196:                         break;
197:                 }
198:                 // if can not scale, so $sString is null, then show the original
199:                 // image.
200:                 if ($string == '') {
201:                     $filename = str_replace($frontendPath,$frontendURL, $filename_a);
202:                     $string = $filename;
203:                 }
204:                 break;
205: 
206:             case 'imagelist':
207:                 global $cfg, $client, $lang, $cfgClient;
208: 
209:                 $dirName = (string) $_REQUEST['dir'];
210:                 $imageId = (int) $_REQUEST['id'];
211:                 $idArtLang = (int) $_REQUEST['idartlang'];
212: 
213:                 $art = new cApiArticleLanguage($idArtLang, true);
214:                 $artReturn = $art->getContent('CMS_IMGEDITOR', $imageId);
215:                 $image = new cContentTypeImgeditor($artReturn, $imageId, array());
216: 
217:                 $string = $image->generateFileSelect($dirName);
218:                 break;
219: 
220:             case 'loadImageMeta':
221:                 $imageId = (int) $_REQUEST['id'];
222:                 $idArtLang = (int) $_REQUEST['idartlang'];
223: 
224:                 $art = new cApiArticleLanguage($idArtLang, true);
225:                 $artReturn = $art->getContent('CMS_IMGEDITOR', $imageId);
226:                 $image = new cContentTypeImgeditor($artReturn, $imageId, array());
227: 
228:                 $filename = (string) basename($_REQUEST['filename']);
229:                 $dirname = (string) dirname($_REQUEST['filename']);
230:                 if ($dirname != '.') {
231:                     $dirname .= '/';
232:                 } else {
233:                     $dirname = '';
234:                 }
235: 
236:                 $string = $image->getImageMeta($filename, $dirname);
237:                 break;
238: 
239:             case 'upl_mkdir':
240:                 $imageId = (int) $_REQUEST['id'];
241:                 $idArtLang = (int) $_REQUEST['idartlang'];
242:                 $path = (string) $_REQUEST['path'];
243:                 $name = (string) $_REQUEST['foldername'];
244: 
245:                 $art = new cApiArticleLanguage($idArtLang, true);
246:                 $artReturn = $art->getContent('CMS_IMGEDITOR', $imageId);
247:                 $image = new cContentTypeImgeditor($artReturn, $imageId, array());
248: 
249:                 $string = $image->uplmkdir($path, $name);
250:                 break;
251: 
252:             case 'upl_upload':
253:                 $imageId = (int) $_REQUEST['id'];
254:                 $idArtLang = (int) $_REQUEST['idartlang'];
255:                 $path = (string) $_REQUEST['path'];
256: 
257:                 $art = new cApiArticleLanguage($idArtLang, true);
258:                 $artReturn = $art->getContent('CMS_IMGEDITOR', $imageId);
259:                 $image = new cContentTypeImgeditor($artReturn, $imageId, array());
260: 
261:                 $string = $image->uplupload($path);
262:                 break;
263: 
264:             case 'linkeditorfilelist':
265:                 $id = (int) $_REQUEST['id'];
266:                 $idArtLang = (int) $_REQUEST['idartlang'];
267:                 $idCat = (string) $_REQUEST['idcat'];
268: 
269:                 $art = new cApiArticleLanguage($idArtLang, true);
270:                 $artReturn = $art->getContent('CMS_LINKEDITOR', $id);
271:                 $linkEditor = new cContentTypeLinkeditor($artReturn, $id, array());
272: 
273:                 $string = $linkEditor->generateArticleSelect($idCat);
274:                 break;
275: 
276:             case 'linkeditordirlist':
277:                 $id = (int) $_REQUEST['id'];
278:                 $idArtLang = (int) $_REQUEST['idartlang'];
279:                 $levelId = (string) $_REQUEST['level'];
280:                 $parentidcat = (string) $_REQUEST['parentidcat'];
281: 
282:                 $art = new cApiArticleLanguage($idArtLang, true);
283:                 $artReturn = $art->getContent('CMS_LINKEDITOR', $id);
284:                 $linkEditor = new cContentTypeLinkeditor($artReturn, $id, array());
285: 
286:                 $string = $linkEditor->getCategoryList($linkEditor->buildCategoryArray($levelId, $parentidcat));
287:                 break;
288: 
289:             case 'linkeditorimagelist':
290:                 $dirName = (string) $_REQUEST['dir'];
291:                 $id = (int) $_REQUEST['id'];
292:                 $idArtLang = (int) $_REQUEST['idartlang'];
293: 
294:                 $art = new cApiArticleLanguage($idArtLang, true);
295:                 $artReturn = $art->getContent('CMS_LINKEDITOR', $id);
296:                 $linkEditor = new cContentTypeLinkeditor($artReturn, $id, array());
297: 
298:                 $string = $linkEditor->getUploadFileSelect($dirName);
299:                 break;
300: 
301:             case 'generaljstranslations':
302:                 $translations = array();
303:                 $translations['Confirmation Required'] = i18n('Confirmation Required');
304:                 $translations['OK'] = i18n('OK');
305:                 $translations['Cancel'] = i18n('Cancel');
306:                 $string = json_encode($translations);
307:                 break;
308: 
309:             case 'logfilecontent':
310:                 $type = $_REQUEST['logfile'];
311:                 $numberOfLines = $_REQUEST['numberOfLines'];
312:                 $cfg = cRegistry::getConfig();
313:                 $filename = $cfg['path']['frontend'] . DS . $cfg['path']['logs'] . $type;
314:                 $string = cFileHandler::read($filename);
315:                 $lines = file($filename);
316:                 $lines = array_splice($lines, $numberOfLines * -1);
317:                 $string = implode('', $lines);
318:                 break;
319: 
320:             default:
321:                 // if action is unknown generate error message
322:                 $string = 'Unknown Ajax Action';
323:                 break;
324:         }
325: 
326:         return $string;
327:     }
328: 
329: }
330: 
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0