Browse code

3.5.6 efiction version

Jimako authored on 2024/03/09 16:09:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,73 @@
1
+<?php
2
+
3
+// ----------------------------------------------------------------------
4
+// eFiction 3.2
5
+// Copyright (c) 2007 by Tammy Keefer
6
+// Valid HTML 4.01 Transitional
7
+// Based on eFiction 1.1
8
+// Copyright (C) 2003 by Rebecca Smallwood.
9
+// http://efiction.sourceforge.net/
10
+// ----------------------------------------------------------------------
11
+// LICENSE
12
+//
13
+// This program is free software; you can redistribute it and/or
14
+// modify it under the terms of the GNU General Public License (GPL)
15
+// as published by the Free Software Foundation; either version 2
16
+// of the License, or (at your option) any later version.
17
+//
18
+// This program is distributed in the hope that it will be useful,
19
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+// GNU General Public License for more details.
22
+//
23
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
24
+// ----------------------------------------------------------------------
25
+
26
+if(!defined("_CHARSET")) exit( );
27
+	include("includes/emailer.php");
28
+	$cat = isset($_GET['cat']) ? $_GET['cat'] : -1;
29
+
30
+	$output .= "<div style='text-align: center;'><h4>"._MAILUSERS."</h4></div>";
31
+	if(isset($_POST['submit'])) {
32
+		$who = isset($_POST['who']) ? $_POST['who'] : false;
33
+		$category = isset($_POST['category']) ? $_POST['category'] : false;
34
+		if($who == "authors") $select = "SELECT "._EMAILFIELD." as email, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_authorprefs as ap WHERE "._UIDFIELD." = ap.uid AND ap.stories > 0";
35
+		else if($who == "admins") $select = "SELECT "._EMAILFIELD." as email, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_authorprefs as ap WHERE "._UIDFIELD." = ap.uid AND ap.level > 0";
36
+		else $select = "SELECT "._EMAILFIELD." as email, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE;
37
+		if($who == "admins" && $_POST['category'] != "all" && isNumber($_POST['category'])) $select .= " AND (FIND_IN_SET(".$_POST['category'].", ap.categories) > 0 OR ap.categories = 0)";
38
+		$query = dbquery($select);
39
+		$subject = strip_tags(descript($_POST['subject']));
40
+		$mailtext = descript($_POST['mailtext']);
41
+		$sent = 0;
42
+		while($result = dbassoc($query)){
43
+			$mailresult = sendemail($result['penname'], $result['email'], $sitename, $siteemail, $subject, $mailtext, "html");
44
+			if($mailresult) $sent++;
45
+			$output .= $result['penname']." <img src=\"images/".($mailresult ? "check.gif\" alt=\"check\" title=\"check\"" : "X.gif\" alt=\"X\" title=\"X\"")."><br />";		
46
+		}
47
+		if($sent) $output .= write_message(_MESSAGESENT." $sent<br/>"._ACTIONSUCCESSFUL);
48
+		else $output .= write_message(_NOMAILSENT);
49
+	}
50
+	else {
51
+		$output .= "<form method=\"POST\" name=\"form\" enctype=\"multipart/form-data\" action=\"admin.php?action=mailusers\">
52
+		<table align=\"center\"><tr><td><label for=\"who\">"._EMAIL.":</label> </td><td><select name=\"who\" id=\"who\">
53
+			<option value=\"all\">"._ALLMEMBERS."</option>
54
+			<option value=\"authors\">"._AUTHORSONLY."</option>
55
+			<option value=\"admins\">"._ADMINS."</option>
56
+		</select></td></tr><tr><td><label for=\"category\">"._CATEGORY.":</label> </td><td><select name=\"category\" id=\"category\" onChange='if(this.selectedIndex.value == false) return false; else document.location = document.location.pathname + \"?action=mailusers&amp;cat=\" + document.form.category.options[document.form.category.selectedIndex].value;'><option value=\"all\">"._ALL."</option>";
57
+		$result = dbquery("SELECT category, catid, parentcatid FROM ".TABLEPREFIX."fanfiction_categories ORDER BY leveldown, displayorder");
58
+		while($cats = dbassoc($result)) {
59
+			if($cats['catid'] == $cat || $cats['parentcatid'] == $cat) {
60
+				$output .= "<option value=\"".$cats['catid']."\"";
61
+				if($cats['catid'] == $cat) $output .= " selected";
62
+				$output .= ">".$cats['category'];
63
+				$output .= "</option>";
64
+			}		
65
+		}
66
+		$output .= "</select></td></tr>
67
+		<tr><td><label for=\"subject\">"._SUBJECT.":</label> </td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"subject\"></td></tr>
68
+		<tr><td valign=\"top\"><label for=\"mailtext\">"._TEXT.":</label> </td><td><textarea class=\"textbox\" name=\"mailtext\" cols=\"40\" rows=\"6\"></TEXTAREA></td></tr>
69
+		<tr><td><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></td></tr></table></form>";
70
+		$output .= "<br /><br /><div style='text-align: center;'>"._EMAILWARNING."</div><br />";
71
+	}
72
+
73
+?>
0 74
\ No newline at end of file