Skip to content

Commit

Permalink
3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ForumHulp committed Jan 21, 2017
1 parent fe01308 commit 1b5cd56
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 28 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Navigate in the ACP to `Customise -> Extension Management -> Extensions` and cli

To permanently uninstall, click `Delete Data` and then you can safely delete the `/ext/forumhulp/pmspy/` folder.

We feel sorry as our answers on phpbb sites are removed, so use github or our forum for answers.

## License
[GNU General Public License v2](http://opensource.org/licenses/GPL-2.0)

Expand Down
66 changes: 43 additions & 23 deletions acp/pmspy_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,41 @@

namespace forumhulp\pmspy\acp;

use phpbb\config\config;
use phpbb\db\driver\driver_interface;
use phpbb\user;
use phpbb\request\request_interface;
use phpbb\template\template;
use phpbb\pagination;

class pmspy_module
{
public $u_action;

private $config;
private $db;
private $user;
private $request;
private $template;

private function setup(config $config, driver_interface $db, user $user, request_interface $request, template $template, pagination $pagination, $phpbb_root_path, $phpEx)
{
$this->config = $config;
$this->db = $db;
$this->user = $user;
$this->request = $request;
$this->template = $template;
$this->pagination = $pagination;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
}

function main($id, $mode)
{
global $config, $db, $user, $request, $template, $phpbb_container, $phpbb_root_path, $phpEx;

$this->config = $config;
$this->db = $db;
$this->user = $user;
$this->request = $request;
$this->template = $template;
$this->pagination = $phpbb_container->get('pagination');
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
$this->setup($config, $db, $user, $request, $template, $phpbb_container->get('pagination'), $phpbb_root_path, $phpEx);

$this->tpl_name = 'acp_pm_spy';
$this->page_title = 'ACP_PM_SPY';

Expand Down Expand Up @@ -124,7 +143,7 @@ function main($id, $mode)
PRIVMSGS_SENTBOX => $this->user->lang['PM_SENTBOX'],
PRIVMSGS_INBOX => $this->user->lang['PM_INBOX'],
);

$flags = (($this->config['auth_bbcode_pm']) ? OPTION_FLAG_BBCODE : 0) +
(($this->config['auth_smilies_pm']) ? OPTION_FLAG_SMILIES : 0) +
(($this->config['allow_post_links']) ? OPTION_FLAG_LINKS : 0);
Expand All @@ -140,17 +159,17 @@ function main($id, $mode)
while ($row = $this->db->sql_fetchrow($result))
{
$this->template->assign_block_vars('pm_row', array(
'AUTHOR_IP' => $row['author_ip'],
'FROM' => $this->get_pm_user_data($row['author_id']),
'TO' => ($row['to_address'] && ($row['folder_id'] < PRIVMSGS_OUTBOX || !$row['folder_id'])) ? $this->get_pm_user_data($row['user_id']) : '',
'BCC' => ($row['bcc_address'] && ($row['folder_id'] < PRIVMSGS_OUTBOX || !$row['folder_id'])) ? $this->get_pm_user_data($row['user_id']) : '',
'DATE' => $this->user->format_date($row['message_time']),
'FOLDER' => ($row['folder_id'] > PRIVMSGS_INBOX) ? $this->user->lang['PM_SAVED'] : $pm_box_ary[$row['folder_id']],
'IS_GROUP' => (strstr($row['to_address'], 'g')) ? $this->get_pm_group($row['to_address']) : '',
'PM_ID' => str_replace('"', '#', serialize(array('msg_ids' => $row['msg_id'], 'user_id' => $row['user_id'], 'folder_id' => $row['folder_id']))),
'PM_KEY' => $row['msg_id'] . $row['user_id'],
'PM_SUBJECT' => $row['message_subject'],
'PM_TEXT' => generate_text_for_display($row['message_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $flags),
'AUTHOR_IP' => $row['author_ip'],
'FROM' => $this->get_pm_user_data($row['author_id']),
'TO' => ($row['to_address'] && ($row['folder_id'] < PRIVMSGS_OUTBOX || !$row['folder_id'])) ? $this->get_pm_user_data($row['user_id']) : '',
'BCC' => ($row['bcc_address'] && ($row['folder_id'] < PRIVMSGS_OUTBOX || !$row['folder_id'])) ? $this->get_pm_user_data($row['user_id']) : '',
'DATE' => $this->user->format_date($row['message_time']),
'FOLDER' => ($row['folder_id'] > PRIVMSGS_INBOX) ? $this->user->lang['PM_SAVED'] : $pm_box_ary[$row['folder_id']],
'IS_GROUP' => (strstr($row['to_address'], 'g')) ? $this->get_pm_group($row['to_address']) : '',
'PM_ID' => str_replace('"', '#', serialize(array('msg_ids' => $row['msg_id'], 'user_id' => $row['user_id'], 'folder_id' => $row['folder_id']))),
'PM_KEY' => $row['msg_id'] . $row['user_id'],
'PM_SUBJECT' => $row['message_subject'],
'PM_TEXT' => generate_text_for_display($row['message_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $flags),
));
}
$this->db->sql_freeresult($result);
Expand All @@ -168,7 +187,7 @@ function main($id, $mode)
}
}

function get_pm_group($group)
private function get_pm_group($group)
{
$group = str_replace('g_', '', $group);
$group = explode(':', $group);
Expand All @@ -177,12 +196,13 @@ function get_pm_group($group)
$groupname = array();
while ($row = $this->db->sql_fetchrow($result))
{
$groupname[] = (isset($this->user->lang['G_' . utf8_strtoupper($row['group_name'])])) ? $this->user->lang['G_' . utf8_strtoupper($row['group_name'])] : $row['group_name'];
$groupname[] = (isset($this->user->lang['G_' . utf8_strtoupper($row['group_name'])])) ? $this->user->lang['G_' . utf8_strtoupper($row['group_name'])] :
$row['group_name'];
}
return implode(', ', $groupname);
}

function get_pm_user_data($pm_user)
private function get_pm_user_data($pm_user)
{
$sql = 'SELECT username, user_colour, user_lastvisit, MAX(session_time) AS session_time FROM ' . USERS_TABLE . ' u
LEFT JOIN ' . SESSIONS_TABLE . ' s ON s.session_user_id = u.user_id
Expand Down
6 changes: 3 additions & 3 deletions adm/style/acp_pm_spy.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ <h1>{L_PM_SPY_READ} <a href="{U_ACTION}&amp;action=details" class="simpledialog"
<table cellspacing="1">
<thead>
<tr>
<th>{L_MARK}</th>
<th>{L_SUBJECT}</th>
<th>{L_FROM} <a href="{U_ACTION}&amp;sk=f&amp;sd=d" title="{L_DESCENDING}"><i class="fa fa-arrow-up"<!-- IF U_NAME == 'f' and U_SORT == 'a' --> id="act-arrow"<!-- ENDIF -->></i></a><a href="{U_ACTION}&amp;sk=f&amp;sd=a" title="{L_ASCENDING}"><i class="fa fa-arrow-down"<!-- IF U_NAME == 'f' and U_SORT == 'd' --> id="act-arrow"<!-- ENDIF -->></i></a>
</th>
Expand All @@ -44,13 +43,13 @@ <h1>{L_PM_SPY_READ} <a href="{U_ACTION}&amp;action=details" class="simpledialog"
</th>
<th>{L_DATE} <a href="{U_ACTION}&amp;sk=d&amp;sd=d" title="{L_DESCENDING}"><i class="fa fa-arrow-up"<!-- IF U_NAME == 'd' and U_SORT == 'a' --> id="act-arrow"<!-- ENDIF -->></i></a><a href="{U_ACTION}&amp;sk=d&amp;sd=a" title="{L_ASCENDING}"><i class="fa fa-arrow-down"<!-- IF U_NAME == 'd' and U_SORT == 'd' --> id="act-arrow"<!-- ENDIF -->></i></a>
</th>
<th>{L_MARK}</th>
</tr>
</thead>

<tbody>
<!-- BEGIN pm_row -->
<tr class="<!-- IF pm_row.S_ROW_COUNT is even -->row1<!-- ELSE -->row2<!-- ENDIF -->">
<td style="text-align: center;"><input type="checkbox" class="radio" name="mark[]" value="{pm_row.PM_ID}" /></td>
<td class="cursor" onclick="ShowHide('pm{pm_row.PM_KEY}')" title="{L_READ_MESSAGE}">{pm_row.PM_SUBJECT}</td>
<td>{pm_row.FROM}</td>
<td>{pm_row.TO}</td>
Expand All @@ -59,6 +58,7 @@ <h1>{L_PM_SPY_READ} <a href="{U_ACTION}&amp;action=details" class="simpledialog"
<td>{pm_row.FOLDER}</td>
<td>{pm_row.AUTHOR_IP}</td>
<td>{pm_row.DATE}</td>
<td style="text-align: center;"><input type="checkbox" class="radio" name="mark[]" value="{pm_row.PM_ID}" /></td>
</tr>
<tr class="<!-- IF pm_row.S_ROW_COUNT is even -->row1<!-- ELSE -->row2<!-- ENDIF -->" style="display:none" id="pm{pm_row.PM_KEY}">
<td>&nbsp;</td>
Expand All @@ -67,7 +67,7 @@ <h1>{L_PM_SPY_READ} <a href="{U_ACTION}&amp;action=details" class="simpledialog"
<!-- END pm_row -->
</tbody>
</table>
<p class="small" style="float:left;margin-top:5px;"><input class="button2" type="submit" value="{L_DELETE_PMS}" name="delete" /><br />
<p class="small" style="float:right;margin-top:5px;"><input class="button2" type="submit" value="{L_DELETE_PMS}" name="delete" />
<a href="#" onclick="marklist('pm_spy', 'mark', true); return false;">{L_MARK_ALL}</a> &bull; <a href="#" onclick="marklist('pm_spy', 'mark', false); return false;">{L_UNMARK_ALL}</a></p>
<!-- IF .pagination or TOTAL_POSTS -->
<div class="pagination">
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "phpbb-extension",
"description": "Show PMs of your members, delete them if you want.",
"homepage": "http://forumhulp.com",
"version": "3.1.0",
"version": "3.1.1",
"keywords": ["forumhulp", "phpbb", "extension", "add user", "pb"],
"license": "GPL-2.0",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion language/en/info_acp_pmspy.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
'LOG_PM_SPY' => '<strong>PM’s deleted by PM Spy</strong><br />',

'FH_HELPER_NOTICE' => 'Forumhulp helper application does not exist!<br />Download <a href="https://github.com/ForumHulp/helper" target="_blank">forumhulp/helper</a> and copy the helper folder to your forumhulp extension folder.',
'PMSPY_NOTICE' => '<div class="phpinfo"><p class="entry">This extension resides in %1$s » %2$s » %3$s.</p></div>',
'PMSPY_NOTICE' => '<div class="phpinfo"><p class="entry">This extension resides in %1$s » %2$s » %3$s.</p></div>',
));

// Description of extension
Expand Down

0 comments on commit 1b5cd56

Please sign in to comment.