Skip to content

Commit

Permalink
updated to 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbaseman committed Oct 4, 2016
1 parent 97003ab commit b7f2ab7
Show file tree
Hide file tree
Showing 21 changed files with 650 additions and 341 deletions.
56 changes: 56 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
* -----------------------------------------------------------------------------------------
* MODULE VERSION HISTORY
* -----------------------------------------------------------------------------------------
* v1.0.3 stable (jacobi22: 19.04.2016)
+ fix Output array (show Notice in PHP 5.3.28 - thx to hgs)
+ add sortable Groups

* v1.0.2 stable (jacobi22: 06.04.2016)
+ display Usergroups

* v1.0.1 stable (jacobi22: 26.03.2016)
* + add sort function
* + add colored lines for user groups
* + show time since last login in minutes & hours
* + thx for english and dutch translation to CodeaLot & Sky Writer

* v1.0.0 stable (jacobi22: 26.03.2016)
* rebuild to new module structure
*
* v0.32 stable (evaki: Sep 15, 2012)
* + fixed E_STRICT-Notice in tool.php [function.mktime] (since php 5.1) changed to time()
*
* v0.30 stable (doc: Mar 13, 2009)
* + updated module according guidelines introduced in the "Module Primer"
* + removed support for WB 2.6.x (only supports WB 2.7 or higher)
*
* v0.21 stable (doc: Sep 28, 2008)
* + applied module functions introduced with WB 2.7 (/framework/module.functions.php)
* + added module variable $module_requirements to info.php
*
* v0.20 stable (doc: Sep 27, 2008)
* + seperated HTML / CSS and PHP by using the phplib template class
* + moved CSS styles to backend.css file
* + introduction of Zend coding guidelines (http://framework.zend.com/manual/de/coding-standard.html)
*
* v0.14 stable (doc: Dec 07, 2007)
* + fixed bug in tool.php (displayed wrong login information for users never logged in so far)
* + applied common WB version numbering to index.php
*
* v0.13 beta (davon: Dec 06, 2007)
* + added IP Check (including quick mouseover (title tag) infos)
* + small changes at the information layout
* + changed displaying of the full email adress into simple "Mailto" with mouseover title tag
*
* v0.12 beta (doc: Dec 01, 2006)
* + changed module function from page to tool (thanks to ruebenwurzel)
* + added language support via language files (GERMAN and ENGLISH available so far)
* + added some CSS styles to format the output table
*
* v0.11 alpha (doc: Nov 30, 2006)
* + added output of days inactive and mailto: link (posted in forum as: "User Infos")
*
* v0.10 alpha (doc: Nov 30, 2006)
* + initial release of the module (posted in forum as: "User Infos")
* ------------------------------------------------------------------------------------------------
*/
23 changes: 23 additions & 0 deletions addon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/*
*
* @category Addons
* @package Admin tool: User Statistics
* @copyright Uwe Jacobsen <[email protected]>, Christian Sommer, Evaki
* @author Uwe Jacobsen <[email protected]>, Christian Sommer, Evaki
* @license http://www.gnu.org/licenses/gpl.html GPL License
* @version 1.0.3
* @lastmodified $Date: $
* @since File available since 2016-03-24
* @description xyz
*/
/* -------------------------------------------------------- */
// Must include code to stop this file being accessed directly
if (!defined('WB_PATH')) { throw new Exception('Cannot access the addon \"'.basename(__DIR__).'\" directly'); }
/* -------------------------------------------------------- */

// set the name of the addon
$sAddonName = basename(__DIR__);
include(dirname(__DIR__).'/SimpleCommandDispatcher.inc');

// end of file
36 changes: 14 additions & 22 deletions backend.css
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
/**
* Admin tool: User Statistics
*
* This admin tool provides details about registered Website Baker
* users from the Website Baker users database table.
/**
* @category Addons
* @package Admin tool: User Statistics
* @copyright Uwe Jacobsen <[email protected]>, Christian Sommer, Evaki
* @author Uwe Jacobsen <[email protected]>, Christian Sommer, Evaki
* @license http://www.gnu.org/licenses/gpl.html GPL License
* @version 1.0.3
* @lastmodified $Date: $
* @since File available since 2016-03-24
* @description settings for wysiwyg editor
*
* This file contains the CSS definitions for the backend.
*
* LICENSE: GNU General Public License 3.0
*
* @author Christian Sommer
* @copyright Christian Sommer (c) 2006-2009
* @license http://www.gnu.org/licenses/gpl.html
* @version 0.30
* @platform Website Baker 2.7
/**
* backend.css
*/

div.userstat thead {
background-color: #C7D1DB;
}

div.userstat thead td {
font-weight: bold;
}

div.userstat tr.even {
background-color: #EEEEF0;
}
/* switch path to default or oldstyle */
@import url("themes/default/css/backend_default.css");
157 changes: 157 additions & 0 deletions cmd/cmdTool.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<?php
/**
*
/**
* @category Addons
* @package Admin tool: User Statistics
* @copyright Uwe Jacobsen <[email protected]>, Christian Sommer, Evaki
* @author Uwe Jacobsen <[email protected]>, Christian Sommer, Evaki
* @license http://www.gnu.org/licenses/gpl.html GPL License
* @version 1.0.3
* @lastmodified $Date: $
* @since File available since 2016-03-24
* @description settings for wysiwyg editor
*
/**
* cmdTool.php
/* -------------------------------------------------------- */
// Must include code to stop this file being accessed directly
if(defined('WB_PATH') == false) { die('Illegale file access /'.basename(__DIR__).'/'.basename(__FILE__).''); }
/* -------------------------------------------------------- */

if( !$admin->get_permission($sAddonName,'module' ) ) {
$admin->print_error($MESSAGE['ADMIN_INSUFFICIENT_PRIVELLIGES'], $js_back);
}
$sort = '';
$orderby = "active";
$sGroupOrder = "group_id";
$ordering = "DESC";
$sUsersort = 'U1';
$sUsersortClass = 'indiff';
$sTimeSort = 'T1';
$sTimeSortClass = 'indiff';
$sActiveSort = 'A1';
$sActiveSortClass = 'indiff';
$sGroupSort = 'G1';
$sGroupSortClass = 'indiff';
if (isset($_POST['U1']))$sort = $_POST['U1']; // sort by title
elseif (isset($_POST['U2'])) $sort = $_POST['U2']; // sort by time stamp
elseif (isset($_POST['T1'])) $sort = $_POST['T1'];
elseif (isset($_POST['T2'])) $sort = $_POST['T2'];
elseif (isset($_POST['A1'])) $sort = $_POST['A1'];
elseif (isset($_POST['A2'])) $sort = $_POST['A2'];
elseif (isset($_POST['G1'])) $sort = $_POST['G1'];
elseif (isset($_POST['G2'])) $sort = $_POST['G2'];

switch ($sort){

//displayname
case 'U1': $orderby = "display_name"; $ordering = "ASC"; $adtitle = 'asc'; $sUsersort = 'U2'; $sUsersortClass = "asc"; break;
case 'U2': $orderby = "display_name"; $ordering = "DESC"; $adtitle = 'desc'; $sUsersortClass = "desc"; break;

// inactive time
case 'T1': $orderby = "login_when"; $ordering = "ASC"; $sTimeSort = 'T2'; $sTimeSortClass = "asc"; break;
case 'T2': $orderby = "login_when"; $ordering = "DESC"; $sTimeSortClass = "desc"; break;
// inactive vs active
case 'A1': $orderby = "active"; $ordering = "ASC"; $sActiveSort = 'A2'; $sActiveSortClass = "asc"; break;
case 'A2': $orderby = "active"; $ordering = "DESC"; $sActiveSortClass = "desc"; break;
// inactive vs active
case 'G1': $orderby = "group_id"; $ordering = "ASC"; $sGroupSort = 'G2'; $sGroupSortClass = "asc"; break;
case 'G2': $orderby = "group_id"; $ordering = "DESC"; $sGroupSortClass = "desc"; break;


}
// create template object
$oTpl = new Template($sAddonThemePath);
$oTpl->set_var($MOD_USERSTATS);

$oTpl->set_file('page', 'backend_view.htt');
$oTpl->set_block('page', 'user_list', 'user_list_handle');
$oTpl->set_block('page', 'user_table', 'user_table_handle');

$query = 'SELECT `user_id`,`group_id`,`username`,`display_name`,`login_when`,`email`,`active` FROM `'.TABLE_PREFIX.'users` '
.'ORDER BY `'.$orderby.'` '.$ordering.' '
.' ';
$results = $database->query ($query );

if (!$results || $results && $results->numRows() == 0) {
// database query failed or no users in database
$oTpl->set_var('TXT_MESSAGE', $MOD_USERSTATS['TXT_ERROR_DATABASE']);

// clear the blocks not required
$oTpl->set_var('user_list_handle', '');
$oTpl->set_var('user_table_handle', '');

} else {
$oTpl->set_var('TXT_MESSAGE', $MOD_USERSTATS['TXT_DESCRIPTION']);

// loop over all users and add one row per user to the template
$i = 1;
while($row = $results->fetchRow(MYSQLI_ASSOC)) {


// Get Groupname from database
$sql = 'SELECT `name` FROM `'.TABLE_PREFIX.'groups`'
.'WHERE `group_id` = '.$row['group_id'].' ';
$sGroupName = $database->get_one($sql);

$sAccountStatus = ( $row['active'] == 1) ? $MOD_USERSTATS['ACC_ACTIVE'] : $MOD_USERSTATS['ACC_INACTIVE'];
$sSuperUserCSS = ($row['user_id']== 1) ? 'active' : '';
$sUserActiveCSS = ( $row['active'] == 1) ? ($i % 2 == 0) ? 'aeven' : 'even' : 'inactive';
$sLastLoginMin = 0;
$sLastLogin = '';
$sOnlineTimeMin = (round((time() - (int) $row['login_when']) / (3600 * 24)));
$sOnlineTime = ($row['login_when'] == 0) ? '-' : $sOnlineTimeMin." ".$MOD_USERSTATS['TXT_DAYS'];


if($sOnlineTime == 0 && $sLastLoginMin == 0){
$sLastLoginMin = (round(abs(time() - (int) $row['login_when']) / 60));
$sLastLogin = $sLastLoginMin.' '.$MOD_USERSTATS['TXT_MINUTES'];
$sLastLogin = $MOD_USERSTATS['TXT_VOR'].$sLastLogin;
}
if($sOnlineTimeMin == 0 && $sLastLoginMin >=60){
$sOnTime2 = (round(abs(time() - (int) $row['login_when']) / (3600)));
$sOnTime2Hours = (floor($sLastLoginMin/60));
$sOnTime2Mins = (($sLastLoginMin%60)< 10) ? '0'.($sLastLoginMin%60) : ($sLastLoginMin%60);

$sLastLogin = $sOnTime2Hours.":".$sOnTime2Mins." ".$MOD_USERSTATS['TXT_HOURS'];
$sLastLogin = $MOD_USERSTATS['TXT_VOR'].$sLastLogin;
}
$sLastLogin = ($row['login_when'] == 0) ? '-' : $sLastLogin;
$bOnlineTime = ( $sOnlineTime == 0 ) ? $sLastLogin : $sOnlineTime;
// replace dynamic template placeholders with values from database
$oTpl->set_var(array(
'DISPLAYNAME' => htmlentities(ucwords($row['display_name'])),
'USERNAME' => htmlentities(($row['username'])),
'LAST_LOGIN' => date((($row['login_when'] == 0) ? '-' : $MOD_USERSTATS['DATE_FORMAT']), (int) $row['login_when']),
'LAST_LOGIN_SINCE' => $sLastLogin,
'DAYS_INACTIVE' => $bOnlineTime,
'USER_EMAIL' => htmlentities($row['email']),
'ACTION_URL' => ADMIN_URL.'/admintools/tool.php?tool=userstat',
'USERSORT' => $sUsersort,
'USERSORTCSS' => $sUsersortClass,
'TIMESORT' => $sTimeSort,
'TIMESORTCSS' => $sTimeSortClass,
'ACTIVESORT' => $sActiveSort,
'ACTIVESORTCSS' => $sActiveSortClass,
'ACTIVE' => $sAccountStatus,
'UserActiveCSS' => $sUserActiveCSS,
'SuperUserCSS' => $sSuperUserCSS,
'GROUPSORT' => $sGroupSort,
'GROUPSORTCSS' => $sGroupSortClass,
'USERGROUP' => $sGroupName,
'TXT_TH_GROUPS' => $MOD_USERSTATS['TXT_TH_GROUPS']
)
);

// add template values in append mode (add per loop)
$oTpl->parse('user_list_handle', 'user_list', true);
$i++;
}
// parse the final template block
$oTpl->parse('user_table_handle', 'user_table');
}

// ouput the final template
$oTpl->pparse('output', 'page');
// end of file
23 changes: 23 additions & 0 deletions cmd/cmdUninstall.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
*
/**
* @category Addons
* @package Admin tool: User Statistics
* @copyright Uwe Jacobsen <[email protected]>, Christian Sommer, Evaki
* @author Uwe Jacobsen <[email protected]>, Christian Sommer, Evaki
* @license http://www.gnu.org/licenses/gpl.html GPL License
* @version 1.0.3
* @lastmodified $Date: $
* @since File available since 2016-03-24
* @description settings for wysiwyg editor
*
/**
* cmdUninstall.php
/* -------------------------------------------------------- */
// Must include code to stop this file being accessed directly
if(defined('WB_PATH') == false) { die('Illegale file access /'.basename(__DIR__).'/'.basename(__FILE__).''); }
/* -------------------------------------------------------- */


// end of file
23 changes: 23 additions & 0 deletions cmd/cmdUpgrade.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
*
/**
* @category Addons
* @package Admin tool: User Statistics
* @copyright Uwe Jacobsen <[email protected]>, Christian Sommer, Evaki
* @author Uwe Jacobsen <[email protected]>, Christian Sommer, Evaki
* @license http://www.gnu.org/licenses/gpl.html GPL License
* @version 1.0.3
* @lastmodified $Date: $
* @since File available since 2016-03-24
* @description settings for wysiwyg editor
*
/**
* cmdUpgrade.php
/* -------------------------------------------------------- */
// Must include code to stop this file being accessed directly
if(defined('WB_PATH') == false) { die('Illegale file access /'.basename(__DIR__).'/'.basename(__FILE__).''); }
/* -------------------------------------------------------- */


// end of file
37 changes: 20 additions & 17 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
<?php
/**
* Admin tool: User Statistics
*
* This admin tool provides details about registered Website Baker
* users from the Website Baker users database table.
* @category Addons
* @package Admin tool: User Statistics
* @copyright Uwe Jacobsen <[email protected]>, Christian Sommer, Evaki
* @author Uwe Jacobsen <[email protected]>, Christian Sommer, Evaki
* @license http://www.gnu.org/licenses/gpl.html GPL License
* @version 1.0.3
* @lastmodified $Date: $
* @since File available since 2016-03-24
* @description folder protection file for userstat
*
* This file prevents directory listing.
*
* LICENSE: GNU General Public License 3.0
*
* @author Christian Sommer
* @copyright Christian Sommer (c) 2006-2009
* @license http://www.gnu.org/licenses/gpl.html
* @version 0.30
* @platform Website Baker 2.7
*/

// prevent directory listing
header('Location: ../../index.php');
*
* index.php
*/
/* -------------------------------------------------------- */
// Must include code to stop this file being accessed directly
if(!defined('WB_PATH')) {
require_once( dirname(dirname(__DIR__)).'/framework/globalExceptionHandler.php');
throw new IllegalFileException();
}
/* -------------------------------------------------------- */

?>
// end of file
Loading

0 comments on commit b7f2ab7

Please sign in to comment.