-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin.php
798 lines (684 loc) · 25.2 KB
/
admin.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
<?PHP
include "functions.inc";
include "authentication.inc";
function login() {
include "theme.inc";
$theme->header();
$theme->box("Login", "<FORM ACTION=\"admin.php\" METHOD=\"post\"><P>Name: <INPUT TYPE=\"text\" NAME=\"aid\" SIZE=\"20\" MAXLENGTH=\"20\"><P>Password: <INPUT TYPE=\"password\" NAME=\"pwd\" SIZE=\"20\" MAXLENGTH=\"18\"><P><INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"login\"></FORM>");
$theme->footer();
}
function logout() {
setcookie("admin");
include "theme.inc";
$theme->header();
?>
<BR><BR><BR><BR>
<P ALIGN="center"><FONT SIZE="+2"><B>You are now logged out!</B></FONT></P>
<P>You have been logged out of the system. Since authentication details are stored by using cookies, logging out is only necessary to prevent those who have access to your computer from abusing your account.</P>
<?
$theme->footer();
}
function backup() {
include "config.inc";
if ($system == 0) {
exec("mysqldump -h $dbhost -u $dbuname -p$dbpass $dbname | mail -s \"[$sitename] MySQL backup\" $notify_email");
exec("mysqldump -h $dbhost -u $dbuname -p$dbpass $dbname > ../$sitename-backup-". date("Ymd", time()).".mysql");
}
else print "<P><B>Warning:</B> the backup feature is only supported on UNIX systems. Check your configuration file if you are using a UNIX system.</P>";
}
function main() {
include "config.inc";
include "theme.inc";
$theme->header();
dbconnect();
$result = mysql_query("SELECT qid, subject, timestamp FROM queue order by timestamp");
echo "<FORM ACTION=\"admin.php\" METHOD=\"post\">";
echo "<TABLE WIDTH=\"100%\">";
if (mysql_num_rows($result) != 0) {
while (list($qid, $subject, $timestamp) = mysql_fetch_row($result)) {
### format date:
$datetime = date("F d - h:i:s A", $timestamp);
### generate overview:
echo " <TR>";
echo " <TD BGCOLOR=\"#c0c0c0\" WIDTH=\"11\" ALIGN=\"middle\"><INPUT TYPE=\"radio\" NAME=\"qid\" VALUE=\"$qid\"></TD>";
echo " <TD BGCOLOR=\"#c0c0c0\"><A HREF=\"admin.php?op=submission&qid=$qid\">$subject</A></TD>";
echo " <TD BGCOLOR=\"#c0c0c0\">$datetime</TD>";
echo " </TR>";
$dummy++;
}
}
if ($dummy < 1) {
echo " <TR><TD ALIGN=\"center\" BGCOLOR=\"#c0c0c0\" COLSPAN=\"3\">There are currently <B>no</B> new submissions available.</TD></TR>";
}
else {
echo " <TR><TD COLSPAN=\"3\"><INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Delete article\"> <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"View article\"></TD></TR>";
}
echo " <TR><TD COLSPAN=\"3\">Article ID: <INPUT TYPE=\"text\" NAME=\"sid\" SIZE=\"5\"> <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Edit article\"></TD></TR>";
echo " <TR><TD COLSPAN=\"3\"><A HREF=\"admin.php?op=news_admin_write\">Write and post an article as administrator.</A></TD></TR>";
echo "</TABLE></FORM>";
mysql_free_result($result);
?>
<HR>
<LI><A HREF="admin.php?op=blocks">Edit global blocks on main page.</A></LI><BR>
<I>Allows you to update the content blocks on the main page.</I>
<HR>
<LI><A HREF="admin.php?op=user_overview">Edit user accounts.</A></LI><BR>
<I>Add, delete, block, view and update user accounts.</I>
<HR>
<LI><A HREF="admin.php?op=mod_authors">Edit adminstrators accounts.</A></LI><BR>
<HR>
<LI><A HREF="admin.php?op=backup">Backup MySQL tables.</A></LI><BR>
<I>Will mail a backup of the MySQL database to '<? echo $notify_email; ?>'.</I>
<HR>
<LI><A HREF="webboard.php?section=webboard">Webboard manager.</A></LI><BR>
<I>Allows you to delete flamebait post or threads from the webboard.</I>
<HR>
<LI><A HREF="poll.php?section=poll">Poll manager.</A></LI><BR>
<I>Install, delete or update polls.</I>
<HR>
<LI><A HREF="refer.php?section=refer">Referring site manager.</A></LI><BR>
<I>Edit, block or delete sites that participate with the referring site program.</I>
<HR>
<LI><A HREF="">Resource manager.</A> (not implemented yet)</LI><BR>
<I>Allows admins to maintain a list of resources, news sites and other interesting start points to start their search for news.</I>
<HR>
<LI><A HREF="admin.php?op=logout">Logout</A></LI>
<?PHP
$theme->footer();
}
/*********************************************************/
/* block functions */
/*********************************************************/
function block_overview() {
include "theme.inc";
$theme->header();
dbconnect();
$result = mysql_query("SELECT id, title, content FROM blocks");
if (mysql_num_rows($result) > 0) {
while(list($id, $title, $content) = mysql_fetch_array($result)) {
echo "<FORM ACTION=\"admin.php\" METHOD=\"post\">";
echo " <B>Title:</B><BR>";
echo " <INPUT TYPE=\"text\" NAME=\"title\" SIZE=\"60\" MAXLENGTH=\"60\" VALUE=\"$title\">";
echo " <BR><BR>";
echo " <B>Content:</B><BR>";
echo " <TEXTAREA WRAP=\"virtual\" COLS=\"60\" ROWS=\"8\" NAME=\"content\">$content</TEXTAREA>";
echo " <BR><BR>";
echo " <INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$id\">";
echo " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Update block\"> <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Delete block\">";
echo "</FORM>";
}
}
?>
<HR>
<FORM ACTION="admin.php" METHOD="post">
<B>Title:</B><BR>
<INPUT TYPE="text" NAME="title" SIZE="60" MAXLENGTH="60">
<BR><BR>
<B>Content:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="8" NAME="content"></TEXTAREA>
<BR><BR>
<INPUT TYPE="submit" NAME="op" VALUE="Add new block">
</FORM>
<?php
$theme->footer();
}
function block_add($title, $content) {
dbconnect();
mysql_query("INSERT INTO blocks VALUES (NULL,'$aid','$title','$content')");
header("Location: admin.php?op=main");
}
function block_update($id, $title, $content) {
dbconnect();
mysql_query("update blocks set title='$title', content='$content' where id=$id");
header("Location: admin.php?op=main");
}
function block_delete($id) {
dbconnect();
mysql_query("DELETE FROM blocks WHERE id = '$id'");
header("Location: admin.php?op=main");
}
/*********************************************************/
/* user account functions */
/*********************************************************/
function user_overview() {
include "theme.inc";
$theme->header();
dbconnect();
$result = mysql_query("SELECT * FROM users");
while ($account = mysql_fetch_object($result)) {
$count++;
print "$count. $account->uname [ <A HREF=\"account.php?op=userinfo&uname=$account->uname\">view</A> | edit | block | delete ]<BR>";
}
$theme->footer();
}
/*********************************************************/
/* article functions */
/*********************************************************/
function news_queue_delete($qid) {
dbconnect();
$result = mysql_query("DELETE FROM queue WHERE qid = $qid");
header("Location: admin.php?op=main");
}
function news_display($qid) {
global $user, $subject, $article;
include "config.inc";
include "header.inc";
dbconnect();
if (isset($qid)) $result = mysql_query("SELECT qid, uid, uname, timestamp, subject, abstract, article, category FROM queue WHERE qid = $qid");
else $result = mysql_query("SELECT qid, uid, uname, timestamp, subject, abstract, article, category FROM queue LIMIT 1");
list($qid, $uid, $uname, $timestamp, $subject, $abstract, $article, $category) = mysql_fetch_row($result);
mysql_free_result($result);
$subject = stripslashes($subject);
$abstract = stripslashes($abstract);
$article = stripslashes($article);
$theme->preview("", $uname, $timestamp, $subject, "", $abstract, "", $article);
?>
<FORM ACTION="admin.php" METHOD="post">
<P>
<B>Author or poster:</B><br>
<INPUT TYPE="text" NAME="author" SIZE="50" VALUE="<?PHP echo "$uname"; ?>">
</P>
<P>
<B>Subject:</B><BR>
<INPUT TYPE="text" NAME="subject" SIZE="50" VALUE="<?PHP echo"$subject"; ?>">
</P>
<P>
<B>Department:</B><BR>
<INPUT TYPE="text" NAME="department" SIZE="50" VALUE=""> dept.<BR>
<I>
<FONT SIZE="2">
Example departments:
<UL>
<LI>we-saw-it-coming dept.</LI>
<LI>don't-get-your-panties-in-a-knot dept.</LI>
<LI>brain-melt dept.</LI>
<LI>beats-the-heck-out-of-me dept.</LI>
</UL>
</FONT>
</I>
</P>
<P>
<B>Category:</B><BR>
<SELECT NAME="category">
<?PHP
for ($i = 0; $i < sizeof($categories); $i++) {
echo "<OPTION VALUE=\"$categories[$i]\" ";
if ($category == $categories[$i]) echo "SELECTED";
echo ">$categories[$i]\n";
}
?>
</SELECT>
</P>
<P>
<B>Author's abstract:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="8" NAME="abstract"><?PHP echo "$abstract"; ?></TEXTAREA><BR>
<FONT SIZE="2"><I>Will be displayed on the main page!</I></FONT>
</P>
<P>
<B>Editor's comments:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="5" NAME="comments"></TEXTAREA><BR>
<FONT SIZE="2"><I>Will be displayed on the main page after the abstract.</I></FONT>
</P>
<P>
<B>Extended article:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="12" NAME="article"><?PHP echo "$article"; ?></TEXTAREA><BR>
<FONT SIZE="2">Will be displayed on the article's page when following the 'read more'-link.</FONT></I>
</P>
<INPUT TYPE="hidden" NAME="qid" VALUE="<?PHP echo "$qid"; ?>">
<INPUT TYPE="hidden" NAME="uid" VALUE="<?PHP echo "$uid"; ?>">
<INPUT TYPE="submit" NAME="op" VALUE="Delete article">
<INPUT TYPE="submit" NAME="op" VALUE="Preview article">
<INPUT TYPE="submit" NAME="op" VALUE="Post article">
</FORM>
<?PHP
$theme->footer();
}
function news_preview($qid, $uid, $author, $subject, $department, $category, $abstract, $comments, $article) {
global $user, $boxstuff, $aid;
include "config.inc";
include "theme.inc";
$theme->header();
$subject = stripslashes($subject);
$agstract = stripslashes($abstract);
$comments = stripslashes($comments);
$article = stripslashes($article);
$theme->preview($aid, $author, time(), $subject, $department, $abstract, $comments, $article);
$theme->footer();
?>
<FORM ACTION="admin.php" METHOD="post">
<P>
<B>Author or poster:</B><br>
<INPUT TYPE="text" NAME="author" SIZE="50" VALUE="<?PHP echo "$author"; ?>">
</P>
<P>
<B>Subject:</B><BR>
<INPUT TYPE="text" NAME="subject" SIZE="50" VALUE="<?PHP echo"$subject"; ?>">
</P>
<P>
<B>Department:</B><BR>
<INPUT TYPE="text" NAME="department" SIZE="50" VALUE="<?PHP echo"$department"; ?>"> dept.<BR>
<I><FONT SIZE="2">
Example departments:
<UL>
<LI>we-saw-it-coming dept.</LI>
<LI>don't-get-your-panties-in-a-knot dept.</LI>
<LI>brain-melt dept.</LI>
<LI>beats-the-heck-out-of-me dept.</LI>
</UL>
</FONT></I>
</P>
<P>
<B>Category:</B><BR>
<SELECT NAME="category">
<?PHP
for ($i = 0; $i < sizeof($categories); $i++) {
echo "<OPTION VALUE=\"$categories[$i]\" ";
if ($category == $categories[$i]) echo "SELECTED";
echo ">$categories[$i]\n";
}
?>
</SELECT>
</P>
<P>
<B>Author's abstract:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="8" NAME="abstract"><?PHP echo "$abstract"; ?></TEXTAREA><BR>
<FONT SIZE="2"><I>Will be displayed on the main page!</I></FONT>
</P>
<P>
<B>Editor's comments:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="5" NAME="comments"><? echo "$comments"; ?></TEXTAREA><BR>
<FONT SIZE="2"><I>Will be displayed on the main page after the abstract.</I></FONT>
</P>
<P>
<B>Extended article:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="12" NAME="article"><? echo "$article"; ?></TEXTAREA><BR>
<I><FONT SIZE="2">Will be displayed on the article's page when following the 'read more'-link.</FONT></I>
</P>
<INPUT TYPE="hidden" NAME="qid" VALUE="<?PHP echo "$qid"; ?>">
<INPUT TYPE="hidden" NAME="uid" VALUE="<?PHP echo "$uid"; ?>">
<INPUT TYPE="submit" NAME="op" VALUE="Delete article">
<INPUT TYPE="submit" NAME="op" VALUE="Preview article">
<INPUT TYPE="submit" NAME="op" VALUE="Post article">
</FORM>
<?PHP
$theme->footer();
}
function news_post($qid, $uid, $author, $subject, $department, $category, $abstract, $comments, $article) {
global $aid;
dbconnect();
if ($uid == -1) $author = "";
$subject = stripslashes(FixQuotes($subject));
$abstract = stripslashes(FixQuotes($abstract));
$comments = stripslashes(FixQuotes($comments));
$article = stripslashes(FixQuotes($article));
$result = mysql_query("INSERT INTO stories (sid, aid, subject, time, abstract, comments, article, category, informant, department) VALUES (NULL, '$aid', '$subject', '". time() ."', '$abstract', '$comments', '$article', '$category', '$author', '$department')");
### remove article from queue:
news_queue_delete($qid);
}
function news_edit($sid) {
global $user, $subject, $abstract, $comments, $article;
include "theme.inc";
include "config.inc";
$theme->header();
dbconnect();
$result = mysql_query("SELECT * FROM stories where sid = $sid");
$article = mysql_fetch_object($result);
mysql_free_result($result);
$theme->preview($article->author, $article->informant, $article->time, $article->subject, $article->department, $article->abstract, $article->comments, $article->article);
?>
<FORM ACTION="admin.php" METHOD="post">
<P>
<B>Author or poster:</B><BR>
<INPUT TYPE="text" NAME="author" SIZE="50" VALUE="<?PHP echo "$article->aid"; ?>">
</P>
<P>
<B>Subject:</B><BR>
<INPUT TYPE="text" NAME="subject" SIZE="50" VALUE="<?PHP echo"$article->subject"; ?>">
</P>
<P>
<B>Department:</B><BR>
<INPUT TYPE="text" NAME="department" SIZE="50" VALUE="<?PHP echo"$article->department"; ?>"> dept.<BR>
<I><FONT SIZE="2">
Example departments:
<UL>
<LI>we-saw-it-coming dept.</LI>
<LI>don't-get-your-panties-in-a-knot dept.</LI>
<LI>brain-melt dept.</LI>
<LI>beats-the-heck-out-of-me dept.</LI>
</UL>
</FONT></I>
</P>
<P>
<B>Category:</B><BR>
<SELECT NAME="category">
<?PHP
for ($i = 0; $i < sizeof($categories); $i++) {
echo "<OPTION VALUE=\"$categories[$i]\" ";
if ($article->category == $categories[$i]) echo "SELECTED";
echo ">$categories[$i]\n";
}
?>
</SELECT>
</P>
<P>
<B>Author's abstract:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="8" NAME="abstract"><?PHP echo "$article->abstract"; ?></TEXTAREA><BR>
<FONT SIZE="2"><I>Will be displayed on the main page!</I></FONT>
</P>
<P>
<B>Editor's comments:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="5" NAME="comments"><? echo "$article->comments"; ?></TEXTAREA><BR>
<FONT SIZE="2"><I>Will be displayed on the main page after the abstract.</I></FONT>
</P>
<P>
<B>Extended article:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="12" NAME="article"><? echo "$article->article"; ?></TEXTAREA><BR>
<I><FONT SIZE="2">Will be displayed on the article's page when following the 'read more'-link.</FONT></I>
</P>
<INPUT TYPE="hidden" NAME="sid" SIZE=60 VALUE="<?PHP echo"$sid"; ?>">
<INPUT TYPE="submit" NAME="op" VALUE="Update article"></FORM>
<?PHP
$theme->footer();
}
function news_update($sid, $subject, $category, $department, $abstract, $comments, $article) {
global $aid;
dbconnect();
$subject = stripslashes(FixQuotes($subject));
$department = stripslashes(FixQuotes($department));
$abstract = stripslashes(FixQuotes($abstract));
$comments = stripslashes(FixQuotes($comments));
$article = stripslashes(FixQuotes($article));
mysql_query("UPDATE stories SET subject = '$subject', category = '$category', department = '$department', abstract = '$abstract', comments = '$comments', article = '$article' WHERE sid = $sid");
header("Location: admin.php?op=main");
}
function news_admin_write() {
include "theme.inc";
include "config.inc";
dbconnect();
$theme->header();
?>
<FORM ACTION="admin.php" METHOD="post">
<P>
<B>Subject:</B><BR>
<INPUT TYPE="text" NAME="subject" SIZE="50" VALUE="">
</P>
<P>
<B>Department:</B><BR>
<INPUT TYPE="text" NAME="department" SIZE="50" VALUE=""> dept.<BR>
<I>
<FONT SIZE="2">
Example departments:
<UL>
<LI>we-saw-it-coming dept.</LI>
<LI>don't-get-your-panties-in-a-knot dept.</LI>
<LI>brain-melt dept.</LI>
<LI>beats-the-heck-out-of-me dept.</LI>
</UL>
</FONT>
</I>
</P>
<P>
<B>Category:</B><BR>
<SELECT NAME="category">
<?PHP
for ($i = 0; $i < sizeof($categories); $i++) {
echo "<OPTION VALUE=\"$categories[$i]\">$categories[$i]\n";
}
?>
</SELECT>
</P>
<P>
<B>Introduction of article:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="7" NAME="abstract"></TEXTAREA><BR>
<FONT SIZE="2"><I>Will be displayed on the main page.</I></FONT>
</P>
<P>
<B>Rest of article:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="8" NAME="article"></TEXTAREA><BR>
<I><FONT SIZE="2">Will be displayed on the article's page when following the 'read more'-link.</FONT></I>
</P>
<INPUT TYPE="submit" NAME="op" VALUE="Preview admin article">
<INPUT TYPE="submit" NAME="op" VALUE="Post admin article">
</FORM>
<?
$theme->footer();
}
function news_admin_preview($subject, $category, $department, $abstract, $article) {
global $aid;
include "theme.inc";
include "config.inc";
$subject = stripslashes($subject);
$intro = stripslashes($intro);
$rest = stripslashes($rest);
$theme->header();
$theme->preview("", $aid, $time, $subject, "", $abstract, "", $article);
?>
<FORM ACTION="admin.php" METHOD="post">
<P>
<B>Subject:</B><BR>
<INPUT TYPE="text" NAME="subject" SIZE="50" VALUE="<? echo "$subject"; ?>">
</P>
<P>
<B>Department:</B><BR>
<INPUT TYPE="text" NAME="department" SIZE="50" VALUE="<? echo "$department"; ?>"> dept.<BR>
<I>
<FONT SIZE="2">
Example departments:
<UL>
<LI>we-saw-it-coming dept.</LI>
<LI>don't-get-your-panties-in-a-knot dept.</LI>
<LI>brain-melt dept.</LI>
<LI>beats-the-heck-out-of-me dept.</LI>
</UL>
</FONT>
</I>
</P>
<P>
<B>Category:</B><BR>
<SELECT NAME="category">
<?PHP
for ($i = 0; $i < sizeof($categories); $i++) {
echo "<OPTION VALUE=\"$categories[$i]\" ";
if ($category == $categories[$i]) echo "SELECTED";
echo ">$categories[$i]\n";
}
?>
</SELECT>
</P>
<P>
<B>Introduction of article:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="7" NAME="abstract"><? echo "$abstract"; ?></TEXTAREA><BR>
<FONT SIZE="2"><I>Will be displayed on the main page.</I></FONT>
</P>
<P>
<B>Rest of article:</B><BR>
<TEXTAREA WRAP="virtual" COLS="60" ROWS="8" NAME="article"><? echo "$article"; ?></TEXTAREA><BR>
<I><FONT SIZE="2">Will be displayed on the article's page when following the 'read more'-link.</FONT></I>
</P>
<INPUT TYPE="submit" NAME="op" VALUE="Preview admin article">
<INPUT TYPE="submit" NAME="op" VALUE="Post admin article">
</FORM>
<?
$theme->footer();
}
function news_admin_post($subject, $category, $department, $abstract, $article, $category) {
global $aid;
dbconnect();
$subject = stripslashes(FixQuotes($subject));
$intro = stripslashes(FixQuotes($intro));
$rest = stripslashes(FixQuotes($rest));
$result = mysql_query("INSERT INTO stories VALUES (NULL, '$aid', '$subject', '". time() ."', '$abstract', '', '$article', '$category', '$aid', '$department')");
if (!$result) {
echo mysql_errno(). ": ".mysql_error(). "<BR>";
exit();
}
header("Location: admin.php?op=main");
}
/*********************************************************/
/* admin admining */
/*********************************************************/
function displayadmins() {
$titlebar = "<b>current authors</b>";
include "header.inc";
dbconnect();
$result = mysql_query("select aid from authors");
echo "<table border=1>";
while(list($a_aid) = mysql_fetch_row($result)) {
echo "<tr><td>$a_aid</td>";
echo "<td><a href=\"$that_url/admin.php?op=modifyadmin&chng_aid=$a_aid\">Modify Info</a></td>";
echo "<td><a href=\"$that_url/admin.php?op=deladmin&del_aid=$a_aid\">Delete Author</a></td></tr>";
}
echo "</table>";
echo "<form action=\"$that_url/admin.php\" method=\"post\">";
echo "Handle: <INPUT TYPE=\"text\" NAME=\"add_aid\" size=30 maxlength=30><br>";
echo "Name: <INPUT TYPE=\"text\" NAME=\"add_name\" size=30 maxlength=60><br>";
echo "Email: <INPUT TYPE=\"text\" NAME=\"add_email\" size=30 maxlength=60><br>";
echo "URL: <INPUT TYPE=\"text\" NAME=\"add_url\" size=30 maxlength=60><br>";
echo "Password: <INPUT TYPE=\"text\" NAME=\"add_pwd\" size=12 maxlength=12><br>";
echo " <INPUT TYPE=submit NAME=op VALUE=\"Add author\"></form>";
include "footer.inc";
}
function modifyadmin($chng_aid) {
$titlebar = "<b>update $chng_aid</b>";
include "header.inc";
dbconnect();
$result = mysql_query("select aid, name, url, email, pwd from authors where aid='$chng_aid'");
list($chng_aid, $chng_name, $chng_url, $chng_email, $chng_pwd) = mysql_fetch_row($result);
echo "<form action=\"admin.php\" method=\"post\">";
echo "Name: $chng_name<INPUT TYPE=\"hidden\" NAME=\"chng_name\" VALUE=\"$chng_name\"><br>";
echo "Handle: <INPUT TYPE=\"text\" NAME=\"chng_aid\" VALUE=\"$chng_aid\"><br>";
echo "Email: <INPUT TYPE=\"text\" NAME=\"chng_email\" VALUE=\"$chng_email\" size=30 maxlength=60><br>";
echo "URL: <INPUT TYPE=\"text\" NAME=\"chng_url\" VALUE=\"$chng_url\" size=30 maxlength=60><br>";
echo "Password: <INPUT TYPE=\"password\" NAME=\"chng_pwd\" VALUE=\"$chng_pwd\" size=12 maxlength=12><br>";
echo "Retype Password: <INPUT TYPE=\"password\" NAME=\"chng_pwd2\" size=12 maxlength=12> (for changes only)<br>";
echo " <INPUT TYPE=submit NAME=op VALUE=\"Update Author\"></form>";
include "footer.inc";
}
function updateadmin($chng_aid, $chng_name, $chng_email, $chng_url, $chng_pwd, $chng_pwd2) {
if ($chng_pwd2 != "") {
if($chng_pwd != $chng_pwd2) {
$titlebar = "<b>bad pass</b>";
include "header.inc";
echo "Sorry, the new passwords do not match. Click back and try again";
include "footer.inc";
exit;
}
dbconnect();
$result = mysql_query("update authors set aid='$chng_aid', email='$chng_email', url='$chng_url', pwd='$chng_pwd' where NAME='$chng_name'");
header("Location: admin.php?op=main");
} else {
dbconnect();
$result = mysql_query("update authors set aid='$chng_aid', email='$chng_email', url='$chng_url' where NAME='$chng_name'");
header("Location: admin.php?op=main");
}
}
if ($admin) {
switch($op) {
case "main":
main();
break;
case "blocks":
block_overview();
break;
case "Add new block":
block_add($title, $content);
break;
case "Delete block":
block_delete($id);
break;
case "Update block":
block_update($id, $title, $content);
break;
case "submission":
// fall through
case "View article":
news_display($qid);
break;
case "Preview article":
news_preview($qid, $uid, $author, $subject, $department, $category, $abstract, $comments, $article);
break;
case "Post article":
news_post($qid, $uid, $author, $subject, $department, $category, $abstract, $comments, $article);
break;
case "Edit article":
news_edit($sid);
break;
case "Update article":
news_update($sid, $subject, $category, $department, $abstract, $comments, $article);
break;
case "Delete article":
news_queue_delete($qid);
break;
case "news_admin_write":
news_admin_write($sid);
break;
case "Preview admin article":
news_admin_preview($subject, $category, $department, $abstract, $article);
break;
case "Post admin article":
news_admin_post($subject, $category, $department, $abstract, $article);
break;
case "mod_authors":
displayadmins();
break;
case "modifyadmin":
modifyadmin($chng_aid);
break;
case "Update author":
updateadmin($chng_aid, $chng_name, $chng_email, $chng_url, $chng_pwd, $chng_pwd2);
break;
case "Add author":
dbconnect();
$result = mysql_query("INSERT INTO authors VALUES ('$add_aid','$add_name','$add_url','$add_email','$add_pwd')");
if (!$result) {
echo mysql_errno(). ": ".mysql_error(). "<br>"; return;
}
header("Location: $that_url/admin.php?op=main");
break;
case "deladmin":
include "header.inc";
echo "Are you sure you want to delete $del_aid?<br>";
echo "<a href=\"$that_url/admin.php?op=deladminconf&del_aid=$del_aid\">Yes</a> <a href=\"$that_url/admin.php?op=main\">No</a>";
include "footer.inc";
break;
case "deladminconf":
dbconnect();
mysql_query("delete from authors where aid='$del_aid'");
header("Location: $that_url/admin.php?op=main");
break;
case "create":
poll_createPoll();
break;
case "createPosted":
poll_createPosted();
break;
case "remove":
poll_removePoll();
break;
case "removePosted":
poll_removePosted();
break;
case "user_overview":
user_overview();
break;
case "backup":
backup();
main();
break;
case "view":
poll_viewPoll();
break;
case "viewPosted":
poll_viewPosted();
break;
case "logout":
logout();
break;
default:
main();
break;
}
} else {
login();
}
?>