Пример #1
0
	/**
	 * @param  UserTable  $user
	 * @param  int        $status
	 */
	public function deleteHangout( $user, /** @noinspection PhpUnusedParameterInspection */ $status )
	{
		$plugin			=	cbhangoutClass::getPlugin();

		if ( $plugin->params->get( 'hangout_delete', 1 ) ) {
			cbhangoutClass::getModel();

			$hangout		=	cbhangoutModel::getHangout( null, null, $user, $user, $plugin );

			if ( $hangout ) foreach ( $hangout as $hng ) {
				$hng->delete();
			}
		}
	}
Пример #2
0
	/**
	 * @param  boolean  $raw
	 * @return array
	 */
	static public function getCategoriesList( $raw = false )
	{
		static $cache				=	null;

		if ( ! isset( $cache ) ) {
			$plugin					=	cbhangoutClass::getPlugin();
			$categories				=	explode( ',', $plugin->params->get( 'hangout_categories', 'General,Movies,Music,Games,Sports' ) );
			$cache					=	array();

			if ( $categories ) foreach ( $categories as $category ) {
				$cache[]			=	moscomprofilerHTML::makeOption( $category, CBTxt::T( $category ) );
			}
		}

		$rows						=	$cache;

		if ( $rows ) {
			if ( $raw === true ) {
				$categories			=	array();

				foreach ( $rows as $row ) {
					$categories[]	=	$row->value;
				}

				$rows				=	$categories;
			}
		} else {
			$rows					=	array();
		}

		return $rows;
	}
Пример #3
0
	/**
	 * @param  boolean  $raw
	 * @return array
	 */
	static public function getCategoriesList( $raw = false )
	{
		global $_CB_database;

		static $cache				=	null;

		if ( ! isset( $cache ) ) {
			$plugin					=	cbhangoutClass::getPlugin();
			$section				=	$plugin->params->get( 'hangout_j_section', null );

			if ( $section ) {
				$query				=	'SELECT cat.' . $_CB_database->NameQuote( 'id' ) . ' AS value'
									.	", IF( cat." . $_CB_database->NameQuote( 'level' ) . " = ( sec." . $_CB_database->NameQuote( 'level' ) . " + 1 ), cat." . $_CB_database->NameQuote( 'title' ) . ", CONCAT( REPEAT( '- ', cat." . $_CB_database->NameQuote( 'level' ) . " - ( sec." . $_CB_database->NameQuote( 'level' ) . " + 1 ) ), cat." . $_CB_database->NameQuote( 'title' ) . " ) ) AS text"
									.	"\n FROM " . $_CB_database->NameQuote( '#__categories' ) . " AS cat"
									.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__categories' ) . " AS sec"
									.	' ON sec.' . $_CB_database->NameQuote( 'id' ) . ' = ' . (int) $section
									.	"\n WHERE cat." . $_CB_database->NameQuote( 'lft' ) . " BETWEEN ( sec." . $_CB_database->NameQuote( 'lft' ) . " + 1 ) AND ( sec." . $_CB_database->NameQuote( 'rgt' ) . " - 1 )"
									.	"\n AND sec." . $_CB_database->NameQuote( 'access' ) . " IN " . $_CB_database->safeArrayOfIntegers( Application::MyUser()->getAuthorisedViewLevels() )
									.	"\n AND sec." . $_CB_database->NameQuote( 'extension' ) . " = " . $_CB_database->Quote( 'com_content' )
									.	"\n AND cat." . $_CB_database->NameQuote( 'published' ) . " = 1"
									.	"\n AND cat." . $_CB_database->NameQuote( 'access' ) . " IN " . $_CB_database->safeArrayOfIntegers( Application::MyUser()->getAuthorisedViewLevels() )
									.	"\n AND cat." . $_CB_database->NameQuote( 'extension' ) . " = " . $_CB_database->Quote( 'com_content' );
			} else {
				$query				=	'SELECT ' . $_CB_database->NameQuote( 'id' ) . ' AS value'
									.	", CONCAT( REPEAT( '- ', " . $_CB_database->NameQuote( 'level' ) . " ), " . $_CB_database->NameQuote( 'title' ) . " ) AS text"
									.	"\n FROM " . $_CB_database->NameQuote( '#__categories' )
									.	"\n WHERE " . $_CB_database->NameQuote( 'published' ) . " = 1"
									.	"\n AND " . $_CB_database->NameQuote( 'access' ) . " IN " . $_CB_database->safeArrayOfIntegers( Application::MyUser()->getAuthorisedViewLevels() )
									.	"\n AND " . $_CB_database->NameQuote( 'extension' ) . " = " . $_CB_database->Quote( 'com_content' );
			}

			$_CB_database->setQuery( $query );

			$cache					=	$_CB_database->loadObjectList();
		}

		$rows						=	$cache;

		if ( $rows ) {
			if ( $raw === true ) {
				$categories			=	array();

				foreach ( $rows as $row ) {
					$categories[]	=	(int) $row->value;
				}

				$rows				=	$categories;
			}
		} else {
			$rows					=	array();
		}

		return $rows;
	}
Пример #4
0
	/**
	 * @param  int|TableInterface  $row
	 * @param  bool                $htmlspecialchars
	 * @param  string              $type
	 * @return string
	 */
	static public function getUrl( $row, $htmlspecialchars = true, $type = 'article' )
	{
		global $_CB_framework;

		$plugin				=	cbhangoutClass::getPlugin();

		if ( is_integer( $row ) ) {
			$row			=	new cbhangoutBlogTable();

			$row->load( (int) $row );
		}

		$category			=	$row->getCategory();

		/** @noinspection PhpIncludeInspection */
		require_once ( $_CB_framework->getCfg( 'absolute_path' ) . '/components/com_k2/helpers/route.php' );

		$categorySlug		=	$row->get( 'catid' ) . ( $category->get( 'alias' ) ? ':' . $category->get( 'alias' ) : null );
		$articleSlug		=	$row->get( 'id' ) . ( $row->get( 'alias' ) ? ':' . $row->get( 'alias' ) : null );

		switch ( $type ) {
			case 'section':
				/** @noinspection PhpUndefinedClassInspection */
				$url		=	K2HelperRoute::getCategoryRoute( $plugin->params->get( 'hangout_section', null ) );
				break;
			case 'category':
				/** @noinspection PhpUndefinedClassInspection */
				$url		=	K2HelperRoute::getCategoryRoute( $categorySlug );
				break;
			case 'article':
			default:
			/** @noinspection PhpUndefinedClassInspection */
				$url		=	K2HelperRoute::getItemRoute( $articleSlug, $categorySlug );
				break;
		}

		if ( ! stristr( $url, 'Itemid' ) ) {
			$url			=	$_CB_framework->getCfg( 'live_site' ) . '/' . $url;
		} else {
			$url			=	JRoute::_( $url, false );
		}

		if ( $url ) {
			if ( $htmlspecialchars ) {
				$url		=	htmlspecialchars( $url );
			}
		}

		return $url;
	}
	/**
	 * @param  TabTable   $tab       Current tab
	 * @param  UserTable  $user      Current user
	 * @param  int        $ui        1 front, 2 admin UI
	 * @param  array      $postdata  Raw unfiltred POST data
	 * @return string                HTML
	 */
	public function getCBpluginComponent( /** @noinspection PhpUnusedParameterInspection */ $tab, $user, $ui, $postdata )
	{
		global $_CB_framework, $_LANG;

		outputCbJs( 1 );
		outputCbTemplate( 1 );

		$plugin					=	cbhangoutClass::getPlugin();
		$model					=	cbhangoutClass::getModel();
		$action					=	$this->input( 'action', null, GetterInterface::STRING );
		$function				=	$this->input( 'func', null, GetterInterface::STRING );
		$id						=	$this->input( 'id', null, GetterInterface::INT );
		$user					=	CBuser::getUserDataInstance( $_CB_framework->myId() );

		$tab					=	new TabTable();

		$tab->load( array( 'pluginid' => (int) $plugin->id ) );

		$profileUrl				=	$_CB_framework->userProfileUrl( $user->get( 'id' ), false, 'cbhangoutTab' );

		if ( ! ( $tab->enabled && Application::MyUser()->canViewAccessLevel( $tab->viewaccesslevel ) ) ) {
			cbRedirect( $profileUrl, CBTxt::T( 'Not authorized.' ), 'error' );
		}

		ob_start();
		switch ( $action ) {
			case 'hangout':
				switch ( $function ) {
					case 'new':
						$this->showBlogEdit( null, $user, $model, $plugin );
						break;
					case 'edit':
						$this->showBlogEdit( $id, $user, $model, $plugin );
						break;
					case 'save':
						cbSpoofCheck( 'plugin' );
						$this->saveBlogEdit( $id, $user, $model, $plugin );
						break;
					case 'publish':
						$this->stateBlog( 1, $id, $user, $model, $plugin );
						break;
					case 'unpublish':
						$this->stateBlog( 0, $id, $user, $model, $plugin );
						break;
					case 'delete':
						$this->deleteBlog( $id, $user, $model, $plugin );
						break;
                                        //marych 
                                        case 'joinconf':
						$this->joinConf( $id, $user, $model, $plugin );
						break;    
                                            
					case 'show':
					default:
						if ( $model->type != 2 ) {
							cbRedirect( cbhangoutModel::getUrl( (int) $id, false ) );
						} else {
							$this->showBlog( $id, $user, $model, $plugin );
						}
						break;
				}
				break;
			default:
				cbRedirect( $profileUrl, CBTxt::T( 'Not authorized.' ), 'error' );
				break;
		}
		$html		=	ob_get_contents();
		ob_end_clean();

		$class		=	$plugin->params->get( 'general_class', null );

		$return		=	'<div id="cbBlogs" class="cbBlogs' . ( $class ? ' ' . htmlspecialchars( $class ) : null ) . '">'
					.		'<div id="cbBlogsInner" class="cbBlogsInner">'
					.			$html
					.		'</div>'
					.	'</div>';

		echo $return;
	}