Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function useredit($uid = 0) {
- global $nav;
- $nav[] = url('admin/users',t('Users'));
- $res = sql_query("select * from `".tb()."accounts` where id='$uid' ");
- $user = sql_fetch_array($res);
- $user['roles'] = explode('|',$user['roles']);
- if (!$user['id']) {
- die('wrong uid');
- }
- if ($user['featured']) $featured = 'checked';
- section_content('
- <p>
- '.t('Username').':
- <strong>'.$user['username'].'</strong>
- ('.url('u/'.$user['username'],t('View profile')).')<br />
- Email: '.$user['email'].'<br />
- Location: '.h($user['location']).'
- </p>
- <p>
- <label>User IP</label>
- <strong>'.$user['ipaddress'].'</strong> (<a href="http://www.google.ca/search?q='.$user['ipaddress'].'" target="_blank">Whois</a>)
- </p>
- <fieldset>
- <form action="'.url('admin/usereditpost').'" method="post">
- <p>
- '.label('User Roles'));
- $res = sql_query("select * from ".tb()."roles where (id=3 or id>9) order by id");
- while ($role = sql_fetch_array($res)) {
- $checked = '';
- if (in_array($role['id'],$user['roles'])) $checked = ' checked ';
- section_content('<input type="checkbox" name="set_roles[]" value="'.$role['id'].'" '.$checked.' />'.h($role['name']).' ');
- }
- section_content('
- </p>
- <p>
- '.label(t('Status')).'
- <input type="radio" name="disabled" value=0 '.admin_check_status($user,0).' /> Verified
- <input type="radio" name="disabled" value=1 '.admin_check_status($user,1).' /> Un-verified
- <input type="radio" name="disabled" value=2 '.admin_check_status($user,2).' /> Suspended
- <input type="radio" name="disabled" value=3 '.admin_check_status($user,3).' /> Spammer<br />
- <span>
- <strong>Un-verified</strong> - can not post.<br />
- <strong>Suspended</strong> - can not login.<br />
- <strong>Spammer</strong> - can not post and old posts will be hidden.</span>
- </p>
- <p>
- '.label(t('Featured')).'
- <input type="checkbox" name="set_featured" value=1 '.
- $featured.' /> Featured<br />
- <span class="sub">Featured members have more chance to be displayed.</span>
- </p>
- <p>
- <input type="hidden" name="uid" value="'.$user['id'].'" />
- <input type="submit" value="'.t('Save changes').'" class="button" />
- </p>
- </form>
- </fieldset>');
- if (!in_array(3,$user['roles'])) {
- section_content('<fieldset>
- <form action="'.url('admin/userdelete').'" method="post">
- If you delete this member, <strong>all</strong> his/her posts,comments,and messages will be deleted too.<br />
- <input type="submit" value="Delete" onclick="return confirm(\'Are you sure to delete this user?\');" style="background:yellow" />
- <input type="hidden" name="uid" value="'.$user['id'].'" />
- </form>
- </fieldset>
- ');
- }
- }
- function userdelete() {
- $res = sql_query("select * from `".tb()."accounts` where id='{$_POST['uid']}' ");
- $user = sql_fetch_array($res);
- if (!$user['id']) {
- sys_back('wrong uid');
- }
- $uid = $user['id'];
- /*delete forum posts*/
- sql_query("delete from ".tb()."accounts where id='$uid'");
- sql_query("delete from ".tb()."forum_threads where userid='$uid'");
- sql_query("delete from ".tb()."forum_posts where uid='$uid'");
- /*delete comments*/
- sql_query("delete from ".tb()."comments where uid='$uid'");
- /*delete follower*/
- sql_query("delete from ".tb()."followers where uid='$uid' or fid='$uid'");
- /*others*/
- sql_query("delete from ".tb()."friends where uid='$uid' or fid='$uid'");
- sql_query("delete from ".tb()."groups where creatorid='$uid'");
- sql_query("delete from ".tb()."group_members where uid='$uid'");
- sql_query("delete from ".tb()."group_members_pending where uid='$uid'");
- sql_query("delete from ".tb()."group_posts where uid='$uid'");
- sql_query("delete from ".tb()."group_topics where uid='$uid'");
- sql_query("delete from ".tb()."messages where from_id='$uid' or to_id='$uid'");
- sql_query("delete from ".tb()."profiles where id='$uid'");
- sql_query("delete from ".tb()."profile_comments where uid='$uid'");
- $res = sql_query("select id from ".tb()."stories where uid='$uid'");
- while ($story = sql_fetch_array($res)) {
- $res2 = sql_query("select uri from ".tb()."story_photos where sid='{$story['id']}'");
- while($photo = sql_fetch_array($res2)) {
- @unlink($photo['uri']);
- }
- }
- sql_query("delete from ".tb()."stories where app='blogs'");
- sql_query("delete from ".tb()."stories where uid='$uid'");
- sql_query("delete from ".tb()."streams where uid='$uid'");
- sql_query("delete from ".tb()."liked where uid='$uid'");
- redirect('admin/members_quick',1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement