Ejemplo n.º 1
0
 protected function getInput()
 {
     $html = '';
     if ($this->form->getValue('params.provider_type') && $this->form->getValue('params.widget_type') != 'widget') {
         SCStringUtilities::loadLanguage('com_jfbconnect', JPATH_ADMINISTRATOR);
         JForm::addFieldPath(JPATH_ROOT . '/components/com_jfbconnect/libraries/provider/' . $this->form->getValue('params.provider_type') . '/widget');
         $xmlFile = JPATH_ROOT . '/components/com_jfbconnect/libraries/provider/' . $this->form->getValue('params.provider_type') . '/widget/' . $this->form->getValue('params.widget_type') . '.xml';
         if (JFile::exists($xmlFile)) {
             $options = array('control' => 'jform');
             $form = JForm::getInstance('com_jfbconnect_' . $this->form->getValue('params.widget_type'), $xmlFile, $options);
             $registry = $this->form->getValue('params');
             $settings = new JRegistry();
             $settings->set('params.widget_settings', $registry->widget_settings);
             $form->bind($settings);
             ob_start();
             foreach ($form->getFieldsets() as $fieldsets => $fieldset) {
                 foreach ($form->getFieldset($fieldset->name) as $field) {
                     $this->formShowField($field);
                 }
             }
             $html = ob_get_clean();
         }
     }
     return '<div id="widget_settings">' . $html . '</div>';
 }
Ejemplo n.º 2
0
 public function getOptions()
 {
     SCStringUtilities::loadLanguage('com_jfbconnect', JPATH_ADMINISTRATOR);
     $options = array();
     $options[] = JHtml::_('select.option', 'default', JText::_('COM_JFBCONNECT_SOCIAL_LOGIN_BUTTON_TYPE_DEFAULT'), 'value', 'text');
     $options[] = JHtml::_('select.option', 'custom', JText::_('COM_JFBCONNECT_SOCIAL_LOGIN_BUTTON_TYPE_CUSTOM'), 'value', 'text');
     return $options;
 }
Ejemplo n.º 3
0
 protected function getTagHtml()
 {
     //Get the Comments Count string
     $tagString = '<div class="fb-comments-count"';
     $tagString .= $this->getField('href', 'url', null, SCSocialUtilities::getStrippedUrl(), 'data-href');
     $tagString .= '></div>';
     SCStringUtilities::loadLanguage('com_jfbconnect');
     $tag = JText::sprintf('COM_JFBCONNECT_COMMENTS_COUNT', $tagString);
     return $tag;
 }
Ejemplo n.º 4
0
 protected function getInput()
 {
     require_once JPATH_ADMINISTRATOR . '/components/com_jfbconnect/models/fields/providerloginbutton.php';
     $html = array();
     $data = $this->form->getValue($this->fieldname, $this->group, null);
     // Support for SCLogin module
     $loginbuttonstype = $this->form->getValue('loginbuttonstype', 'params', null);
     if (!$loginbuttonstype) {
         // Support for SCSocialWidget module
         $loginbuttonstype = $this->form->getValue('loginbuttonstype', 'params.widget_settings', 'default');
     }
     if ($loginbuttonstype == 'default') {
         $noticeStyle = 'style="display:block"';
         $buttonStyle = "display:none";
     } else {
         $noticeStyle = 'style="display:none"';
         $buttonStyle = "display:block";
     }
     jimport('sourcecoast.utilities');
     SCStringUtilities::loadLanguage('com_jfbconnect', JPATH_ADMINISTRATOR);
     $html[] = '<div class="fieldsocialbuttons">';
     JFactory::getDocument()->addStyleDeclaration('.fieldsocialbuttons label { display: inline; float:left; }
         .fieldsocialbuttons input[type="radio"] { margin: 0 8px; }
         label.providername { width:60px; }');
     $html[] = '<div style="clear:both"> </div>';
     $html[] = '<fieldset id="loginbutton_custom_notice" ' . $noticeStyle . '>' . JText::_('COM_JFBCONNECT_LOGIN_BUTTON_CUSTOM_INSTRUCTIONS') . '</fieldset>';
     $providerFound = false;
     foreach (JFBCFactory::getAllProviders() as $p) {
         if ($p->appId) {
             $providerFound = true;
             $value = is_array($data) && array_key_exists($p->systemName, $data) ? $data[$p->systemName] : 'icon_label.png';
             $field = '<field type="providerloginbutton"
                 label="Default Login Button"
                 provider="' . $p->systemName . '"
                             name="' . $p->systemName . '"
                             required="true"
                             style="' . $buttonStyle . '"
                             />';
             $element = new SimpleXMLElement($field);
             $node = new JFormFieldProviderloginbutton($this->form);
             $node->setup($element, $value, $this->group . '.' . $this->fieldname);
             $html[] = $node->getInput();
         }
     }
     if (!$providerFound) {
         $html[] = '<label>No social networks are enabled. Please use the JFBConnect configuration area to set your App IDs and Secret Keys</label>';
     }
     $html[] = '</div>';
     return implode($html);
 }
Ejemplo n.º 5
0
 static function _splitIntoTagParameters($paramList)
 {
     $paramList = SCStringUtilities::replaceNBSPWithSpace($paramList);
     $params = explode(' ', $paramList);
     $count = count($params);
     for ($i = 0; $i < $count; $i++) {
         $params[$i] = str_replace('"', '', $params[$i]);
         if (strpos($params[$i], '=') === false && $i > 0) {
             $previousIndex = SCEasyTags::_findPreviousParameter($params, $i - 1);
             //Combine this with previous entry and space
             $combinedParamValue = $params[$previousIndex] . ' ' . $params[$i];
             $params[$previousIndex] = $combinedParamValue;
             unset($params[$i]);
         }
     }
     return $params;
 }
Ejemplo n.º 6
0
 static function getAutotuneControlIconText()
 {
     SCStringUtilities::loadLanguage('com_jfbconnect');
     $autotuneModel = JModelLegacy::getInstance('AutoTune', 'JFBConnectModel');
     $upToDate = $autotuneModel->isUpToDate();
     if ($upToDate) {
         return JText::_('COM_JFBCONNECT_BUTTON_AUTOTUNE');
     } else {
         if (defined('SC16')) {
             return '<span>' . JText::_('COM_JFBCONNECT_BUTTON_AUTOTUNE_RECOMMENDED') . '<br/><span class="update-badge">!</span></span>';
         }
         //SC16
         if (defined('SC30')) {
             return '<span style="color:blue"><strong>' . JText::_('COM_JFBCONNECT_BUTTON_AUTOTUNE_RECOMMENDED') . '</strong></span>';
         }
         //SC30
     }
 }
Ejemplo n.º 7
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     JPluginHelper::importPlugin('socialprofiles');
     $profilePlugins = $app->triggerEvent('socialProfilesGetPlugins');
     $this->assignRef('profilePlugins', $profilePlugins);
     foreach ($profilePlugins as $p) {
         $options = array();
         $options['control'] = "profiles_" . $p->getName();
         SCStringUtilities::loadLanguage('plg_socialprofiles_' . $p->getName(), JPATH_ADMINISTRATOR);
         $path = JPATH_SITE . '/plugins/socialprofiles/' . $p->getName();
         JForm::addFieldPath($path . '/fields/');
         $this->formLoad($p->getName(), $path . '/forms/config.xml', $options);
         $data = JFBCFactory::config()->get('profile_' . $p->getName());
         $reg = new JRegistry();
         $reg->loadString($data);
         $this->formBind($p->getName(), $reg);
     }
     parent::display($tpl);
 }
Ejemplo n.º 8
0
 function scsocialwidget()
 {
     $input = JFactory::getApplication()->input;
     $provider = $input->get('provider');
     $widget = $input->get('name');
     // load the name form.xml file here
     SCStringUtilities::loadLanguage('com_jfbconnect', JPATH_ADMINISTRATOR);
     JForm::addFieldPath(JPATH_ROOT . '/components/com_jfbconnect/libraries/provider/' . $provider . '/widget');
     $xmlFile = JPATH_ROOT . '/components/com_jfbconnect/libraries/provider/' . $provider . '/widget/' . $widget . '.xml';
     if (JFile::exists($xmlFile)) {
         $options = array('control' => 'jform');
         $form = JForm::getInstance('com_jfbconnect_' . $widget, $xmlFile, $options);
         $registry = $this->getModuleSettings($input->getInt('id'));
         $form->bind($registry);
         foreach ($form->getFieldsets() as $fiedsets => $fieldset) {
             foreach ($form->getFieldset($fieldset->name) as $field) {
                 $this->formShowField($field);
             }
         }
     }
     exit;
 }
Ejemplo n.º 9
0
 static function getAutoUsername($firstName, $lastName, $email, $genericPrefixStr, $socialUserId, $usernamePrefixFormat)
 {
     // Scrub the first/last name for invalid characters that Joomla will deny:
     $stripChars = array('<', '>', '\\', '"', "'", '%', ';', '(', ')', '&');
     $firstName = str_replace($stripChars, '', $firstName);
     $lastName = str_replace($stripChars, '', $lastName);
     if ($usernamePrefixFormat == AUTONAME_EXT) {
         return $genericPrefixStr . $socialUserId;
     } else {
         if ($usernamePrefixFormat == AUTONAME_FIRSTLAST) {
             $firstName = SCStringUtilities::strtolower($firstName);
             $lastName = SCStringUtilities::strtolower($lastName);
             if ($lastName != '') {
                 $prefix = $firstName . "." . $lastName;
             } else {
                 $prefix = $firstName;
             }
         } else {
             if ($usernamePrefixFormat == AUTONAME_FIRLAS) {
                 $firstName = SCStringUtilities::strtolower($firstName);
                 $lastName = SCStringUtilities::strtolower($lastName);
                 // Try to always make usernames at least 6 characters
                 $lastLength = strlen(utf8_decode($lastName));
                 $firstLength = strlen(utf8_decode($firstName));
                 $firstPrefix = SCStringUtilities::substr($firstName, 0, max(3, 6 - $lastLength));
                 $lastPrefix = SCStringUtilities::substr($lastName, 0, max(3, 6 - $firstLength));
                 $prefix = $firstPrefix . $lastPrefix;
             } else {
                 if ($email != '') {
                     $prefix = $email;
                 }
             }
         }
     }
     if ($prefix != '') {
         $suffix = SCUserUtilities::getUsernameUniqueNumber($prefix);
         return $prefix . $suffix;
     } else {
         return '';
     }
 }
Ejemplo n.º 10
0
 function get($path, $default = null)
 {
     $data = $default;
     $pageListTypes = array("music", "books", "movies", "television", "games", "activities", "interests");
     if (in_array($path, $pageListTypes)) {
         $data = $this->formatPageList(parent::get($path, $default));
     } else {
         if ($this->exists($path)) {
             $data = parent::get($path, $default);
         } else {
             if ($path == "full_name") {
                 // standardized provider value for full name
                 $data = parent::get('name', $default);
             } else {
                 // Alternative fields that require extra parsing
                 $parts = explode('.', $path);
                 if ($parts[0] == 'education') {
                     if (isset($this->data->education)) {
                         $edu = $this->data->education;
                         if ($edu) {
                             foreach ($edu as $k => $node) {
                                 if ($node->type == $parts[1]) {
                                     unset($parts[0]);
                                     unset($parts[1]);
                                     $newPath = 'education.' . $k . '.' . implode('.', $parts);
                                     $data = parent::get($newPath, $default);
                                     break;
                                 }
                             }
                         }
                     }
                 } else {
                     return $default;
                 }
             }
         }
     }
     if (!empty($data)) {
         if (is_array($data)) {
             // This is a field with multiple, comma separated values
             // Remove empty values to prevent blah, , blah as output
             unset($data['id']);
             // Remove id key which is useless to import
             $data = SCStringUtilities::r_implode(', ', $data);
         }
         // add custom field handlers here
         switch ($path) {
             case 'website':
                 $websites = explode("\n", $data);
                 if (count($websites) > 0) {
                     $data = trim($websites[0]);
                 }
                 break;
         }
     }
     return $data;
 }
Ejemplo n.º 11
0
 protected function importSocialProfile()
 {
     $fieldMap = $this->getFieldMap($this->network);
     $socialProfile = $this->fetchProfileFromFieldMap(true);
     if ($socialProfile) {
         foreach ($fieldMap as $fieldId => $socialField) {
             // Fetch the value from the POST data (if present) or the imported data from the Social Network
             $value = $socialProfile->getFieldWithUserState($fieldId);
             if ($value != null && $value != "") {
                 if (is_array($value)) {
                     // This is a field with multiple, comma separated values
                     // Remove empty values to prevent blah, , blah as output
                     unset($value['id']);
                     // Remove id key which is useless to import
                     $value = SCStringUtilities::r_implode(', ', $value);
                 }
                 $this->saveProfileField($fieldId, $value);
             }
         }
     }
 }
Ejemplo n.º 12
0
 function triggerAction($action, $url, $params = null, $uniqueKey = null)
 {
     if (!$params) {
         $params = array();
     }
     $return = new stdClass();
     $return->status = false;
     $return->message = "";
     SCStringUtilities::loadLanguage('com_jfbconnect');
     if (JFBCFactory::provider('facebook')->userIsConnected() && $action->enabledForUser()) {
         // Find the object definition for the passed in URL
         $app = JFactory::getApplication();
         JPluginHelper::importPlugin('opengraph');
         $pluginArgs = array($url);
         $objects = $app->triggerEvent('onOpenGraphFindObjectType', $pluginArgs);
         // Remove all null elements and get the first real object returned
         $objects = array_filter($objects);
         $object = array_shift($objects);
         if ($object && $action->isAssociatedTo($object)) {
             if (!$uniqueKey) {
                 $uniqueKey = $this->getUniqueKey($url);
             }
             if ($action->actionReady($uniqueKey)) {
                 // Always include the 'object' argument as some actions want the generic, others want the specific.
                 if (array_key_exists('explicitly_shared', $params)) {
                     if ($params['explicitly_shared'] == 'true') {
                         $params['fb:explicitly_shared'] = 'true';
                     }
                     unset($params['explicitly_shared']);
                 }
                 $args = $params;
                 $args['object'] = $url;
                 $args[strtolower($object->type)] = $url;
                 $actionPath = $action->getActionPath();
                 $response = JFBCFactory::provider('facebook')->api('/me/' . $actionPath, $args);
                 //$response['id'] = '12345';
                 $error = JFBCFactory::provider('facebook')->getLastError();
                 //$error = "";
                 if ($error) {
                     $return->status = false;
                     // Error / not posted
                     $return->response = $error;
                 } else {
                     $return->status = true;
                     // Posted, response is the action ID
                     $return->response = $response['id'];
                 }
                 $activityId = $this->storeActivity($action, $object, $uniqueKey, $url, $return->status, $return->response);
                 // Setup the return message, used for AJAX calls
                 if ($error) {
                     $return->message = $error;
                 } else {
                     $return->message = '<span class="ogMessage">' . JText::_("COM_JFBCONNECT_OPENGRAPH_ACTION_ADDED") . '</span>' . '<span class="ogOptions">' . '<a href="' . JRoute::_('index.php?option=com_jfbconnect&task=opengraph.undoAndDisableAction&action=' . $action->id . '&activity=' . $activityId . '&' . JSession::getFormToken() . '=1') . '" target="_blank">' . JText::_('COM_JFBCONNECT_OPENGRAPH_ACTION_DELETE_AND_DISABLE') . '</a>' . ' | <a href="' . JRoute::_('index.php?option=com_jfbconnect&view=opengraph') . '" target="_blank">' . JText::_('COM_JFBCONNECT_OPENGRAPH_ACTION_SEE_ALL') . '</a>' . '</span>';
                 }
             } else {
                 $return->message = JText::_('COM_JFBCONNECT_OPENGRAPH_ACTION_NOT_READY');
             }
         } else {
             $return->message = JText::_('COM_JFBCONNECT_OPENGRAPH_ACTION_NOT_ASSOCIATED');
         }
     } else {
         $return->message = JText::_('COM_JFBCONNECT_OPENGRAPH_ACTION_NOT_ENABLED');
     }
     return $return;
 }
Ejemplo n.º 13
0
 function migrateSocialFieldsToProfile($joomlaId)
 {
     $socialFieldMap = $this->configModel->getSetting('profiles_' . $this->profileName . "_field_map");
     $fields = array();
     foreach ($socialFieldMap as $socialField) {
         // Strip out any path information from the field
         $loc = strpos($socialField, '.');
         if ($loc) {
             $socialField = substr($socialField, 0, $loc);
         }
         $fields[] = $socialField;
     }
     $fields = array_unique($fields);
     $socialProfile = $this->fetchProfile($fields);
     $sql = "";
     if ($socialProfile) {
         foreach ($socialFieldMap as $fieldId => $socialField) {
             $value = $socialProfile->get($socialField);
             if ($value != null && $value != "") {
                 if (is_array($value)) {
                     // This is a field with multiple, comma separated values
                     // Remove empty values to prevent blah, , blah as output
                     unset($value['id']);
                     // Remove id key which is useless to import
                     $value = SCStringUtilities::r_implode(', ', $value);
                 }
                 $sql .= $this->addFieldToDB($joomlaId, $fieldId, $value);
             }
         }
     }
     $this->_db->setQuery($sql);
     $this->_db->queryBatch();
 }
Ejemplo n.º 14
0
    public function onAfterRender()
    {
        $body = JResponse::getBody();
        // Add FB built-in and custom OG tag for namespace, if applicable
        $ogNamespaces = 'og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#';
        $appConfig = JFBCFactory::config()->get('autotune_app_config', array());
        if (array_key_exists('namespace', $appConfig)) {
            $appNamespace = $appConfig['namespace'];
            if ($appNamespace != '') {
                $ogNamespaces .= " " . $appNamespace . ': http://ogp.me/ns/fb/' . $appNamespace . '#';
            }
        }
        $body = str_ireplace("<html ", '<html prefix="' . $ogNamespaces . '" ', $body);
        // Should the modal popup be displayed?
        $showLoginModal = JFBCFactory::config()->get('facebook_login_show_modal');
        if ($showLoginModal) {
            jimport('sourcecoast.utilities');
            SCStringUtilities::loadLanguage('com_jfbconnect');
            $loginModalDiv = '<div id="jfbcLoginModal" class="sourcecoast modal" style="display:none"><div class="modal-body">' . JText::_('COM_JFBCONNECT_LOGIN_POPUP') . '</div></div>';
        } else {
            $loginModalDiv = "";
        }
        $body = str_ireplace("</body>", $loginModalDiv . "</body>", $body);
        $locale = $this->getLocale();
        // get Event Notification subscriptions
        $subs = "\nFB.Event.subscribe('comment.create', jfbc.social.facebook.comment.create);";
        $subs .= "\nFB.Event.subscribe('comment.remove', jfbc.social.facebook.comment.remove);";
        $subs .= "\nFB.Event.subscribe('edge.create', jfbc.social.facebook.like.create);";
        $subs .= "\nFB.Event.subscribe('edge.remove', jfbc.social.facebook.like.remove);";
        if (JFBCFactory::config()->get('social_notification_google_analytics')) {
            $subs .= "\njfbc.social.googleAnalytics.trackFacebook();";
        }
        $fbCanvas = JFBConnectProviderFacebookCanvas::getInstance();
        if ($fbCanvas->get('resizeEnabled', false)) {
            $resizeCode = "window.setTimeout(function() {\n" . "  FB.Canvas.setAutoGrow();\n" . "}, 250);";
        } else {
            $resizeCode = "";
        }
        if ($fbCanvas->get('canvasEnabled', false)) {
            $canvasCode = "jfbc.canvas.checkFrame();";
        } else {
            $canvasCode = "";
        }
        // Figure out if status:true should be set. When false, makes page load faster
        $user = JFactory::getUser();
        $guest = $user->guest;
        // Check cookie to make sure autologin hasn't already occurred once. If so, and we try again, there will be loops.
        $autoLoginPerformed = JRequest::getInt('jfbconnect_autologin_disable', 0, 'COOKIE');
        if (JFBCFactory::config()->get('facebook_auto_login') && $guest && !$autoLoginPerformed) {
            $status = 'status: true,';
            // get Event Notification subscriptions
            $subs .= "\nFB.Event.subscribe('auth.authResponseChange', function(response) {jfbc.login.facebook_onlogin();});";
        } else {
            $status = 'status: false,';
        }
        $debugEnabled = $this->configModel->get('facebook_display_errors');
        $script = $debugEnabled ? "sdk/debug.js" : "sdk.js";
        if ($this->appId) {
            $appIdCode = "appId: '" . $this->appId . "', ";
        } else {
            $appIdCode = "";
        }
        $forceParse = JFBCFactory::config()->get('social_tags_always_parse');
        $xfbml = $forceParse || $this->widgetRendered ? 'true' : 'false';
        $version = "version: 'v2.3',";
        $javascript = <<<EOT
<div id="fb-root"></div>
<script type="text/javascript">
  {$canvasCode}
  window.fbAsyncInit = function() {
    FB.init({{$version}{$appIdCode}{$status} cookie: true, xfbml: {$xfbml}});{$subs}{$resizeCode}
  };
  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/{$locale}/{$script}";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
</script>
EOT;
        if (preg_match('/\\<body[\\s\\S]*?\\>/i', $body, $matches)) {
            $newBody = str_replace($matches[0], $matches[0] . $javascript, $body);
            JResponse::setBody($newBody);
        }
    }
Ejemplo n.º 15
0
 private function sendNewUserEmails(&$user, $providerName)
 {
     $app = JFactory::getApplication();
     $sendEmail = true;
     $profileEmails = $app->triggerEvent('socialProfilesSendsNewUserEmails');
     foreach ($profileEmails as $pe) {
         if ($pe) {
             $sendEmail = false;
         }
     }
     if (!$sendEmail) {
         return;
     }
     $useractivation = $this->getActivationMode();
     $newEmail = $user->get('email');
     if (SCStringUtilities::endswith($newEmail, "@unknown.com")) {
         return;
     }
     // Compile the notification mail values.
     $config = JFactory::getConfig();
     $params = JComponentHelper::getParams('com_users');
     $language = JFactory::getLanguage();
     $language->load('com_users');
     SCStringUtilities::loadLanguage('com_jfbconnect');
     $data = $user->getProperties();
     $data['fromname'] = $config->get('fromname');
     $data['mailfrom'] = $config->get('mailfrom');
     $data['sitename'] = $config->get('sitename');
     $data['siteurl'] = JUri::base();
     $uri = JURI::getInstance();
     $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
     $data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
     if (JFBCFactory::config()->get('registration_send_new_user_email') || $useractivation > 0) {
         $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
         // Handle account activation/confirmation emails.
         if ($useractivation == 2) {
             // Set the link to confirm the user email.
             if ($this->_newUserPassword == '') {
                 $emailBody = JText::sprintf('COM_JFBCONNECT_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY_NOPASSWORD', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $providerName);
             } else {
                 $emailBody = JText::sprintf('COM_JFBCONNECT_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $providerName, $data['username'], $this->_newUserPassword);
             }
         } else {
             if ($useractivation == 1) {
                 // Set the link to activate the user account.
                 if ($this->_newUserPassword == '') {
                     $emailBody = JText::sprintf('COM_JFBCONNECT_EMAIL_REGISTERED_WITH_ACTIVATION_BODY_NOPASSWORD', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $providerName);
                 } else {
                     $emailBody = JText::sprintf('COM_JFBCONNECT_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'] . 'index.php?option=com_users&task=registration.activate&token=' . $data['activation'], $data['siteurl'], $providerName, $data['username'], $this->_newUserPassword);
                 }
             } else {
                 $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
                 if ($this->_newUserPassword == '') {
                     $emailBody = JText::sprintf('COM_JFBCONNECT_EMAIL_REGISTERED_BODY_NOPASSWORD', $data['name'], $data['sitename'], $data['siteurl'], $providerName);
                 } else {
                     $emailBody = JText::sprintf('COM_JFBCONNECT_EMAIL_REGISTERED_BODY', $data['name'], $data['sitename'], $data['siteurl'], $providerName, $data['username'], $this->_newUserPassword);
                 }
             }
         }
         // Send the registration email.
         $return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody);
     } else {
         $return = true;
     }
     if ($useractivation < 2 && $params->get('mail_to_admin') == 1) {
         $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
         $emailBodyAdmin = JText::sprintf('COM_USERS_EMAIL_REGISTERED_NOTIFICATION_TO_ADMIN_BODY', $data['name'], $data['username'], $data['siteurl']);
         // get all admin users
         $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE sendEmail=1';
         $db = JFactory::getDBO();
         $db->setQuery($query);
         $rows = $db->loadObjectList();
         // Send mail to all superadministrators id
         foreach ($rows as $row) {
             $return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $row->email, $emailSubject, $emailBodyAdmin);
             // Check for an error.
             if ($return !== true) {
                 $this->setError(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED'));
                 return false;
             }
         }
     }
     // Check for an error.
     if ($return !== true) {
         $this->setError(JText::_('COM_USERS_REGISTRATION_SEND_MAIL_FAILED'));
         // Send a system message to administrators receiving system mails
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->clear()->select($db->quoteName('id'))->from($db->quoteName('#__users'))->where($db->quoteName('block') . ' = ' . (int) 0)->where($db->quoteName('sendEmail') . ' = ' . (int) 1);
         $db->setQuery($query);
         try {
             $sendEmail = $db->loadColumn();
         } catch (RuntimeException $e) {
             $this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
             return false;
         }
         if (count($sendEmail) > 0) {
             $jdate = new JDate();
             // Build the query to add the messages
             foreach ($sendEmail as $userid) {
                 $values = array($db->quote($userid), $db->quote($userid), $db->quote($jdate->toSql()), $db->quote(JText::_('COM_USERS_MAIL_SEND_FAILURE_SUBJECT')), $db->quote(JText::sprintf('COM_USERS_MAIL_SEND_FAILURE_BODY', $return, $data['username'])));
                 $query->clear()->insert($db->quoteName('#__messages'))->columns($db->quoteName(array('user_id_from', 'user_id_to', 'date_time', 'subject', 'message')))->values(implode(',', $values));
                 $db->setQuery($query);
                 try {
                     $db->execute();
                 } catch (RuntimeException $e) {
                     $this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
                     return false;
                 }
             }
         }
         return false;
     }
 }
Ejemplo n.º 16
0
require_once JPATH_SITE . '/components/com_jfbconnect/libraries/factory.php';
$document = JFactory::getDocument();
$document->addStyleSheet("components/com_jfbconnect/assets/css/default.css");
$document->addStyleSheet(JURI::root() . "media/sourcecoast/css/sc_bootstrap.css");
$document->addStyleSheet(JURI::root() . "media/sourcecoast/css/common.css");
$document->addScript(JURI::root() . "media/sourcecoast/js/jq-bootstrap-1.8.3.js");
$document->addScript("components/com_jfbconnect/assets/jfbconnect-admin.js");
$document->addScript("components/com_jfbconnect/assets/js/jfbcadmin-template.js");
if (defined('SC16')) {
    $document->addScriptDeclaration('jfbcJQuery(document).ready(function ()
    {
        jfbcMakePrettyRadioButtons();
    })');
}
jimport('sourcecoast.utilities');
SCStringUtilities::loadLanguage('com_jfbconnect', JPATH_ADMINISTRATOR);
require_once JPATH_COMPONENT . '/controller.php';
$input = JFactory::getApplication()->input;
$task = $input->getCmd('task');
// Slowly update these 'old' admin views to the new style...
$oldStyle = array('ajax', 'autotune', 'canvas', 'config', 'notification', 'opengraph', 'profiles', 'request', 'social', 'usermap');
if (strpos($task, '.') === false && (in_array(JRequest::getCmd('controller', ''), $oldStyle) || in_array(JRequest::getCmd('view', ''), $oldStyle))) {
    // Old beatup way. Don't do this anymore
    $view = JRequest::getCmd('controller', '');
    if ($view == "") {
        $view = JRequest::getCmd('view', '');
    }
    if ($view != '' && $view != "jfbconnect") {
        require_once JPATH_COMPONENT . '/controllers/' . strtolower($view) . '.php';
        $controllerName = $view;
    } else {
Ejemplo n.º 17
0
 public function getLoginButtonWithImage($params, $loginClass, $loginID)
 {
     if (is_array($params)) {
         $reg = new JRegistry();
         $reg->loadArray($params);
         $params = $reg;
     } else {
         if (!$params) {
             $params = new JRegistry();
         }
     }
     $alignment = $params->get('alignment', 'left');
     $image = $params->get('image', JFBCFactory::config()->get($this->systemName . '_login_button', 'icon_label.png'));
     SCStringUtilities::loadLanguage('com_jfbconnect');
     $buttonAltTitle = JText::_('COM_JFBCONNECT_LOGIN_USING_' . strtoupper($this->name));
     return '<div class="social-login ' . $this->systemName . ' ' . $loginClass . ' pull-' . $alignment . '">
     <a id="' . $loginID . '" href="javascript:void(0)" onclick="jfbc.login.provider(\'' . $this->systemName . '\');">
         <img src="' . JURI::root(true) . '/media/sourcecoast/images/provider/' . $this->systemName . '/' . $image . '" alt="' . $buttonAltTitle . '" title="' . $buttonAltTitle . '"/></a>
         </div>';
 }
Ejemplo n.º 18
0
 private function removeRenderKey($easyTag, $renderKey)
 {
     if ($renderKey != '') {
         $key = 'key=' . $renderKey;
         $easyTag = str_ireplace($key . ' ', '', $easyTag);
         //Key with blank space
         $easyTag = str_ireplace($key, '', $easyTag);
         $easyTag = SCStringUtilities::trimNBSP($easyTag);
     }
     return $easyTag;
 }
Ejemplo n.º 19
0
 protected function getProfileFields()
 {
     $fields = array();
     if (JPluginHelper::isEnabled('user', 'profile')) {
         SCStringUtilities::loadLanguage('plg_user_profile', JPATH_ADMINISTRATOR);
         $form = JForm::getInstance('profile', JPATH_SITE . '/plugins/user/profile/profiles/profile.xml');
         $allFields = $form->getFieldset();
         foreach ($allFields as $f) {
             if ($f->name != 'profile[spacer]' && $f->fieldname != 'tos') {
                 $fields[] = (object) array('id' => $f->fieldname, "name" => $f->title);
             }
         }
     } else {
         $fields[] = (object) array('id' => 'xyz', 'name' => 'User - Profile plugin not enabled');
     }
     return $fields;
 }
Ejemplo n.º 20
0
 * @version         Release v6.4.2
 * @build-date      2015/08/24
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
jimport('joomla.filesystem.file');
if (!JFile::exists(JPATH_ROOT . '/components/com_jfbconnect/libraries/provider.php')) {
    echo "JFBConnect not found. Please reinstall.";
    return;
}
if (!class_exists('JFBCFactory')) {
    echo "JFBConnect not enabled. Please enable.";
    return;
}
jimport('sourcecoast.utilities');
SCStringUtilities::loadLanguage('com_jfbconnect');
$channels = $params->get('channel_id');
if (!is_array($channels)) {
    $channels = explode(',', $channels);
}
$options = new JRegistry();
$options->set('show_provider', $params->get('show_provider'));
$options->set('show_date', $params->get('show_date'));
$options->set('show_link', $params->get('show_link'));
$options->set('show_post', $params->get('show_post'));
$options->set('show_comments', $params->get('show_comments'));
$options->set('post_limit', $params->get('post_limit'));
$options->set('datetime_format', $params->get('datetime_format'));
//$options->set('datetime_format', JText::_('DATE_FORMAT_LC2'));
$stream = new JFBConnectStream($options, $channels);
$height = $params->get('height');
Ejemplo n.º 21
0
 protected function getSelectedText($contentText, $socialGraphFirstText, $numCharacters)
 {
     $articleText = SCStringUtilities::trimNBSP($contentText);
     $articleText = strip_tags($articleText);
     $articleText = preg_replace('/\\s+/', ' ', $articleText);
     $articleText = str_replace('{K2Splitter}', '', $articleText);
     SCSocialUtilities::stripSystemTags($articleText, 'JFBC');
     SCSocialUtilities::stripSystemTags($articleText, 'JLinked');
     SCSocialUtilities::stripSystemTags($articleText, 'SC');
     SCSocialUtilities::stripSystemTags($articleText, 'loadposition');
     $articleText = trim($articleText);
     $addEllipsis = false;
     if ($socialGraphFirstText == '1') {
         $addEllipsis = strlen($articleText) > $numCharacters;
         if (function_exists('mb_substr')) {
             $articleText = mb_substr($articleText, 0, $numCharacters, 'UTF-8');
         } else {
             $articleText = substr($articleText, 0, $numCharacters);
         }
     } else {
         if ($socialGraphFirstText == '2') {
             if (function_exists('mb_split')) {
                 $parts = mb_split('\\s+', $articleText);
             } else {
                 $parts = preg_split('/\\s+/', $articleText);
             }
             $selParts = array_slice($parts, 0, $numCharacters);
             $articleText = implode(" ", $selParts);
             $addEllipsis = count($parts) > $numCharacters;
         } else {
             $articleText = '';
         }
     }
     if ($addEllipsis) {
         $articleText .= '...';
     }
     return $articleText;
 }
Ejemplo n.º 22
0
 private function addTagFromString($graphFieldStr, $isDefault, $priority, $origin)
 {
     $keyValue = explode('=', $graphFieldStr, 2);
     if (count($keyValue) == 2) {
         $graphName = strtolower(trim($keyValue[0]));
         $graphValue = SCStringUtilities::trimNBSP($keyValue[1]);
         //$graphValue = trim($keyValue[1]);
         if ($isDefault) {
             $this->addDefaultGraphTag($graphName, $graphValue, $priority);
         } else {
             $this->addOpenGraphTag($graphName, $graphValue, false, $priority, $origin);
         }
     }
 }
Ejemplo n.º 23
0
 function __construct($className, $tagName, $id, $loginTextKey, $loginButtonClass, $logoutButtonId)
 {
     $this->className = $className;
     $this->tagName = strtolower($tagName);
     $this->loginButtonId = $id;
     $this->loginButtonClass = $loginButtonClass;
     $this->logoutButtonId = $logoutButtonId;
     SCStringUtilities::loadLanguage('com_jfbconnect');
     $this->loginButtonText = JText::_($loginTextKey);
     $this->examples = array('{' . $tagName . '}', '{' . $tagName . ' logout=true logout_url=http://www.sourcecoast.com}');
 }