Exemplo n.º 1
0
}
// Prevent the browser from caching the result.
// Date in the past
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// always modified
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// HTTP/1.1
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
// HTTP/1.0
header('Pragma: no-cache');
//send document UTF-8 BOM (do not remove)
header('Content-type: text/javascript; charset=UTF-8');
echo '' . "\n";
//include modules codes in output file
$modulesCodes = new CMS_modulesCodes();
/*
 * This function need to return an array at the following format :
 * array (
 *		  "toolbarName1"		=> array("'toolbarButton1'","'toolbarButton2'" ...),
 *		  "toolbarName2"		=> array("'toolbarButton1','toolbarButton2'" ...),
 * 		  "modulesDeclaration"	=> array("FCKConfig.Plugins.Add( 'automneLinks', 'en,fr' );", ...),
 *		  "ToolbarSets"			=> array("toolbarDeclaration1", ...)
 *		 );
 */
$modulesCodeInclude = $modulesCodes->getModulesCodes(MODULE_TREATMENT_EDITOR_CODE, '', new CMS_date(), array("editor" => "fckeditor", "toolbar" => "Default|Basic|BasicLink", "user" => $cms_user));
//new CMS_date() is a fake object cause the function need one...
?>

FCKConfig.CustomConfigurationsPath = '' ;
 /**
  * Process the module validations. Note that the EMails sent to either the transferred validator or the editors were sent before.
  *
  * @param CMS_resourceValidation $resourceValidation The resource validation to process
  * @param integer $result The result of the validation process. See VALIDATION_OPTION constants
  * @return boolean true on success, false on failure to process
  * @access public
  */
 function processValidation($resourceValidation, $result, $lastValidation = true)
 {
     if (!CMS_poly_object_catalog::hasPrimaryResource($this->getCodename())) {
         $this->raiseError("Module have not any primary resource !");
         return false;
     }
     if (!$resourceValidation instanceof CMS_resourceValidation) {
         $this->raiseError("ResourceValidation is not a valid CMS_resourceValidation object");
         return false;
     }
     if (!SensitiveIO::isInSet($result, CMS_resourceValidation::getAllValidationOptions())) {
         $this->raiseError("ProcessValidation : result is not a valid validation option");
         return false;
     }
     //Tell the resource of the changes
     $resource = $resourceValidation->getResource();
     $editions = $resourceValidation->getEditions();
     //add a call to all modules for validation specific treatment
     $modulesCodes = new CMS_modulesCodes();
     //add a call to modules after validation
     $modulesCodes->getModulesCodes(MODULE_TREATMENT_BEFORE_VALIDATION_TREATMENT, '', $resource, array('result' => $result, 'lastvalidation' => $lastValidation, 'module' => $this->_codename));
     switch ($result) {
         case VALIDATION_OPTION_REFUSE:
             //validation was refused, adjust the array of validations refused
             $all_editions = CMS_resourceStatus::getAllEditions();
             foreach ($all_editions as $aEdition) {
                 if ($aEdition & $editions) {
                     if (RESOURCE_EDITION_LOCATION & $aEdition && $resource->getProposedLocation() == RESOURCE_LOCATION_DELETED) {
                         $resource->removeProposedLocation();
                     } else {
                         $resource->addValidationRefused($aEdition);
                     }
                 }
             }
             break;
         case VALIDATION_OPTION_ACCEPT:
             //if one of the edition was the location, only treat this one. Move the data.
             if ($editions & RESOURCE_EDITION_LOCATION) {
                 if ($resource->getLocation() == RESOURCE_LOCATION_USERSPACE) {
                     //pulling resource out of USERSPACE
                     switch ($resource->getProposedLocation()) {
                         case RESOURCE_LOCATION_DELETED:
                             $locationTo = RESOURCE_DATA_LOCATION_DELETED;
                             break;
                     }
                     //first, move edited
                     $this->_changeDataLocation($resource, RESOURCE_DATA_LOCATION_EDITED, $locationTo);
                     //then delete public
                     $this->_changeDataLocation($resource, RESOURCE_DATA_LOCATION_PUBLIC, RESOURCE_DATA_LOCATION_DEVNULL);
                     //mark item as deleted
                     CMS_modulePolymodValidation::markDeletedItem($resource->getID());
                 } else {
                     if ($resource->getProposedLocation() == RESOURCE_LOCATION_USERSPACE) {
                         //Pushing resource to USERSPACE
                         switch ($resource->getLocation()) {
                             case RESOURCE_LOCATION_DELETED:
                                 $locationFrom = RESOURCE_DATA_LOCATION_DELETED;
                                 break;
                         }
                         //if resource was published, copy data to public table
                         if ($resource->getPublication() != RESOURCE_PUBLICATION_NEVERVALIDATED) {
                             $this->_changeDataLocation($resource, $locationFrom, RESOURCE_DATA_LOCATION_PUBLIC, true);
                         }
                         //move data from its location to edited
                         $this->_changeDataLocation($resource, $locationFrom, RESOURCE_DATA_LOCATION_EDITED);
                     } else {
                         //the move entirely takes place outside of USERSPACE (archived to deleted hopefully)
                         switch ($resource->getLocation()) {
                             case RESOURCE_LOCATION_DELETED:
                                 $locationFrom = RESOURCE_DATA_LOCATION_DELETED;
                                 break;
                         }
                         switch ($resource->getProposedLocation()) {
                             case RESOURCE_LOCATION_DELETED:
                                 $locationTo = RESOURCE_DATA_LOCATION_DELETED;
                                 break;
                         }
                         $this->_changeDataLocation($resource, $locationFrom, $locationTo);
                         if ($locationTo == RESOURCE_DATA_LOCATION_DELETED) {
                             //mark item as deleted
                             CMS_modulePolymodValidation::markDeletedItem($resource->getID());
                         }
                     }
                 }
                 $resource->validateProposedLocation();
             } else {
                 $all_editions = CMS_resourceStatus::getAllEditions();
                 $this->_changeDataLocation($resource, RESOURCE_DATA_LOCATION_EDITED, RESOURCE_DATA_LOCATION_PUBLIC, true);
                 foreach ($all_editions as $aEdition) {
                     if ($aEdition & $editions) {
                         $resource->validateEdition($aEdition);
                     }
                 }
             }
             break;
     }
     //if resource is a polyobject, we need to save only it resource (parent) status
     if (!$resource instanceof CMS_poly_object) {
         $resource->writeToPersistence();
     } else {
         $resource->writeToPersistence(false);
         //Clear polymod cache
         //CMS_cache::clearTypeCacheByMetas('polymod', array('module' => $this->_codename));
         CMS_cache::clearTypeCache('polymod');
     }
     $modulesCodes->getModulesCodes(MODULE_TREATMENT_AFTER_VALIDATION_TREATMENT, '', $resource, array('result' => $result, 'lastvalidation' => $lastValidation, 'module' => $this->_codename));
     return true;
 }
Exemplo n.º 3
0
 /**
  * Returns the javascript needed by the editor, which will be included in the <head> part
  *
  * @return string
  * @access public
  */
 function getJavascript()
 {
     //include modules javascript codes in output file
     $modulesCodes = new CMS_modulesCodes();
     $modulesJSCodeInclude = $modulesCodes->getModulesCodes(MODULE_TREATMENT_EDITOR_JSCODE, '', $this, array("language" => $this->_language, "formName" => $this->_form));
     $modulesJSCodeInclude = sizeof($modulesJSCodeInclude) ? implode("\n", $modulesJSCodeInclude) : "";
     return $modulesJSCodeInclude;
 }
Exemplo n.º 4
0
 /**
  * Get the page content for the specified visualization mode and language.
  *
  * @return string The content of the page.
  * @access public
  */
 function getContent(&$language, $visualizationMode = false)
 {
     if (!$language instanceof CMS_language || !SensitiveIO::isInSet($visualizationMode, CMS_page::getAllVisualizationModes())) {
         $this->raiseError("Language must be a valid language and visualization mode in the set of possibles");
         return false;
     }
     $this->_checkTemplate();
     if ($this->_template) {
         //get parsed content definition from template (including CS block contents)
         $definition = $this->_template->getContent($language, $this, $visualizationMode);
         //instanciate modules treatments for page content tags
         $modulesTreatment = new CMS_modulesTags(MODULE_TREATMENT_PAGECONTENT_TAGS, $visualizationMode, $this);
         $modulesTreatment->setTreatmentParameters(array("language" => $language));
         $modulesTreatment->setDefinition($definition);
         $content = $modulesTreatment->treatContent(true);
         //instanciate modules treatments for page header tags
         $modulesTreatment = new CMS_modulesTags(MODULE_TREATMENT_PAGEHEADER_TAGS, $visualizationMode, $this);
         $modulesTreatment->setTreatmentParameters(array("language" => $language, 'replaceVars' => true));
         $modulesTreatment->setDefinition($content);
         $content = $modulesTreatment->treatContent(true);
         /*if ($visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC_INDEXABLE) {
         			//eval() the PHP code
         			$content = sensitiveIO::evalPHPCode($content);
         			return $content;
         		}*/
         //include modules header codes on top of output file
         $modulesCodes = new CMS_modulesCodes();
         $headerInclude = $modulesCodes->getModulesCodes(MODULE_TREATMENT_PAGECONTENT_HEADER_CODE, $visualizationMode, $this);
         if (is_array($headerInclude) && $headerInclude) {
             $content = implode("\n", $headerInclude) . $content;
         }
         //include modules footers codes on bottom of output file
         $footerInclude = $modulesCodes->getModulesCodes(MODULE_TREATMENT_PAGECONTENT_FOOTER_CODE, $visualizationMode, $this);
         if (is_array($footerInclude) && $footerInclude) {
             $content .= implode("\n", $footerInclude);
         }
         //replace {{pageID}} tag in all page content.
         $content = str_replace('{{pageID}}', $this->getID(), $content);
         if ($visualizationMode != PAGE_VISUALMODE_HTML_PUBLIC && $visualizationMode != PAGE_VISUALMODE_PRINT) {
             //eval() the PHP code
             $content = sensitiveIO::evalPHPCode($content);
         }
         return $content;
     } else {
         return false;
     }
 }
Exemplo n.º 5
0
//load interface instance
$view = CMS_view::getInstance();
//set default display mode for this page
$view->setDisplayMode(CMS_view::SHOW_RAW);
//This file is an admin file. Interface must be secure
$view->setSecure();
//CHECKS user has templates clearance
if (!$cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDIT_TEMPLATES)) {
    //templates
    CMS_grandFather::raiseError('User has no rights template editions');
    $view->setActionMessage($cms_language->getMessage(MESSAGE_ERROR_NO_RIGHTS_FOR_TEMPLATES));
    $view->show();
}
//include modules codes in output file
$template = '';
$modulesCodes = new CMS_modulesCodes();
$modulesCodeInclude = $modulesCodes->getModulesCodes(MODULE_TREATMENT_TEMPLATES_EDITION_LABELS, PAGE_VISUALMODE_CLIENTSPACES_FORM, $template, array("language" => $cms_language, "user" => $cms_user));
$modulesTab = '';
if (is_array($modulesCodeInclude) && $modulesCodeInclude) {
    foreach ($modulesCodeInclude as $codename => $description) {
        //if user has rights on module
        if ($cms_user->hasModuleClearance($codename, CLEARANCE_MODULE_EDIT)) {
            $module = CMS_modulesCatalog::getByCodename($codename);
            $label = sensitiveIO::sanitizeJSString($module->getLabel($cms_language));
            $description = sensitiveIO::sanitizeJSString($description);
            $modulesTab .= "{\n\t\t\t\ttitle:\t\t\t\t'{$label}',\n\t\t\t\thtml:\t\t\t\t'{$description}'\n\t\t\t},";
        }
    }
}
//remove last comma
if ($modulesTab) {
Exemplo n.º 6
0
 /**
  * Delete object and values.
  * If object is a primary resource, this deletion is submitted to validation and an email is sent to validators.
  *
  * @param boolean $hardDelete : completely destroy object and associated resource if any. After this, this object will no longer exists at all. Default : false.
  * /!\ if object is a primary resource, no validation will be queried to validators, object will be directly destroyed from all locations. /!\
  * @return boolean true on success, false on failure
  * @access public
  */
 function delete($hardDelete = false)
 {
     global $cms_user;
     //get Object definition
     $objectDef = $this->getObjectDefinition();
     //get module codename
     $polyModuleCodename = $objectDef->getValue('module');
     //if object is not a primary resource
     if ($this->_objectResourceStatus != 1 || $hardDelete) {
         $forceSecondaryRessourcePublication = false;
         if ($this->_objectResourceStatus == 2 && !$hardDelete) {
             //if this object is a secondary resource, primary items which uses this object must be updated
             //get all primary resource associated
             $primaryItems = CMS_poly_object_catalog::getPrimaryItemsWhichUsesSecondaryItem($this->_ID, true, false);
             if ($primaryItems) {
                 foreach ($primaryItems as $primaryItem) {
                     $primaryItem->writeToPersistence();
                 }
             } else {
                 $forceSecondaryRessourcePublication = true;
             }
         }
         //if object is not a secondary resource, delete public datas, else preserve it : it will be deleted on primary resource validation
         if ($this->_objectResourceStatus != 2 || $this->_objectResourceStatus == 2 && $forceSecondaryRessourcePublication || $hardDelete) {
             //delete datas from public locations
             CMS_modulePolymodValidation::moveResourceData($polyModuleCodename, $this->getID(), RESOURCE_DATA_LOCATION_PUBLIC, RESOURCE_DATA_LOCATION_DEVNULL);
             if (!$hardDelete) {
                 //mark item as deleted
                 CMS_modulePolymodValidation::markDeletedItem($this->getID());
             } else {
                 //destroy poly_object reference
                 $sql = "delete from mod_object_polyobjects where id_moo = '" . $this->getID() . "'";
                 new CMS_query($sql);
             }
         }
         if ($this->_objectResourceStatus != 1 && $this->_objectResourceStatus != 2 || $this->_objectResourceStatus == 2 && $forceSecondaryRessourcePublication) {
             $modulesCodes = new CMS_modulesCodes();
             //add a call to all modules for before validation specific treatment
             $modulesCodes->getModulesCodes(MODULE_TREATMENT_BEFORE_VALIDATION_TREATMENT, '', $this, array('result' => VALIDATION_OPTION_ACCEPT, 'lastvalidation' => true, 'module' => $polyModuleCodename, 'action' => 'delete'));
         }
         if (!$hardDelete) {
             //move resource datas from edited to deleted location
             CMS_modulePolymodValidation::moveResourceData($polyModuleCodename, $this->getID(), RESOURCE_DATA_LOCATION_EDITED, RESOURCE_DATA_LOCATION_DELETED);
         } else {
             //delete datas from edited locations
             CMS_modulePolymodValidation::moveResourceData($polyModuleCodename, $this->getID(), RESOURCE_DATA_LOCATION_EDITED, RESOURCE_DATA_LOCATION_DEVNULL);
         }
         if ($this->_objectResourceStatus != 1 && $this->_objectResourceStatus != 2 || $this->_objectResourceStatus == 2 && $forceSecondaryRessourcePublication) {
             //add a call to all modules for after validation specific treatment
             $modulesCodes->getModulesCodes(MODULE_TREATMENT_AFTER_VALIDATION_TREATMENT, '', $this, array('result' => VALIDATION_OPTION_ACCEPT, 'lastvalidation' => true, 'module' => $polyModuleCodename, 'action' => 'delete'));
         }
         if ($this->_objectResourceStatus == 1 && $hardDelete) {
             //delete associated resource
             parent::destroy();
         }
         //Log action
         $log = new CMS_log();
         $language = $cms_user->getLanguage();
         $log->logMiscAction(CMS_log::LOG_ACTION_RESOURCE_DELETE, $cms_user, 'Item \'' . $this->getLabel() . '\' (' . $objectDef->getLabel($language) . ')', $polyModuleCodename);
         if ($hardDelete) {
             unset($this);
         }
         //Clear polymod cache
         //CMS_cache::clearTypeCacheByMetas('polymod', array('module' => $polyModuleCodename));
         CMS_cache::clearTypeCache('polymod');
         return true;
     } else {
         //change the article proposed location and send emails to all the validators
         if ($this->setProposedLocation(RESOURCE_LOCATION_DELETED, $cms_user)) {
             parent::writeToPersistence();
             if (APPLICATION_ENFORCES_WORKFLOW) {
                 if (!NO_APPLICATION_MAIL) {
                     //get editors
                     $editors = $this->getEditors();
                     $editorsIds = array();
                     foreach ($editors as $editor) {
                         $editorsIds[] = $editor->getUserId();
                     }
                     $validators = CMS_profile_usersCatalog::getValidators($polyModuleCodename);
                     foreach ($validators as $validator) {
                         //add script to send email for validator if needed
                         CMS_scriptsManager::addScript($polyModuleCodename, array('task' => 'emailNotification', 'object' => $this->getID(), 'validator' => $validator->getUserId(), 'type' => 'delete', 'editors' => $editorsIds));
                     }
                     //then launch scripts execution
                     CMS_scriptsManager::startScript();
                 }
             } else {
                 $validation = new CMS_resourceValidation($polyModuleCodename, RESOURCE_EDITION_LOCATION, $this);
                 $mod = CMS_modulesCatalog::getByCodename($polyModuleCodename);
                 $mod->processValidation($validation, VALIDATION_OPTION_ACCEPT);
             }
             //Log action
             $log = new CMS_log();
             $language = $cms_user->getLanguage();
             $log->logResourceAction(CMS_log::LOG_ACTION_RESOURCE_DELETE, $cms_user, $polyModuleCodename, $this->getStatus(), 'Item \'' . $this->getLabel() . '\' (' . $objectDef->getLabel($language) . ')', $this);
             //Clear polymod cache
             //CMS_cache::clearTypeCacheByMetas('polymod', array('module' => $polyModuleCodename));
             CMS_cache::clearTypeCache('polymod');
             return true;
         } else {
             return false;
         }
     }
 }
Exemplo n.º 7
0
$service = sensitiveIO::sanitizeJSString($contactData->getService());
$jobtitle = sensitiveIO::sanitizeJSString($contactData->getJobTitle());
$address1 = sensitiveIO::sanitizeJSString($contactData->getAddressField1());
$address2 = sensitiveIO::sanitizeJSString($contactData->getAddressField2());
$address3 = sensitiveIO::sanitizeJSString($contactData->getAddressField3());
$zipcode = sensitiveIO::sanitizeJSString($contactData->getZip());
$city = sensitiveIO::sanitizeJSString($contactData->getCity());
$state = sensitiveIO::sanitizeJSString($contactData->getState());
$country = sensitiveIO::sanitizeJSString($contactData->getCountry());
$phone = sensitiveIO::sanitizeJSString($contactData->getPhone());
$cellphone = sensitiveIO::sanitizeJSString($contactData->getCellphone());
$fax = sensitiveIO::sanitizeJSString($contactData->getFax());
$company = sensitiveIO::sanitizeJSString($contactData->getCompany());
$gender = sensitiveIO::sanitizeJSString($contactData->getGender());
//Alerts
$modulesCodes = new CMS_modulesCodes();
$alerts = $modulesCodes->getModulesCodes(MODULE_TREATMENT_ALERTS, '', $user, array("user" => $cms_user));
$alertsPanel = '';
foreach ($alerts as $codename => $modAlerts) {
    $module = CMS_modulesCatalog::getByCodename($codename);
    $alertsPanel .= "{\n\t\txtype:\t\t\t'fieldset',\n\t\ttitle: \t\t\t'" . sensitiveIO::sanitizeJSString($module->getlabel($cms_language)) . "',\n\t\tdefaultType: \t'checkbox',\n\t\tautoHeight:\t\ttrue,\n\t\tdefaults: {\n\t\t\txtype:\t\t\t'checkbox',\n\t\t\tanchor:\t\t\t'97%',\n\t\t\thideLabel:\t\ttrue,\n\t\t\tlabelSeparator:\t''\n\t\t},\n\t\titems:\t\t\t[";
    foreach ($modAlerts as $level => $messages) {
        $checked = $user->hasAlertLevel($level, $codename) ? 'checked:true,' : '';
        $msgcodename = $module->isPolymod() ? MOD_POLYMOD_CODENAME : $codename;
        $alertsPanel .= "{\n\t\t\t" . $checked . "\n\t\t\tboxLabel: \t'<span ext:qtip=\"" . $cms_language->getJSMessage($messages['description'], false, $msgcodename) . "\" class=\"atm-help\">" . $cms_language->getJSMessage($messages['label'], false, $msgcodename) . "</span>',\n\t\t\tname: \t\t'alerts[" . $codename . "][]',\n\t\t\tinputValue:\t'" . $level . "'\n\t\t},";
    }
    //remove last comma
    $alertsPanel = io::substr($alertsPanel, 0, -1);
    $alertsPanel .= ']},';
}
//remove last comma
Exemplo n.º 8
0
 /**
  * Get toolbar elements specifics to modules for the curent user
  *
  * @return array : modules elements
  * @access public
  */
 protected function _getModulesElements()
 {
     static $modulesElements;
     if (!isset($modulesElements[$this->_user->getUserId()])) {
         //include modules codes in output file
         $modulesCodes = new CMS_modulesCodes();
         $modulesElements[$this->_user->getUserId()] = $modulesCodes->getModulesCodes(MODULE_TREATMENT_EDITOR_PLUGINS, '', new CMS_stack(), array("editor" => "fckeditor", "user" => $this->_user));
     }
     return $modulesElements[$this->_user->getUserId()];
 }
Exemplo n.º 9
0
// | Automne is subject to version 2.0 or above of the GPL license.		  |
// | The license text is bundled with this package in the file			  |
// | LICENSE-GPL, and is available through the world-wide-web at		  |
// | http://www.gnu.org/copyleft/gpl.html.								  |
// +----------------------------------------------------------------------+
// | Author: Sébastien Pauchet <*****@*****.**>	  |
// +----------------------------------------------------------------------+
//
// $Id: polymod-help.php,v 1.3 2010/03/08 16:42:07 sebastien Exp $
/**
 * PHP page : Load polymod help for object.
 * Used accross an Ajax request.
 *
 * @package Automne
 * @subpackage admin
 * @author Sébastien Pauchet <*****@*****.**>
 */
require_once dirname(__FILE__) . '/../../cms_rc_admin.php';
//load interface instance
$view = CMS_view::getInstance();
$module = sensitiveIO::request('module');
$object = sensitiveIO::request('object');
$mode = sensitiveIO::request('mode');
if ($object) {
    $modulesCodes = new CMS_modulesCodes();
    $modulesCodeInclude = $modulesCodes->getModulesCodes($mode, PAGE_VISUALMODE_CLIENTSPACES_FORM, '', array("language" => $cms_language, "user" => $cms_user, 'request' => array($module => true, $module . 'object' => $object)));
    $view->setContent($modulesCodeInclude[$module]);
} else {
    $view->setContent('');
}
$view->show(CMS_view::SHOW_HTML);