Ejemplo n.º 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();
			}
		}
	}
Ejemplo n.º 2
0
	/**
	 * @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;
	}