'encrypt', 'jquery');
return array_merge(parent::$shortcuts, $shortcuts);
}
public function __construct() {
$handler = array(
'send' => array('process' => 'process_sendSMS'),
'u' => array('process' => 'viewuser'),
);
$this->user->check_auth('u_userlist');
parent::__construct(false, $handler, array());
$this->process();
}
public function process_sendSMS(){
if ($this->in->get('submit') != ''){
$this->user->check_auth('a_sms_send');
$objSMS = register('sms', array($this->config->get('pk_sms_username'), $this->config->get('pk_sms_password')));
$arrReceiver = array();
$strMessage = ($this->in->get('text_area') != '')? $this->in->get('text_area') : '';
$blnReturn = false;
if (is_array($this->in->getArray('sendto', 'string')) && strlen($strMessage)){
$arrReceiverEmails = $this->in->getArray('sendto', 'string');
foreach($arrReceiverEmails as $email){
$arrReceiver[] = $this->crypt->decrypt($email);
}
$blnReturn = $objSMS->send($strMessage, $arrReceiver);
}
if ($blnReturn){
$this->core->message($this->user->lang('sms_success'), $this->user->lang('success'), 'green');
} else {
$this->core->message($objSMS->getError(), $this->user->lang('error'), 'red');
}
}
$this->display();
}
public function viewuser(){
include_once($this->root_path.'core/country_states.php');
$user_id = $this->in->get('u');
$row = $this->pdh->get('user', 'data', array($user_id));
if (!$row){
$this->display();
return;
}
$is_user =($this->user->is_signedin()) ? true : false;
$is_admin = ($this->user->check_group(2, false) || $this->user->check_group(3, false));
$privacy = unserialize($row['privacy_settings']);
$custom = unserialize($row['custom_fields']);
//check the pricacy permissions. if we dont have the permission unset() the data array
$perm = false;
$privacy['priv_set'] = (isset($privacy['priv_set'])) ? $privacy['priv_set'] : -1;
switch ((int)$privacy['priv_set']){
case 0: // all
$perm = true;
break;
case 1: // only user
if($is_user){
$perm = true;
}
break;
case 2: // only admins
if($is_admin){
$perm = true;
}
break;
default:
if($is_user || $is_admin){
$perm = true;
};
}
$phone_perm = false;
$privacy['priv_phone'] = (isset($privacy['priv_phone'])) ? $privacy['priv_phone'] : -1;
switch ((int)$privacy['priv_phone']){
case 0: // all
// do nothing... everything fine
$phone_perm = true;
break;
case 1: // only user
if ($is_user) { $phone_perm = true;}
break;
case 2: // only admins
if ($is_admin) { $phone_perm = true;}
break;
case 3: // nobody
$phone_perm = false;
break;
default:
if ($is_admin || $is_user){
$phone_perm = true;
}
}
if($row['irq'] != ""){
$irc_parts = explode('@',$row['irq']);
$data['irq'] = ' '.$row['irq'].'';
} else {
$data['irq'] = '';
}
$user_avatar = $this->pfh->FolderPath('user_avatars','eqdkp').$custom['user_avatar'];
$age = ($this->time->age($row['birthday']) !== 0) ? $this->time->age($row['birthday']) : '';
$user_data = array(
'userid' => sanitize($row['user_id']),
'USERNAME' => sanitize($row['username']),
'firstandlastname' => (($row['first_name'] != '') ? sanitize($row['first_name']).' ' : '').(($row['last_name'] != '') ? sanitize($row['last_name']) : ''),
'USER_COUNTRY' => ucfirst(strtolower($country_array[$row['country']])),
'USER_COUNTRYFLAG' => ($row['country'] != '') ? '' : '',
'USER_MAIL' => ($perm && ($this->user->is_signedin()) && strlen($row['user_email'])) ? ''.$this->user->lang('adduser_send_mail').'' : '',
'USER_REGISTERED' => ($row['user_registered'] > 0) ? $this->time->user_date($row['user_registered'], true) : '',
'USER_ICQ' => ($perm && strlen($row['icq'])) ? ' '.sanitize($row['icq']).'' : '',
'USER_SKYPE' => ($perm && strlen($row['skype'])) ? ' '.sanitize($row['skype']).'' : '',
'USER_MSN' => ($perm && strlen($row['msn'])) ? ' '.sanitize($row['msn']).' ' : '',
'USER_IRC' => ($perm && strlen($data['irq'])) ? $data['irq'] : '',
'USER_TWITTER' => ($perm && strlen($custom['twitter'])) ? ' '.$custom['twitter'].'' : '',
'USER_FACEBOOK' => ($perm && strlen($custom['facebook'])) ? ''.sanitize($custom['facebook']).'' : '',
'USER_CELLPHONE' => ($phone_perm && strlen($row['cellphone'])) ? ' '.sanitize($row['cellphone']) : '',
'USER_PHONE' => ($phone_perm && strlen($row['phone'])) ? ' '.sanitize($row['phone']) : '',
'USER_IMAGE' => (isset($custom['user_avatar']) && is_file($user_avatar)) ? $user_avatar : $this->root_path.'images/no_pic.png',
'USER_BIRTHDAY' => ($privacy['priv_bday'] == 1) ? $this->time->user_date($row['birthday']).' ('.$age.')': $age,
'USER_TOWN' => sanitize($row['town']),
'USER_HARDWARE' => sanitize($custom['hardware']),
'USER_WORK' => sanitize($custom['work']),
'USER_INTERESTS' => sanitize($custom['interests']),
);
$this->tpl->assign_vars($user_data);
$member_list = $this->pdh->maget('member', array('classid', 'raceid', 'rankname', 'twink', 'name', 'level'), 0, array($this->pdh->get('member', 'connection_id', array($user_id))));
if (is_array($member_list)){
foreach ($member_list as $mid => $member){
$member_array = array(
'NAME' => ''.sanitize($member['name'])."",
'LEVEL' => sanitize($member['level']),
'CLASS' => $this->game->decorate('classes', array($member['classid'])).' '.$this->game->get_name('classes', $member['classid']),
'RACE' => $this->game->decorate('races', array($member['raceid'])).' '.$this->game->get_name('races', $member['raceid']),
'RANK' => sanitize($member['rankname']),
'TYPE' => sanitize($member['twink']),
);
$this->tpl->assign_block_vars('char_row', $member_array );
}
}
$this->jquery->Dialog('usermailer', $this->user->lang('adduser_send_mail'), array('url'=>$this->root_path."email.php".$this->SID."&user=".$row['user_id'], 'width'=>'660', 'height'=>'450'));
$this->core->set_vars(array(
'page_title' => $this->user->lang('user_list'),
'template_file' => 'userprofile.html',
'display' => true)
);
}
public function display(){
include_once($this->root_path.'core/country_states.php');
$is_user = ($this->user->is_signedin()) ? true : false;
$is_admin = ($this->user->check_group(2, false) || $this->user->check_group(3, false));
$usergroups = $this->pdh->get('user_groups', 'id_list', array(true));
$special_user = unserialize(stripslashes($this->config->get('special_user')));
$special_user = (!$special_user) ? array() : $special_user;
unset($usergroups[0]); //Guestgroup
foreach ($usergroups as $group){
$user_in_group = $this->pdh->get('user_groups_users', 'user_list', array($group));
if (is_array($user_in_group) && count($user_in_group) > 0){
$this->tpl->assign_block_vars('group_row', array(
'NAME' => $this->pdh->get('user_groups', 'name', array($group)),
'ID' => $group,
'FOOTCOUNT' => sprintf($this->user->lang('user_group_footcount'), count($user_in_group)),
));
$this->tpl->add_js(' $("#selall_usergr_'.$group.'").click(function(){
var checked_status = this.checked;
$(".cellphonebox_'.$group.'").each(function(){
this.checked = checked_status;
});
});', 'docready');
foreach ($user_in_group as $usr){
if (!in_array($usr, $special_user)){
$row = $this->pdh->get('user', 'data', array($usr));
$privacy = unserialize($row['privacy_settings']);
$custom = unserialize($row['custom_fields']);
//check the pricacy permissions. if we dont have the permission unset() the data array
$perm = false;
$privacy['priv_set'] = (isset($privacy['priv_set'])) ? $privacy['priv_set'] : -1;
switch ((int)$privacy['priv_set']){
case 0: // all
$perm = true;
break;
case 1: // only user
if($is_user){
$perm = true;
}
break;
case 2: // only admins
if($is_admin){
$perm = true;
}
break;
default:
if($is_user || $is_admin){
$perm = true;
};
}
$phone_perm = false;
$privacy['priv_phone'] = (isset($privacy['priv_phone'])) ? $privacy['priv_phone'] : -1;
switch ((int)$privacy['priv_phone']){
case 0: // all
// do nothing... everything fine
$phone_perm = true;
break;
case 1: // only user
if ($is_user) { $phone_perm = true;}
break;
case 2: // only admins
if ($is_admin) { $phone_perm = true;}
break;
case 3: // nobody
$phone_perm = false;
break;
default:
if ($is_admin || $is_user){
$phone_perm = true;
}
}
//IRC
if ($row['irq'] != ""){
$irc_parts = explode('@',$row['irq']);
$data['irq'] = ' '.$this->html->Tooltip('IRC: '.$row['irq'], '').'';
} else {$data['irq'] = '';}
$user_data = array(
'userid' => sanitize($row['user_id']),
'username' => sanitize($row['username']),
'firstandlastname' => (($row['first_name'] != '') ? sanitize($row['first_name']).' ' : '').(($row['last_name'] != '') ? sanitize($row['last_name']) : ''),
'country' => sanitize($row['country']),
'country_flag' => ($row['country'] != '') ? $this->html->Tooltip(ucfirst(strtolower($country_array[$row['country']])), '') : '',
'email' => ($perm && ($this->user->is_signedin()) && strlen($row['user_email'])) ? ''.$this->user->lang('adduser_send_mail').'' : '',
'registered' => ($row['user_registered'] > 0) ? $this->time->user_date($row['user_registered'], true) : '',
'icq' => ($perm && strlen($row['icq'])) ? ''.$this->html->Tooltip('ICQ: '.$row['icq'], '').'' : '',
'skype' => ($perm && strlen($row['skype'])) ? ''.$this->html->Tooltip('Skype: '.$row['skype'], '').'' : '',
'msn' => ($perm && strlen($row['msn'])) ? ''.$this->html->Tooltip('MSN: '.$row['msn'], '').' ' : '',
'irq' => ($perm && strlen($data['irq'])) ? $data['irq'] : '',
'twitter' => ($perm && isset($custom['twitter']) && strlen($custom['twitter'])) ? ''.$this->html->Tooltip('Twitter: '.$custom['twitter'], '').'' : '',
'facebook' => ($perm && isset($custom['facebook']) && strlen($custom['facebook'])) ? ''.$this->html->Tooltip('Facebook: '.$custom['facebook'], '').'' : '',
'cellphone' => ($phone_perm && strlen($row['cellphone'])) ? $this->html->Tooltip($this->user->lang('adduser_cellphone').': '.$row['cellphone'], '') : '',
'phone' => ($phone_perm && strlen($row['phone'])) ? $this->html->Tooltip($this->user->lang('adduser_phone').': '.$row['phone'], '') : '',
'cellphone_checkbox' => (strlen($row['cellphone']) > 1 && isset($privacy['priv_nosms']) && (int)$privacy['priv_nosms'] != 1 && (int)$this->config->get('pk_sms_enable') == 1 && $this->user->check_auth('a_sms_send', false)) ? '' : '',
'charakter_count' => ($members = $this->pdh->get('member', 'connection_id', array($row['user_id']))) ? count($members) : 0,
);
$this->tpl->assign_block_vars('group_row.row_users', $user_data );
}
}
}
} //foreach user-group
if (((int)$this->config->get('pk_sms_enable') == 1) && $this->user->check_auth('a_sms_send', false)){
if(strlen(($this->config->get('pk_sms_username'))) < 1 || strlen(($this->config->get('pk_sms_password')))){
$sms_info = $this->user->lang('sms_info_account')." ".$this->user->lang('sms_info_account_link') ;
if ($_HMODE) {$sms_info = $this->user->lang('sms_info_account')." ".$_HMODE_LINK;}
}
$this->tpl->assign_vars(array(
'F_SMS' => true,
'F_ACC_INFO' => $sms_info,
));
}
$this->jquery->Dialog('usermailer', $this->user->lang('adduser_send_mail'), array('url'=>$this->root_path."email.php".$this->SID."&user='+userid+'", 'width'=>'660', 'height'=>'450', 'withid'=>'userid'));
$this->core->set_vars(array(
'page_title' => $this->user->lang('user_list'),
'template_file' => 'listusers.html',
'display' => true)
);
}
}
if(version_compare(PHP_VERSION, '5.3.0', '<')) registry::add_const('short_listusers', listusers::__shortcuts());
registry::register('listusers');
?>