Display number of users in thread.php
This commit is contained in:
parent
ec635be396
commit
d12f36e1dd
|
@ -109,6 +109,7 @@ sed -i '' -e "s|<anonymous_password>|$anonymous_password|" $configpath/rslight.i
|
||||||
sed -i '' -e "s|<local_password>|$local_password|" $configpath/rslight.inc.php
|
sed -i '' -e "s|<local_password>|$local_password|" $configpath/rslight.inc.php
|
||||||
sed -i '' -e "s|<admin_password>|$admin_password|" $configpath/admin.inc.php
|
sed -i '' -e "s|<admin_password>|$admin_password|" $configpath/admin.inc.php
|
||||||
sed -i '' -e "s|<admin_key>|$admin_key|" $configpath/admin.inc.php
|
sed -i '' -e "s|<admin_key>|$admin_key|" $configpath/admin.inc.php
|
||||||
|
sed -i '' -e "s|<sessions_path>|/var/lib/php/sessions|" $configpath/rslight.inc.php
|
||||||
echo "done"
|
echo "done"
|
||||||
echo
|
echo
|
||||||
echo "***************************************************"
|
echo "***************************************************"
|
||||||
|
|
|
@ -108,6 +108,7 @@ sed -i '' -e "s|<anonymous_password>|$anonymous_password|" $configpath/rslight.i
|
||||||
sed -i '' -e "s|<local_password>|$local_password|" $configpath/rslight.inc.php
|
sed -i '' -e "s|<local_password>|$local_password|" $configpath/rslight.inc.php
|
||||||
sed -i '' -e "s|<admin_password>|$admin_password|" $configpath/admin.inc.php
|
sed -i '' -e "s|<admin_password>|$admin_password|" $configpath/admin.inc.php
|
||||||
sed -i '' -e "s|<admin_key>|$admin_key|" $configpath/admin.inc.php
|
sed -i '' -e "s|<admin_key>|$admin_key|" $configpath/admin.inc.php
|
||||||
|
sed -i '' -e "s|<sessions_path>|/tmp|" $configpath/rslight.inc.php
|
||||||
echo "done"
|
echo "done"
|
||||||
echo
|
echo
|
||||||
echo "***************************************************"
|
echo "***************************************************"
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<center>
|
<?php
|
||||||
<font size="1em">
|
echo '<center>';
|
||||||
<i>rocksolid light</i> 0.6.9
|
echo '<font size="1em">';
|
||||||
<br />
|
echo '<i>rocksolid light</i> 0.6.9';
|
||||||
<a href="https://github.com/novabbs/rocksolid-light" target=_blank>clearnet</a>
|
echo '<br />';
|
||||||
<a href="http://rslight.i2p/getrslight" target=_blank>i2p</a>
|
echo '<a href="https://github.com/novabbs/rocksolid-light" target=_blank>clearnet</a>';
|
||||||
<a href="http://git.fuwafuwaqtlkkxwc.onion/novabbs/rocksolid-light" target=_blank>tor</a>
|
echo '<a href="http://rslight.i2p/getrslight" target=_blank>i2p</a>';
|
||||||
</font>
|
echo '<a href="http://git.fuwafuwaqtlkkxwc.onion/novabbs/rocksolid-light" target=_blank>tor</a>';
|
||||||
</center>
|
echo '</font>';
|
||||||
|
echo '</center>';
|
||||||
|
?>
|
||||||
|
|
|
@ -137,5 +137,7 @@ if(isset($frames_on) && $frames_on === true) {
|
||||||
} else {
|
} else {
|
||||||
echo $text_register["no_access_group"];
|
echo $text_register["no_access_group"];
|
||||||
}
|
}
|
||||||
|
$sessions_data = file_get_contents($spooldir.'/sessions.dat');
|
||||||
|
echo '<h1 class="np_thread_headline">'.$sessions_data.'</h1>';
|
||||||
include "tail.inc";
|
include "tail.inc";
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -37,7 +37,7 @@ return [
|
||||||
'spamc' => 'spamc',
|
'spamc' => 'spamc',
|
||||||
'spamgroup' => 'rocksolid.spam',
|
'spamgroup' => 'rocksolid.spam',
|
||||||
'php_exec' => 'php',
|
'php_exec' => 'php',
|
||||||
'tac' => 'tac',
|
'tac' => '<sessions_path>',
|
||||||
'webserver_user' => '<webserver_user>',
|
'webserver_user' => '<webserver_user>',
|
||||||
'enable_nocem' => '',
|
'enable_nocem' => '',
|
||||||
'nocem_groups' => 'rocksolid.spam',
|
'nocem_groups' => 'rocksolid.spam',
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
include "config.inc.php";
|
||||||
|
include ("$file_newsportal");
|
||||||
|
if(trim($CONFIG['tac'] == '')) {
|
||||||
|
if(is_file($spooldir.'/sessions.dat')) {
|
||||||
|
unlink($spooldir.'/sessions.dat');
|
||||||
|
}
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
count_users();
|
||||||
|
|
||||||
|
function count_users() {
|
||||||
|
GLOBAL $CONFIG, $spooldir;
|
||||||
|
$session_age = 300;
|
||||||
|
$session_save_file = $spooldir.'/sessions.dat';
|
||||||
|
$session_dir = $CONFIG['tac'];
|
||||||
|
$session_files = scandir($session_dir);
|
||||||
|
$count = 0;
|
||||||
|
foreach($session_files as $session_file) {
|
||||||
|
if(filemtime($session_dir.'/'.$session_file) < time() - $session_age) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(strpos($session_file, 'sess_') === 0) {
|
||||||
|
$contents = file_get_contents($session_dir.'/'.$session_file);
|
||||||
|
if(strpos($contents, 'starttime') !== false) {
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($count == 1) {
|
||||||
|
$are = 'is';
|
||||||
|
$users = 'user';
|
||||||
|
} else {
|
||||||
|
$are = 'are';
|
||||||
|
$users = 'users';
|
||||||
|
}
|
||||||
|
$session_info = '<h1 class="np_thread_headline">There '.$are.' currently '.$count.' '. $users.' online</h1>'."\r\n";
|
||||||
|
file_put_contents($session_save_file, $session_info);
|
||||||
|
}
|
||||||
|
?>
|
|
@ -25,11 +25,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose($fp1);
|
fclose($fp1);
|
||||||
exec($CONFIG['php_exec']." ".$config_dir."scripts/nntp.php > /dev/null 2>&1");
|
exec($CONFIG['php_exec']." ".$config_dir."/scripts/nntp.php > /dev/null 2>&1");
|
||||||
if(is_numeric($CONFIG['local_ssl_port'])) {
|
if(is_numeric($CONFIG['local_ssl_port'])) {
|
||||||
exec($CONFIG['php_exec']." ".$config_dir."scripts/nntp-ssl.php > /dev/null 2>&1");
|
exec($CONFIG['php_exec']." ".$config_dir."/scripts/nntp-ssl.php > /dev/null 2>&1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
# Generate user count file (must be root)
|
||||||
|
exec($CONFIG['php_exec']." ".$config_dir."/scripts/count_users.php");
|
||||||
|
echo "Updated user count\n";
|
||||||
/* Change to non root user */
|
/* Change to non root user */
|
||||||
$uinfo=posix_getpwnam($CONFIG['webserver_user']);
|
$uinfo=posix_getpwnam($CONFIG['webserver_user']);
|
||||||
change_identity($uinfo["uid"],$uinfo["gid"]);
|
change_identity($uinfo["uid"],$uinfo["gid"]);
|
||||||
|
@ -39,7 +42,7 @@
|
||||||
|
|
||||||
if(isset($CONFIG['enable_nocem']) && $CONFIG['enable_nocem'] == true) {
|
if(isset($CONFIG['enable_nocem']) && $CONFIG['enable_nocem'] == true) {
|
||||||
@mkdir($spooldir."nocem",0755,'recursive');
|
@mkdir($spooldir."nocem",0755,'recursive');
|
||||||
exec($CONFIG['php_exec']." ".$config_dir."scripts/nocem.php");
|
exec($CONFIG['php_exec']." ".$config_dir."/scripts/nocem.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
reset($menulist);
|
reset($menulist);
|
||||||
|
@ -51,14 +54,14 @@ foreach($menulist as $menu) {
|
||||||
chdir("../".$menuitem[0]);
|
chdir("../".$menuitem[0]);
|
||||||
# Send articles
|
# Send articles
|
||||||
echo "Sending articles\n";
|
echo "Sending articles\n";
|
||||||
echo exec($CONFIG['php_exec']." ".$config_dir."scripts/send.php");
|
echo exec($CONFIG['php_exec']." ".$config_dir."/scripts/send.php");
|
||||||
# Refresh spool
|
# Refresh spool
|
||||||
if(isset($spoolnews) && ($spoolnews == true)) {
|
if(isset($spoolnews) && ($spoolnews == true)) {
|
||||||
exec($CONFIG['php_exec']." ".$config_dir."scripts/spoolnews.php");
|
exec($CONFIG['php_exec']." ".$config_dir."/scripts/spoolnews.php");
|
||||||
echo "Refreshed spoolnews\n";
|
echo "Refreshed spoolnews\n";
|
||||||
}
|
}
|
||||||
# Expire articles
|
# Expire articles
|
||||||
exec($CONFIG['php_exec']." ".$config_dir."scripts/expire.php");
|
exec($CONFIG['php_exec']." ".$config_dir."/scripts/expire.php");
|
||||||
echo "Expired articles\n";
|
echo "Expired articles\n";
|
||||||
}
|
}
|
||||||
# Rotate log files
|
# Rotate log files
|
||||||
|
|
|
@ -51,7 +51,7 @@ return [
|
||||||
|
|
||||||
# Executables on your system
|
# Executables on your system
|
||||||
'php_exec' => 'The path to php, or just php if it is already in your path',
|
'php_exec' => 'The path to php, or just php if it is already in your path',
|
||||||
'tac' => 'The shell command to display a file in reverse (Try tac, or tail -r)',
|
'tac' => 'Path to php session files (leave empty to not display number of users online)',
|
||||||
'webserver_user' => 'The user that your webserver runs as',
|
'webserver_user' => 'The user that your webserver runs as',
|
||||||
|
|
||||||
# NOCEM
|
# NOCEM
|
||||||
|
|
Loading…
Reference in New Issue