diff --git a/e107_handlers/db_debug_class.php b/e107_handlers/db_debug_class.php index 4907b17c9..94b31c0b1 100644 --- a/e107_handlers/db_debug_class.php +++ b/e107_handlers/db_debug_class.php @@ -691,7 +691,7 @@ class e107_db_debug { // Dump the debug log // - $text .= "\n\n"; + $text = "\n
\n"; $bRowHeaders=FALSE; diff --git a/e107_handlers/debug_handler.php b/e107_handlers/debug_handler.php index 190bf8009..8b08c9177 100644 --- a/e107_handlers/debug_handler.php +++ b/e107_handlers/debug_handler.php @@ -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); diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 162fe6685..87d079e3b 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -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."'>" ; + $text = "<".$tag." {$idAtt}class='".$prefix.$id.$size.$spin.$rotate.$fixedW."'>" ; $text .= ($space !== false) ? $space : ""; return $text; diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 416b10e8c..792bdc816 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -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); diff --git a/e107_handlers/user_select_class.php b/e107_handlers/user_select_class.php index 5a8840733..0f928bc9b 100644 --- a/e107_handlers/user_select_class.php +++ b/e107_handlers/user_select_class.php @@ -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 .= ""; - $text .= $where; + if(ADMIN) + { + $text .= "user_list method is deprecated. ".print_a(debug_backtrace(),true); + } + return $text; } diff --git a/e107_plugins/pm/admin_config.php b/e107_plugins/pm/admin_config.php index cbc774677..8c85003a9 100644 --- a/e107_plugins/pm/admin_config.php +++ b/e107_plugins/pm/admin_config.php @@ -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')); } diff --git a/e107_plugins/pm/languages/English.php b/e107_plugins/pm/languages/English.php index 56ff36119..9130f642e 100755 --- a/e107_plugins/pm/languages/English.php +++ b/e107_plugins/pm/languages/English.php @@ -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)"); ?> \ No newline at end of file diff --git a/e107_plugins/pm/languages/English_admin.php b/e107_plugins/pm/languages/English_admin.php index b305977c8..a24fc5ad6 100644 --- a/e107_plugins/pm/languages/English_admin.php +++ b/e107_plugins/pm/languages/English_admin.php @@ -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"); ?> \ No newline at end of file diff --git a/e107_plugins/pm/plugin.xml b/e107_plugins/pm/plugin.xml index 4a8a2fd9f..70870b7f4 100755 --- a/e107_plugins/pm/plugin.xml +++ b/e107_plugins/pm/plugin.xml @@ -13,7 +13,7 @@ 000 - + 310e_UC_MEMBERe_UC_ADMIN @@ -25,5 +25,6 @@ 10100 + matchclass \ No newline at end of file diff --git a/e107_plugins/pm/pm.php b/e107_plugins/pm/pm.php index f7c6e8ba6..e96d27858 100755 --- a/e107_plugins/pm/pm.php +++ b/e107_plugins/pm/pm.php @@ -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."
"; - } - } - else - { - $msg .= LAN_PM_23.'
'; - unset($_POST['uploaded']); - } - } -*/ - $_POST['from_id'] = USERID; - return $msg.$this->add($_POST); } } diff --git a/e107_plugins/pm/pm_class.php b/e107_plugins/pm/pm_class.php index 1cc2bac74..d5b49ddc9 100755 --- a/e107_plugins/pm/pm_class.php +++ b/e107_plugins/pm/pm_class.php @@ -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}
"; $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("'", ''', 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("'", ''', 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; diff --git a/e107_plugins/pm/pm_template.php b/e107_plugins/pm/pm_template.php index 21964c794..f2e92d1ee 100755 --- a/e107_plugins/pm/pm_template.php +++ b/e107_plugins/pm/pm_template.php @@ -76,13 +76,14 @@ $sc_style['PM_REPLY']['post'] = " $PM_SEND_PM = "
+ - + + - + @@ -108,21 +109,22 @@ $PM_INBOX_HEADER = " - - - - + + + + "; -$PM_INBOX_TABLE = " +$PM_INBOX_TABLE = "{SETIMAGE: w=30&h=30&crop=1} + - + diff --git a/e107_plugins/pm/shortcodes/batch/pm_shortcodes.php b/e107_plugins/pm/shortcodes/batch/pm_shortcodes.php index d170bc9e8..cff18716f 100644 --- a/e107_plugins/pm/shortcodes/batch/pm_shortcodes.php +++ b/e107_plugins/pm/shortcodes/batch/pm_shortcodes.php @@ -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."
".$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 "{$this->var['from_name']}"; + // return "{$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 = "".LAN_PM_4." "; - $ret = "
".e107::getForm()->checkbox('to_userclass',1,false, LAN_PM_4).""; + // $ret = "
".e107::getForm()->checkbox('to_userclass',1,false, LAN_PM_4).""; // 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)."
"; + $ret .= e107::getUserClass()->uc_dropdown('pm_userclass', e_UC_NOBODY, $args)."
"; 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 ""; } @@ -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') : "".LAN_PM_51.""; + $icon = (deftrue('FONTAWESOME')) ? e107::getParser()->toGlyph('fa-user-plus','fw=1') : "".LAN_PM_51.""; - return "".$icon.""; + return "".$icon.""; } else { - $icon = (deftrue('FONTAWESOME')) ? e107::getParser()->toGlyph('fa-user-times') : "".LAN_PM_50.""; + $icon = (deftrue('FONTAWESOME')) ? e107::getParser()->toGlyph('fa-user-times','fw=1') : "".LAN_PM_50.""; - return "".$icon.""; + return "".$icon.""; } } @@ -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 "".$tp->toGlyph('fa-edit',' ')."Compose"; + } + + private function url($route, $params = array()) { diff --git a/user.php b/user.php index 616781051..a5262a4b7 100644 --- a/user.php +++ b/user.php @@ -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())
".LAN_PM_1.": ".LAN_PM_1.":
".LAN_PM_2.": {PM_FORM_TOUSER}
-
{PM_FORM_TOCLASS}
{PM_FORM_TO}
".LAN_PM_5.":
   ".LAN_PM_5."".LAN_PM_31."".LAN_PM_32." ".LAN_PM_31."".LAN_PM_5."".LAN_PM_32."{PM_COMPOSE: class=block-level}
{PM_SELECT} {PM_ATTACHMENT_ICON}{PM_AVATAR: shape=circle} {PM_FROM=link} {PM_SUBJECT=link,inbox}{PM_FROM=link}{PM_DATE} {PM_DELETE=inbox} {PM_BLOCK_USER}