Signed-off-by: NurPech <nurpech@nurpech.de>
<?php
/* czncadmin.php - main script - ZNCAdmin
* Copyright (C) 2011-2012 Philipp Kreil (pk910)
<?php
/* czncadmin.php - main script - ZNCAdmin
* Copyright (C) 2011-2012 Philipp Kreil (pk910)
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
error_reporting(E_ALL & ~E_NOTICE);
*/
error_reporting(E_ALL & ~E_NOTICE);
case "search":
zncadmin_search();
break;
case "search":
zncadmin_search();
break;
zncadmin_seen();
break;
case "resetpass":
zncadmin_seen();
break;
case "resetpass":
foreach($in as $item) {
$out[] = "\\".$item;
}
foreach($in as $item) {
$out[] = "\\".$item;
}
array_push($in,"*");
array_push($out,"(.*)");
}
array_push($in,"*");
array_push($out,"(.*)");
}
$skip = (preg_match("#^".preg_prepare($flagval)."$#i", $zncserver['name']) != $positive);
break;
default:
$skip = (preg_match("#^".preg_prepare($flagval)."$#i", $zncserver['name']) != $positive);
break;
default:
//SUBCOMMAND: search
function zncadmin_seen() {
global $argv, $zncservers;
//SUBCOMMAND: search
function zncadmin_seen() {
global $argv, $zncservers;
- $time = $argv[2];
- $over_time = true;
- if($time[0] == '>' || $time[0] == '<') {
- if($time[0] == '<') $over_time = false;
- $time = substr($time, 1);
- }
- $time = time() - str2time($time);
+ $time = $argv[2];
+ $over_time = true;
+ if($time[0] == '>' || $time[0] == '<') {
+ if($time[0] == '<') $over_time = false;
+ $time = substr($time, 1);
+ }
+ $time = time() - str2time($time);
$mask = $argv[3];
if(!$time) {
error("missing time parameter");
$mask = $argv[3];
if(!$time) {
error("missing time parameter");
//SUBCOMMAND: stats
function zncadmin_stats() {
//SUBCOMMAND: stats
function zncadmin_stats() {
- global $argv, $zncservers;
+ global $argv, $zncservers, $force;
+ $server = $argv[2];
$table = new Table(6);
$table->add("Server", "Port / SSL Port", "Total ZNC's", "Connected (IRC)", "Online (User)", "Protected?");
$count = 0;
foreach($zncservers as $zncserver) {
$table = new Table(6);
$table->add("Server", "Port / SSL Port", "Total ZNC's", "Connected (IRC)", "Online (User)", "Protected?");
$count = 0;
foreach($zncservers as $zncserver) {
+ if($server > 0 && $zncserver['name'] != $server) continue;
+ if($server > 0 && $zncserver['name'] == $server && $zncserver['protected'] === true && !$force) {
+ error("Access denied\n");
+ return;
+ }
+
$total = 0;
$connected = 0;
$online = 0;
$total = 0;
$connected = 0;
$online = 0;