本文整理汇总了PHP中CBLib\Application\Application::Cms方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::Cms方法的具体用法?PHP Application::Cms怎么用?PHP Application::Cms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBLib\Application\Application
的用法示例。
在下文中一共展示了Application::Cms方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showAbout
/**
* prepare frontend about render
*
* @param string $return
* @param GroupTable $group
* @param string $users
* @param string $invites
* @param array $counters
* @param array $buttons
* @param array $menu
* @param cbTabs $tabs
* @param UserTable $user
* @return array|null
*/
public function showAbout( &$return, &$group, &$users, &$invites, &$counters, &$buttons, &$menu, &$tabs, $user )
{
global $_CB_framework;
if ( CBGroupJive::isModerator( $user->get( 'id' ) ) || ( ( $group->get( 'published' ) == 1 ) && ( CBGroupJive::getGroupStatus( $user, $group ) >= 3 ) ) ) {
$menu[] = '<a href="' . $_CB_framework->pluginClassUrl( $this->element, true, array( 'action' => 'about', 'func' => 'edit', 'id' => (int) $group->get( 'id' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'About' ) . '</a>';
}
$about = trim( $group->params()->get( 'about_content' ) );
if ( ( ! $about ) || ( $about == '<p></p>' ) ) {
return null;
}
CBGroupJive::getTemplate( 'about', true, true, $this->element );
if ( $this->params->get( 'groups_about_substitutions', 0 ) ) {
$about = CBuser::getInstance( (int) $user->get( 'id' ), false )->replaceUserVars( $about, false, false, null, false );
}
if ( $this->params->get( 'groups_about_content_plugins', 0 ) ) {
$about = Application::Cms()->prepareHtmlContentPlugins( $about );
}
return array( 'id' => 'about',
'title' => CBTxt::T( 'About' ),
'content' => HTML_groupjiveAbout::showAbout( $about, $group, $user, $this )
);
}
示例2: prepareFieldDataSave
/**
* Mutator:
* Prepares field data for saving to database (safe transfer from $postdata to $user)
* Override
*
* @param FieldTable $field
* @param UserTable $user RETURNED populated: touch only variables related to saving this field (also when not validating for showing re-edit)
* @param array $postdata Typically $_POST (but not necessarily), filtering required.
* @param string $reason 'edit' for save user edit, 'register' for save registration
*/
public function prepareFieldDataSave( &$field, &$user, &$postdata, $reason )
{
$hybrid = new cbconnectHybrid();
$fieldName = $field->get( 'name' );
$provider = $hybrid->getProviderFromField( $fieldName );
$providerId = $hybrid->getIdFromProvider( $provider );
$currentValue = $user->get( $fieldName );
$value = cbGetParam( $postdata, $fieldName );
if ( $currentValue && ( $user->get( 'id' ) == Application::MyUser()->get( 'id' ) ) ) {
if ( is_array( $value ) ) {
if ( isset( $value[0] ) && ( $value[0] == 1 ) ) {
$postdata[$fieldName] = '';
}
}
$value = cbGetParam( $postdata, $fieldName );
if ( $value === '' ) {
try {
$adapter = $hybrid->getAdapter( $providerId );
if ( $adapter ) {
switch( $provider ) {
case 'facebook':
/** @noinspection PhpUndefinedMethodInspection */
$adapter->api()->api( '/me/permissions', 'DELETE' );
break;
}
$adapter->logout();
}
} catch ( Exception $e ) {}
}
}
if ( ( ! Application::Cms()->getClientId() ) && $user->get( 'id' ) && $currentValue && ( $value !== '' ) ) {
$postdata[$fieldName] = $currentValue;
}
parent::prepareFieldDataSave( $field, $user, $postdata, $reason );
}
示例3: showEventActivity
/**
* render frontend event activity
*
* @param CB\Plugin\Activity\Table\ActivityTable $row
* @param string $title
* @param string $message
* @param CB\Plugin\Activity\Activity $stream
* @param EventTable $event
* @param cbgjEventsPlugin $plugin
* @return string
*/
static function showEventActivity( $row, &$title, &$message, $stream, $event, $plugin )
{
global $_CB_framework;
$title = CBTxt::T( 'GROUP_EVENT_ACTIVITY_TITLE', 'scheduled an event in [group]', array( '[group]' => '<strong><a href="' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $event->group()->get( 'id' ) ) ) . '">' . htmlspecialchars( CBTxt::T( $event->group()->get( 'name' ) ) ) . '</a></strong>' ) );
$user = CBuser::getMyUserDataInstance();
$userStatus = CBGroupJive::getGroupStatus( $user, $event->group() );
$eventOwner = ( $user->get( 'id' ) == $event->get( 'user_id' ) );
$showAddress = $plugin->params->get( 'groups_events_address', 1 );
$address = htmlspecialchars( $event->get( 'location' ) );
if ( $showAddress ) {
if ( $event->get( 'address' ) ) {
$mapUrl = CBTxt::T( 'GROUP_EVENT_ADDRESS_MAP_URL', 'https://www.google.com/maps/place/[address]', array( '[location]' => urlencode( $event->get( 'location' ) ), '[address]' => urlencode( $event->get( 'address' ) ) ) );
} else {
$mapUrl = CBTxt::T( 'GROUP_EVENT_LOCATION_MAP_URL', 'https://www.google.com/maps/search/[location]', array( '[location]' => urlencode( $event->get( 'location' ) ), '[address]' => urlencode( $event->get( 'address' ) ) ) );
}
if ( $mapUrl ) {
$address = '<a href="' . htmlspecialchars( $mapUrl ) . '" target="_blank" rel="nofollow">' . $address . '</a>';
}
}
$canAttend = ( ( ! $eventOwner ) && ( $event->status() != 1 ) && ( ! $event->get( '_attending' ) ) && ( $userStatus >= 1 ) && ( ( ! $event->get( 'limit' ) ) || ( $event->get( 'limit' ) && ( $event->get( '_guests' ) < $event->get( 'limit' ) ) ) ) );
$return = '<div class="gjEventActivity">'
. '<div class="gjGroupEventsRow row' . ( $event->status() == 1 ? ' gjGroupEventExpired' : ( $event->status() == 2 ? ' gjGroupEventActive' : null ) ) . '">'
. '<div class="gjGroupEventCalendar col-md-2 hidden-sm hidden-xs">'
. '<div class="panel panel-default text-center">'
. '<div class="gjGroupEventMonth panel-body">' . cbFormatDate( $event->get( 'start' ), true, false, 'M' ) . '</div>'
. '<div class="gjGroupEventDay panel-footer">' . cbFormatDate( $event->get( 'start' ), true, false, 'j' ) . '</div>'
. '</div>'
. '</div>'
. '<div class="gjGroupEventContainer col-md-10 col-sm-12 col-xs-12">'
. '<div class="panel ' . ( $event->status() == 1 ? 'panel-warning' : ( $event->status() == 2 ? 'panel-primary' : 'panel-default' ) ) . '">'
. '<div class="gjGroupEventHeader panel-heading">'
. '<div class="row">'
. '<div class="gjGroupEventTitle ' . ( $canAttend ? 'col-sm-8' : 'col-sm-12' ) . '">' . htmlspecialchars( $event->get( 'title' ) ) . '</div>';
if ( $canAttend ) {
$return .= '<div class="gjGroupEventMenu col-sm-4 text-right">'
. '<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'events', 'func' => 'attend', 'id' => (int) $event->get( 'id' ) ) ) . '\';" class="gjButton gjButtonAttend btn btn-xs btn-success">' . CBTxt::T( 'Attend' ) . '</button>'
. '</div>';
}
$return .= '</div>'
. '</div>'
. '<div class="gjGroupEventDetails panel-body small">';
if ( $event->status() == 1 ) {
$return .= '<div class="gjGroupEventNotice text-warning text-right">' . CBTxt::T( 'This event has ended.' ) . '</div>';
} elseif ( $event->status() == 2 ) {
if ( $event->get( 'end' ) ) {
$return .= '<div class="gjGroupEventNotice text-primary text-right">' . CBTxt::T( 'GROUP_EVENT_ENDS_IN', 'This event is currently in progress and ends in [timeago].', array( '[timeago]' => cbFormatDate( $event->get( 'end' ), true, 'exacttimeago' ) ) ) . '</div>';
} else {
$return .= '<div class="gjGroupEventNotice text-primary text-right">' . CBTxt::T( 'This event is currently in progress.' ) . '</div>';
}
} else {
$return .= '<div class="gjGroupEventNotice text-right">' . CBTxt::T( 'GROUP_EVENT_STARTS_IN', 'This event starts in [timeago].', array( '[timeago]' => cbFormatDate( $event->get( 'start' ), true, 'exacttimeago' ) ) ) . '</div>';
}
$return .= '<div class="gjGroupEventDate">'
. '<span class="gjGroupEventIcon fa fa-clock-o text-center"></span> ' . $event->date()
. '</div>'
. '<div class="gjGroupEventLocation">'
. '<span class="gjGroupEventIcon fa fa-map-marker text-center"></span> ' . $address
. '</div>'
. '<div class="gjGroupEventAttending">'
. '<div class="gjGroupEventGuests">'
. '<span class="gjGroupEventIcon fa fa-users text-center"></span> '
. '<a href="' . htmlspecialchars( $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'events', 'func' => 'attending', 'id' => (int) $event->get( 'id' ), 'return' => CBGroupJive::getReturn() ) ) ) . '">'
. ( $event->get( 'limit' ) ? CBTxt::T( 'GROUP_GUESTS_COUNT_LIMITED', '%%COUNT%% of [limit] Guest|%%COUNT%% of [limit] Guests', array( '%%COUNT%%' => (int) $event->get( '_guests', 0 ), '[limit]' => (int) $event->get( 'limit' ) ) ) : CBTxt::T( 'GROUP_GUESTS_COUNT', '%%COUNT%% Guest|%%COUNT%% Guests', array( '%%COUNT%%' => (int) $event->get( '_guests', 0 ) ) ) )
. '</a>'
. '</div>'
. '</div>'
. '</div>'
. '<div class="gjGroupEventDescription panel-footer">'
. '<div class="cbMoreLess">'
. '<div class="cbMoreLessContent">'
. ( $plugin->params->get( 'groups_events_content_plugins', 0 ) ? Application::Cms()->prepareHtmlContentPlugins( $event->get( 'event' ) ) : $event->get( 'event' ) )
. '</div>'
. '<div class="cbMoreLessOpen fade-edge hidden">'
. '<a href="javascript: void(0);" class="cbMoreLessButton">' . CBTxt::T( 'See More' ) . '</a>'
. '</div>'
. '</div>'
. '</div>'
. '</div>'
. '</div>'
. '</div>'
//.........这里部分代码省略.........
示例4: stream
/**
* Outputs stream HTML
*
* @param bool $inline
* @param bool $data
* @return string
*/
public function stream( $inline = false, $data = true )
{
global $_CB_framework, $_PLUGINS;
static $plugin = null;
if ( ! $plugin ) {
$plugin = $_PLUGINS->getLoadedPlugin( 'user', 'cbactivity' );
}
if ( ! $plugin ) {
return null;
}
if ( ! class_exists( 'CBplug_cbactivity' ) ) {
$component = $_CB_framework->getCfg( 'absolute_path' ) . '/components/com_comprofiler/plugin/user/plug_cbactivity/component.cbactivity.php';
if ( file_exists( $component ) ) {
include_once( $component );
}
}
ob_start();
$pluginTab = null;
$pluginData = array( 'stream' => $this, 'inline' => $inline, 'data' => $data );
$pluginArguements = array( &$pluginTab, &$this->user, ( Application::Cms()->getClientId() ? 2 : 1 ), &$pluginData );
$_PLUGINS->call( $plugin->id, 'getCBpluginComponent', 'CBplug_cbactivity', $pluginArguements, $pluginTab );
$return = ob_get_contents();
ob_end_clean();
return $return;
}
示例5: formatFieldValueLayout
/**
* @param string $value
* @param string $reason
* @param null|FieldTable $field
* @param null|UserTable $user
* @param boolean $htmlspecialchars
* @param array $extra
* @return string
*/
protected function formatFieldValueLayout($value, $reason = 'profile', $field = null, $user = null, $htmlspecialchars = true, $extra = array())
{
if (in_array($reason, array('profile', 'list', 'edit', 'register')) && $value !== null && $value !== '' && $field !== null && !$field->get('_hideLayout', 0)) {
switch ($reason) {
case 'register':
$layout = CBTxt::T($field->params->get('fieldLayoutRegister', null));
break;
case 'edit':
$layout = CBTxt::T($field->params->get('fieldLayoutEdit', null));
break;
case 'list':
$layout = CBTxt::T($field->params->get('fieldLayoutList', null));
break;
case 'profile':
default:
$layout = CBTxt::T($field->params->get('fieldLayout', null));
break;
}
// Remove userdata and userfield usage of self from layout to avoid infinite loop:
$layout = trim(preg_replace('/\\[cb:(userdata +field|userfield +field)="' . preg_quote($field->get('name')) . '"[^]]+\\]/i', '', $layout));
if ($layout) {
$value = str_replace('[value]', $value, $layout);
if ($field->params->get('fieldLayoutContentPlugins', 0)) {
$value = Application::Cms()->prepareHtmlContentPlugins($value);
}
if ($user !== null) {
$value = cbReplaceVars($value, $user, $htmlspecialchars, true, $extra);
}
}
}
return $value;
}
示例6: _evaluateIfs
/**
* Evaluate [cb:if ...]
*
* @access private (public because it's recursively calling itself in the preg_replace_callback function at bottom)
*
* @param string|array $input
* @param array $extraStrings
* @return string
*/
public function _evaluateIfs($input, $extraStrings = array())
{
// $regex = "#\[if ([^\]]+)\](.*?)\[/if\]#s";
// $regex = '#\[indent]((?:[^[]|\[(?!/?indent])|(?R))+)\[/indent]#s';
$regex = '#\\[cb:if(?: +user="([^"/\\[\\] ]+)")?( +[^\\]]+)\\]((?:[^\\[]|\\[(?!/?cb:if[^\\]]*])|(?R))+)\\[/cb:if]#';
$that = $this;
return preg_replace_callback($regex, function (array $matches) use($extraStrings, $that) {
$regex2 = '# +(?:(&&|and|\\|\\||or|) +)?([^=<!>~ ]+) *(=|<|>|>=|<=|<>|!=|=~|!~| includes |!includes ) *"([^"]*)"#';
$conditions = null;
if (preg_match_all($regex2, $matches[2], $conditions)) {
$user = $that->_evaluateUserAttrib($matches[1]);
$resultsIdx = 0;
$results = array($resultsIdx => true);
for ($i = 0, $n = count($conditions[0]); $i < $n; $i++) {
$operator = $conditions[1][$i];
$field = $conditions[2][$i];
$compare = $conditions[3][$i];
$value = $conditions[4][$i];
if ($field === 'viewaccesslevel') {
$var = Application::User((int) $user->getUserData()->get('id'))->getAuthorisedViewLevels();
} elseif ($field === 'usergroup') {
$var = Application::User((int) $user->getUserData()->get('id'))->getAuthorisedGroups();
} elseif ($field === 'application_context') {
$var = Application::Cms()->getClientId() ? 'administrator' : 'frontend';
} elseif ($field === 'language_code') {
list($var) = explode('-', Application::Cms()->getLanguageTag());
} elseif ($field === 'language_tag') {
$var = Application::Cms()->getLanguageTag();
} elseif ($field) {
if (isset($extraStrings[$field])) {
$var = $extraStrings[$field];
} else {
$var = $user->getField($field, null, 'php', 'none', 'profile', 0, true);
// allow accessing all fields in the if
if (is_array($var)) {
$var = array_shift($var);
} elseif (isset($user->_cbuser->{$field})) {
// fall-back to the record if it exists:
$var = $user->_cbuser->get($field);
} else {
$fieldLower = strtolower($field);
if (isset($user->_cbuser->{$fieldLower})) {
// second fall-back to the record if it exists:
$var = $user->_cbuser->get($fieldLower);
} else {
$var = null;
}
}
}
} else {
$var = null;
}
// When using an includes or !includes operator ensure the value stays an array if it is an array:
if (is_array($var) && !in_array($compare, array(' includes ', '!includes '))) {
$var = implode('|*|', $var);
}
// Ensure user id is always an integer:
if (in_array($field, array('id', 'user_id'))) {
$var = (int) $var;
}
if ($field == 'user_id' && $value == 'myid') {
$value = (int) Application::MyUser()->getUserId();
}
switch ($compare) {
case '=':
$r = $var == $value;
break;
case '<':
$r = $var < $value;
break;
case '>':
$r = $var > $value;
break;
case '>=':
$r = $var >= $value;
break;
case '<=':
$r = $var <= $value;
break;
case '<>':
case '!=':
$r = $var != $value;
break;
case '=~':
case '!~':
$ma = @preg_match($value, $var);
$r = $compare == '=~' ? $ma === 1 : $ma == 0;
if ($ma === false) {
// error in regexp itself:
global $_CB_framework;
if ($_CB_framework->getCfg('debug') > 0) {
//.........这里部分代码省略.........
示例7: icon
/**
* @return string
*/
public function icon()
{
global $_CB_framework;
if ( Application::Cms()->getClientId() ) {
CBActivity::getTemplate( 'twemoji', false, true, false );
}
$icon = null;
$emoteClass = 'streamIconEmote' . ucfirst( strtolower( preg_replace( '/[^-a-zA-Z0-9_]/', '', $this->get( 'value' ) ) ) );
if ( $this->get( 'icon' ) ) {
$icon = '<img src="' . $_CB_framework->getCfg( 'live_site' ) . '/images/' . htmlspecialchars( $this->get( 'icon' ) ) . '" class="streamIconEmote ' . $emoteClass . ' img-responsive-inline" />';
} elseif ( $this->get( 'class' ) ) {
$icon = '<span class="streamIconEmote ' . $emoteClass . ' ' . htmlspecialchars( $this->get( 'class' ) ) . '"></span>';
}
return $icon;
}
示例8: getGroupOptions
/**
* Returns an options array of available groups
*
* @param bool $raw
* @param array $excludeCategories
* @param array $excludeGroups
* @return array|\stdClass[]
*/
static public function getGroupOptions( $raw = false, $excludeCategories = array(), $excludeGroups = array() )
{
global $_CB_database;
if ( Application::Cms()->getClientId() ) {
$raw = false;
$excludeCategories = array();
$excludeGroups = array();
}
static $cache = array();
$userId = Application::MyUser()->getUserId();
if ( ! isset( $cache[$userId] ) ) {
$query = 'SELECT g.' . $_CB_database->NameQuote( 'id' ) . ' AS value'
. ', g.' . $_CB_database->NameQuote( 'name' ) . ' AS text'
. ', g.' . $_CB_database->NameQuote( 'category' )
. ', c.' . $_CB_database->NameQuote( 'name' ) . ' AS category_name'
. "\n FROM " . $_CB_database->NameQuote( '#__groupjive_groups' ) . " AS g"
. "\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_categories' ) . " AS c"
. ' ON c.' . $_CB_database->NameQuote( 'id' ) . ' = g.' . $_CB_database->NameQuote( 'category' );
if ( ( ! self::isModerator( $userId ) ) && ( ! Application::Cms()->getClientId() ) ) {
$query .= "\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_users' ) . " AS u"
. ' ON u.' . $_CB_database->NameQuote( 'group' ) . ' = g.' . $_CB_database->NameQuote( 'id' )
. ' AND u.' . $_CB_database->NameQuote( 'user_id' ) . ' = ' . (int) $userId
. ' AND u.' . $_CB_database->NameQuote( 'status' ) . ' >= 1'
. "\n WHERE c." . $_CB_database->NameQuote( 'published' ) . " = 1"
. "\n AND c." . $_CB_database->NameQuote( 'access' ) . " IN " . $_CB_database->safeArrayOfIntegers( self::getAccess( $userId ) )
. "\n AND ( g." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $userId
. ' OR ( ( g.' . $_CB_database->NameQuote( 'published' ) . ' = 1 )'
. ' AND ( ( g.' . $_CB_database->NameQuote( 'type' ) . ' IN ( 1, 2 ) )'
. ' OR ( u.' . $_CB_database->NameQuote( 'id' ) . ' IS NOT NULL ) ) ) )'
. ( $excludeCategories ? "\n AND c." . $_CB_database->NameQuote( 'id' ) . " NOT IN " . $_CB_database->safeArrayOfIntegers( $excludeCategories ) : null )
. ( $excludeGroups ? "\n AND g." . $_CB_database->NameQuote( 'id' ) . " NOT IN " . $_CB_database->safeArrayOfIntegers( $excludeGroups ) : null );
} else {
$query .= ( $excludeCategories ? "\n WHERE c." . $_CB_database->NameQuote( 'id' ) . " NOT IN " . $_CB_database->safeArrayOfIntegers( $excludeCategories ) : null )
. ( $excludeGroups ? "\n " . ( $excludeCategories ? 'AND' : 'WHERE' ) . " g." . $_CB_database->NameQuote( 'id' ) . " NOT IN " . $_CB_database->safeArrayOfIntegers( $excludeGroups ) : null );
}
$query .= "\n ORDER BY c." . $_CB_database->NameQuote( 'ordering' ) . ", g." . $_CB_database->NameQuote( 'ordering' );
$_CB_database->setQuery( $query );
$cache[$userId] = $_CB_database->loadObjectList();
}
if ( $raw === true ) {
return $cache[$userId];
}
$optGroups = array();
$options = array();
foreach ( $cache[$userId] as $group ) {
$category = (int) $group->category;
if ( ! in_array( $category, $optGroups ) ) {
$options[] = \moscomprofilerHTML::makeOptGroup( ( $category ? CBTxt::T( $group->category_name ) : CBTxt::T( 'Uncategorized' ) ) );
$optGroups[] = $category;
}
$options[] = \moscomprofilerHTML::makeOption( (int) $group->value, CBTxt::T( $group->text ) );
}
return $options;
}
示例9: triggerSysPlugins
}
}
/**
* Triggers the system plugins
*/
public function triggerSysPlugins()
{
// now check for content plugin:
self::registerOnRealStart(false);
//TODO LATER: make it more universal.
// $_PLUGINS->trigger( 'onCPayHostSystemStart', array() ); // not needed here as plugins are not loaded depending on triggers yet
}
}
/**
* Event handler for onAfterStart
*/
function cbpaidSysPlugin_onAfterStart()
{
$_CBPAID_SYSPLUG = new cbpaidSysPlugin();
$_CBPAID_SYSPLUG->checkExpireMe();
$_CBPAID_SYSPLUG->triggerSysPlugins();
}
//TODO this is temporary as we don't have yet a general CB method:
if (Application::Cms()->getClientId() == 0) {
// We do check for content restrictions only in frontend:
define('_CBSUBS_CONTENT_BOT_FILE', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'plugin' . DIRECTORY_SEPARATOR . 'cbsubscontent' . DIRECTORY_SEPARATOR . 'cbsubs.content_access.php');
if (is_readable(_CBSUBS_CONTENT_BOT_FILE)) {
/** @noinspection PhpIncludeInspection */
include_once _CBSUBS_CONTENT_BOT_FILE;
}
}
示例10: validate
/**
* Validator:
* Validates $value for $field->required and other rules
* Override
*
* @param FieldTable $field
* @param UserTable $user RETURNED populated: touch only variables related to saving this field (also when not validating for showing re-edit)
* @param string $columnName Column to validate
* @param string $value (RETURNED:) Value to validate, Returned Modified if needed !
* @param array $postdata Typically $_POST (but not necessarily), filtering required.
* @param string $reason 'edit' for save user edit, 'register' for save registration
* @return boolean True if validate, $this->_setErrorMSG if False
*/
public function validate( &$field, &$user, $columnName, &$value, &$postdata, $reason )
{
if ( ( ! Application::Cms()->getClientId() ) && ( ! Application::MyUser()->isGlobalModerator() ) && in_array( $reason, array( 'register', 'edit' ) ) ) {
if ( parent::validate( $field, $user, $columnName, $value, $postdata, $reason ) ) {
$captcha = cbantispamCaptcha::getInstance( $field->get( 'name' ), $field->params->get( 'cbantispam_captcha_mode', null ) );
if ( ! $captcha->validateCaptcha() ) {
$this->_setValidationError( $field, $user, $reason, ( $captcha->error ? $captcha->error : CBTxt::T( 'Invalid Captcha Code' ) ) );
return false;
}
}
}
return true;
}
示例11: getField
/**
* @param FieldTable $field
* @param UserTable $user
* @param string $output
* @param string $reason
* @param int $list_compare_types
* @return mixed|null|string
*/
public function getField( &$field, &$user, $output, $reason, $list_compare_types )
{
global $_CB_framework;
$return = null;
if ( ( ! Application::Cms()->getClientId() ) && ( $output == 'htmledit' ) && ( $reason == 'edit' ) && $user->get( 'id' ) && ( ! cbprivacyClass::checkUserModerator( $user->get( 'id' ) ) ) ) {
$url = $_CB_framework->pluginClassUrl( $this->element, true, array( 'action' => 'privacy', 'func' => 'delete' ) );
$value = '<a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete your account?' ) ) . '\' ) ) { location.href = \'' . $url . '\'; }">'
. CBTxt::T( 'Delete account and user profile.' )
. '</a>';
$return = $this->formatFieldValueLayout( $value, $reason, $field, $user, false )
. $this->_fieldIconsHtml( $field, $user, $output, $reason, null, 'html', $value, null, null, true, 0 );
}
return $return;
}
示例12: store
/**
* @param bool $updateNulls
* @return bool
*/
public function store( $updateNulls = false )
{
global $_CB_framework, $_PLUGINS;
$new = ( $this->get( 'id' ) ? false : true );
$old = new self();
$this->set( 'date', $this->get( 'date', Application::Database()->getUtcDateTime() ) );
if ( ! $new ) {
$old->load( (int) $this->get( 'id' ) );
$_PLUGINS->trigger( 'gj_onBeforeUpdateGroup', array( &$this, $old ) );
} else {
$_PLUGINS->trigger( 'gj_onBeforeCreateGroup', array( &$this ) );
}
if ( ! parent::store( $updateNulls ) ) {
return false;
}
if ( ! CBGroupJive::uploadImage( 'canvas', $this ) ) {
return false;
}
if ( ! CBGroupJive::uploadImage( 'logo', $this ) ) {
return false;
}
if ( ! parent::store( $updateNulls ) ) {
return false;
}
// If the new owner doesn't match the previous then demote (frontend) or delete (backend) the previous:
if ( $old->get( 'id' ) ) {
if ( $old->get( 'user_id' ) != $this->get( 'user_id' ) ) {
$previousUser = new UserTable();
$previousUser->load( array( 'user_id' => (int) $old->get( 'user_id' ), 'group' => (int) $this->get( 'id' ) ) );
if ( $previousUser->get( 'id' ) ) {
if ( Application::Cms()->getClientId() ) {
if ( ! $previousUser->delete() ) {
$this->setError( $previousUser->getError() );
return false;
}
} else {
$previousUser->set( 'status', 1 );
if ( ! $previousUser->store() ) {
$this->setError( $previousUser->getError() );
return false;
}
}
}
}
}
$user = new UserTable();
$user->load( array( 'user_id' => (int) $this->get( 'user_id' ), 'group' => (int) $this->get( 'id' ) ) );
// If the owner doesn't exist or isn't marked owner then create them or promote them to owner:
if ( ( ! $user->get( 'id' ) ) || ( $user->get( 'status' ) != 4 ) ) {
$user->set( 'user_id', (int) $this->get( 'user_id' ) );
$user->set( 'group', (int) $this->get( 'id' ) );
$user->set( 'status', 4 );
if ( $user->getError() || ( ! $user->store() ) ) {
$this->setError( $user->getError() );
return false;
}
}
// If the category is changed be sure to move the canvas and logo as needed:
if ( $old->get( 'id' ) && ( $this->get( 'canvas' ) || $this->get( 'logo' ) ) && ( $old->get( 'category' ) != $this->get( 'category' ) ) ) {
$basePath = $_CB_framework->getCfg( 'absolute_path' ) . '/images/comprofiler/plug_cbgroupjive';
$oldPath = $basePath . '/' . (int) $old->get( 'category' ) . '/' . (int) $this->get( 'id' );
$newPath = $basePath . '/' . (int) $this->get( 'category' ) . '/' . (int) $this->get( 'id' );
if ( is_dir( $oldPath ) ) {
CBGroupJive::createDirectory( $basePath, $this->get( 'category' ), $this->get( 'id' ) );
CBGroupJive::copyDirectory( $oldPath, $newPath, true );
}
}
if ( ! $new ) {
$_PLUGINS->trigger( 'gj_onAfterUpdateGroup', array( $this, $old ) );
} else {
$_PLUGINS->trigger( 'gj_onAfterCreateGroup', array( $this ) );
}
return true;
//.........这里部分代码省略.........
示例13: checkCBPostIsHTTPS
/**
* Checks if a page is executed https, and if not, if it should be according to login module HTTPS posts specifications
*
* @param boolean $return [default: false] : True: returns if https switchover is needed for the POST form (if not already on HTTPS and login module asks for it). False: errors 403 if not in https and it's configured in login module.
* @return boolean True: switchover needed (returned only if $return = true)
*/
function checkCBPostIsHTTPS($return = false)
{
global $_CB_framework, $_CB_database, $_SERVER;
$isHttps = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off';
if (!$isHttps && file_exists($_CB_framework->getCfg('absolute_path') . '/modules/' . (checkJversion() > 0 ? 'mod_cblogin/' : null) . 'mod_cblogin.php')) {
$language = CBuser::getMyUserDataInstance()->getUserLanguage();
if (!$language) {
$language = Application::Cms()->getLanguageTag();
}
$query = 'SELECT ' . $_CB_database->NameQuote('params') . "\n FROM " . $_CB_database->NameQuote('#__modules') . "\n WHERE " . $_CB_database->NameQuote('module') . " = " . $_CB_database->Quote('mod_cblogin') . "\n AND " . $_CB_database->NameQuote('published') . " = 1" . "\n AND " . $_CB_database->NameQuote('access') . " IN " . $_CB_database->safeArrayOfIntegers(Application::MyUser()->getAuthorisedViewLevels()) . "\n AND " . $_CB_database->NameQuote('language') . " IN ( " . $_CB_database->Quote($language) . ", " . $_CB_database->Quote('*') . ", " . $_CB_database->Quote('') . " )" . "\n ORDER BY " . $_CB_database->NameQuote('position') . ", " . $_CB_database->NameQuote('ordering');
$_CB_database->setQuery($query, 0, 1);
$module = $_CB_database->loadResult();
if ($module) {
$params = new Registry($module);
$https_post = $params->get('https_post', 0) != 0;
} else {
$https_post = false;
}
} else {
$https_post = false;
}
if ($return) {
return $https_post;
} else {
if ($https_post && !$isHttps) {
header('HTTP/1.0 403 Forbidden');
exit(CBTxt::T('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!'));
}
}
return null;
}
示例14: getUi
/**
* Returns the UI (admin: 2, front-end: 1)
* @deprecated 2.0 Use Application::Cms()->getClientId() which returns (0 = front, 1 = admin)
*
* @return int
*/
function getUi()
{
return Application::Cms()->getClientId() ? 2 : 1;
}
示例15: showEvents
//.........这里部分代码省略.........
}
} elseif ( $row->get( 'published' ) == 1 ) {
$menuItems .= '<li class="gjEventMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to unpublish this Event?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'events', 'func' => 'unpublish', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-times-circle"></span> ' . CBTxt::T( 'Unpublish' ) . '</a></li>';
} else {
$menuItems .= '<li class="gjEventMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'events', 'func' => 'publish', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Publish' ) . '</a></li>';
}
}
if ( $menu ) {
$menuItems .= '<li class="gjEventMenuItem">' . implode( '</li><li class="gjEventMenuItem">', $menu ) . '</li>';
}
if ( $isModerator || $isOwner || $rowOwner || ( $userStatus >= 2 ) ) {
$menuItems .= '<li class="gjEventMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Event?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'events', 'func' => 'delete', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>';
}
$menuItems .= '</ul>';
$menuAttr = cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );
$return .= '<span class="gjEventMenu btn-group">'
. '<button type="button" ' . trim( $menuAttr ) . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
. '</span>';
}
$return .= '</div>';
}
$return .= '</div>'
. '</div>'
. '<div class="gjGroupEventDetails panel-body small">';
if ( $row->status() == 1 ) {
$return .= '<div class="gjGroupEventNotice text-warning text-right">' . CBTxt::T( 'This event has ended.' ) . '</div>';
} elseif ( $row->status() == 2 ) {
if ( $row->get( 'end' ) ) {
$return .= '<div class="gjGroupEventNotice text-primary text-right">' . CBTxt::T( 'GROUP_EVENT_ENDS_IN', 'This event is currently in progress and ends in [timeago].', array( '[timeago]' => cbFormatDate( $row->get( 'end' ), true, 'exacttimeago' ) ) ) . '</div>';
} else {
$return .= '<div class="gjGroupEventNotice text-primary text-right">' . CBTxt::T( 'This event is currently in progress.' ) . '</div>';
}
} else {
$return .= '<div class="gjGroupEventNotice text-right">' . CBTxt::T( 'GROUP_EVENT_STARTS_IN', 'This event starts in [timeago].', array( '[timeago]' => cbFormatDate( $row->get( 'start' ), true, 'exacttimeago' ) ) ) . '</div>';
}
$return .= '<div class="gjGroupEventDate">'
. '<span class="gjGroupEventIcon fa fa-clock-o text-center"></span> ' . $row->date()
. '</div>'
. '<div class="gjGroupEventLocation">'
. '<span class="gjGroupEventIcon fa fa-map-marker text-center"></span> ' . $address
. '</div>'
. '<div class="gjGroupEventAttending row">'
. '<div class="gjGroupEventGuests col-sm-6">'
. '<span class="gjGroupEventIcon fa fa-users text-center"></span> '
. '<a href="' . htmlspecialchars( $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'events', 'func' => 'attending', 'id' => (int) $row->get( 'id' ) ) ) ) . '">'
. ( $row->get( 'limit' ) ? CBTxt::T( 'GROUP_GUESTS_COUNT_LIMITED', '%%COUNT%% of [limit] Guest|%%COUNT%% of [limit] Guests', array( '%%COUNT%%' => (int) $row->get( '_guests', 0 ), '[limit]' => (int) $row->get( 'limit' ) ) ) : CBTxt::T( 'GROUP_GUESTS_COUNT', '%%COUNT%% Guest|%%COUNT%% Guests', array( '%%COUNT%%' => (int) $row->get( '_guests', 0 ) ) ) )
. '</a>'
. '</div>'
. '<div class="gjGroupEventHost col-sm-6 text-right">'
. CBuser::getInstance( (int) $row->get( 'user_id' ), false )->getField( 'formatname', null, 'html', 'none', 'list', 0, true )
. '</div>'
. '</div>'
. '</div>'
. '<div class="gjGroupEventDescription panel-footer">'
. '<div class="cbMoreLess">'
. '<div class="cbMoreLessContent">'
. ( $plugin->params->get( 'groups_events_content_plugins', 0 ) ? Application::Cms()->prepareHtmlContentPlugins( $row->get( 'event' ) ) : $row->get( 'event' ) )
. '</div>'
. '<div class="cbMoreLessOpen fade-edge hidden">'
. '<a href="javascript: void(0);" class="cbMoreLessButton">' . CBTxt::T( 'See More' ) . '</a>'
. '</div>'
. '</div>'
. '</div>'
. ( is_array( $integrations ) && $integrations ? '<div class="gjGroupEventFooter panel-footer">' . implode( '', $integrations ) . '</div>' : null )
. '</div>'
. '</div>'
. '</div>';
} else {
if ( $searching ) {
$return .= CBTxt::T( 'No group event search results found.' );
} else {
$return .= CBTxt::T( 'This group currently has no events.' );
}
}
$return .= '</div>';
if ( $plugin->params->get( 'groups_events_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
$return .= '<div class="gjGroupEventsPaging text-center">'
. $pageNav->getListLinks()
. '</div>';
}
$return .= $pageNav->getLimitBox( false )
. '</form>'
. '</div>';
$_PLUGINS->trigger( 'gj_onAfterDisplayEvents', array( &$return, $rows, $group, $user ) );
return $return;
}