Fork me on GitHub

Search

Donat-O-Meter

Make donations with PayPal!
Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00

Learn XOOPS Core

Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

- 2 2.5 2.6 3.0 4 6 adslight Android AntiHarvesting AntiMalUser AntiSpam API Apple Battlefield billige Bootstrap By Captcha cell cent chronolabs CHUNG Clicks content CĂN demo Digitally docek download Dresses evden eve facebook Fat floor Food for free Gateway Google Guide herre Honeypot HP Human HỘ IP iPhone jQuery Language Law Legal List log Loss module modules Monster new newbb news NHÀ online PARK Payment phone PHP Prevention profile project Protector publisher RESIDENCE responsive review Rights rmcommon security Sentry Signatures Signed site Smartphone Smoking Solution Spam Studio tdmcreate template The Theme themes web weight xoops Xortify XPayment

New Users

Registering user

# 137911

mydarkglobe

Welcome to XOOPS!




Bottom   Previous Topic   Next Topic  |  Register To Post

(1) 2 3 4 ... 8 »


#1 Posted on: 2013/2/26 8:56 Userlog: a new module to log user activities
Irmtfan has created a fantastic module for tracking user activities called Userlog (see here the News).

Irmtfan, this is a very cool module, and for an Alpha, extremely stable! I think, it will be an excellent tool for an admin to see what is going on.

Few issues/comments:

- it doesn't run on PHP 5.4. I always suggest now to test all modules on PHP 5.4, because many of the hosts are currently switching to PHP 5.4. If it runs on PHP 5.4, then it should run on PHP 5.3 as well, as long as we don't add any PHP 5.4 specific features. Plus, PHP 5.4 is stricter in error reporting, so it actually helps in testing by reporting errors that wouldn't show in PHP 5.3

- we need to change the module logo to our standard XOOPS "Blue Move" logo. If you need help, let me know

- in Help, the name of the module should provide a link back to the module

- the ASC ordering in column titles doesn't work - it is always DESC

- Did you measure how his module impacts overall performance on a busy site (like what you have)?

- what is the difference between logs in the DB and logs in the file. In Preferences you can set a file, but when is the data stored in DB, and when in a file? Is the data automatically moved from DB to the logfile?

Suggestions for next releases:

- add "Purge" tab, to be able to delete selected entries manually (with option to delete, or export and then delete). Right now you can only set it in Preferences

- add "Export" tab, to export as CSV or Excel files for selected entries (like selected users or selected dates)

- and for release 2.0 or 3.0, it would be interesting to link Userlog to entries in Protector, to for example, select a suspicious activity in Protector, and then see all entries for the same IP from the Userlog. Or the opposite - select IP or User in Userlog, and see if there were any entries in the Protector.

Overall, it is an AWESOME module, and you've done a FANTASTIC job with it!
Congratulations!

Top


Please support XOOPS & DONATE
Use 2.5.7 | Debugging | Requests | Bugs
Mamba
Joined:
2004/4/23 13:58
From Ohio, USA
Group:
Webmaster
Registered Users
Designer Group
Posts: 8136
(Show More) (Show Less)


#2 Posted on: 2013/2/26 9:42 Re: Userlog: a new module to log user activities
Hello
I get an error
Resized Image

configuration:Version de XOOPS XOOPS 2.5.5
Version de PHP 5.3.3-7+squeeze14
Version de MySQL 5.1.66-0+squeeze1
API serveur apache2handler
OS Linux
safe_mode Off
register_globals Off
magic_quotes_gpc Off
allow_url_fopen On
fsockopen On
allow_call_time_pass_reference Off
post_max_size 8M
max_input_time 60
output_buffering 4096
max_execution_time 30
memory_limit 128M
file_uploads On
upload_max_filesize 7M

Top

tatane
Joined:
2008/5/6 11:51
From FRANCE
Group:
Registered Users
Posts: 501
(Show More) (Show Less)


#3 Posted on: 2013/2/26 12:11 Re: Userlog: a new module to log user activities
Quote:
I get an error

You just need to create the folder manually.

However, when I saved the preferences, the folder has been created automatically.

In future XOOPS modules, as a standard, we should report missing folders, and provide a link or button next to the error report, to create them.

Or the module creates all the required folders during installation, and reports missing folders, if it was not able to create them.

Top


Please support XOOPS & DONATE
Use 2.5.7 | Debugging | Requests | Bugs
Mamba
Joined:
2004/4/23 13:58
From Ohio, USA
Group:
Webmaster
Registered Users
Designer Group
Posts: 8136
(Show More) (Show Less)


#4 Posted on: 2013/2/26 20:29 Re: Userlog: a new module to log user activities
Thank you Mamba. please add this module to the SVN under XoopsModules branch.

As i wrote in the news, I dont name it Alpha because of stability. I call it Alpha because im not sure about anything in this module like the structures and features. nothing is final in this module. once we finalize all my doubts about this module we can release a final version soon.

I wrote this module because i find it a big missing part in XOOPS. this module was far from my abilities but i release the first alpha version anyway to have something in hand to show the community what is missing in XOOPS.
I also had this intention to develop it as a real community driven project.
In the coding part:
unfortunately now in xoops we have less than 10 active free developers so we should work together to reach to the best outcome. Now there is an unwritten rule in xoops that one developer write a module as an close project then release it and in sometimes the developer leave xoops and the module get orphaned. i really want to break it and do a real teamwork.
so i invite all developers to come here and read this topic, review this module codes (I will explain all codes in the module help), advise me, share better codes with us and commit to the SVN.

I want to invite Mage, Trabis, Mamba, timgno, zyspec, red, voltan, mojtaba, peekey, black_beard, alfred and all other developers that i cannot remember there names to come here and share in developments. please lets make it a community project.

In non coding part:
please report me any feature you think we should add to a log module.
Now please focus on feature rather than reporting bugs. bugs can wait for beta versions. focus on structure and let me know your ideas. i will explain more in module help and document parts.

ok lets back to the module.
I think this module is vital for any CMS. here is my proposal that force me to write this module.

1- a log system. we simply need to know what is happening in our websites. if your site make bigger your problems will be bigger too. eg: you will be in more trouble finding issues come from all admins have some permissions.

2- a view/read/unread/new nodes system. Now all modules have a counter to count views. but today this counter is useless. it just count every views without telling us about who is viewing and when the item is viewed
we really need this feature in xoops. i introduce it in this module but it is really basic now and needs your attentions.

3- a login history: im not sure about it. i just want to log the login and logouts. now this module is doing it. but i want to now what you want to see for example in a login history block.
Quote:

it doesn't run on PHP 5.4.

this module should work in 5.4 what is the issue?

Quote:

- we need to change the module logo to our standard XOOPS "Blue Move" logo. If you need help, let me know

yes i need all your helps.

Quote:

Did you measure how his module impacts overall performance on a busy site (like what you have)?


I did my best for it. Im sure it will not cause more trouble than protector but i dont test it in real environments.

Quote:

- add "Purge" tab, to be able to delete selected entries manually (with option to delete, or export and then delete). Right now you can only set it in Preferences

- add "Export" tab, to export as CSV or Excel files for selected entries (like selected users or selected dates)

- and for release 2.0 or 3.0, it would be interesting to link Userlog to entries in Protector, to for example, select a suspicious activity in Protector, and then see all entries for the same IP from the Userlog. Or the opposite - select IP or User in Userlog, and see if there were any entries in the Protector.


yes i also think about them. there is an automatic purge in the module now. i wanted to release it as soon as possible but i will add purge, export and other things.

the file logging is incomplete now i will complete it soon.
also we really need to integrate this module with logger and protector in 2.6

@tatane:
thank you i just add that config in hurry. but once you add a setting and start to log some users the folder will be created automatically.
I will solve that.

thank you for your suggestions.


Top

irmtfan
Joined:
2003/12/7 14:14
From In the middle of nowhere
Group:
Registered Users
Community Coordinator (temporary)
Posts: 3371
(Show More) (Show Less)


#5 Posted on: 2013/2/26 22:25 Re: Userlog: a new module to log user activities
Quote:
I want to invite Mage, Trabis, Mamba, timgno, zyspec, red, voltan, mojtaba, peekey, black_beard, alfred and all other developers that i cannot remember there names to come here and share in developments. please lets make it a community project.

Yes, I can only second that! This is critical in order to move XOOPS forward!

Quote:
this module should work in 5.4 what is the issue?

This is what I am getting:
Quote:
Fatal error: require_once(): Failed opening required 'PEAR/Config.php' (include_path='.;s:\wamp64\bin\php\php5.4.8\pear') in S:\wamp64\bin\php\php5.4.8\PEAR\Common.php on line 836
Call Stack
# Time Memory Function Location
1 0.0012 306224 {main}( ) ..\index.php:0
2 0.1075 5529800 xoops_cp_header( ) ..\index.php:25
3 0.1097 5745144 XoopsGuiDefault->header( ) ..\cp_functions.php:29
4 0.1097 5747312 XoopsSystemGui->header( ) ..\default.php:51
5 0.1206 6431864 XoopsPreload->triggerEvent( ) ..\gui.php:90
6 0.1206 6432848 call_user_func ( ) ..\preload.php:140
7 0.1207 6432880 UserlogCorePreload::eventSystemClassGuiHeader( ) ..\preload.php:140
8 0.1209 6448072 include( 'S:\wamp64\www\xtest256a6\modules\userlog\include\log.php' ) ..\core.php:42
9 0.1223 6602920 include_once( 'S:\wamp64\bin\php\php5.4.8\PEAR\Common.php' ) ..\log.php:28

I do have issues with PEAR locally, but on PHP 5.3.21 it works without any problems. Is there any dependency on PEAR in your code?

Quote:
I call it Alpha because im not sure about anything in this module like the structures and features. nothing is final in this module. once we finalize all my doubts about this module we can release a final version soon.

You've done already an excellent job with it! But if you're looking for more ideas, I've just added some new screenshots of features that I would like to see in every XOOPS Module, see the Standardization discussion. It doesn't mean that all of these features have to be included, but as we develop new modules, it's good to discuss the standards, and potentially improve them, and make it easier for users and developers.

I also emailed you four logos for your review.

Top


Please support XOOPS & DONATE
Use 2.5.7 | Debugging | Requests | Bugs
Mamba
Joined:
2004/4/23 13:58
From Ohio, USA
Group:
Webmaster
Registered Users
Designer Group
Posts: 8136
(Show More) (Show Less)


#6 Posted on: 2013/2/27 2:25 Re: Userlog: a new module to log user activities
Ok now it is in the svn:

https://sourceforge.net/p/xoops/svn/11113/tree/XoopsModules/userlog

Quote:

we need to change the module logo

Now it is fixed thanks to Mamba.

Quote:

- in Help, the name of the module should provide a link back to the module

fixed. more help added. IMO it is now clear.

Quote:

the ASC ordering in column titles doesn't work - it is always DESC

I cannot reproduce it. where? in admin/logs.php everything is ok.

Quote:

what is the difference between logs in the DB and logs in the file.

Now it just store logs in file and you can find them in the folder and review them manually. but i must find some time to work on showing the content of file in a nice way in admin.

@tatane:
your reported issue had been fixed thank you. I must install the fresh module before submit news !!!

I add this in module docs for developers attention:
Quote:

developers help for userlog module.

1- log user activities structure.
I assume we need to gather below information from user. If you have any idea about them please let me know.
i dont sanitize them because i want to log them as ther are. what is your idea. Im a very basic programmer. please help me.

in userlog/class/setting.php

public function getOptions($option null$V "value")
    {
        
$V strtolower($V);
        
        if (
$this->userlog->getUser()) {
            
$uid $this->userlog->getUser()->getVar('uid');
            
$uname $this->userlog->getUser()->getVar('uname');
            
$last_login $this->userlog->getUser()->getVar('last_login');
            
$admin $this->userlog->getUser()->isAdmin();
            
$groups "g" implode("g",$this->userlog->getUser()->getGroups()); // g1g2
        
} else {
            
$uid 0;
            
$uname '';
            
$last_login 0;
            
$admin 0;
            
$groups "g" XOOPS_GROUP_ANONYMOUS// g3
        
}
        
$options = array(
        
"log_id" =>        array(    "type" => "int",
                                
"title" => _AM_USERLOG_LOG_ID,
                                
"value" => null // null for now
                                
),
        
"log_time" =>    array(    "type" => "int",
                                
"title" => _AM_USERLOG_LOG_TIME,
                                
"value" => time()
                                ),
        
"uid" =>         array(    "type" => "int",
                                
"title" => _AM_USERLOG_UID,
                                
"value" => $uid
                                
),
        
"uname" =>        array(    "type" => "text",
                                
"title" => _AM_USERLOG_UNAME,
                                
"value" => $uname
                                
),
        
"admin" =>         array(    "type" => "bool",
                                
"title" => _AM_USERLOG_ADMIN,
                                
"value" => $admin
                                
),
        
"groups" =>        array(    "type" => "text",
                                
"title" => _AM_USERLOG_GROUPS,
                                
"value" => $groups
                                
),
        
"last_login" =>    array(    "type" => "int",
                                
"title" => _AM_USERLOG_LAST_LOGIN,
                                
"value" => $last_login
                                
),
        
"user_ip" =>    array(    "type" => "text",
                                
"title" => _AM_USERLOG_USER_IP,
                                
"value" => $_SERVER['REMOTE_ADDR']
                                ),
        
"user_agent" => array(    "type" => "text",
                                
"title" => _AM_USERLOG_USER_AGENT,
                                
"value" => $_SERVER['HTTP_USER_AGENT']
                                ),
        
"url" =>         array(    "type" => "text",
                                
"title" => _AM_USERLOG_URL,
                                
"value" => $_SERVER['REQUEST_URI']
                                ),
        
"script" =>     array(    "type" => "text",
                                
"title" => _AM_USERLOG_SCRIPT,
                                
"value" => end(explode('/',$_SERVER['PHP_SELF']))
                                ),
        
"referer" =>     array(    "type" => "text",
                                
"title" => _AM_USERLOG_REFERER,
                                
"value" => !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ""
                                
),
        
"pagetitle" =>     array(    "type" => "text",
                                
"title" => _AM_USERLOG_PAGETITLE,
                                
"value" => isset($GLOBALS['xoopsTpl']) ? $GLOBALS['xoopsTpl']->get_template_vars("xoops_pagetitle") : ""
                                
),
        
"module" =>     array(    "type" => "text",
                                
"title" => _AM_USERLOG_MODULE,
                                
"value" => $this->userlog->getLogModule()->getVar("dirname")
                                ),
        
"item_name" =>     array(    "type" => "text",
                                
"title" => _AM_USERLOG_ITEM_NAME,
                                
"value" => null
                                
),
        
"item_id" =>     array(    "type" => "text",
                                
"title" => _AM_USERLOG_ITEM_ID,
                                
"value" => null
                                
),
        
// user data input method
        
"request_method" => array(    "type" => "text",
                                    
"title" => _AM_USERLOG_REQUEST_METHOD,
                                    
"value" => $_SERVER['REQUEST_METHOD']
                                    ),
        
"get" =>         array(    "type" => "text",
                                
"title" => _AM_USERLOG_GET,
                                
"value" => $_GET
                                
),
        
"post" =>         array(    "type" => "text",
                                
"title" => _AM_USERLOG_POST,
                                
"value" => $_POST
                                
),
        
"request" =>    array(    "type" => "text",
                                
"title" => _AM_USERLOG_REQUEST,
                                
"value" => $_REQUEST
                                
),
        
"files" =>        array(    "type" => "text",
                                
"title" => _AM_USERLOG_FILES,
                                
"value" => $_FILES
                                
),
        
"env" =>         array(    "type" => "text",
                                
"title" => _AM_USERLOG_ENV,
                                
"value" => $_ENV
                                
),
        
"session" =>     array(    "type" => "text",
                                
"title" => _AM_USERLOG_SESSION,
                                
"value" => $_SESSION
                                
),
        
"cookie" =>     array(    "type" => "text",
                                
"title" => _AM_USERLOG_COOKIE,
                                
"value" => $_COOKIE
                                
),
        
"header" =>     array(    "type" => "text",
                                
"title" => _AM_USERLOG_HEADER,
                                
"value" => headers_list()
                                ),
        
"logger" =>     array(    "type" => "text",
                                
"title" => _AM_USERLOG_LOGGER,
                                
"value" => $GLOBALS['xoopsLogger']->errors
                                
),
        
// settings will not be logged
        
"store_file" => array(    "type" => "int",
                                
"title" => _AM_USERLOG_STORE_FILE,
                                
"value" => 1
                                
),
        
"store_db" =>     array(    "type" => "int",
                                
"title" => _AM_USERLOG_STORE_DB,
                                
"value" => 1
                                
),
        
"views" =>         array(    "type" => "int",
                                
"title" => _AM_USERLOG_VIEWS,
                                
"value" => // for item_name and item_id
                                
),
        );
        
$ret $this->userlog->getFromKeys($options$option);
        if (empty(
$V)) return $ret;
        if (
$V == "key") return array_keys($ret);
        
$ret2 null;
        foreach (
$ret as $option=>$val) {
            
$ret2[$option] = $val[$V];
        }
        return 
$ret2;
    }


2- setting structure.
i think we just need to log users based on "uid" or "gid" or "ip" and it will cover all possibilities. please let me know your idea.

the table structure is:
in userlog/sql/mysql.sql
CREATE TABLE mod_userlog_set (
  
set_id mediumint(8unsigned NOT NULL auto_increment,
  
name varchar(100NOT NULL default '',
  
logby varchar(10NOT NULL default '',
  
unique_id int(11unsigned NOT NULL default 0,
  
options TEXT NOT NULL,
  
scope TEXT NOT NULL,
  
PRIMARY KEY  (set_id),
  
UNIQUE logby_id (logbyunique_id)
ENGINE=MyISAM;


The above is clear. more information in module help.

3- performance.
it checks every hit to see if the visitor have a setting or not. for the best performance i wrote a get function like this.
in userlog/class/setting.php
public function get()
    {
        
// if uid setting exist in File
        
$unique_uid = ($this->userlog->getUser()) ? $this->userlog->getUser()->getVar('uid') : 0;
        if (
$options $this->getFile('uid'$unique_uid)) {
            return 
$options;
        }

        
// if gid setting exist in File
        
$unique_gid = ($this->userlog->getUser()) ? $this->userlog->getUser()->getGroups() :  array(XOOPS_GROUP_ANONYMOUS);
        foreach (
$unique_gid as $gid) {
            if (
$options $this->getFile('gid'$gid)) {
                return 
$options;
            }
        }
        
// if ip setting exist in File
        
$unique_ip XoopsUserUtility::getIP(); // ip as int
        
if ($options $this->getFile('ip'$unique_ip)) {
            return 
$options;
        }
        
// if all exist in File
        
if ($options $this->getFile('all'0)) {
            return 
$options;
        }
        
///////////////////////////////////////////////////////////
        // database get All is better for performance???
        
$logsetsObj $this->userlog->getHandler('setting')->getAll();
        if (empty(
$logsetsObj)) return false// if not set in db return false
        
$uid_unique_uid "uid" $unique_uid;
        foreach(
$unique_gid as $key=>$gid) {
            
$gid_unique_gid[$key] = "gid" $gid;
        }
        
$ip_unique_ip "ip" $unique_ip;
        foreach(
$logsetsObj as $setObj) {
            
$sLobgy $setObj->logby();
            
$sUnique_id    $setObj->unique_id();
            
$sLogbyId $sLobgy $sUnique_id;
            
// if uid setting exist in db return it            
            
if($sLogbyId == $uid_unique_uid ||
            
// if gid setting exist in db return it
               
in_array($sLogbyId$gid_unique_gid) ||
            
// if ip setting exist in db return it
               
$sLogbyId == $ip_unique_ip) {
                    
$sets = array($setObj->options(), $setObj->scope());
                    
$this->setFile($sLobgy$sUnique_id$sets); // build cache
                    
return $sets;
            }
            
// if all exist in db
            
if($sUnique_id == 0) {
                
$sets = array($setObj->options(), $setObj->scope());
                
$this->setFile('all'0$sets); // build cache
                
return $sets;
            }
        }
        return 
false;
    }


as you can see it create cache files for each settings. IMO it will help to reduce queries for users have a setting.

for getting settings from db i firstly used criteria but then i decide to get all settings at once and then find if the user have setting or not. IMO it has the better performance. please let me know your opinion. what is the best performance? this function is important for your review.

4- views
now every module have a counter for its item views. eg: news, publisher, page in xoops 2.6
but this counter is useless. we dont need forever views. we need views in a specific time period.
in every news agency the first and top block is "today hot news" and it means news that had been most viewed today.

for a long time that was an unsolved issue for me and i think in the whole xoops we have this problem in all modules.
after starting userlog for a different purpose I suddenly reach to an innovative idea for gathering all views in all modules.
i used module "notification" because every module item that should have views have a notification too.
there we have all needed information about items. so i wrote this nice and tricky function:
public function setItem()
    {
        
$not_config =& $this->userlog->getLogModule()->getInfo('notification');
        if (!empty(
$not_config)) {
            foreach (
$not_config['category'] as $category) {
                
// if $item_id != 0 ---> return true
                
if (!empty($category['item_name']) && $item_id UserlogRequest::getInt($category['item_name'], 0)){
                    
$this->setVar('item_name'$category['item_name']);
                    
$this->setVar('item_id'$item_id);
                    return 
true;
                }
            }
        }
        return 
false;        
    }


so for example in news we only have these typical URLs:

news/article.php?storyid=ITEM_ID
news/index.php|article.php?storytopic=ITEM_ID

as you can see i just need to store item_name and item_id because i have the module dirname and script name!!!

IMO we should stick to this idea to have a overall item views in the XOOPS and drop all counters in all modules.
i need your idea about this.


please if you have any opinion contribute here.
Thank you.

@Mamba:
i dont have any issues in php 5.3.17 and 5.4.4
I just used Xoops core functions but i just can guess it needs pear for file classes.
does your localhost have pear support? It sees it is required for this module!!!

Top

irmtfan
Joined:
2003/12/7 14:14
From In the middle of nowhere
Group:
Registered Users
Community Coordinator (temporary)
Posts: 3371
(Show More) (Show Less)


#7 Posted on: 2013/2/27 4:18 Re: Userlog: a new module to log user activities
Quote:

Quote:
the ASC ordering in column titles doesn't work - it is always DESC


I cannot reproduce it. where? in admin/logs.php everything is ok.

Go to:

/modules/userlog/admin/logs.php

and start clicking on the Column "Log Time". The order will stay the same, regardless how many times you click.

I'll look more into the PEAR problem. It us most probably my local problem.

Top


Please support XOOPS & DONATE
Use 2.5.7 | Debugging | Requests | Bugs
Mamba
Joined:
2004/4/23 13:58
From Ohio, USA
Group:
Webmaster
Registered Users
Designer Group
Posts: 8136
(Show More) (Show Less)


#8 Posted on: 2013/2/27 4:52 Re: Userlog: a new module to log user activities
Thank you for your work irmtfan

Top

Cesag
Joined:
2010/2/1 15:21
From France
Group:
Registered Users
Community Coordinator (temporary)
Posts: 743
(Show More) (Show Less)


#9 Posted on: 2013/2/27 6:44 Re: Userlog: a new module to log user activities
Is there a place in english I can download this from?

Top

MikeShane
Joined:
2008/1/4 20:46
From USA
Group:
Registered Users
Posts: 132
(Show More) (Show Less)


#10 Posted on: 2013/2/27 12:05 Re: Userlog: a new module to log user activities
You can download Userlog module here.


Top

Cesag
Joined:
2010/2/1 15:21
From France
Group:
Registered Users
Community Coordinator (temporary)
Posts: 743
(Show More) (Show Less)




(1) 2 3 4 ... 8 »



You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You can vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create pdf.
You cannot get print page.

[Advanced Search]