1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-17 19:09:45 +01:00

Private Messages: Fixes #1485. Also check language files for changes. 'fw' (fixed width) option added to $tp->toGlyph()

This commit is contained in:
Cameron 2016-04-03 14:37:37 -07:00
parent a21cce9c4b
commit 2c18d90b9c
14 changed files with 189 additions and 105 deletions

View File

@ -691,7 +691,7 @@ class e107_db_debug {
// Dump the debug log
//
$text .= "\n<table class='fborder table table-striped'>\n";
$text = "\n<table class='fborder table table-striped'>\n";
$bRowHeaders=FALSE;

View File

@ -51,6 +51,8 @@ if (strstr(e_MENU, "debug") || isset($_COOKIE['e107_debug_level']))
$e107_debug = new e107_debug;
require_once(e_HANDLER.'db_debug_class.php');
$db_debug = new e107_db_debug;
// $db_debug = e107::getDebug(); // XXX enable after 2.1.1
$e107_debug->set_error_reporting();
$e107_debug_level = $e107_debug->debug_level;
define('E107_DEBUG_LEVEL', $e107_debug_level);

View File

@ -3426,6 +3426,10 @@ class e_parser
$spin = null;
$rotate = null;
$fixedW = null;
$prefix = null;
$size = null;
$tag = 'span';
// return print_r($fa4,true);
@ -3436,6 +3440,7 @@ class e_parser
$tag = 'i';
$spin = !empty($parm['spin']) ? ' fa-spin' : '';
$rotate = !empty($parm['rotate']) ? ' fa-rotate-'.intval($parm['rotate']) : '';
$fixedW = !empty($parm['fw']) ? ' fa-fw' : "";
}
elseif(deftrue("BOOTSTRAP"))
{
@ -3456,7 +3461,7 @@ class e_parser
$idAtt = (!empty($parm['id'])) ? "id='".$parm['id']."' " : '';
$text = "<".$tag." {$idAtt}class='".$prefix.$id.$size.$spin.$rotate."'></".$tag.">" ;
$text = "<".$tag." {$idAtt}class='".$prefix.$id.$size.$spin.$rotate.$fixedW."'></".$tag.">" ;
$text .= ($space !== false) ? $space : "";
return $text;

View File

@ -1097,6 +1097,11 @@ class e_form
case 'matchclass':
$where = "user_class REGEXP '(^|,)(".str_replace(",","|", USERCLASS).")(,|$)'";
$classList = USERCLASS;
$clist = explode(",",USERCLASS);
if(count($clist) > 1 && !isset($options['group'])) // group classes by default if more than one found.
{
$options['group'] = 'class';
}
break;
default:
@ -1106,8 +1111,14 @@ class e_form
}
$users = e107::getDb()->retrieve("user",$fields, "WHERE ".$where." ORDER BY user_name LIMIT 1000",true);
if(empty($users))
{
return "Unavailable";
}
$opt = array();
if(!empty($options['group']) && $options['group'] == 'class')
@ -1159,7 +1170,7 @@ class e_form
* @param array|string $options [optional] 'readonly' (make field read only), 'name' (db field name, default user_name)
* @return string HTML text for display
*/
function userpicker($name_fld, $id_fld, $default_name, $default_id, $options = array())
function userpicker($name_fld, $id_fld='', $default_name, $default_id, $options = array())
{
if(!is_array($options))
{
@ -1188,6 +1199,8 @@ class e_form
'options' => $default_options,
);
//TODO FIXME Filter by userclass. - see $frm->userlist().
$options = array_replace_recursive($defaults, $options);
$ret = $this->text($name_fld, $default_id, 20, $options);

View File

@ -28,6 +28,9 @@ class user_select
*/
function user_list($class, $form_name)
{
// e107::getMessage()->addDebug("Deprecated user_list Method used ".debug_backtrace());
global $sql, $tp;
if($class === FALSE) { $class = e_UC_MEMBER;}
switch ($class)
@ -63,7 +66,11 @@ class user_select
$text .= "</select>";
$text .= $where;
if(ADMIN)
{
$text .= "user_list method is deprecated. ".print_a(debug_backtrace(),true);
}
return $text;
}

View File

@ -111,23 +111,25 @@ class private_msg_ui extends e_admin_ui
protected $prefs = array(
'title' => array('title'=> ADLAN_PM_16, 'tab'=>0, 'type' => 'text', 'data' => 'str', 'help'=>''),
'pm_class' => array('title'=> ADLAN_PM_23, 'tab'=>0, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('classlist'=>'nobody,member,admin,classes')),
'sendall_class' => array('title'=> ADLAN_PM_29, 'tab'=>0, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('classlist'=>'nobody,member,admin,classes')),
'send_to_class' => array('title'=> "'Send to' user selection", 'tab'=>0, 'type' => 'method', 'data' => 'int', 'help'=>''),
'opt_userclass' => array('title'=> ADLAN_PM_31, 'tab'=>0, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('classlist'=>'nobody,member,admin,classes')),
'animate' => array('title'=> ADLAN_PM_17, 'tab'=>0, 'type' => 'boolean', 'data' => 'str', 'help'=>''),
'dropdown' => array('title'=> ADLAN_PM_18, 'tab'=>0, 'type' => 'boolean', 'data' => 'str', 'help'=>''),
'pm_class' => array('title'=> ADLAN_PM_23, 'tab'=>0, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('size'=>'xlarge', 'classlist'=>'nobody,main,member,admin,classes')),
'sendall_class' => array('title'=> ADLAN_PM_29, 'tab'=>1, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('size'=>'xlarge', 'classlist'=>'nobody,main,member,admin,classes')),
'send_to_class' => array('title'=> ADLAN_PM_83, 'tab'=>0, 'type' => 'method', 'data' => 'str', 'help'=>''),
'multi_class' => array('title'=> ADLAN_PM_30, 'tab'=>0, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('size'=>'xlarge', 'classlist'=>'nobody,main,member,admin,classes')),
'opt_userclass' => array('title'=> ADLAN_PM_31, 'tab'=>0, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('size'=>'xlarge', 'classlist'=>'nobody,main,member,admin,classes')),
'animate' => array('title'=> ADLAN_PM_17, 'tab'=>1, 'type' => 'boolean', 'data' => 'str', 'help'=>''),
// 'dropdown' => array('title'=> ADLAN_PM_18, 'tab'=>0, 'type' => 'boolean', 'data' => 'str', 'help'=>''),
'read_timeout' => array('title'=> ADLAN_PM_19, 'tab'=>1, 'type' => 'number', 'data' => 'int', 'help'=>''),
'unread_timeout'=> array('title'=> ADLAN_PM_20, 'tab'=>1, 'type' => 'number', 'data' => 'int', 'help'=>''),
'popup' => array('title'=> ADLAN_PM_21, 'tab'=>0, 'type' => 'boolean', 'data' => 'int', 'help'=>''),
'popup_delay' => array('title'=> ADLAN_PM_22, 'tab'=>0, 'type' => 'number', 'data' => 'int', 'help'=>'', 'writeParms'=>array('post'=>ADLAN_PM_44, 'tdClassRight'=>'form-inline')),
'perpage' => array('title'=> ADLAN_PM_24, 'tab'=>0, 'type' => 'number', 'data' => 'int', 'help'=>''),
'notify_class' => array('title'=> ADLAN_PM_25, 'tab'=>1, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('classlist'=>'nobody,member,admin,classes')),
'receipt_class' => array('title'=> ADLAN_PM_26, 'tab'=>1, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('classlist'=>'nobody,member,admin,classes')),
'attach_class' => array('title'=> ADLAN_PM_27, 'tab'=>1, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('classlist'=>'nobody,member,admin,classes')),
'popup' => array('title'=> ADLAN_PM_21, 'tab'=>1, 'type' => 'boolean', 'data' => 'int', 'help'=>''),
'popup_delay' => array('title'=> ADLAN_PM_22, 'tab'=>1, 'type' => 'number', 'data' => 'int', 'help'=>'', 'writeParms'=>array('post'=>ADLAN_PM_44, 'tdClassRight'=>'form-inline')),
'notify_class' => array('title'=> ADLAN_PM_25, 'tab'=>1, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('size'=>'xlarge', 'classlist'=>'nobody,main,member,admin,classes')),
'receipt_class' => array('title'=> ADLAN_PM_26, 'tab'=>1, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('size'=>'xlarge', 'classlist'=>'nobody,main,member,admin,classes')),
'attach_class' => array('title'=> ADLAN_PM_27, 'tab'=>0, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('size'=>'xlarge', 'classlist'=>'nobody,main,member,admin,classes')),
'attach_size' => array('title'=> ADLAN_PM_28, 'tab'=>1, 'type' => 'number', 'data' => 'int', 'help'=>'', 'writeParms'=>'tdClassRight=form-inline&post=Kb'),
'multi_class' => array('title'=> ADLAN_PM_30, 'tab'=>0, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('classlist'=>'nobody,member,admin,classes')),
'pm_max_send' => array('title'=> ADLAN_PM_81, 'tab'=>1, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('classlist'=>'nobody,member,admin,classes')),
'pm_max_send' => array('title'=> ADLAN_PM_81, 'tab'=>1, 'type' => 'userclass', 'data' => 'int', 'help'=>'', 'writeParms'=>array('size'=>'xlarge', 'classlist'=>'nobody,main,member,admin,classes')),
'perpage' => array('title'=> ADLAN_PM_24, 'tab'=>0, 'type' => 'number', 'data' => 'int', 'help'=>''),
);
@ -856,12 +858,12 @@ class private_msg_ui extends e_admin_ui
class private_msg_form_ui extends e_admin_form_ui
{
function send_to_class($parms, $value, $id)
function send_to_class($value, $mode, $id)
{
$list = e107::getUserClass()->getClassList('main,admin,member,classes');
$list['matchclass'] = "(Any user with the same class)"; //TODO LAN
return $this->select('pm_option-send_to_class', $list, vartrue($value, e_UC_MEMBER));
return $this->select('send_to_class', $list, vartrue($value, e_UC_MEMBER), array('size'=>'xlarge'));
}

View File

@ -85,4 +85,5 @@ define("LAN_PM_107", "The Private Message you sent to {UNAME} was read on ");
define("LAN_PM_108", "Message sent on: ");
define("LAN_PM_109", "New Message(s)");
define("LAN_PM_111", "Read");
define("LAN_PM_112", "User(s)");
?>

View File

@ -26,11 +26,11 @@ define("ADLAN_PM_23", "Restrict PM use to");
define("ADLAN_PM_24", "Number of PMs to show per page");
define("ADLAN_PM_25", "Enable PM email notifications");
define("ADLAN_PM_26", "Allow user to request read receipt email notifications");
define("ADLAN_PM_27", "Allow posting of attachments");
define("ADLAN_PM_27", "Userclass which may include attachments");
define("ADLAN_PM_28", "Maximum attachment size");
define("ADLAN_PM_29", "Allow sending to all members");
define("ADLAN_PM_30", "Allow sending to multiple recipients");
define("ADLAN_PM_31", "Userclass allowed to send to userclass");
define("ADLAN_PM_30", "Userclass which may send to more than one user at a time");
define("ADLAN_PM_31", "Userclass which may to send to entire userclasses");
//define("ADLAN_PM_32", "Update Settings");
define("ADLAN_PM_33", "Inactive (no limits)");
define("ADLAN_PM_34", "PM counts");
@ -75,7 +75,7 @@ define("ADLAN_PM_79", "--ORPHANS-- unused attachments deleted. --MISSING-- missi
define("ADLAN_PM_80", "Preference formats updated");
define("ADLAN_PM_81", "Maximum number of PMs to send immediately");
define("ADLAN_PM_82", "If sending more than this, they are added to a queue and sent out using the cron task");
define("ADLAN_PM_83", "Users may only send messages to users in this class");
?>

View File

@ -13,7 +13,7 @@
<pref name="read_timeout">0</pref>
<pref name="unread_timeout">0</pref>
<pref name="popup">0</pref>
<pref name="popup_delay"></pref>
<pref name="popup_delay">3</pref>
<pref name="perpage">10</pref>
<pref name="pm_class">e_UC_MEMBER</pref>
<pref name="notify_class">e_UC_ADMIN</pref>
@ -25,5 +25,6 @@
<pref name="allow_userclass">1</pref>
<pref name="pm_limits">0</pref>
<pref name="pm_max_send">100</pref>
<pref name="sent_to_class">matchclass</pref>
</pluginPrefs>
</e107Plugin>

View File

@ -59,7 +59,7 @@ if(!defined('ATTACHMENT_ICON'))
if(deftrue('BOOTSTRAP') && deftrue('FONTAWESOME'))
{
define('PM_DELETE_ICON', $tp->toGlyph('fa-trash'));
define('PM_DELETE_ICON', $tp->toGlyph('fa-trash', 'fw=1'));
}
else
{
@ -74,7 +74,7 @@ if(!empty($_GET['mode']))
{
$action = $tp->filter($_GET['mode']);
}
/*
if($action == 'textarea' || $action == 'input')
{
if($qs[1] == 'pm_to') {
@ -83,7 +83,7 @@ if($action == 'textarea' || $action == 'input')
$us->popup();
exit;
}
}
}*/
$pm_proc_id = intval(varset($qs[1],0));
@ -407,19 +407,26 @@ class pm_extended extends private_message
}
$pm_info = $this->pmManager->pm_getInfo('outbox');
if($pm_info['outbox']['total'] != $_POST['numsent'])
{
return LAN_PM_14;
}
if(isset($_POST['pm_userclass']) && ($_POST['pm_userclass'] == e_UC_NOBODY))
{
$_POST['pm_userclass'] = false;
}
if(isset($_POST['user']))
{
$_POST['pm_to'] = $_POST['user'];
}
if(isset($_POST['pm_to']))
{
$msg = '';
if(isset($_POST['to_userclass']) && $_POST['to_userclass'])
if(!empty($_POST['pm_userclass']))
{
if(!check_class($this->pmPrefs['opt_userclass']))
{
@ -432,11 +439,7 @@ class pm_extended extends private_message
}
else
{
$to_array = explode("\n", trim($_POST['pm_to']));
foreach($to_array as $k => $v)
{
$to_array[$k] = trim($v);
}
$to_array = explode(",", str_replace(" ", "", $_POST['pm_to']));
$to_array = array_unique($to_array);
if(count($to_array) == 1)
@ -487,12 +490,6 @@ class pm_extended extends private_message
$maxsize = intval($this->pmPrefs['attach_size']) * 1024;
foreach(array_keys($_FILES['file_userfile']['size']) as $fid)
{
if($maxsize > 0 && $_FILES['file_userfile']['size'][$fid] > $maxsize)
@ -542,32 +539,8 @@ class pm_extended extends private_message
}
/*
if($_FILES['file_userfile']['name'][0])
{
if(check_class($this->pmPrefs['attach_class']))
{
require_once(e_HANDLER.'upload_handler.php');
$randnum = rand(1000, 9999);
$_POST['uploaded'] = file_upload(e_PLUGIN.'pm/attachments', 'attachment', $randnum.'_');
if($_POST['uploaded'] == FALSE)
{
unset($_POST['uploaded']);
$msg .= LAN_PM_22."<br />";
}
}
else
{
$msg .= LAN_PM_23.'<br />';
unset($_POST['uploaded']);
}
}
*/
$_POST['from_id'] = USERID;
return $msg.$this->add($_POST);
}
}

View File

@ -176,14 +176,15 @@ class private_message
// print_a($vars);
}
if(isset($vars['to_userclass']) || isset($vars['to_array']))
if(!empty($vars['pm_userclass']) || isset($vars['to_array']))
{
if(isset($vars['to_userclass']))
if(!empty($vars['pm_userclass']))
{
$toclass = e107::getUserClass()->uc_get_classname($vars['pm_userclass']);
$tolist = $this->get_users_inclass($vars['pm_userclass']);
$ret .= LAN_PM_38.": {$toclass}<br />";
$class = TRUE;
$info['pm_sent_del'] = 1; // keep the outbox clean and limited to 1 entry when sending to an entire class.
}
else
{
@ -361,7 +362,7 @@ class private_message
*
* @return none
*/
function pm_send_notify($uid, $pmInfo, $pmid, $attach_count = 0)
function pm_send_notify($uid, $pmInfo, $pmid, $attach_count = 0) //TODO Add Template.
{
require_once(e_HANDLER.'mail.php');
$subject = LAN_PM_100.SITENAME;
@ -372,11 +373,14 @@ class private_message
$txt = LAN_PM_101.SITENAME."\n\n";
$txt .= LAN_PM_102.USERNAME."\n";
$txt .= LAN_PM_103.$pmInfo['pm_subject']."\n";
if($attach_count > 0)
{
$txt .= LAN_PM_104.$attach_count."\n";
}
$txt .= LAN_PM_105."\n".$pmlink."\n";
sendemail($pmInfo['to_info']['user_email'], $subject, $txt, $pmInfo['to_info']['user_name']);
}
@ -388,7 +392,7 @@ class private_message
*
* @return none
*/
function pm_send_receipt($pmInfo)
function pm_send_receipt($pmInfo) //TODO Add Template.
{
require_once(e_HANDLER.'mail.php');
$subject = LAN_PM_106.$pmInfo['sent_name'];
@ -398,6 +402,7 @@ class private_message
$txt .= LAN_PM_108.date('l F dS Y h:i:s A', $pmInfo['pm_sent'])."\n";
$txt .= LAN_PM_103.$pmInfo['pm_subject']."\n";
$txt .= LAN_PM_105."\n".$pmlink."\n";
sendemail($pmInfo['from_email'], $subject, $txt, $pmInfo['from_name']);
}
@ -545,14 +550,26 @@ class private_message
function pm_getuid($var)
{
$sql = e107::getDb();
$var = strip_if_magic($var);
$var = str_replace("'", '&#039;', trim($var)); // Display name uses entities for apostrophe
if($sql->select('user', 'user_id, user_name, user_class, user_email', "user_name LIKE '".$sql->escape($var, FALSE)."'"))
if(is_numeric($var))
{
$where = "user_id = ".intval($var);
}
else
{
$var = strip_if_magic($var);
$var = str_replace("'", '&#039;', trim($var)); // Display name uses entities for apostrophe
$where = "user_name LIKE '".$sql->escape($var, FALSE)."'";
}
if($sql->select('user', 'user_id, user_name, user_class, user_email', $where))
{
$row = $sql->fetch();
return $row;
}
return FALSE;
return false;
}
@ -647,6 +664,7 @@ class private_message
SELECT SQL_CALC_FOUND_ROWS pm.*, u.user_image, u.user_name FROM #private_msg AS pm
LEFT JOIN #user AS u ON u.user_id = pm.pm_to
WHERE pm.pm_from='{$uid}' AND pm.pm_sent_del = '0'
ORDER BY pm.pm_sent DESC
LIMIT ".$from.', '.$limit;

View File

@ -76,13 +76,14 @@ $sc_style['PM_REPLY']['post'] = "</td>
$PM_SEND_PM = "<div id='pm-send-pm'>
<table class='table fborder'>
<thead>
<tr>
<td colspan='2' class='fcaption'>".LAN_PM_1.": </td>
<th colspan='2' class='fcaption'>".LAN_PM_1.": </th>
</tr>
</thead>
<tr>
<td class='forumheader3' style='width: 30%'>".LAN_PM_2.": </td>
<td class='forumheader3' style='width: 70%; text-align:left'>{PM_FORM_TOUSER}<br />
<div class='form-inline'>{PM_FORM_TOCLASS}</div></td>
<td class='forumheader3' style='width: 70%; text-align:left'>{PM_FORM_TO}</td>
</tr>
<tr>
<td class='forumheader3'>".LAN_PM_5.": </td>
@ -108,21 +109,22 @@ $PM_INBOX_HEADER = "
<tr>
<th class='fcaption' style='width:1%'>&nbsp;</th>
<th class='fcaption' style='width:1%'>&nbsp;</th>
<th class='fcaption' style='width:38%'>".LAN_PM_5."</th>
<th class='fcaption' style='width:22%'>".LAN_PM_31."</th>
<th class='fcaption' style='width:30%'>".LAN_PM_32."</th>
<th class='fcaption' style='width:8%'>&nbsp;</th>
<th class='fcaption' style='width:25%'>".LAN_PM_31."</th>
<th class='fcaption' style='width:auto'>".LAN_PM_5."</th>
<th class='fcaption' style='width:auto'>".LAN_PM_32."</th>
<th class='fcaption' style='width:100px'>{PM_COMPOSE: class=block-level}</th>
</tr>
</thead>
<tbody>
";
$PM_INBOX_TABLE = "
$PM_INBOX_TABLE = "{SETIMAGE: w=30&h=30&crop=1}
<tr class='{PM_STATUS_CLASS}'>
<td class='forumheader3'>{PM_SELECT}</td>
<td class='forumheader3'>{PM_ATTACHMENT_ICON}</td>
<td class='forumheader3'>{PM_AVATAR: shape=circle} {PM_FROM=link}</td>
<td class='forumheader3'>{PM_SUBJECT=link,inbox}</td>
<td class='forumheader3'>{PM_FROM=link}</td>
<td class='forumheader3'>{PM_DATE}</td>
<td class='forumheader3' style='text-align: center; white-space: nowrap'>{PM_DELETE=inbox}&nbsp;{PM_BLOCK_USER}</td>
</tr>

View File

@ -114,36 +114,76 @@ if(!class_exists('plugin_pm_pm_shortcodes'))
}
}
// TODO rewrite $frm->userpicker(), etc. Get rid of e107_handlers/user_select_class.php
public function sc_pm_form_to($parm)
{
$userTo = $this->sc_pm_form_touser();
$classTo = $this->sc_pm_form_toclass();
if(deftrue('BOOTSTRAP'))
{
if(check_class($this->pmPrefs['opt_userclass']) )
{
$tab = array();
$userDiz = (check_class($this->pmPrefs['multi_class'])) ? LAN_PM_112 : LAN_USER;
$tab['user'] = array('caption'=> $userDiz, 'text'=>$userTo);
$tab['class'] = array('caption'=>LAN_PM_4, 'text'=>$classTo);
return e107::getForm()->tabs($tab);
}
else
{
return $userTo;
}
}
return $userTo."<br />".$classTo; // Legacy Layout.
}
// TODO Get rid of e107_handlers/user_select_class.php
public function sc_pm_form_touser()
{
if(vartrue($this->var['from_name']))
if(vartrue($this->var['from_name'])) //TODO What's this?
{
return "<input type='hidden' name='pm_to' value='{$this->var['from_name']}' />{$this->var['from_name']}";
// return "<input type='hidden' name='pm_to' value='{$this->var['from_name']}' />{$this->var['from_name']}";
}
require_once(e_HANDLER.'user_select_class.php');
$us = new user_select;
$type = ($this->pmPrefs['dropdown'] == TRUE ? 'list' : 'popup');
// require_once(e_HANDLER.'user_select_class.php');
// $us = new user_select;
// $type = ($this->pmPrefs['dropdown'] == TRUE ? 'list' : 'popup');
if(check_class($this->pmPrefs['multi_class']))
{
$ret = $us->select_form($type, 'textarea.pm_to', '', $this->pmPrefs['pm_class']);
$selectize = array('maxItems'=>10);
$ret = e107::getForm()->userpicker('pm_to', null, null, null, array('selectize'=>$selectize));
}
else
{
$frm = e107::getForm();
//TODO Use $frm->userpicker();
return $frm->userlist('pm_to',null,array('default'=>'blank'));
return $frm->text('pm_to','',20,'typeahead=users');
// $ret = $us->select_form($type, 'pm_to', '', $this->pmPrefs['pm_class']);
$ret = $frm->userlist('pm_to',null,array('default'=>'blank', 'classes'=>varset($this->pmPrefs['send_to_class'], e_UC_MEMBER)));
}
return $ret;
}
public function sc_pm_form_toclass($parm = '')
{
if(vartrue($this->var['from_name']))
{
return '';
@ -151,24 +191,28 @@ if(!class_exists('plugin_pm_pm_shortcodes'))
$ret = "";
if(check_class($this->pmPrefs['opt_userclass']) && check_class($this->pmPrefs['multi_class']))
if(check_class($this->pmPrefs['opt_userclass']) )
{
//$ret = "<input type='checkbox' name='to_userclass' value='1' />".LAN_PM_4." ";
$ret = "<div class='input-group'><span class='input-group-addon'>".e107::getForm()->checkbox('to_userclass',1,false, LAN_PM_4)."</span>";
// $ret = "<div class='input-group'><span class='input-group-addon'>".e107::getForm()->checkbox('to_userclass',1,false, LAN_PM_4)."</span>";
// Option show by visibility
$filterVisible = $parm == 'visible' ? 'matchclass, filter' : 'matchclass';
$args = (ADMIN ? 'admin, classes' : 'classes, '.$filterVisible);
$args = (ADMIN ? 'nobody, admin, classes' : 'nobody,classes, '.$filterVisible);
if(check_class($this->pmPrefs['sendall_class']))
{
$args = 'member, '.$args;
}
$ret .= e107::getUserClass()->uc_dropdown('pm_userclass', '', $args)."</div>";
$ret .= e107::getUserClass()->uc_dropdown('pm_userclass', e_UC_NOBODY, $args)."</div>";
if (strpos($ret,'option') === FALSE) $ret = '';
}
else
{
return false;
}
return $ret;
}
@ -185,7 +229,7 @@ if(!class_exists('plugin_pm_pm_shortcodes'))
}
}
return e107::getForm()->text('pm_subject',$value,255);
return e107::getForm()->text('pm_subject',$value,255, array('size'=>80));
// return "<input class='tbox' type='text' name='pm_subject' value='{$value}' size='63' maxlength='255' />";
}
@ -472,9 +516,9 @@ if(!class_exists('plugin_pm_pm_shortcodes'))
}
public function sc_pm_avatar()
public function sc_pm_avatar($parm)
{
return e107::getParser()->toAvatar($this->var);
return e107::getParser()->toAvatar($this->var, $parm);
}
@ -485,15 +529,15 @@ if(!class_exists('plugin_pm_pm_shortcodes'))
if(in_array($this->var['pm_from'], $this->pmBlocks))
{
$icon = (deftrue('FONTAWESOME')) ? e107::getParser()->toGlyph('fa-user-plus') : "<img src='".e_PLUGIN_ABS."pm/images/mail_unblock.png' alt='".LAN_PM_51."' class='icon S16' />";
$icon = (deftrue('FONTAWESOME')) ? e107::getParser()->toGlyph('fa-user-plus','fw=1') : "<img src='".e_PLUGIN_ABS."pm/images/mail_unblock.png' alt='".LAN_PM_51."' class='icon S16' />";
return "<a class='btn btn-sm btn-default btn-danger' href='".$this->url('action/unblock', 'id='.$this->var['pm_from'])."' title='".LAN_PM_51."'>".$icon."</a>";
return "<a class='btn btn-default btn-danger' href='".$this->url('action/unblock', 'id='.$this->var['pm_from'])."' title='".LAN_PM_51."'>".$icon."</a>";
}
else
{
$icon = (deftrue('FONTAWESOME')) ? e107::getParser()->toGlyph('fa-user-times') : "<img src='".e_PLUGIN_ABS."pm/images/mail_block.png' alt='".LAN_PM_50."' class='icon S16' />";
$icon = (deftrue('FONTAWESOME')) ? e107::getParser()->toGlyph('fa-user-times','fw=1') : "<img src='".e_PLUGIN_ABS."pm/images/mail_block.png' alt='".LAN_PM_50."' class='icon S16' />";
return "<a class='btn btn-sm btn-default' href='".$this->url('action/block', 'id='.$this->var['pm_from'])."' title='".LAN_PM_50."'>".$icon."</a>";
return "<a class='btn btn-default' href='".$this->url('action/block', 'id='.$this->var['pm_from'])."' title='".LAN_PM_50."'>".$icon."</a>";
}
}
@ -655,6 +699,17 @@ if(!class_exists('plugin_pm_pm_shortcodes'))
}
public function sc_pm_compose()
{
$tp = e107::getParser();
$urlCompose = e107::url('pm','index','', array('query'=>array('mode'=>'send')));
$class = (!empty($parm['class'])) ? $parm['class'] : 'btn btn-sm btn-primary btn-block-level';
return "<a class='".$class."' href='".$urlCompose."'>".$tp->toGlyph('fa-edit',' ')."Compose</a>";
}
private function url($route, $params = array())
{

View File

@ -52,7 +52,12 @@ if(e_AJAX_REQUEST)
$db = e107::getDb();
if($db->select("user", "user_id,user_name", "user_name LIKE '". $q."%' ORDER BY user_name LIMIT " . $l))
$where = "user_name LIKE '". $q."%' ";
//TODO FIXME Filter by userclass. - see $frm->userlist().
if($db->select("user", "user_id,user_name", $where. " ORDER BY user_name LIMIT " . $l))
{
$data = array();
while($row = $db->fetch())