/** * Draws the user profile tab "Subscriptions" (if enabled, user is the profile owner, and something to display. * * @param UserTable $user * @param boolean $itsmyself * @param string $htmlSubscribed * @return string */ public function drawUserSomethings($user, $itsmyself, $htmlSubscribed) { global $_CB_framework, $ueConfig; $this->htmlSubscribed = $htmlSubscribed; $subscriptions = $this->_model; if (count($subscriptions) == 1) { $subTxt = CBPTXT::T(cbpaidApp::settingsParams()->get('subscription_name', 'subscription')); } else { $subTxt = CBPTXT::T(cbpaidApp::settingsParams()->get('subscriptions_name', 'subscriptions')); } if ($itsmyself) { $userName = null; } else { $userName = getNameFormat($user->name, $user->username, $ueConfig['name_format']); } if ($_CB_framework->getUi() == 1) { if ($itsmyself) { $this->htmlTabTitle = sprintf(CBPTXT::Th("Your current %s"), $subTxt); } else { $this->htmlTabTitle = sprintf(CBPTXT::Th("%s's current %s"), $userName, $subTxt); } } else { if ($itsmyself) { $this->htmlTabTitle = sprintf(CBPTXT::Th("Your current and past %s"), $subTxt); } else { $this->htmlTabTitle = sprintf(CBPTXT::Th("%s's current and past %s"), $userName, $subTxt); } } return $this->display(); }
/** * Draws the user profile tab "Subscriptions" (if enabled, user is the profile owner, and something to display. * * @param string $htmlSubscriptionsAndUpgrades * @param string $htmlInvoicesLink * @param string $tabTitleText * @param string $htmlTabDescription * @return string */ public function drawTab($htmlSubscriptionsAndUpgrades, $htmlInvoicesLink, $tabTitleText, $htmlTabDescription) { global $ueConfig; $this->htmlSubscriptionsAndUpgrades = $htmlSubscriptionsAndUpgrades; $this->htmlInvoicesLink = $htmlInvoicesLink; $this->htmlTabDescription = $htmlTabDescription; $user = $this->_model; $title = cbReplaceVars(CBPTXT::Th(cbUnHtmlspecialchars($tabTitleText)), $user); if ($title) { $name = getNameFormat($user->name, $user->username, $ueConfig['name_format']); $title = sprintf($title, $name); } $this->htmlTabTitle = $title; return $this->display(); }
/** * Generates the HTML to display the user profile tab * @param moscomprofilerTab $tab the tab database entry * @param moscomprofilerUser $user the user being displayed * @param int $ui 1 for front-end, 2 for back-end * @return mixed either string HTML for tab content, or false if ErrorMSG generated */ function getDisplayTab($tab, $user, $ui) { global $_CB_framework, $_CB_database, $ueConfig; $return = null; if (!$ueConfig['allowConnections'] || isset($ueConfig['connectionDisplay']) && $ueConfig['connectionDisplay'] == 1 && $_CB_framework->myId() != $user->id) { return null; } $params = $this->params; $con_ShowTitle = $params->get('con_ShowTitle', '1'); $con_ShowSummary = $params->get('con_ShowSummary', '0'); $con_SummaryEntries = $params->get('con_SummaryEntries', '4'); $con_pagingenabled = $params->get('con_PagingEnabled', '1'); $con_entriesperpage = $params->get('con_EntriesPerPage', '10'); $pagingParams = $this->_getPaging(array(), array("connshow_")); $showall = $this->_getReqParam("showall", false); if ($con_ShowSummary && !$showall && $pagingParams["connshow_limitstart"] === null) { $summaryMode = true; $showpaging = false; $con_entriesperpage = $con_SummaryEntries; } else { $summaryMode = false; $showpaging = $con_pagingenabled; } $isVisitor = null; if ($_CB_framework->myId() != $user->id) { $isVisitor = "\n AND m.pending=0 AND m.accepted=1"; } if ($showpaging || $summaryMode) { //select a count of all applicable entries for pagination if ($isVisitor) { $contotal = $this->_getUserNumberOfConnections($user); } else { $query = "SELECT COUNT(*)" . "\n FROM #__comprofiler_members AS m" . "\n LEFT JOIN #__comprofiler AS c ON m.memberid=c.id" . "\n LEFT JOIN #__users AS u ON m.memberid=u.id" . "\n WHERE m.referenceid=" . (int) $user->id . "\n AND c.approved=1 AND c.confirmed=1 AND c.banned=0 AND u.block=0" . $isVisitor . "\n "; $_CB_database->setQuery($query); $contotal = $_CB_database->loadResult(); if (!is_numeric($contotal)) { $contotal = 0; } } } if (!$showpaging || $pagingParams["connshow_limitstart"] === null || $con_entriesperpage > $contotal) { $pagingParams["connshow_limitstart"] = "0"; } $query = "SELECT m.*,u.name,u.email,u.username,c.avatar,c.avatarapproved, u.id " . "\n FROM #__comprofiler_members AS m" . "\n LEFT JOIN #__comprofiler AS c ON m.memberid=c.id" . "\n LEFT JOIN #__users AS u ON m.memberid=u.id" . "\n WHERE m.referenceid=" . (int) $user->id . "" . "\n AND c.approved=1 AND c.confirmed=1 AND c.banned=0 AND u.block=0" . $isVisitor . "\n ORDER BY m.membersince DESC, m.memberid ASC"; $_CB_database->setQuery($query, (int) ($pagingParams["connshow_limitstart"] ? $pagingParams["connshow_limitstart"] : 0), (int) $con_entriesperpage); $connections = $_CB_database->loadObjectList(); if (!count($connections) > 0) { $return .= _UE_NOCONNECTIONS; return $return; } if ($con_ShowTitle) { if ($_CB_framework->myId() == $user->id) { $return .= "<h3 class=\"cbConTitle\">" . _UE_YOURCONNECTIONS . "</h3>"; } else { $return .= "<h3 class=\"cbConTitle\">" . sprintf(_UE_USERSNCONNECTIONS, getNameFormat($user->name, $user->username, $ueConfig['name_format'])) . "</h3>"; } } $return .= $this->_writeTabDescription($tab, $user); $live_site = $_CB_framework->getCfg('live_site'); $boxHeight = $ueConfig['thumbHeight'] + 46; $boxWidth = $ueConfig['thumbWidth'] + 28; foreach ($connections as $connection) { $conAvatar = getFieldValue('image', $connection->avatar, $connection); $emailIMG = getFieldValue('primaryemailaddress', $connection->email, $connection, null, 1); $pmIMG = getFieldValue('pm', $connection->username, $connection, null, 1); $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', null, $connection, null, 1) : ""; if ($connection->accepted == 1 && $connection->pending == 1) { $actionIMG = '<img src="' . $live_site . '/components/com_comprofiler/images/pending.png" border="0" alt="' . _UE_CONNECTIONPENDING . "\" title=\"" . _UE_CONNECTIONPENDING . "\" /> <a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=" . $connection->memberid) . "\" onclick=\"return confirmSubmit();\" ><img src=\"" . $live_site . "/components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_REMOVECONNECTION . "\" /></a>"; } elseif ($connection->accepted == 1 && $connection->pending == 0) { $actionIMG = "<a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=" . $connection->memberid) . "\" onclick=\"return confirmSubmit();\" ><img src=\"" . $live_site . "/components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_REMOVECONNECTION . "\" /></a>"; } elseif ($connection->accepted == 0) { $actionIMG = "<a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=acceptConnection&connectionid=" . $connection->memberid) . '"><img src="' . $live_site . "/components/com_comprofiler/images/tick.png\" border=\"0\" alt=\"" . _UE_ACCEPTCONNECTION . "\" title=\"" . _UE_ACCEPTCONNECTION . "\" /></a> <a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=" . $connection->memberid) . '"><img src="' . $live_site . "/components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_DECLINECONNECTION . "\" /></a>"; } $tipField = "<b>" . _UE_CONNECTEDSINCE . "</b> : " . dateConverter($connection->membersince, 'Y-m-d', $ueConfig['date_format']); if (getLangDefinition($connection->type) != null) { $tipField .= "<br /><b>" . _UE_CONNECTIONTYPE . "</b> : " . getConnectionTypes($connection->type); } if ($connection->description != null) { $tipField .= "<br /><b>" . _UE_CONNECTEDCOMMENT . "</b> : " . htmlspecialchars($connection->description); } $tipTitle = _UE_CONNECTEDDETAIL; $htmltext = $conAvatar; $style = "style=\"padding:5px;\""; $tooltipAvatar = cbFieldTip($ui, $tipField, $tipTitle, '250', '', $htmltext, '', $style, '', false); if ($_CB_framework->myId() == $user->id) { $return .= "<div class=\"connectionBox\" style=\"position:relative;height:" . ($boxHeight + 24) . "px;width:" . $boxWidth . "px;\">" . "<div style=\"position:absolute; top:3px; width:auto;left:5px;right:5px;\">" . $actionIMG . '</div>' . "<div style=\"position:absolute; top:18px; width:auto;left:5px;right:5px;\">" . $tooltipAvatar . '</div>' . "<div style=\"position:absolute; bottom:0px; width:auto;left:5px;right:5px;\">" . $onlineIMG . " " . getNameFormat($connection->name, $connection->username, $ueConfig['name_format']) . "<br /><a href=\"" . cbSef("index.php?option=com_comprofiler&task=userProfile&user="******"><img src="' . $live_site . "/components/com_comprofiler/images/profiles.gif\" border=\"0\" alt=\"" . _UE_VIEWPROFILE . "\" title=\"" . _UE_VIEWPROFILE . "\" /></a> " . $emailIMG . " " . $pmIMG . "\n"; } else { $return .= "<div class=\"connectionBox\" style=\"position:relative;height:" . $boxHeight . "px;width:" . $boxWidth . "px;\">" . "<div style=\"position:absolute; top:10px; width:auto;left:5px;right:5px;\">" . $tooltipAvatar . '</div>' . "<div style=\"position:absolute; bottom:0px; width:auto;left:5px;right:5px;\">" . $onlineIMG . " " . getNameFormat($connection->name, $connection->username, $ueConfig['name_format']) . "\n"; } $return .= "</div></div>\n"; } $return .= "<div style=\"clear:both;\"> </div>"; // Add paging control at end of list if paging enabled if ($showpaging && $con_entriesperpage < $contotal) { $return .= "<div style='width:95%;text-align:center;'>" . $this->_writePaging($pagingParams, "connshow_", $con_entriesperpage, $contotal) . "</div>"; } if ($con_ShowSummary && $_CB_framework->myId() == $user->id || $summaryMode && $con_entriesperpage < $contotal) { $return .= "<div class=\"connSummaryFooter\" style=\"width:100%;clear:both;\">"; if ($_CB_framework->myId() == $user->id) { // Manage connections link: $return .= "<div id=\"connSummaryFooterManage\" style=\"float:left;\">" . "<a href=\"" . cbSef('index.php?option=com_comprofiler&task=manageConnections') . "\" >[" . _UE_MANAGECONNECTIONS . "]</a>" . "</div>"; } if ($summaryMode && $con_entriesperpage < $contotal) { // See all of user's ## connections $return .= "<div id=\"connSummaryFooterSeeConnections\" style=\"float:right;\">" . "<a href=\"" . $this->_getAbsURLwithParam(array("showall" => "1")) . "\">"; if ($_CB_framework->myId() == $user->id) { $return .= sprintf(_UE_SEEALLNCONNECTIONS, $contotal); } else { $return .= sprintf(_UE_SEEALLOFUSERSNCONNECTIONS, getNameFormat($user->name, $user->username, $ueConfig['name_format']), "<strong>" . $contotal . "</strong>"); } $return .= "</a>" . "</div>"; } $return .= " </div>" . "<div style=\"clear:both;\"> </div>"; } return $return; }
/** * Sends a PM or Email notification with substitutions based off configuration * * @param int $type 1: Email, 2: PM, 3: Moderators, 4: Auto * @param UserTable|int|null $from * @param UserTable|int|string $to * @param string $subject * @param string $body * @param GroupTable $group * @param array $extra * @return bool */ static public function sendNotification( $type, $from, $to, $subject, $body, $group, $extra = array() ) { global $_CB_framework, $_PLUGINS; if ( ( ! $subject ) || ( ! $body ) || ( ! $group->get( 'id' ) ) || ( $group->get( 'published', 1 ) != 1 ) || ( ! $group->category()->get( 'published', 1 ) ) || ( ! $to ) ) { return false; } if ( $from instanceof UserTable ) { $fromUser = $from; } elseif ( is_int( $from ) ) { $fromUser = \CBuser::getUserDataInstance( $from ); } else { $fromUser = null; } if ( $to instanceof UserTable ) { $toUser = $to; } elseif ( is_int( $to ) ) { $toUser = \CBuser::getUserDataInstance( $to ); } else { $toUser = null; } if ( $fromUser && $toUser && ( $fromUser->get( 'id' ) == $toUser->get( 'id' ) ) ) { return false; } static $plugin = null; static $params = null; if ( ! $params ) { $plugin = $_PLUGINS->getLoadedPlugin( 'user', 'cbgroupjive' ); $params = $_PLUGINS->getPluginParams( $plugin ); } $notifyBy = (int) $params->get( 'notifications_notifyby', 1 ); $fromName = $params->get( 'notifications_from_name', null ); $fromEmail = $params->get( 'notifications_from_address', null ); $cbUser = \CBuser::getInstance( ( $fromUser ? (int) $fromUser->get( 'id' ) : ( $toUser ? (int) $toUser->get( 'id' ) : 0 ) ), false ); $user = $cbUser->getUserData(); $extras = array( 'category_id' => (int) $group->category()->get( 'id' ), 'category_name' => ( $group->category()->get( 'id' ) ? CBTxt::T( $group->category()->get( 'name' ) ) : CBTxt::T( 'Uncategorized' ) ), 'category' => '<a href="' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'categories', 'func' => 'show', 'id' => (int) $group->get( 'category' ) ) ) . '">' . ( $group->category()->get( 'id' ) ? CBTxt::T( $group->category()->get( 'name' ) ) : CBTxt::T( 'Uncategorized' ) ) . '</a>', 'group_id' => (int) $group->get( 'id' ), 'group_name' => htmlspecialchars( CBTxt::T( $group->get( 'name' ) ) ), 'group' => '<a href="' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '">' . htmlspecialchars( CBTxt::T( $group->get( 'name' ) ) ) . '</a>', 'user' => '<a href="' . $_CB_framework->viewUrl( 'userprofile', false, array( 'user' => (int) $user->get( 'id' ) ) ) . '">' . getNameFormat( $user->get( 'name' ), $user->get( 'username' ), Application::Config()->get( 'name_format', 3 ) ) . '</a>' ); if ( ! $toUser ) { $extras['email'] = $to; $extras['name'] = $to; $extras['username'] = $to; } $extras = array_merge( $extras, $extra ); $subject = $cbUser->replaceUserVars( $subject, true, false, $extras, false ); $body = $cbUser->replaceUserVars( $body, false, false, $extras, false ); if ( $type == 4 ) { $type = ( $notifyBy == 2 ? 2 : 1 ); } $notification = new \cbNotification(); if ( $type == 3 ) { // Moderator Notification: $notification->sendToModerators( $subject, $body, false, 1 ); } elseif ( ( $type == 2 ) && $toUser ) { // PM Notification: if ( ! $toUser->get( 'id' ) ) { return false; } $notification->sendUserPMSmsg( $toUser, 0, $subject, $body, true, false, 1, $extras ); } else { // Email Notification: if ( $toUser ) { if ( ! $toUser->get( 'id' ) ) { return false; } $notification->sendFromSystem( $toUser, $subject, $body, 1, 1, null, null, null, $extras, true, $fromName, $fromEmail ); } else { $userTo = new UserTable(); $userTo->set( 'email', $to ); $userTo->set( 'name', $to ); $userTo->set( 'username', $to ); $notification->sendFromSystem( $userTo, $subject, $body, 1, 1, null, null, null, $extras, true, $fromName, $fromEmail ); } } return true; }
/** * Computes text for the title of the invoices list * * @param int $invoicesNumber array of cbpaidPaymentBasket of Completed and Pending baskets * @param UserTable $user reflecting the user being displayed (here null) * @param boolean $itsmyself user is logged in user * @param string $periodText if non-empty, text of the period showing invoices * @return string */ protected function _invoicesTitle($invoicesNumber, $user, $itsmyself, $periodText) { global $ueConfig; if ($itsmyself) { if ($periodText) { $plansTitle = sprintf(CBPTXT::Th("Your invoices of last %s"), htmlspecialchars($periodText)); } else { if ($invoicesNumber == 1) { $plansTitle = CBPTXT::Th("Your invoice"); } else { $plansTitle = CBPTXT::Th("Your invoices"); } } } else { if ($periodText) { $plansTitle = sprintf(CBPTXT::Th("%s's invoices of last %s"), getNameFormat($user->name, $user->username, $ueConfig['name_format']), htmlspecialchars($periodText)); } else { $plansTitle = sprintf(CBPTXT::Th("%s's invoices"), getNameFormat($user->name, $user->username, $ueConfig['name_format'])); } } return $plansTitle; }
/** * Generates the HTML to display the user profile tab * * @param \CB\Database\Table\TabTable $tab the tab database entry * @param \CB\Database\Table\UserTable $user the user being displayed * @param int $ui 1 for front-end, 2 for back-end * @return string|boolean Either string HTML for tab content, or false if ErrorMSG generated */ public function getDisplayTab($tab, $user, $ui) { global $_CB_framework, $_CB_database, $ueConfig; $return = null; if (!$ueConfig['allowConnections'] || isset($ueConfig['connectionDisplay']) && $ueConfig['connectionDisplay'] == 1 && $_CB_framework->myId() != $user->id) { return null; } $js = "if ( typeof confirmSubmit != 'function' ) {" . "function confirmSubmit() {" . "if ( confirm( '" . addslashes(CBTxt::T('UE_CONFIRMREMOVECONNECTION', 'Are you sure you want to remove this connection?')) . "' ) ) {" . "return true;" . "} else {" . "return false;" . "}" . "};" . "}"; $_CB_framework->document->addHeadScriptDeclaration($js); $params = $this->params; $con_ShowSummary = $params->get('con_ShowSummary', '0'); $con_SummaryEntries = $params->get('con_SummaryEntries', '4'); $con_pagingenabled = $params->get('con_PagingEnabled', '1'); $con_entriesperpage = $params->get('con_EntriesPerPage', '10'); $pagingParams = $this->_getPaging(array(), array('connshow_')); $showall = $this->_getReqParam("showall", false); if ($con_ShowSummary && !$showall && $pagingParams['connshow_limitstart'] === null) { $summaryMode = true; $showpaging = false; $con_entriesperpage = $con_SummaryEntries; } else { $summaryMode = false; $showpaging = $con_pagingenabled; } $isVisitor = null; if ($_CB_framework->myId() != $user->id) { $isVisitor = "\n AND m.pending=0 AND m.accepted=1"; } if ($showpaging || $summaryMode) { //select a count of all applicable entries for pagination if ($isVisitor) { $contotal = $this->_getUserNumberOfConnections($user); } else { $query = "SELECT COUNT(*)" . "\n FROM #__comprofiler_members AS m" . "\n LEFT JOIN #__comprofiler AS c ON m.memberid=c.id" . "\n LEFT JOIN #__users AS u ON m.memberid=u.id" . "\n WHERE m.referenceid=" . (int) $user->id . "\n AND c.approved=1 AND c.confirmed=1 AND c.banned=0 AND u.block=0" . $isVisitor; $_CB_database->setQuery($query); $contotal = $_CB_database->loadResult(); if (!is_numeric($contotal)) { $contotal = 0; } } } else { $contotal = 0; } if (!$showpaging || $pagingParams['connshow_limitstart'] === null || $con_entriesperpage > $contotal) { $pagingParams['connshow_limitstart'] = 0; } $query = "SELECT m.*,u.name,u.email,u.username,c.avatar,c.avatarapproved, u.id" . "\n FROM #__comprofiler_members AS m" . "\n LEFT JOIN #__comprofiler AS c ON m.memberid=c.id" . "\n LEFT JOIN #__users AS u ON m.memberid=u.id" . "\n WHERE m.referenceid=" . (int) $user->id . "" . "\n AND c.approved=1 AND c.confirmed=1 AND c.banned=0 AND u.block=0" . $isVisitor . "\n ORDER BY m.membersince DESC, m.memberid ASC"; $_CB_database->setQuery($query, (int) ($pagingParams['connshow_limitstart'] ? $pagingParams['connshow_limitstart'] : 0), (int) $con_entriesperpage); $connections = $_CB_database->loadObjectList(); if (!count($connections) > 0) { $return .= CBTxt::Th('UE_NOCONNECTIONS', 'This user has no current connections.'); return $return; } $return .= $this->_writeTabDescription($tab, $user); foreach ($connections as $connection) { $cbUser = CBuser::getInstance((int) $connection->id); if (!$cbUser) { $cbUser = CBuser::getInstance(null); } $tipField = getConnectionTab::renderConnectionToolTip($connection); $tipTitle = CBTxt::T('UE_CONNECTEDDETAIL', 'Connection Details'); $htmlText = $cbUser->getField('avatar', null, 'html', 'none', 'list', 0, true); $tooltip = cbTooltip(1, $tipField, $tipTitle, 300, null, $htmlText, null, 'style="display: inline-block; padding: 5px;"'); if ($connection->accepted == 1 && $connection->pending == 1) { $actionImg = '<span class="fa fa-clock-o fa-lg" title="' . htmlspecialchars(CBTxt::T('UE_CONNECTIONPENDING', 'Connection Pending')) . '"></span>' . ' <a href="' . $_CB_framework->viewUrl('removeconnection', true, array('act' => 'connections', 'connectionid' => (int) $connection->memberid)) . '" onclick="return confirmSubmit();" >' . '<span class="fa fa-times-circle-o fa-lg" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION_DESC', 'Remove Connection to that user')) . '"></span>' . '</a>'; } elseif ($connection->accepted == 1 && $connection->pending == 0) { $actionImg = '<a href="' . $_CB_framework->viewUrl('removeconnection', true, array('act' => 'connections', 'connectionid' => (int) $connection->memberid)) . '" onclick="return confirmSubmit();" >' . '<span class="fa fa-times-circle-o fa-lg" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>'; } elseif ($connection->accepted == 0) { $actionImg = '<a href="' . $_CB_framework->viewUrl('acceptconnection', true, array('act' => 'connections', 'connectionid' => (int) $connection->memberid)) . '" >' . '<span class="fa fa-check-circle-o fa-lg" title="' . htmlspecialchars(CBTxt::T('UE_ACCEPTCONNECTION', 'Accept Connection')) . '"></span>' . '</a>' . ' <a href="' . $_CB_framework->viewUrl('removeconnection', true, array('act' => 'connections', 'connectionid' => (int) $connection->memberid)) . '" onclick="return confirmSubmit();" >' . '<span class="fa fa-times-circle-o fa-lg" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>'; } else { $actionImg = null; } if ($_CB_framework->myId() == $user->id) { $return .= '<div class="containerBox img-thumbnail">' . '<div class="containerBoxInner" style="min-height: 130px; min-width: 90px;">' . $actionImg . '<br />' . $cbUser->getField('onlinestatus', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . ' ' . $cbUser->getField('formatname', null, 'html', 'none', 'list', 0, true) . '<br />' . $tooltip . '<br />' . ' <a href="' . $_CB_framework->userProfileUrl((int) $connection->memberid) . '">' . '<span class="fa fa-user" title="' . htmlspecialchars(CBTxt::T('UE_VIEWPROFILE', 'View Profile')) . '"></span>' . '</a>' . ' ' . $cbUser->getField('email', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . ' ' . $cbUser->getField('pm', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . '</div>' . '</div>'; } else { $return .= '<div class="containerBox img-thumbnail">' . '<div class="containerBoxInner" style="min-height: 100px; min-width: 90px;">' . $cbUser->getField('onlinestatus', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . ' ' . $cbUser->getField('formatname', null, 'html', 'none', 'list', 0, true) . '<br />' . $tooltip . '</div>' . '</div>'; } } $return .= '<div class="clearfix"></div>'; // Add paging control at end of list if paging enabled if ($showpaging && $con_entriesperpage < $contotal) { $return .= '<div class="text-center">' . $this->_writePaging($pagingParams, 'connshow_', $con_entriesperpage, $contotal) . '</div>'; } if ($con_ShowSummary && $_CB_framework->myId() == $user->id || $summaryMode && $con_entriesperpage < $contotal) { $return .= '<div class="connSummaryFooter clearfix">'; if ($_CB_framework->myId() == $user->id) { // Manage connections link: $return .= '<div id="connSummaryFooterManage" class="pull-left">' . '<a href="' . $_CB_framework->viewUrl('manageconnections') . '" >[' . CBTxt::Th('UE_MANAGECONNECTIONS', 'Manage Connections') . ']</a>' . '</div>'; } if ($summaryMode && $con_entriesperpage < $contotal) { // See all of user's ## connections $return .= '<div id="connSummaryFooterSeeConnections" class="pull-right">' . '<a href="' . $this->_getAbsURLwithParam(array('showall' => 1)) . '">'; if ($_CB_framework->myId() == $user->id) { $return .= sprintf(CBTxt::Th('UE_SEEALLNCONNECTIONS', 'See all %s connections'), $contotal); } else { $return .= sprintf(CBTxt::Th('UE_SEEALLOFUSERSNCONNECTIONS', 'See all of %s\'s %s connections'), getNameFormat($user->name, $user->username, $ueConfig['name_format']), "<strong>" . $contotal . "</strong>"); } $return .= '</a>' . '</div>'; } $return .= '</div>'; } return $return; }
/** * Generates the HTML to display the user profile tab * * @param TabTable $tab the tab database entry * @param UserTable $user the user being displayed * @param int $ui 1 for front-end, 2 for back-end * @return mixed Either string HTML for tab content, or false if ErrorMSG generated */ public function getDisplayTab($tab, $user, $ui) { global $ueConfig; $params = $this->params; $title = cbReplaceVars($params->get('title', '_UE_PROFILE_TITLE_TEXT'), $user); $name = getNameFormat($user->name, $user->username, $ueConfig['name_format']); $return = (sprintf($title, $name) ? '<div class="page-header cbProfileTitle"><h3>' . sprintf($title, $name) . '</h3></div>' : null) . $this->_writeTabDescription($tab, $user); return $return; }
/** * BBcode editor * * @uses $this->pbconfig->EnableRating, $this->pbconfig->ShowTitle, $this->pbconfig->ShowName, $this->pbconfig->ShowEmail, $this->pbconfig->UseLocation, $this->pbconfig->LocationField, $this->pbconfig->UseWebAddress, $this->pbconfig->WebField, $this->pbconfig->AllowBBCode, $this->pbconfig->AllowSmiles, $this->pbconfig->Captcha * * @param pbProfileBookEntry $item * @param string $idTag * @param string $htmlAreaLabel * @param string $txtSubmit * @param UserTable $curruser * @param boolean $required * @return string */ function _bbeditor( $item, $idTag, $htmlAreaLabel, $txtSubmit, $curruser, $required ) { global $_CB_framework, $ueConfig; $myId = Application::MyUser()->getUserId(); $newOrMe = ( ( $item->posterid == -1 ) || ( $item->posterid == $myId ) ); $htmltext = '<div class="cbpbEditorContainer" id="div' . $idTag . '">'; //get the CB initiatied form action path this is used for all forms $base_url = $this->_getAbsURLwithParam( array() ); $htmltext .= '<form name="admin' . $idTag . '" id="admin' . $idTag . '" method="post" onsubmit="javascript: return pb_submitForm(this);" action="' . $base_url . "\">\n"; $htmltext .= '<input type="hidden" name="' . $this->_getPagingParamName( 'formaction' . $this->pbconfig->MainMode[0] ) . '" value="' . ( $item->_pbid ? 'edit' : 'new' ) . "\" />\n"; if ( $item->_pbid ) { $htmltext .= '<input type="hidden" name="' . $this->_getPagingParamName( 'id' ) . '" value="' . $item->_pbid . "\" />\n"; } if ( $this->pbconfig->AllowBBCode ) { $editor = $this->getEditor( $idTag ); } else { $editor = null; } $htmltext .= "<table width=\"100%\">\n"; $locationField = null; //Check to see if the Location field should be used if ( $this->pbconfig->UseLocation ) { //Check to see if a registered user is logged in and if the admin has defined a a value for the location field if ( $myId && ( $this->pbconfig->LocationField != 0 ) && $newOrMe ) { $locationField = new FieldTable(); $locationField->load( $this->pbconfig->LocationField ); $naLocationField = $locationField->name; //if they true then display the location value from the users cb profile in read only $locationField = '<td class="titleCell">' . CBTxt::th( "Location" ) . ':<br /><input type="hidden" name="' . $this->_getPagingParamName( 'posterlocation' ) . '" value="' . htmlspecialchars( $curruser->$naLocationField ) . '" />' . htmlspecialchars( $curruser->$naLocationField ) . '</td>'; } else { //else display an entry field to capture the location $locationField = '<td class="titleCell">' . CBTxt::th( "Location" ) . ':<br /><input class="inputbox" type="text" name="' . $this->_getPagingParamName( 'posterlocation' ) . '" value="' . htmlspecialchars( $item->posterlocation ) . '" /></td>'; } } $webField = null; if ( $this->pbconfig->UseWebAddress ) { if ( $myId && ( $this->pbconfig->WebField != 0 ) && $newOrMe ) { $webfield = new FieldTable(); $webfield->load( $this->pbconfig->WebField ); $naWebField = $webfield->name; $webField = '<td class="titleCell">' . CBTxt::th( "Web Address" ) . ':<br /><input type="hidden" name="' . $this->_getPagingParamName( 'posterurl' ) . '" value="' . $curruser->$naWebField . '" />' . $this->_displayWebAddress( $curruser->$naWebField ) . '</td>'; } else { $webField = '<td class="titleCell">' . CBTxt::th( "Web Address" ) . ':<br /><input class="inputbox" type="text" name="' . $this->_getPagingParamName( 'posterurl' ) . '" value="' . htmlspecialchars( $item->posterurl ) . '" /></td>'; } } $htmltext .= "\n<tr>"; if ( ! $myId ) { $htmltext .= '<td class="titleCell">' . CBTxt::th( "Name" ) . ':<br /><input class="inputbox" type="text" name="' . $this->_getPagingParamName( 'postername' ) . '" value="' . htmlspecialchars( $item->postername ) . '" /></td>'; $htmltext .= '<td class="titleCell">' . CBTxt::th( "Email" ) . ':<br /><input class="inputbox" type="text" name="' . $this->_getPagingParamName( 'posteremail' ) . '" value="' . htmlspecialchars( $item->posteremail ) . '" /></td>'; } else { $htmlName = ( $item->postername ? htmlspecialchars( $item->postername ) : getNameFormat( $curruser->name, $curruser->username, $ueConfig['name_format'] ) ); if ( $this->pbconfig->ShowName ) { $htmltext .= '<td class="titleCell">' . CBTxt::th( "Name" ) . ':<br /><input type="hidden" name="' . $this->_getPagingParamName( 'postername' ) . '" value="' . $htmlName . '" />' . $htmlName . '</td>'; } else { $htmltext .= '<td><input type="hidden" name="' . $this->_getPagingParamName( 'postername' ) . '" value="' . $htmlName . '" /></td>'; } if ( $this->pbconfig->ShowEmail ) { $htmltext .= '<td class="titleCell">' . CBTxt::th( "Email" ) . ':<br />'; if ( ! $item->posteremail || $myId == $item->posterid || Application::MyUser()->isAuthorizedToPerformActionOnAsset( 'core.manage', 'com_users' ) ) { $htmltext .= '<input type="hidden" name="' . $this->_getPagingParamName( 'posteremail' ) . '" value="' . ( $item->posteremail ? htmlspecialchars( $item->posteremail ) : htmlspecialchars( $curruser->email ) ) . '" />' . ( $item->posteremail ? htmlspecialchars( $item->posteremail ) : htmlspecialchars( $curruser->email ) ); } else { $htmltext .= CBTxt::th( "Hidden" ); } } else { if ( ! $item->posteremail || $myId == $item->posterid || Application::MyUser()->isAuthorizedToPerformActionOnAsset( 'core.manage', 'com_users' ) ) { $htmltext .= '<td><input type="hidden" name="' . $this->_getPagingParamName( 'posteremail' ) . '" value="' . ( $item->posteremail ? htmlspecialchars( $item->posteremail ) : htmlspecialchars( $curruser->email ) ) . '" /></td>'; } } } $htmltext .= '</tr>'; //Check to see if we are displaying the web address or location field. If we are then add a row for them if ( $webField != null || $locationField != null ) { $htmltext .= "\n<tr>" . $locationField . $webField . '</tr>'; } $htmltext .= '<tr><td colspan="2">'; //Check to see if the admin has enabled rating for profile entries if ( $this->pbconfig->EnableRating && ( $myId != $item->userid ) ) { //Yep its enabled so get the ratings HTML/Code $htmltext .= '<div class="titleCell">' . CBTxt::Th( "User Rating" ) . ':</div>' . '<div class="fieldCell">' . pbcbRatings::getRatingForm( $item->postervote, 'admin' . $idTag, $this->_getPagingParamName( 'postervote' ), ( $this->pbconfig->EnableRating == 3 ) ) . '</div>' ; } // Title line: if ( $this->pbconfig->ShowTitle ) { $htmltext .= '<div class="pbTitleInput">' . '<span class="titleCell">' . CBTxt::Th( "Title" ) . ':</span> ' . '<span class="fieldCell">' . '<input class="form-control pbTitleBox" type="text" name="' . $this->_getPagingParamName( 'postertitle' ) . '" value="' . htmlspecialchars( $item->postertitle ) . '" maxlength="128" />' . '</span>' . '</div>' ; } // Comment editor: $htmltext .= '<div class="pbCommentInput">' . '<span class="titleCell">' . $htmlAreaLabel . ':</span>' . '<span class="fieldCell">' . $editor . '<table class="cbpbEditorTexts"><tr>'; if ( $this->pbconfig->AllowSmiles ) { $htmltext .= "<td width=\"73%\">\n"; } else { $htmltext .= "<td width=\"100%\">\n"; } $htmltext .= '<textarea class="inputbox cbpbEditor" name="' . $this->_getPagingParamName( 'postercomments' ) . '" rows="7" cols ="40" style="width: 95%; overflow:auto;" >' . htmlspecialchars( $item->postercomment ) . "</textarea>\n</td>\n"; if ( $this->pbconfig->AllowSmiles ) { $htmltext .= "<td>\n" . $this->getSmilies( $idTag ) . "</td>\n"; } $htmltext .= "</tr>\n</table>\n" . '</span>' . '</div>' . '</td></tr>'; // Captcha integration: if ( ( $this->pbconfig->Captcha == 2 ) || ( ( $this->pbconfig->Captcha == 1 ) && ( $curruser === null ) ) ) { global $_PLUGINS; $_PLUGINS->loadPluginGroup( 'user' ); $pluginsResults = $_PLUGINS->trigger( 'onGetCaptchaHtmlElements', array( true ) ); // onCheckCaptchaHtmlElements if ( implode( $pluginsResults ) != '' ) { $htmltext .= '<tr><td colspan="2">' . implode( '</td></tr><tr><td colspan="2">', $pluginsResults ) . '</td></tr>'; } } $htmltext .= '<tr><td colspan="2"><span class="fieldCell"><input class="button" name="submitentry" type="submit" value="' . $txtSubmit . "\" /></span></td></tr>\n"; $htmltext .= "</table>\n"; $htmltext .= "</form>\n"; $htmltext .= "</div>\n"; //Add the localized Javascript parameters so that error messages are properly translated $validateArray = array(); if ( $required ) { $validateArray[] = array( 'field' => 'postername', 'confirm' => null, 'error' => CBTxt::T( "Name is Required!" ) ); $validateArray[] = array( 'field' => 'posteremail', 'confirm' => null, 'error' => CBTxt::T( "Email Address is Required!" ) ); } if ( $myId != $item->userid ) { if ( $this->pbconfig->EnableRating == 3 ) { $validateArray[] = array( 'field' => 'postervote', 'confirm' => null, 'error' => CBTxt::T( "User Rating is Required!" ) ); } elseif ( $this->pbconfig->EnableRating == 2 ) { $validateArray[] = array( 'field' => 'postervote', 'confirm' => CBTxt::T( "You have not selected a User Rating. Do you really want to provide an Entry without User Rating ?" ), 'error' => null ); } } if ( $this->pbconfig->ShowTitle ) { $validateArray[] = array( 'field' => 'postertitle', 'confirm' => null, 'error' => CBTxt::T( "Title is Required!" ) ); } $validateArray[] = array( 'field' => 'postercomments', 'confirm' => null, 'error' => CBTxt::T( "Comment is Required!" ) ); $res = array(); foreach ( $validateArray as $validateField ) { $res[] = "Array('" . addslashes( $this->_getPagingParamName( $validateField['field'] ) ) . "'," . "'" . addslashes( $validateField['confirm'] ) . "'," . "'" . addslashes( $validateField['error'] ) . "')"; } $_CB_framework->document->addHeadScriptDeclaration( 'var _admin' . $idTag . '_validations = Array( ' . implode( ',', $res ) . ");\n" . 'var _admin' . $idTag . "_bbcodestack = Array();\n" ); return $htmltext; }
/** * Computes page title, sets page title and pathway * * @param UserTable $user * @param string $thisUserTitle Title if it's the user displaying * @param string $otherUserTitle Title if it's another user displayed * @return string title (plaintext, without htmlspecialchars or slashes) */ function cbSetTitlePath($user, $thisUserTitle, $otherUserTitle) { global $ueConfig, $_CB_framework; $title = null; if ($_CB_framework->myId() == $user->id) { if ($thisUserTitle) { $title = $thisUserTitle; } } else { if ($otherUserTitle) { $name = getNameFormat($user->name, $user->username, $ueConfig['name_format']); $title = sprintf($otherUserTitle, $name); } } if ($title) { $_CB_framework->setPageTitle($title); $_CB_framework->appendPathWay(htmlspecialchars($title)); } return $title; }
/** * Generates the HTML to display the user edit tab * * @param TabTable $tab the tab database entry * @param UserTable $user the user being displayed * @param int $ui 1 for front-end, 2 for back-end * @return mixed either string HTML for tab content, or false if ErrorMSG generated */ public function getEditTab( $tab, $user, $ui ) { global $ueConfig, $_CB_framework; $return = ''; if ( ( $ui != 2 ) /* || ( $_CB_framework->myId() == $user->id ) */ ) { return $return; } cbpaidErrorHandler::on(); if ( cbpaidApp::authoriseAction( 'cbsubs.usersubscriptionview' ) ) { $params = $this->params; $paidsubsManager =& cbpaidSubscriptionsMgr::getInstance(); $paidsubsManager->checkExpireMe( __FUNCTION__ ); if ( $user->id ) { $basketsMgr =& cbpaidOrdersMgr::getInstance(); $basketsMgr->timeoutUnusedBaskets( $user->id ); } $title = CBPTXT::Th( $params->get( 'profileTitle', "Your subscriptions" )); if ( $title ) { $name = getNameFormat( $user->name, $user->username, $ueConfig['name_format'] ); $return .= '<div class="contentheading" id="cbregProfileTitle">' . sprintf( $title, $name ) . "</div>\n"; } $return .= $this->_writeTabDescription( $tab, $user ); $itsmyself = ( $_CB_framework->myId() == $user->id ); $subscriptionsGUI = new cbpaidControllerUI(); $return .= $subscriptionsGUI->getShowSubscriptionUpgrades( $user, $itsmyself ); } cbpaidErrorHandler::off(); return $return; /* global $_CB_framework; $params = $this->params; $exampleText = $params->get('exampletext', 'Text Parameter not set!'); $xmlfile = $_CB_framework->getCfg( 'absolute_path' ) . '/components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/cbpaidsubscriptions.xml'; $this->userParams = new Registry( $user->cb_subs_params, $xmlfile, $maintagname='cbinstall', $attrname='type', $attrvalue='plugin', $paramsnode='params' ); $ret = $this->userParams->render( $pluginId=null, $tabId=null, $tag_name='userparams',$attr='class',$attrvalue='getcbpaidsubscriptionsTab', $control_name='subscriptionparams', $paramstextarea=false ); return $ret; */ }
function _sendEmailMSG($to, $from, $sub, $msg, $addPrefix = false, $mode = 0, $cc = null, $bcc = null, $attachment = null) { //BB: add html global $_CB_framework, $ueConfig, $_SERVER; if ($addPrefix) { $uname = getNameFormat($from->name, $from->username, $ueConfig['name_format']); $premessage = sprintf(_UE_SENDEMAILNOTICE, $uname, cb_html_entity_decode_all($_CB_framework->getCfg('sitename')), $_CB_framework->getCfg('live_site')); if (isset($ueConfig['allow_email_replyto']) && $ueConfig['allow_email_replyto'] == 2) { $premessage .= sprintf(_UE_SENDEMAILNOTICE_REPLYTO, $uname, $from->email); } $postmessage = sprintf(_UE_SENDEMAILNOTICE_DISCLAIMER, cb_html_entity_decode_all($_CB_framework->getCfg('sitename'))); // $premessage .= sprintf(_UE_SENDEMAILNOTICE_MESSAGEHEADER, $uname); $msg = $premessage . $msg . $postmessage; $from->name = $uname . " @ " . cb_html_entity_decode_all($_CB_framework->getCfg('sitename')); // $ueConfig['reg_email_name'] } // if (class_exists("mosPHPMailer")) { $res = comprofilerMail($from->email, $from->name, $to->email, $sub, $msg, $mode, $cc, $bcc, $attachment, $from->replytoEmail, $from->replytoName); /* } else if (function_exists( 'mosMail' )) { $res = mosMail($from->email, $from->name, $to->email, $sub, $msg); } else { //TODO drop this once we are dedicated to >= 4.5.2 $EOL = defined( 'PHP_EOL' ) ? PHP_EOL : '\n'; // assume Linux for old systems. $header = "MIME-Version: 1.0" . $EOL; $header .= "Content-type: text/plain; charset=" . $_CB_framework->outputCharset() . $EOL; $header .= "Content-Transfer-encoding: 8bit" . $EOL; $fromTag = $from->name." <" . $from->email . ">"; $header .= "From: ".$fromTag. $EOL; $replyTag = $from->replytoName." <" . $from->replytoEmail . ">"; $header .= "Reply-To: ".$replyTag. $EOL; $header .= "Organization: ".cb_html_entity_decode_all($_CB_framework->getCfg( 'sitename' )). $EOL; $header .= "Message-ID: <".md5(uniqid(time()))."@{$_SERVER['SERVER_NAME']}>" . $EOL; $header .= "Return-Path: ".$from->email. $EOL; $header .= "X-Priority: 3" . $EOL; $header .= "X-MSmail-Priority: Low" . $EOL; $header .= "X-Mailer: PHP\r\n"; //hotmail and others dont like PHP mailer. --Microsoft Office Outlook, Build 11.0.5510 $header .= "X-Sender: ".$from->email. $EOL . $EOL; $res = mail($to->email, $sub, $msg, $header); } */ return $res; }
/** * Generates the HTML to display the user profile tab * @param moscomprofilerTab $tab the tab database entry * @param moscomprofilerUser $user the user being displayed * @param int $ui 1 for front-end, 2 for back-end * @return mixed either string HTML for tab content, or false if ErrorMSG generated */ function getDisplayTab($tab, $user, $ui) { global $ueConfig; // Display user's name + "Profile Page" $params = $this->params; $title = cbReplaceVars($params->get('title', '_UE_PROFILE_TITLE_TEXT'), $user); $name = getNameFormat($user->name, $user->username, $ueConfig['name_format']); $return = '<div class="contentheading" id="cbProfileTitle">' . sprintf($title, $name) . "</div>\n"; $return .= $this->_writeTabDescription($tab, $user); return $return; }
static function manageConnections($connections, $actions, $total, &$connMgmtTabs, &$pagingParams, $perpage, $connecteds = null) { global $_CB_framework, $ueConfig, $_REQUEST; $Itemid = $_CB_framework->itemid(); $ui = 1; outputCbTemplate($ui); initToolTip(1); ob_start(); ?> var tabPanemyCon; function showCBTabPaneMy( sName ) { if (typeof tabPanemyCon != "undefined" ) { switch ( sName.toLowerCase() ) { case "<?php echo strtolower(_UE_MANAGEACTIONS); ?> ": case "manageactions": case "0": tabPanemyCon.setSelectedIndex( 0 ); break; case "<?php echo strtolower(_UE_MANAGECONNECTIONS); ?> ": case "manageconnections": case "1": tabPanemyCon.setSelectedIndex( 1 ); break; case "<?php echo strtolower(_UE_CONNECTEDWITH); ?> ": case "connectedfrom": case "2": tabPanemyCon.setSelectedIndex( 2 ); break; } } } <?php $cbjavascript = ob_get_contents(); ob_end_clean(); $_CB_framework->outputCbJQuery($cbjavascript); ob_start(); ?> function confirmSubmit() { if (confirm("<?php echo _UE_CONFIRMREMOVECONNECTION; ?> ")) return true ; else return false ; } <?php $cbjavascript = ob_get_contents(); ob_end_clean(); $_CB_framework->document->addHeadScriptDeclaration($cbjavascript); $tabs = new cbTabs(0, $ui); $cTypes = explode("\n", $ueConfig['connection_categories']); $connectionTypes = array(); foreach ($cTypes as $cType) { if (trim($cType) != null && trim($cType) != "") { $connectionTypes[] = moscomprofilerHTML::makeOption(trim($cType), getLangDefinition(trim($cType))); } } ?> <div class="contentheading"><?php echo _UE_MANAGECONNECTIONS; ?> </div><br /> <br /> <?php echo $tabs->startPane("myCon"); // Tab 0: Manange Actions: echo $tabs->startTab("myCon", _UE_MANAGEACTIONS . " (" . count($actions) . ")", "action"); if (!count($actions) > 0) { echo "\t\t<div class=\"tab_Description\">" . _UE_NOACTIONREQUIRED . "</div>\n"; } else { echo '<form method="post" action="' . cbSef('index.php?option=com_comprofiler&task=processConnectionActions' . ($Itemid ? "&Itemid=" . (int) $Itemid : "")) . '">'; echo "\t\t<div class=\"tab_Description\">" . _UE_CONNECT_ACTIONREQUIRED . "</div>\n"; // echo "<div style=\"width:100%;text-align:right;\"><input type=\"submit\" class=\"inputbox\" value=\""._UE_UPDATE."\" /></div>"; echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"95%\">"; echo "<tr>"; echo "<td>"; foreach ($actions as $action) { $conAvatar = null; $conAvatar = getFieldValue('image', $action->avatar, $action); $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', $action->isOnline, $action, null, 1) : ""; $tipField = "<b>" . _UE_CONNECTIONREQUIREDON . "</b> : " . dateConverter($action->membersince, 'Y-m-d', $ueConfig['date_format']); if ($action->reason != null) { $tipField .= "<br /><b>" . _UE_CONNECTIONMESSAGE . "</b> :<br />" . htmlspecialchars($action->reason, ENT_QUOTES); } $tipTitle = _UE_CONNECTIONREQUESTDETAIL; $htmltext = $conAvatar; $style = "style=\"padding:5px;\""; $tooltip = cbFieldTip($ui, $tipField, $tipTitle, '250', '', $htmltext, '', $style, '', false); echo "<div class=\"connectionBox\">"; echo $onlineIMG . ' ' . getNameFormat($action->name, $action->username, $ueConfig['name_format']) . "<br />" . $tooltip . "<br /><img src=\"components/com_comprofiler/images/tick.png\" border=\"0\" alt=\"" . _UE_ACCEPTCONNECTION . "\" title=\"" . _UE_ACCEPTCONNECTION . "\" /><input type=\"radio\" value=\"a\" checked=\"checked\" name=\"" . $action->id . "action\"/> <img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_DECLINECONNECTION . "\" title=\"" . _UE_DECLINECONNECTION . "\" /><input type=\"radio\" value=\"d\" name=\"" . $action->id . "action\"/><input type=\"hidden\" name=\"uid[]\" value=\"" . $action->id . "\" />"; echo " </div>\n"; } echo "</td>"; echo "</tr>"; echo "</table>"; echo "<div style=\"width:100%;text-align:right;\"><input type=\"submit\" class=\"button\" value=\"" . _UE_UPDATE . "\" /></div>"; echo cbGetSpoofInputTag('manageConnections'); echo "</form>"; } echo $tabs->endTab(); // Tab 1: Manange Connections: echo $tabs->startTab("myCon", _UE_MANAGECONNECTIONS, "connections"); if (!count($connections) > 0) { echo "\t\t<div class=\"tab_Description\">" . _UE_NOCONNECTIONS . "</div>\n"; } else { ?> <form action='<?php echo cbSef('index.php?option=com_comprofiler&task=saveConnections' . ($Itemid ? "&Itemid=" . (int) $Itemid : "")); ?> ' method='post' name='userAdmin'> <div class="tab_Description"><?php echo _UE_CONNECT_MANAGECONNECTIONS; ?> </div> <table cellpadding="5" cellspacing="0" border="0" width="95%"> <thead><tr> <th style='text-align:center;'><?php echo _UE_CONNECTION; ?> </th> <th style='text-align:center;'><?php echo _UE_CONNECTIONTYPE; ?> </th> <th style='text-align:center;'><?php echo _UE_CONNECTIONCOMMENT; ?> </th> </tr></thead> <tbody> <?php $i = 1; foreach ($connections as $connection) { $k = explode('|*|', trim($connection->type)); $list = array(); $list['connectionType'] = moscomprofilerHTML::selectList($connectionTypes, $connection->id . 'connectiontype[]', 'class="inputbox" multiple="multiple" size="5"', 'value', 'text', $k, 0); $conAvatar = null; $conAvatar = getFieldValue('image', $connection->avatar, $connection); $emailIMG = getFieldValue('primaryemailaddress', $connection->email, $connection, null, 1); $pmIMG = getFieldValue('pm', $connection->username, $connection, null, 1); $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', $connection->isOnline, $connection, null, 1) : ""; if ($connection->accepted == 1 && $connection->pending == 1) { $actionIMG = "<img src=\"components/com_comprofiler/images/pending.png\" border=\"0\" alt=\"" . _UE_CONNECTIONPENDING . "\" title=\"" . _UE_CONNECTIONPENDING . "\" /> <a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=" . $connection->memberid . ($Itemid ? "&Itemid=" . (int) $Itemid : "")) . "\" onclick=\"return confirmSubmit();\" ><img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_REMOVECONNECTION . "\" /></a>"; } elseif ($connection->accepted == 1 && $connection->pending == 0) { $actionIMG = "<a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=" . $connection->memberid . ($Itemid ? "&Itemid=" . (int) $Itemid : "")) . "\" onclick=\"return confirmSubmit();\" ><img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_REMOVECONNECTION . "\" /></a>"; } elseif ($connection->accepted == 0) { $actionIMG = "<a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=acceptConnection&connectionid=" . $connection->memberid . ($Itemid ? "&Itemid=" . (int) $Itemid : "")) . "\"><img src=\"components/com_comprofiler/images/tick.png\" border=\"0\" alt=\"" . _UE_ACCEPTCONNECTION . "\" title=\"" . _UE_ACCEPTCONNECTION . "\" /></a> <a href=\"" . cbSef("index.php?option=com_comprofiler&act=connections&task=removeConnection&connectionid=" . $connection->memberid . ($Itemid ? "&Itemid=" . (int) $Itemid : "")) . "\"><img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_DECLINECONNECTION . "\" /></a>"; } $tipField = "<b>" . _UE_CONNECTEDSINCE . "</b> : " . dateConverter($connection->membersince, 'Y-m-d', $ueConfig['date_format']); if ($connection->type != null) { $tipField .= "<br /><b>" . _UE_CONNECTIONTYPE . "</b> : " . getConnectionTypes($connection->type); } if ($connection->description != null) { $tipField .= "<br /><b>" . _UE_CONNECTEDCOMMENT . "</b> : " . htmlspecialchars($connection->description); } $tipTitle = _UE_CONNECTEDDETAIL; $htmltext = $conAvatar; $style = "style=\"padding:5px;\""; $tooltip = cbFieldTip($ui, $tipField, $tipTitle, '200', '', $htmltext, '', $style, '', false); echo "\n<tr style='vertical-align:top;' class='sectiontableentry" . $i . "'>"; echo "\n\t<td style='text-align:center;'>" . $onlineIMG . ' ' . getNameFormat($connection->name, $connection->username, $ueConfig['name_format']) . "<br />" . $tooltip . "<br />" . $actionIMG . " <a href=\"" . cbSef("index.php?option=com_comprofiler&task=userProfile&user="******"&Itemid=" . (int) $Itemid : "")) . "\"><img src=\"components/com_comprofiler/images/profiles.gif\" border=\"0\" alt=\"" . _UE_VIEWPROFILE . "\" title=\"" . _UE_VIEWPROFILE . "\" /></a> " . $emailIMG . " " . $pmIMG . "</td>"; echo "\n\t<td style='text-align:center;'>" . $list['connectionType'] . "</td>"; echo "\n\t<td style='text-align:center;'><textarea cols=\"25\" class=\"inputbox\" rows=\"5\" name=\"" . $connection->id . "description\">" . htmlspecialchars($connection->description) . "</textarea><input type=\"hidden\" name=\"uid[]\" value=\"" . $connection->id . "\" /></td>"; echo "\n</tr>"; $i = $i == 1 ? 2 : 1; } echo "</tbody>"; echo "</table><br />"; if ($perpage < $total) { echo "<div style='width:95%;text-align:center;'>" . $connMgmtTabs->_writePaging($pagingParams, 'connections_', $perpage, $total, 'manageConnections') . "</div>"; } echo "<div style=\"width:100%;text-align:right;\"><input type=\"submit\" class=\"button\" value=\"" . _UE_UPDATE . "\" /></div>"; echo cbGetSpoofInputTag('manageConnections'); echo "</form>"; } echo $tabs->endTab(); // Tab 2: Users connected with me: if ($ueConfig['autoAddConnections'] == 0) { echo $tabs->startTab('myCon', _UE_CONNECTEDWITH, 'connected'); if (!count($connecteds) > 0) { echo _UE_NOCONNECTEDWITH; } else { // tooltip params: $width = '200'; $icon = ''; $href = ''; echo '<table cellpadding="5" cellspacing="0" border="0" width="95%">'; echo '<tr>'; echo '<td>'; foreach ($connecteds as $connected) { $conAvatar = null; $conAvatar = getFieldValue('image', $connected->avatar, $connected); $emailIMG = getFieldValue('primaryemailaddress', $connected->email, $connected, null, 1); $pmIMG = getFieldValue('pm', $connected->username, $connected, null, 1); $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', $connected->isOnline, $connected, null, 1) : ''; if ($connected->accepted == 1 && $connected->pending == 1) { $actionIMG = '<img src="components/com_comprofiler/images/pending.png" border="0" alt="' . _UE_CONNECTIONPENDING . '" title="' . _UE_CONNECTIONPENDING . '" /> ' . '<a href="' . cbSef('index.php?option=com_comprofiler&act=connections&task=denyConnection&connectionid=' . $connected->memberid . ($Itemid ? '&Itemid=' . (int) $Itemid : '')) . '" onclick="return confirmSubmit();">' . '<img src="components/com_comprofiler/images/publish_x.png" border="0" alt="' . _UE_REMOVECONNECTION . '" title="' . _UE_REMOVECONNECTION . '" /></a>'; } elseif ($connected->accepted == 1 && $connected->pending == 0) { $actionIMG = '<a href="' . cbSef('index.php?option=com_comprofiler&act=connections&task=denyConnection&connectionid=' . $connected->referenceid . ($Itemid ? '&Itemid=' . (int) $Itemid : '')) . '" onclick="return confirmSubmit();">' . '<img src="components/com_comprofiler/images/publish_x.png" border="0" alt="' . _UE_REMOVECONNECTION . '" title="' . _UE_REMOVECONNECTION . '" /></a>'; } elseif ($connected->accepted == 0) { $actionIMG = '<a href="' . cbSef('index.php?option=com_comprofiler&act=connections&task=acceptConnection&connectionid=' . $connected->referenceid . ($Itemid ? '&Itemid=' . (int) $Itemid : '')) . '">' . '<img src="components/com_comprofiler/images/tick.png" border="0" alt="' . _UE_ACCEPTCONNECTION . '" title="' . _UE_ACCEPTCONNECTION . '" /></a> ' . '<a href="' . cbSef('index.php?option=com_comprofiler&act=connections&task=denyConnection&connectionid=' . $connected->referenceid . ($Itemid ? '&Itemid=' . (int) $Itemid : '')) . '" onclick="return confirmSubmit();">' . '<img src="components/com_comprofiler/images/publish_x.png" border="0" alt="' . _UE_REMOVECONNECTION . '" title="' . _UE_DECLINECONNECTION . '" /></a>'; } $tipField = '<b>' . _UE_CONNECTEDSINCE . '</b> : ' . dateConverter($connected->membersince, 'Y-m-d', $ueConfig['date_format']); if (getLangDefinition($connected->type) != null) { $tipField .= '<br /><b>' . _UE_CONNECTIONTYPE . '</b> : ' . getLangDefinition($connected->type); } if ($connected->description != null) { $tipField .= '<br /><b>' . _UE_CONNECTEDCOMMENT . '</b> : ' . htmlspecialchars($connected->description); } $tipTitle = _UE_CONNECTEDDETAIL; $htmltext = $conAvatar; $style = 'style="padding:5px;"'; $tooltip = cbFieldTip($ui, $tipField, $tipTitle, $width, $icon, $htmltext, $href, $style, '', false); echo '<div class="connectionBox">'; echo $actionIMG . '<br />'; echo $tooltip . '<br />'; echo $onlineIMG . ' ' . getNameFormat($connected->name, $connected->username, $ueConfig['name_format']); echo '<br /><a href="' . cbSef('index.php?option=com_comprofiler&task=userProfile&user='******'&Itemid=' . (int) $Itemid : '')) . '"><img src="components/com_comprofiler/images/profiles.gif" border="0" alt="' . _UE_VIEWPROFILE . '" title="' . _UE_VIEWPROFILE . '" /></a> ' . $emailIMG . ' ' . $pmIMG . "\n"; echo " </div>\n"; } echo '</td>'; echo '</tr>'; echo '</table>'; } echo $tabs->endTab(); } echo $tabs->endPane(); if (isset($_REQUEST['tab'])) { $_CB_framework->outputCbJQuery("showCBTabPaneMy( '" . addslashes(urldecode(stripslashes(cbGetParam($_REQUEST, 'tab')))) . "' );"); } elseif (!(count($actions) > 0)) { $_CB_framework->outputCbJQuery("tabPanemyCon.setSelectedIndex( 1 );"); } echo '<div style="clear:both;padding:5px"><a href="' . cbSef('index.php?option=com_comprofiler' . getCBprofileItemid(true)) . '">' . _UE_BACK_TO_YOUR_PROFILE . '</a></div>'; }
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(); } }
/** * Notifies connection changes * * @param int $userId * @param int $connectionId * @param string $msg * @param string $subject * @param string $messageHTML * @param string $messageText * @param string $userMessage * @return boolean */ protected function _notifyConnectionChange( $userId, $connectionId, $msg, $subject, $messageHTML, $messageText, $userMessage = null ) { global $_CB_framework, $ueConfig; $rowFrom = new UserTable(); $rowFrom->load( (int) $userId ); $fromName = getNameFormat( $rowFrom->name, $rowFrom->username, $ueConfig['name_format'] ); $fromURL = 'index.php?option=com_comprofiler&view=userprofile&user='******'&tab=1' . getCBprofileItemid(true); $fromURL = cbSef( $fromURL ); if ( strncasecmp( 'http', $fromURL, 4 ) != 0 ) { $fromURL = $_CB_framework->getCfg( 'live_site' ) . '/' . $fromURL; } $subject = sprintf( $subject, $fromName ); if ( $userMessage != null ) { $messageHTML .= sprintf( str_replace( "\n", "\n<br />", CBTxt::T( 'UE_CONNECTIONMSGPREFIX', " %s included the following personal message:\n\n%s" ) ), htmlspecialchars( $fromName ), '<strong>' . htmlspecialchars( $userMessage ) . '</strong>' ); $messageText .= sprintf( str_replace( "\n", "\r\n", CBTxt::T( 'UE_CONNECTIONMSGPREFIX', " %s included the following personal message:\n\n%s" ) ), $fromName, $userMessage ); } $notificationMsgHTML = sprintf( $messageHTML, '<strong><a href="' . $fromURL . '">' . htmlspecialchars( $fromName ) . '</a></strong>' ); $notificationMsgText = sprintf( $messageText, $fromName ); $manageURL = 'index.php?option=com_comprofiler&view=manageconnections' . getCBprofileItemid( true ); $manageURL = cbSef( $manageURL ); if ( strncasecmp( 'http', $manageURL, 4 ) != 0 ) { $manageURL = $_CB_framework->getCfg( 'live_site' ) . '/' . $manageURL; } $notificationMsgHTML = $notificationMsgHTML . "\n<br /><br /><a href=\"" . $manageURL . '">' . CBTxt::T( 'UE_MANAGECONNECTIONS_LINK UE_MANAGECONNECTIONS', 'Manage Connections' ) . "</a>\n"; $notificationMsgText = $notificationMsgText . "\r\n\r\n\r\n" . $fromName . ' ' . CBTxt::T( 'CONNECTION_PROFILE UE_PROFILE', 'Profile' ) . ': ' . cbUnHtmlspecialchars( $fromURL ); $notificationMsgText = $notificationMsgText . "\r\n\r\n" . CBTxt::T( 'UE_MANAGECONNECTIONS_URL_LABEL UE_MANAGECONNECTIONS', 'Manage Connections' ) . ': ' . cbUnHtmlspecialchars( $manageURL ) . "\r\n"; $notificationMsgHTML = '<div style="padding: 4px; margin: 4px 3px 6px 0px; background: #C44; font-weight: bold;" class="cbNotice">' . CBTxt::T( 'UE_SENDPMSNOTICE', 'NOTE: This is a message generated automatically by the Connections system. It has the connecting user\'s address, so you can conveniently reply if you wish to.' ) . "</div>\n\n" . $notificationMsgHTML; $cbNotification = new cbNotification(); $cbNotification->sendFromUser( $connectionId, $userId, $subject, $notificationMsgHTML, $notificationMsgText ); $this->_setUserMSG( $msg ); return true; }
/** * Generates the menu and user status to display on the user profile by calling back $this->addMenu * @param moscomprofilerTab $tab the tab database entry * @param moscomprofilerUser $user the user being displayed * @param int $ui 1 for front-end, 2 for back-end * @return boolean either true, or false if ErrorMSG generated */ function getMenuAndStatus( $tab, $user, $ui ) { global $_CB_framework, $_CB_database, $ueConfig,$_REQUEST,$_POST; $params = $this->params; $Itemid = getCBprofileItemid( 0 ); // Build basic menu: $ue_base_url = "index.php?option=com_comprofiler"; if ( $Itemid ) { $ue_base_url .= "&Itemid=" . $Itemid; // Base URL string } $ue_credits_url = $ue_base_url."&task=teamCredits"; $ue_userdetails_url = $ue_base_url."&task=userDetails" . $this->_addUid( $user ); $ue_useravatar_url = $ue_base_url."&task=userAvatar" . $this->_addUid( $user ); $ue_deleteavatar_url = $ue_base_url."&task=userAvatar&do=deleteavatar" . $this->_addUid( $user ); $ue_unbanrequest_url = $ue_base_url."&task=banProfile&act=2&reportform=1&uid=".$user->id; $ue_banhistory_url = $ue_base_url."&task=moderateBans&act=2&uid=".$user->id; $ue_ban_url = $ue_base_url."&task=banProfile&act=1&uid=".$user->id; $ue_unban_url = $ue_base_url."&task=banProfile&act=0&reportform=0&uid=".$user->id; $ue_reportuser_url = $ue_base_url."&task=reportUser&uid=".$user->id; $ue_viewuserreports_url = $ue_base_url."&task=viewReports&uid=".$user->id; $ue_viewOlduserreports_url = $ue_base_url."&task=viewReports&act=1&uid=".$user->id; $ue_approve_image_url= $ue_base_url."&task=approveImage&flag=1&avatars=".$user->id; $ue_reject_image_url = $ue_base_url."&task=approveImage&flag=0&avatars=".$user->id; $ue_userprofile_url = $ue_base_url.""; $adminimagesdir = $_CB_framework->getCfg( 'live_site' ) . '/components/com_comprofiler/images/'; // $this->menuBar->set("class", "mainlevel"); //BB: hardcoded to check >RC2. $firstMenuName = $params->get('firstMenuName', '_UE_MENU_CB'); $firstSubMenuName = $params->get('firstSubMenuName', '_UE_MENU_ABOUT_CB'); $firstSubMenuHref = $params->get('firstSubMenuHref', $ue_credits_url); $secondSubMenuName = $params->get('secondSubMenuName', ''); $secondSubMenuHref = $params->get('secondSubMenuHref', ''); if ($firstMenuName != "") { $mi = array(); $mi[$firstMenuName]=''; // $this->_addMenuItem( $mi,$firstMenuName,"javascript:void(0)" ); // Community if ($firstSubMenuName != "") { unset($mi); if ($firstSubMenuHref == "") $firstSubMenuHref = "javascript:void(0)"; $mi = array(); $mi[$firstMenuName]["_UE_TEAMCREDITS_CB"]=''; $this->_addMenuItem( $mi,getLangDefinition($firstSubMenuName),cbSef($firstSubMenuHref) ); // About... if ($secondSubMenuName != "") { if ($secondSubMenuHref == "") $secondSubMenuHref = "javascript:void(0)"; $mi = array(); $mi[$firstMenuName]["_UE_SECOND"]=''; $this->_addMenuItem( $mi,getLangDefinition($secondSubMenuName),cbSef($secondSubMenuHref) ); // Free... } } } // ----- VIEW MENU - BEFORE EDIT MENU IF NOT VIEWING A PROFILE ----- if ( $_CB_framework->myId() > 0 ) { // View My Profile: if ( $_CB_framework->displayedUser() === null ) { $mi = array(); $mi["_UE_MENU_VIEW"]["_UE_MENU_VIEWMYPROFILE"]=null; $this->_addMenuItem( $mi, _UE_MENU_VIEWMYPROFILE,cbSef($ue_userprofile_url), "", "","", _UE_MENU_VIEWMYPROFILE_DESC,"" ); } } // ----- EDIT MENU ----- if ( ! cbCheckIfUserCanPerformUserTask( $user->id, 'allowModeratorsUserEdit') ) { if ( $user->id == $_CB_framework->myId() ) { $menuTexts = array( '_UE_UPDATEPROFILE' => _UE_UPDATEPROFILE, '_UE_MENU_UPDATEPROFILE_DESC' => _UE_MENU_UPDATEPROFILE_DESC, '_UE_UPDATEAVATAR' => _UE_UPDATEAVATAR, '_UE_MENU_UPDATEAVATAR_DESC' => _UE_MENU_UPDATEAVATAR_DESC, '_UE_DELETE_AVATAR' => _UE_DELETE_AVATAR, '_UE_MENU_DELETE_AVATAR_DESC' => _UE_MENU_DELETE_AVATAR_DESC ); } else { $menuTexts = array( '_UE_UPDATEPROFILE' => _UE_MOD_MENU_UPDATEPROFILE, '_UE_MENU_UPDATEPROFILE_DESC' => _UE_MOD_MENU_UPDATEPROFILE_DESC, '_UE_UPDATEAVATAR' => _UE_MOD_MENU_UPDATEAVATAR, '_UE_MENU_UPDATEAVATAR_DESC' => _UE_MOD_MENU_UPDATEAVATAR_DESC, '_UE_DELETE_AVATAR' => _UE_MOD_MENU_DELETE_AVATAR, '_UE_MENU_DELETE_AVATAR_DESC' => _UE_MOD_MENU_DELETE_AVATAR_DESC ); } // Update Profile: $mi = array(); $mi["_UE_MENU_EDIT"]["_UE_UPDATEPROFILE"]=null; $this->_addMenuItem( $mi, $menuTexts['_UE_UPDATEPROFILE'],cbSef($ue_userdetails_url), "", "<img src=\"".$adminimagesdir."updateprofile.gif\" alt='' />","", $menuTexts['_UE_MENU_UPDATEPROFILE_DESC'],"" ); // Update Avatar: if($ueConfig['allowAvatar']==1 && ($ueConfig['allowAvatarUpload']==1 || $ueConfig['allowAvatarGallery']==1)) { $mi = array(); $mi["_UE_MENU_EDIT"]["_UE_UPDATEAVATAR"]=null; $this->_addMenuItem( $mi, $menuTexts['_UE_UPDATEAVATAR'],cbSef($ue_useravatar_url), "", "<img src=\"".$adminimagesdir."newavatar.gif\" alt='' />","", $menuTexts['_UE_MENU_UPDATEAVATAR_DESC'],"" ); // Delete Avatar: if($user->avatar!='' && $user->avatar!=null) { $mi = array(); $mi["_UE_MENU_EDIT"]["_UE_DELETE_AVATAR"]=null; $this->_addMenuItem( $mi, $menuTexts['_UE_DELETE_AVATAR'],cbSef($ue_deleteavatar_url), "", "<img src=\"".$adminimagesdir."delavatar.gif\" alt='' />","", $menuTexts['_UE_MENU_DELETE_AVATAR_DESC'],"" ); } } } // ----- VIEW MENU - AFTER EDIT IF VIEWING A PROFILE ----- if ( $_CB_framework->myId() > 0 ) { // View My Profile: if ( ( $_CB_framework->myId() != $user->id ) && ( $_CB_framework->displayedUser() !== null ) ) { $mi = array(); $mi["_UE_MENU_VIEW"]["_UE_MENU_VIEWMYPROFILE"]=null; $this->_addMenuItem( $mi, _UE_MENU_VIEWMYPROFILE,cbSef($ue_userprofile_url), "", "","", _UE_MENU_VIEWMYPROFILE_DESC,"" ); } } // ----- MESSAGES MENU ----- // Send PMS if ( $_CB_framework->myId() != $user->id && $_CB_framework->myId() > 0 ) { global $_CB_PMS; $resultArray = $_CB_PMS->getPMSlinks($user->id, $_CB_framework->myId(), "", "", 1); if (count($resultArray) > 0) { foreach ($resultArray as $res) { if (is_array($res)) { $mi = array(); $mi["_UE_MENU_MESSAGES"][$res["caption"]]=null; $this->_addMenuItem( $mi, getLangDefinition($res["caption"]),cbSef($res["url"]), "", "","", getLangDefinition($res["tooltip"]),"" ); } } } } // Send Email $emailHtml=getFieldValue('primaryemailaddress',$user->email,$user); if ($ueConfig['allow_email_display']!=4 && $_CB_framework->myId() != $user->id && $_CB_framework->myId() > 0) { switch ($ueConfig['allow_email_display']) { case 1: // Display Email only $caption = $emailHtml; $url = "javascript:void(0);"; $desc = _UE_MENU_USEREMAIL_DESC; break; case 2: // Display Email with link: $caption = null; $url = $emailHtml; $desc = _UE_MENU_SENDUSEREMAIL_DESC; break; case 3: // Display Email-to text with link to web-form: $caption = _UE_MENU_SENDUSEREMAIL; $url = $emailHtml; $desc = _UE_MENU_SENDUSEREMAIL_DESC; break; } $mi = array(); $mi["_UE_MENU_MESSAGES"]["_UE_MENU_SENDUSEREMAIL"]=null; $this->_addMenuItem( $mi, $caption, $url, "", "", "", $desc, "" ); } // ----- CONNECTIONS MENU ----- IF ($ueConfig['allowConnections'] && $_CB_framework->myId() > 0) { $ue_addConnection_url = $ue_base_url."&act=connections&task=addConnection&connectionid=".$user->id; $ue_removeConnection_url = $ue_base_url."&act=connections&task=removeConnection&connectionid=".$user->id; $ue_manageConnection_url = $ue_base_url."&task=manageConnections"; // Manage My Connections $mi = array(); $mi["_UE_MENU_CONNECTIONS"]["_UE_MENU_MANAGEMYCONNECTIONS"]=null; $this->_addMenuItem( $mi, _UE_MENU_MANAGEMYCONNECTIONS,cbSef($ue_manageConnection_url), "", "","", _UE_MENU_MANAGEMYCONNECTIONS_DESC,"" ); if ( $_CB_framework->myId() != $user->id ) { $_CB_database->setQuery("SELECT COUNT(*) FROM #__comprofiler_members WHERE referenceid=" . (int) $_CB_framework->myId() . " AND memberid=" . (int) $user->id); $isConnection = $_CB_database->loadResult(); if ($isConnection) { $_CB_database->setQuery("SELECT COUNT(*) FROM #__comprofiler_members WHERE referenceid=" . (int) $_CB_framework->myId() . " AND memberid=" . (int) $user->id." AND pending=0"); $isApproved = $_CB_database->loadResult(); $_CB_database->setQuery("SELECT COUNT(*) FROM #__comprofiler_members WHERE referenceid=" . (int) $_CB_framework->myId() . " AND memberid=" . (int) $user->id." AND accepted=1"); $isAccepted = $_CB_database->loadResult(); } if($isConnection==0) { $connectionurl=cbSef($ue_addConnection_url); if ( $ueConfig['useMutualConnections'] == 1 ) { $fmsg = "_UE_ADDCONNECTIONREQUEST"; $fmsgdesc = _UE_ADDCONNECTIONREQUEST_DESC; } else { $fmsg = "_UE_ADDCONNECTION"; $fmsgdesc = _UE_ADDCONNECTION_DESC; } if($ueConfig['conNotifyType']!=0) { $connectionurl="javascript:void(0)\" onclick=\"return overlib('" . str_replace(array("<",">"), array("<",">"), _UE_CONNECTIONINVITATIONMSG."<br /><form action="".$connectionurl ."" method="post" id="connOverForm" name="connOverForm">"._UE_MESSAGE ."<br /><textarea cols="40" rows="8" name="message"></textarea><br />" . "<input type="button" class="inputbox" onclick="cbConnSubmReq();" value="" ._UE_SENDCONNECTIONREQUEST."" /> " ."<input type="button" class="inputbox" onclick="cClick();" value="" ._UE_CANCELCONNECTIONREQUEST."" /></form>") ."', STICKY, CAPTION,'" .sprintf(_UE_CONNECTTO,htmlspecialchars(str_replace("'","'",getNameFormat($user->name,$user->username,$ueConfig['name_format'])),ENT_QUOTES)) ."', CENTER,CLOSECLICK,CLOSETEXT,'"._UE_CLOSE_OVERLIB."',WIDTH,350, ANCHOR,'cbAddConn',CENTERPOPUP,'LR','UR');"; // $flink="<a href=\"".$connectionurl."\" id=\"cbAddConn\" name=\"cbAddConn\" title=\"".$fmsgdesc."\">".getLangDefinition($fmsg)."</a>"; $flink = $connectionurl."\" name=\"cbAddConn"; //BBTRYREMOVED: "\" title=\"".$fmsgdesc."\">".getLangDefinition($fmsg)."</a>"; } else { $flink=$connectionurl; } } else { if ($isAccepted) { $connectionurl=cbSef($ue_removeConnection_url); if ($isApproved) { $fmsg = "_UE_REMOVECONNECTION"; $fmsgdesc=_UE_REMOVECONNECTION_DESC; } else { $fmsg = "_UE_REVOKECONNECTIONREQUEST"; $fmsgdesc=_UE_REVOKECONNECTIONREQUEST_DESC; } // $flink="<a href=\"".$connectionurl."\" onclick=\"return confirmSubmit();\" title=\"".$fmsgdesc."\">".getLangDefinition($fmsg)."</a>"; $flink = $connectionurl."\" onclick=\"return confirmSubmit();"; //BBTRYREMOVED: \" title=\"".$fmsgdesc."\">".getLangDefinition($fmsg)."</a>"; } else { /* $connectionurl=cbSef($ue_manageConnection_url); $fmsg = "_UE_MANAGECONNECTIONS"; //BB this is wrong here, unless non-accepted connections are also displayed there $fmsgdesc=_UE_MENU_MANAGEMYCONNECTIONS_DESC; $flink=$connectionurl; */ $fmsg = null; // manage connections is already above, no need to repeat here ! } } // Request/Add/Remove/Revoke Connection if ( $fmsg ) { $mi = array(); $mi["_UE_MENU_CONNECTIONS"][$fmsg]=null; $this->_addMenuItem( $mi, getLangDefinition($fmsg), $flink /*$connectionurl*/, "", "","", $fmsgdesc,"" ); } } } // ----- MODERATE MENU ----- if ( $_CB_framework->myId() == $user->id ) { // Request to unban: if($user->banned==1 && $this->cbUserIsModerator==0 && $ueConfig['allowUserBanning']==1) { $mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_REQUESTUNBANPROFILE"]=null; $this->_addMenuItem( $mi, _UE_REQUESTUNBANPROFILE,cbSef($ue_unbanrequest_url), "", "","", _UE_MENU_REQUESTUNBANPROFILE_DESC,"" ); } } else { // Report User: if($ueConfig['allowUserReports']==1 && $this->cbUserIsModerator==0 && $_CB_framework->myId() > 0) { $mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_REPORTUSER"]=null; $this->_addMenuItem( $mi, _UE_REPORTUSER,cbSef($ue_reportuser_url), "", "","", _UE_MENU_REPORTUSER_DESC,"" ); } // Approve/Reject Avatar & Ban/Unban profile & View User Reports: if($this->cbMyIsModerator==1 && $this->cbUserIsModerator==0) { $query = "SELECT COUNT(*) FROM #__comprofiler_userreports WHERE reportedstatus=0 AND reporteduser="******"SELECT COUNT(*) FROM #__comprofiler_userreports WHERE reporteduser="******"_UE_MENU_MODERATE"]["_UE_APPROVE_IMAGE"]=null; $this->_addMenuItem( $mi, _UE_APPROVE_IMAGE,cbSef($ue_approve_image_url), "", "","", _UE_MENU_APPROVE_IMAGE_DESC,"" ); } // Reject Image $mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_REJECT_IMAGE"]=null; $this->_addMenuItem( $mi, _UE_REJECT_IMAGE,cbSef($ue_reject_image_url), "", "","", _UE_MENU_REJECT_IMAGE_DESC,"" ); } if($ueConfig['allowUserBanning']==1) { if($user->banned!=0 ) { // unban profile $mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_UNBANPROFILE"]=null; $this->_addMenuItem( $mi, _UE_UNBANPROFILE,cbSef($ue_unban_url), "", "","", _UE_MENU_UNBANPROFILE_DESC,"" ); } else { // ban profile $mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_BANPROFILE"]=null; $this->_addMenuItem( $mi, _UE_BANPROFILE,cbSef($ue_ban_url), "", "","", _UE_MENU_BANPROFILE_DESC,"" ); } if( $user->bannedby ) { // ban history $mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_MENU_BANPROFILE_HISTORY"]=null; $this->_addMenuItem( $mi, _UE_MENU_BANPROFILE_HISTORY,cbSef($ue_banhistory_url), "", "","", _UE_MENU_BANPROFILE_HISTORY_DESC,"" ); } } if($ueConfig['allowUserReports']==1 && $userreports>0) { // view user reports $mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_VIEWUSERREPORTS"]=null; $this->_addMenuItem( $mi, _UE_VIEWUSERREPORTS,cbSef($ue_viewuserreports_url), "", "","", _UE_MENU_VIEWUSERREPORTS_DESC,"" ); } elseif($ueConfig['allowUserReports']==1 && $userreportsAllTimes>0) { // view user reports $mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_VIEWUSERREPORTS"]=null; $this->_addMenuItem( $mi, _UE_MOD_MENU_VIEWOLDUSERREPORTS,cbSef($ue_viewOlduserreports_url), "", "","", _UE_MOD_MENU_VIEWOLDUSERREPORTS_DESC,"" ); } } } // Test example: /* $mi = array(); $mi["_UE_MENU_CONNECTIONS"]["duplique"]=null; $this->addMenu( array( "position" => "menuBar" , // "menuBar", "menuList" "arrayPos" => $mi , "caption" => _UE_MENU_MANAGEMYCONNECTIONS , "url" => cbSef($ue_manageConnection_url) , // can also be "<a ....>" or "javascript:void(0)" or "" "target" => "" , // e.g. "_blank" "img" => null , // e.g. "<img src='plugins/user/myplugin/images/icon.gif' width='16' height='16' alt='' />" "alt" => null , // e.g. "text" "tooltip" => _UE_MENU_MANAGEMYCONNECTIONS_DESC , "keystroke" => null ) ); // e.g. "P" */ }
/** * prepare frontend invite edit render * * @param int $id * @param UserTable $user */ private function showInviteEdit( $id, $user ) { global $_CB_framework; $row = new InviteTable(); $row->load( (int) $id ); $isModerator = CBGroupJive::isModerator( $user->get( 'id' ) ); $groupId = $this->input( 'group', null, GetterInterface::INT ); if ( $groupId === null ) { $group = $row->group(); } else { $group = CBGroupJive::getGroup( $groupId ); } $returnUrl = $_CB_framework->pluginClassUrl( $this->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ); if ( ! CBGroupJive::canAccessGroup( $group, $user ) ) { cbRedirect( $returnUrl, CBTxt::T( 'Group does not exist.' ), 'error' ); } elseif ( $row->get( 'id' ) && ( $user->get( 'id' ) != $row->get( 'user_id' ) ) ) { cbRedirect( $returnUrl, CBTxt::T( 'You do not have sufficient permissions to edit this invite.' ), 'error' ); } elseif ( ! $isModerator ) { if ( ( $row->get( 'published' ) == -1 ) || ( ( ! $this->params->get( 'groups_invites_display', 1 ) ) && ( $group->get( 'type' ) != 3 ) ) ) { cbRedirect( $returnUrl, CBTxt::T( 'You do not have access to invites in this group.' ), 'error' ); } elseif ( ( ! $row->get( 'id' ) ) && ( ! CBGroupJive::canCreateGroupContent( $user, $group, 'invites' ) ) ) { cbRedirect( $returnUrl, CBTxt::T( 'You do not have sufficient permissions to create an invite in this group.' ), 'error' ); } } CBGroupJive::getTemplate( 'invite_edit' ); $input = array(); $inviteBy = array(); $inviteByLimit = explode( '|*|', $this->params->get( 'groups_invites_by', '1|*|2|*|3|*|4' ) ); if ( ! $inviteByLimit ) { $inviteByLimit = array( 1, 2, 3, 4 ); } if ( in_array( 1, $inviteByLimit ) ) { $inviteBy[] = CBTxt::T( 'User ID' ); } if ( in_array( 2, $inviteByLimit ) ) { $inviteBy[] = CBTxt::T( 'Username' ); } if ( in_array( 3, $inviteByLimit ) ) { $inviteBy[] = CBTxt::T( 'Name' ); } if ( in_array( 4, $inviteByLimit ) ) { $inviteBy[] = CBTxt::T( 'Email Address' ); } $input['invite_by'] = $inviteBy; $listConnections = array(); if ( Application::Config()->get( 'allowConnections' ) ) { $cbConnection = new cbConnection( (int) $user->get( 'id' ) ); foreach( $cbConnection->getConnectedToMe( (int) $user->get( 'id' ) ) as $connection ) { $listConnections[] = moscomprofilerHTML::makeOption( (string) $connection->id, getNameFormat( $connection->name, $connection->username, Application::Config()->get( 'name_format', 3 ) ) ); } } if ( $listConnections ) { array_unshift( $listConnections, moscomprofilerHTML::makeOption( '0', CBTxt::T( '- Select Connection -' ) ) ); $listTooltip = cbTooltip( null, CBTxt::T( 'Select a connection to invite.' ), null, null, null, null, null, 'data-hascbtooltip="true"' ); $input['list'] = moscomprofilerHTML::selectList( $listConnections, 'selected', 'class="gjInviteConnection form-control"' . $listTooltip, 'value', 'text', (int) $this->input( 'post/selected', 0, GetterInterface::INT ), 1, false, false ); } else { $input['list'] = null; } $toTooltup = cbTooltip( null, CBTxt::T( 'GROUP_INVITE_BY', 'Input the recipient as [invite_by].', array( '[invite_by]' => implode( ', ', $inviteBy ) ) ), null, null, null, null, null, 'data-hascbtooltip="true"' ); $input['to'] = '<input type="text" id="to" name="to" value="' . htmlspecialchars( $this->input( 'post/to', ( $row->get( 'user' ) ? (int) $row->get( 'user' ) : $row->get( 'email' ) ), GetterInterface::STRING ) ) . '" class="gjInviteOther form-control" size="40"' . $toTooltup . ' />'; $messageTooltip = cbTooltip( null, CBTxt::T( 'Optionally input private message to include with the invite.' ), null, null, null, null, null, 'data-hascbtooltip="true"' ); $input['message'] = '<textarea id="message" name="message" class="form-control" cols="40" rows="5"' . $messageTooltip . '>' . htmlspecialchars( $this->input( 'post/message', $row->get( 'message' ), GetterInterface::STRING ) ) . '</textarea>'; HTML_groupjiveInviteEdit::showInviteEdit( $row, $input, $group, $user, $this ); }
/** * Replaces @MENTION with profile urls * * @return string */ public function profiles() { global $_CB_database, $_CB_framework; /** @var UserTable[] $users */ static $users = array(); foreach ( $this->words as $k => $word ) { if ( preg_match( $this->regexp['profile'], $word, $match ) ) { $cleanWord = Get::clean( $match[1], GetterInterface::STRING ); if ( ! isset( $users[$cleanWord] ) ) { $user = new UserTable(); if ( is_numeric( $match[1] ) ) { $user->load( (int) $match[1] ); } if ( ! $user->get( 'id' ) ) { $wordNext2 = ( isset( $this->words[$k+1] ) && ( ! preg_match( $this->regexp['profile'], $this->words[$k+1] ) ) ? $cleanWord . ' ' . Get::clean( $this->words[$k+1], GetterInterface::STRING ) : null ); $wordNext3 = ( $wordNext2 && isset( $this->words[$k+2] ) && ( ! preg_match( $this->regexp['profile'], $this->words[$k+2] ) ) ? $wordNext2 . ' ' . Get::clean( $this->words[$k+2], GetterInterface::STRING ) : null ); $wordNext4 = ( $wordNext3 && isset( $this->words[$k+3] ) && ( ! preg_match( $this->regexp['profile'], $this->words[$k+3] ) ) ? $wordNext3 . ' ' . Get::clean( $this->words[$k+3], GetterInterface::STRING ) : null ); $wordNext5 = ( $wordNext4 && isset( $this->words[$k+4] ) && ( ! preg_match( $this->regexp['profile'], $this->words[$k+4] ) ) ? $wordNext4 . ' ' . Get::clean( $this->words[$k+4], GetterInterface::STRING ) : null ); $wordNext6 = ( $wordNext5 && isset( $this->words[$k+5] ) && ( ! preg_match( $this->regexp['profile'], $this->words[$k+5] ) ) ? $wordNext5 . ' ' . Get::clean( $this->words[$k+5], GetterInterface::STRING ) : null ); $query = 'SELECT c.*, u.*' . "\n FROM " . $_CB_database->NameQuote( '#__users' ) . " AS u" . "\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS c" . ' ON c.' . $_CB_database->NameQuote( 'id' ) . ' = u.' . $_CB_database->NameQuote( 'id' ) . "\n WHERE ( u." . $_CB_database->NameQuote( 'username' ) . ' = ' . $_CB_database->Quote( $cleanWord ) // Match username exactly . ' OR u.' . $_CB_database->NameQuote( 'name' ) . ' = ' . $_CB_database->Quote( $cleanWord ); // Match name exactly if ( $wordNext2 ) { // 2 Words $query .= ' OR u.' . $_CB_database->NameQuote( 'username' ) . ' = ' . $_CB_database->Quote( $wordNext2 ) // Match username +1 word exactly . ' OR u.' . $_CB_database->NameQuote( 'name' ) . ' = ' . $_CB_database->Quote( $wordNext2 ); // Match name +1 word exactly } if ( $wordNext3 ) { // 3 Words $query .= ' OR u.' . $_CB_database->NameQuote( 'username' ) . ' = ' . $_CB_database->Quote( $wordNext3 ) // Match username +2 words exactly . ' OR u.' . $_CB_database->NameQuote( 'name' ) . ' = ' . $_CB_database->Quote( $wordNext3 ); // Match name +2 words exactly } if ( $wordNext4 ) { // 4 Words $query .= ' OR u.' . $_CB_database->NameQuote( 'username' ) . ' = ' . $_CB_database->Quote( $wordNext4 ) // Match username +3 words exactly . ' OR u.' . $_CB_database->NameQuote( 'name' ) . ' = ' . $_CB_database->Quote( $wordNext4 ); // Match name +3 words exactly } if ( $wordNext5 ) { // 5 Words $query .= ' OR u.' . $_CB_database->NameQuote( 'username' ) . ' = ' . $_CB_database->Quote( $wordNext5 ) // Match username +4 words exactly . ' OR u.' . $_CB_database->NameQuote( 'name' ) . ' = ' . $_CB_database->Quote( $wordNext5 ); // Match name +4 words exactly } if ( $wordNext6 ) { // 6 Words $query .= ' OR u.' . $_CB_database->NameQuote( 'username' ) . ' = ' . $_CB_database->Quote( $wordNext6 ) // Match username +5 words exactly . ' OR u.' . $_CB_database->NameQuote( 'name' ) . ' = ' . $_CB_database->Quote( $wordNext6 ); // Match name +5 words exactly } $query .= ' )' . "\n ORDER BY u." . $_CB_database->NameQuote( 'username' ) . ", u." . $_CB_database->NameQuote( 'name' ); $_CB_database->setQuery( $query ); $_CB_database->loadObject( $user ); } $users[$cleanWord] = $user; } $user = $users[$cleanWord]; if ( $user->get( 'id' ) ) { $this->parsed = preg_replace( '/@' . (int) $user->get( 'id' ) . '\b|@' . preg_quote( $user->get( 'name' ), '/' ) . '\b|@' . preg_quote( $user->get( 'username' ), '/' ) . '\b|' . preg_quote( $word, '/' ) . '\b/i', '<a href="' . $_CB_framework->userProfileUrl( (int) $user->get( 'id' ) ) . '" rel="nofollow">@' . htmlspecialchars( getNameFormat( $user->get( 'name' ), $user->get( 'username' ), Application::Config()->get( 'name_format' ) ) ) . '</a>', $this->parsed ); } } } return $this->parsed; }
/** * @param string $message * @param UserTable $row * @param int $mode * @param array $extras * @return string */ public function _replaceVariables($message, $row, $mode = 0, $extras = array()) { global $_CB_framework, $ueConfig; // Always build the confirm link for substitution: $confirmLink = $_CB_framework->rawViewUrl('confirm', false, array('confirmcode' => $row->cbactivation)); // Lets build the confirm output only if confirmation is enabled: if ($ueConfig['reg_confirmation'] == 1) { if ($row->confirmed) { $confirm = "\n" . CBTxt::T('UE_USER_EMAIL_CONFIRMED', 'Email address is already confirmed') . "\n"; } else { $confirm = "\n" . $confirmLink . "\n"; } } else { $confirm = null; } // Lets fix linebreaks encase the message was sent as a plain string: $message = str_replace(array('\\r\\n', '\\n'), array("\r\n", "\n"), $message); // Prepare default substitution extras (note how we push some normal substitutions as extras so non-existing users can still substitute information): $extraStrings = array('emailaddress' => $row->email, 'email' => $row->email, 'formatname' => getNameFormat($row->name, $row->username, $ueConfig['name_format']), 'name' => $row->name, 'username' => $row->username, 'details' => $this->_getUserDetails($row, isset($ueConfig['emailpass']) ? $ueConfig['emailpass'] : 0), 'confirm' => $confirm, 'confirmlink' => $confirmLink, 'sitename' => $_CB_framework->getCfg('sitename'), 'siteurl' => $_CB_framework->getCfg('live_site')); // Combine default substitutions with extras supplied: if ($extras && is_array($extras)) { $extraStrings = array_merge($extraStrings, $extras); } if ($row instanceof UserTable && $row->id) { return CBuser::getInstance($row->id)->replaceUserVars($message, true, true, $extraStrings, false); } return cbReplaceVars($message, $row, $mode, true, $extraStrings, false); }
/** * Returns an options array of available user tags with optional activity specific * * @param null|int|ActivityTable $activityId * @param null|int $userId * @return array */ static public function loadTagOptions( $activityId = null, $userId = null ) { global $_CB_database; /** @var ActivityTable[] $cache */ static $cache = array(); if ( $activityId && ( $userId === null ) ) { if ( $activityId instanceof ActivityTable ) { $activity = $activityId; $activityId = (int) $activity->get( 'id' ); } else { if ( ! isset( $cache[$activityId] ) ) { $activity = new ActivityTable(); $activity->load( (int) $activityId ); $cache[$activityId] = $activity; } $activity = $cache[$activityId]; } $userId = (int) $activity->get( 'user_id' ); } elseif ( $userId === null ) { $userId = Application::MyUser()->getUserId(); } static $connections = array(); static $custom = array(); static $options = array(); if ( ! isset( $options[$userId][$activityId] ) ) { if ( ! isset( $connections[$userId] ) ) { $connectionOptions = array(); if ( Application::Config()->get( 'allowConnections' ) ) { $cbConnection = new \cbConnection( $userId ); foreach( $cbConnection->getConnectedToMe( $userId ) as $connection ) { $connectionOptions[] = \moscomprofilerHTML::makeOption( (string) $connection->id, getNameFormat( $connection->name, $connection->username, Application::Config()->get( 'name_format', 3 ) ) ); } } $connections[$userId] = $connectionOptions; } if ( ! isset( $custom[$activityId] ) ) { $activityOptions = array(); if ( $activityId ) { $exclude = array(); foreach ( $connections[$userId] as $connection ) { $exclude[] = $connection->value; } $query = 'SELECT *' . "\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_activity_tags' ) . "\n WHERE " . $_CB_database->NameQuote( 'type' ) . " = " . $_CB_database->Quote( 'activity' ) . "\n AND " . $_CB_database->NameQuote( 'item' ) . " = " . (int) $activityId . "\n ORDER BY " . $_CB_database->NameQuote( 'date' ) . " ASC"; $_CB_database->setQuery( $query ); $tags = $_CB_database->loadObjectList( null, '\CB\Plugin\Activity\Table\TagTable', array( $_CB_database ) ); /** @var TagTable[] $tags */ foreach ( $tags as $tag ) { if ( ! in_array( $tag->get( 'user' ), $exclude ) ) { $activityOptions[] = \moscomprofilerHTML::makeOption( (string) $tag->get( 'user' ), $tag->get( 'user' ) ); } } } $custom[$activityId] = $activityOptions; } $options[$userId][$activityId] = array_merge( $connections[$userId], $custom[$activityId] ); } return $options[$userId][$activityId]; }