Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
if(!defined('DOKU_INC')) die();

if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
require_once(DOKU_PLUGIN . 'action.php');
// Using autoloading instead of require_once for better compatibility

class action_plugin_statistics extends DokuWiki_Action_Plugin {

Expand Down Expand Up @@ -113,13 +113,13 @@ function loglogins(Doku_Event $event, $param) {
$act = $this->_act_clean($event->data);
if($act == 'logout') {
$type = 'o';
} elseif($_SERVER['REMOTE_USER'] && $act == 'login') {
if($_REQUEST['r']) {
} elseif(isset($_SERVER['REMOTE_USER']) && $_SERVER['REMOTE_USER'] && $act == 'login') {
if(isset($_REQUEST['r']) && $_REQUEST['r']) {
$type = 'p';
} else {
$type = 'l';
}
} elseif($_REQUEST['u'] && !$_REQUEST['http_credentials'] && !$_SERVER['REMOTE_USER']) {
} elseif(isset($_REQUEST['u']) && $_REQUEST['u'] && !isset($_REQUEST['http_credentials']) && !isset($_SERVER['REMOTE_USER'])) {
$type = 'f';
}
if(!$type) return;
Expand Down
9 changes: 6 additions & 3 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,14 @@ public function getMenuSort() {
* handle user request
*/
public function handle() {
$this->opt = preg_replace('/[^a-z]+/', '', $_REQUEST['opt']);
$this->opt = preg_replace('/[^a-z]+/', '', isset($_REQUEST['opt']) ? $_REQUEST['opt'] : '');
if(!in_array($this->opt, $this->allowedpages)) $this->opt = 'dashboard';

$this->start = (int) $_REQUEST['s'];
$this->setTimeframe($_REQUEST['f'], $_REQUEST['t']);
$this->start = (int) (isset($_REQUEST['s']) ? $_REQUEST['s'] : 0);
$this->setTimeframe(
isset($_REQUEST['f']) ? $_REQUEST['f'] : '',
isset($_REQUEST['t']) ? $_REQUEST['t'] : ''
);
}

/**
Expand Down
5 changes: 4 additions & 1 deletion helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ public function runSQL($sql_string) {

$result = mysqli_query($link, $sql_string);
if($result === false) {
dbglog('DB Error: ' . mysqli_error($link) . ' ' . hsc($sql_string), -1);
// Using modern logger instead of deprecated dbglog
if (class_exists('\dokuwiki\Logger')) {
\dokuwiki\Logger::error('DB Error: ' . mysqli_error($link) . ' ' . hsc($sql_string));
}
msg('DB Error: ' . mysqli_error($link) . ' ' . hsc($sql_string), -1);
return null;
}
Expand Down
7 changes: 6 additions & 1 deletion img.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
$plugin = plugin_load('helper', 'statistics');
try {
if(!auth_ismanager()) throw new Exception('Access denied');
$plugin->Graph()->render($_REQUEST['img'], $_REQUEST['f'], $_REQUEST['t'], $_REQUEST['s']);
$plugin->Graph()->render(
isset($_REQUEST['img']) ? $_REQUEST['img'] : '',
isset($_REQUEST['f']) ? $_REQUEST['f'] : '',
isset($_REQUEST['t']) ? $_REQUEST['t'] : '',
isset($_REQUEST['s']) ? $_REQUEST['s'] : ''
);
} catch(Exception $e) {
$plugin->sendGIF(false);
}
Expand Down
2 changes: 1 addition & 1 deletion inc/StatisticsBrowscap.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct() {
* @return string
*/
protected function _getRemoteData($url) {
$http = new DokuHTTPClient($url);
$http = new \dokuwiki\HTTP\DokuHTTPClient($url);
$file = $http->get($url);
if(!$file)
throw new Exception('Your server can\'t connect to external resources. Please update the file manually.');
Expand Down
Loading