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
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SIWECOS
    • 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
  • cRights
  • 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
  • cApiImageCheckImageEditingPossibility
  • 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
  • conGetUniqueArticleUrlname
  • conGetUsedModules
  • conHtmlentities
  • conHtmlEntityDecode
  • conHtmlSpecialChars
  • conIsArticleUrlnameUnique
  • conIsLocked
  • conLock
  • conLockBulkEditing
  • conMakeArticleIndex
  • conMakeCatOnline
  • conMakeInlineScript
  • conMakeOnline
  • conMakeOnlineBulkEditing
  • conMakePublic
  • conMakeStart
  • conMoveArticles
  • conPhp54Check
  • conRemoveOldCategoryArticle
  • conSaveContentEntry
  • conSetCodeFlag
  • conSetCodeFlagBulkEditing
  • conSetMetaValue
  • conSetStartArticle
  • consoleLog
  • 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
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getJsHelpContext
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParentAreaId
  • getRightsList
  • 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
  • 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
  • strCheckAlias
  • 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
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the module synchronizer class.
  5:  *
  6:  * @todo refactor documentation
  7:  *
  8:  * @package    Core
  9:  * @subpackage Backend
 10:  * @author     Rusmir Jusufovic
 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.api.string.php');
 20: cInclude('includes', 'functions.con.php');
 21: 
 22: /**
 23:  * This class synchronized the contents of modul dir with the table
 24:  * $cfg['tab']['mod']. If a modul exist in modul dir but not in
 25:  * $cfg['tab']['mod'] this class will insert the modul in the table.
 26:  *
 27:  * @package    Core
 28:  * @subpackage Backend
 29:  */
 30: class cModuleSynchronizer extends cModuleHandler {
 31: 
 32:     /**
 33:      * The last id of the module that had changed or had added.
 34:      *
 35:      * @var int
 36:      */
 37:     private $_lastIdMod = 0;
 38: 
 39:     /**
 40:      * This method insert a new modul in $cfg['tab']['mod'] table, if
 41:      * the name of modul dont exist
 42:      *
 43:      * @param string $dir
 44:      * @param string $oldModulName
 45:      * @param string $newModulName
 46:      *
 47:      * @throws cDbException
 48:      * @throws cException
 49:      * @throws cInvalidArgumentException
 50:      */
 51:     private function _syncModule($dir, $oldModulName, $newModulName) {
 52:         global $client;
 53:         // if modul dont exist in the $cfg['tab']['mod'] table.
 54:         if ($this->_isExistInTable($oldModulName, $client) == false) {
 55:             // add new Module in db-tablle
 56:             $this->_addModule($newModulName);
 57:         } else {
 58:             // update the name of the module
 59:             if ($oldModulName != $newModulName) {
 60:                 $this->_updateModulnameInDb($oldModulName, $newModulName, $client);
 61:             }
 62:         }
 63:     }
 64: 
 65:     /**
 66:      * Rename css, js and input/output file
 67:      *
 68:      * @param string $dir
 69:      * @param string $oldModulName
 70:      * @param string $newModulName
 71:      */
 72:     private function _renameFiles($dir, $oldModulName, $newModulName) {
 73:         if (cFileHandler::exists($dir . $newModulName . '/' . $this->_directories['php'] . $oldModulName . '_input.php') == true) {
 74:             rename($dir . $newModulName . '/' . $this->_directories['php'] . $oldModulName . '_input.php', $dir . $newModulName . '/' . $this->_directories['php'] . $newModulName . '_input.php');
 75:         }
 76: 
 77:         if (cFileHandler::exists($dir . $newModulName . '/' . $this->_directories['php'] . $oldModulName . '_output.php') == true) {
 78:             rename($dir . $newModulName . '/' . $this->_directories['php'] . $oldModulName . '_output.php', $dir . $newModulName . '/' . $this->_directories['php'] . $newModulName . '_output.php');
 79:         }
 80: 
 81:         if (cFileHandler::exists($dir . $newModulName . '/' . $this->_directories['css'] . $oldModulName . '.css') == true) {
 82:             rename($dir . $newModulName . '/' . $this->_directories['css'] . $oldModulName . '.css', $dir . $newModulName . '/' . $this->_directories['css'] . $newModulName . '.css');
 83:         }
 84: 
 85:         if (cFileHandler::exists($dir . $newModulName . '/' . $this->_directories['js'] . $oldModulName . '.js') == true) {
 86:             rename($dir . $newModulName . '/' . $this->_directories['js'] . $oldModulName . '.js', $dir . $newModulName . '/' . $this->_directories['js'] . $newModulName . '.js');
 87:         }
 88:     }
 89: 
 90:     /**
 91:      * Rename the Modul files and Modul dir
 92:      *
 93:      * @param string $dir
 94:      *         path the the moduls
 95:      * @param string $dirNameOld
 96:      *         old dir name
 97:      * @param string $dirNameNew
 98:      *         new dir name
 99:      * @param int $client
100:      *         idclient
101:      * @return bool
102:      *         true on success or false on failure
103:      */
104:     private function _renameFileAndDir($dir, $dirNameOld, $dirNameNew, $client) {
105:         if (rename($dir . $dirNameOld, $dir . $dirNameNew) == FALSE) {
106:             return false;
107:         } else { // change names of the files
108:             $this->_renameFiles($dir, $dirNameOld, $dirNameNew);
109:         }
110:         return true;
111:     }
112: 
113:     /**
114:      * Compare file change timestemp and the timestemp in ['tab']['mod'].
115:      * If file had changed make new code :conGenerateCodeForAllArtsUsingMod
116:      *
117:      * @return int
118:      *         id of last update module
119:      * @throws cDbException
120:      * @throws cException
121:      * @throws cInvalidArgumentException
122:      */
123:     public function compareFileAndModuleTimestamp() {
124:         global $cfgClient;
125: 
126:         $db = cRegistry::getDb();
127:         $db->query('
128:             SELECT lastmodified, idclient, description, type, `name`, alias, idmod
129:             FROM ' . $this->_cfg['tab']['mod'] . '
130:             WHERE idclient = ' . cSecurity::toInteger($this->_client));
131: 
132:         $synchLock = 0;
133:         $retIdMod  = 0;
134: 
135:         // for performance reasons IDs of modules are collected in order to generate their code
136:         $idmods    = [];
137: 
138:         while ($db->nextRecord()) {
139:             $showMessage = false;
140: 
141:             $modulePath = $cfgClient[$db->f('idclient')]['module']['path'] . $db->f('alias') . '/';
142:             $modulePHP = $modulePath . $this->_directories['php'] . $db->f('alias');
143: 
144:             $lastmodified = $db->f('lastmodified');
145:             $lastmodified = DateTime::createFromFormat('Y-m-d H:i:s', $lastmodified);
146:             $lastmodified = $lastmodified->getTimestamp();
147: 
148:             $lastmodInput = $lastmodOutput = 0;
149: 
150:             if (cFileHandler::exists($modulePHP . '_input.php')) {
151:                 $lastmodInput = filemtime($modulePHP . '_input.php');
152:             }
153: 
154:             if (cFileHandler::exists($modulePHP . '_output.php')) {
155:                 $lastmodOutput = filemtime($modulePHP . '_output.php');
156:             }
157: 
158:             if (cFileHandler::exists($modulePath . "info.xml")) {
159:                 $lastModInfo = filemtime($modulePath . "info.xml");
160:                 if ($lastModInfo > $lastmodified) {
161:                     try {
162:                         $xml = cFileHandler::read($modulePath . 'info.xml');
163:                     } catch (cInvalidArgumentException $e) {
164:                         $xml = '';
165:                     }
166:                     $modInfo = cXmlBase::xmlStringToArray($xml);
167:                     $mod     = new cApiModule($db->f("idmod"));
168:                     if ($modInfo["description"] != $mod->get("description")) {
169:                         $mod->set("description", $modInfo["description"]);
170:                         $this->setLastModified($lastModInfo, $db->f('idmod'));
171:                     }
172:                     if ($modInfo["type"] != $mod->get("type")) {
173:                         $mod->set("type", $modInfo["type"]);
174:                         $this->setLastModified($lastModInfo, $db->f('idmod'));
175:                     }
176: 
177:                     if ($modInfo["name"] != $mod->get("name")) {
178:                         $mod->set("name", $modInfo["name"]);
179:                         $this->setLastModified($lastModInfo, $db->f('idmod'));
180:                     }
181: 
182:                     if ($modInfo["alias"] != $mod->get("alias")) {
183:                         $mod->set("alias", $modInfo["alias"]);
184:                         $this->setLastModified($lastModInfo, $db->f('idmod'));
185:                     }
186:                     $mod->store(true);
187:                     $synchLock = 1;
188:                     $showMessage = true;
189:                 }
190:             }
191: 
192:             $lastmodabsolute = max($lastmodInput, $lastmodOutput);
193:             if ($lastmodified < $lastmodabsolute) {
194:                 $synchLock = 1;
195:                 $this->setLastModified($lastmodabsolute, $db->f('idmod'));
196:                 $idmods[] = (int) $db->f('idmod');
197:                 $showMessage = true;
198:             }
199: 
200:             if (($idmod = $this->_synchronizeFilesystemAndDb($db)) != 0) {
201:                 $retIdMod = $idmod;
202:             }
203: 
204:             if ($showMessage) {
205:                 cRegistry::appendLastOkMessage(sprintf(i18n('Module %s successfully synchronized'), $db->f('name')));
206:             }
207:         }
208: 
209:         if (count($idmods)) {
210:             conGenerateCodeForAllartsUsingMod($idmods);
211:         }
212: 
213:         if ($synchLock == 0) {
214:             cRegistry::addInfoMessage(i18n('All modules are already synchronized'));
215:         }
216: 
217:         // we need it for the update of moduls on the left site (module/backend)
218:         return $retIdMod;
219:     }
220: 
221:     /**
222:      * If someone delete a moduldir with ftp/ssh.
223:      * We have a modul
224:      * in db but not in directory, if the modul in use make a new modul in
225:      * fileystem but if not
226:      * clear it from filesystem.
227:      *
228:      * @param cDb $db
229:      *         CONTENIDO database object
230:      *
231:      * @return int
232:      *         id of last update module
233:      * @throws cDbException
234:      * @throws cException
235:      * @throws cInvalidArgumentException
236:      */
237:     private function _synchronizeFilesystemAndDb($db) {
238:         $returnIdMod = 0;
239:         $this->initWithDatabaseRow($db);
240:         // modul dont exist in filesystem
241:         if ($this->modulePathExists() == false) {
242:             $modul = new cApiModule($db->f('idmod'));
243:             $returnIdMod = $db->f('idmod');
244:             if ($modul->moduleInUse($db->f('idmod')) == true) {
245:                 // modul in use, make new modul in filesystem
246:                 if ($this->createModule() == false) {
247:                     $notification = new cGuiNotification();
248:                     $notification->displayNotification('error', i18n("Can not create module") . " " . $db->f('name'));
249:                 }
250:             } else {
251:                 // modul not in use, delete it
252:                 $sql = sprintf('DELETE  FROM %s WHERE idmod = %s AND idclient = %s', $this->_cfg['tab']['mod'], $db->f('idmod'), $this->_client);
253:                 $myDb = cRegistry::getDb();
254:                 $myDb->query($sql);
255:             }
256:         }
257:         return $returnIdMod;
258:     }
259: 
260:     /**
261:      * Depending on the client, this method
262:      * will check the modul dir of the client and if found
263:      * a Modul(Dir) that not exist in Db-table this method will
264:      * insert the Modul in Db-table ([tab][mod]).
265:      *
266:      * @return int
267:      *         last id of synchronized module
268:      * @throws cDbException
269:      * @throws cException
270:      * @throws cInvalidArgumentException
271:      */
272:     public function synchronize() {
273:         global $cfgClient;
274: 
275:         // get the path to the modul dir from the client
276:         $dir = $cfgClient[$this->_client]['module']['path'];
277: 
278:         if (is_dir($dir)) {
279:             if (false !== ($handle = cDirHandler::read($dir))) {
280:                 foreach ($handle as $file) {
281:                     if (false === cFileHandler::fileNameBeginsWithDot($file) && is_dir($dir . $file . '/')) {
282:                         $newFile = cString::cleanURLCharacters($file);
283:                         // dir is ok
284:                         if ($newFile == $file) {
285:                             $this->_syncModule($dir, $file, $newFile);
286:                         } else { // dir not ok (with not allowed characters)
287:                             if (is_dir($dir . $newFile)) { // exist the new dir
288:                                 // name?
289:                                 // make new dirname
290:                                 $newDirName = $newFile . cString::getPartOfString(md5(time() . rand(0, time())), 0, 4);
291: 
292:                                 // rename
293:                                 if ($this->_renameFileAndDir($dir, $file, $newDirName, $this->_client) != false) {
294:                                     $this->_syncModule($dir, $file, $newDirName);
295:                                 }
296:                             } else { // $newFile (dir) not exist
297:                                 // rename dir old
298:                                 if ($this->_renameFileAndDir($dir, $file, $newFile, $this->_client) != false) {
299:                                     $this->_syncModule($dir, $file, $newFile);
300:                                 }
301:                             }
302:                         }
303:                     }
304:                 }
305:             }
306:         }
307: 
308:         // last Modul Id that will refresh the windows /modul overview
309:         return $this->_lastIdMod;
310:     }
311: 
312:     /**
313:      * This method look in the db-table $cfg['tab']['mod'] for a modul
314:      * name.
315:      * If the modul name exist it will return true
316:      *
317:      * @param string $alias
318:      * @param int    $idclient
319:      *         idclient
320:      * @return bool
321:      *         if a modul with the $name exist in the $cfg['tab']['mod'] table
322:      *         return true else false
323:      * @throws cDbException
324:      */
325:     private function _isExistInTable($alias, $idclient) {
326:         $db = cRegistry::getDb();
327: 
328:         // Select depending from idclient all moduls wiht the name $name
329:         $sql = sprintf("SELECT * FROM %s WHERE alias='%s' AND idclient=%s", $this->_cfg['tab']['mod'], $alias, $idclient);
330: 
331:         $db->query($sql);
332: 
333:         // a record is found
334:         if ($db->nextRecord()) {
335:             return true;
336:         } else {
337:             return false;
338:         }
339:     }
340: 
341:     /**
342:      * Update the name of module (if the name not allowes)
343:      *
344:      * @param string $oldName
345:      *         old name
346:      * @param string $newName
347:      *         new module name
348:      * @param int    $idclient
349:      *         id of client
350:      * @throws cDbException
351:      */
352:     private function _updateModulnameInDb($oldName, $newName, $idclient) {
353:         $db = cRegistry::getDb();
354: 
355:         // Select depending from idclient all modules wiht the name $name
356:         $sql = sprintf("SELECT * FROM %s WHERE alias='%s' AND idclient=%s", $this->_cfg['tab']['mod'], $oldName, $idclient);
357: 
358:         $db->query($sql);
359: 
360:         // a record is found
361:         if ($db->nextRecord()) {
362:             $sqlUpdateName = sprintf("UPDATE %s SET alias='%s' WHERE idmod=%s", $this->_cfg['tab']['mod'], $newName, $db->f('idmod'));
363:             $db->query($sqlUpdateName);
364:             return;
365:         }
366:     }
367: 
368:     /**
369:      * This method add a new Modul in the table $cfg['tab']['mod'].
370:      *
371:      * @param string $name
372:      *         name of the new module
373:      *
374:      * @throws cDbException
375:      * @throws cException
376:      * @throws cInvalidArgumentException
377:      */
378:     private function _addModule($name) {
379: 
380:         // initializing variables
381:         $client       = cRegistry::getClientId();
382:         $alias        = $name;
383:         $type         = '';
384:         $error        = 'none';
385:         $description  = '';
386:         $deletable    = 0;
387:         $template     = '';
388:         $static       = 0;
389:         $package_guid = '';
390:         $package_data = '';
391:         $author       = '';
392:         $created      = '';
393:         $lastmodified = '1970-01-01 00:00:00';
394: 
395:         // old behaviour before CON-2603
396:         // $cfgClient    = cRegistry::getClientConfig(cRegistry::getClientId());
397:         // $modulePath   = $cfgClient['module']['path'] . $name . '/';
398:         // $modInfo      = cXmlBase::xmlStringToArray(cFileHandler::read($modulePath . 'info.xml'));
399:         // $name         = $modInfo['name'];
400:         // $alias        = $modInfo['alias'];
401:         // $type         = $modInfo['type'];
402:         // $lastmodified = '';
403: 
404:         // create mew module
405:         $oModColl = new cApiModuleCollection();
406:         $mod = $oModColl->create(
407:             $name,
408:             $client,
409:             $alias,
410:             $type,
411:             $error,
412:             $description,
413:             $deletable,
414:             $template,
415:             $static,
416:             $package_guid,
417:             $package_data,
418:             $author,
419:             $created,
420:             $lastmodified
421:         );
422: 
423:         // save last module id
424:         if (is_object($mod)) {
425:             $this->_lastIdMod = $mod->get('idmod');
426:         }
427:     }
428: 
429:     /**
430:      * Update the con_mod, the field lastmodified
431:      *
432:      * @param int $timestamp
433:      *         timestamp of last modification
434:      * @param int $idmod
435:      *         id of module
436:      * @throws cDbException
437:      * @throws cInvalidArgumentException
438:      */
439:     public function setLastModified($timestamp, $idmod) {
440:         $oMod = new cApiModule((int) $idmod);
441:         if ($oMod->isLoaded()) {
442:             $oMod->set('lastmodified', date('Y-m-d H:i:s', $timestamp));
443:             $oMod->store(true);
444:         }
445:     }
446: 
447: }
448: 
CMS CONTENIDO 4.10.1 API documentation generated by ApiGen 2.8.0