コード例 #1
0
    static function userProfile($user, $option, $submitvalue)
    {
        global $_CB_framework, $ueConfig, $_POST, $_PLUGINS;
        $_PLUGINS->loadPluginGroup('user');
        $results = $_PLUGINS->trigger('onBeforeUserProfileRequest', array(&$user, 1));
        if ($_PLUGINS->is_errors()) {
            echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n";
            exit;
        }
        $cbTemplate = HTML_comprofiler::_cbTemplateLoad();
        $cbMyIsModerator = isModerator($_CB_framework->myId());
        $cbUserIsModerator = isModerator($user->id);
        $showProfile = 1;
        if ($user->banned != 0 || $user->block == 1 && $user->confirmed && $user->approved) {
            echo "<font color='red'>";
            if ($user->banned != 0) {
                if ($_CB_framework->myId() != $user->id) {
                    echo _UE_USERPROFILEBANNED;
                } else {
                    echo _UE_BANNED_CHANGE_PROFILE;
                }
            }
            if ($user->block == 1 && $user->confirmed && $user->approved) {
                echo _UE_USERPROFILEBLOCKED;
            }
            if ($_CB_framework->myId() != $user->id && $cbMyIsModerator != 1) {
                $showProfile = 0;
            } else {
                if ($user->block == 1) {
                    echo ": " . _UE_LOGIN_BLOCKED;
                }
                if ($user->banned != 0) {
                    echo "<br />" . nl2br($user->bannedreason);
                }
            }
            echo "<br /></font>";
        }
        if (!$user->confirmed) {
            echo "<font color='red'>" . _UE_USER_NOT_CONFIRMED . "</font><br />";
        }
        if (!$user->approved) {
            echo "<font color='red'>" . _UE_USER_NOT_APPROVED . "</font><br />";
        }
        if ((!$user->confirmed || !$user->approved) && $cbMyIsModerator != 1) {
            $showProfile = 0;
        }
        if ($showProfile == 1) {
            $results = $_PLUGINS->trigger('onBeforeUserProfileDisplay', array(&$user, 1, $cbUserIsModerator, $cbMyIsModerator));
            if ($_PLUGINS->is_errors()) {
                echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n";
                exit;
            }
            $output = 'html';
            $cbUser =& CBuser::getInstance($user->id);
            $_CB_framework->displayedUser((int) $user->id);
            $userViewTabs = $cbUser->getProfileView();
            /*
            			$tabs = new cbTabs( 0, 1 );
            			$userViewTabs = $tabs->getViewTabs($user);			// this loads, registers menu and user status and renders the tabs
            */
            $_CB_framework->setPageTitle(cbUnHtmlspecialchars(getNameFormat($user->name, $user->username, $ueConfig['name_format'])));
            $_CB_framework->appendPathWay(getNameFormat($user->name, $user->username, $ueConfig['name_format']));
            outputCbTemplate(1);
            initToolTip(1);
            $_CB_framework->document->addHeadScriptDeclaration('
	function cbConnSubmReq() {
		cClick();
		document.connOverForm.submit();
	}
	function confirmSubmit() {
	if (confirm("' . _UE_CONFIRMREMOVECONNECTION . '"))
		return true ;
	else
		return false ;
	}
');
            if (is_array($results)) {
                echo implode('', $results);
            }
            echo "\n\t<div class=\"cbProfile\"><div id=\"cbProfileInner\">";
            echo HTML_comprofiler::_cbTemplateRender($cbTemplate, $user, 'Profile', 'drawProfile', array(&$user, &$userViewTabs), $output);
            echo "</div><div class=\"cbClr\"></div></div>\n" . "<div class=\"cbClr\"></div>";
            // end of cbProfile floating div
            $tab = null;
            if (isset($_GET['tab'])) {
                $tab = urldecode(stripslashes(cbGetParam($_GET, 'tab', '')));
            } elseif (isset($_POST['tab'])) {
                $tab = stripslashes(cbGetParam($_POST, 'tab', ''));
            }
            if ($tab) {
                $_CB_framework->outputCbJQuery("showCBTab('" . addslashes($tab) . "');");
            }
            if ($_CB_framework->myId() != $user->id) {
                recordViewHit($_CB_framework->myId(), $user->id, getenv('REMOTE_ADDR'));
            }
            $_PLUGINS->trigger('onAfterUserProfileDisplay', array($user, true));
        }
    }
コード例 #2
0
 static function userProfile($user, $option, $submitvalue)
 {
     global $_CB_framework, $ueConfig, $_POST, $_PLUGINS;
     $_PLUGINS->loadPluginGroup('user');
     $_PLUGINS->trigger('onBeforeUserProfileRequest', array(&$user, 1));
     if ($_PLUGINS->is_errors()) {
         echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n";
         exit;
     }
     $cbTemplate = HTML_comprofiler::_cbTemplateLoad();
     $cbMyIsModerator = Application::MyUser()->isModeratorFor(Application::User((int) $user->id));
     $cbUserIsModerator = Application::User((int) $user->id)->isGlobalModerator();
     $showProfile = 1;
     if ($user->banned != 0 || $user->block == 1 && $user->confirmed && $user->approved) {
         if ($user->banned != 0) {
             if ($_CB_framework->myId() != $user->id) {
                 $_CB_framework->enqueueMessage(CBTxt::T('UE_USERPROFILEBANNED', 'This profile has been banned by a moderator.') . ($user->bannedreason && $cbMyIsModerator ? '<p>' . nl2br($user->bannedreason) . '</p>' : null), 'error');
             } else {
                 $_CB_framework->enqueueMessage(CBTxt::T('UE_BANNED_CHANGE_PROFILE', 'Your Profile is banned. Only you and moderators can see it.<br />Please follow the request of the moderator, then choose moderation / unban to submit a request for unbanning your profile.') . ($user->bannedreason ? '<p>' . nl2br($user->bannedreason) . '</p>' : null), 'error');
             }
         }
         if ($user->block == 1) {
             $_CB_framework->enqueueMessage(CBTxt::T('UE_USERPROFILEBLOCKED', 'This profile is no longer available.'), 'error');
         }
         if ($_CB_framework->myId() != $user->id && $cbMyIsModerator != 1) {
             $showProfile = 0;
         }
     }
     if (!$user->confirmed) {
         $_CB_framework->enqueueMessage(CBTxt::T('UE_USER_NOT_CONFIRMED', 'This user has not yet confirmed his email address and account!'), 'error');
     }
     if (!$user->approved) {
         $_CB_framework->enqueueMessage(CBTxt::T('UE_USER_NOT_APPROVED', 'This user has not yet been approved by a moderator!'), 'error');
     }
     if ((!$user->confirmed || !$user->approved) && $cbMyIsModerator != 1) {
         $showProfile = 0;
     }
     if ($showProfile == 1) {
         $results = $_PLUGINS->trigger('onBeforeUserProfileDisplay', array(&$user, 1, $cbUserIsModerator, $cbMyIsModerator));
         if ($_PLUGINS->is_errors()) {
             echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n";
             exit;
         }
         $output = 'html';
         $cbUser =& CBuser::getInstance($user->id);
         $_CB_framework->displayedUser((int) $user->id);
         $userViewTabs = $cbUser->getProfileView();
         $_CB_framework->setPageTitle(cbUnHtmlspecialchars(getNameFormat($user->name, $user->username, $ueConfig['name_format'])));
         $_CB_framework->appendPathWay(getNameFormat($user->name, $user->username, $ueConfig['name_format']));
         outputCbTemplate(1);
         initToolTip(1);
         $pageClass = $_CB_framework->getMenuPageClass();
         $return = '<div class="cbProfile cb_template cb_template_' . selectTemplate('dir') . ($pageClass ? ' ' . htmlspecialchars($pageClass) : null) . '">';
         if (is_array($results)) {
             $return .= implode('', $results);
         }
         $return .= $_PLUGINS->callTemplate($cbTemplate, 'Profile', 'drawProfile', array(&$user, &$userViewTabs), $output) . '</div>' . cbPoweredBy();
         echo $return;
         if ($_CB_framework->myId() != $user->id) {
             recordViewHit($_CB_framework->myId(), $user->id, getenv('REMOTE_ADDR'));
         }
         $_PLUGINS->trigger('onAfterUserProfileDisplay', array($user, true));
         $_CB_framework->setMenuMeta();
     }
 }