-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodify_question.php
executable file
·142 lines (120 loc) · 4.8 KB
/
modify_question.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
/*
Website Baker Project <http://www.websitebaker.org/>
Copyright (C) 2004-2007, Ryan Djurovich
Website Baker is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Website Baker is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Website Baker; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require('../../config.php');
// Get id
if(!isset($_GET['question_id']) OR !is_numeric($_GET['question_id'])) {
header("Location: ".ADMIN_URL."/pages/index.php");
} else {
$question_id = $_GET['question_id'];
}
// Include WB admin wrapper script
require(WB_PATH.'/modules/admin.php');
// Load Language file
if(LANGUAGE_LOADED) {
require_once(WB_PATH.'/modules/rbtoggle/languages/EN.php');
if(file_exists(WB_PATH.'/modules/rbtoggle/languages/'.LANGUAGE.'.php')) {
require_once(WB_PATH.'/modules/rbtoggle/languages/'.LANGUAGE.'.php');
}
}
// Get info on question
$query_question = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_rbtoggle_questions WHERE question_id='$question_id' AND section_id='".$section_id."' ");
$fetch_question = $query_question->fetchRow();
?>
<style type="text/css">
.setting_name {
vertical-align: top;
}
</style>
<form name="modify" action="<?php echo WB_URL; ?>/modules/rbtoggle/save_question.php" method="post" style="margin: 0;">
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
<input type="hidden" name="question_id" value="<?php echo $question_id; ?>">
<table class="row_a" cellpadding="2" cellspacing="0" border="0" align="center" width="100%">
<tr>
<td class="setting_name">
<label for="category" accesskey="c"><b><?php echo $FQTEXT['CATEGORY']; ?>:</b></label>
</td>
</tr>
<tr>
<td class="setting_name">
<select name="category" id="category" style="width: 98%;">
<?php
// Get categories
$query_categories = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_rbtoggle_categories WHERE section_id='".$section_id."' ORDER BY pos ASC");
if($query_categories->numRows() > 0){
while( $fetch_categories = $query_categories->fetchRow() ) {
if($fetch_categories['cat_id'] == $fetch_question['cat_id']){ $selected = "selected"; } else { $selected = ""; }
echo '<option value="'.$fetch_categories['cat_id'].'" '.$selected.'>'.$admin->strip_slashes($fetch_categories['cat_name']).'</option>';
}
}
?>
</select>
</td>
</tr>
<tr>
<td class="setting_name">
<label for="question" accesskey="q"><b><?php echo $FQTEXT['QUESTION']; ?>:</b></label>
</td>
</tr>
<tr>
<td class="setting_name">
<input type="text" name="question" id="question" value="<?php echo $admin->strip_slashes($fetch_question['question']); ?>" style="width: 98%;" maxlength="255" />
</td>
</tr>
<tr>
<td class="setting_name">
<label for="answer" accesskey="a"><b><?php echo $FQTEXT['ANSWER']; ?>:</b></label>
</td>
</tr>
</table>
<?php
$content = $fetch_question['answer'];
$name="answer";
if(!isset($wysiwyg_editor_loaded)) {
$wysiwyg_editor_loaded=true;
if (!defined('WYSIWYG_EDITOR') OR WYSIWYG_EDITOR=="none" OR !file_exists(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php')) {
function show_wysiwyg_editor($name,$id,$content,$width,$height) {
echo '<textarea name="'.$name.'" id="'.$id.'" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
}
} else {
$id_list=array();
$query_wysiwyg = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'rbtoggle'");
if($query_wysiwyg->numRows() > 0) {
while($wysiwyg_section = $query_wysiwyg->fetchRow()) {
$entry='content'.$wysiwyg_section['section_id'];
array_push($id_list,$entry);
}
require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
}
}
}
show_wysiwyg_editor('answer','content'.$section_id,htmlspecialchars($content),'725px','350px');
?>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td align="left">
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;"></form>
</td>
<td align="right">
<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" />
</td>
</tr>
</table>
<?php
// Print admin footer
$admin->print_footer();
?>