Пример #1
0
 public function getAvatar($profile)
 {
     if (!$this->exists()) {
         return false;
     }
     $user = CBuser::getInstance($profile->id);
     // @task: Apply guest avatars when necessary.
     if (!$profile->id) {
         $avatar = selectTemplate() . 'images/avatar/tnnophoto_n.png';
         return $avatar;
     }
     if (!$user) {
         $user = CBuser::getInstance(null);
     }
     // Prevent CB from adding anything to the page.
     ob_start();
     $source = $user->getField('avatar', null, 'php');
     $reset = ob_get_contents();
     ob_end_clean();
     unset($reset);
     $source = $source['avatar'];
     //incase we view from backend. we need to remove the /administrator/ from the path.
     $avatar = str_replace('/administrator/', '/', $source);
     return $avatar;
 }
Пример #2
0
 protected function _getURL($user, $sizex, $sizey)
 {
     global $_CB_framework;
     $app = JFactory::getApplication();
     $user = KunenaFactory::getUser($user);
     if ($app->getClientId() == 0) {
         $cbclient_id = 1;
     }
     if ($app->getClientId() == 1) {
         $cbclient_id = 2;
     }
     $_CB_framework->cbset('_ui', $cbclient_id);
     // Get CUser object
     $cbUser = null;
     if ($user->userid) {
         $cbUser = CBuser::getInstance($user->userid);
     }
     if ($cbUser === null) {
         if ($sizex <= 90) {
             return selectTemplate() . 'images/avatar/tnnophoto_n.png';
         }
         return selectTemplate() . 'images/avatar/nophoto_n.png';
     }
     if ($sizex <= 90) {
         return $cbUser->getField('avatar', null, 'csv');
     }
     return $cbUser->getField('avatar', null, 'csv', 'none', 'list');
 }
Пример #3
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;
	}
Пример #4
0
	/**
	 * Outputs the provider buttons to the login/logout form
	 *
	 * @param int       $nameLenght
	 * @param int       $passLenght
	 * @param int       $horizontal
	 * @param string    $classSfx
	 * @param JRegistry $params
	 * @return array|null|string
	 */
	public function getButtons( /** @noinspection PhpUnusedParameterInspection */ $nameLenght, /** @noinspection PhpUnusedParameterInspection */ $passLenght, $horizontal, /** @noinspection PhpUnusedParameterInspection */ $classSfx, /** @noinspection PhpUnusedParameterInspection */ $params )
	{
		global $_CB_framework;

		static $CSS		=	0;

		if ( ! $CSS++ ) {
			$_CB_framework->document->addHeadStyleSheet( $_CB_framework->getCfg( 'live_site' ) . '/components/com_comprofiler/plugin/user/plug_cbconnect/cbconnect.css' );
		}

		$hybrid			=	new cbconnectHybrid();
		$return			=	null;

		foreach ( array_keys( $hybrid->getProviders() ) as $provider ) {
			$return		.=	$hybrid->getButton( $provider, $horizontal );
		}

		if ( $return ) {
			$return		=	'<div class="cbConnectButtons cb_template cb_template_' . selectTemplate( 'dir' ) . '">'
						.		$return
						.	'</div>';

			return array( 'afterButton' => $return );
		}

		return null;
	}
Пример #5
0
function banUser($option, $uid, $form = 1, $act = 1)
{
    global $_CB_framework, $ueConfig, $_PLUGINS, $_POST;
    $isModerator = Application::MyUser()->isModeratorFor(Application::User((int) $uid));
    if ($_CB_framework->myId() < 1 || $uid < 1) {
        $msg = CBTxt::Th('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!');
    } elseif ($ueConfig['allowUserBanning'] == 0) {
        $msg = CBTxt::Th('UE_FUNCTIONALITY_DISABLED', 'This functionality is currently disabled.');
    } else {
        $msg = null;
    }
    $_PLUGINS->loadPluginGroup('user');
    $_PLUGINS->trigger('onBeforeBanUserRequest', array($uid, &$msg, $form, $act));
    if ($msg) {
        $_CB_framework->enqueueMessage($msg, 'error');
        return;
    }
    $bannedByUser = CBuser::getUserDataInstance($_CB_framework->myId());
    $bannedUser = CBuser::getUserDataInstance($uid);
    $orgBannedReason = $bannedUser->get('bannedreason');
    if ($form == 1) {
        $results = $_PLUGINS->trigger('onBeforeBanUserForm', array($uid, &$bannedByUser, &$bannedUser));
        if ($_PLUGINS->is_errors()) {
            $_CB_framework->enqueueMessage($_PLUGINS->getErrorMSG('<br />'), 'error');
            return;
        }
        if (implode('', $results) != "") {
            $return = '<div class="cb_template cb_template_' . selectTemplate('dir') . '">' . '<div>' . implode('</div><div>', $results) . '</div>' . '</div>';
            echo $return;
            return;
        }
        HTML_comprofiler::banUserForm($option, $uid, $act, $orgBannedReason, $bannedByUser, $bannedUser);
    } else {
        $dateStr = cbFormatDate('now');
        if ($act == 1) {
            // Ban by moderator:
            if (!$isModerator || $_CB_framework->myId() != cbGetParam($_POST, 'bannedby', 0)) {
                cbNotAuth(true);
                return;
            }
            cbSpoofCheck('banUserForm');
            $bannedReason = '<b>' . '[' . CBTxt::Th('UE_MODERATORBANRESPONSE', 'Moderator Response') . ', ' . htmlspecialchars($dateStr) . ']' . '</b>' . "\n" . htmlspecialchars(stripslashes(cbGetParam($_POST, 'bannedreason'))) . "\n" . $orgBannedReason;
            if (!$bannedUser->banUser(1, $bannedByUser, $bannedReason)) {
                $_CB_framework->enqueueMessage(CBTxt::Th('UE_USERBAN_FAILED', 'User profile ban failed. Error: [error]', array('[error]' => $bannedUser->getError())));
                return;
            }
            $_CB_framework->enqueueMessage(CBTxt::Th('UE_USERBAN_SUCCESSFUL', 'User Profile Ban Successful.'));
        } elseif ($act == 0) {
            // Unban by moderator:
            if (!$isModerator) {
                cbNotAuth(true);
                return;
            }
            $bannedReason = '<b>' . '[' . CBTxt::Th('UE_UNBANUSER', 'User Profile Unbanned') . ', ' . htmlspecialchars($dateStr) . ']' . '</b>' . "\n" . $orgBannedReason;
            if (!$bannedUser->banUser(0, $bannedByUser, $bannedReason)) {
                $_CB_framework->enqueueMessage(CBTxt::Th('UE_USERUNBAN_FAILED', 'Users profile unban failed. Error: [error]', array('[error]' => $bannedUser->getError())));
                return;
            }
            $_CB_framework->enqueueMessage(CBTxt::Th('UE_USERUNBAN_SUCCESSFUL', 'Users profile unbanned successfully.'));
        } elseif ($act == 2) {
            // Unban request from user:
            if ($_CB_framework->myId() != $uid) {
                cbNotAuth(true);
                return;
            }
            $bannedReason = '<b>' . '[' . CBTxt::Th('UE_USERBANRESPONSE', 'User Response') . ', ' . htmlspecialchars($dateStr) . ']' . '</b>' . "\n" . htmlspecialchars(stripslashes(cbGetParam($_POST, 'bannedreason'))) . "\n" . $orgBannedReason;
            if (!$bannedUser->banUser(2, $bannedByUser, $bannedReason)) {
                $_CB_framework->enqueueMessage(CBTxt::Th('UE_USERUNBANREQUEST_FAILED', 'Your unban profile request failed. Error: [error]', array('[error]' => $bannedUser->getError())));
            }
            $_CB_framework->enqueueMessage(CBTxt::Th('UE_USERUNBANREQUEST_SUCCESSFUL', 'Your unban profile request was successfully submitted.'));
        }
    }
}
Пример #6
0
 /**
  * DO NOT USE: This function will disapear in favor of a new one in very next minor release.
  * you should use
  * CBuser->getField( 'avatar' , null, 'csv', 'none', 'list' );
  * instead of this derpreciated call !
  *
  * @deprecated 1.9	CBuser->getField( 'avatar' , null, 'csv', 'none', 'list' );  	//TODO Unused now: Remove in CB 2.0 RC
  *
  * @param  int          $showAvatar  2: Return default avatar if no avatar defined
  * @return string|null
  */
 public function avatarFilePath($showAvatar = 2)
 {
     global $_CB_framework, $_CB_database;
     $liveSite = $_CB_framework->getCfg('live_site');
     $absolutePath = $_CB_framework->getCfg('absolute_path');
     $return = null;
     if ($this->_cbuser && $this->_cbuser->id) {
         $query = 'SELECT *' . "\n FROM " . $_CB_database->NameQuote('#__comprofiler_fields') . "\n WHERE " . $_CB_database->NameQuote('name') . " = " . $_CB_database->Quote('avatar');
         $_CB_database->setQuery($query);
         $field = new \CB\Database\Table\FieldTable();
         $_CB_database->loadObject($field);
         $field->params = new \CBLib\Registry\Registry($field->params);
         $value = $this->_cbuser->avatar;
         $approvedValue = $this->_cbuser->avatarapproved;
         if ($value != '' && ($approvedValue > 0 || $showAvatar == 10)) {
             if (strpos($value, 'gallery/') === false) {
                 $return = '/images/comprofiler/tn' . $value;
             } else {
                 $galleryPath = $field->params->get('image_gallery_path', null);
                 if (!$galleryPath) {
                     $galleryPath = '/images/comprofiler/gallery';
                 }
                 $return = $galleryPath . '/' . preg_replace('!^gallery/(tn)?!', 'tn', $value);
                 if (!is_file($absolutePath . $return)) {
                     $return = $galleryPath . '/' . preg_replace('!^gallery/!', '', $value);
                 }
             }
             if (!is_file($absolutePath . $return)) {
                 $return = null;
             }
         }
         if ($return === null && $showAvatar == 2) {
             $imagesBase = 'avatar';
             if ($field->name == 'canvas') {
                 $imagesBase = 'canvas';
             }
             if ($approvedValue == 0) {
                 $icon = $field->params->get('pendingDefaultAvatar', null);
                 if ($icon == 'none') {
                     return null;
                 } elseif ($icon) {
                     if ($icon != 'pending_n.png' && !is_file(selectTemplate('absolute_path') . '/images/' . $imagesBase . '/tn' . $icon)) {
                         $icon = null;
                     }
                 }
                 if (!$icon) {
                     $icon = 'pending_n.png';
                 }
             } else {
                 $icon = $field->params->get('defaultAvatar', null);
                 if ($icon == 'none') {
                     return null;
                 } elseif ($icon) {
                     if ($icon != 'nophoto_n.png' && !is_file(selectTemplate('absolute_path') . '/images/' . $imagesBase . '/tn' . $icon)) {
                         $icon = null;
                     }
                 }
                 if (!$icon) {
                     $icon = 'nophoto_n.png';
                 }
             }
             return selectTemplate() . 'images/' . $imagesBase . '/tn' . $icon;
         }
     }
     if ($return) {
         $return = $liveSite . $return;
     }
     return $return;
 }
	/**
	 * Registers a new user
	 *
	 * @param UserTable           $user
	 * @param Hybrid_User_Profile $profile
	 * @return bool
	 */
	private function register( $user, $profile )
	{
		global $_CB_framework, $_PLUGINS, $ueConfig;

		if ( ! $profile->identifier ) {
			cbRedirect( $this->_returnUrl, CBTxt::T( 'PROVIDER_PROFILE_MISSING', '[provider] profile could not be found.', array( '[provider]' => $this->_providerName ) ), 'error' );
			return false;
		}

		$mode						=	$this->params->get( $this->_provider . '_mode', 1, GetterInterface::INT );
		$approve					=	$this->params->get( $this->_provider . '_approve', 0, GetterInterface::INT );
		$confirm					=	$this->params->get( $this->_provider . '_confirm', 0, GetterInterface::INT );
		$usergroup					=	$this->params->get( $this->_provider . '_usergroup', null, GetterInterface::STRING );
		$approval					=	( $approve == 2 ? $ueConfig['reg_admin_approval'] : $approve );
		$confirmation				=	( $confirm == 2 ? $ueConfig['reg_confirmation'] : $confirm );
		$usernameFormat				=	$this->params->get( $this->_provider . '_username', null, GetterInterface::STRING );
		$username					=	null;
		$dummyUser					=	new UserTable();

		if ( $usernameFormat ) {
			$extras					=	array( 'provider' => $this->_provider, 'provider_id' => $this->_providerId, 'provider_name' => $this->_providerName );

			foreach ( (array) $profile as $k => $v ) {
				if ( ( ! is_array( $v ) ) && ( ! is_object( $v ) ) ) {
					$k				=	'profile_' . $k;

					$extras[$k]		=	$v;
				}
			}

			$username				=	preg_replace( '/[<>\\\\"%();&\']+/', '', trim( cbReplaceVars( $usernameFormat, $user, true, false, $extras, false ) ) );
		} else {
			if ( isset( $profile->username ) ) {
				$username			=	preg_replace( '/[<>\\\\"%();&\']+/', '', trim( $profile->username ) );
			}

			if ( ( ! $username ) || ( $username && $dummyUser->loadByUsername( $username ) ) ) {
				$username			=	preg_replace( '/[<>\\\\"%();&\']+/', '', trim( $profile->displayName ) );
			}
		}

		if ( ( ! $username ) || ( $username && $dummyUser->loadByUsername( $username ) ) ) {
			$username				=	(string) $profile->identifier;
		}

		if ( $mode == 2 ) {
			$user->set( 'email', $profile->email );
		} else {
			if ( $dummyUser->loadByUsername( $username ) ) {
				cbRedirect( $this->_returnUrl, CBTxt::T( 'UE_USERNAME_NOT_AVAILABLE', "The username '[username]' is already in use.", array( '[username]' =>  htmlspecialchars( $username ) ) ), 'error' );
				return false;
			}

			if ( ! $this->email( $user, $profile ) ) {
				return false;
			}

			if ( $dummyUser->loadByEmail( $user->get( 'email' ) ) ) {
				cbRedirect( $this->_returnUrl, CBTxt::T( 'UE_EMAIL_NOT_AVAILABLE', "The email '[email]' is already in use.", array( '[email]' =>  htmlspecialchars( $user->get( 'email' ) ) ) ), 'error' );
				return false;
			}

			$this->avatar( $user, $profile, $mode );

			if ( ! $usergroup ) {
				$gids				=	array( (int) $_CB_framework->getCfg( 'new_usertype' ) );
			} else {
				$gids				=	cbToArrayOfInt( explode( '|*|', $usergroup ) );
			}

			$user->set( 'gids', $gids );
			$user->set( 'sendEmail', 0 );
			$user->set( 'registerDate', $_CB_framework->getUTCDate() );
			$user->set( 'password', $user->hashAndSaltPassword( $user->getRandomPassword() ) );
			$user->set( 'registeripaddr', cbGetIPlist() );

			if ( $approval == 0 ) {
				$user->set( 'approved', 1 );
			} else {
				$user->set( 'approved', 0 );
			}

			if ( $confirmation == 0 ) {
				$user->set( 'confirmed', 1 );
			} else {
				$user->set( 'confirmed', 0 );
			}

			if ( ( $user->get( 'confirmed' ) == 1 ) && ( $user->get( 'approved' ) == 1 ) ) {
				$user->set( 'block', 0 );
			} else {
				$user->set( 'block', 1 );
			}
		}

		if ( $profile->firstName || $profile->lastName ) {
			$user->set( 'name', trim( $profile->firstName . ' ' . $profile->lastName ) );
		} elseif ( $profile->displayName ) {
			$user->set( 'name', trim( $profile->displayName ) );
		} else {
			$user->set( 'name', $username );
		}

		switch ( $ueConfig['name_style'] ) {
			case 2:
				$lastName			=	strrpos( $user->get( 'name' ), ' ' );

				if ( $lastName !== false ) {
					$user->set( 'firstname', substr( $user->get( 'name' ), 0, $lastName ) );
					$user->set( 'lastname', substr( $user->get( 'name' ), ( $lastName + 1 ) ) );
				} else {
					$user->set( 'firstname', '' );
					$user->set( 'lastname', $user->get( 'name' ) );
				}
				break;
			case 3:
				$middleName			=	strpos( $user->get( 'name' ), ' ' );
				$lastName			=	strrpos( $user->get( 'name' ), ' ' );

				if ( $lastName !== false ) {
					$user->set( 'firstname', substr( $user->get( 'name' ), 0, $middleName ) );
					$user->set( 'lastname', substr( $user->get( 'name' ), ( $lastName + 1 ) ) );

					if ( $middleName !== $lastName ) {
						$user->set( 'middlename', substr( $user->get( 'name' ), ( $middleName + 1 ), ( $lastName - $middleName - 1 ) ) );
					} else {
						$user->set( 'middlename', '' );
					}
				} else {
					$user->set( 'firstname', '' );
					$user->set( 'lastname', $user->get( 'name' ) );
				}
				break;
		}

		$user->set( 'username', $username );
		$user->set( $this->_providerField, $profile->identifier );

		$this->fields( $user, $profile, $mode );

		if ( $mode == 2 ) {
			foreach ( $user as $k => $v ) {
				$_POST[$k]			=	$v;
			}

			$emailPass				=	( isset( $ueConfig['emailpass'] ) ? $ueConfig['emailpass'] : '******' );
			$regErrorMSG			=	null;

			if ( ( ( $_CB_framework->getCfg( 'allowUserRegistration' ) == '0' ) && ( ( ! isset( $ueConfig['reg_admin_allowcbregistration'] ) ) || $ueConfig['reg_admin_allowcbregistration'] != '1' ) ) ) {
				$msg				=	CBTxt::T( 'UE_NOT_AUTHORIZED', 'You are not authorized to view this page!' );
			} else {
				$msg				=	null;
			}

			$_PLUGINS->loadPluginGroup( 'user' );

			$_PLUGINS->trigger( 'onBeforeRegisterFormRequest', array( &$msg, $emailPass, &$regErrorMSG ) );

			if ( $msg ) {
				$_CB_framework->enqueueMessage( $msg, 'error' );
				return false;
			}

			$fieldsQuery			=	null;
			$results				=	$_PLUGINS->trigger( 'onBeforeRegisterForm', array( 'com_comprofiler', $emailPass, &$regErrorMSG, $fieldsQuery ) );

			if ( $_PLUGINS->is_errors() ) {
				$_CB_framework->enqueueMessage( $_PLUGINS->getErrorMSG( '<br />' ), 'error' );
				return false;
			}

			if ( implode( '', $results ) != '' ) {
				$return				=		'<div class="cb_template cb_template_' . selectTemplate( 'dir' ) . '">'
									.			'<div>' . implode( '</div><div>', $results ) . '</div>'
									.		'</div>';

				echo $return;
				return false;
			}

			$_CB_framework->enqueueMessage( CBTxt::T( 'PROVIDER_SIGN_UP_INCOMPLETE', 'Your [provider] sign up is incomplete. Please complete the following.', array( '[provider]' => $this->_providerName ) ) );

			HTML_comprofiler::registerForm( 'com_comprofiler', $emailPass, $user, $_POST, $regErrorMSG );
			return false;
		} else {
			$_PLUGINS->trigger( 'onBeforeUserRegistration', array( &$user, &$user ) );

			if ( $user->store() ) {
				if ( $user->get( 'confirmed' ) == 0 ) {
					$user->store();
				}

				$messagesToUser		=	activateUser( $user, 1, 'UserRegistration' );

				$_PLUGINS->trigger( 'onAfterUserRegistration', array( &$user, &$user, true ) );

				if ( $user->get( 'block' ) == 1 ) {
					$return			=		'<div class="cb_template cb_template_' . selectTemplate( 'dir' ) . '">'
									.			'<div>' . implode( '</div><div>', $messagesToUser ) . '</div>'
									.		'</div>';

					echo $return;
				} else {
					return true;
				}
			}

			cbRedirect( $this->_returnUrl, CBTxt::T( 'SIGN_UP_WITH_PROVIDER_FAILED', 'Sign up with [provider] failed. Error: [error]', array( '[provider]' => $this->_providerName, '[error]' => $user->getError() ) ), 'error' );
			return false;
		}
	}
Пример #8
0
if (!file_exists(JPATH_SITE . '/libraries/CBLib/CBLib/Core/CBLib.php') || !file_exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php')) {
    echo 'CB not installed';
    return;
}
include_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
cbimport('cb.html');
cbimport('language.front');
outputCbTemplate();
require_once dirname(__FILE__) . '/helper.php';
if ((int) $params->get('cb_plugins', 1)) {
    global $_PLUGINS;
    $_PLUGINS->loadPluginGroup('user');
}
$cbUser = CBuser::getMyInstance();
$user = $cbUser->getUserData();
$templateClass = 'cb_template cb_template_' . selectTemplate('dir');
$mode = (int) $params->get('mode', 1);
if ($params->get('pretext')) {
    $preText = $cbUser->replaceUserVars($params->get('pretext'));
} else {
    $preText = null;
}
if ($params->get('posttext')) {
    $postText = $cbUser->replaceUserVars($params->get('posttext'));
} else {
    $postText = null;
}
if ($mode < 6) {
    $limit = (int) $params->get('limit', 30);
    switch ($mode) {
        case 5:
Пример #9
0
		}

		$xml						=	modCBAdminHelper::getFeedXML( 'http://www.joomlapolis.com/news?format=feed&type=rss', 'cbnewsfeed.xml', $feedDuration );

		if ( $xml ) {
			$items					=	$xml->xpath( '//channel/item' );

			/** @noinspection PhpIncludeInspection */
			require( JModuleHelper::getLayoutPath( 'mod_cbadmin', 'news' ) );
		}
		break;
	case 2:
	case 1:
	default:
		$menu						=	array();

		/** @noinspection PhpIncludeInspection */
		require( JModuleHelper::getLayoutPath( 'mod_cbadmin', 'menu' ) );

		if ( $mode == 2 ) {
			$return					=	'<div class="cb_template cb_template_' . selectTemplate( 'dir' ) . '">'
									.		modCBAdminHelper::getTable( $menu, $disabled )
									.	'</div>';

			echo $return;
		} else {
			echo modCBAdminHelper::getMenu( $menu, $disabled );
		}
		break;
}
Пример #10
0
 /**
  * Renders the registration head part view
  *
  * @return string  HTML
  */
 private function _renderRegistrationHead()
 {
     global $_CB_framework, $ueConfig;
     $layout = isset($ueConfig['reg_layout']) ? $ueConfig['reg_layout'] : 'flat';
     $titleCanvas = isset($ueConfig['reg_title_img']) ? $ueConfig['reg_title_img'] : 'general';
     if ($titleCanvas != 'none') {
         if (in_array($titleCanvas, array('general'))) {
             $canvasImg = selectTemplate() . 'images/title/' . $titleCanvas . '.jpg';
         } else {
             $canvasImg = $_CB_framework->getCfg('live_site') . '/images/' . $titleCanvas;
         }
     } else {
         $canvasImg = null;
     }
     $return = null;
     if ($this->moduleContent) {
         $return .= '<div class="cbRegistrationContainer">' . '<div class="cbRegistrationLogin">' . $this->moduleContent . '</div>';
     }
     $pageClass = $_CB_framework->getMenuPageClass();
     $return .= '<div class="cb_template cb_template_' . selectTemplate('dir') . ' cbRegistration ' . ($layout == 'tabbed' ? 'cbRegistrationTabbed' : ($layout == 'stepped' ? 'cbRegistrationStepped' : 'cbRegistrationFlat')) . ($canvasImg ? ' cbRegistrationCanvas' : null) . ($pageClass ? ' ' . htmlspecialchars($pageClass) : null) . '">';
     if (is_array($this->triggerResults)) {
         $return .= implode('', $this->triggerResults);
     }
     if ($this->registerTitle || $this->introMessage) {
         $return .= '<div class="cbRegistrationHeader"' . ($canvasImg ? ' style="background-image: url(' . $canvasImg . ')"' : null) . '>' . '<div class="cbRegistrationHeaderInner">';
         if ($this->registerTitle) {
             $return .= '<div class="cbRegistrationTitle page-header">' . '<h3>' . $this->registerTitle . '</h3>' . '</div>';
         }
         if ($this->introMessage) {
             $return .= '<div class="cbRegistrationIntro form-group cb_form_line clearfix">' . $this->introMessage . '</div>';
         }
         $return .= '</div>' . '</div>';
     }
     if ($this->topIcons) {
         $return .= '<div class="cbIconsTop form-group cb_form_line clearfix">' . $this->topIcons . '</div>';
     }
     $return .= $this->regFormTag;
     return $return;
 }
Пример #11
0
 /**
  * Gets the user avatar image without any link
  * 
  * @param unknown $system
  * @param unknown $userid
  * @param unknown $alt
  * @param number $height
  * @param string $email
  * @param string $path_only
  * @param unknown $attribs
  * @return void|Ambigous <string, unknown, NULL, string>
  */
 public static function get_user_avatar_image($system, $userid, $alt, $height = 48, $email = null, $path_only = true, $attribs = array())
 {
     $db = JFactory::getDBO();
     $avatar = '';
     $userid = !empty($userid) ? $userid : 0;
     switch ($system) {
         case 'cjforum':
             $api = JPATH_ROOT . '/components/com_cjforum/helpers/api.php';
             if (file_exists($api)) {
                 require_once $api;
                 $avatar = CjForumApi::get_user_avatar_image($userid, $height);
                 if ($path_only == false) {
                     $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
                 }
             }
             break;
         case 'cjblog':
             $api = JPATH_ROOT . DS . 'components' . DS . 'com_cjblog' . DS . 'api.php';
             if (file_exists($api)) {
                 include_once $api;
                 $avatar = CjBlogApi::get_user_avatar_image($userid, $height);
                 if ($path_only == false) {
                     $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
                 }
             }
             break;
         case 'jomsocial':
             include_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'defines.community.php';
             require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
             require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'helpers' . DS . 'string.php';
             $user = CFactory::getUser($userid);
             $avatar = $user->getThumbAvatar();
             if ($path_only == false) {
                 $attribs['height'] = $height . 'px';
                 $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
             }
             break;
         case 'cb':
             global $_CB_framework, $_CB_database, $ueConfig, $mainframe;
             $api = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
             if (!is_file($api)) {
                 return;
             }
             require_once $api;
             cbimport('cb.database');
             cbimport('cb.tables');
             cbimport('cb.field');
             cbimport('language.front');
             outputCbTemplate($_CB_framework->getUi());
             //TODO: Here
             $img_attribs['height'] = $height . 'px';
             if ($userid > 0) {
                 $cbUser = CBuser::getInstance($userid);
                 if ($cbUser !== null) {
                     $avatar = $cbUser->getField('avatar', null, 'php', 'profile', 'list');
                     $name = $cbUser->getField('name');
                     $avatar = $avatar['avatar'];
                     if ($path_only == false) {
                         $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
                     }
                 }
             } else {
                 if ($height <= 90) {
                     $avatar = $path_only ? selectTemplate() . 'images/avatar/tnnophoto_n.png' : Jhtml::image(selectTemplate() . 'images/avatar/tnnophoto_n.png', '', $img_attribs);
                 } else {
                     $avatar = $path_only ? selectTemplate() . 'images/avatar/nophoto_n.png' : Jhtml::image(selectTemplate() . 'images/avatar/nophoto_n.png', '', $img_attribs);
                 }
             }
             break;
         case 'touch':
             $avatarLoc = JURI::base(true) . '/index2.php?option=com_community&amp;controller=profile&amp;task=avatar&amp;width=' . $height . '&amp;height=' . $height . '&amp;user_id=' . $userid . '&amp;no_ajax=1';
             $attribs[] = array('style' => 'height: ' . $height . 'px');
             $avatar = $path_only ? $avatarLoc : JHtml::image($avatarLoc, $alt, $attribs);
             break;
         case 'gravatar':
             if (null == $email && $userid > 0) {
                 $strSql = 'SELECT email FROM #__users WHERE id=' . $userid;
                 $db->setQuery($strSql);
                 $email = $db->loadResult();
             }
             $avatar = 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) . '?s=' . $height . '&d=mm&r=g';
             if ($path_only == false) {
                 $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
             }
             break;
         case 'kunena':
             if (CJFunctions::_initialize_kunena()) {
                 $class = 'avatar';
                 $user = KunenaFactory::getUser($userid);
                 $avatar = $user->getAvatarImage($class, $height, $height);
                 if ($path_only) {
                     preg_match_all('/<img .*src=["|\']([^"|\']+)/i', $avatar, $matches);
                     foreach ($matches[1] as $key => $value) {
                         $avatar = $value;
                         break;
                     }
                 }
             }
             break;
         case 'aup':
             $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
             if (file_exists($api_AUP)) {
                 require_once $api_AUP;
                 if ($path_only) {
                     $avatar = AlphaUserPointsHelper::getAvatarPath($userid);
                 } else {
                     $avatar = AlphaUserPointsHelper::getAupAvatar($userid, 0, $height, $height);
                 }
             }
             break;
         case 'easysocial':
             $api = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_easysocial' . DS . 'includes' . DS . 'foundry.php';
             if (file_exists($api)) {
                 require_once $api;
                 $my = Foundry::user();
                 $avatar = $my->getAvatar($height < 64 ? SOCIAL_AVATAR_SMALL : ($height < 128 ? SOCIAL_AVATAR_MEDIUM : SOCIAL_AVATAR_LARGE));
                 $attribs[] = array('style' => 'height: ' . $height . 'px');
                 if ($path_only == false) {
                     $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
                 }
             }
             break;
     }
     return $avatar;
 }
 /**
  * Displays "Not authorized", and if not logged-in "you need to login"
  *
  */
 function cbNotAuth($enqueue = false)
 {
     global $_CB_framework;
     if ($enqueue) {
         $_CB_framework->enqueueMessage(CBTxt::T('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!') . ($_CB_framework->myId() < 1 ? ' ' . CBTxt::T('You need to log in.') : null), 'error');
     } else {
         $return = '<div class="cbNotAuth cb_template cb_template_' . selectTemplate('dir') . '">' . '<div class="error">' . CBTxt::Th('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!') . '</div>';
         if ($_CB_framework->myId() < 1) {
             $return .= '<div class="error">' . CBTxt::Th('UE_DO_LOGIN', 'You need to log in.') . '</div>';
         }
         $return .= '</div>';
         echo $return;
     }
 }
Пример #13
0
	/**
	 * render frontend invites
	 *
	 * @param object $rows
	 * @param object $pageNav
	 * @param cbgjCategory $category
	 * @param cbgjGroup $group
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showInvites( $rows, $pageNav, $category, $group, $user, $plugin ) {
		global $_CB_framework;

		$groupInvitesSearch			=	( $plugin->params->get( 'group_invites_search', 1 ) && ( $pageNav->searching || $pageNav->total ) );
		$groupInvitesPaging			=	$plugin->params->get( 'group_invites_paging', 1 );
		$groupInvitesLimitbox		=	$plugin->params->get( 'group_invites_limitbox', 1 );
		$authorized					=	cbgjClass::getAuthorization( $category, $group, $user );
		$groupInvitesToggle			=	( $plugin->params->get( 'group_toggle', 3 ) > 1 );
		$data						=	cbgjClass::parseParams( $_POST );

		if ( $plugin->params->get( 'group_invites_list', 0 ) ) {
			$connections			=	cbgjClass::getConnectionsList( $user );

			if ( $connections ) {
				$js					=	"$( '#invites_conn' ).change( function() {"
									.		"$( '#invites_invite' ).attr( 'value', $( this ).val() ).focus().keyup();"
									.		"$( this ).attr( 'value', '' );"
									.	"});";

				$_CB_framework->outputCbJQuery( $js );

				array_unshift( $connections, moscomprofilerHTML::makeOption( '', CBTxt::T( '- Select Connection -' ) ) );

				$usersList			=	moscomprofilerHTML::selectList( $connections, 'invites_conn', null, 'value', 'text', null, 0, false, false );
			}
		}

		if ( $plugin->params->get( 'group_invites_captcha', 0 ) && ( ! cbgjClass::hasAccess( 'usr_mod', $authorized ) ) ) {
			$captcha				=	cbgjCaptcha::render();
		} else {
			$captcha				=	false;
		}

		$return						=	'<form action="' . cbgjClass::getPluginURL( array( 'invites', 'send', (int) $category->get( 'id' ), (int) $group->get( 'id' ) ) ) . '" method="post" name="gjForm_invite" id="gjForm_invite" class="gjForm gjToggle form-horizontal">'
									.		'<div class="gjEditContentInput control-group">'
									.			'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Invite' ) . '</label>'
									.			'<div class="gjEditContentInputField controls">'
									.				'<input type="text" size="35" class="input-large required" value="' . htmlspecialchars( $data->get( 'invites_invite', null ) ) . '" name="invites_invite" id="invites_invite" />'
									.				'<span class="gjEditContentInputIcon help-inline">'
									.					cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
									.					cbgjClass::getIcon( CBTxt::P( 'Invite by [invite_types].', array( '[invite_types]' => implode( ', ', cbgjInvite::inviteBy() ) ) ) )
									.				'</span>'
									.			'</div>'
									.		'</div>';

		if ( isset( $usersList ) ) {
			$return					.=		'<div class="gjEditContentInput control-group">'
									.			'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Connection' ) . '</label>'
									.			'<div class="gjEditContentInputField controls">'
									.				$usersList
									.				'<span class="gjEditContentInputIcon help-inline">'
									.					cbgjClass::getIcon( CBTxt::T( 'Pre-fill invite with a connection.' ) )
									.				'</span>'
									.			'</div>'
									.		'</div>';
		}

		if ( $captcha !== false ) {
			$return					.=		'<div class="gjEditContentInput control-group">'
									.			'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Captcha' ) . '</label>'
									.			'<div class="gjEditContentInputField controls">'
									.				'<div style="margin-bottom: 5px;">' . $captcha['code'] . '</div>'
									.				'<div>' . $captcha['input'] . '</div>'
									.				'<span class="gjEditContentInputIcon help-inline">'
									.					cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
									.				'</span>'
									.			'</div>'
									.		'</div>';
		}

		$return						.=		'<div class="gjButtonWrapper form-actions">'
									.			'<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Send Invite' ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" />&nbsp;'
									.			( $groupInvitesToggle ? '<a href="#gjInviteToggle" role="button" class="gjButton gjButtonCancel btn btn-mini gjToggleCollapse">' . CBTxt::Th( 'Cancel' ) . '</a>' : null )
									.		'</div>'
									.		cbGetSpoofInputTag( 'plugin' )
									.	'</form>'
									.	'<form action="' . $group->getUrl() . '" method="post" name="gjForm_invites" id="gjForm_invites" class="gjForm">';

		if ( $groupInvitesToggle || $groupInvitesSearch ) {
			$return					.=		'<div class="gjTop row-fluid">'
									.			'<div class="gjTop gjTopLeft span6">'
									.				( $groupInvitesToggle ? '<a href="#gjForm_invite" id="gjInviteToggle" role="button" class="gjButton btn gjToggleExpand">' . CBTxt::Th( 'New Invite' ) . '</a>' : null )
									.			'</div>'
									.			'<div class="gjTop gjTopRight span6">'
									.				( $groupInvitesSearch ? $pageNav->search : null )
									.			'</div>'
									.		'</div>';
		}

		if ( $rows ) {
			$return					.=		'<div class="gjContent">';

			foreach ( $rows as $row ) {
				if ( $row->get( 'user' ) ) {
					$userAvatar		=	$row->getInvitedAvatar( true );
					$userName		=	$row->getInvitedName( true );
					$userOnline		=	$row->getInvitedOnline();
				} else {
					$userAvatar		=	'<img src="' . selectTemplate() . 'images/avatar/tnnophoto_n.png" alt="' . htmlspecialchars( $row->get( 'email' ) ) . '" title="' . htmlspecialchars( $row->get( 'email' ) ) . '" />';
					$userName		=	'******' . htmlspecialchars( $row->get( 'email' ) ) . '">' . htmlspecialchars( $row->get( 'email' ) ) . '</a>';
					$userOnline		=	null;
				}

				$menuItems			=	cbgjClass::getIntegrations( 'gj_onBeforeGroupInviteMenu', array( $row, $group, $category, $user, $plugin ) )
									.	'<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'delete', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::T( 'Are you sure you want to delete this invite?' ) ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>'
									.	cbgjClass::getIntegrations( 'gj_onAfterGroupInviteMenu', array( $row, $group, $category, $user, $plugin ) );

				$return				.=			'<div class="gjContentBox mini-layout">'
									.				'<div class="gjContentBoxRow">' . $userName . '</div>'
									.				'<div class="gjContentBoxRow">' . $userAvatar . '</div>'
									.				( $userOnline ? '<div class="gjContentBoxRow">' . $userOnline . '</div>' : null )
									.				'<div class="gjContentBoxRow">'
									.					cbgjClass::getIntegrations( 'gj_onBeforeGroupInviteInfo', array( $row, $group, $category, $user, $plugin ) )
									.					'<span title="' . cbFormatDate( $row->get( 'invited' ), 1, false ) . ( $row->isAccepted() ? ' - ' . cbFormatDate( $row->get( 'accepted' ), 1, false ) : null ) . '">' . $row->getStatus() . '</span>'
									.					cbgjClass::getIntegrations( 'gj_onAfterGroupInviteInfo', array( $row, $group, $category, $user, $plugin ) )
									.				'</div>';

				if ( ( ! $row->isAccepted() ) && ( $row->dateDifference() >= 5 ) ) {
					$return			.=				'<div class="gjContentBoxRow">'
									.					'<input type="button" value="' . htmlspecialchars( CBTxt::Th( 'Resend' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'send', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), true ) . '" />'
									.				'</div>';
				}

				$return				.=				'<div class="gjContentBoxRow">'
									.					cbgjClass::getDropdown( $menuItems, CBTxt::T( 'Menu' ) )
									.				'</div>';

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

			$return					.=		'</div>';
		} else {
			$return					.=		'<div class="gjContent">';

			if ( $groupInvitesSearch && $pageNav->searching ) {
				$return				.=			CBTxt::Th( 'No invite search results found.' );
			} else {
				$return				.=			CBTxt::Th( 'There are no invites available.' );
			}

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

		if ( $groupInvitesPaging ) {
			$return					.=		'<div class="gjPaging pagination pagination-centered">'
									.			( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null )
									.			( ! $groupInvitesLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) )
									.		'</div>';
		}

		$return						.=		cbGetSpoofInputTag( 'plugin' )
									.	'</form>';

		return $return;
	}
Пример #14
0
 public function getUserAvatarImage($app, $userId, $email = null, $height = 48, $urlOnly = true, $alt = '', $imgAttribs = array())
 {
     $avatar = '';
     $userId = !empty($userId) ? $userId : 0;
     $imgAttribs['class'] = isset($imgAttribs['class']) ? $imgAttribs['class'] : 'img-avatar';
     switch ($app) {
         case 'cjforum':
             $api = JPATH_ROOT . '/components/com_cjforum/lib/api.php';
             if (file_exists($api)) {
                 require_once $api;
                 $profileApi = CjForumApi::getProfileApi();
                 $avatar = $profileApi->getUserAvatarImage($userId, $height);
                 if ($urlOnly == false) {
                     $imgAttribs['height'] = $height . 'px';
                     $imgAttribs['style'] = 'max-height: ' . $height . 'px; max-width: ' . $height . 'px;';
                     $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
                 }
             }
             break;
         case 'cjblog':
             $api = JPATH_ROOT . '/components/com_cjblog/api.php';
             if (file_exists($api)) {
                 include_once $api;
                 $avatar = CjBlogApi::get_user_avatar_image($userId, $height);
                 if ($urlOnly == false) {
                     $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
                 }
             }
             break;
         case 'easyprofile':
             $api = JPATH_ROOT . '/components/com_jsn/helpers/helper.php';
             if (file_exists($api)) {
                 $user = new JsnUser($userId);
                 $avatar = $user->getValue('avatar');
                 if ($urlOnly == false) {
                     $imgAttribs['height'] = $height . 'px';
                     $imgAttribs['style'] = 'max-height: ' . $height . 'px; display: block; margin: 0 auto';
                     $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
                 }
             }
             break;
         case 'jomsocial':
             require_once JPATH_ROOT . '/components/com_community/defines.community.php';
             require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
             require_once JPATH_ROOT . '/components/com_community/helpers/string.php';
             $user = CFactory::getUser($userId);
             $avatar = $user->getThumbAvatar();
             if ($urlOnly == false) {
                 $imgAttribs['height'] = $height . 'px';
                 $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
             }
             break;
         case 'cb':
             global $_CB_framework, $_CB_database, $ueConfig, $mainframe;
             $api = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
             if (!is_file($api)) {
                 return;
             }
             require_once $api;
             cbimport('cb.database');
             cbimport('cb.tables');
             cbimport('cb.field');
             cbimport('language.front');
             outputCbTemplate($_CB_framework->getUi());
             //TODO: Here
             $imgAttribs['height'] = $height . 'px';
             if ($userId > 0) {
                 $cbUser = CBuser::getInstance($userId);
                 if ($cbUser !== null) {
                     $avatar = $cbUser->getField('avatar', null, 'php', 'profile', 'list');
                     $alt = $cbUser->getField('name');
                     $avatar = $avatar['avatar'];
                 }
             } else {
                 if ($height <= 90) {
                     $avatar = selectTemplate() . 'images/avatar/tnnophoto_n.png';
                 } else {
                     $avatar = selectTemplate() . 'images/avatar/nophoto_n.png';
                 }
             }
             if ($urlOnly == false) {
                 $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
             }
             break;
         case 'gravatar':
             if (null == $email && $userId > 0) {
                 try {
                     $db = JFactory::getDbo();
                     $query = $db->getQuery(true)->select('email')->from('#__users')->where('id = ' . $userId);
                     $db->setQuery($query);
                     $email = $db->loadResult();
                 } catch (Exception $e) {
                 }
             }
             $avatar = 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) . '?s=' . $height . '&d=mm&r=g';
             if ($urlOnly == false) {
                 $avatar = JHtml::image($avatar, $alt, $imgAttribs);
             }
             break;
         case 'kunena':
             if ($this->_initialize_kunena()) {
                 $class = 'avatar';
                 $user = KunenaFactory::getUser($userId);
                 $avatar = $user->getAvatarImage($class, $height, $height);
                 if ($urlOnly) {
                     preg_match_all('/<img .*src=["|\']([^"|\']+)/i', $avatar, $matches);
                     foreach ($matches[1] as $key => $value) {
                         $avatar = $value;
                         break;
                     }
                 }
             }
             break;
         case 'aup':
             $api_AUP = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
             if (file_exists($api_AUP)) {
                 require_once $api_AUP;
                 if ($urlOnly) {
                     $avatar = AlphaUserPointsHelper::getAvatarPath($userId);
                 } else {
                     $avatar = AlphaUserPointsHelper::getAupAvatar($userId, 0, $height, $height);
                 }
             }
             break;
         case 'easysocial':
             $api = JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
             if (file_exists($api)) {
                 require_once $api;
                 $my = Foundry::user($userId);
                 $avatar = $my->getAvatar($height < 64 ? SOCIAL_AVATAR_SMALL : ($height < 128 ? SOCIAL_AVATAR_MEDIUM : SOCIAL_AVATAR_LARGE));
                 $imgAttribs[] = array('style' => 'height: ' . $height . 'px');
                 if ($urlOnly == false) {
                     $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
                 }
             }
             break;
     }
     return $avatar;
 }
Пример #15
0
 /**
  * Returns full URL of thumbnail of avatar
  *
  * @param  moscomprofilerFields  $field
  * @param  moscomprofilerUser  $user
  * @param  int                 $show_avatar
  * @return string              URL
  */
 function _avatarLivePath(&$field, &$user, $thumbnail = true, $show_avatar = 2)
 {
     global $_CB_framework;
     $oValue = null;
     $col = $field->name;
     $colapproved = $col . 'approved';
     if ($user && $user->id) {
         $avatar = $user->{$col};
         $avatarapproved = $user->{$colapproved};
         $live_site = $_CB_framework->getCfg('live_site');
         $absolute_path = $_CB_framework->getCfg('absolute_path');
         $tn = $thumbnail ? 'tn' : '';
         $oValue = null;
         if ($avatar != '' && ($avatarapproved > 0 || $show_avatar == 10)) {
             if (strpos($avatar, 'gallery/') === false) {
                 $oValue = 'images/comprofiler/' . $tn . $avatar;
             } else {
                 $oValue = 'images/comprofiler/' . $avatar;
             }
             if (!is_file($absolute_path . '/' . $oValue)) {
                 $oValue = null;
             }
         }
         if ($oValue === null && $show_avatar == 2) {
             if ($avatarapproved == 0) {
                 $icon = 'pending_n.png';
             } else {
                 $icon = 'nophoto_n.png';
             }
             return selectTemplate() . 'images/avatar/' . $tn . $icon;
         }
     }
     if ($oValue) {
         $oValue = $live_site . '/' . $oValue;
     }
     return $oValue;
 }
Пример #16
0
	function getAllJsPageCodes( ) {
		$jsCodeTxt			=	'';

		// jQuery code loading:

		if ( count( $this->_jQueryCodes ) > 0 ) {
			foreach ( array_keys( $this->_jQueryPlugins ) as $plugin ) {
				if ( isset( $this->_jqueryCssFiles[$plugin] ) ) {
					foreach ( $this->_jqueryCssFiles[$plugin] as $templateFile => $minExistsmedia ) {
						$templateFileWPath	=	selectTemplate( 'absolute_path' ) . '/' . $templateFile;
						if ( file_exists( $templateFileWPath ) ) {
							$templateFileUrl	=	selectTemplate( 'live_site' ) . $templateFile;
						} else {
							$templateFileUrl	=	selectTemplate( 'live_site', 'default' ) . $templateFile;
						}
						if ( ! isset( $this->_jQueryPluginsSent[$templateFileUrl] ) ) {
							$this->document->addHeadStyleSheet( $templateFileUrl, $minExistsmedia[0], $minExistsmedia[1] );
							$this->_jQueryPluginsSent[$templateFileUrl]		=	true;
						}
					}
				}
			}
			if ( ! defined( 'J_JQUERY_LOADED' ) ) {
				$this->document->addHeadScriptUrl( '/components/com_comprofiler/js/jquery-' . _CB_JQUERY_VERSION . '/jquery-' . _CB_JQUERY_VERSION . '.js', true, null, 'jQuery.noConflict();' );
				define( 'J_JQUERY_LOADED', 1 );
			}
			foreach ( $this->_jQueryPlugins as $plugin => $pluginPath ) {
				if ( ! isset( $this->_jQueryPluginsSent[$plugin] ) ) {
					$this->document->addHeadScriptUrl( $pluginPath, true, null, null, ( $plugin == 'excanvas' ? '<!--[if IE]>' : '' ), ( $plugin == 'excanvas' ? '<![endif]-->' : '' ) );
					$this->_jQueryPluginsSent[$plugin]		=	true;
				}
			}
/*
			$jsCodeTxt		=	"var cbJFrame = window.cbJFrame = function() { return new cbJFrame.prototype.init(); };\n"
							.	"cbJFrame.fn = cbJFrame.prototype = {\n"
							.	"  init: function() { return this; },\n"
							.	"  cbjframe: '" . $ueConfig['version'] . "',\n"
							.	"  jquery: null\n"
							.	"};\n"
							.	"cbJFrame.prototype.init.prototype = cbJFrame.prototype;\n"
							//.	"cbJFrame.jquery = jQuery.noConflict();\n"
							.	'cbJFrame.jquery(document).ready(function($){' . "\n"
							.	implode( "\n", $this->_jQueryCodes )
							.	"});\n";
*/
			$jQcodes		=	trim( implode( "\n", $this->_jQueryCodes ) );
			if ( $jQcodes !== '' ) {
				$jsCodeTxt	=	'jQuery(document).ready(function($){' . "\n"
							.	$jQcodes
							.	"});"
							;
				$this->document->addHeadScriptDeclaration( $jsCodeTxt );
			}
			$this->_jQueryCodes		=	array();
		}

		// classical standalone javascript loading (for compatibility), depreciated ! :

		if ( count( $this->_jsCodes ) > 0 ) {
			$this->document->addHeadScriptDeclaration( implode( "\n", $this->_jsCodes ) );
			$this->_jsCodes	=	array();
		}
	}
 /**
  * @param  array       $connections
  * @param  array       $actions
  * @param  int         $total
  * @param  cbTabs      $connMgmtTabs
  * @param  array       $pagingParams
  * @param  int         $perpage
  * @param  array|null  $connecteds
  */
 static function manageConnections($connections, $actions, $total, &$connMgmtTabs, &$pagingParams, $perpage, $connecteds = null)
 {
     global $_CB_framework, $ueConfig, $_PLUGINS, $_REQUEST;
     $results = $_PLUGINS->trigger('onBeforeManageConnectionsFormDisplay', array(&$connections, &$actions, &$total, &$connMgmtTabs, &$pagingParams, &$perpage, &$connecteds));
     if ($_PLUGINS->is_errors()) {
         echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n";
         exit;
     }
     outputCbTemplate(1);
     initToolTip(1);
     cbValidator::loadValidation();
     $js = "if ( typeof confirmSubmit != 'function' ) {" . "function confirmSubmit() {" . "if ( confirm( '" . addslashes(CBTxt::T('UE_CONFIRMREMOVECONNECTION', 'Are you sure you want to remove this connection?')) . "' ) ) {" . "return true;" . "} else {" . "return false;" . "}" . "};" . "}";
     $_CB_framework->document->addHeadScriptDeclaration($js);
     $connectionCategories = explode("\n", $ueConfig['connection_categories']);
     $connectionTypes = array();
     if ($connectionCategories) {
         foreach ($connectionCategories as $connectionCategory) {
             if (trim($connectionCategory) != null && trim($connectionCategory) != "") {
                 $connectionTypes[] = moscomprofilerHTML::makeOption(trim($connectionCategory), CBTxt::T(trim($connectionCategory)));
             }
         }
     }
     $tabs = new cbTabs(0, 1);
     $pageClass = $_CB_framework->getMenuPageClass();
     $return = '<div class="cbManageConnections cb_template cb_template_' . selectTemplate('dir') . ($pageClass ? ' ' . htmlspecialchars($pageClass) : null) . '">';
     if (is_array($results)) {
         $return .= implode('', $results);
     }
     $return .= '<div class="page-header"><h3>' . CBTxt::Th('UE_MANAGECONNECTIONS', 'Manage Connections') . '</h3></div>' . $tabs->startPane('myCon') . $tabs->startTab('myCon', CBTxt::Th('UE_MANAGEACTIONS', 'Manage Actions') . ' <span class="badge">' . count($actions) . '</span>', 'action');
     if (!count($actions) > 0) {
         $return .= '<div class="form-group cb_form_line clearfix tab_description">' . CBTxt::Th('UE_NOACTIONREQUIRED', 'No Pending Actions') . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<input type="button" class="btn btn-default cbMngConnCancel" value="' . htmlspecialchars(CBTxt::Th('UE_CANCEL', 'Cancel')) . '" onclick="window.location=\'' . $_CB_framework->userProfileUrl() . '\'; return false;" />' . '</div>';
     } else {
         $return .= '<form action="' . $_CB_framework->viewUrl('processconnectionactions') . '" method="post" id="adminForm" name="adminForm" class="cb_form form-auto cbValidation">' . '<div class="form-group cb_form_line clearfix tab_description">' . CBTxt::Th('UE_CONNECT_ACTIONREQUIRED', 'Below you see users proposing to connect with you. You have the choice to accept or decline their request.') . '</div>' . '<div class="table">';
         foreach ($actions as $action) {
             $cbUser = CBuser::getInstance((int) $action->id, false);
             $tipField = '<b>' . CBTxt::Th('UE_CONNECTIONREQUIREDON', 'Connection Required on') . '</b>: ' . $_CB_framework->getUTCDate(array($ueConfig['date_format'], 'Y-m-d'), $action->membersince);
             if ($action->reason != null) {
                 $tipField .= '<br /><b>' . CBTxt::Th('UE_CONNECTIONMESSAGE', 'Personal message included') . '</b>: <br />' . htmlspecialchars($action->reason, ENT_QUOTES);
             }
             $tipTitle = CBTxt::Th('UE_CONNECTIONREQUESTDETAIL', 'Connection Request Details');
             $htmlText = $cbUser->getField('avatar', null, 'html', 'none', 'list', 0, true);
             $tooltip = cbTooltip(1, $tipField, $tipTitle, 300, null, $htmlText, null, 'style="display: inline-block; padding: 5px;"');
             $return .= '<div class="containerBox img-thumbnail">' . '<div class="containerBoxInner" style="min-height: 130px; min-width: 90px;">' . $cbUser->getField('onlinestatus', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . ' ' . $cbUser->getField('formatname', null, 'html', 'none', 'list', 0, true) . '<br />' . $tooltip . '<br />' . '<span class="fa fa-check" title="' . htmlspecialchars(CBTxt::T('UE_ACCEPTCONNECTION', 'Accept Connection')) . '"></span>' . ' <input type="radio" name="' . (int) $action->id . 'action" value="a" checked="checked" />' . ' <span class="fa fa-times" title="' . htmlspecialchars(CBTxt::T('UE_DECLINECONNECTION', 'Decline Connection')) . '"></span>' . ' <input type="radio" name="' . (int) $action->id . 'action" value="d" />' . '<input type="hidden" name="uid[]" value="' . (int) $action->id . '" />' . '</div>' . '</div>';
         }
         $return .= '</div>' . '<div class="form-group cb_form_line clearfix">' . '<input type="submit" class="btn btn-primary cbMngConnSubmit" value="' . htmlspecialchars(CBTxt::Th('UE_UPDATE', 'Update')) . '"' . cbValidator::getSubmitBtnHtmlAttributes() . ' />' . ' <input type="button" class="btn btn-default cbMngConnCancel" value="' . htmlspecialchars(CBTxt::Th('UE_CANCEL', 'Cancel')) . '" onclick="window.location=\'' . $_CB_framework->userProfileUrl() . '\'; return false;" />' . '</div>' . cbGetSpoofInputTag('manageconnections') . '</form>';
     }
     $return .= $tabs->endTab() . $tabs->startTab('myCon', CBTxt::Th('UE_MANAGECONNECTIONS', 'Manage Connections'), 'connections');
     if (!count($connections) > 0) {
         $return .= '<div class="form-group cb_form_line clearfix tab_description">' . CBTxt::Th('UE_NOCONNECTIONS', 'This user has no current connections.') . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<input type="button" class="btn btn-default cbMngConnCancel" value="' . htmlspecialchars(CBTxt::Th('UE_CANCEL', 'Cancel')) . '" onclick="window.location=\'' . $_CB_framework->userProfileUrl() . '\'; return false;" />' . '</div>';
     } else {
         $return .= '<form action="' . $_CB_framework->viewUrl('saveconnections') . '" method="post" id="adminForm" name="adminForm" class="cb_form form-auto cbValidation">' . '<div class="form-group cb_form_line clearfix tab_description">' . CBTxt::Th('UE_CONNECT_MANAGECONNECTIONS', 'Below you see users to whom you are connected directly. ') . '</div>' . '<table class="table table-hover table-responsive">' . '<thead>' . '<tr>' . '<th style="width: 25%;" class="text-center">' . CBTxt::Th('UE_CONNECTION', 'Connections') . '</th>' . '<th style="width: 35%;" class="text-center">' . CBTxt::Th('UE_CONNECTIONTYPE', 'Type') . '</th>' . '<th style="width: 40%;" class="text-center">' . CBTxt::Th('UE_CONNECTIONCOMMENT', 'Comment') . '</th>' . '</tr>' . '</thead>' . '<tbody>';
         $i = 1;
         foreach ($connections as $connection) {
             $cbUser = CBuser::getInstance((int) $connection->id, false);
             $tipField = '<b>' . CBTxt::Th('UE_CONNECTEDSINCE', 'Connected Since') . '</b>: ' . $_CB_framework->getUTCDate(array($ueConfig['date_format'], 'Y-m-d'), $connection->membersince);
             if ($connection->type != null) {
                 $tipField .= '<br /><b>' . CBTxt::Th('UE_CONNECTIONTYPE', 'Type') . '</b>: ' . getConnectionTypes($connection->type);
             }
             if ($connection->description != null) {
                 $tipField .= '<br /><b>' . CBTxt::Th('UE_CONNECTEDCOMMENT', 'Comment') . '</b>: ' . htmlspecialchars($connection->description);
             }
             $tipTitle = CBTxt::Th('UE_CONNECTEDDETAIL', 'Connection Details');
             $htmlText = $cbUser->getField('avatar', null, 'html', 'none', 'list', 0, true);
             $tooltip = cbTooltip(1, $tipField, $tipTitle, 300, null, $htmlText, null, 'style="display: inline-block; padding: 5px;"');
             if ($connection->accepted == 1 && $connection->pending == 1) {
                 $actionImg = '<span class="fa fa-clock-o" title="' . htmlspecialchars(CBTxt::T('UE_CONNECTIONPENDING', 'Connection Pending')) . '"></span>' . ' <a href="' . $_CB_framework->viewUrl('removeconnection', true, array('act' => 'manage', 'connectionid' => (int) $connection->memberid)) . '" onclick="return confirmSubmit();" >' . '<span class="fa fa-times-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>';
             } elseif ($connection->accepted == 1 && $connection->pending == 0) {
                 $actionImg = '<a href="' . $_CB_framework->viewUrl('removeconnection', true, array('act' => 'manage', 'connectionid' => (int) $connection->memberid)) . '" onclick="return confirmSubmit();" >' . '<span class="fa fa-times-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>';
             } elseif ($connection->accepted == 0) {
                 $actionImg = '<a href="' . $_CB_framework->viewUrl('acceptconnection', true, array('act' => 'manage', 'connectionid' => (int) $connection->memberid)) . '" onclick="return confirmSubmit();" >' . '<span class="fa fa-check-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_ACCEPTCONNECTION', 'Accept Connection')) . '"></span>' . '</a>' . ' <a href="' . $_CB_framework->viewUrl('removeconnection', true, array('act' => 'manage', 'connectionid' => (int) $connection->memberid)) . '" onclick="return confirmSubmit();" >' . '<span class="fa fa-times-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>';
             } else {
                 $actionImg = null;
             }
             $return .= '<tr>' . '<td class="text-center">' . $cbUser->getField('onlinestatus', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . ' ' . $cbUser->getField('formatname', null, 'html', 'none', 'list', 0, true) . '<br />' . $tooltip . '<br />' . $actionImg . ' <a href="' . $_CB_framework->userProfileUrl((int) $connection->memberid) . '">' . '<span class="fa fa-user" title="' . htmlspecialchars(CBTxt::T('UE_VIEWPROFILE', 'View Profile')) . '"></span>' . '</a>' . ' ' . $cbUser->getField('email', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . ' ' . $cbUser->getField('pm', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . '</td>' . '<td class="text-center">' . moscomprofilerHTML::selectList($connectionTypes, $connection->id . 'connectiontype[]', 'class="form-control" multiple="multiple" size="5"', 'value', 'text', explode('|*|', trim($connection->type)), 0) . '</td>' . '<td class="text-center">' . '<textarea cols="25" class="form-control"  rows="5" name="' . (int) $connection->id . 'description">' . htmlspecialchars($connection->description) . '</textarea>' . '<input type="hidden" name="uid[]" value="' . (int) $connection->id . '" />' . '</td>' . '</tr>';
             $i = $i == 1 ? 2 : 1;
         }
         $return .= '</tbody>' . '</table>';
         if ($perpage < $total) {
             $return .= '<div class="form-group cb_form_line text-center clearfix">' . $connMgmtTabs->_writePaging($pagingParams, 'connections_', $perpage, $total, 'manageconnections') . '</div>';
         }
         $return .= '<div class="form-group cb_form_line clearfix">' . '<input type="submit" class="btn btn-primary cbMngConnSubmit" value="' . htmlspecialchars(CBTxt::Th('UE_UPDATE', 'Update')) . '"' . cbValidator::getSubmitBtnHtmlAttributes() . ' />' . ' <input type="button" class="btn btn-default cbMngConnCancel" value="' . htmlspecialchars(CBTxt::Th('UE_CANCEL', 'Cancel')) . '" onclick="window.location=\'' . $_CB_framework->userProfileUrl() . '\'; return false;" />' . '</div>' . cbGetSpoofInputTag('manageconnections') . '</form>';
     }
     $return .= $tabs->endTab();
     if ($ueConfig['autoAddConnections'] == 0) {
         $return .= $tabs->startTab('myCon', CBTxt::Th('UE_CONNECTEDWITH', 'Manage Connections With Me'), 'connected');
         if (!count($connecteds) > 0) {
             $return .= '<div class="form-group cb_form_line clearfix tab_description">' . CBTxt::Th('UE_NOCONNECTEDWITH', 'There are currently no users connected with you.') . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<input type="button" class="btn btn-default cbMngConnCancel" value="' . htmlspecialchars(CBTxt::Th('UE_CANCEL', 'Cancel')) . '" onclick="window.location=\'' . $_CB_framework->userProfileUrl() . '\'; return false;" />' . '</div>';
         } else {
             $htmlConnectedWidth = CBTxt::Th('UE_CONNECT_CONNECTEDWITH', '');
             $return .= ($htmlConnectedWidth ? '<div class="form-group cb_form_line clearfix tab_description">' . $htmlConnectedWidth . '</div>' : null) . '<div class="table">';
             foreach ($connecteds as $connected) {
                 $cbUser = CBuser::getInstance((int) $connected->id, false);
                 $tipField = '<b>' . CBTxt::Th('UE_CONNECTEDSINCE', 'Connected Since') . '</b>: ' . $_CB_framework->getUTCDate(array($ueConfig['date_format'], 'Y-m-d'), $connected->membersince);
                 if ($connected->type != null) {
                     $tipField .= '<br /><b>' . CBTxt::Th('UE_CONNECTIONTYPE', 'Type') . '</b>: ' . getConnectionTypes($connected->type);
                 }
                 if ($connected->description != null) {
                     $tipField .= '<br /><b>' . CBTxt::Th('UE_CONNECTEDCOMMENT', 'Comment') . '</b>: ' . htmlspecialchars($connected->description);
                 }
                 $tipTitle = CBTxt::Th('UE_CONNECTEDDETAIL', 'Connection Details');
                 $htmlText = $cbUser->getField('avatar', null, 'html', 'none', 'list', 0, true);
                 $tooltip = cbTooltip(1, $tipField, $tipTitle, 300, null, $htmlText, null, 'style="padding: 5px;"');
                 if ($connected->accepted == 1 && $connected->pending == 1) {
                     $actionImg = '<span class="fa fa-clock-o" title="' . htmlspecialchars(CBTxt::T('UE_CONNECTIONPENDING', 'Connection Pending')) . '"></span>' . ' <a href="' . $_CB_framework->viewUrl('removeconnection', true, array('act' => 'manage', 'connectionid' => (int) $connected->memberid)) . '" >' . '<span class="fa fa-times-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>';
                 } elseif ($connected->accepted == 1 && $connected->pending == 0) {
                     $actionImg = '<a href="' . $_CB_framework->viewUrl('denyconnection', true, array('act' => 'manage', 'connectionid' => (int) $connected->referenceid)) . '" >' . '<span class="fa fa-times-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>';
                 } elseif ($connected->accepted == 0) {
                     $actionImg = '<a href="' . $_CB_framework->viewUrl('acceptconnection', true, array('act' => 'manage', 'connectionid' => (int) $connected->referenceid)) . '" >' . '<span class="fa fa-check-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_ACCEPTCONNECTION', 'Accept Connection')) . '"></span>' . '</a>' . ' <a href="' . $_CB_framework->viewUrl('denyconnection', true, array('act' => 'manage', 'connectionid' => (int) $connected->referenceid)) . '" >' . '<span class="fa fa-times-circle-o" title="' . htmlspecialchars(CBTxt::T('UE_REMOVECONNECTION', 'Remove Connection')) . '"></span>' . '</a>';
                 } else {
                     $actionImg = null;
                 }
                 $return .= '<div class="containerBox img-thumbnail">' . '<div class="containerBoxInner" style="min-height: 130px; min-width: 90px;">' . $actionImg . '<br />' . $cbUser->getField('onlinestatus', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . ' ' . $cbUser->getField('formatname', null, 'html', 'none', 'list', 0, true) . '<br />' . $tooltip . '<br />' . ' <a href="' . $_CB_framework->userProfileUrl((int) $connected->referenceid) . '">' . '<span class="fa fa-user" title="' . htmlspecialchars(CBTxt::T('UE_VIEWPROFILE', 'View Profile')) . '"></span>' . '</a>' . ' ' . $cbUser->getField('email', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . ' ' . $cbUser->getField('pm', null, 'html', 'none', 'profile', 0, true, array('_imgMode' => 1)) . '</div>' . '</div>';
             }
             $return .= '</div>' . '<div class="form-group cb_form_line clearfix">' . '<input type="button" class="btn btn-default cbMngConnCancel" value="' . htmlspecialchars(CBTxt::Th('UE_CANCEL', 'Cancel')) . '" onclick="window.location=\'' . $_CB_framework->userProfileUrl() . '\'; return false;" />' . '</div>';
         }
         $return .= $tabs->endTab();
     }
     $return .= $tabs->endPane() . '</div>' . cbPoweredBy();
     echo $return;
     $_CB_framework->setMenuMeta();
 }
 /**
  * Adds a html head tag once for the calendar if needed.
  * @access private
  *
  */
 function _addHeadTag()
 {
     global $_CB_framework;
     static $added = array(1 => false, 2 => false);
     if (!$added[$this->calendarType]) {
         $UElanguagePath = $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/language';
         if (file_exists($UElanguagePath . '/' . $_CB_framework->getCfg('lang') . '/calendar-locals.js')) {
             $calendarLangFile = '/components/com_comprofiler/plugin/language/' . $_CB_framework->getCfg('lang') . '/calendar-locals.js';
         } elseif (file_exists($UElanguagePath . '/' . strtolower($_CB_framework->getCfg('lang_tag')) . '/calendar-locals.js')) {
             $calendarLangFile = '/components/com_comprofiler/plugin/language/' . strtolower($_CB_framework->getCfg('lang_tag')) . '/calendar-locals.js';
         } else {
             $calendarLangFile = '/components/com_comprofiler/plugin/language/default_language/calendar-locals.js';
         }
         if ($this->calendarType == 1) {
             $_CB_framework->document->addHeadStyleSheet(selectTemplate($this->ui) . 'calendar.css', false, null, array('title' => 'win2k-cold-1'));
             $_CB_framework->document->addHeadScriptUrl('/components/com_comprofiler/js/calendar.js', true);
             $_CB_framework->document->addHeadScriptUrl($calendarLangFile, false, null, null, null, null, array('type' => 'text/javascript', 'charset' => 'utf-8'));
             $_CB_framework->document->addHeadScriptUrl('/components/com_comprofiler/js/calendar-setup.js', true);
         } else {
             $_CB_framework->document->addHeadScriptUrl($calendarLangFile, false, 'var cbTemplateDir="' . selectTemplate($this->ui) . '"; Calendar = function () { };', null, null, null, array('type' => 'text/javascript', 'charset' => 'utf-8'));
             $_CB_framework->addJQueryPlugin('cb_calendarinput', '/components/com_comprofiler/js/calendardateinput.js');
         }
         $added[$this->calendarType] = true;
     }
 }
Пример #19
0
							<div class="cbFeedItemLogo media-object"><?php echo modCBAdminHelper::descriptionIcon( $item->description ); ?></div>
						</a>
						<div class="media-body">
							<h4 class="cbFeedItemTitle media-heading"><a href="<?php echo htmlspecialchars( $item->link ); ?>" target="_blank"><strong><?php echo $item->title; ?></strong></a></h4>
							<div class="cbFeedItemDesc"><?php echo modCBAdminHelper::shortDescription( $item->description, 200 ); ?></div>
							<small class="cbFeedItemDate"><?php echo cbFormatDate( $item->pubDate, true, 'timeago' ); ?></small>
						</div>
					</div>
				</div>
			<?php

			if ( $feedEntries ) {
				if ( ( $itemCount >= $feedEntries ) && ( ( $index + 1 ) != count( $items ) ) ) {
					?><button type="button" class="btn btn-primary btn-lg btn-block cbFeedShowMore"><?php echo CBTxt::T( 'More' ); ?></button><?php

					$itemCount	=	0;
				}
			}
		}
?>
		</div>
	</div>
<?php
} else {
?>
	<div class="cb_template cb_template_<?php echo selectTemplate( 'dir' ); ?>">
		<div class="cbFeed"><?php echo CBTxt::T( 'There currently is no news.' ); ?></div>
	</div>
<?php
}
?>
Пример #20
0
	/**
	 * render frontend tab invites
	 *
	 * @param object $rows
	 * @param object $pageNav
	 * @param moscomprofilerUser $displayed
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @param boolean $tabbed
	 * @return mixed
	 */
	static function showInvites( $rows, $pageNav, $displayed, $user, $plugin, $tabbed ) {
		global $_CB_framework;

		$invitesTabSearch			=	$plugin->params->get( 'invites_tab_search', 1 );
		$invitesTabPaging			=	$plugin->params->get( 'invites_tab_paging', 1 );
		$invitesTabLimitbox			=	$plugin->params->get( 'invites_tab_limitbox', 1 );

		if ( ! $tabbed ) {
			$formUrl				=	cbgjClass::getPluginURL( array( 'panel', 'invites' ) );
		} else {
			$formUrl				=	$_CB_framework->userProfileUrl( $displayed->id, true, $plugin->tab->tabid );
		}

		$return						=	'<div class="gjTabInvites">'
									.		'<form action="' . $formUrl . '" method="post" name="gjTabForm_invites" id="gjTabForm_invites" class="gjForm">'
									.			( $invitesTabSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null );

		if ( $rows ) {
			$return					.=		'<div class="gjContent">';

			foreach ( $rows as $row ) {
				$group				=	$row->getGroup();
				$category			=	$group->getCategory();

				if ( $row->get( 'user' ) ) {
					$userAvatar		=	$row->getInvitedAvatar( true );
					$userName		=	$row->getInvitedName( true );
					$userOnline		=	$row->getInvitedOnline();
				} else {
					$userAvatar		=	'<img src="' . selectTemplate() . 'images/avatar/tnnophoto_n.png" alt="' . htmlspecialchars( $row->get( 'email' ) ) . '" title="' . htmlspecialchars( $row->get( 'email' ) ) . '" />';
					$userName		=	'******' . htmlspecialchars( $row->get( 'email' ) ) . '">' . htmlspecialchars( $row->get( 'email' ) ) . '</a>';
					$userOnline		=	null;
				}

				$menuItems			=	cbgjClass::getIntegrations( 'gj_onBeforeProfileGroupInviteMenu', array( $row, $group, $category, $displayed, $user, $plugin ) )
									.	'<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'delete', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::T( 'Are you sure you want to delete this invite?' ) ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>'
									.	cbgjClass::getIntegrations( 'gj_onAfterProfileGroupInviteMenu', array( $row, $group, $category, $displayed, $user, $plugin ) );

				$return				.=			'<div class="gjContentBox mini-layout">'
									.				'<div class="gjContentBoxRow">' . $userName . '</div>'
									.				'<div class="gjContentBoxRow">' . $userAvatar . '</div>'
									.				( $userOnline ? '<div class="gjContentBoxRow">' . $userOnline . '</div>' : null )
									.				'<div class="gjContentBoxRow">' . $group->getName( 0, true ) . '</div>'
									.				'<div class="gjContentBoxRow">' . $category->getName( 0, true ) . '</div>'
									.				'<div class="gjContentBoxRow">'
									.					cbgjClass::getIntegrations( 'gj_onBeforeProfileGroupInviteInfo', array( $row, $group, $category, $displayed, $user, $plugin ) )
									.					'<span title="' . cbFormatDate( $row->get( 'invited' ), 1, false ) . ( $row->isAccepted() ? ' - ' . cbFormatDate( $row->get( 'accepted' ), 1, false ) : null ) . '">' . $row->getStatus() . '</span>'
									.					cbgjClass::getIntegrations( 'gj_onAfterProfileGroupInviteInfo', array( $row, $group, $category, $displayed, $user, $plugin ) )
									.				'</div>';

				if ( ( ! $row->isAccepted() ) && ( $row->dateDifference() >= 5 ) ) {
					$return			.=				'<div class="gjContentBoxRow">'
									.					'<input type="button" value="' . htmlspecialchars( CBTxt::Th( 'Resend' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'send', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), true ) . '" />'
									.				'</div>';
				}

				$return				.=				'<div class="gjContentBoxRow">'
									.					cbgjClass::getDropdown( $menuItems, CBTxt::Th( 'Menu' ) )
									.				'</div>';

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

			$return					.=		'</div>';
		} else {
			$return					.=			'<div class="gjContent">';

			if ( $invitesTabSearch && $pageNav->searching ) {
				$return				.=				CBTxt::Th( 'No invite search results found.' );
			} else {
				if ( $displayed->id == $user->id ) {
					$return			.=				CBTxt::Th( 'You have no invites.' );
				} else {
					$return			.=				CBTxt::Th( 'This user has no invites.' );
				}
			}

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

		if ( $invitesTabPaging ) {
			$return					.=			'<div class="gjPaging pagination pagination-centered">'
									.				( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null )
									.				( ! $invitesTabLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) )
									.			'</div>';
		}

		$return						.=			cbGetSpoofInputTag( 'plugin' )
									.		'</form>'
									.	'</div>';

		return $return;
	}
Пример #21
0
        }
        /** @noinspection PhpIncludeInspection */
        require JModuleHelper::getLayoutPath('mod_cbadmin', 'updates');
        break;
    case 3:
        static $JS2_loaded = 0;
        if (!$JS2_loaded++) {
            $js = "cbFeedShow = function( element, settings, event, api ) {" . "\$( api.elements.target ).addClass( 'cbFeedItemActive' );" . "};" . "cbFeedHide = function( element, settings, event, api ) {" . "\$( api.elements.target ).removeClass( 'cbFeedItemActive' );" . "};";
            $_CB_framework->outputCbJQuery($js);
        }
        $xml = modCBAdminHelper::getFeedXML('http://www.joomlapolis.com/news?format=feed&type=rss', 'cbnewsfeed.xml', $feedDuration);
        if ($xml) {
            $items = $xml->xpath('//channel/item');
            /** @noinspection PhpIncludeInspection */
            require JModuleHelper::getLayoutPath('mod_cbadmin', 'news');
        }
        break;
    case 2:
    case 1:
    default:
        $menu = array();
        /** @noinspection PhpIncludeInspection */
        require JModuleHelper::getLayoutPath('mod_cbadmin', 'menu');
        if ($mode == 2) {
            $return = '<div class="cb_template cb_template_' . selectTemplate('dir') . '">' . modCBAdminHelper::getTable($menu, $disabled) . '</div>';
            echo $return;
        } else {
            echo modCBAdminHelper::getMenu($menu, $disabled);
        }
        break;
}
Пример #22
0
 public function loadDefaultImages($name, $value, $control_name, $basePath = 'avatar')
 {
     $values = array();
     $values[] = moscomprofilerHTML::makeOption('', CBTxt::T('Normal CB Default'));
     $values[] = moscomprofilerHTML::makeOption('none', CBTxt::T('No image'));
     if (is_dir(selectTemplate('absolute_path', null, 1) . '/images/' . $basePath)) {
         foreach (scandir(selectTemplate('absolute_path', null, 1) . '/images/' . $basePath) as $avatar) {
             if (!preg_match('/^tn/', $avatar) && preg_match('!^[\\w-]+[.](jpg|jpeg|png|gif)$!', $avatar)) {
                 $values[] = moscomprofilerHTML::makeOption($avatar, $avatar);
             }
         }
     }
     return $values;
 }
Пример #23
0
 /**
  * Method to load jQuery frameworks and non-conflicting javascript code into the document head
  * Loading and use is done in "deep non-conflict mode", which allows several concurent versions of jQuery to be loaded and run simultaneously with any other javascript framework, including another conflicting jQuery instance.
  * It means that the window's Javascript global namespace is not used in a fixed way: neither $ nor jQuery global variables are used. Reference: http://api.jquery.com/jQuery.noConflict/
  *
  * Outputs to head
  *
  * @return void
  */
 function getAllJsPageCodes()
 {
     // jQuery code loading:
     if (count($this->_jQueryCodes) > 0) {
         foreach (array_keys($this->_jQueryPlugins) as $plugin) {
             if (isset($this->_jqueryCssFiles[$plugin])) {
                 foreach ($this->_jqueryCssFiles[$plugin] as $templateFile => $minExistsmedia) {
                     $templateFileWPath = selectTemplate('absolute_path') . '/' . $templateFile;
                     if (file_exists($templateFileWPath)) {
                         $templateFileUrl = selectTemplate('relative_path') . '/' . $templateFile;
                     } else {
                         $templateFileUrl = selectTemplate('relative_path', 'default') . '/' . $templateFile;
                     }
                     if (!isset($this->_jQueryPluginsSent[$templateFileUrl])) {
                         $this->document->addHeadStyleSheet($templateFileUrl, $minExistsmedia[0], $minExistsmedia[1]);
                         $this->_jQueryPluginsSent[$templateFileUrl] = true;
                     }
                 }
             }
             if (isset($this->_jqueryJsFiles[$plugin])) {
                 foreach ($this->_jqueryJsFiles[$plugin] as $jsFile => $minExists) {
                     $jsFilePath = '/components/com_comprofiler/js/' . $jsFile;
                     if (!isset($this->_jQueryPluginsSent[$jsFilePath])) {
                         $this->document->addHeadScriptUrl($jsFilePath, $minExists);
                         $this->_jQueryPluginsSent[$jsFilePath] = true;
                     }
                 }
             }
         }
         /*
         			if ( FALSE && checkJversion() >= 2 && is_callable( array( 'JHtml', 'isCallable_' ) ) && JHtml::isCallable_('behavior.jquery' ) ) {
         				// Based on proposed contribution of 12.01.2012 to Joomla:
         				JHtml::_('behavior.jquery', _CB_JQUERY_VERSION, 'components/com_comprofiler/js/jquery-' . _CB_JQUERY_VERSION . '/', null, trim( implode( "\n", $this->_jQueryCodes ) ));
         				$plugins = array();
         				foreach ($this->_jQueryPlugins as $k => $v) {
         					$matches	=	null;
         					if ( preg_match( '|^/?(.+/)([^/]+)(?:\.min)?\.js$|', $v, $matches ) ) {
         						JHtml::_('behavior.jquery', _CB_JQUERY_VERSION, $matches[1], array( $matches[2] ) );
         					}
         				}
         				// JHtml::_('behavior.jquery', _CB_JQUERY_VERSION, 'components/com_comprofiler/../com_comprofiler/js/jquery-' . _CB_JQUERY_VERSION . '/', array( 'jquery.autogrow', 'jquery.colorinput', 'jquery.jmap'), '$("p").css("color","red");');
         				// JHtml::_('behavior.jquery', '1.6.7', 'components/com_comprofiler/js/../js/jquery-' . _CB_JQUERY_VERSION . '/', array( 'jquery.autogrow', 'jquery.colorinput', 'jquery.jmap'), '$("p").css("color","red") ;');
         			} else {
         */
         // Store previous defines if present so they can be restored later:
         $preJquery = "if ( typeof window.\$ != 'undefined' ) {" . "\n\t" . 'window.cbjqldr_tmpsave$ = window.$;' . "\n" . '}' . "\n" . "if ( typeof window.jQuery != 'undefined' ) {" . "\n\t" . 'window.cbjqldr_tmpsavejquery = window.jQuery;' . "\n" . '}';
         static $cbjqueryloaded = false;
         if (!defined('CB_JQUERY_LOADED')) {
             global $ueConfig;
             $loadJquery = isset($ueConfig['jsJquery']) ? (int) $ueConfig['jsJquery'] : 1;
             if ($loadJquery || $this->getUi() == 2) {
                 // Define CBs deep no conflict and redefine jquery variables for usage inside of CB plugins and jquery scripts:
                 $postJquery = 'var cbjQuery = jQuery.noConflict( true );';
                 $this->document->addHeadScriptUrl('/components/com_comprofiler/js/jquery/jquery-' . _CB_JQUERY_VERSION . '.js', true, $preJquery, $postJquery);
                 $cbjqueryloaded = true;
                 $preJquery = '';
             }
             define('CB_JQUERY_LOADED', 1);
         }
         // Let's set the cbjquery selector if cb's jquery was never used:
         if (!$cbjqueryloaded) {
             static $cbjquerySet = 0;
             if (!$cbjquerySet++) {
                 $preJquery .= "\n" . 'var cbjQuery = window.jQuery;' . "\n";
             }
         }
         // Now that the existing $ and jQuery are saved, impose use of CB's jQuery for CB plugins:
         $preJquery .= 'window.$ = cbjQuery;' . "\n" . 'window.jQuery = cbjQuery;';
         foreach ($this->_jQueryPlugins as $plugin => $pluginPath) {
             if (!isset($this->_jQueryPluginsSent[$plugin])) {
                 $this->document->addHeadScriptUrl($pluginPath, true, $preJquery, null, $plugin == 'excanvas' ? '<!--[if lte IE 8]>' : '', $plugin == 'excanvas' ? '<![endif]-->' : '');
                 $preJquery = null;
                 $this->_jQueryPluginsSent[$plugin] = true;
             }
         }
         // If no plugins outputed, we still need to have the $preJquery initializations:
         $jsCodeTxt = $preJquery;
         $jQcodes = trim(implode("\n", $this->_jQueryCodes));
         if ($jQcodes !== '') {
             $jsCodeTxt .= 'cbjQuery( document ).ready( function( $ ) {' . "\n" . 'var jQuery = $;' . "\n" . $jQcodes . "\n" . "});" . "\n";
         }
         $this->_jQueryCodes = array();
         $jsCodeTxt .= "if ( typeof window.cbjqldr_tmpsave\$ != 'undefined' ) {" . "\n\t" . 'window.$ = window.cbjqldr_tmpsave$;' . "\n" . '}' . "\n" . "if ( typeof window.cbjqldr_tmpsavejquery != 'undefined' ) {" . "\n\t" . 'window.jQuery = window.cbjqldr_tmpsavejquery;' . "\n" . '}';
         $this->document->addHeadScriptDeclaration($jsCodeTxt);
         /*
         			}
         */
     }
     // classical standalone javascript loading (for compatibility), depreciated ! :
     if (count($this->_jsCodes) > 0) {
         $this->document->addHeadScriptDeclaration(implode("\n", $this->_jsCodes));
         $this->_jsCodes = array();
     }
 }
Пример #24
0
					</div>
				</div>
			<?php 
        if ($feedEntries) {
            if ($itemCount >= $feedEntries && $index + 1 != count($items)) {
                ?>
<button type="button" class="btn btn-primary btn-lg btn-block cbFeedShowMore"><?php 
                echo CBTxt::T('More');
                ?>
</button><?php 
                $itemCount = 0;
            }
        }
    }
    ?>
		</div>
	</div>
<?php 
} else {
    ?>
	<div class="cb_template cb_template_<?php 
    echo selectTemplate('dir');
    ?>
">
		<div class="cbFeed"><?php 
    echo CBTxt::T('There currently is no news.');
    ?>
</div>
	</div>
<?php 
}
 /**
  * Loads CB template rendering engine...
  *
  */
 static function _cbTemplateLoad()
 {
     global $_PLUGINS;
     static $loaded = array();
     $element = selectTemplate('dir');
     $templatePhpFile = selectTemplate('absolute_path') . '/' . $element . '.php';
     if (!is_readable($templatePhpFile)) {
         $element = 'default';
     }
     if (!isset($loaded[$element])) {
         $_PLUGINS->loadPluginGroup('templates', $element);
         $loaded[$element] = true;
     }
     return $element;
 }
 function cbPoweredBy()
 {
     global $ueConfig;
     if (isset($ueConfig['poweredBy']) && !$ueConfig['poweredBy']) {
         return null;
     }
     $input = Application::Input();
     $url = $input->get('server/SERVER_NAME', null, GetterInterface::STRING) . $input->get('server/REQUEST_URI', null, GetterInterface::STRING);
     $urls = array(array('title' => 'social network platform', 'url' => 'http://www.joomlapolis.com/social-networking?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'community software', 'url' => 'http://www.joomlapolis.com/community-builder?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'online community software', 'url' => 'http://www.joomlapolis.com/community-builder?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'social networking software', 'url' => 'http://www.joomlapolis.com/community-builder?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'open source social networking', 'url' => 'http://www.joomlapolis.com/social-networking?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'social network script', 'url' => 'http://www.joomlapolis.com/community-builder?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'social community software', 'url' => 'http://www.joomlapolis.com/community-builder?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'online social networking', 'url' => 'http://www.joomlapolis.com/community-builder?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'social websites', 'url' => 'http://www.joomlapolis.com/social-networking?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'online community sites', 'url' => 'http://www.joomlapolis.com/community-builder?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'how to build a social networking site', 'url' => 'http://www.joomlapolis.com?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'how to create a social network', 'url' => 'http://www.joomlapolis.com?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'online membership sites', 'url' => 'http://www.joomlapolis.com/cb-solutions/cbsubs?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'online paid subscription sites', 'url' => 'http://www.joomlapolis.com/cb-solutions/cbsubs?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'membership sites', 'url' => 'http://www.joomlapolis.com/cb-solutions/cbsubs?pk_campaign=in-cb&pk_kwd=poweredby'), array('title' => 'paid membership sites', 'url' => 'http://www.joomlapolis.com/cb-solutions/cbsubs?pk_campaign=in-cb&pk_kwd=poweredby'));
     list($urlBits) = sscanf(substr(md5($url), -4), '%4x');
     $key = $urlBits % count($urls);
     $return = '<div class="cbPoweredBy cb_template cb_template_' . selectTemplate('dir') . '">' . '<div class="text-center text-small content-spacer">' . '<a title="' . htmlspecialchars($urls[$key]['title']) . '" href="' . htmlspecialchars($urls[$key]['url']) . '" target="_blank">' . 'Powered by Community Builder' . '</a>' . '</div>' . '</div>';
     return $return;
 }
Пример #27
0
	/**
	 * Displays legacy login captcha
	 *
	 * @return null|string
	 */
	public function legacyCaptchaLogin()
	{
		$return			=	null;

		if ( $this->params->get( 'captcha_legacy_login', 0 ) ) {
			$return		=	'<div class="cbLegacyLoginCaptcha cb_template cb_template_' . selectTemplate( 'dir' ) . '">'
						.		cbantispamCaptcha::getInstance( uniqid( 'legacyCaptchaLogin' ), $this->params->get( 'captcha_legacy_login_mode', null ) )->getCaptchaHTML()
						.	'</div>';
		}

		return $return;
	}