Ejemplo n.º 1
0
 function _getTextFormatingInformationAsHTML($form_element)
 {
     $show_text = true;
     $toggle_id = rand(0, 1000000);
     if (isset($form_element['help_text'])) {
         $show_text = $form_element['help_text'];
     }
     global $c_html_textarea;
     $html = '';
     $item = $this->_environment->getCurrentContextItem();
     $with_htmltextarea = $item->withHtmlTextArea();
     include_once 'functions/misc_functions.php';
     if (plugin_hook_method_active('getTextAreaAsHTML')) {
         $with_htmltextarea = true;
     }
     $text = '';
     if (!isset($c_html_textarea) or !$c_html_textarea or !$form_element['with_html_area'] or !$with_htmltextarea) {
         $title = ' ' . $this->_translator->getMessage('COMMON_TEXT_FORMATING_HELP_FULL');
         $html .= '<div style="padding-top:5px;">';
         $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('HELP_COMMON_FORMAT_TITLE') . ':</div>';
         $text .= $this->_translator->getMessage('COMMON_TEXT_FORMATING_FORMAT_TEXT');
         $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA') . ':</div>';
         $text .= $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA_TEXT');
         // plugins
         $plugin_text = plugin_hook_output_all('getTextFormatingInformationAsHTML', '', BRLF);
         if (!empty($plugin_text)) {
             $text .= $plugin_text;
         }
         //$html .='<img id="toggle'.$item->getItemID().'" src="images/more.gif"/>';
         $html .= '<img id="toggle' . $toggle_id . '" src="images/more.gif"/>';
         $html .= $title;
         //$html .= '<div id="creator_information'.$item->getItemID().'">'.LF;
         $html .= '<div id="creator_information' . $toggle_id . '">' . LF;
         $html .= '<div style="padding:2px;">' . LF;
         $html .= '<div id="form_formatting_box" style="width:97%">' . LF;
         $html .= $text;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
     } else {
         $title = '&nbsp;' . $this->_translator->getMessage('COMMON_TEXT_FORMATING_HELP_SHORT');
         $html .= '<div style="padding-top:0px;">';
         $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA') . ':</div>';
         $text .= $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA_TEXT');
         // plugins
         $plugin_text = plugin_hook_output_all('getTextFormatingInformationAsHTML', '', BRLF);
         if (!empty($plugin_text)) {
             $text .= $plugin_text;
         }
         //$html .='<img id="toggle'.$item->getItemID().'" src="images/more.gif"/>';
         $html .= '<img id="toggle' . $toggle_id . '" src="images/more.gif"/>';
         $html .= $title;
         //$html .= '<div id="creator_information'.$item->getItemID().'">'.LF;
         $html .= '<div id="creator_information' . $toggle_id . '">' . LF;
         $html .= '<div style="padding:2px;">' . LF;
         $html .= '<div id="form_formatting_box" style="width:97%">' . LF;
         $html .= $text;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
     }
     //$html .='<script type="text/javascript">initTextFormatingInformation("'.$item->getItemID().'",false);</script>';
     $html .= '<script type="text/javascript">initTextFormatingInformation("' . $toggle_id . '",false);</script>';
     $html .= '<!-- END OF FORM-VIEW -->' . LF;
     $current_module = $this->_environment->getCurrentModule();
     if (($current_module == CS_DATE_TYPE or $current_module == CS_TODO_TYPE or $current_module == CS_MATERIAL_TYPE or $current_module == CS_USER_TYPE or $current_module == CS_DISCUSSION_TYPE or $current_module == CS_GROUP_TYPE or $current_module == CS_INSTITUTION_TYPE or $current_module == CS_TOPIC_TYPE or $current_module == CS_SECTION_TYPE or $current_module == CS_DISCARTICLE_TYPE or $current_module == CS_ANNOUNCEMENT_TYPE) and $show_text) {
         return $html;
     } else {
         return '';
     }
 }
Ejemplo n.º 2
0
 private function _addFCKHash($value)
 {
     global $c_html_textarea;
     if (isset($c_html_textarea) and $c_html_textarea) {
         $current_context_item = $this->_environment->getCurrentContextItem();
         if (isset($current_context_item) and $current_context_item->withHtmlTextArea() or plugin_hook_method_active('getTextAreaAsHTML')) {
             $hack = false;
             if (!empty($_SERVER['HTTP_REFERER'])) {
                 $http_referer = $_SERVER['HTTP_REFERER'];
                 if (strstr($_SERVER['HTTP_REFERER'], '?')) {
                     $http_referer = substr($_SERVER['HTTP_REFERER'], 0, strpos($_SERVER['HTTP_REFERER'], '?'));
                 }
                 global $c_commsy_domain;
                 global $c_commsy_url_path;
                 global $c_single_entry_point;
                 if ($http_referer != $c_commsy_domain . $c_commsy_url_path . '/' . $c_single_entry_point) {
                     $hack = true;
                     // non hack, if only https is the difference
                     if (mb_stristr($http_referer, 'https://') and !mb_stristr($c_commsy_domain, 'https://') and $http_referer == str_replace('http://', 'https://', $c_commsy_domain) . $c_commsy_url_path . '/' . $c_single_entry_point) {
                         $hack = false;
                     }
                 }
             }
             if (!$hack) {
                 // security KFC
                 include_once 'functions/security_functions.php';
                 $fck_text = '<!-- KFC TEXT ' . getSecurityHash($value) . ' -->';
                 $value = $fck_text . $value . $fck_text;
             }
         }
     }
     return $value;
 }