This commit has been accessed 665 times via Git panel.
commit a6a99774eb7b3a23f822f53e81805a45b17c914a
tree 8b7e38dd91236fad39600d776cd0debb3cab9944
parent 56488ab9d41b2f0d54ffa69a12d92faf55641b4c
author Magie Antonio <magie@majcms.org> 1322540895 +0800
committer Magie Antonio <magie@majcms.org> 1322540895 +0800
Enable sending new posts via email plus various fixes
diff --git a/add.php b/add.php
index a3ab0aa..d53749f 100644
--- a/add.php
+++ b/add.php
@@ -273,6 +273,14 @@ echo "\n<style>body { margin: {$maj_wspace}px; } .input, .click { width: 520px;
<p><input autocomplete="off" type="password" name="passwd"> Enter optional password.</p>
<?php
+
+if (file_exists("$maj_data_directory/email.txt")) {
+
+ echo "<p>Send a copy of this entry to one email address or to a comma-separated list of email addresses:<br>";
+ echo "<input autocomplete=\"on\" type=\"text\" name=\"notify\" class=\"input\"></p>";
+}
+
+
if (file_exists("$maj_data_directory/categories")) {
if ($dh_cat = opendir("$maj_data_directory/categories")) {
while (($entry_cat = readdir($dh_cat)) !== false) {
@@ -373,7 +381,7 @@ echo "\n<style>body { margin: {$maj_wspace}px; } .input, .click { width: 520px;
$entry = $_POST['select_year'] . $_POST['select_month'] . $_POST['select_day'] . $_POST['select_hour'] . $_POST['select_min'] . $entry_sec;
$timestamp = date("l, M j, Y, g:i A", mktime($_POST['select_hour'], $_POST['select_min'], $entry_sec, $_POST['select_month'], $_POST['select_day'], $_POST['select_year']));
}
-
+
if (!file_exists("$maj_data_directory/items")) {
mkdir("$maj_data_directory/items");
}
@@ -521,7 +529,7 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
touch("$maj_data_directory/items/$entry/member.txt");
}
- if (file_exists("$maj_data_directory/members/active") and file_exists("$maj_data_directory/ml.txt") and file_exists("$maj_data_directory/email.txt") and !file_exists("$maj_data_directory/items/$entry/private.txt")) {
+ if (file_exists("$maj_data_directory/members/active") and file_exists("$maj_data_directory/ml.txt") and file_exists("$maj_data_directory/email.txt") and !file_exists("$maj_data_directory/items/$entry/private.txt") and !file_exists("$maj_data_directory/categories/{$_POST['category']}/private.txt")) {
if (file_exists("$maj_data_directory/ml-reply2.txt")) {
$ml_reply2 = file_get_contents("$maj_data_directory/ml-reply2.txt");
}
@@ -558,7 +566,6 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
$ml_subject = file_get_contents("$maj_data_directory/ml-prepend.txt") . " " . $ml_subject;
}
- $ml_mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
$ml_body = ucfirst($_POST['body_input']);
$ml_body = str_replace('<br />', "\n", $ml_body);
$ml_body = str_replace("<img src=\"$maj_image_directory/smileys/crying.png\" border=\"0\">", ':((', $ml_body);
@@ -613,9 +620,9 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
$ml_to = '"' . "$ml_to_firstname $ml_to_lastname" . '" <' . $ml_to . '>';
if (file_exists("$maj_data_directory/ml-reply2.txt")) {
- mb_send_mail($ml_to, $ml_subject, $ml_body, "From: $ml_from\r\n" . "Reply-To: $ml_reply2\r\n" . "References: $entry\r\n" . "X-Mailer: $ml_mailer");
+ mb_send_mail($ml_to, $ml_subject, $ml_body, "From: $ml_from\r\n" . "Reply-To: $ml_reply2\r\n" . "References: $entry\r\n" . "X-Mailer: $maj_mailer");
} else {
- mb_send_mail($ml_to, $ml_subject, $ml_body, "From: $ml_from\r\n" . "References: $entry\r\n" . "X-Mailer: $ml_mailer");
+ mb_send_mail($ml_to, $ml_subject, $ml_body, "From: $ml_from\r\n" . "References: $entry\r\n" . "X-Mailer: $maj_mailer");
}
}
}
@@ -676,4 +683,34 @@ if (file_exists("$maj_data_directory/ping.txt")) {
}
}
+if (isset($_POST['notify']) and !empty($_POST['notify']) and file_exists("$maj_data_directory/email.txt") and !file_exists("$maj_data_directory/items/$entry/private.txt")) {
+
+ $notify_from = file_get_contents("$maj_data_directory/email.txt");
+
+ $notify = explode(",",$_POST['notify']);
+
+ foreach ($notify as $notify_to) {
+
+ $notify_check = strpos($notify_to,"<");
+
+ if ($notify_check) {
+
+ $notify_to = substr($notify_to,$notify_check+1);
+ $notify_to = substr($notify_to,0,-1);
+ }
+
+ mb_strtolower($notify_to);
+ trim($notify_to);
+
+ if (mb_ereg("@", $notify_to) and mb_ereg("\.", $notify_to) and (substr_count($notify_to,"@") == "1")) {
+
+ if (isset($_POST['category']) and !empty($_POST['category']) and file_exists("$maj_data_directory/categories/{$_POST['category']}/private.txt")) {
+ continue;
+ }
+
+ mb_send_mail($notify_to, $title_write_content, $body_write_content, "From: $notify_from\r\n" . "References: $entry\r\n" . "X-Mailer: $maj_mailer");
+ }
+ }
+}
+
?>
diff --git a/core.php b/core.php
index 2719738..25674ba 100644
--- a/core.php
+++ b/core.php
@@ -20,6 +20,8 @@ session_start();
$maj_data_directory = "data";
$maj_image_directory = "images";
+$maj_mailer = "MAJ/2.0 (PHP/" . phpversion() . ")";
+
$maj_default_title = file_get_contents("$maj_data_directory/title.txt");
$maj_admin_username = file_get_contents("$maj_data_directory/username.txt");
@@ -703,23 +705,26 @@ function maj_profile() {
if (file_exists("$maj_image_directory/profile.png")) {
$img = "$maj_image_directory/profile.png";
}
+
+ if ($img) {
- $size = getimagesize($img);
- $width = $size[0];
- $height = $size[1];
-
- if ($width > $max) {
-
- $factor = (double) ($max / $width) ;
- $width = (int) ($width * $factor);
- $height = (int) ($height * $factor);
+ $size = getimagesize($img);
+ $width = $size[0];
+ $height = $size[1];
- echo "<a href=\".\"><img src=\"$img\" border=\"0\" width=\"$width\" height=\"$height\"></a><br>";
- }
- else {
- echo "<a href=\".\"><img src=\"$img\" border=\"0\" width=\"$width\" height=\"$height\" align=\"left\"></a>";
+ if ($width > $max) {
+
+ $factor = (double) ($max / $width) ;
+ $width = (int) ($width * $factor);
+ $height = (int) ($height * $factor);
+
+ echo "<a href=\".\"><img src=\"$img\" border=\"0\" width=\"$width\" height=\"$height\"></a><br>";
+ }
+ else {
+ echo "<a href=\".\"><img src=\"$img\" border=\"0\" width=\"$width\" height=\"$height\" align=\"left\"></a>";
+ }
}
-
+
include("$maj_data_directory/profile.php");
echo "\r\n\t</div>\r\n</div>\r\n\r\n";
@@ -1542,11 +1547,18 @@ function maj_recent() {
}
while ($increment < $maximum) {
+
+ $title = file_get_contents("$maj_data_directory/items/$maj_latest[$increment]/title.txt");
+
+ if (file_exists("$maj_data_directory/items/$maj_latest[$increment]/member.txt") and (!isset($maj_logged_in_username))) {
+ echo "$title";
+ }
+ else {
+ echo "<a class=\"navlink\" href=\"index.php?entry=$maj_latest[$increment]\">$title</a>";
+ }
- echo "<a class=\"navlink\" href=\"index.php?entry=$maj_latest[$increment]\">";
- readfile("$maj_data_directory/items/$maj_latest[$increment]/title.txt");
- echo "</a><br>";
-
+ echo "<br>";
+
$increment = $increment + 1;
}
diff --git a/index.php b/index.php
index 0b5ea08..2b37a60 100644
--- a/index.php
+++ b/index.php
@@ -430,8 +430,6 @@ if (isset($maj_req_entry) and !empty($maj_req_entry)) {
$maj_from_email = '"' . $maj_from_email_author . '" <' . $maj_from_email . '>';
}
- $maj_mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$maj_commented_entry_title = file_get_contents("$maj_data_directory/items/$maj_req_entry/title.txt");
if (!file_exists("$maj_data_directory/nak.txt") and file_exists("$maj_data_directory/email.txt")) {
@@ -811,16 +809,16 @@ if ($maj_dh_items = opendir("$maj_data_directory/items")) {
continue;
}
- if ((file_exists("$maj_data_directory/items/$maj_item/members") and !isset($maj_logged_in_username)) or (isset($maj_logged_in_username) and !file_exists("$maj_data_directory/items/$maj_item/members/$maj_logged_in_username"))) {
+ if (file_exists("$maj_data_directory/items/$maj_item/members") and (!isset($maj_logged_in_username) or !file_exists("$maj_data_directory/items/$maj_item/members/$maj_logged_in_username"))) {
continue;
}
+ $maj_latest[] = $maj_item;
+
if (file_exists("$maj_data_directory/items/$maj_item/member.txt") and (!isset($maj_logged_in_username))) {
continue;
}
- $maj_latest[] = $maj_item;
-
if (file_exists("$maj_data_directory/items/$maj_item/album")) {
$maj_albums[] = $maj_item;
}
@@ -1061,30 +1059,29 @@ if (file_exists("$maj_data_directory/bb.txt") and file_exists("$maj_data_directo
while ($maj_increment_latest <= 4) {
- echo "<tr><td bgcolor=\"#ffffff\"><a href=\"index.php?entry=$maj_latest[$maj_increment_latest]";
-
- if ($maj_dh_summary_comments = opendir("$maj_data_directory/items/$maj_latest[$maj_increment_latest]/comments/live")) {
-
- while (($maj_entry_summary_comments = readdir($maj_dh_summary_comments)) !== false) {
-
- if ($maj_entry_summary_comments != "." && $maj_entry_summary_comments != "..") {
- $maj_items_summary_comments[] = $maj_entry_summary_comments;
- }
- }
- closedir($maj_dh_summary_comments);
- }
+ $maj_latest_title = file_get_contents("$maj_data_directory/items/$maj_latest[$maj_increment_latest]/title.txt");
+ $maj_items_summary_comments = glob("$maj_data_directory/items/$maj_latest[$maj_increment_latest]/comments/live/*");
+ $maj_summary_comments = count($maj_items_summary_comments);
rsort($maj_items_summary_comments);
-
- $maj_summary_comments = count($maj_items_summary_comments);
-
- if ($maj_summary_comments > 0) {
- echo "&show=comments";
+
+ echo "<tr><td bgcolor=\"#ffffff\">";
+
+ if (file_exists("$maj_data_directory/items/$maj_latest[$maj_increment_latest]/member.txt") and (!isset($maj_logged_in_username))) {
+
+ echo "<b>$maj_latest_title</b>";
}
+ else {
+ echo "<a href=\"index.php?entry=$maj_latest[$maj_increment_latest]";
- echo "\">";
- readfile("$maj_data_directory/items/$maj_latest[$maj_increment_latest]/title.txt");
- echo "</a></td>";
+ if ($maj_summary_comments > 0) {
+ echo "&show=comments";
+ }
+
+ echo "\">$maj_latest_title</a>";
+ }
+
+ echo "</td>";
echo "<td bgcolor=\"#ffffff\"><a href=\"member.php?id=";
readfile("$maj_data_directory/items/$maj_latest[$maj_increment_latest]/author.txt");
@@ -1113,9 +1110,9 @@ if (file_exists("$maj_data_directory/bb.txt") and file_exists("$maj_data_directo
echo "<td bgcolor=\"#ffffff\" align=\"right\">$maj_iso_last</td>";
}
else {
- $maj_iso_year = mb_substr($maj_items_summary_comments[0],0,4);
- $maj_iso_month = mb_substr($maj_items_summary_comments[0],4,2);
- $maj_iso_day = mb_substr($maj_items_summary_comments[0],6,2);
+ $maj_iso_year = mb_substr(basename($maj_items_summary_comments[0]),0,4);
+ $maj_iso_month = mb_substr(basename($maj_items_summary_comments[0]),4,2);
+ $maj_iso_day = mb_substr(basename($maj_items_summary_comments[0]),6,2);
$maj_iso_last = $maj_iso_year . "-" . $maj_iso_month . "-" . $maj_iso_day;
echo "<td bgcolor=\"#ffffff\" align=\"right\">$maj_summary_comments</td>";
diff --git a/options.php b/options.php
index a55509d..26ef61e 100644
--- a/options.php
+++ b/options.php
@@ -80,8 +80,6 @@ if (isset($_POST['email']) and !empty($_POST['email']) and (file_get_contents("$
$old_email = file_get_contents("$maj_data_directory/members/active/$maj_logged_in_username/email.txt");
- $mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$sig_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
$sig_url = str_replace('//', '/', $sig_url);
$sig_url = "http://" . $sig_url;
@@ -98,7 +96,7 @@ if (isset($_POST['email']) and !empty($_POST['email']) and (file_get_contents("$
mb_send_mail($email_to, "confirm $key_email", $confirm_change,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
echo "Confirmation request sent. Check your $email_write_content inbox for details.";
}
diff --git a/reg.php b/reg.php
index ff7d940..ec62e66 100644
--- a/reg.php
+++ b/reg.php
@@ -95,8 +95,6 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
$email = file_get_contents("$maj_data_directory/members/active/$username/email.txt");
$from_email = file_get_contents("$maj_data_directory/email.txt");
- $mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$sig_author = file_get_contents("$maj_data_directory/author.txt");
$sig_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
@@ -115,12 +113,12 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
mb_send_mail($email_from, "registration notice ($email)", $registered_notice,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
mb_send_mail($email_to, "password notice ($username)", $password_notice,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
$fp_new_txt = fopen("$maj_data_directory/bb-new.txt","w");
fwrite($fp_new_txt,$username);
@@ -153,8 +151,6 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
$email = file_get_contents("$maj_data_directory/members/pending/$username/email.txt");
$from_email = file_get_contents("$maj_data_directory/email.txt");
- $mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$sig_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
$sig_url = str_replace('//', '/', $sig_url);
$sig_url = "http://" . $sig_url;
@@ -189,7 +185,7 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
mb_send_mail($email_from, "confirmation notice ($email)", $confirmation_notice,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
}
else {
if (!file_exists("$maj_data_directory/members/active")) {
@@ -204,7 +200,7 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
mb_send_mail($email_from, "registration notice ($email)", $registered_notice,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
$password = str_rand(16);
@@ -222,8 +218,6 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
$email = file_get_contents("$maj_data_directory/members/active/$username/email.txt");
$from_email = file_get_contents("$maj_data_directory/email.txt");
- $mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$sig_author = file_get_contents("$maj_data_directory/author.txt");
$sig_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
@@ -239,7 +233,7 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
mb_send_mail($email_to, "password notice ($username)", $password_notice,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
$fp_new_txt = fopen("$maj_data_directory/bb-new.txt","w");
fwrite($fp_new_txt,$username);
@@ -582,8 +576,6 @@ if ($_POST['submit'] == "1") {
fwrite($fp_key_txt,$key);
fclose($fp_key_txt);
- $mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$sig_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
$sig_url = str_replace('//', '/', $sig_url);
$sig_url = "http://" . $sig_url;
@@ -600,7 +592,7 @@ if ($_POST['submit'] == "1") {
mb_send_mail($email_to, "confirm $key", $confirm_thanks,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
unset($err_username);
unset($err_firstname);
diff --git a/reset.php b/reset.php
index c4e096b..7fa1ace 100644
--- a/reset.php
+++ b/reset.php
@@ -78,8 +78,6 @@ if (isset($_POST['username']) and !empty($_POST['username']) and isset($_POST['a
$email = file_get_contents("$maj_data_directory/members/active/$username/email.txt");
$from_email = file_get_contents("$maj_data_directory/email.txt");
- $mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$sig_author = file_get_contents("$maj_data_directory/author.txt");
$from_email = '"' . $sig_author . '" <' . $from_email . '>';
@@ -98,12 +96,12 @@ if (isset($_POST['username']) and !empty($_POST['username']) and isset($_POST['a
mb_send_mail($from_email, "password reset notice ($username)", $reset_notice,
"From: $from_email\r\n" .
"Reply-To: $from_email\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
mb_send_mail($email, "password reset notice ($username)", $password_notice,
"From: $from_email\r\n" .
"Reply-To: $from_email\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
if (file_exists("$maj_data_directory/members/active/$username/bb-lockout.txt")) {
unlink("$maj_data_directory/members/active/$username/bb-lockout.txt");
tree 8b7e38dd91236fad39600d776cd0debb3cab9944
parent 56488ab9d41b2f0d54ffa69a12d92faf55641b4c
author Magie Antonio <magie@majcms.org> 1322540895 +0800
committer Magie Antonio <magie@majcms.org> 1322540895 +0800
Enable sending new posts via email plus various fixes
diff --git a/add.php b/add.php
index a3ab0aa..d53749f 100644
--- a/add.php
+++ b/add.php
@@ -273,6 +273,14 @@ echo "\n<style>body { margin: {$maj_wspace}px; } .input, .click { width: 520px;
<p><input autocomplete="off" type="password" name="passwd"> Enter optional password.</p>
<?php
+
+if (file_exists("$maj_data_directory/email.txt")) {
+
+ echo "<p>Send a copy of this entry to one email address or to a comma-separated list of email addresses:<br>";
+ echo "<input autocomplete=\"on\" type=\"text\" name=\"notify\" class=\"input\"></p>";
+}
+
+
if (file_exists("$maj_data_directory/categories")) {
if ($dh_cat = opendir("$maj_data_directory/categories")) {
while (($entry_cat = readdir($dh_cat)) !== false) {
@@ -373,7 +381,7 @@ echo "\n<style>body { margin: {$maj_wspace}px; } .input, .click { width: 520px;
$entry = $_POST['select_year'] . $_POST['select_month'] . $_POST['select_day'] . $_POST['select_hour'] . $_POST['select_min'] . $entry_sec;
$timestamp = date("l, M j, Y, g:i A", mktime($_POST['select_hour'], $_POST['select_min'], $entry_sec, $_POST['select_month'], $_POST['select_day'], $_POST['select_year']));
}
-
+
if (!file_exists("$maj_data_directory/items")) {
mkdir("$maj_data_directory/items");
}
@@ -521,7 +529,7 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
touch("$maj_data_directory/items/$entry/member.txt");
}
- if (file_exists("$maj_data_directory/members/active") and file_exists("$maj_data_directory/ml.txt") and file_exists("$maj_data_directory/email.txt") and !file_exists("$maj_data_directory/items/$entry/private.txt")) {
+ if (file_exists("$maj_data_directory/members/active") and file_exists("$maj_data_directory/ml.txt") and file_exists("$maj_data_directory/email.txt") and !file_exists("$maj_data_directory/items/$entry/private.txt") and !file_exists("$maj_data_directory/categories/{$_POST['category']}/private.txt")) {
if (file_exists("$maj_data_directory/ml-reply2.txt")) {
$ml_reply2 = file_get_contents("$maj_data_directory/ml-reply2.txt");
}
@@ -558,7 +566,6 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
$ml_subject = file_get_contents("$maj_data_directory/ml-prepend.txt") . " " . $ml_subject;
}
- $ml_mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
$ml_body = ucfirst($_POST['body_input']);
$ml_body = str_replace('<br />', "\n", $ml_body);
$ml_body = str_replace("<img src=\"$maj_image_directory/smileys/crying.png\" border=\"0\">", ':((', $ml_body);
@@ -613,9 +620,9 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
$ml_to = '"' . "$ml_to_firstname $ml_to_lastname" . '" <' . $ml_to . '>';
if (file_exists("$maj_data_directory/ml-reply2.txt")) {
- mb_send_mail($ml_to, $ml_subject, $ml_body, "From: $ml_from\r\n" . "Reply-To: $ml_reply2\r\n" . "References: $entry\r\n" . "X-Mailer: $ml_mailer");
+ mb_send_mail($ml_to, $ml_subject, $ml_body, "From: $ml_from\r\n" . "Reply-To: $ml_reply2\r\n" . "References: $entry\r\n" . "X-Mailer: $maj_mailer");
} else {
- mb_send_mail($ml_to, $ml_subject, $ml_body, "From: $ml_from\r\n" . "References: $entry\r\n" . "X-Mailer: $ml_mailer");
+ mb_send_mail($ml_to, $ml_subject, $ml_body, "From: $ml_from\r\n" . "References: $entry\r\n" . "X-Mailer: $maj_mailer");
}
}
}
@@ -676,4 +683,34 @@ if (file_exists("$maj_data_directory/ping.txt")) {
}
}
+if (isset($_POST['notify']) and !empty($_POST['notify']) and file_exists("$maj_data_directory/email.txt") and !file_exists("$maj_data_directory/items/$entry/private.txt")) {
+
+ $notify_from = file_get_contents("$maj_data_directory/email.txt");
+
+ $notify = explode(",",$_POST['notify']);
+
+ foreach ($notify as $notify_to) {
+
+ $notify_check = strpos($notify_to,"<");
+
+ if ($notify_check) {
+
+ $notify_to = substr($notify_to,$notify_check+1);
+ $notify_to = substr($notify_to,0,-1);
+ }
+
+ mb_strtolower($notify_to);
+ trim($notify_to);
+
+ if (mb_ereg("@", $notify_to) and mb_ereg("\.", $notify_to) and (substr_count($notify_to,"@") == "1")) {
+
+ if (isset($_POST['category']) and !empty($_POST['category']) and file_exists("$maj_data_directory/categories/{$_POST['category']}/private.txt")) {
+ continue;
+ }
+
+ mb_send_mail($notify_to, $title_write_content, $body_write_content, "From: $notify_from\r\n" . "References: $entry\r\n" . "X-Mailer: $maj_mailer");
+ }
+ }
+}
+
?>
diff --git a/core.php b/core.php
index 2719738..25674ba 100644
--- a/core.php
+++ b/core.php
@@ -20,6 +20,8 @@ session_start();
$maj_data_directory = "data";
$maj_image_directory = "images";
+$maj_mailer = "MAJ/2.0 (PHP/" . phpversion() . ")";
+
$maj_default_title = file_get_contents("$maj_data_directory/title.txt");
$maj_admin_username = file_get_contents("$maj_data_directory/username.txt");
@@ -703,23 +705,26 @@ function maj_profile() {
if (file_exists("$maj_image_directory/profile.png")) {
$img = "$maj_image_directory/profile.png";
}
+
+ if ($img) {
- $size = getimagesize($img);
- $width = $size[0];
- $height = $size[1];
-
- if ($width > $max) {
-
- $factor = (double) ($max / $width) ;
- $width = (int) ($width * $factor);
- $height = (int) ($height * $factor);
+ $size = getimagesize($img);
+ $width = $size[0];
+ $height = $size[1];
- echo "<a href=\".\"><img src=\"$img\" border=\"0\" width=\"$width\" height=\"$height\"></a><br>";
- }
- else {
- echo "<a href=\".\"><img src=\"$img\" border=\"0\" width=\"$width\" height=\"$height\" align=\"left\"></a>";
+ if ($width > $max) {
+
+ $factor = (double) ($max / $width) ;
+ $width = (int) ($width * $factor);
+ $height = (int) ($height * $factor);
+
+ echo "<a href=\".\"><img src=\"$img\" border=\"0\" width=\"$width\" height=\"$height\"></a><br>";
+ }
+ else {
+ echo "<a href=\".\"><img src=\"$img\" border=\"0\" width=\"$width\" height=\"$height\" align=\"left\"></a>";
+ }
}
-
+
include("$maj_data_directory/profile.php");
echo "\r\n\t</div>\r\n</div>\r\n\r\n";
@@ -1542,11 +1547,18 @@ function maj_recent() {
}
while ($increment < $maximum) {
+
+ $title = file_get_contents("$maj_data_directory/items/$maj_latest[$increment]/title.txt");
+
+ if (file_exists("$maj_data_directory/items/$maj_latest[$increment]/member.txt") and (!isset($maj_logged_in_username))) {
+ echo "$title";
+ }
+ else {
+ echo "<a class=\"navlink\" href=\"index.php?entry=$maj_latest[$increment]\">$title</a>";
+ }
- echo "<a class=\"navlink\" href=\"index.php?entry=$maj_latest[$increment]\">";
- readfile("$maj_data_directory/items/$maj_latest[$increment]/title.txt");
- echo "</a><br>";
-
+ echo "<br>";
+
$increment = $increment + 1;
}
diff --git a/index.php b/index.php
index 0b5ea08..2b37a60 100644
--- a/index.php
+++ b/index.php
@@ -430,8 +430,6 @@ if (isset($maj_req_entry) and !empty($maj_req_entry)) {
$maj_from_email = '"' . $maj_from_email_author . '" <' . $maj_from_email . '>';
}
- $maj_mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$maj_commented_entry_title = file_get_contents("$maj_data_directory/items/$maj_req_entry/title.txt");
if (!file_exists("$maj_data_directory/nak.txt") and file_exists("$maj_data_directory/email.txt")) {
@@ -811,16 +809,16 @@ if ($maj_dh_items = opendir("$maj_data_directory/items")) {
continue;
}
- if ((file_exists("$maj_data_directory/items/$maj_item/members") and !isset($maj_logged_in_username)) or (isset($maj_logged_in_username) and !file_exists("$maj_data_directory/items/$maj_item/members/$maj_logged_in_username"))) {
+ if (file_exists("$maj_data_directory/items/$maj_item/members") and (!isset($maj_logged_in_username) or !file_exists("$maj_data_directory/items/$maj_item/members/$maj_logged_in_username"))) {
continue;
}
+ $maj_latest[] = $maj_item;
+
if (file_exists("$maj_data_directory/items/$maj_item/member.txt") and (!isset($maj_logged_in_username))) {
continue;
}
- $maj_latest[] = $maj_item;
-
if (file_exists("$maj_data_directory/items/$maj_item/album")) {
$maj_albums[] = $maj_item;
}
@@ -1061,30 +1059,29 @@ if (file_exists("$maj_data_directory/bb.txt") and file_exists("$maj_data_directo
while ($maj_increment_latest <= 4) {
- echo "<tr><td bgcolor=\"#ffffff\"><a href=\"index.php?entry=$maj_latest[$maj_increment_latest]";
-
- if ($maj_dh_summary_comments = opendir("$maj_data_directory/items/$maj_latest[$maj_increment_latest]/comments/live")) {
-
- while (($maj_entry_summary_comments = readdir($maj_dh_summary_comments)) !== false) {
-
- if ($maj_entry_summary_comments != "." && $maj_entry_summary_comments != "..") {
- $maj_items_summary_comments[] = $maj_entry_summary_comments;
- }
- }
- closedir($maj_dh_summary_comments);
- }
+ $maj_latest_title = file_get_contents("$maj_data_directory/items/$maj_latest[$maj_increment_latest]/title.txt");
+ $maj_items_summary_comments = glob("$maj_data_directory/items/$maj_latest[$maj_increment_latest]/comments/live/*");
+ $maj_summary_comments = count($maj_items_summary_comments);
rsort($maj_items_summary_comments);
-
- $maj_summary_comments = count($maj_items_summary_comments);
-
- if ($maj_summary_comments > 0) {
- echo "&show=comments";
+
+ echo "<tr><td bgcolor=\"#ffffff\">";
+
+ if (file_exists("$maj_data_directory/items/$maj_latest[$maj_increment_latest]/member.txt") and (!isset($maj_logged_in_username))) {
+
+ echo "<b>$maj_latest_title</b>";
}
+ else {
+ echo "<a href=\"index.php?entry=$maj_latest[$maj_increment_latest]";
- echo "\">";
- readfile("$maj_data_directory/items/$maj_latest[$maj_increment_latest]/title.txt");
- echo "</a></td>";
+ if ($maj_summary_comments > 0) {
+ echo "&show=comments";
+ }
+
+ echo "\">$maj_latest_title</a>";
+ }
+
+ echo "</td>";
echo "<td bgcolor=\"#ffffff\"><a href=\"member.php?id=";
readfile("$maj_data_directory/items/$maj_latest[$maj_increment_latest]/author.txt");
@@ -1113,9 +1110,9 @@ if (file_exists("$maj_data_directory/bb.txt") and file_exists("$maj_data_directo
echo "<td bgcolor=\"#ffffff\" align=\"right\">$maj_iso_last</td>";
}
else {
- $maj_iso_year = mb_substr($maj_items_summary_comments[0],0,4);
- $maj_iso_month = mb_substr($maj_items_summary_comments[0],4,2);
- $maj_iso_day = mb_substr($maj_items_summary_comments[0],6,2);
+ $maj_iso_year = mb_substr(basename($maj_items_summary_comments[0]),0,4);
+ $maj_iso_month = mb_substr(basename($maj_items_summary_comments[0]),4,2);
+ $maj_iso_day = mb_substr(basename($maj_items_summary_comments[0]),6,2);
$maj_iso_last = $maj_iso_year . "-" . $maj_iso_month . "-" . $maj_iso_day;
echo "<td bgcolor=\"#ffffff\" align=\"right\">$maj_summary_comments</td>";
diff --git a/options.php b/options.php
index a55509d..26ef61e 100644
--- a/options.php
+++ b/options.php
@@ -80,8 +80,6 @@ if (isset($_POST['email']) and !empty($_POST['email']) and (file_get_contents("$
$old_email = file_get_contents("$maj_data_directory/members/active/$maj_logged_in_username/email.txt");
- $mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$sig_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
$sig_url = str_replace('//', '/', $sig_url);
$sig_url = "http://" . $sig_url;
@@ -98,7 +96,7 @@ if (isset($_POST['email']) and !empty($_POST['email']) and (file_get_contents("$
mb_send_mail($email_to, "confirm $key_email", $confirm_change,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
echo "Confirmation request sent. Check your $email_write_content inbox for details.";
}
diff --git a/reg.php b/reg.php
index ff7d940..ec62e66 100644
--- a/reg.php
+++ b/reg.php
@@ -95,8 +95,6 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
$email = file_get_contents("$maj_data_directory/members/active/$username/email.txt");
$from_email = file_get_contents("$maj_data_directory/email.txt");
- $mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$sig_author = file_get_contents("$maj_data_directory/author.txt");
$sig_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
@@ -115,12 +113,12 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
mb_send_mail($email_from, "registration notice ($email)", $registered_notice,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
mb_send_mail($email_to, "password notice ($username)", $password_notice,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
$fp_new_txt = fopen("$maj_data_directory/bb-new.txt","w");
fwrite($fp_new_txt,$username);
@@ -153,8 +151,6 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
$email = file_get_contents("$maj_data_directory/members/pending/$username/email.txt");
$from_email = file_get_contents("$maj_data_directory/email.txt");
- $mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$sig_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
$sig_url = str_replace('//', '/', $sig_url);
$sig_url = "http://" . $sig_url;
@@ -189,7 +185,7 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
mb_send_mail($email_from, "confirmation notice ($email)", $confirmation_notice,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
}
else {
if (!file_exists("$maj_data_directory/members/active")) {
@@ -204,7 +200,7 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
mb_send_mail($email_from, "registration notice ($email)", $registered_notice,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
$password = str_rand(16);
@@ -222,8 +218,6 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
$email = file_get_contents("$maj_data_directory/members/active/$username/email.txt");
$from_email = file_get_contents("$maj_data_directory/email.txt");
- $mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$sig_author = file_get_contents("$maj_data_directory/author.txt");
$sig_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
@@ -239,7 +233,7 @@ if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and isset($_R
mb_send_mail($email_to, "password notice ($username)", $password_notice,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
$fp_new_txt = fopen("$maj_data_directory/bb-new.txt","w");
fwrite($fp_new_txt,$username);
@@ -582,8 +576,6 @@ if ($_POST['submit'] == "1") {
fwrite($fp_key_txt,$key);
fclose($fp_key_txt);
- $mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$sig_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
$sig_url = str_replace('//', '/', $sig_url);
$sig_url = "http://" . $sig_url;
@@ -600,7 +592,7 @@ if ($_POST['submit'] == "1") {
mb_send_mail($email_to, "confirm $key", $confirm_thanks,
"From: $email_from\r\n" .
"Reply-To: $email_from\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
unset($err_username);
unset($err_firstname);
diff --git a/reset.php b/reset.php
index c4e096b..7fa1ace 100644
--- a/reset.php
+++ b/reset.php
@@ -78,8 +78,6 @@ if (isset($_POST['username']) and !empty($_POST['username']) and isset($_POST['a
$email = file_get_contents("$maj_data_directory/members/active/$username/email.txt");
$from_email = file_get_contents("$maj_data_directory/email.txt");
- $mailer = 'MAJ/2.0 (PHP/' . phpversion() . ')';
-
$sig_author = file_get_contents("$maj_data_directory/author.txt");
$from_email = '"' . $sig_author . '" <' . $from_email . '>';
@@ -98,12 +96,12 @@ if (isset($_POST['username']) and !empty($_POST['username']) and isset($_POST['a
mb_send_mail($from_email, "password reset notice ($username)", $reset_notice,
"From: $from_email\r\n" .
"Reply-To: $from_email\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
mb_send_mail($email, "password reset notice ($username)", $password_notice,
"From: $from_email\r\n" .
"Reply-To: $from_email\r\n" .
- "X-Mailer: $mailer");
+ "X-Mailer: $maj_mailer");
if (file_exists("$maj_data_directory/members/active/$username/bb-lockout.txt")) {
unlink("$maj_data_directory/members/active/$username/bb-lockout.txt");