Project

General

Profile

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 1652 Luisehahne
 * @platform        WebsiteBaker 2.8.3
11 1418 Luisehahne
 * @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 1652 Luisehahne
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
22 1576 darkviper
	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 2007 darkviper
if (($content = $database->get_one($sql)) !== null) {
30 2058 darkviper
    $sFilterApi = WB_PATH.'/modules/output_filter/OutputFilterApi.php';
31
    if (is_readable($sFilterApi)) {
32
        require_once($sFilterApi);
33
        $content = OutputFilterApi('ReplaceSysvar', $content);
34
    }
35
	$content = htmlspecialchars($content);
36 1875 Luisehahne
} else {
37 1876 Luisehahne
 $content = 'There is an relation error in the database.';
38
 $sql = 'INSERT INTO `'.TABLE_PREFIX.'mod_wysiwyg` SET '
39
      .     '`section_id`='.$section_id.', '
40
      .     '`page_id`='.$page_id.', '
41
      .     '`content`=\''.$content.'\', '
42
      .     '`text`=\''.$content.'\'';
43
 if($database->query($sql)) {
44
  $content .= ' WebsiteBaker has solved this problem successful.';
45
 }else {
46
  throw new AppException('Database: missing entry in table \''.TABLE_PREFIX.'mod_wysiwyg\' for section_id='.$section_id);
47
 }
48 1576 darkviper
}
49 1660 Luisehahne
if(!isset($wysiwyg_editor_loaded)) {
50 1875 Luisehahne
	$wysiwyg_editor_loaded=true;
51 1660 Luisehahne
	if(!function_exists('show_wysiwyg_editor'))
52 1640 Luisehahne
	{
53 1660 Luisehahne
		if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php'))
54 1640 Luisehahne
		{
55 1660 Luisehahne
			function show_wysiwyg_editor($name,$id,$content,$width,$height)
56
			{
57
				echo '<textarea name="'.$name.'" id="'.$id.'" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
58
			}
59
		} else {
60
			require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
61 1418 Luisehahne
		}
62
	}
63
}
64
65
?>
66
<form name="wysiwyg<?php echo $section_id; ?>" action="<?php echo WB_URL; ?>/modules/wysiwyg/save.php" method="post">
67 1576 darkviper
	<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
68
	<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
69 1418 Luisehahne
<?php
70 1640 Luisehahne
echo $admin->getFTAN()."\n";
71
echo show_wysiwyg_editor('content'.$section_id,'content'.$section_id,$content,'100%','350');
72 1418 Luisehahne
?>
73 1576 darkviper
	<table summary="" cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-bottom: 10px;">
74
		<tr>
75
			<td align="left">
76
				<input type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
77
			</td>
78
			<td align="right">
79
				<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = 'index.php';" style="width: 100px; margin-top: 5px;" />
80
			</td>
81
		</tr>
82
	</table>
83 1418 Luisehahne
</form>
84 1581 darkviper
<br />