Clean up some warnings.

This commit is contained in:
Retro_Guy 2023-05-14 11:37:10 -07:00
parent 09deebae1a
commit 798eadcebb
13 changed files with 53 additions and 52 deletions

View File

@ -15,5 +15,7 @@ if(isset($config_name) && file_exists($config_dir.$config_name.'.inc.php')) {
/* Include main config file for rslight */
$CONFIG = include $config_file;
ini_set('error_reporting', E_ERROR );
if(!file_exists($config_dir.'/DEBUG')) {
ini_set('error_reporting', E_ERROR );
}
?>

View File

@ -1,7 +1,6 @@
<html>
<head>
<?php
session_start();
if (basename(getcwd()) == 'mods') {
$rootdir = "../../";
} else {
@ -23,21 +22,22 @@ $linklist = file($config_dir."links.conf", FILE_IGNORE_NEW_LINES);
if(isset($_COOKIE['mail_name']) && isset($_COOKIE['pkey'])) {
$user = strtolower($_COOKIE['mail_name']);
if(!isset($_SESSION['theme']) && file_exists($config_dir.'/userconfig/'.$user.'.config')) {
$user_config = unserialize(file_get_contents($config_dir.'/userconfig/'.$user.'.config'));
$_SESSION['theme'] = $user_config['theme'];
}
} else {
unset($user);
}
if(!isset($_SESSION['theme']) && file_exists($config_dir.'/userconfig/'.$user.'.config')) {
$user_config = unserialize(file_get_contents($config_dir.'/userconfig/'.$user.'.config'));
$_SESSION['theme'] = $user_config['theme'];
}
if(trim($_SESSION['theme']) !== '') {
if(isset($_SESSION['theme'])) {
//if(trim($_SESSION['theme']) !== '') {
echo '<link rel="stylesheet" type="text/css" href="../common/themes/'.$_SESSION['theme'].'/style.css">';
} else {
echo '<link rel="stylesheet" type="text/css" href="'.$rootdir.'common/themes/Default Theme/style.css">';
}
if (file_exists($rootdir.'common/themes/'.$_SESSION['theme'].'/images/rocksolidlight.png')) {
if ((isset($_SESSION['theme'])) && file_exists($rootdir.'common/themes/'.$_SESSION['theme'].'/images/rocksolidlight.png')) {
$header_image=$rootdir.'common/themes/'.$_SESSION['theme'].'/images/rocksolidlight.png';
} else {
$header_image=$rootdir.'common/images/rocksolidlight.png';
@ -61,7 +61,7 @@ if (file_exists($rootdir.'common/themes/'.$_SESSION['theme'].'/images/rocksolidl
</td>
<td align="right">
<?php
if($user && check_unread_mail() == true) {
if(isset($user) && $user && check_unread_mail() == true) {
$unread = true;
} else {
$unread = false;
@ -119,11 +119,9 @@ ob_end_clean();
}
// If $config_dir/motd.txt is not blank, show it
$m = file_get_contents($config_dir.'/motd.txt');
if (trim($m) !== '' ) {
$motd = $m;
if(file_exists($config_dir.'/motd.txt')) {
$motd = file_get_contents($config_dir.'/motd.txt');
}
echo '<p align="center">';
echo '<table cellpadding="0" cellspacing="0" class="np_header_bar_large"><tr>';
foreach($menulist as $menu) {

View File

@ -61,6 +61,9 @@
$_SESSION['rsactive'] = true;
if(!isset($_SERVER['REQUEST_STRING'])) {
$_SERVER['REQUEST_STRING'] = '';
}
$location = $_SERVER['REQUEST_URI'].$_SERVER['REQUEST_STRING'];
$_SESSION['return_page'] = $location.'#'.$id;

View File

@ -1,6 +0,0 @@
<?php
if(($iconv_enable==true) &&
(!function_exists("iconv")))
die('There is no iconv-extension in PHP. set <tt>$iconv_enable=false</tt>
in config.inc.php to disable automatic charset recoding.');
?>

View File

@ -29,9 +29,6 @@ $CONFIG = include($config_file);
$logdir=$spooldir.'/log';
$lockdir=$spooldir.'/lock';
if(!file_exists($config_dir.'/debug')) {
ini_set('error_reporting', E_ERROR );
}
/* Permanent configuration changes */
@mkdir($logdir,0755,'recursive');
@mkdir($spooldir.'/upload',0755,'recursive');
@ -233,9 +230,6 @@ if((isset($group)) && (isset($group_config))) {
}
}
// check the settings
include "lib/check.php";
// load the english language definitions first because some of the other
// definitions are incomplete
include("lang/english.lang");

View File

@ -489,7 +489,9 @@ function display_full_headers($article,$group,$name,$from,$getface=false) {
}
$message=file($thisgroup."/".$article, FILE_IGNORE_NEW_LINES);
}
unlink($sendface);
if(isset($sendface)) {
unlink($sendface);
}
$isface = 0;
foreach($message as $line) {
if(trim($line) == '') {
@ -511,6 +513,7 @@ function display_full_headers($article,$group,$name,$from,$getface=false) {
if(stripos($line, 'Xref: ') === 0) {
continue;
}
$return = '';
if(stripos($line, 'From: ') === 0) {
$return.='From: ';
if(isset($CONFIG['hide_email']) && $CONFIG['hide_email'] == true) {
@ -527,7 +530,7 @@ function display_full_headers($article,$group,$name,$from,$getface=false) {
$return.=mb_decode_mimeheader(htmlspecialchars($line)).'<br />';
}
if($getface) {
if($sendface) {
if(isset($sendface)) {
return($sendface);
} else {
return FALSE;
@ -610,6 +613,9 @@ function message_show($group,$id,$attachment=0,$article_data=false,$maxlen=false
$article_data=message_read($id,$attachment,$group);
$head=$article_data->header;
$local_poster=false;
if(!isset($head->rslight_site)) {
$head->rslight_site = '';
}
if(password_verify($CONFIG['thissitekey'].$head->id, $head->rslight_site)) {
$local_poster=true;
}

View File

@ -68,6 +68,7 @@ function thread_pageselect($group,$article_count,$first) {
function thread_cache_load($group) {
global $spooldir,$compress_spoolfiles;
$filename=$spooldir."/".$group."-data.dat";
$waiting = 0;
$now = time();
while(file_exists($filename."-writing")) {
$waiting = 1;
@ -686,7 +687,7 @@ function formatTreeText($tree) {
* format the subject inside the thread
*/
function thread_format_subject($c,$group,$highlightids=false) {
global $file_article, $thread_maxSubject, $frame_article, $thread_show, $spooldir, $CONFIG;
global $file_article, $thread_maxSubject, $frame_article, $frame, $thread_show, $spooldir, $CONFIG;
if(isset($_COOKIE['tzo'])) {
$offset=$_COOKIE['tzo'];
} else {
@ -849,9 +850,9 @@ function thread_format_lastmessage($c,$group='') {
}
if($ovfound == 1) {
$url = 'article-flat.php?id='.$found['number'].'&group='.urlencode($group).'#'.$found['number'];
$return.='<p class=np_posted_date_left><a href="'.$url.'">'.get_date_interval(date("D, j M Y H:i T",$c->date_thread)).'</a>';
$return='<p class=np_posted_date_left><a href="'.$url.'">'.get_date_interval(date("D, j M Y H:i T",$c->date_thread)).'</a>';
} else {
$return.='<p class=np_posted_date_left>'.get_date_interval(date("D, j M Y H:i T",$c->date_thread)).'</p>';
$return='<p class=np_posted_date_left>'.get_date_interval(date("D, j M Y H:i T",$c->date_thread)).'</p>';
}
$return.='<p class=np_posted_date_left>By: '.create_name_link($poster_name, $name_from).'</p>';
return($return);

View File

@ -683,12 +683,14 @@ function groups_show($gruppen) {
$groupdisplay.=create_name_link(mb_decode_mimeheader($lastarticleinfo['name']), $lastarticleinfo['from']);
$groupdisplay.='</td></tr></table>';
}
$groupdisplay.="\n";
flush();
if(isset($userdata[$g->name])) {
$subs[] = $groupdisplay;
} else {
$nonsubs[] = $groupdisplay;
if(isset($groupdisplay)) {
$groupdisplay.="\n";
flush();
if(isset($userdata[$g->name])) {
$subs[] = $groupdisplay;
} else {
$nonsubs[] = $groupdisplay;
}
}
} // END
foreach($subs as $sub) {
@ -1090,6 +1092,10 @@ function group_display_name($gname)
function check_bbs_auth($username, $password) {
global $config_dir,$CONFIG;
if($username == '' && $password == '') {
return false;
}
$workpath = $config_dir."users/";
$username = trim(strtolower($username));
$userFilename = $workpath.$username;

View File

@ -322,7 +322,7 @@ function display_threads($threads, $oldest) {
}
function show_overboard_header($grouplist) {
global $text_thread, $text_article, $file_index, $file_thread, $user_time;
global $text_thread, $frame, $text_article, $file_index, $file_thread, $user_time;
if (isset($_GET['thisgroup'])) {
echo '<h1 class="np_thread_headline">';

View File

@ -66,7 +66,9 @@ if(isset($frames_on) && $frames_on === true) {
$userdata[$group] = time();
file_put_contents($userfile, serialize($userdata));
}
if(!isset($_SERVER['REQUEST_STRING'])) {
$_SERVER['REQUEST_STRING'] = '';
}
$_SESSION['return_page'] = $_SERVER['REQUEST_URI'].$_SERVER['REQUEST_STRING'];
echo '<a name="top"></a>';

View File

@ -11,7 +11,7 @@ include "newsportal.php";
$offset=$CONFIG['timezone'];
}
if($_REQUEST['command'] == 'Show' && password_verify($CONFIG['thissitekey'], $_REQUEST['key'])) {
if((isset($_REQUEST['command']) && $_REQUEST['command'] == 'Show') && password_verify($CONFIG['thissitekey'], $_REQUEST['key'])) {
$getfilename = $spooldir.'/upload/'.$_REQUEST['showfile'];
$getfh = fopen($getfilename, "rb");
$getfile = fread($getfh, filesize($getfilename));
@ -30,8 +30,6 @@ include "head.inc";
echo '<td>';
echo '<form target="'.$frame['content'].'" method="post" action="files.php">';
echo '<input name="command" type="hidden" id="command" value="Browse" readonly="readonly">';
echo '<input type="hidden" name="username" value="'.$_POST['username'].'">';
echo '<input type="hidden" name="password" value="'.$_POST['password'].'">';
echo '<button class="np_button_link" type="submit">Browse</button>';
echo '</form>';
echo '</td>';
@ -39,8 +37,6 @@ include "head.inc";
echo '<td>';
echo '<form target="'.$frame['content'].'" method="post" action="upload.php">';
echo '<input name="command" type="hidden" id="command" value="Upload" readonly="readonly">';
echo '<input type="hidden" name="username" value="'.$_POST['username'].'">';
echo '<input type="hidden" name="password" value="'.$_POST['password'].'">';
echo '<button class="np_button_link" type="submit">Upload</button>';
echo '</form>';
echo '</td>';
@ -67,8 +63,6 @@ include "head.inc";
echo '<form name="browse" method="post" action="files.php" enctype="multipart/form-data">';
echo '<input name="command" type="hidden" id="command" value="Browse" readonly="readonly">';
echo '<input type="hidden" name="key" value="'.password_hash($CONFIG['thissitekey'], PASSWORD_DEFAULT).'">';
echo '<input type="hidden" name="username" value="'.$_POST['username'].'">';
echo '<input type="hidden" name="password" value="'.$_POST['password'].'">';
echo '<select name="listbox">';
foreach($users as $user) {
$num = count(scandir($spooldir.'/upload/'.$user.'/')) - 2;

View File

@ -25,8 +25,6 @@ include "head.inc";
echo '<td>';
echo '<form target="'.$frame['content'].'" method="post" action="files.php">';
echo '<input name="command" type="hidden" id="command" value="Browse" readonly="readonly">';
echo '<input type="hidden" name="username" value="'.$_POST['username'].'">';
echo '<input type="hidden" name="password" value="'.$_POST['password'].'">';
echo '<button class="np_button_link" type="submit">Browse</button>';
echo '</form>';
echo '</td>';
@ -34,15 +32,13 @@ include "head.inc";
echo '<td>';
echo '<form target="'.$frame['content'].'" method="post" action="upload.php">';
echo '<input name="command" type="hidden" id="command" value="Upload" readonly="readonly">';
echo '<input type="hidden" name="username" value="'.$_POST['username'].'">';
echo '<input type="hidden" name="password" value="'.$_POST['password'].'">';
echo '<button class="np_button_link" type="submit">Upload</button>';
echo '</form>';
echo '</td>';
echo '<td width=100%></td></tr></table>';
echo '<hr>';
if(isset($_FILES)) {
if(isset($_FILES['photo'])) {
$_FILES['photo']['name'] = preg_replace('/[^a-zA-Z0-9\.]/', '_', $_FILES['photo']['name']);
// Check auth here
if(isset($_POST['key']) && password_verify($CONFIG['thissitekey'].$_POST['username'], $_POST['key'])) {
@ -63,7 +59,6 @@ if(isset($_FILES)) {
echo 'There was an error saving '.$_FILES['photo']['name'];
}
}
$authkey = password_hash($_POST['username'].$keys[0].get_user_config($_POST['username'],'encryptionkey'), PASSWORD_DEFAULT);
?>
<script type="text/javascript">
if (navigator.cookieEnabled)
@ -81,6 +76,12 @@ if(isset($_FILES)) {
echo '<table border="0" align="center" cellpadding="0" cellspacing="1">';
echo '<form name="form1" method="post" action="upload.php" enctype="multipart/form-data">';
if(!isset($_POST['username'])) {
$_POST['username'] = '';
}
if(!isset($_POST['password'])) {
$_POST['password'] = '';
}
if(!check_bbs_auth($_POST['username'], $_POST['password'])) {
echo '<tr><td><strong>Please Login to Upload<br /></strong></td></tr>';
echo '<tr><td>Username:</td><td><input name="username" type="text" id="username" value="'.$name.'"></td></tr>';

View File

@ -1 +1 @@
0.8.0
0.8.2