| 1 | 2 | Manuela | <?php
 | 
      
        | 2 |  |  | /**
 | 
      
        | 3 |  |  |  *
 | 
      
        | 4 |  |  |  * @category        modules
 | 
      
        | 5 |  |  |  * @package         wysiwyg
 | 
      
        | 6 |  |  |  * @author          WebsiteBaker Project
 | 
      
        | 7 |  |  |  * @copyright       WebsiteBaker Org. e.V.
 | 
      
        | 8 |  |  |  * @link            http://websitebaker.org/
 | 
      
        | 9 |  |  |  * @license         http://www.gnu.org/licenses/gpl.html
 | 
      
        | 10 |  |  |  * @platform        WebsiteBaker 2.8.3
 | 
      
        | 11 |  |  |  * @requirements    PHP 5.3.6 and higher
 | 
      
        | 12 |  |  |  * @version         $Id$
 | 
      
        | 13 |  |  |  * @filesource      $HeadURL$
 | 
      
        | 14 |  |  |  * @lastmodified    $Date$
 | 
      
        | 15 |  |  |  *
 | 
      
        | 16 |  |  |  */
 | 
      
        | 17 |  |  | 
 | 
      
        | 18 |  |  | /* -------------------------------------------------------- */
 | 
      
        | 19 |  |  | // Must include code to stop this file being accessed directly
 | 
      
        | 20 |  |  | if(defined('WB_PATH') == false) { die('Illegale file access /'.basename(__DIR__).'/'.basename(__FILE__).''); }
 | 
      
        | 21 |  |  | /* -------------------------------------------------------- */
 | 
      
        | 22 |  |  | 
 | 
      
        | 23 |  |  | // Get page content   htmlspecialchars
 | 
      
        | 24 |  |  | $sql = 'SELECT `content` FROM `'.TABLE_PREFIX.'mod_wysiwyg` WHERE `section_id`='.(int)$section_id;
 | 
      
        | 25 |  |  | if ( ($content = $database->get_one($sql)) ) {
 | 
      
        | 26 |  |  |     $sFilterApi = WB_PATH.'/modules/output_filter/OutputFilterApi.php';
 | 
      
        | 27 |  |  |     if (is_readable($sFilterApi)) {
 | 
      
        | 28 |  |  |         require_once($sFilterApi);
 | 
      
        | 29 |  |  |         $content = OutputFilterApi('ReplaceSysvar', $content);
 | 
      
        | 30 |  |  |     }
 | 
      
        | 31 |  |  |     $content = htmlspecialchars($content);
 | 
      
        | 32 |  |  | } else {
 | 
      
        | 33 |  |  |     $content = '';
 | 
      
        | 34 |  |  | }
 | 
      
        | 35 |  |  | if(mb_detect_encoding($content, 'UTF-8, '.strtoupper(DEFAULT_CHARSET)) === 'UTF-8'){
 | 
      
        | 36 |  |  |   # der String ist in UTF-8 kodiert
 | 
      
        | 37 |  |  | //$content = (utf8_decode($content));
 | 
      
        | 38 |  |  | //$content = (iconv("UTF-8", strtoupper(DEFAULT_CHARSET), $content));
 | 
      
        | 39 |  |  | }
 | 
      
        | 40 |  |  | //  $content = utf8_decode($content);
 | 
      
        | 41 |  |  | if(!isset($wysiwyg_editor_loaded)) {
 | 
      
        | 42 |  |  |     $wysiwyg_editor_loaded=true;
 | 
      
        | 43 |  |  |     if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) {
 | 
      
        | 44 |  |  |         function show_wysiwyg_editor($name,$id,$content,$width,$height) {
 | 
      
        | 45 |  |  |             echo '<textarea name="'.$name.'" id="'.$id.'" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
 | 
      
        | 46 |  |  |         }
 | 
      
        | 47 |  |  |     } else {
 | 
      
        | 48 |  |  |         $id_list = array();
 | 
      
        | 49 |  |  |         $sql  = 'SELECT `section_id` FROM `'.TABLE_PREFIX.'sections` ';
 | 
      
        | 50 |  |  |         $sql .= 'WHERE `page_id`='.(int)$page_id.' AND `module`=\'wysiwyg\'';
 | 
      
        | 51 |  |  |         if (($query_wysiwyg = $database->query($sql))) {
 | 
      
        | 52 |  |  |             while($wysiwyg_section = $query_wysiwyg->fetchRow( MYSQLI_ASSOC )) {
 | 
      
        | 53 |  |  |                 $entry='content'.$wysiwyg_section['section_id'];
 | 
      
        | 54 |  |  |                 $id_list[] = $entry;
 | 
      
        | 55 |  |  |             }
 | 
      
        | 56 |  |  |             require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
 | 
      
        | 57 |  |  |         }
 | 
      
        | 58 |  |  |     }
 | 
      
        | 59 |  |  | }
 | 
      
        | 60 |  |  | ?>
 | 
      
        | 61 |  |  | <form name="wysiwyg<?php echo $section_id; ?>" action="<?php echo WB_URL; ?>/modules/wysiwyg/save.php" method="post">
 | 
      
        | 62 |  |  |     <input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
 | 
      
        | 63 |  |  |     <input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
 | 
      
        | 64 |  |  | <?php
 | 
      
        | 65 |  |  | echo $admin->getFTAN()."\n";
 | 
      
        | 66 |  |  | show_wysiwyg_editor('content'.$section_id,'content'.$section_id,$content,'100%','350', false);
 | 
      
        | 67 |  |  | ?>
 | 
      
        | 68 |  |  |     <table  style="padding-bottom: 10px; width: 100%;">
 | 
      
        | 69 |  |  |         <tr>
 | 
      
        | 70 |  |  |             <td style="text-align: left;margin-left: 1em;">
 | 
      
        | 71 |  |  |                 <input name="modify" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="min-width: 100px; margin-top: 5px;" />
 | 
      
        | 72 |  |  |                 <input name="pagetree" type="submit" value="<?php echo $TEXT['SAVE'].' & '.$TEXT['BACK']; ?>" style="min-width: 100px; margin-top: 5px;" />
 | 
      
        | 73 |  |  |             </td>
 | 
      
        | 74 |  |  |             <td style="text-align: right;margin-right: 1em;">
 | 
      
        | 75 |  |  |                 <input name="cancel" type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="window.location = 'index.php';" style="min-width: 100px; margin-top: 5px;" />
 | 
      
        | 76 |  |  |             </td>
 | 
      
        | 77 |  |  |         </tr>
 | 
      
        | 78 |  |  |     </table>
 | 
      
        | 79 |  |  | </form>
 | 
      
        | 80 |  |  | <br />
 |