Add netbeans project
[contractdashboard.git] / cutenews / inc / options.mdu
1 <?PHP
2
3 if($member_db[1] == 4 and ($action != 'personal' and $action != 'options')){ msg('error', 'Error!', 'Access Denied for your user-level (commenter)'); }
4 // ********************************************************************************
5 // Options Menu
6 // ********************************************************************************
7 if($action == "options" or $action == '')
8 {
9 echoheader("options","Options");
10
11 //----------------------------------
12 // Predefine Options
13 //----------------------------------
14
15 // access means the lower level of user allowed; 1:admin, 2:editor+admin, 3:editor+admin+journalist, 4:all
16 $options = array(
17 array(
18 'name' => "Personal Options",
19 'url' => "$PHP_SELF?mod=options&action=personal",
20 'access' => "4",
21 ),
22
23 array(
24 'name' => "Block IP's from posting comments",
25 'url' => "$PHP_SELF?mod=ipban",
26 'access' => "1",
27 ),
28
29
30 array(
31 'name' => "System Configurations",
32 'url' => "$PHP_SELF?mod=options&action=syscon&rand=".time(),
33 'access' => "1",
34 ),
35
36
37 array(
38 'name' => "Integration Wizards (News and RSS)",
39 'url' => "$PHP_SELF?mod=wizards",
40 'access' => "1",
41 ),
42
43 array(
44 'name' => "Edit Templates",
45 'url' => "$PHP_SELF?mod=options&action=templates",
46 'access' => "1",
47 ),
48
49 array(
50 'name' => "Add/Edit Users",
51 'url' => "$PHP_SELF?mod=editusers&action=list",
52 'access' => "1",
53 ),
54
55 array(
56 'name' => "Archives Manager",
57 'url' => "$PHP_SELF?mod=tools&action=archive",
58 'access' => "1",
59 ),
60
61 array(
62 'name' => "Manage Uploaded Images",
63 'url' => "$PHP_SELF?mod=images",
64 'access' => "1",
65 ),
66
67 array(
68 'name' => "Backup Tool",
69 'url' => "$PHP_SELF?mod=tools&action=backup",
70 'access' => "1",
71 ),
72
73 array(
74 'name' => "Edit Categories",
75 'url' => "$PHP_SELF?mod=categories",
76 'access' => "1",
77 ),
78
79
80
81 );
82
83
84 //------------------------------------------------
85 // Cut the options for wich we don't have access
86 //------------------------------------------------
87 $count_options = count($options);
88 for($i=0; $i<$count_options; $i++){
89 if($member_db[1] > $options[$i]['access']){
90 unset($options[$i]);
91 }
92 }
93 echo'<table border="0" width="100%"><tr>';
94 $i = 0;
95 foreach($options as $option){
96 if($i%2 == 0){ echo"</tr>\n<tr>\n<td width='47%'>&nbsp;&nbsp;&nbsp;<a href='".$option['url']."'><b>".$option['name']."</b></a></td>\n"; }
97 else{ echo"\n<td width='53%'><a href='".$option['url']."'><b>".$option['name']."</b></a></td>\n"; }
98 $i++;
99 }
100
101 echo'</tr></table>';
102 echofooter();
103 }
104 // ********************************************************************************
105 // Show Personal Options
106 // ********************************************************************************
107 elseif($action == "personal")
108 {
109 echoheader("user","Personal Options");
110
111 $registrationdate = date("D, d F Y",$member_db[0]); //registration date
112 if($member_db[7] == 1){ $ifchecked = "Checked"; } //if user wants to hide his e-mail
113
114 foreach($member_db as $key=>$value){
115 $member_db[$key] = stripslashes(preg_replace(array("'\"'", "'\''"), array("&quot;", "&#039;"),$member_db[$key]));
116 }
117
118 echo"
119 <table border=0 height=1 width=617 cellspacing=\"0\" cellpadding=\"0\">
120 <form method=POST action=\"$PHP_SELF\" name=personal>
121 <td height=\"21\" width=\"99\" bgcolor=#F7F6F4 >
122 &nbsp; Username
123 <td height=\"21\" width=\"400\" bgcolor=#F7F6F4 colspan=2>
124 $member_db[2]
125 <tr>
126 <td height=\"21\" width=\"200\">
127 &nbsp; New Password
128 <td height=\"21\" width=\"400\" colspan=2>
129 <input name=editpassword >&nbsp;&nbsp;&nbsp;Only if you want to change the current
130 </tr>
131
132 <tr>
133 <td height=\"21\" width=\"200\" bgcolor=#F7F6F4>
134 &nbsp; Nickname
135 <td height=\"21\" width=\"400\" bgcolor=#F7F6F4 colspan=2>
136 <input type=text name=editnickname value=\"$member_db[4]\">
137 </tr>
138
139 <tr>
140 <td height=\"21\" width=\"200\" >
141 &nbsp; Email
142 <td height=\"21\" width=\"400\" colspan=2>
143 <input type=text name=editmail value=\"$member_db[5]\">&nbsp;&nbsp;&nbsp;<input type=checkbox name=edithidemail $ifchecked>&nbsp;Hide my e-mail from visitors
144 </tr>";
145
146 if($member_db[1] != 4){echo"<tr>
147 <td height=\"21\" width=\"200\" bgcolor=#F7F6F4>
148 &nbsp; Default Avatar URL
149 <td height=\"21\" width=\"400\" bgcolor=#F7F6F4 >
150 <input type=text name=change_avatar value=\"$member_db[8]\">&nbsp;&nbsp;&nbsp;&nbsp;will appear on 'Add News' page
151 </tr>"; }else{ $bg = "bgcolor=#F7F6F4"; }
152
153 echo"<tr>
154 <td height=\"21\" width=\"200\" $bg>
155 &nbsp; Access Level
156 <td height=\"21\" width=\"400\" $bg colspan=2>";
157
158 if ($member_db[1] == 4){ echo "commenter"; }
159 elseif ($member_db[1] == 3){ echo "journalist"; }
160 elseif ($member_db[1] == 2){ echo "editor"; }
161 elseif ($member_db[1] == 1){ echo "administrator"; }
162
163 if($member_db[1] != 4){ echo"</tr>
164 <tr>
165 <td height=\"21\" width=\"200\" bgcolor=#F7F6F4>
166 &nbsp; written news
167 <td height=\"21\" width=\"400\" bgcolor=#F7F6F4 colspan=2>
168 $member_db[6]
169 </tr>"; }
170
171 echo"<tr>
172 <td height=\"21\" width=\"200\" >
173 &nbsp; registration date
174 <td height=\"21\" width=\"400\" colspan=2>
175 $registrationdate
176 </tr>
177 <tr>
178 <td height=\"1\" width=\"611\" colspan=\"2\" colspan=3>
179 <br /><input type=submit value=\"Save Changes\" accesskey=\"s\">
180 </tr>
181 <input type=hidden name=mod value=options><input type=hidden name=action value=dosavepersonal>
182 </form>
183 </table>";
184
185 echofooter();
186 }
187 // ********************************************************************************
188 // Save Personal Options
189 // ********************************************************************************
190 elseif($action == "dosavepersonal")
191 {
192
193 if($editpassword != "" and ($oldpassword == "" or !$oldpassword)){
194 msg("info", "Old Password Verification", "<form method=POST action=\"$PHP_SELF\"> You have requested to change your password.<br>In order to complete this action you must enter your old password: <input type=text name=oldpassword> <input type=submit value='Submit'><input type=hidden name=mod value=options><input type=hidden name=action value=dosavepersonal><input type=hidden name=editpassword value='$editpassword'><input type=hidden name=editnickname value='$editnickname'><input type=hidden name=editmail value='$editmail'><input type=hidden name=edithidemail value='$edithidemail'><input type=hidden name=change_avatar value='$change_avatar'></form>");
195 }elseif($editpassword != "" and (md5($oldpassword) != $member_db[3])){
196 msg("error","Error!","You did not enter correctly your old password.");
197 }
198
199
200
201
202 $editnickname = replace_comment("add",$editnickname);
203 $editmail = replace_comment("add",$editmail);
204 $edithidemail = replace_comment("add",$edithidemail);
205 $change_avatar = replace_comment("add",$change_avatar);
206
207 if($editpassword != "" and !preg_match("/^[\.A-z0-9_\-]{1,15}$/i", $editpassword)){ msg("error","Error !!!", "Your password must conatain only valid characters and numbers"); }
208
209 if($edithidemail){ $edithidemail = 1;}else{ $edithidemail = 0; }
210
211 $avatars = preg_replace(array("'\|'","'\n'","' '"), array("","","_"), $avatars);
212
213 $old_user_db = file("./data/users.db.php");
214 $new_user_db = fopen("./data/users.db.php", w);
215 $personal_success = FALSE;
216 foreach($old_user_db as $old_user_db_line){
217 $old_user_db_arr = explode("|", $old_user_db_line);
218 if(strtolower($username) != strtolower($old_user_db_arr[2])){
219 fwrite($new_user_db,"$old_user_db_line");
220 }
221 else{
222 if($editpassword != ""){
223 $old_user_db_arr[3] = md5($editpassword);
224 if($config_use_cookies == TRUE){ setcookie("md5_password", $old_user_db_arr[3]); }
225 $_SESSION['md5_password'] = $old_user_db_arr[3];
226 }
227 fwrite($new_user_db,"$old_user_db_arr[0]|$old_user_db_arr[1]|$old_user_db_arr[2]|$old_user_db_arr[3]|$editnickname|$editmail|$old_user_db_arr[6]|$edithidemail|$change_avatar|$old_user_db_arr[9]||\n");
228 $personal_success = TRUE;
229 }
230 }
231 fclose($new_user_db);
232 if($personal_success){ msg("info", "Changes Saved", "Your personal information was saved.", "$PHP_SELF?mod=options&action=personal"); }
233 else{ msg("error", "Error !!!", "Error while listing users, $username not found", "$PHP_SELF?mod=options&action=personal"); }
234 }
235 // ********************************************************************************
236 // Edit Templates
237 // ********************************************************************************
238 elseif($action == "templates")
239 {
240 if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permissions for this type of action"); }
241 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
242 Detect all template packs we have
243 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
244 $templates_list = array();
245 if(!$handle = opendir("./data")){ die("<center>Can not open directory $cutepath/data "); }
246 while (false !== ($file = readdir($handle))){
247 if(eregi(".tpl", $file)){
248 $file_arr = explode(".", $file);
249 $templates_list[]= $file_arr[0];
250 }
251 }
252 closedir($handle);
253
254 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
255 If we want to create new template
256 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
257 if($subaction == "new"){
258 echoheader("options", "New Template");
259
260 echo"<form method=post action=\"$PHP_SELF\"><table border=0 cellpading=0 cellspacing=0 width=100% height=100%><tr><td >Create new template based on: <select name=base_template>";
261 foreach($templates_list as $single_template){
262 echo "<option value=\"$single_template\">$single_template</option>";
263 }
264 echo '</select> with name <input type=text name=template_name> &nbsp;<input type=submit value="Create Template">
265 <input type=hidden name=mod value=options>
266 <input type=hidden name=action value=templates>
267 <input type=hidden name=subaction value=donew>
268 </td></tr></table></form>';
269 echofooter();
270 exit;
271 }
272 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
273 Do Create the new template
274 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
275 if($subaction == "donew"){
276 if(!eregi("^[a-z0-9_-]+$", $template_name)){ msg("error", "Error", "The name of the template must be only with letters and numbers", "$PHP_SELF?mod=options&subaction=new&action=templates"); }
277 if(file_exists("./data/${template_name}.tpl")){ msg("error", "Error", "Template with this name already exists", "$PHP_SELF?mod=options&subaction=new&action=templates"); }
278
279 if($base_template != ""){ $base_file = "./data/${base_template}.tpl"; }
280 else{ $base_file = "./data/Default.tpl"; }
281
282 if (!copy($base_file, "./data/${template_name}.tpl")) {
283 msg("error", "Error", "Can not copy file $base_file to ./data/ folder with name ${template_name}.tpl");
284 }
285 @chmod("./data/${template_name}.tpl", 0777);
286
287 msg("info", "Template Created", "A new template was created with name <b>${template_name}</b><br>", "$PHP_SELF?mod=options&action=templates");
288 }
289 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
290 Deleting template, preparation
291 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
292 if($subaction == "delete"){
293 if(strtolower($do_template) == "default"){ msg("Error", "Error !!!", "You can not delete the default template", "$PHP_SELF?mod=options&action=templates"); }
294 if(strtolower($do_template) == "rss"){ msg("Error", "Error !!!", "You can not delete the RSS template, it is not even supposed you to edit it.", "$PHP_SELF?mod=options&action=templates"); }
295 $msg = "<form method=post action=\"$PHP_SELF\">Are you sure you want to delete the template <b>$do_template</b> ?<br><br>
296 <input type=submit value=\" Yes, Delete This Template\"> &nbsp;<input onClick=\"document.location='$PHP_SELF?mod=options&action=templates';\" type=button value=\"Cancel\">
297 <input type=hidden name=mod value=options>
298 <input type=hidden name=action value=templates>
299 <input type=hidden name=subaction value=dodelete>
300 <input type=hidden name=do_template value=\"$do_template\">
301 </form>";
302
303 msg("info", "Deleting Template", $msg);
304 }
305 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
306 DO Deleting template
307 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
308 if($subaction == "dodelete"){
309 if(strtolower($do_template) == "default"){ msg("Error", "Error !!!", "You can not delete the default template", "$PHP_SELF?mod=options&action=templates"); }
310 $unlink = unlink("./data/${do_template}.tpl");
311 if(!$unlink){ msg("error", "Error", "Can not delete file ./data/${do_template}.tpl <br>maybe the is no permission from the server"); }
312 else{ msg("info", "Template Deleted", "The template <b>${do_template}</b> was deleted.", "$PHP_SELF?mod=options&action=templates"); }
313 }
314
315
316 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
317 Show The Template Manager
318 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
319 if($do_template == '' or !$do_template){
320 $do_template = 'Default';
321 $show_delete_link = '';
322 }elseif(strtolower($do_template) != 'default'){
323 $show_delete_link = "<a href=\"$PHP_SELF?action=templates&mod=options&subaction=delete&do_template=$do_template\">[delete this template]</a>";
324 }
325 require("./data/${do_template}.tpl");
326
327
328
329 if(eregi("opera", $HTTP_USER_AGENT)){ $tr_hidden = ""; }
330 else{ $tr_hidden = " style='display:none'"; }
331
332
333 $templates_names = array("template_active", "template_comment", "template_form", "template_full", "template_prev_next", "template_comments_prev_next");
334 foreach($templates_names as $template)
335 {
336 $$template = preg_replace("/</","&lt;",$$template);
337 $$template = preg_replace("/>/","&gt;",$$template);
338 }
339 echoheader("options","Templates");
340
341 echo'<table border=0 cellpading=0 cellspacing=0 height="77" >
342 <tr>
343 <td width=373 height="75">
344 <b>Manage Templates</b>
345
346
347 <table border=0 cellpading=0 cellspacing=0 width=347 class="panel" height="50" >
348 <form method=get action="'.$PHP_SELF.'">
349 <tr>
350 <td width=126height="23">
351 &nbsp;Editing Template
352 <td width=225height="23">
353 :&nbsp; <b>'.$do_template.'</b>
354 </tr>
355 <tr>
356 <td width=126 height="27">
357 &nbsp;Switch to Template
358 <td width=225 height="27">
359 :&nbsp; <select size=1 name=do_template>';
360
361 foreach($templates_list as $single_template){
362 if($single_template == $do_template){ echo"<option selected value=\"$single_template\">$single_template</option>"; }
363 else{ echo"<option value=\"$single_template\">$single_template</option>"; }
364 }
365
366 echo'</select>
367 <input type=submit value=Go>
368 </tr>
369 <tr>
370 <td width=351 height="25" colspan="2">
371 &nbsp;<a href="'.$PHP_SELF.'?mod=options&subaction=new&action=templates">[create new template]</a>&nbsp;
372 '.$show_delete_link.'</tr>
373 <input type=hidden name=action value=templates><input type=hidden name=mod value=options>
374 </form>
375 </table>
376
377 <td width=268 height="75" align="center">
378 <!-- HELP -->
379 <table cellspacing="0" cellpadding="0">
380 <tr>
381 <td width="25" align=middle><img border="0" src="skins/images/help_small.gif"></td>
382 <td >&nbsp;<a onClick="javascript:Help(\'templates\')" href="#">Understanding Templates</a></td>
383 </tr>
384 </table>
385 <!-- END HELP -->
386
387 </tr>
388 </table>
389 <img height=20 border=0 src="skins/images/blank.gif" width=1>
390 <br>
391 <b>Edit Template Parts</b><table width="100%"><form method=post action="'.$PHP_SELF.'">
392
393 <tr> <!- start active news -->
394 <td height="7" bgcolor=#F7F6F4 colspan="2">
395 <b><a style="font-size:16px" href="javascript:ShowOrHide(\'active-news1\',\'active-news2\')" >Active News</a></b>
396 </tr>
397 <tr id=\'active-news1\' '.$tr_hidden.'>
398 <td height="9" width="200" valign="top">
399 <b>{title}<br />
400 {avatar}<br />
401 {short-story}<br />
402 {full-story}<br />
403 {author}<br />
404 {author-name}<br />
405 [mail] </b>and<b> [/mail]<br />
406 {date}<br />
407 [link] </b>and<b> [/link]<br />
408 [full-link] </b>and<b> [/full-link]<br />
409 [com-link] </b>and<b> [/com-link]<br />
410 {comments-num}<br />
411 {category}<br />
412 {category-icon}
413 <td height="9" valign="top" width=430>
414 - Title of the article<br />
415 - Show Avatar image (if any)<br />
416 - Short story of news item<br />
417 - The full story<br />
418 - Author of the article, with link to his email (if any)<br />
419 - The name of the author, without email<br />
420 - Will generate a link to the author mail (if any) eg. [mail]Email[/mail]<br />
421 - Date when the story is written<br />
422 - Will generate a permanent link to the full story<br />
423 - Link to the full story of article, only if there is full story<br />
424 - Generate link to the comments of article<br />
425 - This will display the number of comments posted for article<br />
426 - Name of the category where article is posted (if any)<br />
427 - Shows the category icon (if any)<br />
428 </tr>
429 <tr id=\'active-news2\' '.$tr_hidden.'>
430 <td height="8" colspan="2">
431 <textarea rows="9" cols="98" name="edit_active">'.$template_active.'</textarea>
432 <br />
433 &nbsp;
434 </tr> <!-- End active news -->
435
436 <tr> <!-- Start full story -->
437 <td height="7" bgcolor=#F7F6F4 colspan="2">
438 <b><a style="font-size:16px" href="javascript:ShowOrHide(\'full-story1\',\'full-story2\')" >Full Story</a></b>
439 </tr>
440 <tr id=\'full-story1\' '.$tr_hidden.'>
441 <td height="9" width="200" valign="top">
442 <b> {title}<br />
443 {avatar}<br />
444 {full-story}<br />
445 {short-story}</b><b><br />
446 {author}<br />
447 {author-name}<br />
448 [mail] </b>and<b> [/mail]<br />
449 {date}<br />
450 {comments-num}<br />
451 {category} <br />
452 {category-icon} </b>
453 <td height="9" valign="top">
454 - Title of the article<br />
455 - Show Avatar image (if any)<br />
456 - The full story<br />
457 - Short story of news item<br />
458 - Author of the article, with link to his email (if any)<br />
459 - The name of the author, without email<br />
460 - Will generate a link to the author mail (if any) eg. [mail]Email[/mail]<br />
461 - Date when the story is written<br />
462 - This will display the number of comments posted for article<br />
463 - Name of the category where article is posted (if any)<br />
464 - Shows the category icon (if any)<br />
465 </tr>
466 <tr id=\'full-story2\' '.$tr_hidden.'>
467 <td height="8" colspan="2">
468 <textarea rows="9" cols="98" name="edit_full">'.$template_full.'</textarea>
469 <br />
470 &nbsp;
471 </tr> <!-- End full story -->
472
473 <tr> <!-- Start comment -->
474 <td height="7" bgcolor=#F7F6F4 colspan="2">
475 <b><a style="font-size:16px" href="javascript:ShowOrHide(\'comment1\',\'comment2\')" >Comment</a></b>
476 </tr>
477 <tr id=\'comment1\' '.$tr_hidden.'>
478 <td height="9" width="200" valign="top">
479 <b> {author}<br />
480 {mail}<br />
481 {date}<br />
482 {comment}<br />
483 {comment-iteration}</b>
484 <td height="9" valign="top">
485 - Name of the comment poster<br />
486 - E-mail of the poster<br />
487 - Date when the comment was posted<br />
488 - The Comment<br />
489 - Show the sequential number of individual comment
490 </tr>
491 <tr id=\'comment2\' '.$tr_hidden.'>
492 <td height="8" colspan="2">
493 <textarea rows="9" cols="98" name="edit_comment">'.$template_comment.'</textarea>
494 <br />
495 &nbsp;
496 </tr> <!-- End comment -->
497
498 <tr> <!-- Start add comment form -->
499 <td height="7" bgcolor=#F7F6F4 colspan="2">
500 <b><a style="font-size:16px" href="javascript:ShowOrHide(\'add-comment-form1\',\'add-comment-form2\')" >Add comment form</a></b>
501 </tr>
502 <tr id=\'add-comment-form1\' '.$tr_hidden.'>
503 <td height="9" width="1094" valign="top" colspan="2">
504 Please do not edit this unless you have basic HTML knowledge !!!
505 </tr>
506 <tr id=\'add-comment-form2\' '.$tr_hidden.'>
507 <td height="8" colspan="2">
508 <textarea rows="9" cols="98" name="edit_form">'.$template_form.'</textarea>
509 <br />
510 &nbsp;
511 </tr> <!-- End add comment form -->
512
513 <tr> <!-- Start previous & next -->
514 <td height="7" bgcolor=#F7F6F4 colspan="2">
515 <b><a style="font-size:16px" href="javascript:ShowOrHide(\'previous-next1\',\'previous-next2\')" >News Pagination</a></b>
516 </tr>
517 <tr id=\'previous-next1\' '.$tr_hidden.'>
518 <td height="9" width="200" valign="top">
519 <b> [prev-link] </b>and<b> [/prev-link]<br />
520 [next-link] </b>and<b> [/next-link]<br />
521 {pages}<br />
522 <td height="9" valign="top">
523 - Will generate a link to preveous page (if there is)<br />
524 - Will generate a link to next page (if there is)<br />
525 - Shows linked numbers of the pages; example: <a href=\'#\'>1</a> <a href=\'#\'>2</a> <a href=\'#\'>3</a> <a href=\'#\'>4</a>
526 </tr>
527
528 <tr id=\'previous-next2\' '.$tr_hidden.'>
529 <td height="8" colspan="2">
530 <textarea rows="3" cols="98" name="edit_prev_next">'.$template_prev_next.'</textarea>
531 </tr> <!-- End previous & next -->
532
533
534
535 <tr> <!-- Start previous & next COMMENTS-->
536 <td height="7" bgcolor=#F7F6F4 colspan="2">
537 <b><a style="font-size:16px" href="javascript:ShowOrHide(\'previous-next21\',\'previous-next22\')" >Comments Pagination</a></b>
538 </tr>
539 <tr id=\'previous-next21\' '.$tr_hidden.'>
540 <td height="9" width="200" valign="top">
541 <b> [prev-link] </b>and<b> [/prev-link]<br />
542 [next-link] </b>and<b> [/next-link]<br />
543 {pages}<br />
544 <td height="9" valign="top">
545 - Will generate a link to preveous page (if there is)<br />
546 - Will generate a link to next page (if there is)<br />
547 - Shows linked numbers of the pages; example: <a href=\'#\'>1</a> <a href=\'#\'>2</a> <a href=\'#\'>3</a> <a href=\'#\'>4</a>
548 </tr>
549
550 <tr id=\'previous-next22\' '.$tr_hidden.'>
551 <td height="8" colspan="2">
552 <textarea rows="3" cols="98" name="edit_comments_prev_next">'.$template_comments_prev_next.'</textarea>
553 </tr> <!-- End previous & next COMMENTS -->
554
555
556 <tr>
557 <td height="8" colspan="2">
558 <input type=hidden name=mod value=options>
559 <input type=hidden name=action value=dosavetemplates>
560 <input type=hidden name=do_template value="'.$do_template.'">
561 <br /><input type=submit value=" Save Changes " accesskey="s">
562 </tr></form>
563 </table>';
564
565 echofooter();
566 }
567 // ********************************************************************************
568 // Do Save Changes to Templates
569 // ********************************************************************************
570 elseif($action == "dosavetemplates")
571 {
572 if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permissions for this type of action"); }
573 $templates_names = array("edit_active", "edit_comment", "edit_form", "edit_full", "edit_prev_next", "edit_comments_prev_next");
574 foreach($templates_names as $template)
575 {
576 $$template = stripslashes($$template);
577 }
578
579 if($do_template == "" or !$do_template){ $do_template = "Default"; }
580 $template_file = "./data/${do_template}.tpl";
581
582 if($do_template == "rss"){ $edit_active = str_replace("&", "&amp;",$edit_active); }
583
584 $handle = fopen("$template_file","w");
585 fwrite($handle, "<?PHP\n///////////////////// TEMPLATE $do_template /////////////////////\n");
586 fwrite($handle, "\$template_active = <<<HTML\n$edit_active\nHTML;\n\n\n");
587 fwrite($handle, "\$template_full = <<<HTML\n$edit_full\nHTML;\n\n\n");
588 fwrite($handle, "\$template_comment = <<<HTML\n$edit_comment\nHTML;\n\n\n");
589 fwrite($handle, "\$template_form = <<<HTML\n$edit_form\nHTML;\n\n\n");
590 fwrite($handle, "\$template_prev_next = <<<HTML\n$edit_prev_next\nHTML;\n");
591 fwrite($handle, "\$template_comments_prev_next = <<<HTML\n$edit_comments_prev_next\nHTML;\n");
592 fwrite($handle, "?>\n");
593
594 msg("info","Changes Saved","The changes to template <b>$do_template</b> were successfully saved.","$PHP_SELF?mod=options&action=templates&do_template=$do_template");
595 }
596
597 // ********************************************************************************
598 // System Configuration
599 // ********************************************************************************
600 elseif($action == "syscon")
601 {
602 if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permissions to access this section"); }
603 echoheader("options", "System Configuration");
604
605 function showRow($title="", $description="", $field="")
606 {
607 global $i;
608 if( $i%2 == 0 and $title != ""){ $bg = "bgcolor=#F7F6F4"; }
609 echo"<tr $bg >
610 <td colspan=\"2\" style=\"padding:4\">
611 &nbsp;<b>$title</b>
612 <td width=294 rowspan=\"2\" valign=\"middle\" align=middle>
613 $field<br />&nbsp;
614 </tr>
615 <tr $bg >
616 <td height=15 width=\"27\" style=\"padding:4\">
617 &nbsp;
618 <td height=15 width=\"299\" valign=top>
619 <font color=\"#808080\">$description</font>
620 </tr>";
621 $bg = ""; $i++;
622 }
623 function makeDropDown($options, $name, $selected)
624 {
625 $output = "<select size=1 name=\"$name\">\r\n";
626 foreach($options as $value=>$description)
627 {
628 $output .= "<option value=\"$value\"";
629 if($selected == $value){ $output .= " selected "; }
630 $output .= ">$description</option>\n";
631 }
632 $output .= "</select>";
633 return $output;
634 }
635
636
637 echo"<table border=0 cellpading=0 cellspacing=0 width=654 ><form action=\"$PHP_SELF\" method=post>";
638
639 echo <<<HTML
640 <script language='JavaScript' type="text/javascript">
641
642 function ChangeOption(selectedButton, selectedOption) {
643
644 document.getElementById('general').style.display = "none";
645 document.getElementById('news').style.display = "none";
646 document.getElementById('comments').style.display = "none";
647 document.getElementById('notifications').style.display = "none";
648
649 document.getElementById('button1').style.backgroundColor = "";
650 document.getElementById('button2').style.backgroundColor = "";
651 document.getElementById('button3').style.backgroundColor = "";
652 document.getElementById('button4').style.backgroundColor = "";
653
654 if(selectedOption == 'general') {document.getElementById('general').style.display = "";}
655 if(selectedOption == 'news') {document.getElementById('news').style.display = "";}
656 if(selectedOption == 'comments') {document.getElementById('comments').style.display = "";}
657 if(selectedOption == 'notifications') {document.getElementById('notifications').style.display = "";}
658
659 document.getElementById(selectedButton).style.backgroundColor = "#EBE8E2";
660
661
662 }
663
664 </script>
665
666 <tr style="position:relative" valign=top>
667 <td style="padding-bottom:30px;" colspan="3" >
668 <table style="text-align:center; padding:0px; margin:0px;" width="100%" height=35px cellpadding="0" cellspacing="0">
669 <tr style="border:1px solid black; vertical-align:middle;" >
670 <td id=button1 style="background-color:#EBE8E2; border:1px solid black; -moz-border-radius: .7em .7em .0em .0em" width="25%"><a style="display:block; font-size:150%; font-weight:bold; height:100%; padding-top:10px;" href="javascript:ChangeOption('button1','general');">General</a>
671 <td id=button2 style="border:1px solid black; -moz-border-radius: .7em .7em .0em .0em" width="25%"><a style="display:block; font-size:150%; font-weight:bold; height:100%; padding-top:10px;" href="javascript:ChangeOption('button2','news');">News</a>
672 <td id=button3 style="border:1px solid black; -moz-border-radius: .7em .7em .0em .0em" width="25%"><a style="display:block; font-size:150%; font-weight:bold; height:100%; padding-top:10px;" href="javascript:ChangeOption('button3','comments');">Comments</a>
673 <td id=button4 style="border:1px solid black; -moz-border-radius: .7em .7em .0em .0em" width="25%"><a style="display:block; font-size:150%; font-weight:bold; height:100%; padding-top:10px;" href="javascript:ChangeOption('button4','notifications');">Notifications</a>
674 </tr>
675 </table>
676 </tr>
677 HTML;
678
679
680 if(!$handle = opendir("./skins")){ die("Can not open directory ./skins "); }
681 while (false !== ($file = readdir($handle))) {
682 $file_arr = explode(".",$file);
683 if($file_arr[1] == "skin"){
684 $sys_con_skins_arr[$file_arr[0]] = $file_arr[0];
685 }elseif($file_arr[1] == "lang"){
686 $sys_con_langs_arr[$file_arr[0]] = $file_arr[0];
687 }
688 }
689 closedir($handle);
690
691 // General
692 echo"<tr style='' id=general width=100%><td colspan=10 width=100%><table cellpading=0 cellspacing=0 colspan=10 width=100%>";
693 showRow("Full URL to CuteNews Directory", "example: http://yoursite.com/cutenews", "<input type=text style=\"text-align: center;\" name='save_con[http_script_dir]' value='$config_http_script_dir' size=40>");
694 showRow("CuteNews Skin", "you can download more from our website", makeDropDown($sys_con_skins_arr, "save_con[skin]", "$config_skin"));
695 showRow("Time Adjustment", "in minutes; eg. : <b>180</b>=+3 hours; <b>-120</b>=-2 hours", "<input type=text style=\"text-align: center;\" name='save_con[date_adjust]' value=\"$config_date_adjust\" size=10>");
696 showRow("Smilies", "Separate them with commas (<b>,</b>)", "<input type=text style=\"text-align: center;\" name='save_con[smilies]' value=\"$config_smilies\" size=40>");
697 showRow("Auto-Archive every Month", "if yes, evrery month the active news will be archived", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[auto_archive]", "$config_auto_archive"));
698 showRow("Allow Self-Registration", "allow users to auto-register", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[allow_registration]", "$config_allow_registration"));
699 showRow("Self-Registration Level", "with what access level are users auto-registerd ?", makeDropDown(array("3"=>"Journalist","4"=>"Commenter"), "save_con[registration_level]", "$config_registration_level"));
700 echo"</table></td></tr>";
701
702 // News
703 echo"<tr style='display:none' id=news width=100%><td colspan=10 width=100%><table cellpading=0 cellspacing=0 colspan=10 width=100%>";
704 showRow("Use Avatars", "if not, the avatar URL field wont be shown", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[use_avatar]", "$config_use_avatar"));
705 showRow("Use WYSIWYG Editor","use (or not) the advanced editor", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[use_wysiwyg]", "$config_use_wysiwyg"));
706 showRow("Reverse News", "if yes, older news will be shown on the top", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[reverse_active]", "$config_reverse_active"));
707 showRow("Time Format For News", "view help for time formatting <a href=\"http://www.php.net/manual/en/function.date.php\" target=\"_blank\">here</a>", "<input type=text style=\"text-align: center;\" name='save_con[timestamp_active]' value='$config_timestamp_active' size=40>");
708 showRow("Show Full Story In PopUp", "full Story will be opened in PopUp window", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[full_popup]", "$config_full_popup"));
709 showRow("Settings for Full Story PopUp", "only if 'Show Full Story In PopUp' is enabled", "<input type=text style=\"text-align: center;\" name='save_con[full_popup_string]' value=\"$config_full_popup_string\" size=40>");
710 showRow("Show Comments When Showing Full Story", "if yes, comments will be shown under the story", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[show_comments_with_full]", "$config_show_comments_with_full"));
711 echo"</table></td></tr>";
712
713 // Comments
714 echo"<tr style='display:none' id=comments width=100%><td colspan=10 width=100%><table cellpading=0 cellspacing=0 colspan=10 width=100%>";
715 showRow("Auto Wrap Comments", "any word that is longer than this will be wrapped", "<input type=text style=\"text-align: center;\" name='save_con[auto_wrap]' value=\"$config_auto_wrap\" size=10>");
716 showRow("Reverse Comments", "if yes, newest comments will be shown on the top", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[reverse_comments]", "$config_reverse_comments"));
717 showRow("Comments Flood Protection", "in seconds; 0 = no protection", "<input type=text style=\"text-align: center;\" name='save_con[flood_time]' value=\"$config_flood_time\" size=10>");
718 showRow("Max. Length of Comments in Characters", "enter <b>0</b> to disable checking", "<input type=text style=\"text-align: center;\" name='save_con[comment_max_long]' value='$config_comment_max_long' size=10>");
719 showRow("Comments Per Page (Pagination)", "enter <b>0</b> or leave empty to disable pagination", "<input type=text style=\"text-align: center;\" name='save_con[comments_per_page]' value='$config_comments_per_page' size=10>");
720 showRow("Only Registered Users Can Post Comments", "if yes, only registered users can post comments", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[only_registered_comment]", "$config_only_registered_comment"));
721 showRow("Allow Mail Field to Act and as URL Field", "visitors will be able to put their site URL insted of mail", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[allow_url_instead_mail]", "$config_allow_url_instead_mail"));
722 showRow("Time Format For Comments", "view help for time formatting <a href=\"http://www.php.net/manual/en/function.date.php\" target=\"_blank\">here</a>", "<input type=text style=\"text-align: center;\" name='save_con[timestamp_comment]' value='$config_timestamp_comment' size=40>");
723 showRow("Show Comments In PopUp", "comments will be opened in PopUp window", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[comments_popup]", "$config_comments_popup"));
724 showRow("Settings for Comments PopUp", "only if 'Show Comments In PopUp' is enabled", "<input type=text style=\"text-align: center;\" name=\"save_con[comments_popup_string]\" value=\"$config_comments_popup_string\" size=40>");
725 showRow("Show Full Story When Showing Comments", "if yes, comments will be shown under the story", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[show_full_with_comments]", "$config_show_full_with_comments"));
726 echo"</table></td></tr>";
727
728 // Notifications
729 echo"<tr style='display:none' id=notifications width=100%><td colspan=10 width=100%><table cellpading=0 cellspacing=0 colspan=10 width=100%>";
730 showRow("Email(s)", "Where the notification will be send, separate multyple emails by comma", "<input type=text style=\"text-align: center;\" name='save_con[notify_email]' value=\"$config_notify_email\" size=40>");
731 showRow("Notifications - Active/Disabled", "global status of notifications", makeDropDown(array("active"=>"Active","disabled"=>"Disabled"), "save_con[notify_status]", "$config_notify_status"));
732 showRow("Notify of New Registrations", "when new user auto-registers", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_registration]", "$config_notify_registration"));
733 showRow("Notify of New Comments", "when new comment is added", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_comment]", "$config_notify_comment"));
734 showRow("Notify of Unapproved News", "when unapproved article is posted (by journalists)", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_unapproved]", "$config_notify_unapproved"));
735 showRow("Notify of Auto-Archiving", "when (if) news are auto-archived", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_archive]", "$config_notify_archive"));
736 showRow("Notify of Activated Postponed Articles", "when postponed article is activated", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[notify_postponed]", "$config_notify_postponed"));
737 echo"</table></td></tr>";
738
739
740
741 echo"
742 <input type=hidden name=mod value=options>
743 <input type=hidden name=action value=dosavesyscon>".
744 showRow("","","<br /><input style='font-weight:bold;font-size:120%;' type=submit value=\" Save Changes \" accesskey=\"s\">")."
745 </form></table>";
746 echofooter();
747 }
748 // ********************************************************************************
749 // Save System Configuration
750 // ********************************************************************************
751 elseif($action == "dosavesyscon")
752 {
753 if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permission for this section"); }
754 $handler = fopen("./data/config.php", "w");
755 fwrite($handler, "<?PHP \n\n//System Configurations (Auto Generated file)\n\n");
756 foreach($save_con as $name=>$value)
757 {
758 fwrite($handler, "\$config_$name = \"".htmlspecialchars($value)."\";\n\n");
759 }
760 fwrite($handler, "?>");
761 fclose($handler);
762
763 include("./skins/".$save_con["skin"].".skin.php");
764 msg("info", "Configurations Saved", "The System Configurations were successfully saved.");
765 }
766
767 ?>