Esempio n. 1
0
	protected function getOptions() {
		if ( ( ! file_exists( JPATH_SITE . '/libraries/CBLib/CBLib/Core/CBLib.php' ) ) || ( ! file_exists( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ) ) ) {
			return array();
		}

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

		cbimport( 'language.front' );

		$db					=	JFactory::getDBO();

		$options			=	array();

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

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

		return $options;
	}
Esempio n. 2
0
	/**
	 * @return array
	 */
	protected function getGroups()
	{
		global $_PLUGINS;

		static $loaded				=	0;

		if ( ! $loaded++ ) {
			include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );

			cbimport( 'cb.html' );
			cbimport( 'language.all' );

			$_PLUGINS->loadPluginGroup( 'user' );
		}

		$groups						=	CBGroupJive::getGroupOptions();
		$options					=	array();
		$optGroup					=	0;

		foreach ( $groups as $group ) {
			if ( is_array( $group->value ) ) {
				$optGroup			=	$group->text;

				continue;
			}

			$options[$optGroup][]	=	$group;
		}

		return $options;
	}
Esempio n. 3
0
	/**
	 * @param cbautoactionsActionTable $trigger
	 * @param UserTable $user
	 */
	public function execute( $trigger, $user )
	{
		$params					=	$trigger->getParams()->subTree( 'loginlogout' );

		cbimport( 'cb.authentication' );

		$cbAuthenticate			=	new CBAuthentication();

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

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

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

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

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

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

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

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

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

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

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

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

			if ( $redirect ) {
				cbRedirect( $redirect, ( $resultError ? $resultError : ( $message ? $message : CBTxt::T( 'LOGOUT_SUCCESS', 'You have successfully logged out' ) ) ), ( $resultError ? 'error' : 'message' ) );
			}
		}
	}
Esempio n. 4
0
 protected function getOptions()
 {
     global $_CB_database;
     if (!file_exists(JPATH_SITE . '/libraries/CBLib/CBLib/Core/CBLib.php') || !file_exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php')) {
         return array();
     }
     /** @noinspection PhpIncludeInspection */
     include_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
     cbimport('cb.html');
     cbimport('language.front');
     $query = 'SELECT f.*' . "\n FROM " . $_CB_database->NameQuote('#__comprofiler_fields') . " AS f" . "\n LEFT JOIN " . $_CB_database->NameQuote('#__comprofiler_tabs') . " AS t" . ' ON t.' . $_CB_database->NameQuote('tabid') . ' = f.' . $_CB_database->NameQuote('tabid') . "\n WHERE f." . $_CB_database->NameQuote('published') . " = 1" . "\n AND f." . $_CB_database->NameQuote('name') . " != " . $_CB_database->Quote('NA') . "\n ORDER BY t." . $_CB_database->NameQuote('ordering') . ", f." . $_CB_database->NameQuote('ordering');
     $_CB_database->setQuery($query);
     $fields = $_CB_database->loadObjectList(null, '\\CB\\Database\\Table\\FieldTable', array(&$_CB_database));
     $options = array();
     /** @var FieldTable[] $fields */
     if ($fields) {
         foreach ($fields as $field) {
             if (count($field->getTableColumns())) {
                 $title = CBTxt::T($field->title);
                 $options[] = JHtml::_('select.option', $field->name, $title ? $title . ' (' . $field->name . ')' : $field->name);
             }
         }
     }
     return $options;
 }
Esempio n. 5
0
 public static function getCBAvatar($id)
 {
     $files = JPATH_SITE . 'administrator/components/com_comprofiler/plugin.foundation.php';
     if (!JFile::exists($files)) {
         $avatar = self::getDefaultAvatar();
         return $avatar;
     }
     require_once $files;
     cbimport('cb.database');
     cbimport('cb.tables');
     cbimport('cb.tabs');
     $user = CBuser::getInstance($id);
     if (!$id) {
         $avatar = self::getDefaultAvatar();
         return $avatar;
     }
     if (!$user) {
         $user = CBuser::getInstance(null);
     }
     ob_start();
     $source = $user->getField('avatar', null, 'php');
     $reset = ob_get_contents();
     ob_end_clean();
     unset($reset);
     $source = $source['avatar'];
     $source = str_replace('/administrator/', '/', $source);
     return $source;
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     global $ueConfig;
     // needed for the includes below, incl. ue_config.php
     $_CB_joomla_path = JPATH_SITE;
     $_CB_joomla_adminpath = JPATH_ADMINISTRATOR;
     $_CB_adminpath = $_CB_joomla_adminpath . "/components/com_comprofiler";
     if (!file_exists($_CB_adminpath . '/plugin.class.php')) {
         if (is_callable(array('JError', 'raiseWarning'))) {
             JError::raiseNotice('SOME_ERROR_CODE', 'Paid Subscriptions bot detected that Community Builder is not installed.', '');
         } else {
             trigger_error('Paid Subscriptions bot detected that Community Builder is not installed.', E_USER_WARNING);
         }
         return;
     }
     if (!file_exists($_CB_joomla_path . '/components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/cbpaidsubscriptions.class.php')) {
         if (is_callable(array('JError', 'raiseWarning'))) {
             JError::raiseNotice('SOME_ERROR_CODE', 'Paid Subscriptions bot detected that Community Builder Paid Subscriptions plugin is not installed.', '');
         } else {
             trigger_error('Paid Subscriptions bot detected that Community Builder Paid Subscriptions plugin is not installed.', E_USER_WARNING);
         }
         return;
     }
     /** @noinspection PhpIncludeInspection */
     include_once $_CB_adminpath . '/plugin.foundation.php';
     cbimport('cb.plugins');
     //cbimport( 'cb.tabs' );		// comprofiler.class.php is not needed for sure.
     cbimport('cb.database');
     cbimport('cb.tables');
     /** @noinspection PhpIncludeInspection */
     include_once $_CB_joomla_path . '/components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/cbpaidsubscriptions.class.php';
     $this->paidsubsManager = cbpaidSubscriptionsMgr::getInstance();
 }
Esempio n. 7
0
	/**
	 * @param object $subject
	 * @param array  $config
	 */
	public function __construct( &$subject, $config )
	{
		global $_PLUGINS;

		parent::__construct( $subject, $config );

		static $CB_loaded		=	0;

		if ( ! $CB_loaded++ ) {
			if ( ( ! file_exists( JPATH_SITE . '/libraries/CBLib/CBLib/Core/CBLib.php' ) ) || ( ! file_exists( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ) ) ) {
				return;
			}

			include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );

			cbimport( 'cb.html' );
			cbimport( 'language.front' );

			$_PLUGINS->loadPluginGroup( 'user' );

			$this->_gjPlugin	=	$_PLUGINS->getLoadedPlugin( 'user', 'cbgroupjive' );

			if ( ! $this->_gjPlugin ) {
				return;
			}

			$this->_gjParams	=	$_PLUGINS->getPluginParams( $this->_gjPlugin );
		}
	}
Esempio n. 8
0
 /**
  * Outputs legacy mass mailer display
  *
  * @deprecated 2.0
  *
  * @param UserTable[]  $rows
  * @param string       $emailSubject
  * @param string       $emailBody
  * @param string       $emailAttach
  * @param string       $emailFromName
  * @param string       $emailFromAddr
  * @param string       $emailReplyName
  * @param string       $emailReplyAddr
  * @param int          $emailsPerBatch
  * @param int          $emailsBatch
  * @param int          $emailPause
  * @param bool         $simulationMode
  * @param array        $pluginRows
  */
 public function emailUsers($rows, $emailSubject, $emailBody, $emailAttach, $emailFromName, $emailFromAddr, $emailReplyName, $emailReplyAddr, $emailsPerBatch, $emailsBatch, $emailPause, $simulationMode, $pluginRows)
 {
     global $_CB_framework, $_CB_Backend_Title;
     _CBsecureAboveForm('showUsers');
     cbimport('cb.validator');
     outputCbTemplate(2);
     outputCbJs(2);
     $_CB_Backend_Title = array(0 => array('fa fa-envelope-o', CBTxt::T('Community Builder: Mass Mailer')));
     $editorSave = $_CB_framework->saveCmsEditorJS('emailbody');
     if ($editorSave) {
         $js = "\$( '.cbEmailUsersForm' ).submit( function() { " . $editorSave . "});";
     } else {
         $js = null;
     }
     cbValidator::outputValidatorJs($js);
     $emailsList = array();
     foreach (array_slice($rows, 0, 100) as $row) {
         $emailsList[] = htmlspecialchars($row->name) . ' &lt;' . htmlspecialchars($row->email) . '&gt;';
     }
     $return = '<form action="' . $_CB_framework->backendUrl('index.php') . '" method="post" name="adminForm" class="cb_form form-auto cbEmailUsersForm">' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('SEND_EMAIL_TO_TOTAL_USERS', 'Send Email to [total] users', array('[total]' => (int) count($rows))) . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . implode(', ', $emailsList) . (count($rows) > 100 ? ' <strong>' . CBTxt::Th('AND_COUNT_MORE_USERS', 'and [count] more users.', array('[count]' => (int) (count($rows) - 100))) . '</strong>' : null) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_SIMULATION_MODE_LABEL', 'Simulation Mode') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="checkbox" name="simulationmode" id="simulationmode"' . ($simulationMode ? ' checked="checked"' : null) . ' /> <label for="simulationmode">' . CBTxt::T('Do not send emails, just show me how it works') . '</label>' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_SIMULATION_MODE_TOOLTIP', 'Check this box to simulate email sending in a dry run mode. No emails are actually sent.'), CBTxt::T('MASS_MAILER_SIMULATION_MODE_LABEL', 'Simulation Mode'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_SUBJECT_LABEL', 'Email Subject') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailsubject" value="' . htmlspecialchars($emailSubject) . '" class="form-control required" size="60" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_SUBJECT_TOOLTIP', 'Type in the subject of the mass mailing (CB field substitutions are supported).'), CBTxt::T('MASS_MAILER_SUBJECT_LABEL', 'Email Subject'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_MESSAGE_LABEL', 'Email Message') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . $_CB_framework->displayCmsEditor('emailbody', $emailBody, 600, 200, 50, 7) . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_MESSAGE_TOOLTIP', 'Type in the main message body of your mass mailing (HTML editor and CB field substitutions are supported).'), CBTxt::T('MASS_MAILER_MESSAGE_LABEL', 'Email Message'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_ATTACHMENTS_LABEL', 'Email Attachments') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailattach" value="' . htmlspecialchars($emailAttach) . '" class="form-control" size="80" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_ATTACHMENTS_TOOLTIP', 'Absolute server path to file that should be attached to each email. Multiple files can be specified using a comma separator.'), CBTxt::T('MASS_MAILER_ATTACHMENTS_LABEL', 'Email Attachments'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('Substitutions for Subject, Message, and Attachments') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . CBTxt::T('You can use all CB substitutions as in most parts: e.g.: [cb:if team="winners"] Congratulations [cb:userfield field="name" /], you are in the winning team! [/cb:if]') . '</div>' . '</div>' . '</div>' . $this->_pluginRows($pluginRows) . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_FROM_NAME_LABEL', 'From Name') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailfromname" value="' . htmlspecialchars($emailFromName) . '" class="form-control" size="30" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_FROM_NAME_TOOLTIP', 'The name to be used in the From field of email. If left empty the CB and Joomla configuration defaults will be used.'), CBTxt::T('MASS_MAILER_FROM_NAME_LABEL', 'From Name'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_FROM_ADDRESS_LABEL', 'From Email Address') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailfromaddr" value="' . htmlspecialchars($emailFromAddr) . '" class="form-control" size="40" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_FROM_ADDRESS_TOOLTIP', 'The email address to be user in the From field of email. If left empty the CB and Joomla settings will be used.'), CBTxt::T('MASS_MAILER_FROM_ADDRESS_LABEL', 'From Email Address'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_REPLY_TO_NAME_LABEL', 'Reply-To Name') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailreplyname" value="' . htmlspecialchars($emailReplyName) . '" class="form-control" size="30" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_REPLY_TO_NAME_TOOLTIP', 'The Reply-To Name value to be used in the From field of email. If left empty the CB and Joomla settings will be used.'), CBTxt::T('MASS_MAILER_REPLY_TO_NAME_LABEL', 'Reply-To Name'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_REPLY_TO_ADDRESS_LABEL', 'Reply-To Email Address') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailreplyaddr" value="' . htmlspecialchars($emailReplyAddr) . '" class="form-control" size="40" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_REPLY_TO_ADDRESS_TOOLTIP', 'The Reply-To Email address to be used in the email.'), CBTxt::T('MASS_MAILER_REPLY_TO_ADDRESS_LABEL', 'Reply-To Email Address'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_EMAILS_PER_BATCH_LABEL', 'Emails per batch') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailsperbatch" value="' . htmlspecialchars($emailsPerBatch) . '" class="form-control required digits" size="12" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_EMAILS_PER_BATCH_TOOLTIP', 'The number of emails to be sent in each batch (default 50).'), CBTxt::T('MASS_MAILER_EMAILS_PER_BATCH_LABEL', 'Emails per batch'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_SECONDS_BETWEEN_BATCHES_LABEL', 'Seconds of pause between batches') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailpause" value="' . htmlspecialchars($emailPause) . '" class="form-control required digits" size="12" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_SECONDS_BETWEEN_BATCHES_TOOLTIP', 'The number of seconds to pause between batch sending (default is 30 sec).'), CBTxt::T('MASS_MAILER_SECONDS_BETWEEN_BATCHES_LABEL', 'Seconds of pause between batches'), false, 4) . '</div>' . '</div>' . '</div>' . '<input type="hidden" name="option" value="com_comprofiler" />' . '<input type="hidden" name="view" value="emailusers" />' . '<input type="hidden" name="boxchecked" value="0" />';
     foreach ($rows as $row) {
         $return .= '<input type="hidden" name="cid[]" value="' . (int) $row->id . '">';
     }
     $return .= cbGetSpoofInputTag('user') . '</form>';
     echo $return;
 }
Esempio n. 9
0
 function display()
 {
     $cbinclude = JPATH_ADMINISTRATOR . DS . "components" . DS . "com_comprofiler" . DS . "plugin.foundation.php";
     if (!file_exists($cbinclude)) {
         JError::raiseNotice(1, JText::_('FACTORY_CB_NOT_INSTALLED'));
         return;
     }
     require_once $cbinclude;
     cbimport('language.all');
     $integrationFields = JTheFactoryIntegrationCB::getIntegrationFields();
     $integrationArray = JTheFactoryIntegrationCB::getIntegrationArray();
     $database = JFactory::getDBO();
     $query = "SELECT `name` as value,`title` as text FROM #__comprofiler_fields order by `name`";
     $database->setQuery($query);
     $cbfields = $database->loadObjectList();
     foreach ($cbfields as &$f) {
         $f->text = defined($f->text) ? constant($f->text) : $f->text;
     }
     $cbfields = array_merge(array(JHTML::_("select.option", '', '-' . JText::_("FACTORY_NONE") . '-')), $cbfields);
     $view = $this->getView();
     $view->assignRef('integrationFields', $integrationFields);
     $view->assignRef('integrationArray', $integrationArray);
     $view->assignRef('cbfields', $cbfields);
     $view->assign('cb_detected', JTheFactoryIntegrationCB::detectIntegration());
     $view->display();
 }
Esempio n. 10
0
 function __construct()
 {
     $fbConfig =& CKunenaConfig::getInstance();
     $cbpath = KUNENA_ROOT_PATH_ADMIN . DS . 'components' . DS . 'com_comprofiler' . DS . 'plugin.foundation.php';
     if (file_exists($cbpath)) {
         include_once $cbpath;
         cbimport('cb.database');
         cbimport('cb.tables');
         cbimport('language.front');
         cbimport('cb.tabs');
         define("KUNENA_CB_ITEMID_SUFFIX", getCBprofileItemid());
         if ($fbConfig->fb_profile == 'cb') {
             $params = array();
             $this->trigger('onStart', $params);
         }
     }
     if ($this->_detectIntegration() === false) {
         $fbConfig->pm_component = $fbConfig->pm_component == 'cb' ? 'none' : $fbConfig->pm_component;
         $fbConfig->avatar_src = $fbConfig->avatar_src == 'cb' ? 'kunena' : $fbConfig->avatar_src;
         $fbConfig->fb_profile = $fbConfig->fb_profile == 'cb' ? 'kunena' : $fbConfig->fb_profile;
     } else {
         if ($this->useProfileIntegration() === false) {
             $fbConfig->fb_profile = $fbConfig->fb_profile == 'cb' ? 'kunena' : $fbConfig->fb_profile;
         }
     }
 }
Esempio n. 11
0
 public function __construct(&$subject, $config)
 {
     // Do not load if Kunena version is not supported or Kunena is offline
     if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('3.0') && KunenaForum::installed())) {
         return;
     }
     $app = JFactory::getApplication();
     // Do not load if CommunityBuilder is not installed
     $path = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
     if (!is_file($path)) {
         return;
     }
     require_once $path;
     cbimport('cb.database');
     cbimport('cb.tables');
     cbimport('language.front');
     cbimport('cb.tabs');
     cbimport('cb.field');
     global $ueConfig;
     parent::__construct($subject, $config);
     $this->loadLanguage('plg_kunena_comprofiler.sys', JPATH_ADMINISTRATOR) || $this->loadLanguage('plg_kunena_comprofiler.sys', KPATH_ADMIN);
     require_once __DIR__ . "/integration.php";
     if ($app->isAdmin() && (!isset($ueConfig['version']) || version_compare($ueConfig['version'], $this->minCBVersion) < 0)) {
         $app->enqueueMessage(JText::sprintf('PLG_KUNENA_COMPROFILER_WARN_VERSION', $this->minCBVersion), 'notice');
     }
 }
Esempio n. 12
0
 public function logoutUser()
 {
     cbimport('cb.authentication');
     $cbAuthenticate = new CBAuthentication();
     $redirect_url = KunenaRoute::current();
     $resultError = $cbAuthenticate->logout($redirect_url);
     return $resultError ? $resultError : null;
 }
/**
 * Installs CBSubs, final part (ECHOs banners)
 *
 * @return void
 */
function plug_cbpaidsubscriptions_install()
{
    global $_CB_framework, $_CB_database;
    $installedVersion = '4.0.0';
    //CBSUBS_VERSION_AUTOMATICALLY_SET_DO_NOT_EDIT!!!
    ?>
<div style="width:100%;text-align:center">

	<div>
		<img alt="CBSubs Logo" height="300" width="300" src="<?php 
    echo $_CB_framework->getCfg('live_site');
    ?>
/components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/icons/normal/cbsubs_logo_300.jpg" />
	</div>
	<h1>CBSubs <?php 
    echo $installedVersion;
    ?>
</h1>
    <p><strong>Copyright &copy; 2007-2015 and Trademark of Lightning MultiCom SA, Switzerland - www.joomlapolis.com - and its licensors, all rights reserved</strong></p>
    <p><strong>CBSubs is a Trademark of Lightning MultiCom SA, Switzerland, and its licensors. CB, Community Builder and Joomlapolis are also a trademark of joomlapolis.com and may not be used without permission from the trademark holders.</strong></p>
    <p>The copyright holders have spent massive time on this software and are continuing to improve it. A corresponding membership at Joomlapolis.com is required for ongoing maintenance and support.</p>
    <p>All copyright statements must be kept.</p> 
    <p><em>Official site: <a href="http://www.joomlapolis.com?pk_campaign=in-cb&amp;pk_kwd=installed-cbsubs">www.joomlapolis.com</a></em></p>
		
</div>

<?php 
    // Temporary fix in CBSubs 1.2.2 only for CBSubs 1.2.1 bug:
    if (checkJversion() >= 1 && $installedVersion == '1.2.2') {
        $sql = "UPDATE #__users" . " SET password = concat(md5(concat(password,'12345678901234567890123456789012')),':','12345678901234567890123456789012')" . " WHERE ( LENGTH(password) < 65 )" . " AND ( LENGTH(password) > 3 )" . " AND ( registerDate > '2011-07-13 12:00:00' )";
        $_CB_database->setQuery($sql);
        $_CB_database->query();
    }
    // Temporary fix in CBSubs 1.3.0 for CBSubs 1.2.x bug:
    // Ogone gateway was not transfering address from basket:
    $sql = 'UPDATE #__cbsubs_payments p' . ' LEFT JOIN #__cbsubs_payment_baskets b ON p.payment_basket_id = b.id' . ' SET ' . ' p.`address_street` = b.`address_street`,' . ' p.`address_city` = b.`address_city`,' . ' p.`address_state` = b.`address_state`,' . ' p.`address_zip` = b.`address_zip`,' . ' p.`address_country` = b.`address_country`,' . ' p.`address_country_code` = b.`address_country_code`,' . ' p.`payer_business_name` = b.`payer_business_name`,' . ' p.`payer_email` = b.`payer_email`,' . ' p.`contact_phone` = b.`contact_phone`,' . ' p.`vat_number` = b.`vat_number`' . " WHERE p.payment_method IN ('ogone','swisspostfinance')" . ' AND ISNULL(p.`address_country_code`);';
    $_CB_database->setQuery($sql);
    $_CB_database->query();
    cbimport('cb.adminfilesystem');
    $adminFS = cbAdminFileSystem::getInstance();
    $cbsubsDir = $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions';
    // Remove old 2Checkout files if there is no 2Checkout gateway configured, as TwoCheckout is not part anymore in CBSubs 1.3:
    $sql = 'SELECT COUNT(*) FROM #__cbsubs_gateway_accounts' . ' WHERE gateway_type = "processors.twocheckout";';
    $_CB_database->setQuery($sql);
    $hasTwoCheckoutInstalled = $_CB_database->loadResult();
    $twocheckoutdir = $cbsubsDir . '/processors/twocheckout';
    if ($hasTwoCheckoutInstalled == 0 && file_exists($twocheckoutdir)) {
        $adminFS->deldir($twocheckoutdir . '/');
    }
    // Remove old 1.x and 2.x files:
    $oldfiles = array('admin.cbpaidsubscriptions.ctrl.php', 'cbpaidsubscriptions.condition.php', 'cbpaidsubscriptions.countries.php', 'cbpaidsubscriptions.crosstotalizer.php', 'cbpaidsubscriptions.ctrl.php', 'cbpaidsubscriptions.currency.php', 'cbpaidsubscriptions.gui.php', 'cbpaidsubscriptions.guisubs.php', 'cbpaidsubscriptions.importer.php', 'cbpaidsubscriptions.scheduler.php', 'cbpaidsubscriptions.sql.php', 'cbpaidsubscriptions.userparams.php');
    foreach ($oldfiles as $file) {
        $pathFile = $cbsubsDir . '/' . $file;
        if ($file && file_exists($pathFile)) {
            $adminFS->unlink($pathFile);
        }
    }
}
Esempio n. 14
0
	public function __construct() {
		$path = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
		if (!is_file ( $path )) return;

		require_once ($path);
		cbimport ( 'cb.database' );
		cbimport ( 'cb.tables' );
		cbimport ( 'language.front' );
		cbimport ( 'cb.tabs' );
		cbimport ( 'cb.field' );
		$this->loaded = self::detectErrors();
	}
Esempio n. 15
0
 public function exists()
 {
     $file = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
     if (!JFile::exists($file)) {
         return false;
     }
     require_once $file;
     cbimport('cb.database');
     cbimport('cb.tables');
     cbimport('cb.tabs');
     return true;
 }
 /**
  * Constructor (do not call directly, use DI to call it)
  *
  * Code in here was previously in plugin.foundation.php
  *
  * @param  ApplicationContainerInterface  $di  (This is injected by DI)
  */
 function __construct(ApplicationContainerInterface $di)
 {
     if (self::$loaded) {
         return;
     }
     self::$loaded = true;
     define('_CB_JQUERY_VERSION', '1.11.2');
     // IMPORTANT: when changing version here also change in the 2 XML installation files
     /**
      * CB GLOBALS and initializations
      */
     global $mainframe;
     $mainframe = JFactory::getApplication();
     /** @noinspection PhpDeprecationInspection */
     $acl = JFactory::getACL();
     $sefFunc = array('JRoute', '_');
     $getVarFunction = array('JRequest', 'getVar');
     $Jdocument = JFactory::getDocument();
     if ($Jdocument->getType() == 'html') {
         $getDocFunction = array('JFactory', 'getDocument');
     } else {
         $getDocFunction = false;
     }
     $editor = JFactory::getEditor();
     $editorDisplay = array('display' => array('call' => array($editor, 'display'), 'args' => 'noid'), 'save' => array('call' => array($editor, 'save'), 'args' => 'noid'), 'returns' => true);
     $aclParams = array('canEditUsers' => array('com_comprofiler', 'core.edit', 'users', null), 'canBlockUsers' => array('com_comprofiler', 'core.edit.state', 'users', null), 'canReceiveAdminEmails' => array('com_comprofiler', 'core.admin', 'users', null), 'canEditOwnContent' => array('com_content', 'core.edit.own', 'users', null, 'content', 'own'), 'canAddAllContent' => array('com_content', 'core.create', 'users', null, 'content', 'all'), 'canEditAllContent' => array('com_content', 'core.edit', 'users', null, 'content', 'all'), 'canPublishContent' => array('com_content', 'core.edit.state', 'users', null, 'content', 'all'), 'canInstallPlugins' => array('com_installer', 'core.manage', 'users', null), 'canManageUsers' => array('com_comprofiler', 'core.manage', 'users', null));
     /**
      * CB framework
      * @global CBframework $_CB_framework
      */
     global $_CB_framework;
     $_CB_framework = new CBframework($mainframe, $aclParams, $sefFunc, array('option' => 'com_comprofiler'), $getVarFunction, $getDocFunction, $editorDisplay);
     /** @see CBACL */
     $_CB_framework->acl = $di->get('CBACL', array('acl' => $acl));
     $di->set('CBFramework', $_CB_framework, true);
     /**
      * CB Config
      * @deprecated 2.0, use Application::Config() to get the Configuration Registry object
      * @see Application::Config()
      * @var array
      */
     global $ueConfig;
     $ueConfig['version'] = CBLIB;
     // This doesn't load if yet if in installer, as config database table may not yet be created:
     CBConfig::loadLegacyCBueConfig(true);
     if ($di->getCms()->getClientId() === 0) {
         cbimport('language.front');
     } else {
         cbimport('language.all');
     }
     define('_CB_SPOOFCHECKS', isset($ueConfig['enableSpoofCheck']) && $ueConfig['enableSpoofCheck'] ? 1 : 0);
 }
 /**
  * Fetch an http file from the URL
  *
  * @param  string  $url    URL from where to fetch
  * @return string          content, or NULL in case of error
  */
 private function _fetch_http_file($url)
 {
     cbimport('cb.snoopy');
     $s = new CBSnoopy();
     $s->read_timeout = 20;
     @$s->fetch($url);
     if ($s->error || $s->status != 200) {
         // echo '<font color="red">Connection to update server failed: ERROR: ' . $s->error . ($s->status == -100 ? 'Timeout' : $s->status).'</font>';
         $content = null;
     } else {
         $content = $s->results;
     }
     return $content;
 }
Esempio n. 18
0
 function getUserProfile($userid = 0)
 {
     $cbinclude = JPATH_ADMINISTRATOR . DS . "components" . DS . "com_comprofiler" . DS . "plugin.foundation.php";
     if (!file_exists($cbinclude)) {
         JError::raiseNotice(1, JText::_('FACTORY_CB_NOT_INSTALLED'));
         return;
     }
     require_once $cbinclude;
     cbimport('cb.database');
     cbimport('cb.tables');
     $cbUser = CBUser::getInstance($userid);
     $userdata = $cbUser->getUserData();
     $userdata->userid = $userid;
     return get_object_vars($userdata);
 }
Esempio n. 19
0
	/**
	 * Builds and sends e-mail
	 *
	 * @param UserTable  $user
	 * @param string     $mailFrom_email
	 * @param string     $mailFrom_name
	 * @param string     $mailTo
	 * @param string     $mailSubject
	 * @param string     $mailBody
	 * @param string     $mailHtml
	 * @param string     $mailCC
	 * @param string     $mailBCC
	 * @param string     $mailAttachments
	 * @param string[]   $extraStrings
	 * @return void
	 */
	protected function sendMail( $user, $mailFrom_email, $mailFrom_name, $mailTo, $mailSubject, $mailBody, $mailHtml, $mailCC, $mailBCC, $mailAttachments, $extraStrings ) {
		global $_CB_framework;

		cbimport( 'cb.tabs' );

		$cbUser					=	CBuser::getInstance( $user->id );

		if ( ! $cbUser ) {
			return;
		}

		$mailFrom_email			=	trim( $cbUser->replaceUserVars( $mailFrom_email, false, false, array(), false ) );
		$mailFrom_name			=	trim( $cbUser->replaceUserVars( $mailFrom_name, false, false, array(), false ) );
		$mailTo					=	trim( $cbUser->replaceUserVars( $mailTo, false, false, array(), false ) );
		$mailCC					=	trim( $cbUser->replaceUserVars( $mailCC, false, false, array(), false ) );
		$mailBCC				=	trim( $cbUser->replaceUserVars( $mailBCC, false, false, array(), false ) );
		$mailSubject			=	trim( $cbUser->replaceUserVars( CBPTXT::T( $mailSubject ), false, false, $extraStrings, false ) );
		$mailBody				=	trim( $cbUser->replaceUserVars( CBPTXT::T( $mailBody ), false, false, $extraStrings, false ) );
		$mailAttachments		=	trim( $mailAttachments );

		if ( $mailTo != '' ) {
			$mailTo				=	preg_split( '/ *, */', $mailTo );
		} else {
			return;
		}

		if ( $mailCC != '' ) {
			$mailCC				=	preg_split( '/ *, */', $mailCC );
		} else {
			$mailCC				=	null;
		}

		if ( $mailBCC != '' ) {
			$mailBCC			=	preg_split( '/ *, */', $mailBCC );
		} else {
			$mailBCC			=	null;
		}

		if ( $mailAttachments != '' ) {
			$mailAttachments	=	preg_split( '/ *, */', $mailAttachments );
		} else {
			$mailAttachments	=	null;
		}

		if ( $mailTo && ( $mailSubject || $mailBody ) ) {
			comprofilerMail( $mailFrom_email, $mailFrom_name, $mailTo, $_CB_framework->getCfg( 'sitename' ).' - '.$mailSubject, $mailBody, $mailHtml, $mailCC, $mailBCC, $mailAttachments );
		}
	}
Esempio n. 20
0
	/**
	 * @return array|stdClass[]
	 */
	protected function getOptions()
	{
		global $_PLUGINS;

		static $loaded		=	0;

		if ( ! $loaded++ ) {
			include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );

			cbimport( 'cb.html' );
			cbimport( 'language.all' );

			$_PLUGINS->loadPluginGroup( 'user' );
		}

		return CBGroupJive::getCategoryOptions();
	}
Esempio n. 21
0
	/**
	 * @return array
	 */
	protected function getOptions()
	{
		global $_PLUGINS;

		static $loaded		=	0;

		if ( ! $loaded++ ) {
			include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );

			cbimport( 'cb.html' );
			cbimport( 'language.all' );

			$_PLUGINS->loadPluginGroup( 'user' );
		}

		$options			=	parent::getOptions();

		$_PLUGINS->trigger( 'gj_onModuleMode', array( &$options, $this ) );

		return $options;
	}
Esempio n. 22
0
 /**
  * Outputs legacy user edit display
  *
  * @deprecated 2.0
  *
  * @param UserTable  $user
  * @param string     $option
  * @param int        $newCBuser
  * @param array      $postdata
  */
 public function edituser($user, $option, $newCBuser, &$postdata)
 {
     global $_CB_framework, $_CB_Backend_Title, $_PLUGINS;
     $results = $_PLUGINS->trigger('onBeforeUserProfileEditDisplay', array(&$user, 2));
     if ($_PLUGINS->is_errors()) {
         cbRedirect($_CB_framework->backendViewUrl('showusers'), $_PLUGINS->getErrorMSG(), 'error');
     }
     _CBsecureAboveForm('edituser');
     cbimport('cb.validator');
     outputCbTemplate(2);
     initToolTip(2);
     outputCbJs(2);
     $tabs = new cbTabs($_CB_framework->getUi() == 2 && !isset($_REQUEST['tab']) ? 1 : 0, 2);
     // use cookies in backend to remember selected tab.
     $tabcontent = $tabs->getEditTabs($user, $postdata, 'htmledit', 'divs');
     $_CB_Backend_Title = array(0 => array('fa fa-user', $user->id ? CBTxt::T('COMMUNITY_BUILDER_EDIT_USER_USERNAME', 'Community Builder: Edit User [[username]]', array('[username]' => $user->username)) : CBTxt::T('Community Builder: New User')));
     cbValidator::loadValidation();
     if (is_array($results)) {
         echo implode('', $results);
     }
     $return = '<form action="' . $_CB_framework->backendUrl('index.php') . '" method="post" name="adminForm" id="cbcheckedadminForm" enctype="multipart/form-data" autocomplete="off" class="cb_form form-auto cbValidation">' . $tabcontent . '<input type="hidden" name="id" value="' . (int) $user->id . '" />' . '<input type="hidden" name="newCBuser" value="' . (int) $newCBuser . '" />' . '<input type="hidden" name="option" value="com_comprofiler" />' . '<input type="hidden" name="view" value="save" />' . cbGetSpoofInputTag('user') . '<div class="cbIconsBottom">' . getFieldIcons(2, true, true, '', '', true) . '</div>' . '</form>';
     echo $return;
 }
Esempio n. 23
0
 /**
  * Saves legacy user edit display
  *
  * @param string $option
  * @param string $task
  */
 public function saveUser($option, $task = 'save')
 {
     global $_CB_framework, $_CB_Backend_task, $_POST, $_PLUGINS;
     cbimport('language.all');
     cbimport('cb.tabs');
     cbimport('cb.params');
     cbimport('cb.adminfilesystem');
     cbimport('cb.imgtoolbox');
     $userIdPosted = (int) cbGetParam($_POST, 'id', 0);
     if ($userIdPosted == 0) {
         $_POST['id'] = null;
     }
     $msg = $this->_authorizedEdit($userIdPosted);
     if (!$msg) {
         if ($userIdPosted != 0) {
             $msg = checkCBpermissions(array($userIdPosted), 'save', true);
         } else {
             $msg = checkCBpermissions(null, 'save', true);
         }
     }
     if ($userIdPosted != 0) {
         $_PLUGINS->trigger('onBeforeUserProfileSaveRequest', array($userIdPosted, &$msg, 2));
     }
     if ($msg) {
         cbRedirect($_CB_framework->backendViewUrl('showusers', false), $msg, 'error');
     }
     $_PLUGINS->loadPluginGroup('user');
     // Get current user state:
     if ($userIdPosted != 0) {
         $userComplete = CBuser::getUserDataInstance($userIdPosted);
         if (!($userComplete && $userComplete->id)) {
             cbRedirect($_CB_framework->backendViewUrl('showusers', false), CBTxt::T('Your profile could not be updated.'), 'error');
         }
     } else {
         $userComplete = new UserTable();
     }
     // Store new user state:
     $saveResult = $userComplete->saveSafely($_POST, $_CB_framework->getUi(), 'edit');
     if (!$saveResult) {
         $regErrorMSG = $userComplete->getError();
         $msg = checkCBpermissions(array((int) $userComplete->id), 'edit', true);
         if ($userIdPosted != 0) {
             $_PLUGINS->trigger('onBeforeUserProfileEditRequest', array((int) $userComplete->id, &$msg, 2));
         }
         if ($msg) {
             cbRedirect($_CB_framework->backendViewUrl('showusers', false), $msg, 'error');
         }
         if ($userIdPosted != 0) {
             $_PLUGINS->trigger('onAfterUserProfileSaveFailed', array(&$userComplete, &$regErrorMSG, 2));
         } else {
             $_PLUGINS->trigger('onAfterUserRegistrationSaveFailed', array(&$userComplete, &$regErrorMSG, 2));
         }
         $_CB_framework->enqueueMessage($regErrorMSG, 'error');
         $_CB_Backend_task = 'edit';
         // so the toolbar comes up...
         $_PLUGINS->loadPluginGroup('user');
         // resets plugin errors
         $userView = _CBloadView('user');
         /** @var CBController_user $userView */
         $userView->edituser($userComplete, $option, $userComplete->user_id != null ? 0 : 1, $_POST);
         return;
     }
     // Checks-in the row:
     $userComplete->checkin();
     if ($userIdPosted != 0) {
         $_PLUGINS->trigger('onAfterUserProfileSaved', array(&$userComplete, 2));
     } else {
         $messagesToUser = array();
         $_PLUGINS->trigger('onAfterSaveUserRegistration', array(&$userComplete, &$messagesToUser, 2));
     }
     if ($task == 'apply') {
         cbRedirect($_CB_framework->backendViewUrl('edit', false, array('cid' => (int) $userComplete->user_id)), CBTxt::T('SUCCESSFULLY_SAVED_USER_USERNAME', 'Successfully Saved User: [username]', array('[username]' => $userComplete->username)));
     } else {
         cbRedirect($_CB_framework->backendViewUrl('showusers', false), CBTxt::T('SUCCESSFULLY_SAVED_USER_USERNAME', 'Successfully Saved User: [username]', array('[username]' => $userComplete->username)));
     }
 }
Esempio n. 24
0
File: k2.php Progetto: emavro/k2
    function onAfterInitialise()
    {
        // Determine Joomla! version
        if (version_compare(JVERSION, '3.0', 'ge')) {
            define('K2_JVERSION', '30');
        } else {
            if (version_compare(JVERSION, '2.5', 'ge')) {
                define('K2_JVERSION', '25');
            } else {
                define('K2_JVERSION', '15');
            }
        }
        // Define the DS constant under Joomla! 3.0
        if (!defined('DS')) {
            define('DS', DIRECTORY_SEPARATOR);
        }
        // Import Joomla! classes
        jimport('joomla.filesystem.file');
        jimport('joomla.filesystem.folder');
        jimport('joomla.application.component.controller');
        jimport('joomla.application.component.model');
        jimport('joomla.application.component.view');
        // Get application
        $mainframe = JFactory::getApplication();
        // Load the K2 classes
        JLoader::register('K2Table', JPATH_ADMINISTRATOR . '/components/com_k2/tables/table.php');
        JLoader::register('K2Controller', JPATH_BASE . '/components/com_k2/controllers/controller.php');
        JLoader::register('K2Model', JPATH_ADMINISTRATOR . '/components/com_k2/models/model.php');
        if ($mainframe->isSite()) {
            K2Model::addIncludePath(JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'models');
        } else {
            // Fix warning under Joomla! 1.5 caused by conflict in model names
            if (K2_JVERSION != '15' || K2_JVERSION == '15' && JRequest::getCmd('option') != 'com_users') {
                K2Model::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2' . DS . 'models');
            }
        }
        JLoader::register('K2View', JPATH_ADMINISTRATOR . '/components/com_k2/views/view.php');
        JLoader::register('K2HelperHTML', JPATH_ADMINISTRATOR . '/components/com_k2/helpers/html.php');
        // Community Builder integration
        $componentParams = JComponentHelper::getParams('com_k2');
        if ($componentParams->get('cbIntegration') && JFile::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_comprofiler' . DS . 'plugin.foundation.php')) {
            define('K2_CB', true);
            global $_CB_framework;
            require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_comprofiler' . DS . 'plugin.foundation.php';
            cbimport('cb.html');
            cbimport('language.front');
        } else {
            define('K2_CB', false);
        }
        // Define the default Itemid for users and tags. Defined here instead of the K2HelperRoute for performance reasons.
        // UPDATE : Removed. All K2 links without Itemid now use the anyK2Link defined in the router helper.
        // define('K2_USERS_ITEMID', $componentParams->get('defaultUsersItemid'));
        // define('K2_TAGS_ITEMID', $componentParams->get('defaultTagsItemid'));
        // Define JoomFish compatibility version.
        if (JFile::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomfish' . DS . 'joomfish.php')) {
            if (K2_JVERSION == '15') {
                $db = JFactory::getDBO();
                $config = JFactory::getConfig();
                $prefix = $config->getValue('config.dbprefix');
                if (array_key_exists($prefix . '_jf_languages_ext', $db->getTableList())) {
                    define('K2_JF_ID', 'lang_id');
                } else {
                    define('K2_JF_ID', 'id');
                }
            } else {
                define('K2_JF_ID', 'lang_id');
            }
        }
        /*
        if(JRequest::getCmd('option')=='com_k2' && JRequest::getCmd('task')=='save' && !$mainframe->isAdmin()){
        	$dispatcher = JDispatcher::getInstance();
        	foreach($dispatcher->_observers as $observer){
        		if($observer->_name=='jfdatabase' || $observer->_name=='jfrouter' || $observer->_name=='missing_translation'){
        			$dispatcher->detach($observer);
        		}
        	}
        }
        */
        // Use K2 to make Joomla! Varnish-friendly
        // For more checkout: https://snipt.net/fevangelou/the-perfect-varnish-configuration-for-joomla-websites/
        $user = JFactory::getUser();
        if (!$user->guest) {
            JResponse::setHeader('X-Logged-In', 'True', true);
        } else {
            JResponse::setHeader('X-Logged-In', 'False', true);
        }
        if (!$mainframe->isAdmin()) {
            return;
        }
        $option = JRequest::getCmd('option');
        $task = JRequest::getCmd('task');
        $type = JRequest::getCmd('catid');
        if ($option != 'com_joomfish') {
            return;
        }
        if (!JFile::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2' . DS . 'lib' . DS . 'JSON.php')) {
            return;
        }
        JPlugin::loadLanguage('com_k2', JPATH_ADMINISTRATOR);
        JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2' . DS . 'tables');
        require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2' . DS . 'lib' . DS . 'JSON.php';
        // Joom!Fish
        if ($option == 'com_joomfish' && ($task == 'translate.apply' || $task == 'translate.save') && $type == 'k2_items') {
            $language_id = JRequest::getInt('select_language_id');
            $reference_id = JRequest::getInt('reference_id');
            $objects = array();
            $variables = JRequest::get('post');
            foreach ($variables as $key => $value) {
                if ((bool) JString::stristr($key, 'K2ExtraField_')) {
                    $object = new JObject();
                    $object->set('id', JString::substr($key, 13));
                    $object->set('value', $value);
                    unset($object->_errors);
                    $objects[] = $object;
                }
            }
            $json = new Services_JSON();
            $extra_fields = $json->encode($objects);
            $extra_fields_search = '';
            foreach ($objects as $object) {
                $extra_fields_search .= $this->getSearchValue($object->id, $object->value);
                $extra_fields_search .= ' ';
            }
            $user = JFactory::getUser();
            $db = JFactory::getDBO();
            $query = "SELECT COUNT(*) FROM #__jf_content WHERE reference_field = 'extra_fields' AND language_id = {$language_id} AND reference_id = {$reference_id} AND reference_table='k2_items'";
            $db->setQuery($query);
            $result = $db->loadResult();
            if ($result > 0) {
                $query = "UPDATE #__jf_content SET value=" . $db->Quote($extra_fields) . " WHERE reference_field = 'extra_fields' AND language_id = {$language_id} AND reference_id = {$reference_id} AND reference_table='k2_items'";
                $db->setQuery($query);
                $db->query();
            } else {
                $modified = date("Y-m-d H:i:s");
                $modified_by = $user->id;
                $published = JRequest::getVar('published', 0);
                $query = "INSERT INTO #__jf_content (`id`, `language_id`, `reference_id`, `reference_table`, `reference_field` ,`value`, `original_value`, `original_text`, `modified`, `modified_by`, `published`) VALUES (NULL, {$language_id}, {$reference_id}, 'k2_items', 'extra_fields', " . $db->Quote($extra_fields) . ", '','', " . $db->Quote($modified) . ", {$modified_by}, {$published} )";
                $db->setQuery($query);
                $db->query();
            }
            $query = "SELECT COUNT(*) FROM #__jf_content WHERE reference_field = 'extra_fields_search' AND language_id = {$language_id} AND reference_id = {$reference_id} AND reference_table='k2_items'";
            $db->setQuery($query);
            $result = $db->loadResult();
            if ($result > 0) {
                $query = "UPDATE #__jf_content SET value=" . $db->Quote($extra_fields_search) . " WHERE reference_field = 'extra_fields_search' AND language_id = {$language_id} AND reference_id = {$reference_id} AND reference_table='k2_items'";
                $db->setQuery($query);
                $db->query();
            } else {
                $modified = date("Y-m-d H:i:s");
                $modified_by = $user->id;
                $published = JRequest::getVar('published', 0);
                $query = "INSERT INTO #__jf_content (`id`, `language_id`, `reference_id`, `reference_table`, `reference_field` ,`value`, `original_value`, `original_text`, `modified`, `modified_by`, `published`) VALUES (NULL, {$language_id}, {$reference_id}, 'k2_items', 'extra_fields_search', " . $db->Quote($extra_fields_search) . ", '','', " . $db->Quote($modified) . ", {$modified_by}, {$published} )";
                $db->setQuery($query);
                $db->query();
            }
        }
        if ($option == 'com_joomfish' && ($task == 'translate.edit' || $task == 'translate.apply') && $type == 'k2_items') {
            if ($task == 'translate.edit') {
                $cid = JRequest::getVar('cid');
                $array = explode('|', $cid[0]);
                $reference_id = $array[1];
            }
            if ($task == 'translate.apply') {
                $reference_id = JRequest::getInt('reference_id');
            }
            $item = JTable::getInstance('K2Item', 'Table');
            $item->load($reference_id);
            $category_id = $item->catid;
            $language_id = JRequest::getInt('select_language_id');
            $category = JTable::getInstance('K2Category', 'Table');
            $category->load($category_id);
            $group = $category->extraFieldsGroup;
            $db = JFactory::getDBO();
            $query = "SELECT * FROM #__k2_extra_fields WHERE `group`=" . $db->Quote($group) . " AND published=1 ORDER BY ordering";
            $db->setQuery($query);
            $extraFields = $db->loadObjectList();
            $json = new Services_JSON();
            $output = '';
            if (count($extraFields)) {
                $output .= '<h1>' . JText::_('K2_EXTRA_FIELDS') . '</h1>';
                $output .= '<h2>' . JText::_('K2_ORIGINAL') . '</h2>';
                foreach ($extraFields as $extrafield) {
                    $extraField = $json->decode($extrafield->value);
                    $output .= trim($this->renderOriginal($extrafield, $reference_id));
                }
            }
            if (count($extraFields)) {
                $output .= '<h2>' . JText::_('K2_TRANSLATION') . '</h2>';
                foreach ($extraFields as $extrafield) {
                    $extraField = $json->decode($extrafield->value);
                    $output .= trim($this->renderTranslated($extrafield, $reference_id));
                }
            }
            $pattern = '/\\r\\n|\\r|\\n/';
            // *** Mootools Snippet ***
            $js = "\n\t\t\twindow.addEvent('domready', function(){\n\t\t\t\tvar target = \$\$('table.adminform');\n\t\t\t\ttarget.setProperty('id', 'adminform');\n\t\t\t\tvar div = new Element('div', {'id': 'K2ExtraFields'}).setHTML('" . preg_replace($pattern, '', $output) . "').injectInside(\$('adminform'));\n\t\t\t});\n\t\t\t";
            if (K2_JVERSION == '15') {
                JHTML::_('behavior.mootools');
            } else {
                JHTML::_('behavior.framework');
            }
            $document = JFactory::getDocument();
            $document->addScriptDeclaration($js);
            // *** Embedded CSS Snippet ***
            $document->addCustomTag('
			<style type="text/css" media="all">
				#K2ExtraFields { color:#000; font-size:11px; padding:6px 2px 4px 4px; text-align:left; }
				#K2ExtraFields h1 { font-size:16px; height:25px; }
				#K2ExtraFields h2 { font-size:14px; }
				#K2ExtraFields strong { font-style:italic; }
			</style>
			');
        }
        if ($option == 'com_joomfish' && ($task == 'translate.apply' || $task == 'translate.save') && $type == 'k2_extra_fields') {
            $language_id = JRequest::getInt('select_language_id');
            $reference_id = JRequest::getInt('reference_id');
            $extraFieldType = JRequest::getVar('extraFieldType');
            $objects = array();
            $values = JRequest::getVar('option_value');
            $names = JRequest::getVar('option_name');
            $target = JRequest::getVar('option_target');
            for ($i = 0; $i < sizeof($values); $i++) {
                $object = new JObject();
                $object->set('name', $names[$i]);
                if ($extraFieldType == 'select' || $extraFieldType == 'multipleSelect' || $extraFieldType == 'radio') {
                    $object->set('value', $i + 1);
                } elseif ($extraFieldType == 'link') {
                    if (substr($values[$i], 0, 7) == 'http://') {
                        $values[$i] = $values[$i];
                    } else {
                        $values[$i] = 'http://' . $values[$i];
                    }
                    $object->set('value', $values[$i]);
                } else {
                    $object->set('value', $values[$i]);
                }
                $object->set('target', $target[$i]);
                unset($object->_errors);
                $objects[] = $object;
            }
            $json = new Services_JSON();
            $value = $json->encode($objects);
            $user = JFactory::getUser();
            $db = JFactory::getDBO();
            $query = "SELECT COUNT(*) FROM #__jf_content WHERE reference_field = 'value' AND language_id = {$language_id} AND reference_id = {$reference_id} AND reference_table='k2_extra_fields'";
            $db->setQuery($query);
            $result = $db->loadResult();
            if ($result > 0) {
                $query = "UPDATE #__jf_content SET value=" . $db->Quote($value) . " WHERE reference_field = 'value' AND language_id = {$language_id} AND reference_id = {$reference_id} AND reference_table='k2_extra_fields'";
                $db->setQuery($query);
                $db->query();
            } else {
                $modified = date("Y-m-d H:i:s");
                $modified_by = $user->id;
                $published = JRequest::getVar('published', 0);
                $query = "INSERT INTO #__jf_content (`id`, `language_id`, `reference_id`, `reference_table`, `reference_field` ,`value`, `original_value`, `original_text`, `modified`, `modified_by`, `published`) VALUES (NULL, {$language_id}, {$reference_id}, 'k2_extra_fields', 'value', " . $db->Quote($value) . ", '','', " . $db->Quote($modified) . ", {$modified_by}, {$published} )";
                $db->setQuery($query);
                $db->query();
            }
        }
        if ($option == 'com_joomfish' && ($task == 'translate.edit' || $task == 'translate.apply') && $type == 'k2_extra_fields') {
            if ($task == 'translate.edit') {
                $cid = JRequest::getVar('cid');
                $array = explode('|', $cid[0]);
                $reference_id = $array[1];
            }
            if ($task == 'translate.apply') {
                $reference_id = JRequest::getInt('reference_id');
            }
            $extraField = JTable::getInstance('K2ExtraField', 'Table');
            $extraField->load($reference_id);
            $language_id = JRequest::getInt('select_language_id');
            if ($extraField->type == 'multipleSelect' || $extraField->type == 'select' || $extraField->type == 'radio') {
                $subheader = '<strong>' . JText::_('K2_OPTIONS') . '</strong>';
            } else {
                $subheader = '<strong>' . JText::_('K2_DEFAULT_VALUE') . '</strong>';
            }
            $json = new Services_JSON();
            $objects = $json->decode($extraField->value);
            $output = '<input type="hidden" value="' . $extraField->type . '" name="extraFieldType" />';
            if (count($objects)) {
                $output .= '<h1>' . JText::_('K2_EXTRA_FIELDS') . '</h1>';
                $output .= '<h2>' . JText::_('K2_ORIGINAL') . '</h2>';
                $output .= $subheader . '<br />';
                foreach ($objects as $object) {
                    $output .= '<p>' . $object->name . '</p>';
                    if ($extraField->type == 'textfield' || $extraField->type == 'textarea') {
                        $output .= '<p>' . $object->value . '</p>';
                    }
                }
            }
            $db = JFactory::getDBO();
            $query = "SELECT `value` FROM #__jf_content WHERE reference_field = 'value' AND language_id = {$language_id} AND reference_id = {$reference_id} AND reference_table='k2_extra_fields'";
            $db->setQuery($query);
            $result = $db->loadResult();
            $translatedObjects = $json->decode($result);
            if (count($objects)) {
                $output .= '<h2>' . JText::_('K2_TRANSLATION') . '</h2>';
                $output .= $subheader . '<br />';
                foreach ($objects as $key => $value) {
                    if (isset($translatedObjects[$key])) {
                        $value = $translatedObjects[$key];
                    }
                    if ($extraField->type == 'textarea') {
                        $output .= '<p><textarea name="option_name[]" cols="30" rows="15"> ' . $value->name . '</textarea></p>';
                    } else {
                        $output .= '<p><input type="text" name="option_name[]" value="' . $value->name . '" /></p>';
                    }
                    $output .= '<p><input type="hidden" name="option_value[]" value="' . $value->value . '" /></p>';
                    $output .= '<p><input type="hidden" name="option_target[]" value="' . $value->target . '" /></p>';
                }
            }
            $pattern = '/\\r\\n|\\r|\\n/';
            // *** Mootools Snippet ***
            $js = "\n\t\t\twindow.addEvent('domready', function(){\n\t\t\t\tvar target = \$\$('table.adminform');\n\t\t\t\ttarget.setProperty('id', 'adminform');\n\t\t\t\tvar div = new Element('div', {'id': 'K2ExtraFields'}).setHTML('" . preg_replace($pattern, '', $output) . "').injectInside(\$('adminform'));\n\t\t\t});\n\t\t\t";
            JHTML::_('behavior.mootools');
            $document = JFactory::getDocument();
            $document->addScriptDeclaration($js);
        }
        return;
    }
 /**
  * Checks messaging anti-spam
  *
  * @param  boolean      $autoBack     TRUE: returns code 403 and attempts a "back" in browser with Javascript, FALSE: Returns error text
  * @param  boolean      $allowPublic  TRUE: Also checks for guests, FALSE: Only for registered and logged-in users
  * @return null|string                NULL: Ok, String: translated error text
  */
 function cbAntiSpamCheck($autoBack = true, $allowPublic = false)
 {
     global $_POST;
     $validateValuePost = cbGetParam($_POST, 'cbvssps', '');
     cbimport('cb.session');
     $validateValueCookie = CBCookie::getcookie('cbvs');
     $parts0 = explode('_', $validateValuePost);
     $parts1 = explode('_', $validateValueCookie);
     $match = false;
     if (count($parts0) == 3 && count($parts1) == 3) {
         $validate = cbGetAntiSpams($parts0[2], $parts1[2], $allowPublic);
         $match = $validateValuePost === $validate[0] || $validateValueCookie === $validate[1];
     }
     if (!$match) {
         if ($autoBack) {
             _cbExpiredSessionJSterminate();
         } else {
             return CBTxt::Th('UE_SESSION_EXPIRED', 'Session expired or cookies are not enabled in your browser. Please press "reload page" in your browser, and enable cookies in your browser.') . ' ' . CBTxt::Th('UE_PLEASE_REFRESH', 'Please refresh/reload page before filling-in.');
         }
     }
     return null;
 }
Esempio n. 26
0
 /**
  * Creates the page navigator object
  *
  * @param  int    $total       Total number of rows
  * @param  int    $limitstart  First entry
  * @param  int    $limit       Number of entries
  * @param  int[]  $limits      Limits to propose in the pagination setting in the table form
  * @return void
  */
 function createPageNvigator($total, $limitstart, $limit, $limits = null)
 {
     cbimport('cb.pagination');
     $this->pageNav = new cbPageNav($total, $limitstart, $limit, array(&$this, 'fieldName'), $this);
     $this->pageNav->setControllerView($this);
     if ($limits) {
         $this->pageNav->setLimits($limits);
     }
 }
Esempio n. 27
0
 /**
  * returns plugins xml version
  *
  * @param  null|PluginTable|int  $plugin    The plugin id or object to check version for
  * @param  bool                  $raw       1/True: version only (no farm), 0/False: Formatted version (green/red/shortened), 2: array of version information ( $version, $latestVersion, $isLatest, $latestURL )
  * @param  int                   $duration  The duration to cache the plugin version xml file (null/0 for no limit)
  * @param  int                   $length    The maximum version length to display (null/0 for no limit)
  * @return null|string
  */
 public function getPluginVersion($plugin, $raw = false, $duration = 24, $length = 0)
 {
     global $_CB_framework, $ueConfig;
     cbimport('cb.snoopy');
     static $plgVersions = null;
     if ($plgVersions === null) {
         $cacheFile = $_CB_framework->getCfg('absolute_path') . '/cache/cbpluginsversions.xml';
         $plgVersionsXML = null;
         if (file_exists($cacheFile)) {
             if (!$duration || intval(($_CB_framework->now() - filemtime($cacheFile)) / 3600) > $duration) {
                 $request = true;
             } else {
                 $plgVersionsXML = new SimpleXMLElement(trim(file_get_contents($cacheFile)));
                 $request = false;
             }
         } else {
             $request = true;
         }
         if ($request) {
             $s = new CBSnoopy();
             $s->read_timeout = 30;
             $s->referer = $_CB_framework->getCfg('live_site');
             @$s->fetch('http://update.joomlapolis.net/cbpluginsversions20.xml');
             if ((int) $s->status == 200) {
                 try {
                     $plgVersionsXML = new SimpleXMLElement($s->results);
                     $plgVersionsXML->saveXML($cacheFile);
                 } catch (Exception $e) {
                 }
             }
         }
         if ($plgVersionsXML) {
             $plgVersions = $plgVersionsXML->getElementByPath('cb_plugins/' . (checkJversion() >= 2 ? 'j30' : 'j15'));
         } else {
             $plgVersions = false;
         }
     }
     $plugin = $this->getCachedPluginObject($plugin);
     if (!$plugin) {
         return $raw === 2 ? array(null, null, null, null) : null;
     }
     static $cache = array();
     $pluginId = (int) $plugin->id;
     if (!isset($cache[$pluginId][$raw])) {
         $xmlFile = $this->getPluginXmlPath($plugin);
         $version = null;
         $latestVersion = null;
         $isLatest = null;
         $latestURL = null;
         if (file_exists($xmlFile)) {
             try {
                 $xml = new SimpleXMLElement(trim(file_get_contents($xmlFile)));
             } catch (\Exception $e) {
                 $xml = null;
                 echo "{$xmlFile} not an XML file!!!";
             }
             if ($xml !== null) {
                 $ver = null;
                 if (isset($xml->release)) {
                     // New release XML variable used by incubator projects:
                     $ver = $xml->release;
                 } elseif (isset($xml->cbsubsversion)) {
                     // CBSubs plugin versions are same as the CBSubs version; lets grab them:
                     $cbsubsVer = $xml->cbsubsversion->attributes();
                     if (isset($cbsubsVer['version'])) {
                         $ver = $cbsubsVer['version'];
                     }
                 } elseif (isset($xml->description)) {
                     // Attempt to parse plugin description for a version using logical naming:
                     if (preg_match('/(?:plugin|field|fieldtype|ver|version|' . preg_quote($plugin->name) . ') ((?:[0-9]+(?:\\.)?(?:(?: )?RC)?(?:(?: )?B)?(?:(?: )?BETA)?)+)/i', $xml->description, $matches)) {
                         $ver = $matches[1];
                     }
                 }
                 // Check if version was found; if it was lets clean it up:
                 if ($ver) {
                     if (preg_match('/^\\d+(\\.\\d+)+(-[a-z]+\\.\\d+)?(\\+\\w)?$/', $ver)) {
                         $version = $ver;
                     } else {
                         $version = preg_replace('/\\.*([a-zA-Z]+)\\.*/i', '.$1.', preg_replace('/^[a-zA-Z]+/i', '', str_replace(array('-', '_', '+'), '.', str_replace(' ', '', strtoupper($ver)))));
                     }
                     if (is_integer($version)) {
                         $version = implode('.', str_split($version));
                     } elseif (preg_match('/^(\\d{2,})(\\.[a-zA-Z].+)/i', $version, $matches)) {
                         $version = implode('.', str_split($matches[1])) . $matches[2];
                     }
                     $version = trim(str_replace('..', '.', $version), '.');
                     // Encase the version is too long lets cut it short for readability and display full version as mouseover title:
                     if ($version && $length && cbIsoUtf_strlen($version) > $length) {
                         $versionName = rtrim(trim(cbIsoUtf_substr($version, 0, $length)), '.') . '&hellip;';
                         $versionShort = true;
                     } else {
                         $versionName = $version;
                         $versionShort = false;
                     }
                     // Lets try and parse out latest version and latest url from versions xml data:
                     if ($plgVersions) {
                         foreach ($plgVersions as $plgVersion) {
                             $plgName = (string) $plgVersion->name;
                             $plgFile = (string) $plgVersion->file;
                             if ($plgName == $plugin->name || strpos($plgName, $plugin->name) !== false || strpos($plgFile, $plugin->folder) !== false) {
                                 $latestVersion = (string) $plgVersion->version;
                                 $latestURL = (string) $plgVersion->url;
                             }
                         }
                     }
                     if ($latestVersion) {
                         if (version_compare($version, $latestVersion) >= 0) {
                             $isLatest = true;
                         } else {
                             $isLatest = false;
                         }
                     }
                     // Format version display:
                     if (!$raw) {
                         if ($latestVersion) {
                             if ($isLatest) {
                                 $version = '<span class="text-success"' . ($versionShort ? ' title="' . htmlspecialchars($version) . '"' : null) . '><strong>' . $versionName . '</strong></span>';
                             } else {
                                 $version = '<span class="text-danger" title="' . htmlspecialchars($latestVersion) . '"><strong>' . $versionName . '</strong></span>';
                                 if ($latestURL) {
                                     $version = '<a href="' . htmlspecialchars($latestURL) . '" target="_blank">' . $version . '</a>';
                                 }
                             }
                         } else {
                             if ($versionShort) {
                                 $version = '<span title="' . htmlspecialchars($version) . '">' . $versionName . '</span>';
                             } else {
                                 $version = $versionName;
                             }
                         }
                     }
                 }
             }
         }
         if (!$version && !$raw) {
             if ($plugin->iscore) {
                 // core plugins are same version as CB it self:
                 if ($length && cbIsoUtf_strlen($ueConfig['version']) > $length) {
                     $version = '<span title="' . htmlspecialchars($ueConfig['version']) . '">' . rtrim(trim(cbIsoUtf_substr($ueConfig['version'], 0, $length)), '.') . '&hellip;</span>';
                 } else {
                     $version = $ueConfig['version'];
                 }
             } else {
                 $version = '-';
             }
         }
         if ($raw === 2) {
             $version = array($version, $latestVersion, $isLatest, $latestURL);
         }
         $cache[$pluginId][$raw] = $version;
     }
     return $cache[$pluginId][$raw];
 }
Esempio n. 28
0
 function acymailing_replaceusertags(&$email, &$user, $send = true)
 {
     $match = '#(?:{|%7B)cbtag:(.*)(?:}|%7D)#Ui';
     $variables = array('subject', 'body', 'altbody');
     $found = false;
     foreach ($variables as $var) {
         if (empty($email->{$var})) {
             continue;
         }
         $found = preg_match_all($match, $email->{$var}, $results[$var]) || $found;
         if (empty($results[$var][0])) {
             unset($results[$var]);
         }
     }
     if (!$found) {
         return;
     }
     $uservalues = null;
     $db = JFactory::getDBO();
     if (!empty($user->userid)) {
         $db->setQuery('SELECT * FROM ' . acymailing_table('comprofiler', false) . ' WHERE user_id = ' . $user->userid . ' LIMIT 1');
         $uservalues = $db->loadObject();
     }
     include_once ACYMAILING_ROOT . 'administrator' . DS . 'components' . DS . 'com_comprofiler' . DS . 'plugin.foundation.php';
     cbimport('cb.database');
     $pluginsHelper = acymailing_get('helper.acyplugins');
     $currentCBUser = null;
     $tags = array();
     foreach ($results as $var => $allresults) {
         foreach ($allresults[0] as $i => $oneTag) {
             if (isset($tags[$oneTag])) {
                 continue;
             }
             $arguments = explode('|', $allresults[1][$i]);
             $field = $arguments[0];
             unset($arguments[0]);
             $mytag = new stdClass();
             $mytag->default = $this->params->get('default_' . $field, '');
             if (!empty($arguments)) {
                 foreach ($arguments as $onearg) {
                     $args = explode(':', $onearg);
                     if (isset($args[1])) {
                         $mytag->{$args}[0] = $args[1];
                     } else {
                         $mytag->{$args}[0] = 1;
                     }
                 }
             }
             $values = new stdClass();
             if (!empty($mytag->info) and $mytag->info == 'sender') {
                 if (empty($this->sendervalues[$email->mailid]) and !empty($email->userid)) {
                     $db->setQuery('SELECT * FROM #__comprofiler WHERE user_id = ' . $email->userid . ' LIMIT 1');
                     $this->sendervalues[$email->mailid] = $db->loadObject();
                 }
                 if (!empty($this->sendervalues[$email->mailid])) {
                     $values = $this->sendervalues[$email->mailid];
                 }
             } else {
                 $values = $uservalues;
             }
             if (substr($field, 0, 6) == 'cbapi_') {
                 if (!empty($mytag->info) and $mytag->info == 'sender') {
                     if (empty($this->sendervalues[$email->mailid]->{$field}) and !empty($email->userid)) {
                         $currentSender = CBuser::getInstance($email->userid);
                         $values->{$field} = $currentSender->getField(substr($field, 6), $mytag->default, 'html', 'none', 'profile', 0, true);
                         $this->sendervalues[$email->mailid]->{$field} = $values->{$field};
                     } elseif (!empty($this->sendervalues[$email->mailid]->{$field})) {
                         $values->{$field} = @$this->sendervalues[$email->mailid]->{$field};
                     }
                 } elseif (!empty($user->userid)) {
                     if (empty($currentCBUser)) {
                         $currentCBUser = CBuser::getInstance($user->userid);
                     }
                     if (!empty($currentCBUser)) {
                         $values->{$field} = $currentCBUser->getField(substr($field, 6), $mytag->default, 'html', 'none', 'profile', 0, true);
                     }
                 }
             }
             $replaceme = isset($values->{$field}) ? $values->{$field} : $mytag->default;
             if (!empty($mytag->type)) {
                 if ($mytag->type == 'image' and !empty($replaceme)) {
                     $replaceme = '<img src="' . ACYMAILING_LIVE . 'images/comprofiler/' . $replaceme . '" alt="' . htmlspecialchars(@$user->name, ENT_COMPAT, 'UTF-8') . '" />';
                 }
             }
             if ($field == 'thumb') {
                 $replaceme = '<img src="' . ACYMAILING_LIVE . 'images/comprofiler/tn' . $values->avatar . '" alt="' . htmlspecialchars(@$user->name, ENT_COMPAT, 'UTF-8') . '" />';
             } elseif ($field == 'avatar') {
                 $replaceme = '<img src="' . ACYMAILING_LIVE . 'images/comprofiler/' . $values->avatar . '" alt="' . htmlspecialchars(@$user->name, ENT_COMPAT, 'UTF-8') . '" />';
             }
             $tags[$oneTag] = $replaceme;
             $pluginsHelper->formatString($tags[$oneTag], $mytag);
         }
     }
     foreach ($results as $var => $allresults) {
         $email->{$var} = str_replace(array_keys($tags), $tags, $email->{$var});
     }
 }
Esempio n. 29
0
 function getAvatar($user, $extension, $default_avatar)
 {
     $avatar = 0;
     if ($user->get('id') == 0) {
         $avatar = !empty($default_avatar) ? $default_avatar : 0;
     } elseif ($extension == 1) {
         require_once JPATH_ADMINISTRATOR . '/components/com_rokbridge/helper.php';
         $rokbridge = new RokBridgeHelper();
         $phpbb_db = $rokbridge->phpbb_db;
         $query = "SELECT user_id, user_type, username, user_unread_privmsg, user_new_privmsg, user_avatar, user_avatar_type, user_avatar_width, user_avatar_height, user_lastvisit, FROM_UNIXTIME(user_lastvisit,'%a %b %D %x %h:%i %p') AS LastVisit FROM #__users WHERE " . $rokbridge->getWhereClause($user->username);
         $phpbb_db->setQuery($query);
         $fuser = $phpbb_db->loadObject();
         $avatar = $rokbridge->getAvatar($fuser, 35, "", $default_avatar);
         $avatar = substr($avatar, strpos($avatar, '"') + 1);
         $avatar = substr($avatar, 0, strpos($avatar, '"'));
     } elseif ($extension == 2) {
         $jspath = JPATH_BASE . DS . 'components/com_community';
         include_once $jspath . DS . 'libraries/core.php';
         $user =& CFactory::getUser($user->get('id'));
         $avatar = $user->getThumbAvatar();
     } elseif ($extension == 3) {
         $jspath = JPATH_ADMINISTRATOR . '/components/com_comprofiler';
         include_once $jspath . DS . 'plugin.foundation.php';
         cbimport('cb.database');
         $user =& CBuser::getInstance($user->get('id'));
         $avatar = $user->avatarFilePath(1);
         if (empty($avatar)) {
             $avatar = $default_avatar;
         }
     } elseif ($extension == 4) {
         $ini = JFile::read(JPATH_ADMINISTRATOR . '/components/com_juser/config.ini');
         $juserparams = new JParameter($ini);
         $avatar_save_path = $juserparams->get('general::avatars_dir');
         if (file_exists(JPATH_ROOT . DS . $avatar_save_path . DS . $user->get('username') . '.jpg')) {
             $avatar = JURI::root() . str_replace('\\', '/', $avatar_save_path) . '/' . $user->get('username') . '.jpg';
         } else {
             $avatar = JURI::root() . '/components/com_juser/images/default_avatar.png';
         }
     } elseif ($extension == 5) {
         require_once JPATH_BASE . DS . 'components/com_kunena/class.kunena.php';
         $kunena_user = KunenaFactory::getUser($user->get('id'));
         $username = $kunena_user->getName();
         $avatar = $kunena_user->getAvatarURL();
     }
     return $avatar;
 }
Esempio n. 30
0
 /**
  * Creates if needed cbTabs object
  *
  * @param  boolean  $outputTabpaneScript
  * @return cbTabs
  */
 public function &_getCbTabs($outputTabpaneScript = true)
 {
     if ($this->_cbtabs === null) {
         global $_CB_framework;
         cbimport('cb.tabs');
         $this->_cbtabs = new cbTabs(0, $_CB_framework->getUi(), null, $outputTabpaneScript);
     }
     if ($outputTabpaneScript) {
         $this->_cbtabs->outputTabJS();
     }
     return $this->_cbtabs;
 }