//sets the edition status and validate it $pg->setProposedLocation(RESOURCE_LOCATION_USERSPACE, $cms_user); $pg->validateProposedLocation(); //add an edition to the page if (APPLICATION_ENFORCES_WORKFLOW) { $pg->addEdition(RESOURCE_EDITION_CONTENT, $cms_user); } //don't add an edition (siblings order) to the father (which was the previous behavior) //$father->addEdition(RESOURCE_EDITION_SIBLINGSORDER, $cms_user); $pg->writeToPersistence(); $father->writeToPersistence(); //move the data if ($pg->getPublication() == RESOURCE_PUBLICATION_PUBLIC) { CMS_module_standard::_changeDataLocation($pg, RESOURCE_DATA_LOCATION_ARCHIVED, RESOURCE_DATA_LOCATION_PUBLIC, true); } CMS_module_standard::_changeDataLocation($pg, RESOURCE_DATA_LOCATION_ARCHIVED, RESOURCE_DATA_LOCATION_EDITED, false); //attach the page to the tree CMS_tree::attachPageToTree($pg, $father); if ($pg->getPublication() != RESOURCE_PUBLICATION_NEVERVALIDATED) { CMS_tree::attachPageToTree($pg, $father, true); } if (!APPLICATION_ENFORCES_WORKFLOW) { //submit the page to the regenerator CMS_tree::submitToRegenerator($pg->getID(), true); //validate the father $pg->regenerate(true); $validation = new CMS_resourceValidation(MOD_STANDARD_CODENAME, RESOURCE_EDITION_SIBLINGSORDER + RESOURCE_EDITION_CONTENT, $father); $mod = CMS_modulesCatalog::getByCodename(MOD_STANDARD_CODENAME); $mod->processValidation($validation, VALIDATION_OPTION_ACCEPT); } $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE);
//Reset session (start fresh) Zend_Session::destroy(); break; case 'reconnect': //display error login window on top of login form $loginError = "\n\t\tAutomne.message.popup({\n\t\t\tmsg: '{$cms_language->getJsMessage(MESSAGE_ERROR_SESSION_EXPIRED)}',\n\t\t\tbuttons: Ext.MessageBox.OK,\n\t\t\ticon: Ext.MessageBox.ERROR,\n\t\t\tfn:function() {\n\t\t\t\tloginWindow.body.mask('{$cms_language->getJsMessage(MESSAGE_PAGE_PLEASE_WAIT)}');\n\t\t\t\tloginWindow.reload();\n\t\t\t}\n\t\t});"; //Disconnect user CMS_session::authenticate(array('disconnect' => true, 'type' => 'admin')); break; case '': //launch authentification process (for modules which can use it) CMS_session::authenticate(array('authenticate' => true, 'type' => 'admin')); $cms_user = CMS_session::getUser(); if ($cms_user && $cms_user->hasAdminAccess()) { //launch the daily routine incase it's not in the cron CMS_module_standard::processDailyRoutine(); //then set context and load Automne interface $userSessionsInfos = CMS_session::getSessionInfos(); $cms_language = $cms_user->getLanguage(); //welcome message $welcome = $cms_language->getJsMessage(MESSAGE_PAGE_USER_WELCOME, array($userSessionsInfos['fullname'])); $welcomeMsg = ''; //last login $logs = CMS_log_catalog::search('', 0, $cms_user->getUserId(), array(CMS_log::LOG_ACTION_AUTO_LOGIN, CMS_log::LOG_ACTION_LOGIN), false, false, 0, 2, 'datetime', 'desc', false); if (isset($logs[1])) { $welcomeMsg .= '<br /><br />' . $cms_language->getJsMessage(MESSAGE_PAGE_PREVIOUS_LOGIN) . ' ' . $logs[1]->getDateTime()->getLocalizedDate($cms_language->getDateFormat() . ' H:i:s'); } //validations if ($userSessionsInfos['hasValidations']) { $welcomeMsg .= '<br /><br />' . ($userSessionsInfos['awaitingValidation'] ? $cms_language->getJsMessage(MESSAGE_PAGE_USER_VALIDATIONS, array($userSessionsInfos['awaitingValidation'])) : $cms_language->getJsMessage(MESSAGE_PAGE_USER_NOVALIDATION)); }
/** * Process the daily routine, which typically put out of userspace resources which have a past publication date * * @return void * @access public */ function processDailyRoutine() { //see if the action was done today $sql = "\n\t\t\tselect\n\t\t\t\t1\n\t\t\tfrom\n\t\t\t\tactionsTimestamps\n\t\t\twhere\n\t\t\t\tto_days(date_at) = to_days(now())\n\t\t\t\tand type_at='DAILY_ROUTINE'\n\t\t\t\tand module_at='" . MOD_STANDARD_CODENAME . "'\n\t\t"; $q = new CMS_query($sql); if ($q->getNumRows()) { return; } CMS_module_standard::_dailyRoutineUnpublish(); CMS_module_standard::_dailyRoutinePublish(); CMS_module_standard::_dailyRoutineReminders(); CMS_module_standard::_dailyRoutineOptimize(); CMS_module_standard::_dailyRoutineClean(); //update the timestamp $sql = "\n\t\t\tdelete from\n\t\t\t\tactionsTimestamps\n\t\t\twhere\n\t\t\t\ttype_at='DAILY_ROUTINE'\n\t\t\t\tand module_at='" . MOD_STANDARD_CODENAME . "'\n\t\t"; $q = new CMS_query($sql); $sql = "\n\t\t\tinsert into\n\t\t\t\tactionsTimestamps\n\t\t\tset\n\t\t\t\ttype_at='DAILY_ROUTINE',\n\t\t\t\tdate_at=now(),\n\t\t\t\tmodule_at='" . MOD_STANDARD_CODENAME . "'\n\t\t"; $q = new CMS_query($sql); }