Exemplo n.º 1
0
 /**
  * This function is only used for old Automne modules compatibility
  * @author Sébastien Pauchet <*****@*****.**>
  */
 function createAutomneLinks($text, $module = MOD_STANDARD_CODENAME)
 {
     return CMS_textEditor::parseOuterContent($text, $module);
 }
     break;
 case 'update-block-text':
 case 'update-block-varchar':
     //update block content
     if (class_exists($blockClass)) {
         $cms_block = new $blockClass();
         $cms_block->initializeFromBasicAttributes($blockId);
         if ($action == 'update-block-text') {
             $errors = '';
             if (!sensitiveIO::checkXHTMLValue($value, $errors)) {
                 //Send an error to user about his content
                 $jscontent = "\n\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\tmsg: \t\t\t\t'" . $cms_language->getJsMessage(MESSAGE_PAGE_COPY_PASTE_ERROR) . ($errors ? "<br /><br />" . sensitiveIO::sanitizeJSString($errors) : '') . "',\n\t\t\t\t\t\tbuttons: \t\t\tExt.MessageBox.OK,\n\t\t\t\t\t\tclosable: \t\t\ttrue,\n\t\t\t\t\t\ticon: \t\t\t\tExt.MessageBox.ERROR\n\t\t\t\t\t});";
                 $view->addJavascript($jscontent);
                 $view->show();
             }
             $value = CMS_textEditor::parseOuterContent($value);
         }
         $cms_block->writeToPersistence($cms_page->getID(), $cs, $rowTag, RESOURCE_LOCATION_EDITION, false, array("value" => $value));
         //instanciate the clientspace
         $clientSpace = CMS_moduleClientSpace_standard_catalog::getByTemplateAndTagID($tpl, $cs, $visualMode == PAGE_VISUALMODE_FORM);
         //get block's row from CS
         $row = $clientSpace->getRow($rowId, $rowTag);
         if ($row) {
             //get row datas
             $datas = $row->getData($cms_language, $cms_page, $clientSpace, PAGE_VISUALMODE_FORM);
             //instanciate modules treatments for page content tags
             $modulesTreatment = new CMS_modulesTags(MODULE_TREATMENT_PAGECONTENT_TAGS, PAGE_VISUALMODE_FORM, $cms_page);
             $modulesTreatment->setTreatmentParameters(array("language" => $cms_language, 'replaceVars' => $action != 'update-block-text'));
             $modulesTreatment->setDefinition($datas);
             $datas = $modulesTreatment->treatContent(true);
             if ($action == 'update-block-text') {
Exemplo n.º 3
0
 /**
  * Get a CMS_textEditor from given parameters
  * 
  * @param mixed array(), $attrs each key => value is an attribute
  * of this class or an attribute to fckeditor
  * @return CMS_textEditor or null if error
  */
 function getEditorFromParams($attrs)
 {
     if (!is_array($attrs)) {
         CMS_grandFather::raiseError("None array of attributes passed to factory");
         return null;
     }
     $text_editor = new CMS_textEditor($attrs['form'], $attrs['field'], $attrs['value'], $_SERVER["HTTP_USER_AGENT"], '', $attrs['language'], $attrs['width'], $attrs['rows']);
     $fck_attrs = array('ToolbarSet' => $attrs['toolbarset'], 'Width' => $attrs['width'], 'Height' => $attrs['height']);
     $text_editor->setEditorAttributes($fck_attrs);
     return $text_editor;
 }
Exemplo n.º 4
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 setValues($values, $prefixName)
 {
     $params = $this->getParamsValues();
     if (!$params['html']) {
         //remove html characters if any then convert line breaks to <br /> tags
         $value = isset($values[$prefixName . $this->_field->getID() . '_0']) ? nl2br(strip_tags(io::htmlspecialchars($values[$prefixName . $this->_field->getID() . '_0']))) : '';
     } else {
         $value = CMS_textEditor::parseOuterContent($values[$prefixName . $this->_field->getID() . '_0'], CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()));
     }
     if (!$this->_subfieldValues[0]->setValue($value)) {
         return false;
     }
     return true;
 }
Exemplo n.º 5
0
        break;
}
// +----------------------------------------------------------------------+
// | Render                                                               |
// +----------------------------------------------------------------------+
$dialog = new CMS_dialog();
$content = '';
$dialog->setTitle($cms_language->getMessage(MESSAGE_PAGE_TITLE_MODULE, array($cms_module->getLabel($cms_language))) . " :: " . $cms_language->getMessage(MESSAGE_PAGE_TITLE, false, MOD_CMS_FORMS_CODENAME));
$dialog->setBacklink("items.php?item=" . $item->getId());
if ($cms_message) {
    $dialog->setActionMessage($cms_message);
}
// Insert prefered text editor for textarea field
$toolbarset = !$cms_module->getParameters("editor_toolbar") ? 'Basic' : $cms_module->getParameters("editor_toolbar");
$attrs = array('form' => 'frmitem', 'field' => 'source_' . $item->getID(), 'value' => $item->getAttribute('source'), 'language' => $cms_language, 'width' => 600, 'height' => 600, 'rows' => 8, 'toolbarset' => $toolbarset);
$text_editor = CMS_textEditor::getEditorFromParams($attrs);
$dialog->setJavascript($text_editor->getJavascript());
// Get listboxes for categories
$a_all_categories = CMS_moduleCategories_catalog::getAllCategoriesAsArray($cms_user, $cms_module->getCodename(), $cms_language);
if (!sizeof($a_all_categories)) {
    //user has no right on categories so he can't edit/create items
    header("Location: " . $cms_module->getAdminFrontendPath(PATH_RELATIVETO_WEBROOT) . "?cms_message_id=65&" . session_name() . "=" . session_id());
    exit;
}
$s_categories_listboxes = CMS_moduleCategories_catalog::getListBoxes(array('field_name' => 'ids', 'items_possible' => $a_all_categories, 'items_selected' => $item_relations->getCategoriesIds(), 'select_width' => '250px', 'select_height' => '120px', 'form_name' => 'frmitem'));
// Default check statuses for radios
$public = array();
$public[1] = $item->getAttribute('public') === true ? ' checked="checked"' : '';
$public[0] = $item->getAttribute('public') === false ? ' checked="checked"' : '';
$content = '
	<table border="0" cellpadding="3" cellspacing="2">
Exemplo n.º 6
0
 /**
  * Access to description
  *
  * @access public
  * @param CMS_language $language
  * @return string
  */
 function getDescription($language = false, $useAlternative = true, $pluginsCode = true)
 {
     if (!$this->_descriptions) {
         $this->_retrieveLabels();
     }
     if (!is_a($language, 'CMS_language')) {
         $language = $this->_language;
     }
     $description = '';
     if (is_a($language, 'CMS_language') && isset($this->_descriptions[$language->getCode()]) && $this->_descriptions[$language->getCode()]) {
         $description = $this->_descriptions[$language->getCode()];
     } elseif ($useAlternative && isset($this->_descriptions[APPLICATION_DEFAULT_LANGUAGE]) && $this->_descriptions[APPLICATION_DEFAULT_LANGUAGE]) {
         $description = $this->_descriptions[APPLICATION_DEFAULT_LANGUAGE];
     } else {
         $description = '';
     }
     if ($pluginsCode) {
         //search and convert plugins codes
         $description = CMS_textEditor::parseOuterContent($description, $this->_moduleCodename);
         //then eval all plugin codes
         $callbackFunc = create_function('$string', 'ob_start();eval(sensitiveIO::sanitizeExecCommand("$string[2];"));$ret = ob_get_contents();ob_end_clean();return $ret;');
         if ($callbackFunc) {
             $description = preg_replace_callback("/(<\\?php|<\\?)(.*?)\\?>/si", $callbackFunc, $description);
         }
     }
     return $description;
 }
Exemplo n.º 7
0
 /**
  * Get the HTML form given the block HTML example data.
  *
  * @param CMS_language &$language The language of the administration frontend
  * @param CMS_page &$page The page which contains the client space
  * @param CMS_clientSpace &$clientSpace The client space which contains the row
  * @param CMS_row &$row The row which contains the block
  * @param integer $blockID The tag ID of the block
  * @param string $data The data to show as example
  * @return string The HTML form which can send to the page that will modify the block
  * @access private
  */
 protected function _getHTMLForm($language, &$page, &$clientSpace, &$row, $blockID, $data)
 {
     global $cms_user;
     $rawDatas = $this->getRawData($page->getID(), $clientSpace->getTagID(), $row->getTagID(), RESOURCE_LOCATION_EDITION, false);
     $this->_jsBlockClass = 'Automne.blockText';
     $this->_value = CMS_textEditor::parseInnerContent($rawDatas['value']);
     $this->_value = base64_encode($this->_value);
     //set editor options
     $this->_options = array('styles' => isset($this->_attributes['styles']) ? $this->_attributes['styles'] : '', 'bgcolor' => isset($this->_attributes['bgcolor']) ? $this->_attributes['bgcolor'] : '', 'language' => $language->getCode(), 'atmToolbar' => isset($this->_attributes['toolbar']) ? $this->_attributes['toolbar'] : '', 'utf8' => strtolower(APPLICATION_DEFAULT_ENCODING) == 'utf-8');
     $this->_administrable = false;
     $html = parent::_getHTMLForm($language, $page, $clientSpace, $row, $blockID, $data);
     //encode brackets to avoid vars ( {something:type:var} ) to be interpretted
     //decoded into CMS_row::getData
     $html = preg_replace('#{([a-zA-Z0-9._{}:-]*)}#U', '||bo||\\1||bc||', $html);
     $replace = array('||bovd||' => '&#123;', '||bcvd||' => '&#125;');
     $html = str_replace(array_keys($replace), $replace, $html);
     return $html;
 }