mirror of
https://github.com/e107inc/e107.git
synced 2025-07-25 17:01:43 +02:00
This commit is contained in:
@@ -2,16 +2,14 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2011 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* User lookup handler
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/user_select_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $URL$
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
if (!defined("e_THEME")) {
|
||||
@@ -23,10 +21,11 @@ if (!defined("e_THEME")) {
|
||||
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_select.php");
|
||||
|
||||
class user_select {
|
||||
|
||||
function user_list($class, $form_name) {
|
||||
global $pref, $sql, $tp;
|
||||
class user_select
|
||||
{
|
||||
function user_list($class, $form_name)
|
||||
{
|
||||
global $sql, $tp;
|
||||
if($class === FALSE) { $class = e_UC_MEMBER;}
|
||||
switch ($class)
|
||||
{
|
||||
@@ -57,32 +56,64 @@ class user_select {
|
||||
return $text;
|
||||
}
|
||||
|
||||
function class_list($class, $form_name) {
|
||||
global $pref, $sql;
|
||||
|
||||
/**
|
||||
* Display selection dropdown of all user classes
|
||||
*
|
||||
* @param int $class - if its e_UC_MEMBER, all classes are shown. Otherwise only the class matching the value is shown.
|
||||
*/
|
||||
function class_list($class, $form_name)
|
||||
{
|
||||
global $sql;
|
||||
$text = "<select class='tbox' id='class' name='class' onchange=\"uc_switch('user')\">";
|
||||
$text .= "<option value=''>".US_LAN_2."</option>";
|
||||
if (ADMINPERMS == '0' && $class == e_UC_MEMBER) {
|
||||
if (ADMINPERMS == '0' && $class == e_UC_MEMBER)
|
||||
{
|
||||
$text .= "<option value='all'>".US_LAN_3."</option>";
|
||||
}
|
||||
if ($class == e_UC_MEMBER) {
|
||||
if ($class == e_UC_MEMBER)
|
||||
{
|
||||
$sql -> db_Select("userclass_classes", "userclass_id, userclass_name", "ORDER BY userclass_name", "nowhere");
|
||||
while ($row = $sql -> db_Fetch()) {
|
||||
if (check_class($row['userclass_id']) || ADMINPERMS == '0') {
|
||||
while ($row = $sql -> db_Fetch())
|
||||
{
|
||||
if (check_class($row['userclass_id']) || ADMINPERMS == '0')
|
||||
{
|
||||
$text .= "<option value='".$row['userclass_id'].":".$row['userclass_name']."'>".$row['userclass_name']."</option>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql -> db_Select("userclass_classes", "userclass_id, userclass_name", "userclass_id='".intval($class)."' ORDER BY userclass_name");
|
||||
while ($row = $sql -> db_Fetch()) {
|
||||
while ($row = $sql -> db_Fetch())
|
||||
{
|
||||
$text .= "<option value='".$row['userclass_id'].":".$row['userclass_name']."'>".$row['userclass_name']."</option>";
|
||||
}
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
function select_form($type, $user_form, $user_value = '', $class_form = false, $class_value = '', $class = false)
|
||||
|
||||
/**
|
||||
* Put up user selection form
|
||||
*
|
||||
* @param string $type (list|popup) - determines type of display
|
||||
* @param string $user_form - type.name (textarea|input).name of text box or text area to accept user name (popups only)
|
||||
* @param string $user_value - initial value of user input box
|
||||
* @param int|boolean $class - if non-false, userclass ID to filter list (was unused parameter called $class_form)
|
||||
* @param string $dummy - unused parameter (was called $class_value)
|
||||
* @param int|boolean $oldClass - unused parameter; for legacy purposes, if non-false, overrides $class
|
||||
*
|
||||
* @return string html for display
|
||||
*
|
||||
* @todo remove unused parameters when possible
|
||||
* N.B. Only used by pm plugin in 0.7 core distribution
|
||||
*/
|
||||
// function select_form($type, $user_form, $user_value = '', $class_form = false, $class_value = '', $class = false)
|
||||
function select_form($type, $user_form, $user_value = '', $class = false, $dummy = '', $oldClass = FALSE)
|
||||
{
|
||||
global $tp;
|
||||
if ($oldClass !== FALSE) $class = $oldClass; // Handle legacy position of $class
|
||||
$text = "<script type='text/javascript'>
|
||||
<!--
|
||||
function uc_switch(uctype) {
|
||||
@@ -94,7 +125,8 @@ class user_select {
|
||||
list($form_type, $form_id) = explode(".", $user_form);
|
||||
if($form_id == "") { $form_id = $form_type; }
|
||||
|
||||
if ($type == 'list') {
|
||||
if ($type == 'list')
|
||||
{
|
||||
$text .= $this -> user_list($class, 'user');
|
||||
}
|
||||
else if ($type == 'popup')
|
||||
@@ -107,29 +139,40 @@ class user_select {
|
||||
{
|
||||
$text .= "<input class='tbox' type='text' name='".$form_id."' id='".$form_id."' size='25' maxlength='30' value='".$tp -> post_toForm($user_value)."'> ";
|
||||
}
|
||||
// @todo popup doesn't work ATM because e_HANDLER_ABS not valid
|
||||
$text .= "<img src='".e_IMAGE_ABS."generic/user_select.png'
|
||||
style='width: 16px; height: 16px; vertical-align: top' alt='".US_LAN_4."...'
|
||||
title='".US_LAN_4."...' onclick=\"window.open('".e_HANDLER_ABS."user_select_class.php?".$user_form."','user_search', 'toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width=300,height=200,left=100,top=100'); return false;\" />";
|
||||
}
|
||||
|
||||
if ($class !== false) {
|
||||
if (($class < e_UC_NOBODY && USERCLASS) || ADMINPERMS == '0') {
|
||||
/*
|
||||
This appears to duplicate other functionality, in an unhelpful way!
|
||||
if ($class !== false)
|
||||
{
|
||||
if (($class < e_UC_NOBODY && USERCLASS) || ADMINPERMS == '0')
|
||||
{
|
||||
$text .= ' '.$this -> class_list($class, 'class');
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function real_name($_id) {
|
||||
|
||||
|
||||
function real_name($_id)
|
||||
{
|
||||
global $sql;
|
||||
$sql -> db_Select("user", "user_name", "user_id='".intval($_id)."' ");
|
||||
if ($row = $sql -> db_Fetch()) {
|
||||
if ($row = $sql -> db_Fetch())
|
||||
{
|
||||
return $row['user_name'];
|
||||
}
|
||||
}
|
||||
|
||||
function popup() {
|
||||
function popup()
|
||||
{
|
||||
global $ns, $tp;
|
||||
list($elementType, $elementID) = explode(".", e_QUERY);
|
||||
if($elementType == 'textarea')
|
||||
|
@@ -504,7 +504,7 @@ if(count($del_qry) > 0)
|
||||
$delList = $sql->db_getList();
|
||||
foreach($delList as $p)
|
||||
{
|
||||
$pm->del($p['pm_id']);
|
||||
$pm->del($p['pm_id'], TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -274,32 +274,32 @@ class private_message
|
||||
* When physically deleted, any attachments are deleted as well
|
||||
*
|
||||
* @param integer $pmid - ID of the PM
|
||||
* @param boolean $force - set to TRUE to force deletion of unread PMs
|
||||
* @return boolean|string - FALSE if PM not found, or other DB error. String if successful
|
||||
*/
|
||||
function del($pmid)
|
||||
function del($pmid, $force = FALSE)
|
||||
{
|
||||
$pmid = (int)$pmid;
|
||||
$ret = '';
|
||||
$del_pm = FALSE;
|
||||
$newvals = '';
|
||||
if($this->e107->sql->db_Select('private_msg', '*', 'pm_id = '.$pmid.' AND (pm_from = '.USERID.' OR pm_to = '.USERID.')'))
|
||||
{
|
||||
$row = $this->e107->sql->db_Fetch();
|
||||
if($row['pm_to'] == USERID)
|
||||
if (!$force && ($row['pm_to'] == USERID))
|
||||
{
|
||||
$newvals = 'pm_read_del = 1';
|
||||
$ret .= LAN_PM_42.'<br />';
|
||||
if($row['pm_sent_del'] == 1) { $del_pm = TRUE; }
|
||||
if($row['pm_sent_del'] == 1) { $force = TRUE; }
|
||||
}
|
||||
if($row['pm_from'] == USERID)
|
||||
if (!$force && ($row['pm_from'] == USERID))
|
||||
{
|
||||
if($newvals != '') { $del_pm = TRUE; }
|
||||
if($newvals != '') { $force = TRUE; }
|
||||
$newvals = 'pm_sent_del = 1';
|
||||
$ret .= LAN_PM_43."<br />";
|
||||
if($row['pm_read_del'] == 1) { $del_pm = TRUE; }
|
||||
if($row['pm_read_del'] == 1) { $force = TRUE; }
|
||||
}
|
||||
|
||||
if($del_pm == TRUE)
|
||||
if($force == TRUE)
|
||||
{
|
||||
// Delete any attachments and remove PM from db
|
||||
$attachments = explode(chr(0), $row['pm_attachments']);
|
||||
|
@@ -107,11 +107,11 @@ class pm_handler_shortcodes
|
||||
$type = ($this->pmPrefs['dropdown'] == TRUE ? 'list' : 'popup');
|
||||
if(check_class($this->pmPrefs['multi_class']))
|
||||
{
|
||||
$ret = $us->select_form($type, 'textarea.pm_to');
|
||||
$ret = $us->select_form($type, 'textarea.pm_to', '', $this->pmPrefs['pm_class']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret = $us->select_form($type, 'pm_to');
|
||||
$ret = $us->select_form($type, 'pm_to', '', $this->pmPrefs['pm_class']);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user