Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         wysiwyg
6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2012, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.3
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id: modify.php 2007 2013-11-23 21:00:38Z darkviper $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/wysiwyg/modify.php $
14
 * @lastmodified    $Date: 2013-11-23 22:00:38 +0100 (Sat, 23 Nov 2013) $
15
 *
16
 */
17

    
18
/* -------------------------------------------------------- */
19
// Must include code to stop this file being accessed directly
20
if(!defined('WB_PATH')) {
21
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
22
	throw new IllegalFileException();
23
}
24
/* -------------------------------------------------------- */
25

    
26
$sMediaUrl = WB_URL.MEDIA_DIRECTORY;
27
// Get page content
28
$sql = 'SELECT `content` FROM `'.TABLE_PREFIX.'mod_wysiwyg` WHERE `section_id`='.(int)$section_id;
29
if (($content = $database->get_one($sql)) !== null) {
30
	$content = str_replace('{SYSVAR:MEDIA_REL}', $sMediaUrl, $content);
31
	$content = htmlspecialchars(str_replace('{SYSVAR:WB_REL}', WB_URL, $content));
32
} else {
33
 $content = 'There is an relation error in the database.';
34
 $sql = 'INSERT INTO `'.TABLE_PREFIX.'mod_wysiwyg` SET '
35
      .     '`section_id`='.$section_id.', '
36
      .     '`page_id`='.$page_id.', '
37
      .     '`content`=\''.$content.'\', '
38
      .     '`text`=\''.$content.'\'';
39
 if($database->query($sql)) {
40
  $content .= ' WebsiteBaker has solved this problem successful.';
41
 }else {
42
  throw new AppException('Database: missing entry in table \''.TABLE_PREFIX.'mod_wysiwyg\' for section_id='.$section_id);
43
 }
44
}
45
if(!isset($wysiwyg_editor_loaded)) {
46
	$wysiwyg_editor_loaded=true;
47
	if(!function_exists('show_wysiwyg_editor'))
48
	{
49
		if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php'))
50
		{
51
			function show_wysiwyg_editor($name,$id,$content,$width,$height)
52
			{
53
				echo '<textarea name="'.$name.'" id="'.$id.'" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
54
			}
55
		} else {
56
			require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
57
		}
58
	}
59
}
60

    
61
?>
62
<form name="wysiwyg<?php echo $section_id; ?>" action="<?php echo WB_URL; ?>/modules/wysiwyg/save.php" method="post">
63
	<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
64
	<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
65
<?php
66
echo $admin->getFTAN()."\n";
67
echo show_wysiwyg_editor('content'.$section_id,'content'.$section_id,$content,'100%','350');
68
?>
69
	<table summary="" cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-bottom: 10px;">
70
		<tr>
71
			<td align="left">
72
				<input type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
73
			</td>
74
			<td align="right">
75
				<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = 'index.php';" style="width: 100px; margin-top: 5px;" />
76
			</td>
77
		</tr>
78
	</table>
79
</form>
80
<br />
(6-6/10)