예제 #1
0
 function __construct($userid, $do = '')
 {
     $this->_app = JFactory::getApplication();
     $this->my = JFactory::getUser();
     $this->do = $do;
     if ($this->do == 'login') {
         return $this->login();
     } elseif ($this->do == 'logout') {
         return $this->logout();
     }
     kimport('html.parser');
     require_once KPATH_SITE . '/lib/kunena.timeformat.class.php';
     $this->_db = JFactory::getDBO();
     $this->config = KunenaFactory::getConfig();
     if (!$userid) {
         $this->user = $this->my;
     } else {
         $this->user = JFactory::getUser($userid);
     }
     if ($this->user->id == 0 || $this->my->id == 0 && !$this->config->pubprofile) {
         $this->allow = false;
         $this->header = JText::_('COM_KUNENA_LOGIN_NOTIFICATION');
         $this->body = JText::_('COM_KUNENA_PROFILEPAGE_NOT_ALLOWED_FOR_GUESTS') . ' ' . JText::_('COM_KUNENA_NO_ACCESS');
         CKunenaTools::loadTemplate('/login.php');
         return;
     }
     $integration = KunenaFactory::getProfile();
     $activityIntegration = KunenaFactory::getActivityIntegration();
     $template = KunenaFactory::getTemplate();
     $this->params = $template->params;
     if (get_class($integration) == 'KunenaProfileNone') {
         $this->allow = false;
         $this->header = JText::_('COM_KUNENA_PROFILE_DISABLED');
         $this->body = JText::_('COM_KUNENA_PROFILE_DISABLED') . ' ' . JText::_('COM_KUNENA_NO_ACCESS');
         CKunenaTools::loadTemplate('/login.php');
         return;
     }
     $this->allow = true;
     $this->profile = KunenaFactory::getUser($this->user->id);
     if (!$this->profile->exists()) {
         $this->profile->save();
     }
     if ($this->profile->userid == $this->my->id) {
         if ($this->do != 'edit') {
             $this->editlink = CKunenaLink::GetMyProfileLink($this->profile->userid, JText::_('COM_KUNENA_EDIT'), 'nofollow', 'edit');
         } else {
             $this->editlink = CKunenaLink::GetMyProfileLink($this->profile->userid, JText::_('COM_KUNENA_BACK'), 'nofollow');
         }
     }
     $this->name = $this->user->username;
     if ($this->config->userlist_name) {
         $this->name = $this->user->name . ' (' . $this->name . ')';
     }
     if ($this->config->showuserstats) {
         if ($this->config->userlist_usertype) {
             $this->usertype = $this->user->usertype;
         }
         $this->rank_image = $this->profile->getRank(0, 'image');
         $this->rank_title = $this->profile->getRank(0, 'title');
         $this->posts = $this->profile->posts;
         $this->userpoints = $activityIntegration->getUserPoints($this->profile->userid);
         $this->usermedals = $activityIntegration->getUserMedals($this->profile->userid);
     }
     if ($this->config->userlist_joindate || CKunenaTools::isModerator($this->my->id)) {
         $this->registerdate = $this->user->registerDate;
     }
     if ($this->config->userlist_lastvisitdate || CKunenaTools::isModerator($this->my->id)) {
         $this->lastvisitdate = $this->user->lastvisitDate;
     }
     $this->avatarlink = $this->profile->getAvatarLink('kavatar', 'profile');
     $this->personalText = $this->profile->personalText;
     $this->signature = $this->profile->signature;
     $this->timezone = $this->user->getParam('timezone', $this->_app->getCfg('offset', 0));
     $this->moderator = CKunenaTools::isModerator($this->profile->userid);
     $this->admin = CKunenaTools::isAdmin($this->profile->userid);
     switch ($this->profile->gender) {
         case 1:
             $this->genderclass = 'male';
             $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_MALE');
             break;
         case 2:
             $this->genderclass = 'female';
             $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_FEMALE');
             break;
         default:
             $this->genderclass = 'unknown';
             $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_UNKNOWN');
     }
     if ($this->profile->location) {
         $this->locationlink = '<a href="http://maps.google.com?q=' . kunena_htmlspecialchars($this->profile->location) . '" target="_blank">' . kunena_htmlspecialchars($this->profile->location) . '</a>';
     } else {
         $this->locationlink = JText::_('COM_KUNENA_LOCATION_UNKNOWN');
     }
     $this->online = $this->profile->isOnline();
     $this->showUnusedSocial = true;
     $avatar = KunenaFactory::getAvatarIntegration();
     $this->editavatar = is_a($avatar, 'KunenaAvatarKunena') ? true : false;
     kimport('userban');
     $this->banInfo = KunenaUserBan::getInstanceByUserid($userid, true);
     $this->canBan = $this->banInfo->canBan();
     if ($this->config->showbannedreason) {
         $this->banReason = $this->banInfo->reason_public;
     }
 }
예제 #2
0
/**
 * Function  that get the menu used in the header of our board
 * @param int $cbitemid
 *             Community builder itemid, used for linking to cb profile
 * @param array $fbConfig
 * @param array $fbIcons
 * @param int $my_id
 *             The user id
 * @param int $type
 *             What kind of header do you want to print: 1: default (home/profile/latest posts/faq), 2: extended1 (home/profile/view/pending messages/faq) ,3:extended2 (home/profile/reply/view/pdf/faq)
 * @param string $view
 *             The view the user is currently using, only needs to be pass when type==3 or type==2
 * @param int $catid
 *             Only needs to be passed when type==3 or type==2
 * @param int $id
 *             Only needs to be passed when type==3 or type==2
 * @param int $thread
 *             Only needs to be passed when type==3 or type==2 (well actually just give 0 when type==2)
 * @param boolean $is_moderator
 *             Only needs to be passed when type==2
 * @param int $numPending
 *             Number of pending messages, only needs to be passed when type==2
 * @return String $header
 *             The menu :-)
 */
function KUNENA_get_menu($cbitemid, $fbConfig, $fbIcons, $my_id, $type, $view = "", $catid = 0, $id = 0, $thread = 0, $is_moderator = false, $numPending = 0)
{
    $header = '<div id="fb_topmenu" >';
    $header .= CKunenaLink::GetCategoryListLink('<span>' . (isset($fbIcons['home']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['home'] . '" border="0" alt="' . _KUNENA_CATEGORIES . '"  title="' . _KUNENA_CATEGORIES . '" />' : _KUNENA_CATEGORIES) . '</span>');
    if ($my_id != 0) {
        $header .= CKunenaLink::GetMyProfileLink($fbConfig, $my_id, isset($fbIcons['profile']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['profile'] . '" border="0" alt="' . _GEN_MYPROFILE . '" title="' . _GEN_MYPROFILE . '"/>' : _GEN_MYPROFILE);
    }
    switch ($type) {
        case 3:
            /* DISABLE MENU
                $header.= '<a href="'.JRoute::_(KUNENA_LIVEURLREL.'&amp;func=post&amp;do=reply&amp;replyto='.$thread.'&amp;catid='.$catid).'" >';
                $header.= isset($fbIcons['menureply']) ? '<img src="' . KUNENA_URLICONSPATH.$fbIcons['menureply'].'" border="0" alt="'._GEN_POST_REPLY.'" title="'._GEN_POST_REPLY.'"/>' : _GEN_POST_REPLY;
                $header.= '</a>';
               */
            //Disable threaded view option alltogether for Kunena
            //            if ($view == "flat") {
            //    			$header .= CKunenaLink::GetViewLink('view', $id, $catid, 'threaded', (isset($fbIcons['threadedview']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['threadedview'] . '" border="0" alt="' . _GEN_THREADED_VIEW . '" title="' . _GEN_THREADED_VIEW . '"/>' : _GEN_THREADED_VIEW));
            //            }
            //            else
            //            {
            //                $header .= CKunenaLink::GetViewLink('view', $id, $catid, 'flat', (isset($fbIcons['flatview']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['flatview'] . '" border="0" alt="' . _GEN_FLAT_VIEW . '" title="' . _GEN_FLAT_VIEW . '"/>' : _GEN_FLAT_VIEW));
            //            }
            break;
        case 2:
            //Disable threaded view option alltogether for Kunena
            //            if ($view == "flat")
            //            {
            //    			$header .= CKunenaLink::GetViewLink('showcat', $id, $catid, 'threaded', (isset($fbIcons['threadedview']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['threadedview'] . '" border="0" alt="' . _GEN_THREADED_VIEW . '" title="' . _GEN_THREADED_VIEW . '"/>' : _GEN_THREADED_VIEW));
            //            }
            //			else
            //			{
            //                $header .= CKunenaLink::GetViewLink('showcat', $id, $catid, 'flat', (isset($fbIcons['flatview']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['flatview'] . '" border="0" alt="' . _GEN_FLAT_VIEW . '" title="' . _GEN_FLAT_VIEW . '"/>' : _GEN_FLAT_VIEW));
            //			}
            if ($is_moderator) {
                if ($numPending > 0) {
                    $numcolor = '<font color="red">';
                    $header .= CKunenaLink::GetPendingMessagesLink($catid, isset($fbIcons['pendingmessages']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['pendingmessages'] . '" border="0" alt="' . $numPending . ' ' . _SHOWCAT_PENDING . '" />' : $numcolor . '' . $numPending . '</font> ' . _SHOWCAT_PENDING);
                }
            }
            break;
        case 1:
        default:
            $header .= CKunenaLink::GetShowLatestLink(isset($fbIcons['showlatest']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['showlatest'] . '" border="0" alt="' . _GEN_LATEST_POSTS . '" title="' . _GEN_LATEST_POSTS . '"/>' : _GEN_LATEST_POSTS);
            break;
    }
    if ($fbConfig->enablerulespage) {
        $header .= CKunenaLink::GetRulesLink($fbConfig, isset($fbIcons['rules']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['rules'] . '" border="0" alt="' . _GEN_RULES . '" title="' . _GEN_RULES . '"/>' : _GEN_RULES);
    }
    if ($fbConfig->enablehelppage) {
        $header .= CKunenaLink::GetHelpLink($fbConfig, isset($fbIcons['help']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['help'] . '" border="0" alt="' . _GEN_HELP . '" title="' . _GEN_HELP . '"/>' : _GEN_HELP);
    }
    $header .= '</div>';
    return $header;
}
예제 #3
0
	protected function displayCommon($tpl = null) {
		$userid = JRequest::getInt('userid');

		$this->_db = JFactory::getDBO ();
		$this->_app = JFactory::getApplication ();
		$this->config = KunenaFactory::getConfig ();
		$this->my = JFactory::getUser ();
		$this->me = KunenaUserHelper::getMyself();
		$this->do = JRequest::getWord('layout');

		if (!$userid) {
			$this->user = $this->my;
		} else {
			$this->user = JFactory::getUser( $userid );
		}
		if ($this->user->id == 0|| ($this->my->id == 0 && !$this->config->pubprofile)) {
			$this->_app->enqueueMessage ( JText::_('COM_KUNENA_PROFILEPAGE_NOT_ALLOWED_FOR_GUESTS'), 'notice' );
			return;
		}

		$integration = KunenaFactory::getProfile();
		$activityIntegration = KunenaFactory::getActivityIntegration();
		$template = KunenaFactory::getTemplate();
		$this->params = $template->params;

		if (get_class($integration) == 'KunenaProfileNone') {
			$this->_app->enqueueMessage ( JText::_('COM_KUNENA_PROFILE_DISABLED'), 'notice' );
			return;
		}

		$this->allow = true;

		$this->profile = KunenaFactory::getUser ( $this->user->id );
		if (!$this->profile->exists()) {
			$this->profile->save();
		}
		if ($this->profile->userid == $this->my->id) {
			if ($this->do != 'edit') $this->editLink = CKunenaLink::GetMyProfileLink ( $this->profile->userid, JText::_('COM_KUNENA_EDIT').' &raquo;', 'nofollow', 'edit', 'kheader-link' );
			else $this->editLink = CKunenaLink::GetMyProfileLink ( $this->profile->userid, JText::_('COM_KUNENA_BACK').' &raquo;', 'nofollow', '', 'kheader-link' );

			// TODO: Deprecated
			if ($this->do != 'edit') $this->editlink = CKunenaLink::GetMyProfileLink ( $this->profile->userid, JText::_('COM_KUNENA_EDIT'), 'nofollow', 'edit' );
			else $this->editlink = CKunenaLink::GetMyProfileLink ( $this->profile->userid, JText::_('COM_KUNENA_BACK'), 'nofollow' );
		}
		$this->name = $this->user->username;
		if ($this->config->userlist_name) $this->name = $this->user->name . ' (' . $this->name . ')';
		if ($this->config->showuserstats) {
			if ($this->config->userlist_usertype) $this->usertype = $this->user->usertype;
			$this->rank_image = $this->profile->getRank (0, 'image');
			$this->rank_title = $this->profile->getRank (0, 'title');
			$this->posts = $this->profile->posts;
			$this->thankyou = $this->profile->thankyou;
			$this->userpoints = $activityIntegration->getUserPoints($this->profile->userid);
			$this->usermedals = $activityIntegration->getUserMedals($this->profile->userid);
		}
		if ($this->config->userlist_joindate || $this->me->isModerator()) $this->registerdate = $this->user->registerDate;
		if ($this->config->userlist_lastvisitdate || $this->me->isModerator()) $this->lastvisitdate = $this->user->lastvisitDate;
		if ($this->lastvisitdate == "0000-00-00 00:00:00") $this->lastvisitdate = null;
		$this->avatarlink = $this->profile->getAvatarImage('kavatar','profile');
		$this->personalText = $this->profile->personalText;
		$this->signature = $this->profile->signature;
		$this->localtime = KunenaDate::getInstance();
		$this->localtime->setOffset($this->user->getParam('timezone', $this->_app->getCfg ( 'offset', 0 )));
		$this->moderator = $this->profile->isModerator();
		$this->admin = $this->profile->isAdmin();
		switch ($this->profile->gender) {
			case 1:
				$this->genderclass = 'male';
				$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_MALE');
				break;
			case 2:
				$this->genderclass = 'female';
				$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_FEMALE');
				break;
			default:
				$this->genderclass = 'unknown';
				$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_UNKNOWN');
		}
		if ($this->profile->location)
			$this->locationlink = '<a href="http://maps.google.com?q='.$this->escape($this->profile->location).'" target="_blank">'.$this->escape($this->profile->location).'</a>';
		else
			$this->locationlink = JText::_('COM_KUNENA_LOCATION_UNKNOWN');

		$this->online = $this->profile->isOnline();
		$this->showUnusedSocial = true;

		$avatar = KunenaFactory::getAvatarIntegration();
		$this->editavatar = is_a($avatar, 'KunenaAvatarKunena') ? true : false;

		$this->banInfo = KunenaUserBan::getInstanceByUserid($userid, true);
		$this->canBan = $this->banInfo->canBan();
		if ( $this->config->showbannedreason ) $this->banReason = $this->banInfo->reason_public;

		$user = JFactory::getUser();
		if ($user->id != $this->profile->userid)
		{
			$this->profile->uhits++;
			$this->profile->save();
		}

		$this->canManageAttachs = $this->canManageAttachments ();

		$private = KunenaFactory::getPrivateMessaging();
		if ($this->my->id == $this->user->id) {
			$this->pmCount = $private->getUnreadCount($this->my->id);
			$this->pmLink = $private->getInboxLink($this->pmCount ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $this->pmCount) : JText::_('COM_KUNENA_PMS_INBOX'));
		} else {
			$this->pmLink = $this->profile->profileIcon('private');
		}
		$this->setTitle(JText::sprintf('COM_KUNENA_VIEW_USER_DEFAULT', $this->profile->getName()));
		parent::display();
	}
예제 #4
0
/**
 * Function  that get the menu used in the header of our board
 * @param array $fbConfig
 * @param array $fbIcons
 * @param int $my_id
 *             The user id
 * @param int $type
 *             What kind of header do you want to print: 1: default (home/profile/latest posts/faq), 2: extended1 (home/profile/view/pending messages/faq) ,3:extended2 (home/profile/reply/view/pdf/faq)
 * @param string $view
 *             The view the user is currently using, only needs to be pass when type==3 or type==2
 * @param int $catid
 *             Only needs to be passed when type==3 or type==2
 * @param int $id
 *             Only needs to be passed when type==3 or type==2
 * @param int $thread
 *             Only needs to be passed when type==3 or type==2 (well actually just give 0 when type==2)
 * @param boolean $is_moderator
 *             Only needs to be passed when type==2
 * @param int $numPending
 *             Number of pending messages, only needs to be passed when type==2
 * @return String $header
 *             The menu :-)
 */
function KUNENA_get_menu($cbitemid, $fbConfig, $fbIcons, $my_id, $type, $view = "", $catid = 0, $id = 0, $thread = 0, $is_moderator = false, $numPending = 0)
{
    $func = strtolower(JRequest::getCmd('func', ''));
    if ($func == '') {
        switch ($fbConfig->fbdefaultpage) {
            case 'recent':
                $func = 'latest';
                break;
            case 'my':
                $func = $my_id ? 'mylatest' : 'latest';
                break;
            default:
                $func = 'listcat';
        }
    }
    $header = '<div id="fb_topmenu" ><div id="Kunena_tab"><ul>';
    $header .= ' <li ';
    if ($func == 'latest' || $func == '') {
        $header .= ' class="Kunena_item_active" ';
    }
    $header .= ' >' . CKunenaLink::GetShowLatestLink('<span>' . (array_key_exists('showlatest', $fbIcons) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['showlatest'] . '" border="0" alt="' . _KUNENA_ALL_DISCUSSIONS . '" title="' . _KUNENA_ALL_DISCUSSIONS . '"/>' : _KUNENA_ALL_DISCUSSIONS) . '</span>');
    $header .= '</li>';
    if ($my_id != 0) {
        $header .= ' <li ';
        if ($func == 'mylatest') {
            $header .= ' class="Kunena_item_active" ';
        }
        $header .= ' >' . CKunenaLink::GetShowMyLatestLink('<span>' . (array_key_exists('showmylatest', $fbIcons) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['showmylatest'] . '" border="0" alt="' . _KUNENA_MY_DISCUSSIONS . '" title="' . _KUNENA_MY_DISCUSSIONS . '"/>' : _KUNENA_MY_DISCUSSIONS) . '</span>');
        $header .= '</li>';
    }
    $header .= '<li ';
    if ($func == 'listcat') {
        $header .= ' class="Kunena_item_active" ';
    }
    $header .= ' >' . CKunenaLink::GetCategoryListLink('<span>' . (array_key_exists('home', $fbIcons) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['home'] . '" border="0" alt="' . _KUNENA_CATEGORIES . '"  title="' . _KUNENA_CATEGORIES . '" />' : _KUNENA_CATEGORIES) . '</span>');
    $header .= '</li>';
    if ($my_id != 0) {
        $header .= ' <li ';
        if ($func == 'myprofile') {
            $header .= ' class="Kunena_item_active" ';
        }
        $header .= ' >' . CKunenaLink::GetMyProfileLink($fbConfig, $my_id, '<span>' . (array_key_exists('profile', $fbIcons) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['profile'] . '" border="0" alt="' . _GEN_MYPROFILE . '" title="' . _GEN_MYPROFILE . '"/>' : _GEN_MYPROFILE) . '</span>');
        $header .= '</li>';
    }
    switch ($type) {
        case 3:
            //Threaded view option removed from Kunena
            //            if ($view == "flat") {
            //    			$header .= '<li>';
            //    			$header .= CKunenaLink::GetViewLink('view', $id, $catid, 'threaded', '<span>'. _GEN_THREADED_VIEW .'</span>');
            //                $header .= '</li>';
            //            }
            //            else
            //            {
            //    			$header .= '<li>';
            //                $header .= CKunenaLink::GetViewLink('view', $id, $catid, 'flat', '<span>'. _GEN_FLAT_VIEW .'</span>');
            //                $header .= '</li>';
            //            }
            break;
        case 2:
            //Threaded view option removed from Kunena
            //            if ($view == "flat")
            //            {
            //    			$header .= '<li>';
            //    			$header .= CKunenaLink::GetViewLink('showcat', $id, $catid, 'threaded', '<span>'. _GEN_THREADED_VIEW .'</span>');
            //                $header .= '</li>';
            //            }
            //			else
            //			{
            //    			$header .= '<li>';
            //                $header .= CKunenaLink::GetViewLink('showcat', $id, $catid, 'flat', '<span>'. _GEN_FLAT_VIEW .'</span>');
            //                $header .= '</li>';
            //			}
            if ($is_moderator) {
                if ($numPending > 0) {
                    $numcolor = '<font color="red">';
                    $header .= '<li>';
                    $header .= CKunenaLink::GetPendingMessagesLink($catid, '<span>' . (array_key_exists('pendingmessages', $fbIcons) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['pendingmessages'] . '" border="0" alt="' . $numPending . ' ' . _SHOWCAT_PENDING . '" />' : $numcolor . '' . $numPending . '</font> ' . _SHOWCAT_PENDING) . '</span>');
                    $header .= '</li>';
                }
            }
            break;
        case 1:
        default:
            break;
    }
    if ($fbConfig->enablerulespage) {
        $header .= ' <li ';
        if ($func == 'rules') {
            $header .= ' class="Kunena_item_active" ';
        }
        $header .= ' >' . CKunenaLink::GetRulesLink($fbConfig, '<span>' . (array_key_exists('rules', $fbIcons) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['rules'] . '" border="0" alt="' . _GEN_RULES . '" title="' . _GEN_RULES . '"/>' : _GEN_RULES) . '</span>');
        $header .= '</li>';
    }
    if ($fbConfig->enablehelppage) {
        $header .= ' <li ';
        if ($func == 'faq') {
            $header .= ' class="Kunena_item_active" ';
        }
        $header .= ' >' . CKunenaLink::GetHelpLink($fbConfig, '<span>' . (array_key_exists('help', $fbIcons) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['help'] . '" border="0" alt="' . _GEN_HELP . '" title="' . _GEN_HELP . '"/>' : _GEN_HELP) . '</span>');
        $header .= '</li>';
    }
    $header .= '</ul></div></div>';
    return $header;
}