Project

General

Profile

« Previous | Next » 

Revision 1289

Added by kweitzel over 14 years ago

Branch 2.8.1 merged back into Trunk

View differences:

modify.php
1
<?php
2

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9

  
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

  
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

  
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

  
24
*/
25

  
26
if(!defined('WB_PATH')) exit('Direct access to this file is not allowed');
27

  
28
// Get page content
29
$query = "SELECT content FROM ".TABLE_PREFIX."mod_wysiwyg WHERE section_id = '$section_id'";
30
$get_content = $database->query($query);
31
$content = $get_content->fetchRow();
32
$content = (htmlspecialchars($content['content']));
33

  
34
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
		$id_list=array();
43
		$query_wysiwyg = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'wysiwyg'");
44
		if($query_wysiwyg->numRows() > 0) {
45
			while($wysiwyg_section = $query_wysiwyg->fetchRow()) {
46
				$entry='content'.$wysiwyg_section['section_id'];
47
				array_push($id_list,$entry);
48
			}
49
			require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
50
		}
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

  
58
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
59
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
60

  
61
<?php
62
show_wysiwyg_editor('content'.$section_id,'content'.$section_id,$content,'725px','350px');
63
?>
64

  
65
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-bottom: 10px;">
66
<tr>
67
	<td align="left">
68
		<input type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
69
	</td>
70
	<td align="right">
71
		<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = 'index.php';" style="width: 100px; margin-top: 5px;" />
72
	</td>
73
</tr>
74
</table>
75

  
76
</form>
77

  
1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         wysiwyg
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2010, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 4.3.4 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18

  
19
if(!defined('WB_PATH')) exit('Direct access to this file is not allowed');
20

  
21
// Get page content
22
$query = "SELECT content FROM ".TABLE_PREFIX."mod_wysiwyg WHERE section_id = '$section_id'";
23
$get_content = $database->query($query);
24
$content = $get_content->fetchRow();
25
$content = (htmlspecialchars($content['content']));
26

  
27
if(!isset($wysiwyg_editor_loaded)) {
28
	$wysiwyg_editor_loaded=true;
29

  
30
	if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) {
31
		function show_wysiwyg_editor($name,$id,$content,$width,$height) {
32
			echo '<textarea name="'.$name.'" id="'.$id.'" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
33
		}
34
	} else {
35
		$id_list=array();
36
		$query_wysiwyg = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'wysiwyg'");
37
		if($query_wysiwyg->numRows() > 0) {
38
			while($wysiwyg_section = $query_wysiwyg->fetchRow()) {
39
				$entry='content'.$wysiwyg_section['section_id'];
40
				array_push($id_list,$entry);
41
			}
42
			require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
43
		}
44
	}
45
}
46

  
47
?>
48

  
49
<form name="wysiwyg<?php echo $section_id; ?>" action="<?php echo WB_URL; ?>/modules/wysiwyg/save.php" method="post">
50

  
51
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
52
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
53

  
54
<?php
55
show_wysiwyg_editor('content'.$section_id,'content'.$section_id,$content,'100%','350px');
56
?>
57

  
58
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-bottom: 10px;">
59
<tr>
60
	<td align="left">
61
		<input type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
62
	</td>
63
	<td align="right">
64
		<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = 'index.php';" style="width: 100px; margin-top: 5px;" />
65
	</td>
66
</tr>
67
</table>
68

  
69
</form>
70

  
78 71
<br />
79 72

  

Also available in: Unified diff