예제 #1
0
 /**
  * Constructor
  * 
  * @access public
  * @param integer $id
  * @return void 
  */
 function __construct($id = 0)
 {
     if ($id) {
         if (!SensitiveIO::isPositiveInteger($id)) {
             $this->raiseError("Id is not a positive integer");
             return;
         }
         $sql = "\n\t\t\t\tselect\n\t\t\t\t\t*\n\t\t\t\tfrom\n\t\t\t\t\tmod_cms_forms_senders\n\t\t\t\twhere\n\t\t\t\t\tid_snd='" . $id . "'\n\t\t\t";
         $q = new CMS_query($sql);
         if ($q->getNumRows()) {
             $data = $q->getArray();
             $this->_senderID = $id;
             $this->_userID = $data["userID_snd"];
             $this->_clientIP = $data["clientIP_snd"];
             $this->_sessionID = $data["sessionID_snd"];
             $this->_languages = $data["languages_snd"];
             $this->_userAgent = $data["userAgent_snd"];
             if ($data["dateInserted_snd"] != '') {
                 $this->_dateInserted = new CMS_date(date("m-d-Y H:m:s", $data["dateInserted_snd"]));
             }
         } else {
             $this->raiseError("Unknown ID :" . $id);
         }
     } else {
         $this->_dateInserted = new CMS_date();
         $this->_dateInserted->setNow();
     }
 }
예제 #2
0
 /**
  * Constructor
  * 
  * @access public
  * @param $objectDefinition CMS_poly_object_definition the current search object definition or the ID of the CMS_poly_object_definition
  * @param boolean $public
  */
 function __construct($objectDefinition, $public = false)
 {
     global $cms_user;
     if (io::isPositiveInteger($objectDefinition)) {
         $objectDefinition = CMS_poly_object_catalog::getObjectDefinition($objectDefinition);
     }
     if (!is_a($objectDefinition, 'CMS_poly_object_definition')) {
         $this->raiseError('ObjectDefinition must be a valid CMS_poly_object_definition.');
         return false;
     }
     $this->_object = $objectDefinition;
     // Set public status
     $this->_public = $public;
     //add search object type condition
     $this->addWhereCondition("object", $this->_object);
     //if cms_user exists, check user rights
     if (is_object($cms_user)) {
         $this->addWhereCondition("profile", $cms_user);
     }
     //add resource condition if any
     if ($this->_object->isPrimaryResource()) {
         //if this is a public search, add limitation to resource publications dates
         if ($this->_public) {
             $limitDate = new CMS_date();
             $limitDate->setNow();
             $this->addWhereCondition("publication date before", $limitDate);
             $this->addWhereCondition("publication date end", $limitDate);
         }
     }
 }
예제 #3
0
// Date format
$dateFormat = $cms_language->getDateFormat();
// d/m/Y
// +----------------------------------------------------------------------+
// | Build search                                                         |
// +----------------------------------------------------------------------+
//create search object for current object
$search = new CMS_object_search($object);
//if object is a primary resource
if ($object->isPrimaryResource()) {
    //Order
    $search->setAttribute('orderBy', 'publicationDateStart_rs desc,publicationDateEnd_rs desc, id_moo desc');
    // Param : Around publication date
    $dt_today = new CMS_date();
    $dt_today->setDebug(false);
    $dt_today->setNow();
    $dt_today->setFormat($dateFormat);
    $dt_from = new CMS_date();
    $dt_from->setDebug(false);
    $dt_from->setFormat($dateFormat);
    if ($dt_from->setLocalizedDate(CMS_session::getSessionVar("items_dtfrm"), true)) {
        $search->addWhereCondition("publication date after", $dt_from);
    }
    $dt_end = new CMS_date();
    $dt_end->setDebug(false);
    $dt_end->setFormat($dateFormat);
    if ($dt_end->setLocalizedDate(CMS_session::getSessionVar("items_dtnd"), true)) {
        // Check this date isn't greater than start date given
        if (!CMS_date::compare($dt_from, $dt_end, ">=")) {
            $search->addWhereCondition("publication date before", $dt_end);
        }
예제 #4
0
 /**
  * Sets the last reminder to today
  *
  * @return void
  * @access public
  */
 function touchLastReminder()
 {
     $this->_lastReminder->setNow();
 }
예제 #5
0
}
//do some search and replace to allow use of js functions in returned code
$itemFields = str_replace('"scope":"this"', '"scope":this', $itemFields);
function replaceCallBack($parts)
{
    return 'function(' . str_replace(array('\\"', '\\/'), array('"', '/'), $parts[1]) . '}';
}
$itemFields = preg_replace_callback('#"function\\((.*)}"#U', 'replaceCallBack', $itemFields);
//Append pub dates if object is a primary resource
$saveAndValidate = '';
$saveIconCls = $saveTooltip = '';
if ($object->isPrimaryResource()) {
    if (!$item->getID()) {
        $dt = new CMS_date();
        $dt->setDebug(false);
        $dt->setNow();
        $pubStart = $dt->getLocalizedDate($cms_language->getDateFormat());
    } else {
        $pubStart = $item->getPublicationDateStart(false)->getLocalizedDate($cms_language->getDateFormat());
    }
    $pubEnd = $item->getPublicationDateEnd(false)->getLocalizedDate($cms_language->getDateFormat());
    $dateMask = $cms_language->getDateFormatMask();
    $itemFields .= "{\n\t\ttitle:\t\t\t'{$cms_language->getJSMessage(MESSAGE_PAGE_SUBTITLE_WEBSITE_PUBS, false, MOD_POLYMOD_CODENAME)}',\n\t\txtype:\t\t\t'fieldset',\n\t\tautoHeight:\t\ttrue,\n\t\tdefaultType:\t'datefield',\n\t\tlabelWidth:\t\t140,\n\t\tdefaults:\t\t{\n\t\t\twidth:\t\t\t100,\n\t\t\tanchor:\t\t\t'',\n\t\t\tformat:\t\t\t'{$cms_language->getDateFormat()}'\n\t\t},\n\t\titems:\t\t\t[{\n\t\t\tfieldLabel:\t'<span ext:qtip=\"{$cms_language->getJSMessage(MESSAGE_PAGE_FIELD_DATE_COMMENT, array($dateMask))}\" class=\"atm-help\"><span class=\"atm-red\">*</span> {$cms_language->getJSMessage(MESSAGE_PAGE_FIELD_PUBDATE_BEG)}</span>',\n\t\t\tname:\t\t'pubStart',\n\t\t\tallowBlank:\tfalse,\n\t\t\tvalue:\t\t'{$pubStart}'\n\t\t},{\n\t\t\tfieldLabel:\t'<span ext:qtip=\"{$cms_language->getJSMessage(MESSAGE_PAGE_FIELD_DATE_COMMENT, array($dateMask))}\" class=\"atm-help\">{$cms_language->getJSMessage(MESSAGE_PAGE_FIELD_PUBDATE_END)}</span>',\n\t\t\tname:\t\t'pubEnd',\n\t\t\tallowBlank:\ttrue,\n\t\t\tvalue:\t\t'{$pubEnd}'\n\t\t}]\n\t},";
    if ($cms_user->hasValidationClearance($codename)) {
        $saveAndValidate = ",{\n\t\t\tid:\t\t\t\t'{$winId}-save-validate',\n\t\t\txtype:\t\t\t'button',\n\t\t\ttext:\t\t\t'{$cms_language->getJSMessage(MESSAGE_PAGE_PUBLISH)}',\n\t\t\ttooltip:\t\t'{$cms_language->getJSMessage(MESSAGE_PAGE_SAVE_AND_VALID_DESC, false, MOD_POLYMOD_CODENAME)}',\n\t\t\ticonCls:\t\t'atm-pic-validate',\n\t\t\tname:\t\t\t'submitAndValidAdmin',\n\t\t\thandler:\t\tsubmitItem.createDelegate(this, ['save-validate']),\n\t\t\tscope:\t\t\tthis\n\t\t}";
        $saveIconCls = 'atm-pic-draft-validation';
        $saveTooltip = $cms_language->getJSMessage(MESSAGE_PAGE_SAVE_PRIMARY_DESC, false, MOD_POLYMOD_CODENAME);
    }
    $saveLabel = $cms_language->getJSMessage(MESSAGE_PAGE_SUBMIT_TO_VALID);
} else {
    $saveLabel = $cms_language->getJSMessage(MESSAGE_PAGE_PUBLISH);
예제 #6
0
 */
define("ENABLE_HTML_COMPRESSION", false);
require_once dirname(__FILE__) . '/../../cms_rc_admin.php';
define('MESSAGE_PAGE_NO_LOGS', 1608);
define("MESSAGE_PAGE_NO_SERVER_RIGHTS", 748);
//CHECKS user has admin clearance
if (!$cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITVALIDATEALL)) {
    CMS_grandFather::raiseError('User has no administration rights');
    echo $cms_language->getMessage(MESSAGE_PAGE_NO_SERVER_RIGHTS);
    exit;
}
$date = sensitiveIO::request('date');
$errorFile = '';
$gzip = false;
$now = new CMS_date();
$now->setNow(true);
$requestedDate = new CMS_date();
$requestedDate->setFormat($cms_language->getDateFormat());
$requestedDate->setLocalizedDate($date);
if (!$requestedDate->hasError()) {
    if (CMS_date::compare($requestedDate, $now, '==')) {
        $errorFile = PATH_MAIN_FS . '/' . CMS_grandFather::ERROR_LOG;
    } else {
        $gzip = true;
        $requestedDate->moveDate('+1 day');
        $errorFile = PATH_LOGS_FS . '/' . CMS_grandFather::ERROR_LOG . '-' . $requestedDate->getLocalizedDate('Y-m-d') . '.gz';
    }
}
if ($errorFile && file_exists($errorFile)) {
    if (connection_status() == 0) {
        //close session then clean buffer
예제 #7
0
파일: log.php 프로젝트: davidmottet/automne
 /**
  * Record log in database for miscelaneous resource
  *
  * @param integer action
  * @param CMS_profile_user user 
  * @param string textData
  * @param string $module : the module codename
  * @return void
  * @access public
  */
 function logMiscAction($action, &$user, $textData, $module = '')
 {
     $this->setLogAction($action);
     $this->_setUser($user);
     $this->setTextData($textData);
     $this->_datetime = new CMS_Date();
     $this->_datetime->setNow();
     $this->_setModule($module);
     if (!$this->hasError()) {
         $sql_fields = "\n\t\t\t\tuser_log='" . SensitiveIO::sanitizeSQLString($this->_user->getUserId()) . "',\n\t\t\t\taction_log='" . SensitiveIO::sanitizeSQLString($this->_action) . "',\n\t\t\t\tdatetime_log='" . SensitiveIO::sanitizeSQLString($this->_datetime->getDBValue()) . "',\n\t\t\t\tmodule_log='" . SensitiveIO::sanitizeSQLString($this->_module) . "',\n\t\t\t\ttextData_log='" . SensitiveIO::sanitizeSQLString($this->_textData) . "'\n\t\t\t";
         if ($this->_id) {
             $sql = "\n\t\t\t\t\tupdate\n\t\t\t\t\t\tlog\n\t\t\t\t\tset\n\t\t\t\t\t\t" . $sql_fields . "\n\t\t\t\t\twhere\n\t\t\t\t\t\tid_log='" . $this->_id . "'\n\t\t\t\t";
         } else {
             $sql = "\n\t\t\t\t\tinsert into\n\t\t\t\t\t\tlog\n\t\t\t\t\tset\n\t\t\t\t\t\t" . $sql_fields;
         }
         $q = new CMS_query($sql);
         if (!$q->hasError()) {
             $this->_id = $q->getLastInsertedID();
         }
     } else {
         $this->raiseError("Incorrect paramater types");
     }
 }
예제 #8
0
 /**
  * Module script task
  * @param array $parameters the task parameters
  *		task : string task to execute
  *		object : string module codename for the task
  *		field : string module uid
  *		...	: optional field relative parameters
  * @return Boolean true/false
  * @access public
  */
 function scriptTask($parameters)
 {
     switch ($parameters['task']) {
         case 'emailNotification':
             @set_time_limit(300);
             $module = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
             //create a new script for all recipients
             $allUsers = $this->_getRecipients($parameters['object']);
             foreach ($allUsers as $userId) {
                 //add script to send email for user if needed
                 CMS_scriptsManager::addScript($module, array('task' => 'emailSend', 'user' => $userId, 'field' => $parameters['field'], 'object' => $parameters['object']));
             }
             //then set sending date to current date
             $sendingDate = new CMS_date();
             $sendingDate->setNow();
             $this->_subfieldValues[1]->setValue($sendingDate->getDBValue());
             $this->writeToPersistence();
             break;
         case 'emailSend':
             @set_time_limit(300);
             $params = $this->getParamsValues();
             if (!sensitiveIO::isPositiveInteger($parameters['user'])) {
                 return false;
             }
             //instanciate script related item
             $item = CMS_poly_object_catalog::getObjectByID($parameters['object'], false, true);
             if (!is_object($item) || $item->hasError()) {
                 return false;
             }
             //instanciate user
             $cms_user = new CMS_profile_user($parameters['user']);
             //check user
             if (!$cms_user || $cms_user->hasError() || !$cms_user->isActive() || $cms_user->isDeleted() || !sensitiveIO::isValidEmail($cms_user->getEmail())) {
                 return false;
             }
             $cms_language = $cms_user->getLanguage();
             //globalise cms_user and cms_language
             $GLOBALS['cms_language'] = $cms_user->getLanguage();
             $GLOBALS['cms_user'] = $cms_user;
             //check user clearance on object
             if (!$item->userHasClearance($cms_user, CLEARANCE_MODULE_VIEW)) {
                 return false;
             }
             //create email subject
             $parameters['item'] = $item;
             $parameters['public'] = true;
             $polymodParsing = new CMS_polymod_definition_parsing($params['emailSubject'], false);
             $subject = $polymodParsing->getContent(CMS_polymod_definition_parsing::OUTPUT_RESULT, $parameters);
             $body = '';
             //create email body
             if ($params['emailBody']['type'] == 1) {
                 //send body
                 $parameters['module'] = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
                 $polymodParsing = new CMS_polymod_definition_parsing($params['emailBody']['html'], true, CMS_polymod_definition_parsing::PARSE_MODE, $parameters['module']);
                 $body = $polymodParsing->getContent(CMS_polymod_definition_parsing::OUTPUT_RESULT, $parameters);
             } elseif ($params['emailBody']['type'] == 2) {
                 //send a page
                 $page = CMS_tree::getPageById($params['emailBody']['pageID']);
                 if (!$page || $page->hasError()) {
                     $this->raiseError('Page ID is not a valid page : ' . $params['emailBody']['pageID']);
                     return false;
                 }
                 $pageHTMLFile = new CMS_file($page->getHTMLURL(false, false, PATH_RELATIVETO_FILESYSTEM));
                 if (!$pageHTMLFile->exists()) {
                     $this->raiseError('Page HTML file does not exists : ' . $page->getHTMLURL(false, false, PATH_RELATIVETO_FILESYSTEM));
                     return false;
                 }
                 $body = $pageHTMLFile->readContent();
                 //create page URL call
                 $polymodParsing = new CMS_polymod_definition_parsing($params['emailBody']['pageURL'], false);
                 $pageURL = $polymodParsing->getContent(CMS_polymod_definition_parsing::OUTPUT_RESULT, $parameters);
                 parse_str($pageURL, $GLOBALS['_REQUEST']);
                 //$GLOBALS['_REQUEST']
                 //parse and eval HTML page
                 $cms_page_included = true;
                 $GLOBALS['cms_page_included'] = $cms_page_included;
                 //eval() the PHP code
                 $body = sensitiveIO::evalPHPCode($body);
                 $website = $page->getWebsite();
                 $webroot = $website->getURL();
                 //replace URLs values
                 $replace = array('="/' => '="' . $webroot . '/', "='/" => "='" . $webroot . "/", "url(/" => "url(" . $webroot . "/");
                 $body = str_replace(array_keys($replace), $replace, $body);
             } else {
                 $this->raiseError('No valid email type to send : ' . $params['emailBody']['type']);
                 return false;
             }
             if (isset($sendmail)) {
                 //$body .= print_r($sendmail,true);
             }
             //drop email sending
             if (isset($sendmail) && $sendmail === false) {
                 return false;
             }
             //if no body for email or if sendmail var is set to false, quit
             if (!$body) {
                 $this->raiseError('No email body to send ... Email parameters : user : '******'user'] . ' - object ' . $parameters['object']);
                 return false;
             }
             //This code is for debug purpose only.
             //$testFile = new CMS_file('/test/test_'.$cms_user->getUserId().'.php', CMS_file::WEBROOT);
             //$testFile->setContent($body);
             //$testFile->writeToPersistence();
             // Set email
             $email = new CMS_email();
             $email->setSubject($subject);
             $email->setEmailHTML($body);
             $email->setEmailTo($cms_user->getEmail());
             if ($params['includeFiles']) {
                 //check for file fields attached to object
                 $files = array();
                 $this->_getFieldsFiles($item, $files);
                 if (sizeof($files)) {
                     foreach ($files as $file) {
                         $email->setFile($file);
                     }
                 }
             }
             //set email From
             if (!$params['emailFrom']) {
                 $email->setFromName(APPLICATION_LABEL);
                 $email->setEmailFrom(APPLICATION_POSTMASTER_EMAIL);
             } else {
                 $email->setFromName($params['emailFrom']);
                 $email->setEmailFrom($params['emailFrom']);
             }
             //Send
             if ($email->sendEmail()) {
                 //store email sent number
                 $this->_subfieldValues[2]->setValue($this->_subfieldValues[2]->getValue() + 1);
                 $this->writeToPersistence();
                 return true;
             } else {
                 return false;
             }
             break;
         default:
             $this->raiseError('No valid task given : ' . $parameters['task']);
             return false;
             break;
     }
 }
예제 #9
0
     if (!$hasSiblings && !CMS_websitesCatalog::isWebsiteRoot($cms_page->getID())) {
         $panelContent .= "\n\t\t\t\t\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_DELETING_PAGE_INFO) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_DELETING_PAGE) . "</span>',\n\t\t\t\t\t\t\t\t\t\ticonCls: 'atm-pic-deletion',\n\t\t\t\t\t\t\t\t\t\thandler: function(){\n\t\t\t\t\t\t\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\t\t\t\t\t\t\tmsg: \t\t\t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_DELETING_PAGE_CONFIRM) . "',\n\t\t\t\t\t\t\t\t\t\t\t\tbuttons: \t\t\tExt.MessageBox.OKCANCEL,\n\t\t\t\t\t\t\t\t\t\t\t\tanimEl: \t\t\tthis.getEl(),\n\t\t\t\t\t\t\t\t\t\t\t\tclosable: \t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\t\t\ticon: \t\t\t\tExt.MessageBox.QUESTION,\n\t\t\t\t\t\t\t\t\t\t\t\tfn: \t\t\t\tfunction (button) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (button == 'ok') {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAutomne.server.call({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\turl:\t\t\t\t'page-controler.php',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: \t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurrentPage:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taction:\t\t\t\t'delete'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}));";
     }
 }
 //page editions cancelling
 $editions = $cms_page->getStatus()->getEditions();
 if ($cms_page->getPublication() != RESOURCE_PUBLICATION_NEVERVALIDATED && $editions & RESOURCE_EDITION_CONTENT) {
     $panelContent .= "\n\t\t\t\t\t\t\t\tmenu.addSeparator();\n\t\t\t\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_UNDO_EDITING_INFO) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_UNDO_EDITING) . "</span>',\n\t\t\t\t\t\t\t\t\ticonCls: 'atm-pic-editions-cancelling',\n\t\t\t\t\t\t\t\t\thandler: function(){\n\t\t\t\t\t\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\t\t\t\t\t\tmsg: \t\t\t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_UNDO_EDITING_CONFIRM) . "',\n\t\t\t\t\t\t\t\t\t\t\tbuttons: \t\t\tExt.MessageBox.OKCANCEL,\n\t\t\t\t\t\t\t\t\t\t\tanimEl: \t\t\tthis.getEl(),\n\t\t\t\t\t\t\t\t\t\t\tclosable: \t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\t\ticon: \t\t\t\tExt.MessageBox.WARNING,\n\t\t\t\t\t\t\t\t\t\t\tfn: \t\t\t\tfunction (button) {\n\t\t\t\t\t\t\t\t\t\t\t\tif (button == 'ok') {\n\t\t\t\t\t\t\t\t\t\t\t\t\ttabs.setActiveTab('public');\n\t\t\t\t\t\t\t\t\t\t\t\t\tAutomne.server.call({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\turl:\t\t\t\t'page-controler.php',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: \t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurrentPage:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taction:\t\t\t\t'cancel_editions'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfcnCallback: \t\tfunction() {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//then reload page infos\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttabs.getPageInfos({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpageId:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnoreload:\ttrue\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcallBackScope:\t\tthis\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}));";
 }
 if ($editions & RESOURCE_EDITION_CONTENT && $cms_user->hasValidationClearance(MOD_STANDARD_CODENAME)) {
     //validate
     $panelContent .= "\n\t\t\t\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_VALIDATION_MODIFICATIONS) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_VALIDATION) . "</span>',\n\t\t\t\t\t\t\t\t\ticonCls: 'atm-pic-validate',\n\t\t\t\t\t\t\t\t\thandler: function () {\n\t\t\t\t\t\t\t\t\t\tAutomne.server.call('validations-controler.php', function(response, options, jsonResponse){\n\t\t\t\t\t\t\t\t\t\t\tif (!jsonResponse.success) {\n\t\t\t\t\t\t\t\t\t\t\t\t//get validation message\n\t\t\t\t\t\t\t\t\t\t\t\tif (response.responseXML && response.responseXML.getElementsByTagName('message').length) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar message = response.responseXML.getElementsByTagName('message').item(0).firstChild.nodeValue;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\t\t\t\t\t\t\t\tmsg: \t\t\t\tmessage,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbuttons: \t\t\tExt.MessageBox.OK,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclosable: \t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\t\t\t\ticon: \t\t\t\tExt.MessageBox.WARNING\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\taction:\t\t\t\t'validateById',\n\t\t\t\t\t\t\t\t\t\t\tresource:\t\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\tmodule:\t\t\t\t'" . MOD_STANDARD_CODENAME . "',\n\t\t\t\t\t\t\t\t\t\t\tevalMessage:\t\tfalse\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}));";
 }
 $endPublication = $cms_page->getPublicationDateEnd(false);
 $now = new CMS_date();
 $now->setNow();
 if ($cms_page->getPublication() == RESOURCE_PUBLICATION_PUBLIC && ($endPublication->isNull() || CMS_date::compare($endPublication, $now, '>'))) {
     if (!$cms_page->isProtected()) {
         //unpublish
         $panelContent .= "\n\t\t\t\t\t\t\t\t\tmenu.addSeparator();\n\t\t\t\t\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_UNPUBLISH_PAGE_INFO) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_UNPUBLISH_PAGE) . "</span>',\n\t\t\t\t\t\t\t\t\t\ticonCls: 'atm-pic-unpublish',\n\t\t\t\t\t\t\t\t\t\thandler: function(){\n\t\t\t\t\t\t\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\t\t\t\t\t\t\tmsg: \t\t\t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_UNPUBLISH_PAGE_CONFIRM) . "',\n\t\t\t\t\t\t\t\t\t\t\t\tbuttons: \t\t\tExt.MessageBox.OKCANCEL,\n\t\t\t\t\t\t\t\t\t\t\t\tanimEl: \t\t\tthis.getEl(),\n\t\t\t\t\t\t\t\t\t\t\t\tclosable: \t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\t\t\ticon: \t\t\t\tExt.MessageBox.QUESTION,\n\t\t\t\t\t\t\t\t\t\t\t\tfn: \t\t\t\tfunction (button) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (button == 'ok') {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAutomne.server.call({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\turl:\t\t\t\t'page-controler.php',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: \t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurrentPage:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taction:\t\t\t\t'unpublish'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfcnCallback: \t\tfunction() {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//then reload page infos\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttabs.getPageInfos({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpageId:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnoreload:\ttrue\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcallBackScope:\t\tthis\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}));";
     }
 } elseif ($cms_page->getPublication() != RESOURCE_PUBLICATION_NEVERVALIDATED && !$endPublication->isNull() && CMS_date::compare($endPublication, $now, '<=')) {
     //publish
     $panelContent .= "\n\t\t\t\t\t\t\t\tmenu.addSeparator();\n\t\t\t\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_PUBLISH_INFO) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_PUBLISH) . "</span>',\n\t\t\t\t\t\t\t\t\ticonCls: 'atm-pic-publish',\n\t\t\t\t\t\t\t\t\thandler: function () {\n\t\t\t\t\t\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\t\t\t\t\t\tmsg: \t\t\t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_PUBLISH_PAGE_CONFIRM) . "',\n\t\t\t\t\t\t\t\t\t\t\tbuttons: \t\t\tExt.MessageBox.OKCANCEL,\n\t\t\t\t\t\t\t\t\t\t\tanimEl: \t\t\tthis.getEl(),\n\t\t\t\t\t\t\t\t\t\t\tclosable: \t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\t\ticon: \t\t\t\tExt.MessageBox.QUESTION,\n\t\t\t\t\t\t\t\t\t\t\tfn: \t\t\t\tfunction (button) {\n\t\t\t\t\t\t\t\t\t\t\t\tif (button == 'ok') {\n\t\t\t\t\t\t\t\t\t\t\t\t\tAutomne.server.call({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\turl:\t\t\t\t'page-controler.php',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: \t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcurrentPage:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taction:\t\t\t\t'publish'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfcnCallback: \t\tfunction() {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//then reload page infos\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttabs.getPageInfos({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpageId:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnoreload:\ttrue\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcallBackScope:\t\tthis\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}));";
 }
 if ($cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_REGENERATEPAGES) && $cms_page->getPublication() == RESOURCE_PUBLICATION_PUBLIC) {
     //regenerate
     $panelContent .= "\n\t\t\t\t\t\t\t\tmenu.addSeparator();\n\t\t\t\t\t\t\t\tmenu.addItem(new Ext.menu.Item({\n\t\t\t\t\t\t\t\t\ttext: '<span ext:qtip=\"" . $cms_language->getJSMessage(MESSAGE_PAGE_REGEN_DESC) . "\">" . $cms_language->getJSMessage(MESSAGE_PAGE_REGENERATE) . "</span>',\n\t\t\t\t\t\t\t\t\ticonCls: 'atm-pic-scripts',\n\t\t\t\t\t\t\t\t\thandler: function () {\n\t\t\t\t\t\t\t\t\t\tAutomne.server.call({\n\t\t\t\t\t\t\t\t\t\t\turl:\t\t\t\t'page-controler.php',\n\t\t\t\t\t\t\t\t\t\t\tparams: \t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tcurrentPage:\t\t'" . $cms_page->getID() . "',\n\t\t\t\t\t\t\t\t\t\t\t\taction:\t\t\t\t'regenerate'\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}));";
 }
 //separator
 $panelContent .= "'-'" . $pageDraft;
예제 #10
0
     $logAction = CMS_log::LOG_ACTION_RESOURCE_UNARCHIVE;
     $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE);
     break;
 case "undelete":
     $cms_page->removeProposedLocation();
     $cms_page->writeToPersistence();
     $edited = true;
     $logAction = CMS_log::LOG_ACTION_RESOURCE_UNDELETE;
     $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE);
     break;
 case "unpublish":
     if (!$cms_page->isProtected()) {
         //set page date end to yesterday
         $dt_end = new CMS_date();
         $dt_end->setDebug(false);
         $dt_end->setNow();
         $dt_end->moveDate('-1 day');
         $dateStart = $cms_page->getPublicationDateStart(false);
         if (CMS_date::compare($dateStart, $dt_end, '>')) {
             $dateStart = $dt_end;
         }
         $cms_page->setPublicationDates($dateStart, $dt_end);
         $cms_page->addEdition(RESOURCE_EDITION_BASEDATA, $cms_user);
         if ($cms_page->writeToPersistence()) {
             $edited = true;
             $logAction = CMS_log::LOG_ACTION_RESOURCE_EDIT_BASEDATA;
             $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE);
         } else {
             $cms_message = $cms_language->getMessage(MESSAGE_FORM_ERROR_WRITING);
             $cms_page->raiseError('Error during writing of page ' . $cms_page->getID() . '. Action : unpublish page');
         }
예제 #11
0
 /**
  * Writes the resourceStatus into persistence (MySQL for now).
  *
  * @return boolean true on success, false on failure
  * @access public
  */
 function writeToPersistence()
 {
     //first adjust publication and start publication date
     $this->_adjustPublication();
     if ($this->_publicationDateStart->isNull()) {
         $this->_publicationDateStart->setNow();
     }
     $sql_fields = "\n\t\t\tlocation_rs='" . SensitiveIO::sanitizeSQLString($this->_location) . "',\n\t\t\tproposedFor_rs='" . SensitiveIO::sanitizeSQLString($this->_proposedFor) . "',\n\t\t\teditions_rs='" . SensitiveIO::sanitizeSQLString($this->_editions) . "',\n\t\t\tvalidationsRefused_rs='" . SensitiveIO::sanitizeSQLString($this->_validationsRefused) . "',\n\t\t\tpublication_rs='" . SensitiveIO::sanitizeSQLString($this->_publication) . "',\n\t\t\tpublicationDateStart_rs='" . $this->_publicationDateStart->getDBValue() . "',\n\t\t\tpublicationDateEnd_rs='" . $this->_publicationDateEnd->getDBValue() . "',\n\t\t\tpublicationDateStartEdited_rs='" . $this->_publicationDateStartEdited->getDBValue() . "',\n\t\t\tpublicationDateEndEdited_rs='" . $this->_publicationDateEndEdited->getDBValue() . "'\n\t\t";
     if ($this->_id) {
         $sql = "\n\t\t\t\tupdate\n\t\t\t\t\tresourceStatuses\n\t\t\t\tset\n\t\t\t\t\t" . $sql_fields . "\n\t\t\t\twhere\n\t\t\t\t\tid_rs='" . $this->_id . "'\n\t\t\t";
     } else {
         $sql = "\n\t\t\t\tinsert into\n\t\t\t\t\tresourceStatuses\n\t\t\t\tset\n\t\t\t\t\t" . $sql_fields;
     }
     $q = new CMS_query($sql);
     if ($q->hasError()) {
         return false;
     } elseif (!$this->_id) {
         $this->_id = $q->getLastInsertedID();
     }
     return true;
 }
예제 #12
0
 /**
  * Compile the RSS definition
  *
  * @return boolean true on success, false on failure
  * @access public
  */
 function compileDefinition()
 {
     $parameters = array();
     $parameters['module'] = CMS_poly_object_catalog::getModuleCodenameForObjectType($this->getValue('objectID'));
     $parameters['objectID'] = $this->getValue('objectID');
     $parameters['public'] = true;
     $definitionParsing = new CMS_polymod_definition_parsing($this->_objectValues['definition'], true, CMS_polymod_definition_parsing::PARSE_MODE, $parameters['module']);
     $compiledDefinition = $definitionParsing->getContent(CMS_polymod_definition_parsing::OUTPUT_PHP, $parameters);
     $this->_objectValues['compiledDefinition'] = $compiledDefinition;
     $date = new CMS_date();
     $date->setNow();
     $this->_objectValues['lastCompilation'] = $date;
     return true;
 }
예제 #13
0
 /**
  * Process the daily routine reminders part : send reminders to users
  *
  * @return void
  * @access private
  */
 protected function _dailyRoutineReminders()
 {
     $today = new CMS_date();
     $today->setNow();
     $sql = "\n\t\t\tSELECT\n\t\t\t\tid_pag,\n\t\t\t\tremindedEditorsStack_pag,\n\t\t\t\treminderOnMessage_pbd\n\t\t\tFROM\n\t\t\t\tpages, pagesBaseData_public\n\t\t\tWHERE\n\t\t\t\tpage_pbd = id_pag\n\t\t\t\tAND (\n\t\t\t\t\t(lastReminder_pag < reminderOn_pbd\n\t\t\t\t\tAND\n\t\t\t\t\t'" . $today->getDBValue() . "' >= reminderOn_pbd)\n\t\t\t\t\tOR (\n\t\t\t\t\t\t(to_days('" . $today->getDBValue() . "') - to_days(lastReminder_pag))  >= reminderPeriodicity_pbd\n\t\t\t\t\t\tAND\n\t\t\t\t\t\treminderPeriodicity_pbd != '0'\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t";
     $q = new CMS_query($sql);
     $reminders = array();
     while ($data = $q->getArray()) {
         $reminders[] = $data;
     }
     //send the emails
     foreach ($reminders as $reminder) {
         //instanciate page and update its lastReminder vars
         $page = CMS_tree::getPageByID($reminder["id_pag"]);
         $page->touchLastReminder();
         $page->writeToPersistence();
         //build users array
         $users_stack = new CMS_stack();
         $users_stack->setTextDefinition($reminder["remindedEditorsStack_pag"]);
         $users_stack_elements = $users_stack->getElements();
         $users = array();
         foreach ($users_stack_elements as $element) {
             $usr = CMS_profile_usersCatalog::getByID($element[0]);
             if ($usr instanceof CMS_profile_user) {
                 $users[$element[0]] = $usr;
             }
         }
         if (!$users) {
             continue;
         }
         //prepare emails and send them
         $group_email = new CMS_emailsCatalog();
         $languages = CMS_languagesCatalog::getAllLanguages();
         $subjects = array();
         $bodies = array();
         foreach ($languages as $language) {
             $subjects[$language->getCode()] = $language->getMessage(self::MESSAGE_MOD_STANDARD_EMAIL_REMINDER_SUBJECT);
             $bodies[$language->getCode()] = $language->getMessage(self::MESSAGE_MOD_STANDARD_EMAIL_REMINDER_BODY, array($page->getTitle() . " (ID : " . $page->getID() . ")")) . "\n" . $language->getMessage(self::MESSAGE_MOD_STANDARD_EMAIL_REMINDER_BODY_MESSAGE, array($reminder["reminderOnMessage_pbd"]));
         }
         $group_email->setUserMessages($users, $bodies, $subjects, ALERT_LEVEL_PAGE_ALERTS, MOD_STANDARD_CODENAME);
         $group_email->sendMessages();
     }
 }
예제 #14
0
 /**
  * set object Values
  *
  * @param array $values : the POST result values
  * @param string $prefixname : the prefix used for post names
  * @return boolean true on success, false on failure
  * @access public
  */
 function writeToPersistence()
 {
     $params = $this->getParamsValues();
     $date = new CMS_date();
     if ($this->_subfieldValues[0]->getValue()) {
         $date->setFromDBValue($this->_subfieldValues[0]->getValue());
     }
     if ($params['updateDate'] || $date->isNull() && ($params['setNow'] || $params['creationDate'])) {
         $date->setNow();
         if ($params['moveDate']) {
             $date->moveDate($params['moveDate']);
         }
         if (!$this->_subfieldValues[0]->setValue($date->getDBValue())) {
             return false;
         }
     }
     return parent::writeToPersistence();
 }