|
|
1 |
<?PHP
|
|
|
2 |
|
|
|
3 |
if($member_db[1] > 3){ msg("error", "Access Denied", "You don't have permission to add news"); }
|
|
|
4 |
|
|
|
5 |
$orig_cat_lines = file("./data/category.db.php");
|
|
|
6 |
//only show allowed categories
|
|
|
7 |
$allowed_cats = array();
|
|
|
8 |
$cat_lines = array();
|
|
|
9 |
foreach($orig_cat_lines as $single_line){
|
|
|
10 |
$ocat_arr = explode("|", $single_line);
|
|
|
11 |
if($member_db[1] <= $ocat_arr[3] or ($ocat_arr[3] == '0' || $ocat_arr[3] == '')){
|
|
|
12 |
$cat_lines[] = $single_line;
|
|
|
13 |
$allowed_cats[] = $ocat_arr[0];
|
|
|
14 |
}
|
|
|
15 |
|
|
|
16 |
}
|
|
|
17 |
|
|
|
18 |
if ($action == "addnews"){
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
echoheader("addnews", "Add News");
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
$short_story_id = 'short_story';
|
|
|
29 |
$full_story_id = 'full_story';
|
|
|
30 |
|
|
|
31 |
//
|
|
|
32 |
// Are we using the WYSIWYG ?
|
|
|
33 |
//
|
|
|
34 |
if($config_use_wysiwyg == "yes"){
|
|
|
35 |
$use_wysiwyg = true;
|
|
|
36 |
$article_format_options = "
|
|
|
37 |
<label for='convert'>
|
|
|
38 |
<input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" disabled > Convert new lines to <br /></label>
|
|
|
39 |
<br/>
|
|
|
40 |
<label for='html'>
|
|
|
41 |
<input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"dummi\" checked disabled> Use HTML in this article</label>
|
|
|
42 |
<input type=hidden name=\"if_use_html\" value=\"yes\">
|
|
|
43 |
<br/>";
|
|
|
44 |
|
|
|
45 |
}else{
|
|
|
46 |
$use_wysiwyg = false;
|
|
|
47 |
$article_format_options = "
|
|
|
48 |
<label for='convert'>
|
|
|
49 |
<input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" checked > Convert new lines to <br /></label>
|
|
|
50 |
<br/>
|
|
|
51 |
<label for='html'>
|
|
|
52 |
<input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_use_html\" checked> Use HTML in this article</label>
|
|
|
53 |
<br/>";
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
echo "
|
|
|
57 |
<SCRIPT LANGUAGE=\"JavaScript\">
|
|
|
58 |
function preview(){
|
|
|
59 |
if(document.addnews.short_story.value == '' || document.addnews.title.value == ''){ alert('Your article must have at least Title and Short Story'); }
|
|
|
60 |
else{
|
|
|
61 |
dd=window.open('','prv','height=400,width=750,resizable=1,scrollbars=1')
|
|
|
62 |
document.addnews.mod.value='preview';document.addnews.target='prv'
|
|
|
63 |
document.addnews.submit();dd.focus()
|
|
|
64 |
setTimeout(\"document.addnews.mod.value='addnews';document.addnews.target='_self'\",500)
|
|
|
65 |
}
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
function increaseTextarea(area){
|
|
|
69 |
if (document.getElementById(area).style.height == '') {
|
|
|
70 |
document.getElementById(area).style.height = '300px';
|
|
|
71 |
}
|
|
|
72 |
else{
|
|
|
73 |
var pattern = new RegExp(\"\\\\d+\",'ig');
|
|
|
74 |
var currHeight = document.getElementById(area).style.height.match(pattern);
|
|
|
75 |
var newHeight = +currHeight + 100;
|
|
|
76 |
document.getElementById(area).style.height = newHeight + 'px';
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
function submitForm() {
|
|
|
84 |
//make sure hidden and iframe values are in sync before submitting form
|
|
|
85 |
//to sync only 1 rte, use updateRTE(rte)
|
|
|
86 |
//to sync all rtes, use updateRTEs
|
|
|
87 |
updateRTE('short_story');
|
|
|
88 |
updateRTE('full_story');
|
|
|
89 |
//updateRTEs();
|
|
|
90 |
|
|
|
91 |
//change the following line to true to submit form
|
|
|
92 |
return true;
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
function increaseTextareaBug(){";
|
|
|
96 |
|
|
|
97 |
if($use_wysiwyg){
|
|
|
98 |
echo"var area = '$full_story_id';
|
|
|
99 |
if (document.getElementById(area).style.height == '') {
|
|
|
100 |
document.getElementById(area).style.height = '250px';
|
|
|
101 |
}
|
|
|
102 |
else{
|
|
|
103 |
var pattern = new RegExp(\"\\\\d+\",'ig');
|
|
|
104 |
var currHeight = document.getElementById(area).style.height.match(pattern);
|
|
|
105 |
var newHeight = +currHeight + 1;
|
|
|
106 |
document.getElementById(area).style.height = newHeight + 'px';
|
|
|
107 |
}";
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
echo"}
|
|
|
111 |
|
|
|
112 |
onload=focus;function focus(){document.forms[0].title.focus();}
|
|
|
113 |
|
|
|
114 |
</SCRIPT>
|
|
|
115 |
|
|
|
116 |
<form onSubmit = \"return submitForm();\" method=post name=addnews action=\"$PHP_SELF\">
|
|
|
117 |
<table border=0 cellpading=0 cellspacing=0 width=\"654\" >
|
|
|
118 |
|
|
|
119 |
<tr>
|
|
|
120 |
<td width=\"75\">
|
|
|
121 |
Title
|
|
|
122 |
<td width=\"575\" colspan=\"2\">
|
|
|
123 |
<input type=text size=\"55\" name=\"title\" tabindex=1>
|
|
|
124 |
</tr>";
|
|
|
125 |
|
|
|
126 |
if($config_use_avatar == "yes"){
|
|
|
127 |
echo"<tr>
|
|
|
128 |
<td width=\"75\">
|
|
|
129 |
Avatar URL
|
|
|
130 |
<td width=\"575\" colspan=\"2\">
|
|
|
131 |
<input tabindex=2 type=text size=\"42\" value=\"$member_db[8]\" name=\"manual_avatar\" > <font style=\"font-size:7pt\">(optional)</font>
|
|
|
132 |
</tr>";
|
|
|
133 |
}
|
|
|
134 |
/* Old Single Category Code */
|
|
|
135 |
|
|
|
136 |
if(count($cat_lines) > 0){
|
|
|
137 |
echo"<tr id='singlecat'>
|
|
|
138 |
<td width=\"75\">
|
|
|
139 |
Category
|
|
|
140 |
<td width=\"575\" colspan=\"2\">
|
|
|
141 |
<select id='selecsinglecat' name=category tabindex=3>\n
|
|
|
142 |
<option value=\"\"> </option>\n";
|
|
|
143 |
foreach($cat_lines as $single_line){
|
|
|
144 |
$cat_arr = explode("|", $single_line);
|
|
|
145 |
$if_is_selected = "";
|
|
|
146 |
if($category == $cat_arr[0]){ $if_is_selected = " selected "; }
|
|
|
147 |
echo"<option $if_is_selected value=\"$cat_arr[0]\">$cat_arr[1]</option>\n";
|
|
|
148 |
}
|
|
|
149 |
echo"</select> <a href=\"javascript:ShowOrHide('multicat','singlecat');\" onClick=\"javascript:document.getElementById('selecsinglecat').name='';\">(multiple categories)</a></tr>";
|
|
|
150 |
}
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
/*###
|
|
|
154 |
##### New Multy Category Code
|
|
|
155 |
*/###
|
|
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
if(count($cat_lines) > 0){
|
|
|
160 |
echo"
|
|
|
161 |
<tr style=\"display:none;\" id='multicat'>
|
|
|
162 |
<td width=\"75\">
|
|
|
163 |
Category
|
|
|
164 |
<td>";
|
|
|
165 |
echo'<table width="100%" border="0" cellspacing="0" cellpadding="0" class="panel">';
|
|
|
166 |
|
|
|
167 |
foreach($cat_lines as $single_line){
|
|
|
168 |
|
|
|
169 |
|
|
|
170 |
$cat_arr = explode("|", $single_line);
|
|
|
171 |
$if_is_selected = "";
|
|
|
172 |
if($category == $cat_arr[0]){ $if_is_selected = " checked "; }
|
|
|
173 |
|
|
|
174 |
// echo"<input name='category[]' type=checkbox $if_is_selected value=\"$cat_arr[0]\">$cat_arr[1],\n";
|
|
|
175 |
|
|
|
176 |
echo"
|
|
|
177 |
|
|
|
178 |
<td style='font-size:10px;' valign=top>
|
|
|
179 |
<label for='cat{$cat_arr[0]}'>
|
|
|
180 |
<input $if_is_selected style='background-color:transparent;border:0px;' type=checkbox name='category[]' id='cat{$cat_arr[0]}' value='{$cat_arr[0]}'>$cat_arr[1]</label>";
|
|
|
181 |
$i++;
|
|
|
182 |
if ($i%4 == 0){ echo'<tr>'; }
|
|
|
183 |
|
|
|
184 |
|
|
|
185 |
}
|
|
|
186 |
echo"</tr></table> <td> </td> ";
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
|
|
|
194 |
|
|
|
195 |
|
|
|
196 |
|
|
|
197 |
echo"
|
|
|
198 |
<tr>
|
|
|
199 |
<td width=\"75\" valign=\"top\">
|
|
|
200 |
<br />Short Story
|
|
|
201 |
<td>";
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
if ($use_wysiwyg) {
|
|
|
205 |
echo"
|
|
|
206 |
<script language=\"JavaScript\" type=\"text/javascript\" src=\"rte/richtext.js\"></script>
|
|
|
207 |
<script language=\"JavaScript\" type=\"text/javascript\">
|
|
|
208 |
initRTE(\"rte/images/\", \"rte/\", \"rte/\", false); </script>
|
|
|
209 |
|
|
|
210 |
<script language=\"JavaScript\" type=\"text/javascript\">
|
|
|
211 |
writeRichText('short_story', '', 460, 250, true, false);
|
|
|
212 |
</script>
|
|
|
213 |
";
|
|
|
214 |
}else{
|
|
|
215 |
echo"
|
|
|
216 |
<textarea rows=\"12\" cols=\"74\" id=\"short_story\" name=\"short_story\" tabindex=4></textarea>
|
|
|
217 |
";
|
|
|
218 |
}
|
|
|
219 |
|
|
|
220 |
echo"
|
|
|
221 |
<td width=\"108\" valign=\"top\" style='background: url(skins/images/baloon.gif) no-repeat top left'>
|
|
|
222 |
<p align=\"center\"><a href=# onclick=\"window.open('$PHP_SELF?&mod=images&action=quick&area=$short_story_id&wysiwyg=$use_wysiwyg', '_Addimage', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');return false;\&q |