| 1 | 1418 | Luisehahne | <?php
 | 
      
        | 2 |  |  | /**
 | 
      
        | 3 |  |  |  *
 | 
      
        | 4 |  |  |  * @category        modules
 | 
      
        | 5 |  |  |  * @package         wysiwyg
 | 
      
        | 6 |  |  |  * @author          WebsiteBaker Project
 | 
      
        | 7 | 1576 | darkviper |  * @copyright       2009-2012, Website Baker Org. e.V.
 | 
      
        | 8 | 1418 | Luisehahne |  * @link			http://www.websitebaker2.org/
 | 
      
        | 9 |  |  |  * @license         http://www.gnu.org/licenses/gpl.html
 | 
      
        | 10 |  |  |  * @platform        WebsiteBaker 2.8.x
 | 
      
        | 11 |  |  |  * @requirements    PHP 5.2.2 and higher
 | 
      
        | 12 |  |  |  * @version         $Id$
 | 
      
        | 13 |  |  |  * @filesource		$HeadURL$
 | 
      
        | 14 |  |  |  * @lastmodified    $Date$
 | 
      
        | 15 |  |  |  *
 | 
      
        | 16 |  |  |  */
 | 
      
        | 17 |  |  | 
 | 
      
        | 18 | 1538 | Luisehahne | /* -------------------------------------------------------- */
 | 
      
        | 19 | 1576 | darkviper | // Must include code to stop this file being accessed directly
 | 
      
        | 20 |  |  | if(!defined('WB_PATH')) {
 | 
      
        | 21 |  |  | 	require_once(dirname(dirname(__FILE__)).'/framework/globalExceptionHandler.php');
 | 
      
        | 22 |  |  | 	throw new IllegalFileException();
 | 
      
        | 23 | 1538 | Luisehahne | }
 | 
      
        | 24 |  |  | /* -------------------------------------------------------- */
 | 
      
        | 25 | 1418 | Luisehahne | 
 | 
      
        | 26 | 1581 | darkviper | $sMediaUrl = WB_URL.MEDIA_DIRECTORY;
 | 
      
        | 27 | 1418 | Luisehahne | // Get page content
 | 
      
        | 28 | 1578 | Luisehahne | $sql = 'SELECT `content` FROM `'.TABLE_PREFIX.'mod_wysiwyg` WHERE `section_id`='.(int)$section_id;
 | 
      
        | 29 | 1576 | darkviper | if ( ($content = $database->get_one($sql)) ) {
 | 
      
        | 30 | 1581 | darkviper | 	$content = htmlspecialchars(str_replace('{SYSVAR:MEDIA_REL}', $sMediaUrl, $content));
 | 
      
        | 31 | 1576 | darkviper | }else {
 | 
      
        | 32 |  |  | 	$content = '';
 | 
      
        | 33 |  |  | }
 | 
      
        | 34 | 1418 | Luisehahne | if(!isset($wysiwyg_editor_loaded)) {
 | 
      
        | 35 |  |  | 	$wysiwyg_editor_loaded=true;
 | 
      
        | 36 |  |  | 
 | 
      
        | 37 |  |  | 	if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) {
 | 
      
        | 38 |  |  | 		function show_wysiwyg_editor($name,$id,$content,$width,$height) {
 | 
      
        | 39 |  |  | 			echo '<textarea name="'.$name.'" id="'.$id.'" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
 | 
      
        | 40 |  |  | 		}
 | 
      
        | 41 |  |  | 	} else {
 | 
      
        | 42 | 1576 | darkviper | 		$id_list = array();
 | 
      
        | 43 |  |  | 		$sql  = 'SELECT `section_id` FROM `'.TABLE_PREFIX.'sections` ';
 | 
      
        | 44 |  |  | 		$sql .= 'WHERE `page_id`='.(int)$page_id.' AND `module`=\'wysiwyg\'';
 | 
      
        | 45 |  |  | 		if (($query_wysiwyg = $database->query($sql))) {
 | 
      
        | 46 | 1418 | Luisehahne | 			while($wysiwyg_section = $query_wysiwyg->fetchRow()) {
 | 
      
        | 47 |  |  | 				$entry='content'.$wysiwyg_section['section_id'];
 | 
      
        | 48 | 1576 | darkviper | 				$id_list[] = $entry;
 | 
      
        | 49 | 1418 | Luisehahne | 			}
 | 
      
        | 50 |  |  | 			require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
 | 
      
        | 51 |  |  | 		}
 | 
      
        | 52 |  |  | 	}
 | 
      
        | 53 |  |  | }
 | 
      
        | 54 |  |  | 
 | 
      
        | 55 |  |  | ?>
 | 
      
        | 56 |  |  | <form name="wysiwyg<?php echo $section_id; ?>" action="<?php echo WB_URL; ?>/modules/wysiwyg/save.php" method="post">
 | 
      
        | 57 | 1576 | darkviper | 	<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
 | 
      
        | 58 |  |  | 	<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
 | 
      
        | 59 | 1418 | Luisehahne | <?php
 | 
      
        | 60 |  |  | echo $admin->getFTAN()."\n";
 | 
      
        | 61 | 1426 | Luisehahne | show_wysiwyg_editor('content'.$section_id,'content'.$section_id,$content,'100%','350');
 | 
      
        | 62 | 1418 | Luisehahne | ?>
 | 
      
        | 63 | 1576 | darkviper | 	<table summary="" cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-bottom: 10px;">
 | 
      
        | 64 |  |  | 		<tr>
 | 
      
        | 65 |  |  | 			<td align="left">
 | 
      
        | 66 |  |  | 				<input type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
 | 
      
        | 67 |  |  | 			</td>
 | 
      
        | 68 |  |  | 			<td align="right">
 | 
      
        | 69 |  |  | 				<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = 'index.php';" style="width: 100px; margin-top: 5px;" />
 | 
      
        | 70 |  |  | 			</td>
 | 
      
        | 71 |  |  | 		</tr>
 | 
      
        | 72 |  |  | 	</table>
 | 
      
        | 73 | 1418 | Luisehahne | </form>
 | 
      
        | 74 | 1581 | darkviper | <br />
 |