mirror of
https://github.com/e107inc/e107.git
synced 2025-07-27 01:40:22 +02:00
This commit is contained in:
@@ -2,16 +2,14 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* 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
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
|
* User lookup handler
|
||||||
*
|
*
|
||||||
*
|
* $URL$
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/user_select_class.php,v $
|
* $Id$
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined("e_THEME")) {
|
if (!defined("e_THEME")) {
|
||||||
@@ -23,10 +21,11 @@ if (!defined("e_THEME")) {
|
|||||||
|
|
||||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_select.php");
|
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_select.php");
|
||||||
|
|
||||||
class user_select {
|
class user_select
|
||||||
|
{
|
||||||
function user_list($class, $form_name) {
|
function user_list($class, $form_name)
|
||||||
global $pref, $sql, $tp;
|
{
|
||||||
|
global $sql, $tp;
|
||||||
if($class === FALSE) { $class = e_UC_MEMBER;}
|
if($class === FALSE) { $class = e_UC_MEMBER;}
|
||||||
switch ($class)
|
switch ($class)
|
||||||
{
|
{
|
||||||
@@ -57,32 +56,64 @@ class user_select {
|
|||||||
return $text;
|
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 = "<select class='tbox' id='class' name='class' onchange=\"uc_switch('user')\">";
|
||||||
$text .= "<option value=''>".US_LAN_2."</option>";
|
$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>";
|
$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");
|
$sql -> db_Select("userclass_classes", "userclass_id, userclass_name", "ORDER BY userclass_name", "nowhere");
|
||||||
while ($row = $sql -> db_Fetch()) {
|
while ($row = $sql -> db_Fetch())
|
||||||
if (check_class($row['userclass_id']) || ADMINPERMS == '0') {
|
{
|
||||||
|
if (check_class($row['userclass_id']) || ADMINPERMS == '0')
|
||||||
|
{
|
||||||
$text .= "<option value='".$row['userclass_id'].":".$row['userclass_name']."'>".$row['userclass_name']."</option>";
|
$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");
|
$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>";
|
$text .= "<option value='".$row['userclass_id'].":".$row['userclass_name']."'>".$row['userclass_name']."</option>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $text;
|
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;
|
global $tp;
|
||||||
|
if ($oldClass !== FALSE) $class = $oldClass; // Handle legacy position of $class
|
||||||
$text = "<script type='text/javascript'>
|
$text = "<script type='text/javascript'>
|
||||||
<!--
|
<!--
|
||||||
function uc_switch(uctype) {
|
function uc_switch(uctype) {
|
||||||
@@ -94,7 +125,8 @@ class user_select {
|
|||||||
list($form_type, $form_id) = explode(".", $user_form);
|
list($form_type, $form_id) = explode(".", $user_form);
|
||||||
if($form_id == "") { $form_id = $form_type; }
|
if($form_id == "") { $form_id = $form_type; }
|
||||||
|
|
||||||
if ($type == 'list') {
|
if ($type == 'list')
|
||||||
|
{
|
||||||
$text .= $this -> user_list($class, 'user');
|
$text .= $this -> user_list($class, 'user');
|
||||||
}
|
}
|
||||||
else if ($type == 'popup')
|
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)."'> ";
|
$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'
|
$text .= "<img src='".e_IMAGE_ABS."generic/user_select.png'
|
||||||
style='width: 16px; height: 16px; vertical-align: top' alt='".US_LAN_4."...'
|
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;\" />";
|
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');
|
$text .= ' '.$this -> class_list($class, 'class');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
function real_name($_id) {
|
|
||||||
|
|
||||||
|
function real_name($_id)
|
||||||
|
{
|
||||||
global $sql;
|
global $sql;
|
||||||
$sql -> db_Select("user", "user_name", "user_id='".intval($_id)."' ");
|
$sql -> db_Select("user", "user_name", "user_id='".intval($_id)."' ");
|
||||||
if ($row = $sql -> db_Fetch()) {
|
if ($row = $sql -> db_Fetch())
|
||||||
|
{
|
||||||
return $row['user_name'];
|
return $row['user_name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function popup() {
|
function popup()
|
||||||
|
{
|
||||||
global $ns, $tp;
|
global $ns, $tp;
|
||||||
list($elementType, $elementID) = explode(".", e_QUERY);
|
list($elementType, $elementID) = explode(".", e_QUERY);
|
||||||
if($elementType == 'textarea')
|
if($elementType == 'textarea')
|
||||||
|
@@ -504,7 +504,7 @@ if(count($del_qry) > 0)
|
|||||||
$delList = $sql->db_getList();
|
$delList = $sql->db_getList();
|
||||||
foreach($delList as $p)
|
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
|
* When physically deleted, any attachments are deleted as well
|
||||||
*
|
*
|
||||||
* @param integer $pmid - ID of the PM
|
* @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
|
* @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;
|
$pmid = (int)$pmid;
|
||||||
$ret = '';
|
$ret = '';
|
||||||
$del_pm = FALSE;
|
|
||||||
$newvals = '';
|
$newvals = '';
|
||||||
if($this->e107->sql->db_Select('private_msg', '*', 'pm_id = '.$pmid.' AND (pm_from = '.USERID.' OR pm_to = '.USERID.')'))
|
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();
|
$row = $this->e107->sql->db_Fetch();
|
||||||
if($row['pm_to'] == USERID)
|
if (!$force && ($row['pm_to'] == USERID))
|
||||||
{
|
{
|
||||||
$newvals = 'pm_read_del = 1';
|
$newvals = 'pm_read_del = 1';
|
||||||
$ret .= LAN_PM_42.'<br />';
|
$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';
|
$newvals = 'pm_sent_del = 1';
|
||||||
$ret .= LAN_PM_43."<br />";
|
$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
|
// Delete any attachments and remove PM from db
|
||||||
$attachments = explode(chr(0), $row['pm_attachments']);
|
$attachments = explode(chr(0), $row['pm_attachments']);
|
||||||
|
@@ -107,11 +107,11 @@ class pm_handler_shortcodes
|
|||||||
$type = ($this->pmPrefs['dropdown'] == TRUE ? 'list' : 'popup');
|
$type = ($this->pmPrefs['dropdown'] == TRUE ? 'list' : 'popup');
|
||||||
if(check_class($this->pmPrefs['multi_class']))
|
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
|
else
|
||||||
{
|
{
|
||||||
$ret = $us->select_form($type, 'pm_to');
|
$ret = $us->select_form($type, 'pm_to', '', $this->pmPrefs['pm_class']);
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user