Compare commits
4 Commits
860dfa61ca
...
df0adaf253
Author | SHA1 | Date |
---|---|---|
Retro_Guy | df0adaf253 | |
Retro_Guy | 50ac6b3eff | |
Retro_Guy | 84efd8cc0c | |
Retro_Guy | 149abb70b8 |
|
@ -1,140 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
include "config.inc.php";
|
|
||||||
include "head.inc";
|
|
||||||
|
|
||||||
$keyfile = $spooldir.'/keys.dat';
|
|
||||||
$keys = unserialize(file_get_contents($keyfile));
|
|
||||||
|
|
||||||
if((password_verify($keys[0],$_POST['key'])) || (password_verify($keys[1],$_POST['key']))) {
|
|
||||||
$auth_ok = true;
|
|
||||||
} else {
|
|
||||||
$auth_ok = false;
|
|
||||||
unset($_POST['command']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!isset($_POST['command']) || $_POST['command'] !== 'Change') {
|
|
||||||
|
|
||||||
echo '<table border="0" align="center" cellpadding="0" cellspacing="1">';
|
|
||||||
echo '<tr>';
|
|
||||||
echo '<form name="form1" method="post" action="changepw.php">';
|
|
||||||
echo '<td><tr>';
|
|
||||||
echo '<td colspan="3"><strong>Change Password </strong></td>';
|
|
||||||
echo '</tr><tr>';
|
|
||||||
echo '<td>Username:</td>';
|
|
||||||
echo '<td><input name="username" type="text" id="username"></td>';
|
|
||||||
echo '</tr><tr>';
|
|
||||||
echo '<td>Current Password:</td>';
|
|
||||||
echo '<td><input name="current" type="password" id="password"></td>';
|
|
||||||
echo '</tr><tr>';
|
|
||||||
echo '<td>New Password:</td>';
|
|
||||||
echo '<td><input name="password" type="password" id="password"></td>';
|
|
||||||
echo '</tr><tr>';
|
|
||||||
echo '<td>Re-enter Password:</td>';
|
|
||||||
echo '<td><input name="password2" type="password" id="password2"></td>';
|
|
||||||
echo '</tr><tr>';
|
|
||||||
echo '<td><input name="command" type="hidden" id="command" value="Change" readonly="readonly"></td>';
|
|
||||||
echo '</tr><tr>';
|
|
||||||
echo '<input name="key" type="hidden" value="'.password_hash($keys[0], PASSWORD_DEFAULT).'">';
|
|
||||||
echo '<td> </td>';
|
|
||||||
echo '<td><input type="submit" name="Submit" value="Change Password"></td>';
|
|
||||||
echo '</tr></td></form></tr></table>';
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# $hostname: '{POPaddress:port/pop3}INBOX'
|
|
||||||
$hostname = '{rocksolidbbs:110/pop3}INBOX';
|
|
||||||
# $external: Using external POP auth?
|
|
||||||
$external = 0;
|
|
||||||
# $workpath: Where to cache users (must be writable by calling program)
|
|
||||||
$workpath = $config_dir."users/";
|
|
||||||
$keypath = $config_dir."userconfig/";
|
|
||||||
|
|
||||||
$ok = FALSE;
|
|
||||||
$command = "Login";
|
|
||||||
|
|
||||||
$current = $_POST['current'];
|
|
||||||
$username = $_POST['username'];
|
|
||||||
$password = $_POST['password'];
|
|
||||||
$command = $_POST['command'];
|
|
||||||
|
|
||||||
echo '<center>';
|
|
||||||
|
|
||||||
$thisusername = $username;
|
|
||||||
$username = strtolower($username);
|
|
||||||
$userFilename = $workpath.$username;
|
|
||||||
$keyFilename = $keypath.$username;
|
|
||||||
|
|
||||||
# Check all input
|
|
||||||
if (empty($_POST['username'])) {
|
|
||||||
echo "Please enter a Username\r\n";
|
|
||||||
echo '<br /><a href="changepw.php">Back</a>';
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!check_bbs_auth($username, $current)) {
|
|
||||||
echo "Failed to authenticate\r\n";
|
|
||||||
echo '<br /><a href="changepw.php">Back</a>';
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST['password'] !== $_POST['password2']) {
|
|
||||||
echo "Your passwords entered do not match\r\n";
|
|
||||||
echo '<br /><a href="changepw.php">Back</a>';
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
$ok=true;
|
|
||||||
# User is authenticated or to be created. Either way, create the file
|
|
||||||
if ($ok || ($command == "Change") )
|
|
||||||
{
|
|
||||||
if ($userFileHandle = @fopen($userFilename, 'w+'))
|
|
||||||
{
|
|
||||||
fwrite($userFileHandle, password_hash($password, PASSWORD_DEFAULT));
|
|
||||||
fclose($userFileHandle);
|
|
||||||
chmod($userFilename, 0666);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "User:".$thisusername." Password changed\r\n";
|
|
||||||
echo '<br /><a href="../">Back</a>';
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
echo "Authentication Failed\r\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function make_key($username) {
|
|
||||||
$key = openssl_random_pseudo_bytes(44);
|
|
||||||
return base64_encode($key);
|
|
||||||
}
|
|
||||||
|
|
||||||
function check_bbs_auth($username, $password) {
|
|
||||||
global $config_dir;
|
|
||||||
$workpath = $config_dir."users/";
|
|
||||||
$username = strtolower($username);
|
|
||||||
$userFilename = $workpath.$username;
|
|
||||||
|
|
||||||
if ($userFileHandle = @fopen($userFilename, 'r'))
|
|
||||||
{
|
|
||||||
$userFileInfo = fread($userFileHandle, filesize($userFilename));
|
|
||||||
fclose($userFileHandle);
|
|
||||||
if (password_verify ( $password , $userFileInfo))
|
|
||||||
{
|
|
||||||
touch($userFilename);
|
|
||||||
$ok = TRUE;
|
|
||||||
} else {
|
|
||||||
$ok = FALSE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$ok = FALSE;
|
|
||||||
}
|
|
||||||
if ($ok)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
} else {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -49,16 +49,16 @@ if (! isset($_POST['command'])) {
|
||||||
echo '<td><tr>';
|
echo '<td><tr>';
|
||||||
echo '<td><strong>Register Username </strong></td>';
|
echo '<td><strong>Register Username </strong></td>';
|
||||||
echo '</tr><tr>';
|
echo '</tr><tr>';
|
||||||
echo '<td>Username:</td>';
|
echo '<td>Username: </td>';
|
||||||
echo '<td><input name="username" type="text" id="username"value="' . $_POST['username'] . '" maxlength="30"></td>';
|
echo '<td><input name="username" type="text" id="username"value="' . $_POST['username'] . '" maxlength="30"></td>';
|
||||||
echo '</tr><tr>';
|
echo '</tr><tr>';
|
||||||
echo '<td>Email:</td>';
|
echo '<td>Email: </td>';
|
||||||
echo '<td><input name="user_email" type="text" id="user_email" value="' . $_POST['user_email'] . '"></td>';
|
echo '<td><input name="user_email" type="text" id="user_email" value="' . $_POST['user_email'] . '"></td>';
|
||||||
echo '</tr><tr>';
|
echo '</tr><tr>';
|
||||||
echo '<td>Password:</td>';
|
echo '<td>Password: </td>';
|
||||||
echo '<td><input name="password" type="password" id="password"></td>';
|
echo '<td><input name="password" type="password" id="password"></td>';
|
||||||
echo '</tr><tr>';
|
echo '</tr><tr>';
|
||||||
echo '<td>Re-enter Password:</td>';
|
echo '<td>Re-enter Password: </td>';
|
||||||
echo '<td><input name="password2" type="password" id="password2"></td>';
|
echo '<td><input name="password2" type="password" id="password2"></td>';
|
||||||
echo '</tr><tr>';
|
echo '</tr><tr>';
|
||||||
echo '<td><img src="' . $captchaImage . '" /></td>';
|
echo '<td><img src="' . $captchaImage . '" /></td>';
|
||||||
|
@ -72,7 +72,6 @@ if (! isset($_POST['command'])) {
|
||||||
echo '<td> </td>';
|
echo '<td> </td>';
|
||||||
echo '<td><input type="submit" name="Submit" value="Create"></td>';
|
echo '<td><input type="submit" name="Submit" value="Create"></td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
echo '<tr><td><a href="changepw.php">Change current password</a></td></tr>';
|
|
||||||
echo '<tr><td>';
|
echo '<tr><td>';
|
||||||
echo '<td></td><td></td>';
|
echo '<td></td><td></td>';
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
|
|
|
@ -640,6 +640,7 @@ function display_full_headers($article, $group, $name, $from, $getface = false)
|
||||||
}
|
}
|
||||||
if ($getface) {
|
if ($getface) {
|
||||||
if (isset($sendface)) {
|
if (isset($sendface)) {
|
||||||
|
$sendface = mb_decode_mimeheader($sendface);
|
||||||
return ($sendface);
|
return ($sendface);
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -30,7 +30,6 @@ header("Pragma: cache");
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
include "config.inc.php";
|
include "config.inc.php";
|
||||||
include "auth.inc";
|
|
||||||
include "$file_newsportal";
|
include "$file_newsportal";
|
||||||
|
|
||||||
if (isset($_COOKIE['mail_name'])) {
|
if (isset($_COOKIE['mail_name'])) {
|
||||||
|
@ -75,13 +74,13 @@ if (isset($_GET['thisgroup'])) {
|
||||||
$article_age = 30;
|
$article_age = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
$version = 1.1;
|
$version = 1.2;
|
||||||
|
|
||||||
# How long in seconds to cache results
|
# How long in seconds to cache results
|
||||||
$cachetime = 60;
|
$cachetime = 60;
|
||||||
|
|
||||||
# Maximum number of articles to show
|
# Maximum number of articles to show
|
||||||
$maxdisplay = 1000;
|
$maxdisplay = 1000; // default 1000
|
||||||
|
|
||||||
# How many characters of the body to display per article
|
# How many characters of the body to display per article
|
||||||
$snippetlength = 240;
|
$snippetlength = 240;
|
||||||
|
@ -152,8 +151,6 @@ $database = $spooldir . '/articles-overview.db3';
|
||||||
$table = 'overview';
|
$table = 'overview';
|
||||||
$dbh = overview_db_open($database, $table);
|
$dbh = overview_db_open($database, $table);
|
||||||
$query = $dbh->prepare('SELECT * FROM ' . $table . ' WHERE newsgroup=:findgroup AND date >= ' . $cachedate . ' ORDER BY date DESC LIMIT ' . $maxdisplay);
|
$query = $dbh->prepare('SELECT * FROM ' . $table . ' WHERE newsgroup=:findgroup AND date >= ' . $cachedate . ' ORDER BY date DESC LIMIT ' . $maxdisplay);
|
||||||
$articles = array();
|
|
||||||
$db_articles = array();
|
|
||||||
foreach ($grouplist as $findgroup) {
|
foreach ($grouplist as $findgroup) {
|
||||||
$groups = preg_split("/(\ |\t)/", $findgroup, 2);
|
$groups = preg_split("/(\ |\t)/", $findgroup, 2);
|
||||||
$findgroup = $groups[0];
|
$findgroup = $groups[0];
|
||||||
|
@ -169,85 +166,10 @@ foreach ($grouplist as $findgroup) {
|
||||||
$query->execute([
|
$query->execute([
|
||||||
'findgroup' => $findgroup
|
'findgroup' => $findgroup
|
||||||
]);
|
]);
|
||||||
$i = 0;
|
$results = 0;
|
||||||
while (($overviewline = $query->fetch()) !== false) {
|
while (($overviewline = $query->fetch()) !== false) {
|
||||||
$articles[] = $spoolpath . $thisgroup . '/' . $overviewline['number'];
|
$thismsgid = $overviewline['msgid'];
|
||||||
$db_articles[] = $findgroup . ':' . $overviewline['number'] . ':' . $overviewline['date'] . ':' . $overviewline['name'];
|
$target = get_data_from_msgid($thismsgid, $findgroup);
|
||||||
$i ++;
|
|
||||||
if ($i > $maxdisplay) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$dbh = null;
|
|
||||||
|
|
||||||
$files = array();
|
|
||||||
if ($CONFIG['article_database'] == '1') {
|
|
||||||
foreach ($db_articles as $article) {
|
|
||||||
$order = explode(':', $article);
|
|
||||||
$files[$order[2]] = $article;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
foreach ($articles as $article) {
|
|
||||||
if (is_dir($article)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$files[filemtime($article)] = $article;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
krsort($files);
|
|
||||||
|
|
||||||
foreach ($files as $article) {
|
|
||||||
if ($CONFIG['article_database'] == '1') {
|
|
||||||
$data = explode(':', $article);
|
|
||||||
$articledata = np_get_db_article($data[1], $data[0], 0);
|
|
||||||
} else {
|
|
||||||
$articledata = file_get_contents($article);
|
|
||||||
}
|
|
||||||
$bodystart = strpos($articledata, $localeol);
|
|
||||||
$header = substr($articledata, 0, $bodystart);
|
|
||||||
|
|
||||||
# Find group name and article number
|
|
||||||
if ($CONFIG['article_database'] == '1') {
|
|
||||||
$group = $data[0];
|
|
||||||
$articlenumber = $data[1];
|
|
||||||
$groupname = $group;
|
|
||||||
} else {
|
|
||||||
$group = preg_replace($spoolpath_regexp, '', $article);
|
|
||||||
$group = preg_replace('/\//', '.', $group);
|
|
||||||
$findme = strrpos($group, '.');
|
|
||||||
$groupname = substr($group, 0, $findme);
|
|
||||||
$articlenumber = substr($group, $findme + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
preg_match('/Message-ID:.*/i', $header, $articleid);
|
|
||||||
$getid = explode(": ", $articleid[0]);
|
|
||||||
$thismsgid = $getid[1];
|
|
||||||
if (isset($this_overboard['msgids'][$thismsgid])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$isref = preg_match('/References:.*/i', $header, $ref);
|
|
||||||
if ($isref) {
|
|
||||||
$getrefs = explode(': ', $ref[0]);
|
|
||||||
$ref = preg_split("/[\s]+/", $getrefs[1]);
|
|
||||||
if ($getrefs[1] && $refid = get_data_from_msgid($ref[0])) {
|
|
||||||
// Check that article to link is new enough for newsportal to display
|
|
||||||
$groupinfo = file($spooldir . '/' . $refid["newsgroup"] . '-info.txt');
|
|
||||||
$range = explode(' ', $groupinfo[1]);
|
|
||||||
if ($refid['number'] > (intval($range[0]) - 1)) {
|
|
||||||
$threadref = $ref[0];
|
|
||||||
} else {
|
|
||||||
$threadref = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$threadref = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$threadref = false;
|
|
||||||
}
|
|
||||||
$target = get_data_from_msgid($thismsgid, $activegroup);
|
|
||||||
if ($target['date'] > time()) {
|
if ($target['date'] > time()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -257,16 +179,20 @@ foreach ($files as $article) {
|
||||||
if ($target['date'] > $this_overboard['lastmessage']) {
|
if ($target['date'] > $this_overboard['lastmessage']) {
|
||||||
$this_overboard['lastmessage'] = $target['date'];
|
$this_overboard['lastmessage'] = $target['date'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! isset($this_overboard['threads'][$target['date']])) {
|
if (! isset($this_overboard['threads'][$target['date']])) {
|
||||||
$this_overboard['threads'][$target['date']] = $thismsgid;
|
$this_overboard['threads'][$target['date']] = $thismsgid;
|
||||||
$this_overboard['msgids'][$thismsgid] = $target;
|
$this_overboard['msgids'][$thismsgid] = $target;
|
||||||
if ($threadref) {
|
if (trim($overviewline['refs']) != '') {
|
||||||
$this_overboard['threadlink'][$thismsgid] = $threadref;
|
$ref = preg_split("/[\s]+/", $overviewline['refs']);
|
||||||
|
$this_overboard['threadlink'][$thismsgid] = $ref[0];
|
||||||
}
|
}
|
||||||
if ($results ++ > ($maxdisplay - 2)) {
|
if ($results ++ > ($maxdisplay - 2)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents($cachefile, serialize($this_overboard));
|
file_put_contents($cachefile, serialize($this_overboard));
|
||||||
|
@ -275,6 +201,7 @@ if (isset($user_time)) {
|
||||||
} else {
|
} else {
|
||||||
$oldest = (time() - (86400 * $article_age));
|
$oldest = (time() - (86400 * $article_age));
|
||||||
}
|
}
|
||||||
|
|
||||||
$results = display_threads($this_overboard['threads'], $oldest);
|
$results = display_threads($this_overboard['threads'], $oldest);
|
||||||
show_overboard_footer(null, $results, null);
|
show_overboard_footer(null, $results, null);
|
||||||
echo '</body></html>';
|
echo '</body></html>';
|
||||||
|
@ -307,7 +234,7 @@ function expire_overboard($cachefile)
|
||||||
function display_threads($threads, $oldest)
|
function display_threads($threads, $oldest)
|
||||||
{
|
{
|
||||||
global $CONFIG, $OVERRIDES, $thissite, $logfile, $config_name, $snippetlength, $maxdisplay, $prune, $this_overboard;
|
global $CONFIG, $OVERRIDES, $thissite, $logfile, $config_name, $snippetlength, $maxdisplay, $prune, $this_overboard;
|
||||||
echo '<table cellspacing="0" width="100%" class="np_results_table">';
|
$display = '<table cellspacing="0" width="100%" class="np_results_table">';
|
||||||
if (! isset($threads)) {
|
if (! isset($threads)) {
|
||||||
$threads = (object) [];
|
$threads = (object) [];
|
||||||
} else {
|
} else {
|
||||||
|
@ -328,7 +255,6 @@ function display_threads($threads, $oldest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$results = 0;
|
$results = 0;
|
||||||
foreach ($threads as $key => $value) {
|
foreach ($threads as $key => $value) {
|
||||||
$target = $this_overboard['msgids'][$value];
|
$target = $this_overboard['msgids'][$value];
|
||||||
|
@ -336,7 +262,7 @@ function display_threads($threads, $oldest)
|
||||||
if (! isset($target['msgid'])) {
|
if (! isset($target['msgid'])) {
|
||||||
$target = get_data_from_msgid($value);
|
$target = get_data_from_msgid($value);
|
||||||
}
|
}
|
||||||
if (!isset($userdata[$checkgroup])) {
|
if (! isset($userdata[$checkgroup])) {
|
||||||
if (isset($user_config['hide_unsub']) && $user_config['hide_unsub'] == 'hide') {
|
if (isset($user_config['hide_unsub']) && $user_config['hide_unsub'] == 'hide') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -350,37 +276,38 @@ function display_threads($threads, $oldest)
|
||||||
unset($this_overboard['threadlink'][$value]);
|
unset($this_overboard['threadlink'][$value]);
|
||||||
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Pruning: " . $target['newsgroup'] . ":" . $target['number'], FILE_APPEND);
|
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Pruning: " . $target['newsgroup'] . ":" . $target['number'], FILE_APPEND);
|
||||||
}
|
}
|
||||||
$article = get_db_data_from_msgid($target['msgid'], $target['newsgroup'], 1);
|
|
||||||
$poster = get_poster_name(mb_decode_mimeheader($target['name']));
|
$poster = get_poster_name(mb_decode_mimeheader($target['name']));
|
||||||
$groupurl = $thissite . "/thread.php?group=" . _rawurlencode($target['newsgroup']);
|
$groupurl = $thissite . "/thread.php?group=" . _rawurlencode($target['newsgroup']);
|
||||||
if (($results % 2) == 0) {
|
if (($results % 2) == 0) {
|
||||||
echo '<tr class="np_result_line2"><td class="np_result_line2" style="word-wrap:break-word";>';
|
$display .= '<tr class="np_result_line2"><td class="np_result_line2" style="word-wrap:break-word";>';
|
||||||
} else {
|
} else {
|
||||||
echo '<tr class="np_result_line1"><td class="np_result_line1" style="word-wrap:break-word";>';
|
$display .= '<tr class="np_result_line1"><td class="np_result_line1" style="word-wrap:break-word";>';
|
||||||
}
|
}
|
||||||
$url = $thissite . "/article-flat.php?id=" . $target['number'] . "&group=" . _rawurlencode($target['newsgroup']) . "#" . $target['number'];
|
$url = $thissite . "/article-flat.php?id=" . $target['number'] . "&group=" . _rawurlencode($target['newsgroup']) . "#" . $target['number'];
|
||||||
echo '<p class=np_ob_subject>';
|
$display .= '<p class=np_ob_subject>';
|
||||||
echo '<b><a href="' . $url . '"><span>' . headerDecode($target['subject']) . '</span></a></b>';
|
$display .= '<b><a href="' . $url . '"><span>' . headerDecode($target['subject']) . '</span></a></b>';
|
||||||
|
|
||||||
// link for (thread), if possible
|
// link for (thread), if possible
|
||||||
if (isset($this_overboard['threadlink'][$value])) {
|
if (isset($this_overboard['threadlink'][$value])) {
|
||||||
$thread = get_data_from_msgid($this_overboard['threadlink'][$value], $target['newsgroup']);
|
$thread = get_data_from_msgid($this_overboard['threadlink'][$value], $target['newsgroup']);
|
||||||
if ($thread !== false) {
|
if ($thread !== false) {
|
||||||
echo '<font class="np_ob_group"><a href="article-flat.php?id=' . $thread['number'] . '&group=' . rawurlencode($thread['newsgroup']) . '#' . $thread['number'] . '"> (thread)</a></font>';
|
$display .= '<font class="np_ob_group"><a href="article-flat.php?id=' . $thread['number'] . '&group=' . rawurlencode($thread['newsgroup']) . '#' . $thread['number'] . '"> (thread)</a></font>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</p>';
|
$display .= '</p>';
|
||||||
echo '</p><p class=np_ob_group>';
|
$display .= '</p><p class=np_ob_group>';
|
||||||
echo '<a href="' . $groupurl . '"><span class="visited">' . $target['newsgroup'] . '</span></a>';
|
$display .= '<a href="' . $groupurl . '"><span class="visited">' . $target['newsgroup'] . '</span></a>';
|
||||||
echo '</p>';
|
$display .= '</p>';
|
||||||
echo '<p class=np_ob_posted_date>Posted: ' . get_date_interval(date("D, j M Y H:i T", $target['date'])) . ' by: ' . create_name_link($poster['name'], $poster['from']) . '</p>';
|
$display .= '<p class=np_ob_posted_date>Posted: ' . get_date_interval(date("D, j M Y H:i T", $target['date'])) . ' by: ' . create_name_link($poster['name'], $poster['from']) . '</p>';
|
||||||
if ($CONFIG['article_database'] == '1') {
|
if ($CONFIG['article_database'] == '1') {
|
||||||
echo htmlentities(substr($article['search_snippet'], 0, $snippetlength));
|
$article = get_db_data_from_msgid($target['msgid'], $target['newsgroup'], 1);
|
||||||
|
$display .= htmlentities(substr($article['search_snippet'], 0, $snippetlength));
|
||||||
}
|
}
|
||||||
$results ++;
|
$results ++;
|
||||||
}
|
}
|
||||||
echo "</table>";
|
$display .= "</table>";
|
||||||
|
echo $display;
|
||||||
return ($results);
|
return ($results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ if (isset($_POST['command']) && $_POST['command'] == 'Logout') {
|
||||||
$_SESSION = array();
|
$_SESSION = array();
|
||||||
session_destroy();
|
session_destroy();
|
||||||
unset($_COOKIE['mail_name']);
|
unset($_COOKIE['mail_name']);
|
||||||
setcookie('mail_name', '', -1, '/');
|
setcookie('mail_name', '', - 1, '/');
|
||||||
$logmeout = true;
|
$logmeout = true;
|
||||||
} else {
|
} else {
|
||||||
$logmeout = false;
|
$logmeout = false;
|
||||||
|
@ -204,8 +204,14 @@ if ($_POST['command'] != 'Configuration' && $_POST['command'] != 'SaveConfig') {
|
||||||
echo "<p>" . $golink . "</p>";
|
echo "<p>" . $golink . "</p>";
|
||||||
echo '</center>';
|
echo '</center>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply Config
|
// Apply Config
|
||||||
if (isset($_POST['command']) && $_POST['command'] == 'SaveConfig') {
|
if (isset($_POST['command']) && $_POST['command'] == 'SaveConfig') {
|
||||||
|
// Confirm password
|
||||||
|
if (! check_bbs_auth($user, $_POST['confirm_password'])) {
|
||||||
|
$message = '<b>Password Incorrect</b><br />Please try again';
|
||||||
|
retry_configuration($message);
|
||||||
|
}
|
||||||
if ($OVERRIDES['disable_change_name'] != true) {
|
if ($OVERRIDES['disable_change_name'] != true) {
|
||||||
if (trim($_POST['display_name']) == '') {
|
if (trim($_POST['display_name']) == '') {
|
||||||
$_POST['display_name'] = $user;
|
$_POST['display_name'] = $user;
|
||||||
|
@ -223,67 +229,59 @@ if (isset($_POST['command']) && $_POST['command'] == 'SaveConfig') {
|
||||||
$value = false;
|
$value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isset($OVERRIDES['reserved_names'])) {
|
if (isset($OVERRIDES['reserved_names'])) {
|
||||||
$reserved_names = $OVERRIDES['reserved_names'];
|
$reserved_names = $OVERRIDES['reserved_names'];
|
||||||
} else {
|
} else {
|
||||||
$reserved_names = array("admin", "sysop");
|
$reserved_names = array(
|
||||||
|
"admin",
|
||||||
|
"sysop"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if(isset($OVERRIDES['duplicate_aliases'])) {
|
if (isset($OVERRIDES['duplicate_aliases'])) {
|
||||||
$dupe_ok = $OVERRIDES['duplicate_aliases'];
|
$dupe_ok = $OVERRIDES['duplicate_aliases'];
|
||||||
} else {
|
} else {
|
||||||
$dupe_ok = false;
|
$dupe_ok = false;
|
||||||
}
|
}
|
||||||
foreach($reserved_names as $name) {
|
foreach ($reserved_names as $name) {
|
||||||
if(strtolower($_POST['display_name']) == strtolower($name)) {
|
if (strtolower($_POST['display_name']) == strtolower($name)) {
|
||||||
// It's a reserved alias
|
// It's a reserved alias
|
||||||
echo '<b>' . $_POST['display_name'] . "</b> is unavailable.<br />Please try again";
|
$message = '<b>' . $_POST['display_name'] . "</b> is unavailable.<br />Please try again";
|
||||||
echo '<form target="' . $frame['content'] . '" method="post" action="user.php">';
|
retry_configuration($message);
|
||||||
echo '<input name="command" type="hidden" id="command" value="Configuration" readonly="readonly">';
|
|
||||||
echo "<input type='hidden' name='username' value='" . $_POST['username'] . "' />";
|
|
||||||
echo '<button class="np_button_link" type="submit">Return to Configuration</button>';
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($value && (strtolower($_POST['display_name']) != $user)) {
|
if ($value && (strtolower($_POST['display_name']) != $user)) {
|
||||||
// It's someone else's username or alias
|
// It's someone else's username or alias
|
||||||
echo '<b>' . $_POST['display_name'] . "</b> is unavailable.<br />Please try again";
|
$message = '<b>' . $_POST['display_name'] . "</b> is unavailable.<br />Please try again";
|
||||||
echo '<form target="' . $frame['content'] . '" method="post" action="user.php">';
|
retry_configuration($message);
|
||||||
echo '<input name="command" type="hidden" id="command" value="Configuration" readonly="readonly">';
|
|
||||||
echo "<input type='hidden' name='username' value='" . $_POST['username'] . "' />";
|
|
||||||
echo '<button class="np_button_link" type="submit">Return to Configuration</button>';
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
// Validate email format
|
// Validate email format
|
||||||
if (filter_var($_POST['display_email'], FILTER_VALIDATE_EMAIL) == false) {
|
if (filter_var($_POST['display_email'], FILTER_VALIDATE_EMAIL) == false) {
|
||||||
// Email address format invalid. Format is important but does not need to be a real address
|
// Email address format invalid. Format is important but does not need to be a real address
|
||||||
echo '</b> Display email format appears incorrect:<br><b>' . $_POST['display_email'] . '</b><br />Please try again';
|
$message = '</b> Display email format appears incorrect:<br><b>' . $_POST['display_email'] . '</b><br />Please try again';
|
||||||
echo '<form target="' . $frame['content'] . '" method="post" action="user.php">';
|
retry_configuration($message);
|
||||||
echo '<input name="command" type="hidden" id="command" value="Configuration" readonly="readonly">';
|
|
||||||
echo "<input type='hidden' name='username' value='" . $_POST['username'] . "' />";
|
|
||||||
echo '<button class="np_button_link" type="submit">Return to Configuration</button>';
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
// Check if email already exists in user database
|
// Check if email already exists in user database
|
||||||
if ($founduser = check_registered_email_addresses(trim($_POST['display_email']))) {
|
if ($founduser = check_registered_email_addresses(trim($_POST['display_email']))) {
|
||||||
// Email exists in database
|
// Email exists in database
|
||||||
if (strtolower($user) != strtolower($founduser)) {
|
if (strtolower($user) != strtolower($founduser)) {
|
||||||
// It's someone else's email
|
// It's someone else's email
|
||||||
echo '<b>' . $_POST['display_email'] . "</b> is unavailable.<br />Please try again";
|
$message = '<b>' . $_POST['display_email'] . "</b> is unavailable.<br />Please try again";
|
||||||
echo '<form target="' . $frame['content'] . '" method="post" action="user.php">';
|
retry_configuration($message);
|
||||||
echo '<input name="command" type="hidden" id="command" value="Configuration" readonly="readonly">';
|
|
||||||
echo "<input type='hidden' name='username' value='" . $_POST['username'] . "' />";
|
|
||||||
echo '<button class="np_button_link" type="submit">Return to Configuration</button>';
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// New passwords do not match
|
||||||
|
if ($_POST['password'] !== $_POST['password2']) {
|
||||||
|
$message = '<b> New password entries do not match</b><br />Please try again';
|
||||||
|
retry_configuration($message);
|
||||||
|
}
|
||||||
$user_config['display_name'] = trim($_POST['display_name']);
|
$user_config['display_name'] = trim($_POST['display_name']);
|
||||||
$user_config['display_email'] = trim($_POST['display_email']);
|
$user_config['display_email'] = trim($_POST['display_email']);
|
||||||
// Apply alias into $config_dir/aliases_conf
|
// Apply alias into $config_dir/aliases_conf
|
||||||
if(strtolower($user_config['display_name'] != strtolower($_POST['username']))) {
|
if (strtolower($user_config['display_name'] != strtolower($_POST['username']))) {
|
||||||
$value_unique = true;
|
$value_unique = true;
|
||||||
if($dupe_ok) {
|
if ($dupe_ok) {
|
||||||
foreach($dupe_ok as $dupe) {
|
foreach ($dupe_ok as $dupe) {
|
||||||
if($dupe == strtolower($_POST['username'])) {
|
if ($dupe == strtolower($_POST['username'])) {
|
||||||
$value_unique = false;
|
$value_unique = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +293,7 @@ if (isset($_POST['command']) && $_POST['command'] == 'SaveConfig') {
|
||||||
$user_config['signature'] = $_POST['signature'];
|
$user_config['signature'] = $_POST['signature'];
|
||||||
$user_config['xface'] = $_POST['xface'];
|
$user_config['xface'] = $_POST['xface'];
|
||||||
$user_config['timezone'] = $_POST['timezone'];
|
$user_config['timezone'] = $_POST['timezone'];
|
||||||
$user_config['theme'] = $_POST['listbox'];
|
$user_config['theme'] = $_POST['theme'];
|
||||||
$user_config['hide_unsub'] = $_POST['hide_unsub'];
|
$user_config['hide_unsub'] = $_POST['hide_unsub'];
|
||||||
file_put_contents($config_dir . '/userconfig/' . $user . '.config', serialize($user_config));
|
file_put_contents($config_dir . '/userconfig/' . $user . '.config', serialize($user_config));
|
||||||
$_SESSION['theme'] = $user_config['theme'];
|
$_SESSION['theme'] = $user_config['theme'];
|
||||||
|
@ -315,7 +313,13 @@ if (isset($_POST['command']) && $_POST['command'] == 'SaveConfig') {
|
||||||
if ($userdata) {
|
if ($userdata) {
|
||||||
ksort($userdata);
|
ksort($userdata);
|
||||||
}
|
}
|
||||||
echo 'Configuration Saved for ' . $_POST['username'];
|
// Save new password
|
||||||
|
if ((trim($_POST['password']) != '') && ($_POST['password'] == $_POST['password2'])) {
|
||||||
|
$userFilename = $config_dir . '/users/' . strtolower($user);
|
||||||
|
file_put_contents($userFilename, password_hash($_POST['password'], PASSWORD_DEFAULT));
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<center>Configuration Saved for ' . $_POST['username'] . '</center>';
|
||||||
} else {
|
} else {
|
||||||
$user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . $user . '.config'));
|
$user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . $user . '.config'));
|
||||||
}
|
}
|
||||||
|
@ -350,6 +354,16 @@ if ($OVERRIDES['disable_change_name'] != true) {
|
||||||
}
|
}
|
||||||
sort($themes);
|
sort($themes);
|
||||||
if (isset($_POST['command']) && $_POST['command'] == 'Configuration') {
|
if (isset($_POST['command']) && $_POST['command'] == 'Configuration') {
|
||||||
|
// Use modifications from retry configuration
|
||||||
|
if ($_POST['retry'] == "retry") {
|
||||||
|
$display_name = $_POST['display_name'];
|
||||||
|
$display_email = $_POST['display_email'];
|
||||||
|
$user_config['signature'] = $_POST['signature'];
|
||||||
|
$user_config['xface'] = urldecode($_POST['xface']);
|
||||||
|
$user_config['hide_unsub'] = $_POST['hide_unsub'];
|
||||||
|
$user_config['subscribed'] = $_POST['subscribed'];
|
||||||
|
$user_config['theme'] = $_POST['theme'];
|
||||||
|
}
|
||||||
// Show Config
|
// Show Config
|
||||||
echo '<hr><h1 class="np_thread_headline"></h1>';
|
echo '<hr><h1 class="np_thread_headline"></h1>';
|
||||||
echo '<table cellspacing="0" width="100%" class="np_results_table">';
|
echo '<table cellspacing="0" width="100%" class="np_results_table">';
|
||||||
|
@ -377,13 +391,13 @@ if (isset($_POST['command']) && $_POST['command'] == 'Configuration') {
|
||||||
echo '</textarea></td>';
|
echo '</textarea></td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
// Theme
|
// Theme
|
||||||
if (isset($user_config['theme'])) {
|
if (isset($user_config['theme']) && trim($user_config['theme']) != '') {
|
||||||
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Theme: (' . $user_config['theme'] . ')</h3></td>';
|
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Theme: (' . $user_config['theme'] . ')</h3></td>';
|
||||||
} else {
|
} else {
|
||||||
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Theme:</h3></td>';
|
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Theme:</h3></td>';
|
||||||
}
|
}
|
||||||
echo '</tr><tr><td class="np_result_line1" style="word-wrap:break-word">';
|
echo '</tr><tr><td class="np_result_line1" style="word-wrap:break-word">';
|
||||||
echo '<select name="listbox" class="theme_listbox" size="10">';
|
echo '<select name="theme" class="theme_listbox" size="10">';
|
||||||
foreach ($themes as $theme) {
|
foreach ($themes as $theme) {
|
||||||
if ($theme == $user_config['theme']) {
|
if ($theme == $user_config['theme']) {
|
||||||
echo '<option value="' . $theme . '" selected="selected">' . $theme . '</option>';
|
echo '<option value="' . $theme . '" selected="selected">' . $theme . '</option>';
|
||||||
|
@ -395,20 +409,21 @@ if (isset($_POST['command']) && $_POST['command'] == 'Configuration') {
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
// Subscriptions
|
// Subscriptions
|
||||||
if(!isset($user_config['hide_unsub'])) {
|
if (! isset($user_config['hide_unsub'])) {
|
||||||
$user_config['hide_unsub'] = 'show';
|
$user_config['hide_unsub'] = 'show';
|
||||||
}
|
}
|
||||||
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Subscribed:</h3></td>';
|
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Subscriptions:</h3></td>';
|
||||||
echo '<tr><td class="np_result_line1" style="word-wrap:break-word";>';
|
echo '<tr><td class="np_result_line1" style="word-wrap:break-word";>';
|
||||||
|
echo ' While viewing section pages:<br />';
|
||||||
|
|
||||||
if($user_config['hide_unsub'] == 'hide') {
|
if ($user_config['hide_unsub'] == 'hide') {
|
||||||
echo '<input type="radio" name="hide_unsub" id="hide" value="hide" checked="checked">';
|
echo '<input type="radio" name="hide_unsub" id="hide" value="hide" checked="checked">';
|
||||||
} else {
|
} else {
|
||||||
echo '<input type="radio" name="hide_unsub" id="hide" value="hide">';
|
echo '<input type="radio" name="hide_unsub" id="hide" value="hide">';
|
||||||
}
|
}
|
||||||
echo '<label for="hide_unsub"> Hide Unsubscribed Groups</label><br />';
|
echo '<label for="hide_unsub"> Hide Unsubscribed Groups</label><br />';
|
||||||
|
|
||||||
if($user_config['hide_unsub'] == 'show') {
|
if ($user_config['hide_unsub'] == 'show') {
|
||||||
echo '<input type="radio" name="hide_unsub" id="show" value="show" checked="checked">';
|
echo '<input type="radio" name="hide_unsub" id="show" value="show" checked="checked">';
|
||||||
} else {
|
} else {
|
||||||
echo '<input type="radio" name="hide_unsub" id="show" value="show">';
|
echo '<input type="radio" name="hide_unsub" id="show" value="show">';
|
||||||
|
@ -416,21 +431,47 @@ if (isset($_POST['command']) && $_POST['command'] == 'Configuration') {
|
||||||
echo '<label for="hide_unsub"> Show All Groups</label>';
|
echo '<label for="hide_unsub"> Show All Groups</label>';
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
|
|
||||||
|
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Subscribed groups:</h3></td>';
|
||||||
echo '</tr><tr><td class="np_result_line1" style="word-wrap:break-word";><textarea class="configuration" id="subscribed" name="subscribed" rows="10" cols="40">';
|
echo '</tr><tr><td class="np_result_line1" style="word-wrap:break-word";><textarea class="configuration" id="subscribed" name="subscribed" rows="10" cols="40">';
|
||||||
|
// print_r($user_config['subscribed']);
|
||||||
|
|
||||||
|
if (isset($user_config['subscribed'])) {
|
||||||
|
$userdata = $user_config['subscribed'];
|
||||||
|
print_r($user_config['subscribed']);
|
||||||
|
} else {
|
||||||
foreach ($userdata as $key => $value) {
|
foreach ($userdata as $key => $value) {
|
||||||
if($key == "DO.NOT.DELETE") {
|
if ($key == "DO.NOT.DELETE") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
echo $key . "\n";
|
echo $key . "\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
echo '</textarea></td>';
|
echo '</textarea></td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
|
||||||
|
// User Display Name
|
||||||
|
echo '<tr>';
|
||||||
|
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>New password: </h3>';
|
||||||
|
echo '<input name="password" type="password" id="password" maxlength="40"></td>';
|
||||||
|
echo '</tr>';
|
||||||
|
// User Display Email
|
||||||
|
echo '<tr>';
|
||||||
|
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Re-enter new password: </h3>';
|
||||||
|
echo '<input name="password2" type="password" id="password2" maxlength="40"></td>';
|
||||||
|
echo '</tr>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* // Timezone
|
* // Timezone
|
||||||
* echo '<td class="np_result_line1" style="word-wrap:break-word";>Timezone offset (+/- hours from UTC):</td>';
|
* echo '<td class="np_result_line1" style="word-wrap:break-word";>Timezone offset (+/- hours from UTC):</td>';
|
||||||
* echo '</tr><tr><td class="np_result_line1" style="word-wrap:break-word";><input type="text" name="timezone" value="'.$user_config[timezone].'"></td>';
|
* echo '</tr><tr><td class="np_result_line1" style="word-wrap:break-word";><input type="text" name="timezone" value="'.$user_config[timezone].'"></td>';
|
||||||
* echo '</tr>';
|
* echo '</tr>';
|
||||||
*/
|
*/
|
||||||
|
// Password confirmation
|
||||||
|
echo '<tr>';
|
||||||
|
echo '<td class="np_result_line2" style="word-wrap:break-word";><h3>Current password: </h3><h4>(required)</h4>';
|
||||||
|
echo '<input name="confirm_password" type="password" id="confirm_password" maxlength="40"></td>';
|
||||||
|
echo '</tr>';
|
||||||
|
|
||||||
echo '<td class="np_result_line2" style="word-wrap:break-word";>';
|
echo '<td class="np_result_line2" style="word-wrap:break-word";>';
|
||||||
echo '<button class="np_button_link" type="submit">Save Configuration</button>';
|
echo '<button class="np_button_link" type="submit">Save Configuration</button>';
|
||||||
echo '<a href="' . $_SERVER['PHP_SELF'] . '">Cancel</a>';
|
echo '<a href="' . $_SERVER['PHP_SELF'] . '">Cancel</a>';
|
||||||
|
@ -442,4 +483,23 @@ if (isset($_POST['command']) && $_POST['command'] == 'Configuration') {
|
||||||
echo '<br />';
|
echo '<br />';
|
||||||
}
|
}
|
||||||
include "tail.inc";
|
include "tail.inc";
|
||||||
?>
|
|
||||||
|
function retry_configuration($message)
|
||||||
|
{
|
||||||
|
echo '<center>';
|
||||||
|
echo $message;
|
||||||
|
echo '<form target="' . $frame['content'] . '" method="post" action="user.php">';
|
||||||
|
echo '<input name="command" type="hidden" id="command" value="Configuration" readonly="readonly">';
|
||||||
|
echo "<input type='hidden' name='retry' value='retry' />";
|
||||||
|
echo "<input type='hidden' name='username' value='" . $_POST['username'] . "' />";
|
||||||
|
echo "<input type='hidden' name='display_name' value='" . $_POST['display_name'] . "' />";
|
||||||
|
echo "<input type='hidden' name='display_email' value='" . $_POST['display_email'] . "' />";
|
||||||
|
echo "<input type='hidden' name='signature' value='" . $_POST['signature'] . "' />";
|
||||||
|
echo "<input type='hidden' name='xface' value='" . urlencode($_POST['xface']) . "' />";
|
||||||
|
echo "<input type='hidden' name='hide_unsub' value='" . $_POST['hide_unsub'] . "' />";
|
||||||
|
echo "<input type='hidden' name='subscribed' value='" . $_POST['subscribed'] . "' />";
|
||||||
|
echo "<input type='hidden' name='theme' value='" . $_POST['theme'] . "' />";
|
||||||
|
echo '<button class="np_button_link" type="submit">Return to Configuration</button>';
|
||||||
|
echo '</center>';
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue