示例#1
0
	/**
	 * @param cbautoactionsActionTable $trigger
	 * @param UserTable $user
	 */
	public function execute( $trigger, $user )
	{
		$params					=	$trigger->getParams()->subTree( 'loginlogout' );

		cbimport( 'cb.authentication' );

		$cbAuthenticate			=	new CBAuthentication();

		$isHttps				=	( isset( $_SERVER['HTTPS'] ) && ( ! empty( $_SERVER['HTTPS'] ) ) && ( $_SERVER['HTTPS'] != 'off' ) );
		$returnUrl				=	'http' . ( $isHttps ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'];

		if ( ( ! empty( $_SERVER['PHP_SELF'] ) ) && ( ! empty( $_SERVER['REQUEST_URI'] ) ) ) {
			$returnUrl			.=	$_SERVER['REQUEST_URI'];
		} else {
			$returnUrl			.=	$_SERVER['SCRIPT_NAME'];

			if ( isset( $_SERVER['QUERY_STRING'] ) && ( ! empty( $_SERVER['QUERY_STRING'] ) ) ) {
				$returnUrl		.=	'?' . $_SERVER['QUERY_STRING'];
			}
		}

		$returnUrl				=	cbUnHtmlspecialchars( preg_replace( '/[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']/', '""', preg_replace( '/eval\((.*)\)/', '', htmlspecialchars( urldecode( $returnUrl ) ) ) ) );

		if ( preg_match( '/index.php\?option=com_comprofiler&task=confirm&confirmCode=|index.php\?option=com_comprofiler&view=confirm&confirmCode=|index.php\?option=com_comprofiler&task=login|index.php\?option=com_comprofiler&view=login/', $returnUrl ) ) {
			$returnUrl			=	'index.php';
		}

		$redirect				=	$trigger->getSubstituteString( $params->get( 'redirect', null, GetterInterface::STRING ), array( 'cbautoactionsClass', 'escapeURL' ) );

		if ( $redirect ) {
			$returnUrl			=	$redirect;
		}

		$message				=	$trigger->getSubstituteString( CBTxt::T( $params->get( 'message', null, GetterInterface::RAW ) ), false );

		if ( $params->get( 'mode', 1, GetterInterface::BOOLEAN ) ) {
			$messagesToUser		=	array();
			$alertMessages		=	array();

			if ( $params->get( 'method', 1, GetterInterface::BOOLEAN ) ) {
				$credentials	=	$trigger->getSubstituteString( $params->get( 'username', null, GetterInterface::STRING ) );
				$method			=	0;
			} else {
				$credentials	=	$trigger->getSubstituteString( $params->get( 'email', null, GetterInterface::STRING ) );
				$method			=	1;
			}

			$resultError		=	$cbAuthenticate->login( $credentials, false, 0, 1, $returnUrl, $messagesToUser, $alertMessages, $method );

			if ( $redirect ) {
				cbRedirect( $redirect, ( $resultError ? $resultError : ( $message ? $message : ( $alertMessages ? stripslashes( implode( '<br />', $alertMessages ) ) : null ) ) ), ( $resultError ? 'error' : 'message' ) );
			}
		} else {
			$resultError		=	$cbAuthenticate->logout( $returnUrl );

			if ( $redirect ) {
				cbRedirect( $redirect, ( $resultError ? $resultError : ( $message ? $message : CBTxt::T( 'LOGOUT_SUCCESS', 'You have successfully logged out' ) ) ), ( $resultError ? 'error' : 'message' ) );
			}
		}
	}
示例#2
0
	protected function getOptions() {
		if ( ( ! file_exists( JPATH_SITE . '/libraries/CBLib/CBLib/Core/CBLib.php' ) ) || ( ! file_exists( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ) ) ) {
			return array();
		}

		/** @noinspection PhpIncludeInspection */
		include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );

		cbimport( 'language.front' );

		$db					=	JFactory::getDBO();

		$options			=	array();

		$query				=	'SELECT ' . $db->quoteName( 'element' ) . ' AS value'
							.	', ' . $db->quoteName( 'name' ) . ' AS text'
							.	"\n FROM " . $db->quoteName( '#__comprofiler_plugin' )
							.	"\n WHERE " . $db->quoteName( 'type' ) . " NOT IN ( " . $db->quote( 'templates' ) . ", " . $db->quote( 'language' ) . " )"
							.	"\n ORDER BY " . $db->quoteName( 'ordering' );
		$db->setQuery( $query );
		$plugins			=	$db->loadObjectList();

		if ( $plugins ) foreach ( $plugins as $plugin ) {
			$options[]		=	JHtml::_( 'select.option', $plugin->value, CBTxt::T( $plugin->text ) );
		}

		return $options;
	}
示例#3
0
 protected function getOptions()
 {
     global $_CB_database;
     if (!file_exists(JPATH_SITE . '/libraries/CBLib/CBLib/Core/CBLib.php') || !file_exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php')) {
         return array();
     }
     /** @noinspection PhpIncludeInspection */
     include_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
     cbimport('cb.html');
     cbimport('language.front');
     $query = 'SELECT f.*' . "\n FROM " . $_CB_database->NameQuote('#__comprofiler_fields') . " AS f" . "\n LEFT JOIN " . $_CB_database->NameQuote('#__comprofiler_tabs') . " AS t" . ' ON t.' . $_CB_database->NameQuote('tabid') . ' = f.' . $_CB_database->NameQuote('tabid') . "\n WHERE f." . $_CB_database->NameQuote('published') . " = 1" . "\n AND f." . $_CB_database->NameQuote('name') . " != " . $_CB_database->Quote('NA') . "\n ORDER BY t." . $_CB_database->NameQuote('ordering') . ", f." . $_CB_database->NameQuote('ordering');
     $_CB_database->setQuery($query);
     $fields = $_CB_database->loadObjectList(null, '\\CB\\Database\\Table\\FieldTable', array(&$_CB_database));
     $options = array();
     /** @var FieldTable[] $fields */
     if ($fields) {
         foreach ($fields as $field) {
             if (count($field->getTableColumns())) {
                 $title = CBTxt::T($field->title);
                 $options[] = JHtml::_('select.option', $field->name, $title ? $title . ' (' . $field->name . ')' : $field->name);
             }
         }
     }
     return $options;
 }
示例#4
0
	/**
	 * render frontend event activity
	 *
	 * @param CB\Plugin\Activity\Table\ActivityTable $row
	 * @param string                                 $title
	 * @param string                                 $message
	 * @param CB\Plugin\Activity\Activity            $stream
	 * @param VideoTable                             $video
	 * @param cbgjVideoPlugin                        $plugin
	 * @return string
	 */
	static function showVideoActivity( $row, &$title, &$message, $stream, $video, $plugin )
	{
		global $_CB_framework;

		$title			=	CBTxt::T( 'GROUP_VIDEO_ACTIVITY_TITLE', 'published a video in [group]', array( '[group]' => '<strong><a href="' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $video->group()->get( 'id' ) ) ) . '">' . htmlspecialchars( CBTxt::T( $video->group()->get( 'name' ) ) ) . '</a></strong>' ) );

		$return			=	'<div class="gjVideoActivity">'
						.		'<div class="gjGroupVideoRow gjContainerBox img-thumbnail">'
						.			'<div class="gjContainerBoxHeader">'
						.				'<video width="640" height="360" style="width: 100%; height: 100%;" src="' . htmlspecialchars( $video->get( 'url' ) ) . '" type="' . htmlspecialchars( $video->mimeType() ) . '" controls="controls" preload="none" class="streamItemVideo gjVideoPlayer"></video>'
						.			'</div>'
						.			'<div class="gjContainerBoxBody text-left">'
						.				'<div class="gjContainerBoxTitle">'
						.					'<strong>'
						.						'<a href="' . htmlspecialchars( $video->get( 'url' ) ) . '" target="_blank" rel="nofollow">' . htmlspecialchars( ( $video->get( 'title' ) ? $video->get( 'title' ) : $video->name() ) ) . '</a>'
						.					'</strong>'
						.				'</div>';

		if ( $video->get( 'caption' ) ) {
			$return		.=				'<div class="gjContainerBoxContent cbMoreLess">'
						.					'<div class="cbMoreLessContent">'
						.						htmlspecialchars( $video->get( 'caption' ) )
						.					'</div>'
						.					'<div class="cbMoreLessOpen fade-edge hidden">'
						.						'<a href="javascript: void(0);" class="cbMoreLessButton">' . CBTxt::T( 'See More' ) . '</a>'
						.					'</div>'
						.				'</div>';
		}

		$return			.=			'</div>'
						.		'</div>'
						.	'</div>';

		return $return;
	}
示例#5
0
	/**
	 * render frontend group wall notify params
	 *
	 * @param NotificationTable $row
	 * @param array             $input
	 * @param GroupTable        $group
	 * @param UserTable         $user
	 * @param cbgjWallPlugin    $plugin
	 * @return string
	 */
	static function showWallNotifications( $row, $input, $group, $user, $plugin )
	{
		$return			=	'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
						.		'<label for="params__wall_new" class="col-sm-9 control-label">' . CBTxt::T( 'Create of new post' ) . '</label>'
						.		'<div class="cb_field col-sm-3 text-right">'
						.			$input['wall_new']
						.		'</div>'
						.	'</div>';

		if ( $row->group()->params()->get( 'wall', 1 ) == 2 ) {
			$return		.=	'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
						.		'<label for="params__wall_approve" class="col-sm-9 control-label">' . CBTxt::T( 'New post requires approval' ) . '</label>'
						.		'<div class="cb_field col-sm-3 text-right">'
						.			$input['wall_approve']
						.		'</div>'
						.	'</div>';
		}

		if ( $plugin->params->get( 'groups_wall_replies', 1 ) ) {
			$return		.=	'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
						.		'<label for="params__wall_reply" class="col-sm-9 control-label">' . CBTxt::T( 'User reply to my existing posts' ) . '</label>'
						.		'<div class="cb_field col-sm-3 text-right">'
						.			$input['wall_reply']
						.		'</div>'
						.	'</div>';
		}

		return $return;
	}
示例#6
0
 /**
  * Shows Forum Posts
  *
  * @param  stdClass[]   $rows       Rows to show
  * @param  cbPageNav    $pageNav    Page Navigation
  * @param  boolean      $searching  Are we searching currently ?
  * @param  string[]     $input      Inputs to show
  * @param  UserTable    $viewer     Viewing User
  * @param  UserTable    $user       Viewed at User
  * @param  TabTable     $tab        Current Tab
  * @param  PluginTable  $plugin     Current Plugin
  * @return string
  */
 public static function showPosts($rows, $pageNav, $searching, $input, $viewer, $user, $tab, $plugin)
 {
     global $_CB_framework;
     $tabPaging = $tab->params->get('tab_posts_paging', 1);
     $canSearch = $tab->params->get('tab_posts_search', 1) && ($searching || $pageNav->total);
     $return = '<div class="forumsPostsTab tab-content">' . '<form action="' . $_CB_framework->userProfileUrl($user->id, true, $tab->tabid) . '" method="post" name="forumPostsForm" id="forumPostsForm" class="forumPostsForm">';
     if ($canSearch) {
         $return .= '<div class="forumsHeader row" style="margin-bottom: 10px;">' . '<div class="col-sm-offset-8 col-sm-4 text-right">' . '<div class="input-group">' . '<span class="input-group-addon"><span class="fa fa-search"></span></span>' . $input['search'] . '</div>' . '</div>' . '</div>';
     }
     $return .= '<table class="forumsContainer table table-hover table-responsive">' . '<thead>' . '<tr>' . '<th style="width: 50%;" class="text-left">' . CBTxt::T('Subject') . '</th>' . '<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T('Category') . '</th>' . '<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T('Date') . '</th>' . '</tr>' . '</thead>' . '<tbody>';
     if ($rows) {
         foreach ($rows as $row) {
             $return .= '<tr>' . '<td style="width: 50%;" class="text-left"><a href="' . (isset($row->url) ? $row->url : cbforumsModel::getForumURL($row->category_id, $row->id)) . '">' . cbforumsClass::cleanPost($row->subject) . '</a></td>' . '<td style="width: 25%;" class="text-left hidden-xs"><a href="' . (isset($row->category_url) ? $row->category_url : cbforumsModel::getForumURL($row->category_id)) . '">' . cbforumsClass::cleanPost($row->category_name) . '</a></td>' . '<td style="width: 25%;" class="text-left hidden-xs">' . cbFormatDate(date('Y-m-d H:i:s', $row->date)) . '</td>' . '</tr>';
         }
     } else {
         $return .= '<tr>' . '<td colspan="3" class="text-left">';
         if ($searching) {
             $return .= CBTxt::T('No post search results found.');
         } else {
             if ($viewer->id == $user->id) {
                 $return .= CBTxt::T('You have no posts.');
             } else {
                 $return .= CBTxt::T('This user has no posts.');
             }
         }
         $return .= '</td>' . '</tr>';
     }
     $return .= '</tbody>';
     if ($tabPaging && $pageNav->total > $pageNav->limit) {
         $return .= '<tfoot>' . '<tr>' . '<td colspan="3" class="text-center">' . $pageNav->getListLinks() . '</td>' . '</tr>' . '</tfoot>';
     }
     $return .= '</table>' . $pageNav->getLimitBox(false) . '</form>' . '</div>';
     return $return;
 }
	/**
	 * 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 )
					);
	}
示例#8
0
	/**
	 * @param cbautoactionsActionTable $trigger
	 * @param UserTable $user
	 */
	public function execute( $trigger, $user )
	{
		foreach ( $trigger->getParams()->subTree( 'menu' ) as $row ) {
			/** @var ParamsInterface $row */
			$menuTitle				=	$trigger->getSubstituteString( $row->get( 'title', null, GetterInterface::STRING ) );

			if ( ! $menuTitle ) {
				if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
					var_dump( CBTxt::T( 'AUTO_ACTION_MENU_NO_TITLE', ':: Action [action] :: CB Menu skipped due to missing title', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
				}

				continue;
			}

			$menuType				=	$trigger->getSubstituteString( $row->get( 'type', null, GetterInterface::STRING ), true, false );
			$menuClass				=	$trigger->getSubstituteString( $row->get( 'class', null, GetterInterface::STRING ), true, false );
			$menuTarget				=	$row->get( 'target', null, GetterInterface::STRING );
			$menuImg				=	$trigger->getSubstituteString( $row->get( 'image', null, GetterInterface::STRING ), false );

			$menuItem				=	array();
			$menuItem['arrayPos']	=	array( $menuType => array( $menuClass => null ) );
			$menuItem['position']	=	$row->get( 'position', 'menuBar', GetterInterface::STRING );
			$menuItem['caption']	=	htmlspecialchars( $menuTitle );
			$menuItem['url']		=	$trigger->getSubstituteString( $row->get( 'url', null, GetterInterface::STRING ), false );
			$menuItem['target']		=	( $menuTarget ? htmlspecialchars( $menuTarget ) : null );
			$menuItem['img']		=	( $menuImg ? ( $menuImg[0] == '<' ? $menuImg : '<img src="' . htmlspecialchars( $menuImg ) . '" />' ) : null );
			$menuItem['tooltip']	=	htmlspecialchars( $trigger->getSubstituteString( $row->get( 'tooltip', null, GetterInterface::STRING ), false ) );

			$this->addMenu( $menuItem );
		}
	}
示例#9
0
	/**
	 * @return bool
	 */
	public function check()
	{
		if ( $this->get( 'user_id' ) == '' ) {
			$this->setError( CBTxt::T( 'Owner not specified!' ) );

			return false;
		} elseif ( $this->get( 'group' ) == '' ) {
			$this->setError( CBTxt::T( 'Group not specified!' ) );

			return false;
		} elseif ( $this->get( 'post' ) == '' ) {
			$this->setError( CBTxt::T( 'Post not specified!' ) );

			return false;
		} elseif ( ! $this->group()->get( 'id' ) ) {
			$this->setError( CBTxt::T( 'Group does not exist!' ) );

			return false;
		} elseif ( $this->get( 'reply' ) ) {
			if ( ! $this->reply()->get( 'id' ) ) {
				$this->setError( CBTxt::T( 'Reply does not exist!' ) );

				return false;
			}
		}

		return true;
	}
示例#10
0
 /**
  * Renders the Articles tab
  *
  * @param  Table[]      $rows       Articles to render
  * @param  cbPageNav    $pageNav    Pagination
  * @param  boolean      $searching  Currently searching
  * @param  string[]     $input      HTML of input elements
  * @param  UserTable    $viewer     Viewing user
  * @param  UserTable    $user       Viewed user
  * @param  stdClass     $model      The model reference
  * @param  TabTable     $tab        Current Tab
  * @param  PluginTable  $plugin     Current Plugin
  * @return string                   HTML
  */
 public static function showArticleTab($rows, $pageNav, $searching, $input, $viewer, $user, $model, $tab, $plugin)
 {
     global $_CB_framework;
     $tabPaging = $tab->params->get('tab_paging', 1);
     $canSearch = $tab->params->get('tab_search', 1) && ($searching || $pageNav->total);
     $return = '<div class="articlesTab">' . '<form action="' . $_CB_framework->userProfileUrl($user->id, true, $tab->tabid) . '" method="post" name="articleForm" id="articleForm" class="articleForm">';
     if ($canSearch) {
         $return .= '<div class="articlesHeader row" style="margin-bottom: 10px;">' . '<div class="col-sm-offset-8 col-sm-4 text-right">' . '<div class="input-group">' . '<span class="input-group-addon"><span class="fa fa-search"></span></span>' . $input['search'] . '</div>' . '</div>' . '</div>';
     }
     $return .= '<table class="articlesContainer table table-hover table-responsive">' . '<thead>' . '<tr>' . '<th style="width: 50%;" class="text-left">' . CBTxt::T('Article') . '</th>' . '<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T('Category') . '</th>' . '<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T('Created') . '</th>' . '</tr>' . '</thead>' . '<tbody>';
     if ($rows) {
         foreach ($rows as $row) {
             $return .= '<tr>' . '<td style="width: 50%;" class="text-left"><a href="' . cbarticlesModel::getUrl($row, true, 'article') . '">' . $row->get('title') . '</a></td>' . '<td style="width: 25%;" class="text-left hidden-xs">' . ($row->get('category') ? '<a href="' . cbarticlesModel::getUrl($row, true, 'category') . '">' . $row->get('category_title') . '</a>' : CBTxt::T('None')) . '</td>' . '<td style="width: 25%;" class="text-left hidden-xs">' . cbFormatDate($row->get('created')) . '</td>' . '</tr>';
         }
     } else {
         $return .= '<tr>' . '<td colspan="3" class="text-left">';
         if ($searching) {
             $return .= CBTxt::T('No article search results found.');
         } else {
             if ($viewer->id == $user->id) {
                 $return .= CBTxt::T('You have no articles.');
             } else {
                 $return .= CBTxt::T('This user has no articles.');
             }
         }
         $return .= '</td>' . '</tr>';
     }
     $return .= '</tbody>';
     if ($tabPaging && $pageNav->total > $pageNav->limit) {
         $return .= '<tfoot>' . '<tr>' . '<td colspan="3" class="text-center">' . $pageNav->getListLinks() . '</td>' . '</tr>' . '</tfoot>';
     }
     $return .= '</table>' . $pageNav->getLimitBox(false) . '</form>' . '</div>';
     return $return;
 }
示例#11
0
	/**
	 * @return bool
	 */
	public function check()
	{
		$emote		=	cbutf8_strtolower( preg_replace( '/[^-a-zA-Z0-9_.]/', '', $this->get( 'value' ) ) );

		if ( $emote == '' ) {
			$this->setError( CBTxt::T( 'Emote not specified!' ) );

			return false;
		} elseif ( ( $this->get( 'icon' ) == '' ) && ( $this->get( 'class' ) == '' ) ) {
			$this->setError( CBTxt::T( 'Icon not specified!' ) );

			return false;
		} else {
			$row	=	new EmoteTable();

			$row->load( array( 'value' => $emote ) );

			if ( $row->get( 'id' ) && ( $this->get( 'id' ) != $row->get( 'id' ) ) ) {
				$this->setError( CBTxt::T( 'Emote already exists!' ) );

				return false;
			}
		}

		return true;
	}
示例#12
0
	/**
	 * render frontend wall activity
	 *
	 * @param CB\Plugin\Activity\Table\ActivityTable $row
	 * @param string                                 $title
	 * @param string                                 $message
	 * @param CB\Plugin\Activity\Activity            $stream
	 * @param WallTable                              $post
	 * @param cbgjWallPlugin                         $plugin
	 * @return string
	 */
	static function showWallActivity( $row, &$title, &$message, $stream, $post, $plugin )
	{
		global $_CB_framework;

		$title		=	CBTxt::T( 'GROUP_WALL_ACTIVITY_TITLE', 'posted in [group]', array( '[group]' => '<strong><a href="' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $post->group()->get( 'id' ) ) ) . '">' . htmlspecialchars( CBTxt::T( $post->group()->get( 'name' ) ) ) . '</a></strong>' ) );
		$message	=	$post->post();

		return null;
	}
示例#13
0
	/**
	 * @param TagTable[]      $rows
	 * @param Tags            $stream
	 * @param int             $output 0: Normal, 1: Raw, 2: Inline, 3: Load , 4: Save
	 * @param UserTable       $user
	 * @param UserTable       $viewer
	 * @param cbPluginHandler $plugin
	 * @return null|string
	 */
	static public function showTags( $rows, $stream, $output, $user, $viewer, $plugin )
	{
		global $_PLUGINS;

		CBActivity::loadHeaders( $output );

		$sourceClean			=	htmlspecialchars( $stream->source() );

		$tags					=	array();
		$return					=	null;

		$_PLUGINS->trigger( 'activity_onBeforeDisplayTags', array( &$return, &$rows, $stream, $output ) );

		if ( $rows ) foreach ( $rows as $row ) {
			$rowId				=	$sourceClean . 'Tag' . (int) $row->get( 'id' );

			if ( is_numeric( $row->get( 'user' ) ) ) {
				$name			=	CBuser::getInstance( (int) $row->get( 'user' ), false )->getField( 'formatname', null, 'html', 'none', 'list', 0, true );
			} else {
				$name			=	htmlspecialchars( $row->get( 'user' ) );
			}

			if ( ! $name ) {
				continue;
			}

			$tags[]				=	'<span id="' . $rowId . '" class="streamTag">'
								.		$name
								.	'</span>';
		}

		if ( $tags ) {
			$return				.=	( ! in_array( $output, array( 1, 4 ) ) ? '<span class="' . $sourceClean . 'Tags streamTags">' : null );

			if ( count( $tags ) > 2 ) {
				$tagOne			=	array_shift( $tags );
				$tagTwo			=	array_shift( $tags );

				$moreTooltip	=	cbTooltip( null, '<div class="streamTagRow">' . implode( '</div><div class="streamTagRow">', $tags ) . '</div>', null, 'auto', null, null, null, 'data-hascbtooltip="true" data-cbtooltip-position-my="bottom center" data-cbtooltip-position-at="top center" data-cbtooltip-open-event="click" data-cbtooltip-close-event="click unfocus" data-cbtooltip-button-hide="true"' );
				$more			=	'<a href="javascript: void(0);"' . $moreTooltip . '>' . CBTxt::T( 'TAGS_MORE', '%%COUNT%% more', array( '%%COUNT%%' => count( $tags ) ) ) . '</a>';

				$return			.=		CBTxt::T( 'TAGS_MORE_THAN_TWO', '[tag_1], [tag_2], and [more]', array( '[tag_1]' => $tagOne, '[tag_2]' => $tagTwo, '[more]' => $more ) );
			} elseif ( count( $tags ) > 1 ) {
				$return			.=		CBTxt::T( 'TAGS_TWO', '[tag_1] and [tag_2]', array( '[tag_1]' => $tags[0], '[tag_2]' => $tags[1] ) );
			} else {
				$return			.=		$tags[0];
			}

			$return				.=	( ! in_array( $output, array( 1, 4 ) ) ? '</span>' : null );
		}

		$return					.=	CBActivity::reloadHeaders( $output );

		$_PLUGINS->trigger( 'activity_onAfterDisplayTags', array( &$return, $rows, $stream, $output ) );

		return $return;
	}
示例#14
0
 /**
  * @param  OrderedTable  $row
  * @param  UserTable     $user
  * @param  stdClass      $model
  * @param  PluginTable   $plugin
  */
 static function showBlog($row, $user, $model, $plugin)
 {
     global $_CB_framework;
     $_CB_framework->setPageTitle($row->get('title'));
     $_CB_framework->appendPathWay(htmlspecialchars(CBTxt::T('Blogs')), $_CB_framework->userProfileUrl($row->get('user', $user->get('id')), true, 'cbblogsTab'));
     $_CB_framework->appendPathWay(htmlspecialchars($row->get('title')), $_CB_framework->pluginClassUrl($plugin->element, true, array('action' => 'blogs', 'func' => 'show', 'id' => (int) $row->get('id'))));
     $cbUser =& CBuser::getInstance((int) $row->get('user'), false);
     $return = '<div class="blowShow">' . '<div class="blogsTitle page-header"><h3>' . $row->get('title') . ' <small>' . CBTxt::T('WRITTEN_BY_BLOG_AUTHOR', 'Written by [blog_author]', array('[blog_author]' => $cbUser->getField('formatname', null, 'html', 'none', 'list', 0, true))) . '</small></h3></div>' . '<div class="blogsHeader well well-sm">' . CBTxt::T('CATEGORY_CATEGORY', 'Category: [category]', array('[category]' => $row->get('category'))) . ' &nbsp;/&nbsp; ' . CBTxt::T('CREATED_CREATED', 'Created: [created]', array('[created]' => cbFormatDate($row->get('created')))) . ($row->get('modified') && $row->get('modified') != '0000-00-00 00:00:00' ? ' &nbsp;/&nbsp; ' . CBTxt::T('MODIFIED_MODIFIED', 'Modified: [modified]', array('[modified]' => cbFormatDate($row->get('modified')))) : null) . '</div>' . '<div class="blogsText">' . $row->get('blog_intro') . $row->get('blog_full') . '</div>' . '</div>';
     echo $return;
 }
	/**
	 * @param  OrderedTable  $row
	 * @param  UserTable     $user
	 * @param  stdClass      $model
	 * @param  PluginTable   $plugin
	 */
	static function showconsultation( $row, $user, /** @noinspection PhpUnusedParameterInspection */ $model, $plugin, $bids )
	{
		global $_CB_framework;

		$_CB_framework->setPageTitle( $row->get( 'title' ) );
		$_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( 'consultations' ) ), $_CB_framework->userProfileUrl( $row->get( 'user', $user->get( 'id' ) ), true, 'cbconsultationsTab' ) );
		$_CB_framework->appendPathWay( htmlspecialchars( $row->get( 'title' ) ), $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'consultations', 'func' => 'show', 'id' => (int) $row->get( 'id' ) ) ) );

		$cbUser			=&	CBuser::getInstance( (int) $row->get( 'user' ), false );

		$return			=	'<div class="blowShow">'
						.		'<div class="consultationsTitle page-header"><h3>' . $row->get( 'title' ) . ' <small>' . CBTxt::T( 'WRITTEN_BY_consultation_AUTHOR', 'Written by [consultation_author]', array( '[consultation_author]' => $cbUser->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) ) ) . '</small></h3></div>'
						.		'<div class="consultationsHeader well well-sm">'
						.			CBTxt::T( 'CATEGORY_CATEGORY', 'Category: [category]', array( '[category]' => $row->get( 'category' ) ) )
						.			' &nbsp;/&nbsp; ' . CBTxt::T( 'CREATED_CREATED', 'Created: [created]', array( '[created]' => cbFormatDate( $row->get( 'created' ) ) ) )
						.			( $row->get( 'modified' ) && ( $row->get( 'modified' ) != '0000-00-00 00:00:00' ) ? ' &nbsp;/&nbsp; ' . CBTxt::T( 'MODIFIED_MODIFIED', 'Modified: [modified]', array( '[modified]' => cbFormatDate( $row->get( 'modified' ) ) ) ) : null )
						.		'</div>'
						.		'<div class="consultationsText">' . $row->get( 'consultation_intro' ) . $row->get( 'consultation_full' ) . '</div>'
						.	'</div>';
    if($bids!=null){
      $return .= '<script >
          window.___gcfg = {
                  lang: \'ru\',
                          parsetags: \'onload\'
                              };
                              </script>

<script src="https://apis.google.com/js/platform.js" async defer></script>
';
      $return .= '<h2>Ставки</h2>';
      if(empty($bids)){
        $return .= "Нет ставок";
      }else{
        $return .= '<table cellspacing="5" class="consultationsContainer table table-hover table-responsive">';
        $return .= '<tr><th>Дата</th><th>Пользователь</th><th>e-mail</th><th>Цена</th><th></th></tr>';
        foreach($bids as $key=>$value){
          $return .='<tr>';
          $return .= '<td>'.$value->bid_date.'</td>';
          $return .= '<td>'.$value->name.'</td>';
          $return .= '<td>'.$value->email.'</td>';
          $return .= '<td>$'.$value->bid_price.'</td>';
          $return .= '<td>';
          if($key==0){
            //Old version was using Goolge Hangouts for communications.
            //$return .= '<g:hangout render="createhangout" hangout_type="normal" topic="'.addslashes($row->get('title')).'"
            //           invites="[{ id : \''.$value->email.'\', invite_type : \'EMAIL\' }]">
            //           </g:hangout>';
            //New version is using CloudInterpreter
            $return .= '<a target="_blank" href="http://dev.cloudinterpreter.com:8901/'.md5($row->get('id')).'"><button class="btn btn-success">Начать консультацию</button></a>';
          }
          $return .= '</td>';
          $return .='</tr>';
        }
        $return .= '</table>';
      }
		}
    echo $return;
	}
示例#16
0
 /**
  * Th like Translate HTML from english to target language
  * (can add translation markers in HTML for better display in language debug mode)
  *
  * @see \CBLib\Language\CBTxt::T() for pluralizations
  *
  * @param  string  $languageKeys   Key(s) separated by space. Or if second argument is empty, English string
  *                                 (e.g. 'KEY1-DETAILED KEY2-GENERAL')
  * @param  string  $englishString  The English string to use if no translations found
  * @param  array   $args           A strtr-formatted array of string substitutions
  * @return string                  Translated string
  *
  * @throws \InvalidArgumentException
  */
 public static function Th($languageKeys, $englishString = null, array $args = array())
 {
     if ($languageKeys == '') {
         return $languageKeys;
     }
     $translated = static::$self->translateToCurrentLanguage($languageKeys, $englishString, $args);
     if (static::$self->mode == 0) {
         return $translated;
     }
     return self::$self->htmlHighlighter($languageKeys, $englishString, $args, $translated);
 }
示例#17
0
	/**
	 * @param cbautoactionsActionTable $trigger
	 * @param UserTable $user
	 */
	public function execute( $trigger, $user )
	{
		if ( ! $this->installed() ) {
			if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
				var_dump( CBTxt::T( 'AUTO_ACTION_BLOGS_NOT_INSTALLED', ':: Action [action] :: CB Blogs is not installed', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
			}

			return;
		}

		foreach ( $trigger->getParams()->subTree( 'blog' ) as $row ) {
			/** @var ParamsInterface $row */
			$blog			=	new cbblogsBlogTable();

			$owner			=	$row->get( 'owner', null, GetterInterface::STRING );

			if ( ! $owner ) {
				$owner		=	(int) $user->get( 'id' );
			} else {
				$owner		=	(int) $trigger->getSubstituteString( $owner );
			}

			if ( ! $owner ) {
				if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
					var_dump( CBTxt::T( 'AUTO_ACTION_BLOGS_NO_OWNER', ':: Action [action] :: CB Blogs skipped due to missing owner', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
				}

				continue;
			}

			$blogData		=	array(	'user' => $owner,
										'title' => $trigger->getSubstituteString( $row->get( 'title', null, GetterInterface::STRING ) ),
										'blog_intro' => $trigger->getSubstituteString( $row->get( 'intro', null, GetterInterface::RAW ), false ),
										'blog_full' => $trigger->getSubstituteString( $row->get( 'full', null, GetterInterface::RAW ), false ),
										'category' => $row->get( 'category', null, GetterInterface::STRING ),
										'published' => (int) $row->get( 'published', 1, GetterInterface::INT ),
										'access' => (int) $row->get( 'access', 1, GetterInterface::INT )
									);

			if ( ! $blog->bind( $blogData ) ) {
				if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
					var_dump( CBTxt::T( 'AUTO_ACTION_BLOGS_BIND_FAILED', ':: Action [action] :: CB Blogs failed to bind. Error: [error]', array( '[action]' => (int) $trigger->get( 'id' ), '[error]' => $blog->getError() ) ) );
				}

				continue;
			}

			if ( ! $blog->store() ) {
				if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
					var_dump( CBTxt::T( 'AUTO_ACTION_BLOGS_FAILED', ':: Action [action] :: CB Blogs failed to save. Error: [error]', array( '[action]' => (int) $trigger->get( 'id' ), '[error]' => $blog->getError() ) ) );
				}
			}
		}
	}
 /**
  * Edit user
  */
 static function _EDIT()
 {
     global $_CB_framework;
     CBtoolmenuBar::startTable();
     CBtoolmenuBar::apply('apply', CBTxt::T('TOOLBAR_SAVE_EDIT TOOLBAR_SAVE', 'Save'));
     CBtoolmenuBar::save('save', CBTxt::T('TOOLBAR_SAVE_CLOSE_EDIT TOOLBAR_SAVE_CLOSE', 'Save & Close'));
     CBtoolmenuBar::linkAction('cancel', $_CB_framework->backendUrl('index.php?option=com_comprofiler&view=showusers'), 'Cancel');
     CBtoolmenuBar::spacer();
     CBtoolmenuBar::help('http://www.joomlapolis.com/documentation/community-builder/help/user-management-edit?pk_campaign=in-cb&amp;pk_kwd=help');
     CBtoolmenuBar::endTable();
 }
示例#19
0
	/**
	 * render frontend group edit photo params
	 *
	 * @param GroupTable      $row
	 * @param array           $input
	 * @param CategoryTable   $category
	 * @param UserTable       $user
	 * @param cbgjPhotoPlugin $plugin
	 * @return string
	 */
	static function showPhotoParams( $row, $input, $category, $user, $plugin )
	{
		$return		=	'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
					.		'<label for="params__photo" class="col-sm-3 control-label">' . CBTxt::T( 'Photos' ) . '</label>'
					.		'<div class="cb_field col-sm-9">'
					.			$input['photo']
					.			getFieldIcons( null, 0, null, CBTxt::T( 'Optionally enable or disable usage of photos. Group owner and group administrators are exempt from this configuration and can always upload photos. Note existing photos will still be accessible.' ) )
					.		'</div>'
					.	'</div>';

		return $return;
	}
示例#20
0
	/**
	 * render frontend group edit forums params
	 *
	 * @param GroupTable       $row
	 * @param array            $input
	 * @param CategoryTable    $category
	 * @param UserTable        $user
	 * @param cbgjForumsPlugin $plugin
	 * @return string
	 */
	static function showForumsParams( $row, $input, $category, $user, $plugin )
	{
		$return		=	'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
					.		'<label for="params__forums" class="col-sm-3 control-label">' . CBTxt::T( 'Forums' ) . '</label>'
					.		'<div class="cb_field col-sm-9">'
					.			$input['forums']
					.			getFieldIcons( null, 0, null, CBTxt::T( 'Optionally enable or disable usage of forums.' ) )
					.		'</div>'
					.	'</div>';

		return $return;
	}
示例#21
0
	/**
	 * 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;
	}
示例#22
0
	/**
	 * Gets the model description for CB articles
	 *
	 * @param  int|null  $cms
	 * @param  boolean   $include
	 * @return stdClass
	 */
	static public function getModel( $cms = null, $include = true )
	{
		global $_CB_framework;

		static $cache				=	array();

		if ( $cms ) {
			$cms					=	(int) $cms;
		}

		if ( ! isset( $cache[$cms] ) ) {
			$plugin					=	cbpreparatyClass::getPlugin();

			if ( ! $cms ) {
				$cms				=	$plugin->params->get( 'article_model', 1 );
			}

			$model					=	new stdClass();

			if ( in_array( $cms, array( 1, 4, 6 ) ) && checkJversion() >= 2 ) {
				$cms				=	( checkJversion( '3.0+' ) ? 6 : 4 );

				$model->file		=	$plugin->absPath . '/models/joomla25.php';
				$model->detected	=	( $cms == 6 ? CBTxt::T( 'Joomla 3.x' ) : CBTxt::T( 'Joomla 2.x' ) );
				$model->type		=	$cms;
			} elseif ( in_array( $cms, array( 1, 5 ) ) && is_dir( $_CB_framework->getCfg( 'absolute_path' ) . '/administrator/components/com_k2' ) && class_exists( 'K2Model' ) ) {
				$model->file		=	$plugin->absPath . '/models/k2.php';
				$model->detected	=	CBTxt::T( 'K2' );
				$model->type		=	5;
			} else {
				if ( checkJversion( '3.0+' ) ) {
					$cms			=	6;
				} else {
					$cms			=	4;
				}

				$model				=	cbpreparatyClass::getModel( $cms, false );
			}

			if ( $include ) {
				/** @noinspection PhpIncludeInspection */
				require_once( $model->file );

				$model->class		=	new cbpreparatyModel();
			}

			$cache[$cms]			=	$model;
		}

		return $cache[$cms];
	}
示例#23
0
	/**
	 * @param cbantispamWhitelistTable $row
	 * @param array                    $input
	 * @param string                   $type
	 * @param int|string               $tab
	 * @param UserTable                $user
	 * @param cbPluginHandler          $plugin
	 */
	static public function showWhitelist( $row, $input, $type, $tab, $user, $plugin )
	{
		global $_CB_framework;

		cbValidator::loadValidation();

		$name			=	CBuser::getInstance( (int) $user->get( 'id' ), false )->getField( 'formatname', null, 'html', 'none', 'profile', 0, true );
		$pageTitle		=	CBTxt::T( 'WHITELIST_NAME', 'Whitelist [name]', array( '[name]' => $name ) );

		$_CB_framework->setPageTitle( $pageTitle );
		$_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( 'Whitelists' ) ), $_CB_framework->userProfileUrl( (int) $user->get( 'id' ), true, $tab ) );
		$_CB_framework->appendPathWay( htmlspecialchars( $pageTitle ), $_CB_framework->pluginClassUrl( $plugin->element, true, ( $row->get( 'id' ) ? array( 'action' => 'whitelist', 'func' => ( $type ? $type : 'edit' ), 'id' => (int) $row->get( 'id' ), 'usr' => (int) $user->get( 'id' ) ) : array( 'action' => 'whitelist', 'func' => ( $type ? $type : 'new' ), 'usr' => (int) $user->get( 'id' ) ) ) ) );

		$return			=	'<div class="whitelistEdit">'
						.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'whitelist', 'func' => 'save', 'id' => (int) $row->get( 'id' ), 'usr' => (int) $user->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="whitelistForm" id="whitelistForm" class="cb_form whitelistForm form-auto cbValidation">'
						.			( $pageTitle ? '<div class="whitelistTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null )
						.			'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
						.				'<label for="type" class="col-sm-3 control-label">' . CBTxt::T( 'Type' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['type']
						.					getFieldIcons( 1, 1, null, CBTxt::T( 'Select the whitelist type. Type determines what value should be supplied.' ) )
						.				'</div>'
						.			'</div>'
						.			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
						.				'<label for="value" class="col-sm-3 control-label">' . CBTxt::T( 'Value' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['value']
						.					getFieldIcons( 1, 1, null, CBTxt::T( 'Input whitelist value in relation to the type. User type use the users user_id (e.g. 42). IP Address type use a full valid IP Address (e.g. 192.168.0.1). Email type use a fill valid email address (e.g. invalid@cb.invalid). Email Domain type use a full email address domain after @ (e.g. example.com).' ) )
						.				'</div>'
						.			'</div>'
						.			'<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
						.				'<label for="reason" class="col-sm-3 control-label">' . CBTxt::T( 'Reason' ) . '</label>'
						.				'<div class="cb_field col-sm-9">'
						.					$input['reason']
						.					getFieldIcons( 1, 0, null, CBTxt::T( 'Optionally input whitelist reason. Note this is for administrative purposes only.' ) )
						.				'</div>'
						.			'</div>'
						.			'<div class="form-group cb_form_line clearfix">'
						.				'<div class="col-sm-offset-3 col-sm-9">'
						.					'<input type="submit" value="' . htmlspecialchars( ( $row->get( 'id' ) ? CBTxt::T( 'Update Whitelist' ) : CBTxt::T( 'Create Whitelist' ) ) ) . '" class="whitelistButton whitelistButtonSubmit btn btn-primary"' . cbValidator::getSubmitBtnHtmlAttributes() . ' />&nbsp;'
						.					' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="whitelistButton whitelistButtonCancel btn btn-default" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->userProfileUrl( (int) $user->get( 'id' ), false, $tab ) . '\'; }" />'
						.				'</div>'
						.			'</div>'
						.			cbGetSpoofInputTag( 'plugin' )
						.		'</form>'
						.	'</div>';

		echo $return;
	}
示例#24
0
	/**
	 * @param cbautoactionsActionTable $trigger
	 * @param UserTable $user
	 */
	public function execute( $trigger, $user )
	{
		global $_CB_PMS;

		foreach ( $trigger->getParams()->subTree( 'pms' ) as $row ) {
			/** @var ParamsInterface $row */
			$pmFrom			=	$row->get( 'form', null, GetterInterface::STRING );

			if ( ! $pmFrom ) {
				$pmFrom		=	(int) $user->get( 'id' );
			} else {
				$pmFrom		=	(int) $trigger->getSubstituteString( $pmFrom );
			}

			if ( ! $pmFrom ) {
				if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
					var_dump( CBTxt::T( 'AUTO_ACTION_PMS_NO_FROM', ':: Action [action] :: Private Message skipped due to missing from', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
				}

				continue;
			}

			$pmTo			=	$trigger->getSubstituteString( $row->get( 'to', null, GetterInterface::STRING ) );

			if ( ! $pmTo ) {
				if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
					var_dump( CBTxt::T( 'AUTO_ACTION_PMS_NO_TO', ':: Action [action] :: Private Message skipped due to missing to', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
				}

				continue;
			}

			$pmMessage		=	$trigger->getSubstituteString( $row->get( 'message', null, GetterInterface::RAW ), false );

			if ( ! $pmMessage ) {
				if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
					var_dump( CBTxt::T( 'AUTO_ACTION_PMS_NO_MSG', ':: Action [action] :: Private Message skipped due to missing message', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
				}

				continue;
			}

			$pmSubject		=	$trigger->getSubstituteString( $row->get( 'subject', null, GetterInterface::STRING ) );

			$_CB_PMS->sendPMSMSG( $pmTo, $pmFrom, $pmSubject, $pmMessage, true );
		}
	}
示例#25
0
	/**
	 * @return bool
	 */
	public function check()
	{
		if ( $this->get( 'user_id' ) == '' ) {
			$this->setError( CBTxt::T( 'Owner not specified!' ) );

			return false;
		} elseif ( trim( $this->get( 'message' ) ) == '' ) {
			$this->setError( CBTxt::T( 'Message not specified!' ) );

			return false;
		} elseif ( preg_replace( '/[^-a-zA-Z0-9_.]/', '', $this->get( 'type' ) ) == '' ) {
			$this->setError( CBTxt::T( 'Type not specified!' ) );

			return false;
		}

		return true;
	}
示例#26
0
	/**
	 * @return bool
	 */
	public function check()
	{
		if ( $this->get( 'user_id' ) == '' ) {
			$this->setError( CBTxt::T( 'Owner not specified!' ) );

			return false;
		} elseif ( $this->get( 'event' ) == '' ) {
			$this->setError( CBTxt::T( 'Event not specified!' ) );

			return false;
		} elseif ( ! $this->event()->get( 'id' ) ) {
			$this->setError( CBTxt::T( 'Event does not exist!' ) );

			return false;
		}

		return true;
	}
示例#27
0
	/**
	 * Shows Forum Tab
	 *
	 * @param  UserTable    $viewer     Viewing User
	 * @param  UserTable    $user       Viewed at User
	 * @param  TabTable     $tab        Current Tab
	 * @param  PluginTable  $plugin     Current Plugin
	 * @return string
	 */
	static public function showTab( $viewer, $user, $tab, $plugin )
	{
		global $_CB_framework;

		$tabs					=	new cbTabs( 1, 1 );

		$favorites				=	$tab->params->get( 'tab_favs_display', 1 );
		$subscriptions			=	$tab->params->get( 'tab_subs_display', 1 );
		$tabbed					=	( ( $user->id == $_CB_framework->myId() ) && ( $favorites || $subscriptions ) ? true : false );

		$return					=	null;

		if ( $tabbed ) {
			$return				.=			$tabs->startPane( 'cbForumsTabs' )
								.				$tabs->startTab( null, htmlspecialchars( CBTxt::T( 'Posts' ) ), 'cbForumsTabsPosts' );
		}

		$return					.=					cbforumsModel::getPosts( $viewer, $user, $tab, $plugin );

		if ( $tabbed ) {
			$return				.=				$tabs->endTab();

			if ( $favorites ) {
				$return			.=				$tabs->startTab( null, htmlspecialchars( CBTxt::T( 'Favorites' ) ), 'cbForumsTabsFavorites' )
								.					cbforumsModel::getFavorites( $viewer, $user, $tab, $plugin )
								.				$tabs->endTab();
			}

			if ( $subscriptions ) {
				$return			.=				$tabs->startTab( null, htmlspecialchars( CBTxt::T( 'Subscriptions' ) ), 'cbForumsTabsSubscriptions' )
								.					'<div class="tab-content">'
								.						cbforumsModel::getCategorySubscriptions( $viewer, $user, $tab, $plugin )
								.						cbforumsModel::getSubscriptions( $viewer, $user, $tab, $plugin )
								.					'</div>'
								.				$tabs->endTab();
			}

			$return				.=			$tabs->endPane();
		}

		return $return;
	}
示例#28
0
 /**
  * @param  OrderedTable  $row
  * @param  string[]      $input
  * @param  UserTable     $user
  * @param  stdClass      $model
  * @param  PluginTable   $plugin
  */
 static function showBlogEdit($row, $input, $user, $model, $plugin)
 {
     global $_CB_framework, $_PLUGINS;
     cbValidator::loadValidation();
     $blogMode = $plugin->params->get('blog_mode', 1);
     $pageTitle = $row->get('id') ? CBTxt::T('Edit Blog') : CBTxt::T('Create Blog');
     $cbModerator = Application::User((int) $user->get('id'))->isGlobalModerator();
     $_CB_framework->setPageTitle($pageTitle);
     $_CB_framework->appendPathWay(htmlspecialchars(CBTxt::T('Blogs')), $_CB_framework->userProfileUrl($row->get('user', $user->get('id')), true, 'cbblogsTab'));
     $_CB_framework->appendPathWay(htmlspecialchars($pageTitle), $_CB_framework->pluginClassUrl($plugin->element, true, $row->get('id') ? array('action' => 'blogs', 'func' => 'edit', 'id' => (int) $row->get('id')) : array('action' => 'blogs', 'func' => 'new')));
     initToolTip();
     $return = '<div class="blogEdit">' . '<form action="' . $_CB_framework->pluginClassUrl($plugin->element, true, array('action' => 'blogs', 'func' => 'save', 'id' => (int) $row->get('id'))) . '" method="post" enctype="multipart/form-data" name="blogForm" id="blogForm" class="cb_form blogForm form-auto cbValidation">' . ($pageTitle ? '<div class="blogsTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null);
     if ($cbModerator || !$plugin->params->get('blog_approval', 0)) {
         $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="published" class="col-sm-3 control-label">' . CBTxt::Th('Published') . '</label>' . '<div class="cb_field col-sm-9">' . $input['published'] . getFieldIcons(1, 0, null, CBTxt::T('Select publish status of the blog. Unpublished blogs will not be visible to the public.')) . '</div>' . '</div>';
     }
     if ($plugin->params->get('blog_category_config', 1) || $cbModerator) {
         $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="category" class="col-sm-3 control-label">' . CBTxt::Th('Category') . '</label>' . '<div class="cb_field col-sm-9">' . $input['category'] . getFieldIcons(1, 0, null, CBTxt::T('Select blog category. Select the category that best describes your blog.')) . '</div>' . '</div>';
     }
     if ($plugin->params->get('blog_access_config', 1) || $cbModerator) {
         $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="access" class="col-sm-3 control-label">' . CBTxt::Th('Access') . '</label>' . '<div class="cb_field col-sm-9">' . $input['access'] . getFieldIcons(1, 0, null, CBTxt::T('Select access to blog; all groups above that level will also have access to the blog.')) . '</div>' . '</div>';
     }
     $return .= '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">' . '<label for="title" class="col-sm-3 control-label">' . CBTxt::Th('Title') . '</label>' . '<div class="cb_field col-sm-9">' . $input['title'] . getFieldIcons(1, 1, null, CBTxt::T('Input blog title. This is the title that will distinguish this blog from others. Suggested to input something unique and intuitive.')) . '</div>' . '</div>';
     if (in_array($blogMode, array(1, 2))) {
         $return .= '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">' . '<label for="blog_intro" class="col-sm-3 control-label">' . ($blogMode == 1 ? CBTxt::T('Blog Intro') : CBTxt::T('Blog')) . '</label>' . '<div class="cb_field col-sm-9">' . $input['blog_intro'] . getFieldIcons(1, 0, null, CBTxt::T('Input HTML supported blog intro contents. Suggested to use minimal but well formatting for easy readability.')) . '</div>' . '</div>';
     }
     if (in_array($blogMode, array(1, 3))) {
         $return .= '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">' . '<label for="blog_full" class="col-sm-3 control-label">' . ($blogMode == 1 ? CBTxt::T('Blog Full') : CBTxt::T('Blog')) . '</label>' . '<div class="cb_field col-sm-9">' . $input['blog_full'] . getFieldIcons(1, 0, null, CBTxt::T('Input HTML supported blog contents. Suggested to use minimal but well formatting for easy readability.')) . '</div>' . '</div>';
     }
     if ($cbModerator) {
         $return .= '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">' . '<label for="user" class="col-sm-3 control-label">' . CBTxt::T('Owner') . '</label>' . '<div class="cb_field col-sm-9">' . $input['user'] . getFieldIcons(1, 1, null, CBTxt::T('Input owner of blog as single integer user_id.')) . '</div>' . '</div>';
     }
     if ($plugin->params->get('blog_captcha', 0) && !$cbModerator) {
         $_PLUGINS->loadPluginGroup('user');
         $captcha = $_PLUGINS->trigger('onGetCaptchaHtmlElements', array(false));
         if (!empty($captcha)) {
             $captcha = $captcha[0];
             $return .= '<div class="form-group cb_form_line clearfix">' . '<label class="col-sm-3 control-label">' . CBTxt::Th('Captcha') . '</label>' . '<div class="cb_field col-sm-9">' . (isset($captcha[0]) ? $captcha[0] : null) . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<div class="cb_field col-sm-offset-3 col-sm-9">' . str_replace('inputbox', 'form-control', isset($captcha[1]) ? $captcha[1] : null) . getFieldIcons(1, 1, null) . '</div>' . '</div>';
         }
     }
     $return .= '<div class="form-group cb_form_line clearfix">' . '<div class="col-sm-offset-3 col-sm-9">' . '<input type="submit" value="' . htmlspecialchars($row->get('id') ? CBTxt::T('Update Blog') : CBTxt::T('Create Blog')) . '" class="blogsButton blogsButtonSubmit btn btn-primary"' . cbValidator::getSubmitBtnHtmlAttributes() . ' />&nbsp;' . ' <input type="button" value="' . htmlspecialchars(CBTxt::T('Cancel')) . '" class="blogsButton blogsButtonCancel btn btn-default" onclick="if ( confirm( \'' . addslashes(CBTxt::T('Are you sure you want to cancel? All unsaved data will be lost!')) . '\' ) ) { location.href = \'' . $_CB_framework->userProfileUrl($row->get('user', $user->get('id')), false, 'cbblogsTab') . '\'; }" />' . '</div>' . '</div>' . cbGetSpoofInputTag('plugin') . '</form>' . '</div>';
     echo $return;
 }
示例#29
0
	/**
	 * render frontend group file notify params
	 *
	 * @param NotificationTable $row
	 * @param array             $input
	 * @param GroupTable        $group
	 * @param UserTable         $user
	 * @param cbgjFilePlugin    $plugin
	 * @return string
	 */
	static function showFileNotifications( $row, $input, $group, $user, $plugin )
	{
		$return			=	'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
						.		'<label for="params__file_new" class="col-sm-9 control-label">' . CBTxt::T( 'Upload of new file' ) . '</label>'
						.		'<div class="cb_field col-sm-3 text-right">'
						.			$input['file_new']
						.		'</div>'
						.	'</div>';

		if ( $row->group()->params()->get( 'file', 1 ) == 2 ) {
			$return		.=	'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
						.		'<label for="params__file_approve" class="col-sm-9 control-label">' . CBTxt::T( 'New file requires approval' ) . '</label>'
						.		'<div class="cb_field col-sm-3 text-right">'
						.			$input['file_approve']
						.		'</div>'
						.	'</div>';
		}

		return $return;
	}
示例#30
0
	/**
	 * @return bool
	 */
	public function check()
	{
		if ( $this->get( 'value' ) == '' ) {
			$this->setError( CBTxt::T( 'Action not specified!' ) );

			return false;
		} else {
			$row	=	new ActionTable();

			$row->load( array( 'value' => $this->get( 'value' ) ) );

			if ( $row->get( 'id' ) && ( $this->get( 'id' ) != $row->get( 'id' ) ) ) {
				$this->setError( CBTxt::T( 'Action already exists!' ) );

				return false;
			}
		}

		return true;
	}