Author Topic: Inbox monitor  (Read 1807 times)

flyer5

  • Active Member
  • ***
  • Posts: 96
  • Karma: +4/-0
    • North East Nudists
Inbox monitor
« on: April 03, 2015, 01:39:38 AM »
UPDATED - SEE POST BELOW FOR LATEST
----------------------------------------------

This contribution may seem a bit controversial - basically it makes it simple to display and read all the users mailboxes on one page. Some may think this is going a bit far and an invasion of privacy, but, in some cases this may necessary. On my site it was, hence I made this contribution. Besides, you can always read the mail in the database, this just makes it easier!

To install you need make only one change to one file, create and upload two files.

Installation

1. In yoursite.com/admin/
Create a blank file called message_monitor.php
Copy and paste the following into that file

Code: [Select]
<?php
/******************************************************************************
Etano
===============================================================================
File:                       admin/message_monitor.php
$Revision: 610 $
Software by:                DateMill (http://www.datemill.com)
Copyright by:               DateMill (http://www.datemill.com)
Support at:                 http://www.datemill.com/forum
*******************************************************************************
* See the "docs/licenses/etano.txt" file for license.                         *
******************************************************************************/

require_once '../includes/common.inc.php';
require_once 
'../includes/admin_functions.inc.php';
allow_dept(DEPT_ADMIN); // if you have moderators and want them to access this file change to allow_dept(DEPT_ADMIN | DEPT_MODERATOR);

$tpl=new phemplate('skin/','remove_nonjs');

$o=isset($_GET['o']) ? (int)$_GET['o'] : 0;
$r=isset($_GET['r']) ? (int)$_GET['r'] : current($accepted_results_per_page);
$where='1';
$from="`{$dbtable_prefix}user_inbox`";

$query="SELECT count(*) FROM $from WHERE $where";
if (!(
$res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
$totalrows=mysql_result($res,0,0);

$loop=array();
if (!empty(
$totalrows)) {
if ($o>=$totalrows) {
$o=$totalrows-$r;
$o=$o>=$o 0;
}
$query="SELECT `mail_id`,`fk_user_id`,`_user_other`,`subject`, `message_body` FROM $from WHERE $where ORDER BY mail_id DESC LIMIT $o,$r";;
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
while ($rsrow=mysql_fetch_assoc($res)) {
$rsrow['fk_user_id']=sanitize_and_format($rsrow['fk_user_id'],TYPE_STRING,$__field2format[FIELD_TEXTFIELD]);
$rsrow['_user_other']=sanitize_and_format($rsrow['_user_other'],TYPE_STRING,$__field2format[FIELD_TEXTFIELD]);
$rsrow['subject']=sanitize_and_format($rsrow['subject'],TYPE_STRING,$__field2format[FIELD_TEXTFIELD]);
$rsrow['message_body']=sanitize_and_format($rsrow['message_body'],TYPE_STRING,$__field2format[FIELD_TEXTFIELD]);
$loop[]=$rsrow;
}
$output['pager2']=pager($totalrows,$o,$r);
}

$output['return2me']='message_monitor.php';
if (!empty(
$_SERVER['QUERY_STRING'])) {
$output['return2me'].='?'.$_SERVER['QUERY_STRING'];
}
$output['return2me']=rawurlencode($output['return2me']);
$tpl->set_file('content','message_monitor.html');
$tpl->set_loop('loop',$loop);
$tpl->set_var('output',$output);
$tpl->process('content','content',TPL_LOOP TPL_NOLOOP);
$tpl->drop_loop('loop');
$tpl->drop_var('output.pager2');
unset(
$loop);

$tplvars['title']='Message Monitor';
$tplvars['page']='message_monitor';
include 
'frame.php';

Save and upload the file.

2. In yoursite.com/admin/skin/
Create a blank file named message_monitor.html
Copy and paste the following into it

Code: [Select]
<h2>Message Monitor</h2>

<div class="hint"><strong>Message Monitor! Watch for the sex pests!</strong></div>

<table id="Mail" class="results_table">
<tr>
<th width="2%"></th>
<th width="5%">To User</th>
    <th width="10%">Sent By</th>
    <th width="25%">Subject</th>
    <th>Message</th>
</tr>
<!--loop name="loop"-->
<tr class="{loop.myclass}">
<td>&nbsp;</td>
<td>{loop.fk_user_id}</td>
<td>{loop._user_other}</td>
    <td>{loop.subject}</td>
<td>{loop.message_body}</td>

</tr>
<!--noloop name="loop"-->
<tr>
<td colspan="2" class="no_result_item">No messages!! There must be an error</td>
</tr>
<!--/noloop name="loop"-->
<!--/loop name="loop"-->
</table>

{output.pager2}



<script type="text/javascript" src="js/banned_words.js?v={tplvars.js_lib_v}"></script>

3. In yoursite.com/admin/frame.html
Find:
Code: [Select]
<div id="m_admin" class="left_menu_box">
<h2>Administration Center</h2>
<ul>
<li><a href="cpanel.php">Home</a></li>

And add the following line where you would like the option to appear in your menu

Code: [Select]
                            <li><a href="message_monitor.php">Message Monitor</a></li>

Save and upload.

All done, in your admin panel you should now see the link for Message Monitor.
Note: There is no seperate CSS file for this.

abo

  • Prime Member
  • ****
  • Posts: 138
  • Karma: +0/-0
Re: Inbox monitor
« Reply #1 on: April 03, 2015, 04:24:35 AM »
It works fine and i think It's really useful !
Thank's a lot ;)

blueeyeddevil

  • Active Member
  • ***
  • Posts: 43
  • Karma: +3/-0
Re: Inbox monitor
« Reply #2 on: April 04, 2015, 08:36:34 AM »
Maybe would be useful to add some words filter which would highlight messages that contain certain words. For example money or $ may catch messages from scammers trying to lure money from users

flyer5

  • Active Member
  • ***
  • Posts: 96
  • Karma: +4/-0
    • North East Nudists
Re: Inbox monitor
« Reply #3 on: May 14, 2015, 09:50:22 PM »
UPDATE
--------
This update changes the senders user id to user name so making more sense when reading, and re orders the display into a more logical way to read it.
To update just replace the entire contents of admin\message_monitor.php and admin\message_monitor.html as below.

OPEN admin\message_monitor.php
REPLACE all content with
Code: [Select]
<?php
/******************************************************************************
Etano
===============================================================================
File:                       admin/message_monitor.php
$Revision: 610 $
Software by:                DateMill (http://www.datemill.com)
Copyright by:               DateMill (http://www.datemill.com)
Support at:                 http://www.datemill.com/forum
*******************************************************************************
* See the "docs/licenses/etano.txt" file for license.                         *
******************************************************************************/

require_once '../includes/common.inc.php';
require_once 
'../includes/admin_functions.inc.php';
allow_dept(DEPT_ADMIN); // if you have moderators and want them to access this file change to allow_dept(DEPT_ADMIN | DEPT_MODERATOR);

$tpl=new phemplate('skin/','remove_nonjs');
$unset_user='System';

$o=isset($_GET['o']) ? (int)$_GET['o'] : 0;
$r=isset($_GET['r']) ? (int)$_GET['r'] : current($accepted_results_per_page);
$where='1';
$from="`{$dbtable_prefix}user_inbox`";

$query="SELECT count(*) FROM $from WHERE $where";
if (!(
$res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
$totalrows=mysql_result($res,0,0);

$loop=array();
if (!empty(
$totalrows)) {
if ($o>=$totalrows) {
$o=$totalrows-$r;
$o=$o>=$o 0;
}
$query="SELECT `mail_id`,`fk_user_id`,`_user_other`,`subject`, `message_body` FROM $from WHERE $where ORDER BY mail_id DESC LIMIT $o,$r";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
while ($rsrow=mysql_fetch_assoc($res)) {
if (!empty($rsrow['fk_user_id'])) {
  $rsrow['fk_user_id']=get_user_by_userid($rsrow['fk_user_id']);
} else {
$rsrow['fk_user_id']=$rsrow[$unset_user];
}
$rsrow['_user_other']=sanitize_and_format($rsrow['_user_other'],TYPE_STRING,$__field2format[FIELD_TEXTFIELD]);
$rsrow['subject']=sanitize_and_format($rsrow['subject'],TYPE_STRING,$__field2format[FIELD_TEXTFIELD]);
$rsrow['message_body']=sanitize_and_format($rsrow['message_body'],TYPE_STRING,$__field2format[FIELD_TEXTFIELD]);
$loop[]=$rsrow;
}
$output['pager2']=pager($totalrows,$o,$r);
}

$output['return2me']='message_monitor.php';
if (!empty(
$_SERVER['QUERY_STRING'])) {
$output['return2me'].='?'.$_SERVER['QUERY_STRING'];
}
$output['return2me']=rawurlencode($output['return2me']);
$tpl->set_file('content','message_monitor.html');
$tpl->set_loop('loop',$loop);
$tpl->set_var('output',$output);
$tpl->process('content','content',TPL_LOOP TPL_NOLOOP);
$tpl->drop_loop('loop');
$tpl->drop_var('output.pager2');
unset(
$loop);

$tplvars['title']='Message Monitor';
$tplvars['page']='message_monitor';
include 
'frame.php';

OPEN admin\skin\message_monitor.html
REPLACE all content with
Code: [Select]
<h2>Message Monitor</h2>

<div class="hint"><strong>Message Monitor! Watch for the sex pests!</strong></div>

<table id="Mail" class="results_table">
<tr>
<th width="2%"></th>
<th width="5%">Sent By</th>
    <th width="10%">To User</th>
    <th width="25%">Subject</th>
    <th>Message</th>
</tr>
<!--loop name="loop"-->
<tr class="{loop.myclass}">
<td>&nbsp;</td>
<td>{loop._user_other}</td>
<td>{loop.fk_user_id}</td>
    <td>{loop.subject}</td>
<td>{loop.message_body}</td>

</tr>
<!--noloop name="loop"-->
<tr>
<td colspan="2" class="no_result_item">No messages!! There must be an error</td>
</tr>
<!--/noloop name="loop"-->
<!--/loop name="loop"-->
</table>

{output.pager2}



<script type="text/javascript" src="js/banned_words.js?v={tplvars.js_lib_v}"></script>

Thats it all done.

abo

  • Prime Member
  • ****
  • Posts: 138
  • Karma: +0/-0
Re: Inbox monitor
« Reply #4 on: May 14, 2015, 11:52:57 PM »
Done ... i'ts better ! thank you :)

Hornyflings

  • Prime Member
  • ****
  • Posts: 182
  • Karma: +3/-0
    • AsiasHeart
Re: Inbox monitor
« Reply #5 on: July 05, 2015, 08:01:18 AM »
Hi flyer5,

I've just installed your nice mod, thanks for sharing it! It is simple but works very well!

To avoid any misleading the right path for message_monitor.html probably would be:
admin\skin\message_monitor.html

instead as mentioned in UPDATE section:
OPEN admin\message_monitor.html

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Re: Inbox monitor
« Reply #6 on: July 05, 2015, 11:23:49 PM »
Hi flyer5,

I've just installed your nice mod, thanks for sharing it! It is simple but works very well!

To avoid any conflicts the right path for message_monitor.html probably would be:
admin\styles\message_monitor.html

the admin/skin/styles directory is generally reserved for css files, not html. Why do you believe that the html file should be placed inside this directory?
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Re: Inbox monitor
« Reply #7 on: July 05, 2015, 11:38:16 PM »
Come to think of it. Flyer5, have you thought about adding this code to your php file?
If not, can you explain why it isn't necessary.

Code: [Select]
$tplvars['css']='message_monitor.css';
Placed after:
Code: [Select]
$tplvars['title']='Message Monitor';
$tplvars['page']='message_monitor';

And then adding an empty message_monitor.css file in the styles directory?
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

Hornyflings

  • Prime Member
  • ****
  • Posts: 182
  • Karma: +3/-0
    • AsiasHeart
Re: Inbox monitor
« Reply #8 on: July 06, 2015, 12:13:30 AM »
sorry, you are right
admin/skin/styles directory is generally reserved for css files

just saw this path in UPDATE!
OPEN admin\message_monitor.html

posted it by error may be it was to hot here yesterday.
to avoid misleading probably should be OPEN admin\skin\message_monitor.html

flyer5

  • Active Member
  • ***
  • Posts: 96
  • Karma: +4/-0
    • North East Nudists
Re: Inbox monitor
« Reply #9 on: July 08, 2015, 05:39:35 AM »
Come to think of it. Flyer5, have you thought about adding this code to your php file?
If not, can you explain why it isn't necessary.

Code: [Select]
$tplvars['css']='message_monitor.css';
Placed after:
Code: [Select]
$tplvars['title']='Message Monitor';
$tplvars['page']='message_monitor';

And then adding an empty message_monitor.css file in the styles directory?

It works perfectly fine without it, so why add an extra line of code  to a file and a blank file ? I don't see the point, unless I want to style something differently, which i personally dont.
F5

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Re: Inbox monitor
« Reply #10 on: May 25, 2016, 11:26:34 AM »
I thought I'd share some current issues with this in the USA.
Facebook is being sued over intercepting private messages without consent.
http://www.cnet.com/news/facebook-sued-for-allegedly-intercepting-private-messages/

To read some additional information on the privacy of private messages, here's more
https://en.wikipedia.org/wiki/Electronic_Communications_Privacy_Act

The EU might have it's own similar laws.
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

Yahoob

  • Active Member
  • ***
  • Posts: 25
  • Karma: +0/-0
Re: Inbox monitor
« Reply #11 on: February 05, 2017, 10:21:22 AM »
Marble. Do you have any idea if it is allowed if they give you consent at sign up if you put it in the privacy statement? I feel like this is something facebook could not have left out of their own.

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Re: Inbox monitor
« Reply #12 on: February 09, 2017, 04:54:17 PM »
The main issue was that Facebook was using their systems to capture data from private messages and using it to target ads toward those users. I haven't read their privacy statement lately to see if they've made any changes, but they did stop the practice at the time due to the lawsuit. I haven't read the outcome to see if any laws are in place to protect their users from Facebook "snooping".
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.