Beispiel #1
0
 function update($setting, $value)
 {
     if (is_array($value) || is_object($value)) {
         $value = serialize($value);
     } else {
         $value = trim($value);
     }
     $query = $this->_db->getQuery(true);
     $query->select($this->_db->qn('id'))->from($this->_db->qn($this->table))->where($this->_db->qn('setting') . "=" . $this->_db->quote($setting));
     $this->_db->setQuery($query);
     $settingId = $this->_db->loadResult();
     $row = $this->getTable();
     $row->id = $settingId;
     $row->setting = $setting;
     $row->value = $value;
     if (!$settingId) {
         $row->created_at = JFactory::getDate()->toSql();
     }
     $row->updated_at = JFactory::getDate()->toSql();
     if (!$row->check()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if ($setting == 'sc_download_id') {
         JFBCFactory::model('updates')->refreshUpdateSites($value);
     }
     $this->settings = null;
     return true;
 }
Beispiel #2
0
 public function post()
 {
     $app = JFactory::getApplication();
     //$type = $app->input->get('type','story','STRING');
     $provider_nm = $app->input->get('provider', 'facebook', 'CMD');
     $user_id = $app->input->get('user_id', 0, 'INT');
     $tokan = $app->input->get('tokan', 0, 'RAW');
     $email = $app->input->get('email', '', 'STRING');
     $password = $app->input->get('password', '', 'STRING');
     //$log_usr = $this->plugin->get('user')->id;
     $provider = JFBCFactory::provider($provider_nm);
     $provider->client->authenticate();
     $loginRegisterModel = JFBCFactory::model('LoginRegister');
     //$user = jFactory::getUser(161);
     $provider->setSessionToken();
     $provider->client->setExtendedAccessToken();
     //$provider_obj->client->getUser();
     $provider->onBeforeLogin();
     $config = JFactory::getConfig();
     $lifetime = $config->get('lifetime', 15);
     setcookie('jfbconnect_autologin_disable', 1, time() + $lifetime * 60);
     $providerUserId = $provider->getProviderUserId();
     $userMapModel = JFBCFactory::usermap();
     $jUserId = $userMapModel->getJoomlaUserId($providerUserId, strtolower($provider->name));
     $jUserEmailId = $userMapModel->getJoomlaUserIdFromEmail($email);
     //get temp id
     if ($jUserEmailId) {
         $providerUserId = $userMapModel->getProviderUserId($jUserEmailId, strtolower($provider->name));
         $jUserId = $userMapModel->getJoomlaUserId($providerUserId, strtolower($provider->name));
     } else {
         if (!$jUserEmailId && JFBCFactory::config()->getSetting('automatic_registration')) {
             //# User is not in system, should create their account automatically
             //$jUserEmailId = $userMapModel->getJoomlaUserIdFromEmail($email);
             if (!$jUserEmailId) {
                 $pdata = array();
                 $pdata['email'] = $email;
                 $pdata['password'] = $password;
                 $fbuser = $loginRegisterModel->createNewUser($provider);
             }
             if ($loginRegisterModel->autoCreateUser($providerUserId, $provider)) {
                 $jUserId = $userMapModel->getJoomlaUserId($providerUserId, strtolower($provider->name));
             }
         }
     }
     $jUser = JUser::getInstance($jUserId);
     $loginSuccess = false;
     // Try to log the user, but not if blocked and initial registration (then there will be a pretty message on how to activate)
     if (!$provider->initialRegistration || $jUser->get('block') == 0 && $provider->initialRegistration) {
         $options = array('silent' => 1, 'provider' => $provider, 'provider_user_id' => $providerUserId);
         // Disable other authentication messages
         // hack for J3.2.0 bug. Should remove after 3.2.1 is available.
         $password = $provider->secretKey;
         $loginSuccess = $app->login(array('username' => $provider->appId, 'password' => $password), $options);
     }
     $this->plugin->setResponse($jUser);
 }
Beispiel #3
0
 public function ajaxGetHtml()
 {
     $return = new stdClass();
     $return->target = '#social-post-container';
     $return->title = JText::_('COM_JFBCONNECT_CHANNELS_POST_TITLE');
     $channels = JFBCFactory::model('channel')->getChannels();
     $checkboxes = array();
     foreach ($channels as $c) {
         $options = new JRegistry();
         $options->loadObject($c);
         $data = JFBCFactory::provider($c->provider)->channel($c->type, $options);
         if ($data->postCharacterMax > 0) {
             $charCounter = ' <span class="social-post-counter" data-max="' . $data->postCharacterMax . '" data-url-length="' . $data->urlLength . '"></span>';
         } else {
             $charCounter = "";
         }
         $checkboxes[] = '<input type="checkbox" name="cids[]" class="' . $c->provider . '-' . $c->type . '" value="' . $c->id . '" id="cid_' . $c->id . '" />
             <label class="channel-name" for="cid_' . $c->id . '">
                 <img src="' . JURI::root() . 'media/sourcecoast/images/provider/' . $c->provider . '/icon.png" />' . $c->title . '</label>' . $charCounter;
     }
     if (count($checkboxes) > 0) {
         $return->html = '<div id="social-post-popup">
         <form id="social-post-form" action="index.php?option=com_jfbconnect&task=ajax.fetch&library=toolbar.button.post&subtask=createPost">
       <p>' . JText::_('COM_JFBCONNECT_CHANNELS_POST_INSTRUCTION_LABEL') . '</p>
       <textarea id="social-post-message" name="message" style="width:90%" rows="5"></textarea>
       <br/><input type="checkbox" id="channels_selectall" onclick="
       jfbcJQuery(\'#social-post-popup :checkbox\').each(function() {
          if(this.id != \'channels_selectall\')
             this.checked = jfbcJQuery(\'#channels_selectall\').is(\':checked\');
          });
       "/><label for="channels_selectall">Select All</label><br/>
       ' . implode("<br/>", $checkboxes) . JHTML::_('form.token') . '</form>
           </div>';
         $return->buttons = array();
         $button = array('name' => "Post", 'id' => 'submit-social-post', 'action' => 'jfbc.toolbar.post.submit');
         $button['name'] = "Post";
         $return->buttons[] = $button;
     } else {
         $return->html = JText::_('COM_JFBCONNECT_CHANNELS_POST_ERROR_LABEL');
     }
     echo json_encode($return);
 }
Beispiel #4
0
 function display($tpl = null)
 {
     $model = JFBCFactory::model('updates');
     $downloadId = JFBCFactory::config()->get('sc_download_id');
     $xmlElement = simplexml_load_file(JPATH_ADMINISTRATOR . '/components/com_jfbconnect/jfbconnect.xml');
     if ($xmlElement) {
         $jfbcVersion = (string) $xmlElement->version;
     } else {
         $jfbcVersion = "Unknown. XML Manifest could not be read.";
     }
     $jfbcUpdateSite = $model->getUpdateSite();
     if (is_object($jfbcUpdateSite) && $jfbcUpdateSite->enabled) {
         $jfbcUpdateSiteEnabled = true;
     } else {
         $jfbcUpdateSiteEnabled = false;
     }
     $jfbcUpdate = $model->getJfbconnectUpdateId();
     $this->jfbcUpdateSiteEnabled = $jfbcUpdateSiteEnabled;
     $this->jfbcVersion = $jfbcVersion;
     $this->jfbcUpdate = $jfbcUpdate;
     $this->addToolbar();
     parent::display($tpl);
 }
Beispiel #5
0
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 * @version         Release v6.4.2
 * @build-date      2015/08/24
 */
defined('_JEXEC') or die('Restricted access');
jimport('joomla.version');
jimport('sourcecoast.utilities');
jimport('sourcecoast.adminHelper');
$token = JSession::getFormToken() . '=' . 1;
$ajaxUrl = JURI::base() . 'index.php?option=com_installer&view=update&task=update.ajax&' . $token;
$script = "var jfbconnect_update_ajax_url = '{$ajaxUrl}';\n";
$script .= 'var jfbconnect_update_text = {"UPTODATE" : "' . JText::_('COM_JFBCONNECT_UPDATES_UPDATE_TEXT') . '",
    "UPDATEFOUND": "' . JText::_('COM_JFBCONNECT_UPDATES_UPDATE_FOUND') . '",
    "ERROR": "' . JText::_('COM_JFBCONNECT_UPDATES_UPDATE_ERROR') . '"
    };' . "\n";
$extensionId = JFBCFactory::model('updates')->getJfbconnectExtensionId();
$script .= "var jfbconnect_extension_id = '{$extensionId}';\n";
$script .= "jfbcAdmin.checkForUpdate();";
$document = JFactory::getDocument();
$document->addScriptDeclaration($script);
$configModel = $this->configModel;
$autotuneModel = $this->autotuneModel;
$usermapModel = $this->usermapModel;
$userCounts = $this->userCounts;
$feed = $this->getFeed();
?>
<div class="sourcecoast">
    <div class="row-fluid">
        <div class="span12">
            <div class="span6">
                <div class="jfbcControlIcons">