1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00
php-e107/user.php

222 lines
4.6 KiB
PHP
Raw Normal View History

2006-12-02 04:36:16 +00:00
<?php
/*
2008-12-20 20:19:05 +00:00
* e107 website system
*
* Copyright (C) 2008-2010 e107 Inc (e107.org)
2008-12-20 20:19:05 +00:00
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* User information
*
* $URL$
* $Id$
2008-12-20 20:19:05 +00:00
*
*/
2009-08-28 15:30:25 +00:00
//HCL define('PAGE_NAME', 'Members');
2008-12-20 20:19:05 +00:00
2006-12-02 04:36:16 +00:00
require_once("class2.php");
2009-08-28 15:30:25 +00:00
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
// Next bit is to fool PM plugin into doing things
global $user;
$user['user_id'] = USERID;
2012-06-19 12:53:48 +00:00
// require_once(e_CORE."shortcodes/batch/user_shortcodes.php");
2006-12-02 04:36:16 +00:00
require_once(e_HANDLER."form_handler.php");
if (isset($_POST['delp']))
{
$tmp = explode(".", e_QUERY);
if ($tmp[0]=="self")
{
$tmp[1]=USERID;
}
if (USERID == $tmp[1] || (ADMIN && getperms("4")))
{
$sql->db_Select("user", "user_sess", "user_id='". USERID."'");
2008-01-15 22:16:07 +00:00
$row = $sql->db_Fetch();
@unlink(e_UPLOAD."avatars/".$row['user_sess']);
2006-12-02 04:36:16 +00:00
$sql->db_Update("user", "user_sess='' WHERE user_id=".intval($tmp[1]));
header("location:".e_SELF."?id.".$tmp[1]);
exit;
}
}
$qs = explode(".", e_QUERY);
$self_page =($qs[0] == 'id' && intval($qs[1]) == USERID);
2012-06-19 12:53:48 +00:00
include_once(e107::coreTemplatePath('user')); //correct way to load a core template.
$user_shortcodes = e107::getScBatch('user');
/*
2006-12-02 04:36:16 +00:00
if (file_exists(THEME."user_template.php"))
{
require_once(THEME."user_template.php");
}
else
{
require_once(e_BASE.$THEMES_DIRECTORY."templates/user_template.php");
}
2012-06-19 12:53:48 +00:00
*/
2006-12-02 04:36:16 +00:00
$user_frm = new form;
require_once(HEADERF);
if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
$full_perms = getperms("0") || check_class(varset($pref['memberlist_access'], 253)); // Controls display of info from other users
if (!$full_perms && !$self_page)
2006-12-02 04:36:16 +00:00
{
2008-12-20 20:19:05 +00:00
$ns->tablerender(LAN_USER_48, "<div style='text-align:center'>".LAN_USER_55."</div>");
2006-12-02 04:36:16 +00:00
require_once(FOOTERF);
exit;
}
if (isset($_POST['records']))
{
$records = intval($_POST['records']);
$order = ($_POST['order'] == 'ASC' ? 'ASC' : 'DESC');
$from = 0;
}
else if(!e_QUERY)
{
$records = 20;
$from = 0;
$order = "DESC";
}
else
{
if ($qs[0] == "self")
{
$id = USERID;
}
else
{
if ($qs[0] == "id")
{
2008-06-05 19:57:52 +00:00
$id = intval($qs[1]);
2006-12-02 04:36:16 +00:00
}
else
{
$qs = explode(".", e_QUERY);
$from = intval($qs[0]);
$records = intval($qs[1]);
$order = ($qs[2] == 'ASC' ? 'ASC' : 'DESC');
}
}
}
if ($records > 30)
{
$records = 30;
}
if (isset($id))
{
if ($id == 0)
{
2008-12-20 20:19:05 +00:00
$text = "<div style='text-align:center'>".LAN_USER_49." ".SITENAME."</div>";
$ns->tablerender(LAN_USER_48, $text);
2006-12-02 04:36:16 +00:00
require_once(FOOTERF);
exit;
}
$loop_uid = $id;
$ret = $e_event->trigger("showuser", $id);
if ($ret!='')
{
$text = "<div style='text-align:center'>".$ret."</div>";
2008-12-20 20:19:05 +00:00
$ns->tablerender(LAN_USER_48, $text);
2006-12-02 04:36:16 +00:00
require_once(FOOTERF);
exit;
}
if($pref['profile_comments'])
2006-12-02 04:36:16 +00:00
{
require_once(e_HANDLER."comment_class.php");
$comment_edit_query = 'comment.user.'.$id;
2006-12-02 04:36:16 +00:00
}
if (isset($_POST['commentsubmit']) && $pref['profile_comments'])
2006-12-02 04:36:16 +00:00
{
$cobj = new comment;
$cobj->enter_comment($_POST['author_name'], $_POST['comment'], 'profile', $id, $pid, $_POST['subject']);
2006-12-02 04:36:16 +00:00
}
if($text = renderuser($id))
{
2008-12-20 20:19:05 +00:00
$ns->tablerender(LAN_USER_50, $text);
2006-12-02 04:36:16 +00:00
}
else
{
2008-12-20 20:19:05 +00:00
$text = "<div style='text-align:center'>".LAN_USER_51."</div>";
$ns->tablerender(LAN_USER_48, $text);
2006-12-02 04:36:16 +00:00
}
unset($text);
require_once(FOOTERF);
exit;
}
$users_total = $sql->db_Count("user","(*)", "WHERE user_ban = 0");
if (!$sql->db_Select("user", "*", "user_ban = 0 ORDER BY user_id $order LIMIT $from,$records"))
{
2008-12-20 20:19:05 +00:00
echo "<div style='text-align:center'><b>".LAN_USER_53."</b></div>";
2006-12-02 04:36:16 +00:00
}
else
{
$userList = $sql->db_getList();
2008-04-01 19:58:41 +00:00
$text = $tp->parseTemplate($USER_SHORT_TEMPLATE_START, TRUE, $user_shortcodes);
2006-12-02 04:36:16 +00:00
foreach ($userList as $row)
{
$loop_uid = $row['user_id'];
2012-06-19 12:53:48 +00:00
2006-12-02 04:36:16 +00:00
$text .= renderuser($row, "short");
}
$text .= $tp->parseTemplate($USER_SHORT_TEMPLATE_END, TRUE, $user_shortcodes);
}
2008-12-20 20:19:05 +00:00
$ns->tablerender(LAN_USER_52, $text);
2006-12-02 04:36:16 +00:00
$parms = $users_total.",".$records.",".$from.",".e_SELF.'?[FROM].'.$records.".".$order;
echo "<div class='nextprev'>&nbsp;".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
function renderuser($uid, $mode = "verbose")
{
global $sql, $pref, $tp, $sc_style, $user_shortcodes;
global $EXTENDED_START, $EXTENDED_TABLE, $EXTENDED_END, $USER_SHORT_TEMPLATE, $USER_FULL_TEMPLATE;
global $user;
if(is_array($uid))
{
$user = $uid;
}
else
{
if(!$user = get_user_data($uid))
{
return FALSE;
}
}
2012-06-19 12:53:48 +00:00
e107::getScBatch('user')->setVars($user);
2006-12-02 04:36:16 +00:00
if($mode == 'verbose')
{
return $tp->parseTemplate($USER_FULL_TEMPLATE, TRUE, $user_shortcodes);
}
else
{
return $tp->parseTemplate($USER_SHORT_TEMPLATE, TRUE, $user_shortcodes);
}
}
require_once(FOOTERF);
2012-06-19 12:53:48 +00:00
?>