mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
r291
git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@291 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
6a33fcba58
commit
4553d083d7
3 changed files with 60 additions and 47 deletions
|
@ -42,6 +42,10 @@ switch ($ajax->action)
|
|||
case 'user_register':
|
||||
require(INC_DIR .'functions_validate.php');
|
||||
break;
|
||||
|
||||
case 'manage_user':
|
||||
require(INC_DIR .'functions_admin.php');
|
||||
break;
|
||||
}
|
||||
|
||||
// position in $ajax->valid_actions['xxx']
|
||||
|
@ -63,13 +67,13 @@ class ajax_common
|
|||
'edit_user_profile' => array('admin'),
|
||||
'change_user_rank' => array('admin'),
|
||||
'change_user_opt' => array('admin'),
|
||||
'delete_userdata' => array('admin'),
|
||||
|
||||
'change_tor_status' => array('mod'),
|
||||
'mod_action' => array('mod'),
|
||||
|
||||
'gen_passkey' => array('user'),
|
||||
'change_torrent' => array('user'),
|
||||
'manage_user' => array('user'),
|
||||
|
||||
'view_post' => array('guest'),
|
||||
'view_torrent' => array('guest'),
|
||||
|
@ -412,17 +416,17 @@ class ajax_common
|
|||
$this->response['html'] = $html;
|
||||
$this->response['mode'] = $mode;
|
||||
}
|
||||
|
||||
|
||||
function get_forum_mods()
|
||||
{
|
||||
global $lang, $datastore;
|
||||
|
||||
|
||||
$forum_id = (int) $this->request['forum_id'];
|
||||
|
||||
|
||||
$datastore->enqueue(array(
|
||||
'moderators',
|
||||
));
|
||||
|
||||
|
||||
$moderators = array();
|
||||
$mod = $datastore->get('moderators');
|
||||
|
||||
|
@ -433,7 +437,7 @@ class ajax_common
|
|||
$moderators[] = '<a href="'. PROFILE_URL . $user_id .'">'. $mod['name_users'][$user_id] .'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($mod['mod_groups'][$forum_id]))
|
||||
{
|
||||
foreach ($mod['mod_groups'][$forum_id] as $group_id)
|
||||
|
@ -441,10 +445,10 @@ class ajax_common
|
|||
$moderators[] = '<a href="'. "groupcp.php?". POST_GROUPS_URL ."=". $group_id .'">'. $mod['name_groups'][$group_id] .'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$html = ': ';
|
||||
$html .= ($moderators) ? join(', ', $moderators) : $lang['NONE'];
|
||||
|
||||
|
||||
$this->response['html'] = '<strong>'.$html.'</strong>';
|
||||
unset($moderators, $mod);
|
||||
$datastore->rm('moderators');
|
||||
|
@ -484,10 +488,10 @@ class ajax_common
|
|||
{
|
||||
require(AJAX_DIR .'posts.php');
|
||||
}
|
||||
|
||||
function delete_userdata()
|
||||
|
||||
function manage_user()
|
||||
{
|
||||
require(AJAX_DIR .'delete_userdata.php');
|
||||
require(AJAX_DIR .'manage_user.php');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,55 +6,66 @@ global $userdata, $lang;
|
|||
|
||||
$mode = (string) $this->request['mode'];
|
||||
$user_id = $this->request['user_id'];
|
||||
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
case 'delete_profile':
|
||||
if ($userdata['user_id'] == $user_id) $this->ajax_die($lang['USER_DELETE_ME']);
|
||||
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['USER_DELETE_CONFIRM']);
|
||||
|
||||
if ($user_id != 2 && $user_id != BOT_UID)
|
||||
{
|
||||
require(INC_DIR .'functions_admin.php');
|
||||
|
||||
if ($user_id != BOT_UID)
|
||||
{
|
||||
user_delete($user_id);
|
||||
delete_user_sessions($user_id);
|
||||
|
||||
|
||||
$this->response['info'] = $lang['USER_DELETED'];
|
||||
}
|
||||
else $this->ajax_die($lang['USER_DELETE_CSV']);
|
||||
break;
|
||||
|
||||
case 'delete_message':
|
||||
|
||||
case 'delete_topics':
|
||||
if (empty($this->request['confirmed']) && $userdata['user_id'] == $user_id) $this->prompt_for_confirm($lang['DELETE_USER_POSTS_ME']);
|
||||
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DELETE_USER_POSTS_CONFIRM']);
|
||||
|
||||
if (empty($this->request['confirmed'])) $this->prompt_for_confirm('Óäàëèòü âñå ñîîáùåíèÿ è âñå íà÷àòûå þçåðîì òîïèêè öåëèêîì?');
|
||||
|
||||
if (IS_ADMIN)
|
||||
{
|
||||
require(INC_DIR .'functions_admin.php');
|
||||
|
||||
post_delete('user', $user_id);
|
||||
|
||||
$user_topics = DB()->fetch_rowset("SELECT topic_id FROM ". BB_TOPICS ." WHERE topic_poster = $user_id", 'topic_id');
|
||||
$deleted_topics = topic_delete($user_topics);
|
||||
$deleted_posts = post_delete('user', $user_id);
|
||||
|
||||
$this->response['info'] = $lang['USER_DELETED_POSTS'];
|
||||
}
|
||||
else $this->ajax_die($lang['NOT_ADMIN']);
|
||||
break;
|
||||
|
||||
|
||||
case 'delete_message':
|
||||
if (empty($this->request['confirmed']) && $userdata['user_id'] == $user_id) $this->prompt_for_confirm($lang['DELETE_USER_POSTS_ME']);
|
||||
if (empty($this->request['confirmed'])) $this->prompt_for_confirm('Óäàëèòü âñå ñîîáùåíèÿ, êðîìå çàãëàâíûõ?');
|
||||
|
||||
if (IS_ADMIN)
|
||||
{
|
||||
post_delete('user', $user_id);
|
||||
|
||||
$this->response['info'] = $lang['USER_DELETED_POSTS'];
|
||||
}
|
||||
else $this->ajax_die($lang['NOT_ADMIN']);
|
||||
break;
|
||||
|
||||
case 'user_activate':
|
||||
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DEACTIVATE_CONFIRM']);
|
||||
|
||||
|
||||
DB()->query("UPDATE ". BB_USERS ." SET user_active = '1' WHERE user_id = ". $user_id);
|
||||
|
||||
|
||||
$this->response['info'] = $lang['USER_ACTIVATE_ON'];
|
||||
break;
|
||||
|
||||
|
||||
case 'user_deactivate':
|
||||
if ($userdata['user_id'] == $user_id) $this->ajax_die($lang['USER_DEACTIVATE_ME']);
|
||||
if ($userdata['user_id'] == $user_id) $this->ajax_die($lang['USER_DEACTIVATE_ME']);
|
||||
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['ACTIVATE_CONFIRM']);
|
||||
|
||||
|
||||
DB()->query("UPDATE ". BB_USERS ." SET user_active = '0' WHERE user_id = ". $user_id);
|
||||
delete_user_sessions($user_id);
|
||||
|
||||
|
||||
$this->response['info'] = $lang['USER_ACTIVATE_OFF'];
|
||||
break;
|
||||
}
|
|
@ -92,9 +92,13 @@ $(document).ready(function(){
|
|||
<var class="ajax-params">{action: "edit_user_profile", id: "u_up_release"}</var>
|
||||
<var class="ajax-params">{action: "edit_user_profile", id: "u_up_bonus"}</var>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- ENDIF / SHOW_ADMIN_OPTIONS -->
|
||||
|
||||
<script type="text/javascript">
|
||||
ajax.callback.manage_user = function(data) {
|
||||
if(data.info) alert(data.info);
|
||||
if(data.url) document.location.href = data.url;
|
||||
};
|
||||
</script>
|
||||
<a name="editprofile"></a>
|
||||
|
||||
<h1 class="pagetitle">{L_VIEWING_PROFILE}</h1>
|
||||
|
@ -211,7 +215,8 @@ $(document).ready(function(){
|
|||
<td id="user_regdate">
|
||||
<span class="editable bold">{USER_REGDATE}</span>
|
||||
<!-- IF IS_ADMIN -->
|
||||
[ <a href="#" onclick="ajax.exec({action : 'delete_userdata', mode: '<!-- IF USER_ACTIVE -->user_deactivate<!-- ELSE -->user_activate<!-- ENDIF -->', user_id : {PROFILE_USER_ID}}); return false;" class="<!-- IF USER_ACTIVE -->adm<!-- ELSE -->seed bold<!-- ENDIF -->"><!-- IF USER_ACTIVE -->{L_USER_DEACTIVATE}<!-- ELSE -->{L_USER_ACTIVATE}<!-- ENDIF --></a> ]
|
||||
[ <a href="#" onclick="ajax.exec({action : 'manage_user', mode: '<!-- IF USER_ACTIVE -->user_deactivate<!-- ELSE -->user_activate<!-- ENDIF -->', user_id : {PROFILE_USER_ID}}); return false;" class="<!-- IF USER_ACTIVE -->adm<!-- ELSE -->seed bold<!-- ENDIF -->"><!-- IF USER_ACTIVE -->{L_USER_DEACTIVATE}<!-- ELSE -->{L_USER_ACTIVATE}<!-- ENDIF --></a> ]
|
||||
[ <a href="#" onclick="ajax.exec({action : 'manage_user', mode: 'delete_profile', user_id : '{PROFILE_USER_ID}'}); return false;" class="adm">{L_USER_DELETE_EXPLAIN}</a> ]
|
||||
<!-- ENDIF -->
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -237,23 +242,16 @@ $(document).ready(function(){
|
|||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<!-- IF IS_ADMIN -->
|
||||
<tr id="delete" style="display: none;">
|
||||
<td colspan="2" class="med tCenter">
|
||||
[ <a href="#" onclick="ajax.exec({action : 'delete_userdata', mode: 'delete_profile', user_id : '{PROFILE_USER_ID}'}); return false;" class="adm">{L_USER_DELETE_EXPLAIN}</a> ]
|
||||
[ <a href="#" onclick="ajax.exec({action : 'delete_userdata', mode: 'delete_message', user_id : '{PROFILE_USER_ID}'}); return false;" class="adm">{L_DELETE_USER_POSTS}</a> ]
|
||||
|
||||
<script type="text/javascript">
|
||||
ajax.callback.delete_userdata = function(data) {
|
||||
if(data.info) alert(data.info);
|
||||
if(data.url) document.location.href = data.url;
|
||||
};
|
||||
</script>
|
||||
[ <a href="#" onclick="ajax.exec({action : 'manage_user', mode: 'delete_topics', user_id : '{PROFILE_USER_ID}'}); return false;" class="adm">топики целиком</a> ]
|
||||
[ <a href="#" onclick="ajax.exec({action : 'manage_user', mode: 'delete_message', user_id : '{PROFILE_USER_ID}'}); return false;" class="adm">все, кроме заглавных</a> ]
|
||||
</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
|
||||
|
||||
<!-- IF LOCATION -->
|
||||
<tr>
|
||||
<th class="vBottom">{L_LOCATION}:</th>
|
||||
|
@ -383,7 +381,7 @@ $(document).ready(function(){
|
|||
) / {L_DOWNLOADED} <b class="leechmed">{DOWN_TOTAL}</b>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<!-- IF SHOW_PASSKEY -->
|
||||
<script type="text/javascript">
|
||||
ajax.callback.gen_passkey = function(data){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue