function dispatch() { global $xoopsUser, $xoopsConfig; if($this->isGuest()){ redirect_header(XOOPS_URL, 2, _NOPERM); } $user_handler =& XsnsUserHandler::getInstance(); $user =& $user_handler->get($xoopsUser->getVar('uid')); if(!is_object($user)){ redirect_header(XOOPS_URL, 2, _NOPERM); } require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; require_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/user.php'; require_once XOOPS_ROOT_PATH.'/include/comment_constants.php'; $config_handler =& xoops_gethandler('config'); if(defined('XOOPS_CUBE_LEGACY')){ $xoopsConfigUser =& $config_handler->getConfigsByDirname('user'); $user_config =& $xoopsConfigUser; } else{ $xoopsConfigUser =& $config_handler->getConfigsByCat(XOOPS_CONF_USER); $user_config =& $xoopsConfig; } require_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/notification.php'; require_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; $elements = array(); $token_handler = new XoopsMultiTokenHandler(); $token = new XoopsFormToken($token_handler->create('edituser')); // Hidden $elements['hiddens'] = array( array('html' => '<input type="hidden" name="'.XSNS_PAGE_ARG.'" value="mypage">'), array('html' => '<input type="hidden" name="'.XSNS_ACTION_ARG.'" value="profile_edit_exec">'), array('html' => '<input type="hidden" name="uid" value="'.$xoopsUser->getVar('uid').'">'), array('html' => '<input type="hidden" name="'.$token->_name.'" value="'.$token->_value.'">'), ); // Avatar $elements['avatar'] = array( 'name' => 'user_avatar', 'value' => $xoopsUser->getVar('user_avatar'), 'html' => '<img src="'.XOOPS_UPLOAD_URL.'/'.$xoopsUser->getVar('user_avatar').'" alt="'.$xoopsUser->getVar('uname').'" /><br>[<a href="'.XSNS_URL_MYPAGE.'&'.XSNS_ACTION_ARG.'=profile_avatar_up'.'">'._MD_XSNS_PROFILE_AVATAR_EDIT.'</a>]', ); // E-mail if(@$xoopsConfigUser['allow_chgmail']){ $email_text = '<input type="text" name="email" size="30" value="'.$xoopsUser->getVar('email', 'e').'">'; } else{ $email_text = $xoopsUser->getVar('email'); } $elements['email'] = array( 'name' => 'email', 'value' => $xoopsUser->getVar('email'), 'html' => $email_text.'<br><input type="checkbox" name="user_viewemail" value="1"'.($xoopsUser->getVar('user_viewemail') ? ' checked' : '') .'>'._US_ALLOWVIEWEMAIL, ); // Real name $elements['realname'] = array( 'name' => 'name', 'value' => $xoopsUser->getVar('name', 'e'), ); // Web site URL $elements['url'] = array( 'name' => 'url', 'value' => $xoopsUser->getVar('url', 'e'), ); // ICQ $elements['icq'] = array( 'name' => 'user_icq', 'value' => $xoopsUser->getVar('user_icq', 'e'), ); // AIM $elements['aim'] = array( 'name' => 'user_aim', 'value' => $xoopsUser->getVar('user_aim', 'e'), ); // YIM $elements['yim'] = array( 'name' => 'user_yim', 'value' => $xoopsUser->getVar('user_yim', 'e'), ); // MSNM $elements['msnm'] = array( 'name' => 'user_msnm', 'value' => $xoopsUser->getVar('user_msnm', 'e'), ); // Location $elements['location'] = array( 'name' => 'user_from', 'value' => $xoopsUser->getVar('user_from', 'e'), ); // Occupation $elements['occupation'] = array( 'name' => 'user_occ', 'value' => $xoopsUser->getVar('user_occ', 'e'), ); // Interest $elements['interest'] = array( 'name' => 'user_intrest', 'value' => $xoopsUser->getVar('user_intrest', 'e'), ); // Extra info $elements['extra'] = array( 'name' => 'bio', 'value' => $xoopsUser->getVar('bio', 'e'), ); // Signature $sig = $xoopsUser->getVar('user_sig', 'e'); $this->setXoopsCodeTarea('sig_xoops_codes', $sig, 'user_sig', 50, 5, null, 'sig_xoops_smilies'); $elements['sig'] = array( 'name' => 'user_sig', 'value' => $sig, ); $elements['attachsig'] = array( 'name' => 'attachsig', 'value' => $xoopsUser->getVar('attachsig') ? 'checked' : '', ); // Time zone $timezone_offset = $xoopsUser->getVar('timezone_offset'); $timezone_select = new XoopsFormSelectTimezone(_US_TIMEZONE, 'timezone_offset', $timezone_offset); $elements['timezone'] = array( 'name' => 'timezone_offset', 'value' => $timezone_offset, 'html' => XsnsUtils::getSelectBoxHtml('timezone_offset', $timezone_select->_options, $timezone_offset), ); // Event notify method $not_method = $xoopsUser->getVar('notify_method'); $not_method_arr = array( XOOPS_NOTIFICATION_METHOD_DISABLE => _NOT_METHOD_DISABLE, XOOPS_NOTIFICATION_METHOD_PM => _NOT_METHOD_PM, XOOPS_NOTIFICATION_METHOD_EMAIL => _NOT_METHOD_EMAIL, ); $elements['notify_method'] = array( 'name' => 'notify_method', 'value' => $not_method, 'html' => XsnsUtils::getSelectBoxHtml('notify_method', $not_method_arr, $not_method), ); // Event notify mode $not_mode = $xoopsUser->getVar('notify_mode'); $not_mode_arr = array( XOOPS_NOTIFICATION_MODE_SENDALWAYS => _NOT_MODE_SENDALWAYS, XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE => _NOT_MODE_SENDONCE, XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT => _NOT_MODE_SENDONCEPERLOGIN, ); $elements['notify_mode'] = array( 'name' => 'notify_mode', 'value' => $not_mode, 'html' => XsnsUtils::getSelectBoxHtml('notify_mode', $not_mode_arr, $not_mode), ); // Password $elements['password'] = array( 'name' => 'password', 'html' => '<input type="password" name="password" size="15" maxlength="32"> <input type="password" name="vpass" size="15" maxlength="32">', ); // Comment mode $umode = $xoopsUser->getVar('umode'); $umode_arr = array( 'nest' => _NESTED, 'flat' => _FLAT, 'thread' => _THREADED, ); $elements['umode'] = array( 'name' => 'umode', 'value' => $umode, 'html' => XsnsUtils::getSelectBoxHtml('umode', $umode_arr, $umode), ); // Comment order $uorder = $xoopsUser->getVar('uorder'); $uorder_arr = array( XOOPS_COMMENT_OLD1ST => _OLDESTFIRST, XOOPS_COMMENT_NEW1ST => _NEWESTFIRST, ); $elements['uorder'] = array( 'name' => 'uorder', 'value' => $uorder, 'html' => XsnsUtils::getSelectBoxHtml('uorder', $uorder_arr, $uorder), ); // user cookie $usercookie = empty($_COOKIE[@$user_config['usercookie']]) ? 0 : 1; $usercookie_arr = array(1 => _YES, 0 => _NO); $elements['usercookie'] = array( 'name' => 'usercookie', 'value' => $usercookie, 'html' => XsnsUtils::getRadioHtml('usercookie', $usercookie_arr, $usercookie), ); // user mail ok $mailok = $xoopsUser->getVar('user_mailok'); $mailok_arr = array(1 => _YES, 0 => _NO); $elements['mailok'] = array( 'name' => 'user_mailok', 'value' => $mailok, 'html' => XsnsUtils::getRadioHtml('user_mailok', $mailok_arr, $mailok), ); $this->context->setAttribute('user_menu', $user->getMypageMenu()); $this->context->setAttribute('elements', $elements); $this->context->setAttribute('allow_self_delete', @$xoopsConfigUser['self_delete']); }
function dispatch() { global $xoopsUser, $xoopsUserIsAdmin; if($this->isGuest()){ redirect_header(XOOPS_URL, 2, _NOPERM); } $limit = 10; $start = $this->getIntRequest('s', XSNS_REQUEST_GET); if(!isset($start) || $start<0){ $start = 0; } $cid = $this->getIntRequest('cid', XSNS_REQUEST_GET); if(!$cid){ redirect_header(XOOPS_URL, 2, _NOPERM); } // コミュニティの取得 $perm = XSNS_AUTH_XOOPS_ADMIN | XSNS_AUTH_ADMIN; $commu_handler =& XsnsCommunityHandler::getInstance(); $community =& $commu_handler->get($cid); if(!is_object($community) || !$community->checkAuthority($perm)){ redirect_header(XOOPS_URL, 2, _NOPERM); } $commu_vars = array('id' => $cid, 'name' => $community->getVar('name')); // コミュニティメンバー一覧の取得 $c_member_obj_list =& $community->getMemberObjects($limit, $start); $pager = $this->getPageSelector(XSNS_URL_MEMBER."&".XSNS_ACTION_ARG."=edit&cid=".$cid, $start, $limit, count($c_member_obj_list), $community->getMemberCount()); // 管理項目 $menu_list = array( 0 => array( // メンバー 0 => _MD_XSNS_MEMBER_LEAVE, 1 => _MD_XSNS_MEMBER_SET_ADMIN, 2 => _MD_XSNS_MEMBER_SET_SUB_ADMIN, ), 1 => array( // 副管理者 0 => _MD_XSNS_MEMBER_LEAVE, 1 => _MD_XSNS_MEMBER_SET_ADMIN, ), 2 => array( // 承認待ちのメンバー 0 => _MD_XSNS_MEMBER_LEAVE, ), ); $own_uid = $xoopsUser->getVar('uid'); $uid_admin = $community->getVar('uid_admin'); $uid_sub_admin = $community->getVar('uid_sub_admin'); $is_commu_admin = ($own_uid == $uid_admin)? true : false; $c_member_list = array(); foreach($c_member_obj_list as $c_member_obj){ $mid = $c_member_obj->getVar('uid'); $c_member_list[$mid] =& $c_member_obj->getInfo(); $c_member_list[$mid]['form_edit'] = $this->getFormHeader('post', 'member', 'request', false, array('cid'=>$cid, 'uid'=>$mid)); // 対象メンバーが自分自身(管理者)の場合 → 何も表示しない if($mid==$own_uid){ $c_member_list[$mid]['is_editable'] = false; } else{ // XOOPS管理者で、コミュニティの管理者でない場合 → [退会させる]だけを表示 if($xoopsUserIsAdmin && !$is_commu_admin){ $menu = $menu_list[2]; } // 対象メンバーが副管理者の場合 → [副管理者に指名]以外の項目を表示 elseif($mid == $uid_sub_admin){ $menu = $menu_list[1]; } // 対象メンバーが通常のメンバーの場合 → すべての項目を表示 else{ $menu = $menu_list[0]; } $c_member_list[$mid]['is_editable'] = true; $c_member_list[$mid]['sel_edit'] = XsnsUtils::getSelectBoxHtml('mode', $menu); } } $this->context->setAttribute('commu', $commu_vars); $this->context->setAttribute('member_list', $c_member_list); $this->context->setAttribute('pager', $pager); }