本文整理汇总了PHP中selectTemplate函数的典型用法代码示例。如果您正苦于以下问题:PHP selectTemplate函数的具体用法?PHP selectTemplate怎么用?PHP selectTemplate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了selectTemplate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAvatar
public function getAvatar($profile)
{
if (!$this->exists()) {
return false;
}
$user = CBuser::getInstance($profile->id);
// @task: Apply guest avatars when necessary.
if (!$profile->id) {
$avatar = selectTemplate() . 'images/avatar/tnnophoto_n.png';
return $avatar;
}
if (!$user) {
$user = CBuser::getInstance(null);
}
// Prevent CB from adding anything to the page.
ob_start();
$source = $user->getField('avatar', null, 'php');
$reset = ob_get_contents();
ob_end_clean();
unset($reset);
$source = $source['avatar'];
//incase we view from backend. we need to remove the /administrator/ from the path.
$avatar = str_replace('/administrator/', '/', $source);
return $avatar;
}
示例2: _getURL
protected function _getURL($user, $sizex, $sizey)
{
global $_CB_framework;
$app = JFactory::getApplication();
$user = KunenaFactory::getUser($user);
if ($app->getClientId() == 0) {
$cbclient_id = 1;
}
if ($app->getClientId() == 1) {
$cbclient_id = 2;
}
$_CB_framework->cbset('_ui', $cbclient_id);
// Get CUser object
$cbUser = null;
if ($user->userid) {
$cbUser = CBuser::getInstance($user->userid);
}
if ($cbUser === null) {
if ($sizex <= 90) {
return selectTemplate() . 'images/avatar/tnnophoto_n.png';
}
return selectTemplate() . 'images/avatar/nophoto_n.png';
}
if ($sizex <= 90) {
return $cbUser->getField('avatar', null, 'csv');
}
return $cbUser->getField('avatar', null, 'csv', 'none', 'list');
}
示例3: showBacklink
/**
* render frontend forum backlink
*
* @param GroupTable $group
* @param object $category
* @param cbgjForumsPlugin $plugin
* @return string
*/
static function showBacklink( $group, $category, $plugin )
{
global $_CB_framework;
$return = '<div class="cb_template cb_template_' . selectTemplate( 'dir' ) . '">'
. '<div class="gjBacklink text-right" style="margin-bottom: 5px;">'
. '<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '\';" class="gjButton gjButtonBacklink btn btn-xs btn-default"><span class="fa fa-plus-circle"></span> ' . CBTxt::T( 'Back to Group' ) . '</button>'
. '</div>'
. '</div>';
return $return;
}
示例4: getButtons
/**
* Outputs the provider buttons to the login/logout form
*
* @param int $nameLenght
* @param int $passLenght
* @param int $horizontal
* @param string $classSfx
* @param JRegistry $params
* @return array|null|string
*/
public function getButtons( /** @noinspection PhpUnusedParameterInspection */ $nameLenght, /** @noinspection PhpUnusedParameterInspection */ $passLenght, $horizontal, /** @noinspection PhpUnusedParameterInspection */ $classSfx, /** @noinspection PhpUnusedParameterInspection */ $params )
{
global $_CB_framework;
static $CSS = 0;
if ( ! $CSS++ ) {
$_CB_framework->document->addHeadStyleSheet( $_CB_framework->getCfg( 'live_site' ) . '/components/com_comprofiler/plugin/user/plug_cbconnect/cbconnect.css' );
}
$hybrid = new cbconnectHybrid();
$return = null;
foreach ( array_keys( $hybrid->getProviders() ) as $provider ) {
$return .= $hybrid->getButton( $provider, $horizontal );
}
if ( $return ) {
$return = '<div class="cbConnectButtons cb_template cb_template_' . selectTemplate( 'dir' ) . '">'
. $return
. '</div>';
return array( 'afterButton' => $return );
}
return null;
}
示例5: banUser
function banUser($option, $uid, $form = 1, $act = 1)
{
global $_CB_framework, $ueConfig, $_PLUGINS, $_POST;
$isModerator = Application::MyUser()->isModeratorFor(Application::User((int) $uid));
if ($_CB_framework->myId() < 1 || $uid < 1) {
$msg = CBTxt::Th('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!');
} elseif ($ueConfig['allowUserBanning'] == 0) {
$msg = CBTxt::Th('UE_FUNCTIONALITY_DISABLED', 'This functionality is currently disabled.');
} else {
$msg = null;
}
$_PLUGINS->loadPluginGroup('user');
$_PLUGINS->trigger('onBeforeBanUserRequest', array($uid, &$msg, $form, $act));
if ($msg) {
$_CB_framework->enqueueMessage($msg, 'error');
return;
}
$bannedByUser = CBuser::getUserDataInstance($_CB_framework->myId());
$bannedUser = CBuser::getUserDataInstance($uid);
$orgBannedReason = $bannedUser->get('bannedreason');
if ($form == 1) {
$results = $_PLUGINS->trigger('onBeforeBanUserForm', array($uid, &$bannedByUser, &$bannedUser));
if ($_PLUGINS->is_errors()) {
$_CB_framework->enqueueMessage($_PLUGINS->getErrorMSG('<br />'), 'error');
return;
}
if (implode('', $results) != "") {
$return = '<div class="cb_template cb_template_' . selectTemplate('dir') . '">' . '<div>' . implode('</div><div>', $results) . '</div>' . '</div>';
echo $return;
return;
}
HTML_comprofiler::banUserForm($option, $uid, $act, $orgBannedReason, $bannedByUser, $bannedUser);
} else {
$dateStr = cbFormatDate('now');
if ($act == 1) {
// Ban by moderator:
if (!$isModerator || $_CB_framework->myId() != cbGetParam($_POST, 'bannedby', 0)) {
cbNotAuth(true);
return;
}
cbSpoofCheck('banUserForm');
$bannedReason = '<b>' . '[' . CBTxt::Th('UE_MODERATORBANRESPONSE', 'Moderator Response') . ', ' . htmlspecialchars($dateStr) . ']' . '</b>' . "\n" . htmlspecialchars(stripslashes(cbGetParam($_POST, 'bannedreason'))) . "\n" . $orgBannedReason;
if (!$bannedUser->banUser(1, $bannedByUser, $bannedReason)) {
$_CB_framework->enqueueMessage(CBTxt::Th('UE_USERBAN_FAILED', 'User profile ban failed. Error: [error]', array('[error]' => $bannedUser->getError())));
return;
}
$_CB_framework->enqueueMessage(CBTxt::Th('UE_USERBAN_SUCCESSFUL', 'User Profile Ban Successful.'));
} elseif ($act == 0) {
// Unban by moderator:
if (!$isModerator) {
cbNotAuth(true);
return;
}
$bannedReason = '<b>' . '[' . CBTxt::Th('UE_UNBANUSER', 'User Profile Unbanned') . ', ' . htmlspecialchars($dateStr) . ']' . '</b>' . "\n" . $orgBannedReason;
if (!$bannedUser->banUser(0, $bannedByUser, $bannedReason)) {
$_CB_framework->enqueueMessage(CBTxt::Th('UE_USERUNBAN_FAILED', 'Users profile unban failed. Error: [error]', array('[error]' => $bannedUser->getError())));
return;
}
$_CB_framework->enqueueMessage(CBTxt::Th('UE_USERUNBAN_SUCCESSFUL', 'Users profile unbanned successfully.'));
} elseif ($act == 2) {
// Unban request from user:
if ($_CB_framework->myId() != $uid) {
cbNotAuth(true);
return;
}
$bannedReason = '<b>' . '[' . CBTxt::Th('UE_USERBANRESPONSE', 'User Response') . ', ' . htmlspecialchars($dateStr) . ']' . '</b>' . "\n" . htmlspecialchars(stripslashes(cbGetParam($_POST, 'bannedreason'))) . "\n" . $orgBannedReason;
if (!$bannedUser->banUser(2, $bannedByUser, $bannedReason)) {
$_CB_framework->enqueueMessage(CBTxt::Th('UE_USERUNBANREQUEST_FAILED', 'Your unban profile request failed. Error: [error]', array('[error]' => $bannedUser->getError())));
}
$_CB_framework->enqueueMessage(CBTxt::Th('UE_USERUNBANREQUEST_SUCCESSFUL', 'Your unban profile request was successfully submitted.'));
}
}
}
示例6: avatarFilePath
/**
* DO NOT USE: This function will disapear in favor of a new one in very next minor release.
* you should use
* CBuser->getField( 'avatar' , null, 'csv', 'none', 'list' );
* instead of this derpreciated call !
*
* @deprecated 1.9 CBuser->getField( 'avatar' , null, 'csv', 'none', 'list' ); //TODO Unused now: Remove in CB 2.0 RC
*
* @param int $showAvatar 2: Return default avatar if no avatar defined
* @return string|null
*/
public function avatarFilePath($showAvatar = 2)
{
global $_CB_framework, $_CB_database;
$liveSite = $_CB_framework->getCfg('live_site');
$absolutePath = $_CB_framework->getCfg('absolute_path');
$return = null;
if ($this->_cbuser && $this->_cbuser->id) {
$query = 'SELECT *' . "\n FROM " . $_CB_database->NameQuote('#__comprofiler_fields') . "\n WHERE " . $_CB_database->NameQuote('name') . " = " . $_CB_database->Quote('avatar');
$_CB_database->setQuery($query);
$field = new \CB\Database\Table\FieldTable();
$_CB_database->loadObject($field);
$field->params = new \CBLib\Registry\Registry($field->params);
$value = $this->_cbuser->avatar;
$approvedValue = $this->_cbuser->avatarapproved;
if ($value != '' && ($approvedValue > 0 || $showAvatar == 10)) {
if (strpos($value, 'gallery/') === false) {
$return = '/images/comprofiler/tn' . $value;
} else {
$galleryPath = $field->params->get('image_gallery_path', null);
if (!$galleryPath) {
$galleryPath = '/images/comprofiler/gallery';
}
$return = $galleryPath . '/' . preg_replace('!^gallery/(tn)?!', 'tn', $value);
if (!is_file($absolutePath . $return)) {
$return = $galleryPath . '/' . preg_replace('!^gallery/!', '', $value);
}
}
if (!is_file($absolutePath . $return)) {
$return = null;
}
}
if ($return === null && $showAvatar == 2) {
$imagesBase = 'avatar';
if ($field->name == 'canvas') {
$imagesBase = 'canvas';
}
if ($approvedValue == 0) {
$icon = $field->params->get('pendingDefaultAvatar', null);
if ($icon == 'none') {
return null;
} elseif ($icon) {
if ($icon != 'pending_n.png' && !is_file(selectTemplate('absolute_path') . '/images/' . $imagesBase . '/tn' . $icon)) {
$icon = null;
}
}
if (!$icon) {
$icon = 'pending_n.png';
}
} else {
$icon = $field->params->get('defaultAvatar', null);
if ($icon == 'none') {
return null;
} elseif ($icon) {
if ($icon != 'nophoto_n.png' && !is_file(selectTemplate('absolute_path') . '/images/' . $imagesBase . '/tn' . $icon)) {
$icon = null;
}
}
if (!$icon) {
$icon = 'nophoto_n.png';
}
}
return selectTemplate() . 'images/' . $imagesBase . '/tn' . $icon;
}
}
if ($return) {
$return = $liveSite . $return;
}
return $return;
}
示例7: register
//.........这里部分代码省略.........
$user->set( 'firstname', '' );
$user->set( 'lastname', $user->get( 'name' ) );
}
break;
case 3:
$middleName = strpos( $user->get( 'name' ), ' ' );
$lastName = strrpos( $user->get( 'name' ), ' ' );
if ( $lastName !== false ) {
$user->set( 'firstname', substr( $user->get( 'name' ), 0, $middleName ) );
$user->set( 'lastname', substr( $user->get( 'name' ), ( $lastName + 1 ) ) );
if ( $middleName !== $lastName ) {
$user->set( 'middlename', substr( $user->get( 'name' ), ( $middleName + 1 ), ( $lastName - $middleName - 1 ) ) );
} else {
$user->set( 'middlename', '' );
}
} else {
$user->set( 'firstname', '' );
$user->set( 'lastname', $user->get( 'name' ) );
}
break;
}
$user->set( 'username', $username );
$user->set( $this->_providerField, $profile->identifier );
$this->fields( $user, $profile, $mode );
if ( $mode == 2 ) {
foreach ( $user as $k => $v ) {
$_POST[$k] = $v;
}
$emailPass = ( isset( $ueConfig['emailpass'] ) ? $ueConfig['emailpass'] : '0' );
$regErrorMSG = null;
if ( ( ( $_CB_framework->getCfg( 'allowUserRegistration' ) == '0' ) && ( ( ! isset( $ueConfig['reg_admin_allowcbregistration'] ) ) || $ueConfig['reg_admin_allowcbregistration'] != '1' ) ) ) {
$msg = CBTxt::T( 'UE_NOT_AUTHORIZED', 'You are not authorized to view this page!' );
} else {
$msg = null;
}
$_PLUGINS->loadPluginGroup( 'user' );
$_PLUGINS->trigger( 'onBeforeRegisterFormRequest', array( &$msg, $emailPass, &$regErrorMSG ) );
if ( $msg ) {
$_CB_framework->enqueueMessage( $msg, 'error' );
return false;
}
$fieldsQuery = null;
$results = $_PLUGINS->trigger( 'onBeforeRegisterForm', array( 'com_comprofiler', $emailPass, &$regErrorMSG, $fieldsQuery ) );
if ( $_PLUGINS->is_errors() ) {
$_CB_framework->enqueueMessage( $_PLUGINS->getErrorMSG( '<br />' ), 'error' );
return false;
}
if ( implode( '', $results ) != '' ) {
$return = '<div class="cb_template cb_template_' . selectTemplate( 'dir' ) . '">'
. '<div>' . implode( '</div><div>', $results ) . '</div>'
. '</div>';
echo $return;
return false;
}
$_CB_framework->enqueueMessage( CBTxt::T( 'PROVIDER_SIGN_UP_INCOMPLETE', 'Your [provider] sign up is incomplete. Please complete the following.', array( '[provider]' => $this->_providerName ) ) );
HTML_comprofiler::registerForm( 'com_comprofiler', $emailPass, $user, $_POST, $regErrorMSG );
return false;
} else {
$_PLUGINS->trigger( 'onBeforeUserRegistration', array( &$user, &$user ) );
if ( $user->store() ) {
if ( $user->get( 'confirmed' ) == 0 ) {
$user->store();
}
$messagesToUser = activateUser( $user, 1, 'UserRegistration' );
$_PLUGINS->trigger( 'onAfterUserRegistration', array( &$user, &$user, true ) );
if ( $user->get( 'block' ) == 1 ) {
$return = '<div class="cb_template cb_template_' . selectTemplate( 'dir' ) . '">'
. '<div>' . implode( '</div><div>', $messagesToUser ) . '</div>'
. '</div>';
echo $return;
} else {
return true;
}
}
cbRedirect( $this->_returnUrl, CBTxt::T( 'SIGN_UP_WITH_PROVIDER_FAILED', 'Sign up with [provider] failed. Error: [error]', array( '[provider]' => $this->_providerName, '[error]' => $user->getError() ) ), 'error' );
return false;
}
}
示例8: cbimport
if (!file_exists(JPATH_SITE . '/libraries/CBLib/CBLib/Core/CBLib.php') || !file_exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php')) {
echo 'CB not installed';
return;
}
include_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
cbimport('cb.html');
cbimport('language.front');
outputCbTemplate();
require_once dirname(__FILE__) . '/helper.php';
if ((int) $params->get('cb_plugins', 1)) {
global $_PLUGINS;
$_PLUGINS->loadPluginGroup('user');
}
$cbUser = CBuser::getMyInstance();
$user = $cbUser->getUserData();
$templateClass = 'cb_template cb_template_' . selectTemplate('dir');
$mode = (int) $params->get('mode', 1);
if ($params->get('pretext')) {
$preText = $cbUser->replaceUserVars($params->get('pretext'));
} else {
$preText = null;
}
if ($params->get('posttext')) {
$postText = $cbUser->replaceUserVars($params->get('posttext'));
} else {
$postText = null;
}
if ($mode < 6) {
$limit = (int) $params->get('limit', 30);
switch ($mode) {
case 5:
示例9: selectTemplate
}
$xml = modCBAdminHelper::getFeedXML( 'http://www.joomlapolis.com/news?format=feed&type=rss', 'cbnewsfeed.xml', $feedDuration );
if ( $xml ) {
$items = $xml->xpath( '//channel/item' );
/** @noinspection PhpIncludeInspection */
require( JModuleHelper::getLayoutPath( 'mod_cbadmin', 'news' ) );
}
break;
case 2:
case 1:
default:
$menu = array();
/** @noinspection PhpIncludeInspection */
require( JModuleHelper::getLayoutPath( 'mod_cbadmin', 'menu' ) );
if ( $mode == 2 ) {
$return = '<div class="cb_template cb_template_' . selectTemplate( 'dir' ) . '">'
. modCBAdminHelper::getTable( $menu, $disabled )
. '</div>';
echo $return;
} else {
echo modCBAdminHelper::getMenu( $menu, $disabled );
}
break;
}
示例10: _renderRegistrationHead
/**
* Renders the registration head part view
*
* @return string HTML
*/
private function _renderRegistrationHead()
{
global $_CB_framework, $ueConfig;
$layout = isset($ueConfig['reg_layout']) ? $ueConfig['reg_layout'] : 'flat';
$titleCanvas = isset($ueConfig['reg_title_img']) ? $ueConfig['reg_title_img'] : 'general';
if ($titleCanvas != 'none') {
if (in_array($titleCanvas, array('general'))) {
$canvasImg = selectTemplate() . 'images/title/' . $titleCanvas . '.jpg';
} else {
$canvasImg = $_CB_framework->getCfg('live_site') . '/images/' . $titleCanvas;
}
} else {
$canvasImg = null;
}
$return = null;
if ($this->moduleContent) {
$return .= '<div class="cbRegistrationContainer">' . '<div class="cbRegistrationLogin">' . $this->moduleContent . '</div>';
}
$pageClass = $_CB_framework->getMenuPageClass();
$return .= '<div class="cb_template cb_template_' . selectTemplate('dir') . ' cbRegistration ' . ($layout == 'tabbed' ? 'cbRegistrationTabbed' : ($layout == 'stepped' ? 'cbRegistrationStepped' : 'cbRegistrationFlat')) . ($canvasImg ? ' cbRegistrationCanvas' : null) . ($pageClass ? ' ' . htmlspecialchars($pageClass) : null) . '">';
if (is_array($this->triggerResults)) {
$return .= implode('', $this->triggerResults);
}
if ($this->registerTitle || $this->introMessage) {
$return .= '<div class="cbRegistrationHeader"' . ($canvasImg ? ' style="background-image: url(' . $canvasImg . ')"' : null) . '>' . '<div class="cbRegistrationHeaderInner">';
if ($this->registerTitle) {
$return .= '<div class="cbRegistrationTitle page-header">' . '<h3>' . $this->registerTitle . '</h3>' . '</div>';
}
if ($this->introMessage) {
$return .= '<div class="cbRegistrationIntro form-group cb_form_line clearfix">' . $this->introMessage . '</div>';
}
$return .= '</div>' . '</div>';
}
if ($this->topIcons) {
$return .= '<div class="cbIconsTop form-group cb_form_line clearfix">' . $this->topIcons . '</div>';
}
$return .= $this->regFormTag;
return $return;
}
示例11: get_user_avatar_image
/**
* Gets the user avatar image without any link
*
* @param unknown $system
* @param unknown $userid
* @param unknown $alt
* @param number $height
* @param string $email
* @param string $path_only
* @param unknown $attribs
* @return void|Ambigous <string, unknown, NULL, string>
*/
public static function get_user_avatar_image($system, $userid, $alt, $height = 48, $email = null, $path_only = true, $attribs = array())
{
$db = JFactory::getDBO();
$avatar = '';
$userid = !empty($userid) ? $userid : 0;
switch ($system) {
case 'cjforum':
$api = JPATH_ROOT . '/components/com_cjforum/helpers/api.php';
if (file_exists($api)) {
require_once $api;
$avatar = CjForumApi::get_user_avatar_image($userid, $height);
if ($path_only == false) {
$avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
}
}
break;
case 'cjblog':
$api = JPATH_ROOT . DS . 'components' . DS . 'com_cjblog' . DS . 'api.php';
if (file_exists($api)) {
include_once $api;
$avatar = CjBlogApi::get_user_avatar_image($userid, $height);
if ($path_only == false) {
$avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
}
}
break;
case 'jomsocial':
include_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'defines.community.php';
require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'helpers' . DS . 'string.php';
$user = CFactory::getUser($userid);
$avatar = $user->getThumbAvatar();
if ($path_only == false) {
$attribs['height'] = $height . 'px';
$avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
}
break;
case 'cb':
global $_CB_framework, $_CB_database, $ueConfig, $mainframe;
$api = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
if (!is_file($api)) {
return;
}
require_once $api;
cbimport('cb.database');
cbimport('cb.tables');
cbimport('cb.field');
cbimport('language.front');
outputCbTemplate($_CB_framework->getUi());
//TODO: Here
$img_attribs['height'] = $height . 'px';
if ($userid > 0) {
$cbUser = CBuser::getInstance($userid);
if ($cbUser !== null) {
$avatar = $cbUser->getField('avatar', null, 'php', 'profile', 'list');
$name = $cbUser->getField('name');
$avatar = $avatar['avatar'];
if ($path_only == false) {
$avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
}
}
} else {
if ($height <= 90) {
$avatar = $path_only ? selectTemplate() . 'images/avatar/tnnophoto_n.png' : Jhtml::image(selectTemplate() . 'images/avatar/tnnophoto_n.png', '', $img_attribs);
} else {
$avatar = $path_only ? selectTemplate() . 'images/avatar/nophoto_n.png' : Jhtml::image(selectTemplate() . 'images/avatar/nophoto_n.png', '', $img_attribs);
}
}
break;
case 'touch':
$avatarLoc = JURI::base(true) . '/index2.php?option=com_community&controller=profile&task=avatar&width=' . $height . '&height=' . $height . '&user_id=' . $userid . '&no_ajax=1';
$attribs[] = array('style' => 'height: ' . $height . 'px');
$avatar = $path_only ? $avatarLoc : JHtml::image($avatarLoc, $alt, $attribs);
break;
case 'gravatar':
if (null == $email && $userid > 0) {
$strSql = 'SELECT email FROM #__users WHERE id=' . $userid;
$db->setQuery($strSql);
$email = $db->loadResult();
}
$avatar = 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) . '?s=' . $height . '&d=mm&r=g';
if ($path_only == false) {
$avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
}
break;
case 'kunena':
if (CJFunctions::_initialize_kunena()) {
$class = 'avatar';
//.........这里部分代码省略.........
示例12: cbNotAuth
/**
* Displays "Not authorized", and if not logged-in "you need to login"
*
*/
function cbNotAuth($enqueue = false)
{
global $_CB_framework;
if ($enqueue) {
$_CB_framework->enqueueMessage(CBTxt::T('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!') . ($_CB_framework->myId() < 1 ? ' ' . CBTxt::T('You need to log in.') : null), 'error');
} else {
$return = '<div class="cbNotAuth cb_template cb_template_' . selectTemplate('dir') . '">' . '<div class="error">' . CBTxt::Th('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!') . '</div>';
if ($_CB_framework->myId() < 1) {
$return .= '<div class="error">' . CBTxt::Th('UE_DO_LOGIN', 'You need to log in.') . '</div>';
}
$return .= '</div>';
echo $return;
}
}
示例13: showInvites
//.........这里部分代码省略.........
}
if ( $captcha !== false ) {
$return .= '<div class="gjEditContentInput control-group">'
. '<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Captcha' ) . '</label>'
. '<div class="gjEditContentInputField controls">'
. '<div style="margin-bottom: 5px;">' . $captcha['code'] . '</div>'
. '<div>' . $captcha['input'] . '</div>'
. '<span class="gjEditContentInputIcon help-inline">'
. cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
. '</span>'
. '</div>'
. '</div>';
}
$return .= '<div class="gjButtonWrapper form-actions">'
. '<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Send Invite' ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" /> '
. ( $groupInvitesToggle ? '<a href="#gjInviteToggle" role="button" class="gjButton gjButtonCancel btn btn-mini gjToggleCollapse">' . CBTxt::Th( 'Cancel' ) . '</a>' : null )
. '</div>'
. cbGetSpoofInputTag( 'plugin' )
. '</form>'
. '<form action="' . $group->getUrl() . '" method="post" name="gjForm_invites" id="gjForm_invites" class="gjForm">';
if ( $groupInvitesToggle || $groupInvitesSearch ) {
$return .= '<div class="gjTop row-fluid">'
. '<div class="gjTop gjTopLeft span6">'
. ( $groupInvitesToggle ? '<a href="#gjForm_invite" id="gjInviteToggle" role="button" class="gjButton btn gjToggleExpand">' . CBTxt::Th( 'New Invite' ) . '</a>' : null )
. '</div>'
. '<div class="gjTop gjTopRight span6">'
. ( $groupInvitesSearch ? $pageNav->search : null )
. '</div>'
. '</div>';
}
if ( $rows ) {
$return .= '<div class="gjContent">';
foreach ( $rows as $row ) {
if ( $row->get( 'user' ) ) {
$userAvatar = $row->getInvitedAvatar( true );
$userName = $row->getInvitedName( true );
$userOnline = $row->getInvitedOnline();
} else {
$userAvatar = '<img src="' . selectTemplate() . 'images/avatar/tnnophoto_n.png" alt="' . htmlspecialchars( $row->get( 'email' ) ) . '" title="' . htmlspecialchars( $row->get( 'email' ) ) . '" />';
$userName = '<a href="mailto:' . htmlspecialchars( $row->get( 'email' ) ) . '">' . htmlspecialchars( $row->get( 'email' ) ) . '</a>';
$userOnline = null;
}
$menuItems = cbgjClass::getIntegrations( 'gj_onBeforeGroupInviteMenu', array( $row, $group, $category, $user, $plugin ) )
. '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'delete', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::T( 'Are you sure you want to delete this invite?' ) ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>'
. cbgjClass::getIntegrations( 'gj_onAfterGroupInviteMenu', array( $row, $group, $category, $user, $plugin ) );
$return .= '<div class="gjContentBox mini-layout">'
. '<div class="gjContentBoxRow">' . $userName . '</div>'
. '<div class="gjContentBoxRow">' . $userAvatar . '</div>'
. ( $userOnline ? '<div class="gjContentBoxRow">' . $userOnline . '</div>' : null )
. '<div class="gjContentBoxRow">'
. cbgjClass::getIntegrations( 'gj_onBeforeGroupInviteInfo', array( $row, $group, $category, $user, $plugin ) )
. '<span title="' . cbFormatDate( $row->get( 'invited' ), 1, false ) . ( $row->isAccepted() ? ' - ' . cbFormatDate( $row->get( 'accepted' ), 1, false ) : null ) . '">' . $row->getStatus() . '</span>'
. cbgjClass::getIntegrations( 'gj_onAfterGroupInviteInfo', array( $row, $group, $category, $user, $plugin ) )
. '</div>';
if ( ( ! $row->isAccepted() ) && ( $row->dateDifference() >= 5 ) ) {
$return .= '<div class="gjContentBoxRow">'
. '<input type="button" value="' . htmlspecialchars( CBTxt::Th( 'Resend' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'send', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), true ) . '" />'
. '</div>';
}
$return .= '<div class="gjContentBoxRow">'
. cbgjClass::getDropdown( $menuItems, CBTxt::T( 'Menu' ) )
. '</div>';
$return .= '</div>';
}
$return .= '</div>';
} else {
$return .= '<div class="gjContent">';
if ( $groupInvitesSearch && $pageNav->searching ) {
$return .= CBTxt::Th( 'No invite search results found.' );
} else {
$return .= CBTxt::Th( 'There are no invites available.' );
}
$return .= '</div>';
}
if ( $groupInvitesPaging ) {
$return .= '<div class="gjPaging pagination pagination-centered">'
. ( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null )
. ( ! $groupInvitesLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) )
. '</div>';
}
$return .= cbGetSpoofInputTag( 'plugin' )
. '</form>';
return $return;
}
示例14: getUserAvatarImage
public function getUserAvatarImage($app, $userId, $email = null, $height = 48, $urlOnly = true, $alt = '', $imgAttribs = array())
{
$avatar = '';
$userId = !empty($userId) ? $userId : 0;
$imgAttribs['class'] = isset($imgAttribs['class']) ? $imgAttribs['class'] : 'img-avatar';
switch ($app) {
case 'cjforum':
$api = JPATH_ROOT . '/components/com_cjforum/lib/api.php';
if (file_exists($api)) {
require_once $api;
$profileApi = CjForumApi::getProfileApi();
$avatar = $profileApi->getUserAvatarImage($userId, $height);
if ($urlOnly == false) {
$imgAttribs['height'] = $height . 'px';
$imgAttribs['style'] = 'max-height: ' . $height . 'px; max-width: ' . $height . 'px;';
$avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
}
}
break;
case 'cjblog':
$api = JPATH_ROOT . '/components/com_cjblog/api.php';
if (file_exists($api)) {
include_once $api;
$avatar = CjBlogApi::get_user_avatar_image($userId, $height);
if ($urlOnly == false) {
$avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
}
}
break;
case 'easyprofile':
$api = JPATH_ROOT . '/components/com_jsn/helpers/helper.php';
if (file_exists($api)) {
$user = new JsnUser($userId);
$avatar = $user->getValue('avatar');
if ($urlOnly == false) {
$imgAttribs['height'] = $height . 'px';
$imgAttribs['style'] = 'max-height: ' . $height . 'px; display: block; margin: 0 auto';
$avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
}
}
break;
case 'jomsocial':
require_once JPATH_ROOT . '/components/com_community/defines.community.php';
require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
require_once JPATH_ROOT . '/components/com_community/helpers/string.php';
$user = CFactory::getUser($userId);
$avatar = $user->getThumbAvatar();
if ($urlOnly == false) {
$imgAttribs['height'] = $height . 'px';
$avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
}
break;
case 'cb':
global $_CB_framework, $_CB_database, $ueConfig, $mainframe;
$api = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
if (!is_file($api)) {
return;
}
require_once $api;
cbimport('cb.database');
cbimport('cb.tables');
cbimport('cb.field');
cbimport('language.front');
outputCbTemplate($_CB_framework->getUi());
//TODO: Here
$imgAttribs['height'] = $height . 'px';
if ($userId > 0) {
$cbUser = CBuser::getInstance($userId);
if ($cbUser !== null) {
$avatar = $cbUser->getField('avatar', null, 'php', 'profile', 'list');
$alt = $cbUser->getField('name');
$avatar = $avatar['avatar'];
}
} else {
if ($height <= 90) {
$avatar = selectTemplate() . 'images/avatar/tnnophoto_n.png';
} else {
$avatar = selectTemplate() . 'images/avatar/nophoto_n.png';
}
}
if ($urlOnly == false) {
$avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
}
break;
case 'gravatar':
if (null == $email && $userId > 0) {
try {
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('email')->from('#__users')->where('id = ' . $userId);
$db->setQuery($query);
$email = $db->loadResult();
} catch (Exception $e) {
}
}
$avatar = 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) . '?s=' . $height . '&d=mm&r=g';
if ($urlOnly == false) {
$avatar = JHtml::image($avatar, $alt, $imgAttribs);
}
break;
case 'kunena':
//.........这里部分代码省略.........
示例15: _avatarLivePath
/**
* Returns full URL of thumbnail of avatar
*
* @param moscomprofilerFields $field
* @param moscomprofilerUser $user
* @param int $show_avatar
* @return string URL
*/
function _avatarLivePath(&$field, &$user, $thumbnail = true, $show_avatar = 2)
{
global $_CB_framework;
$oValue = null;
$col = $field->name;
$colapproved = $col . 'approved';
if ($user && $user->id) {
$avatar = $user->{$col};
$avatarapproved = $user->{$colapproved};
$live_site = $_CB_framework->getCfg('live_site');
$absolute_path = $_CB_framework->getCfg('absolute_path');
$tn = $thumbnail ? 'tn' : '';
$oValue = null;
if ($avatar != '' && ($avatarapproved > 0 || $show_avatar == 10)) {
if (strpos($avatar, 'gallery/') === false) {
$oValue = 'images/comprofiler/' . $tn . $avatar;
} else {
$oValue = 'images/comprofiler/' . $avatar;
}
if (!is_file($absolute_path . '/' . $oValue)) {
$oValue = null;
}
}
if ($oValue === null && $show_avatar == 2) {
if ($avatarapproved == 0) {
$icon = 'pending_n.png';
} else {
$icon = 'nophoto_n.png';
}
return selectTemplate() . 'images/avatar/' . $tn . $icon;
}
}
if ($oValue) {
$oValue = $live_site . '/' . $oValue;
}
return $oValue;
}