/**
  * Check if ID can be link or not. if yes the link account.
  */
 public static function link_account_if_possible()
 {
     global $loginRadiusObject, $wpdb, $user_ID;
     $loginRadiusMappingData = array();
     if (null == $loginRadiusObject) {
         $loginRadiusObject = new LoginRadius();
     }
     if (isset($_REQUEST['token']) && is_user_logged_in()) {
         try {
             $loginRadiusUserprofile = $loginRadiusObject->loginradius_get_user_profiledata($_REQUEST['token']);
         } catch (LoginRadiusException $e) {
             // Error Handling
             if ($loginRadiusSettings['enable_degugging'] == '0') {
                 // if debugging is off and Social profile not recieved, redirect to home page.
                 wp_redirect(site_url());
                 exit;
             } else {
                 $loginRadiusUserprofile = null;
                 $message = isset($e->getErrorResponse()->description) ? $e->getErrorResponse()->description : $e->getMessage();
                 error_log($message);
                 // If debug option is set and Social Profile not retrieved
                 Login_Helper::login_radius_notify($message, 'isProfileNotRetrieved');
                 return;
             }
         }
         $loginRadiusMappingData['id'] = !empty($loginRadiusUserprofile->ID) ? $loginRadiusUserprofile->ID : '';
         $loginRadiusMappingData['provider'] = !empty($loginRadiusUserprofile->Provider) ? $loginRadiusUserprofile->Provider : '';
         $loginRadiusMappingData['thumbnail'] = !empty($loginRadiusUserprofile->ThumbnailImageUrl) ? trim($loginRadiusUserprofile->ThumbnailImageUrl) : '';
         if (empty($loginRadiusMappingData['thumbnail']) && $loginRadiusMappingData['provider'] == 'facebook') {
             $loginRadiusMappingData['thumbnail'] = 'http://graph.facebook.com/' . $loginRadiusMappingData['id'] . '/picture?type=large';
         }
         $loginRadiusMappingData['pictureUrl'] = !empty($loginRadiusUserprofile->ImageUrl) ? trim($loginRadiusUserprofile->ImageUrl) : '';
         $wp_user_id = $wpdb->get_var($wpdb->prepare('SELECT user_id FROM ' . $wpdb->usermeta . ' WHERE meta_key="loginradius_provider_id" AND meta_value = %s', $loginRadiusMappingData['id']));
         if (!empty($wp_user_id)) {
             // Check if verified field exist or not.
             $loginRadiusVfyExist = $wpdb->get_var($wpdb->prepare('SELECT user_id FROM ' . $wpdb->usermeta . ' WHERE user_id = %d AND meta_key = "loginradius_isVerified"', $wp_user_id));
             if (!empty($loginRadiusVfyExist)) {
                 // if verified field exists
                 $loginRadiusVerify = $wpdb->get_var($wpdb->prepare('SELECT meta_value FROM ' . $wpdb->usermeta . ' WHERE user_id = %d AND meta_key = "loginradius_isVerified"', $wp_user_id));
                 if ($loginRadiusVerify != '1') {
                     self::link_account($user_ID, $loginRadiusMappingData['id'], $loginRadiusMappingData['provider'], $loginRadiusMappingData['thumbnail'], $loginRadiusMappingData['pictureUrl']);
                     return true;
                 } else {
                     //account already mapped
                     return false;
                 }
             } else {
                 return false;
             }
         } else {
             $loginRadiusMappingProvider = $loginRadiusMappingData['provider'];
             $wp_user_lrid = $wpdb->get_var($wpdb->prepare('SELECT user_id FROM ' . $wpdb->usermeta . ' WHERE meta_key="' . $loginRadiusMappingProvider . 'Lrid" AND meta_value = %s', $loginRadiusMappingData['id']));
             if (!empty($wp_user_lrid)) {
                 $lrVerified = get_user_meta($wp_user_lrid, $loginRadiusMappingProvider . 'LrVerified', true);
                 if ($lrVerified == '1') {
                     // Check if lrid is the same that verified email.
                     // account already mapped
                     return false;
                 } else {
                     // map account
                     self::link_account($user_ID, $loginRadiusMappingData['id'], $loginRadiusMappingData['provider'], $loginRadiusMappingData['thumbnail'], $loginRadiusMappingData['pictureUrl']);
                     return true;
                 }
             } else {
                 // map account
                 self::link_account($user_ID, $loginRadiusMappingData['id'], $loginRadiusMappingData['provider'], $loginRadiusMappingData['thumbnail'], $loginRadiusMappingData['pictureUrl']);
                 return true;
             }
         }
     }
 }
Exemplo n.º 2
0
include_once 'config.php';
include_once 'LoginRadius_functions.php';
include_once 'LoginRadiusSDK.php';
?>
<html>
    <head>
        <!-- CSS goes in the document HEAD or added to your external stylesheet -->
        <title>SocialLogin :: UserProfile</title>
        <script src="js/jquery.js" type="text/javascript"></script>
        <script src="js/tabcontent.js" type="text/javascript"></script>
        <link href="css/tabs.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
        <?php 
if (isset($_REQUEST['token']) && !empty($_REQUEST['token'])) {
    $loginradius = new LoginRadius();
    try {
        $result_accesstoken = $loginradius->loginradius_exchange_access_token(LR_SECRETKEY);
        $lraccesstoken = $result_accesstoken->access_token;
    } catch (LoginRadiusException $e) {
        echo ' Access Token API :- ';
        echo $e->getMessage() . '<br><br>';
        echo 'Redirecting to home page in 5 seconds.....<br>';
        header("refresh:5;url=" . YOUR_DOMAIN);
        exit;
    }
    if (isset($lraccesstoken) && !empty($lraccesstoken)) {
        $UserPhotoalbums = '';
        $UserPhotos = '';
        $UserCheckins = '';
        $UserAudio = '';
Exemplo n.º 3
0
<?php

include_once 'config.php';
include_once 'LoginRadius_functions.php';
include_once 'LoginRadiusSDK.php';
if (!isset($_REQUEST['to']) || !isset($_REQUEST['subject']) || !isset($_REQUEST['message'])) {
    die;
}
$lrsendmessage = $_REQUEST;
$loginradius = new LoginRadius();
try {
    $SendMessage = $loginradius->loginradius_send_message($lrsendmessage['lraccesstoken'], $lrsendmessage['to'], $lrsendmessage['subject'], $lrsendmessage['message']);
} catch (LoginRadiusException $e) {
    die('<div id="Error">' . $e->getMessage() . '</div>');
}
if (isset($SendMessage->isPosted) && $SendMessage->isPosted == true) {
    die('<div id="Success">Message has been Posted</div>');
}
Exemplo n.º 4
0
<?php

include_once 'config.php';
include_once 'LoginRadius_functions.php';
include_once 'LoginRadiusSDK.php';
if (!isset($_REQUEST['lrphotoid']) || !isset($_REQUEST['lraccesstoken'])) {
    die;
}
$lrphoto = $_REQUEST;
$loginradius = new LoginRadius();
try {
    $Userphotos = $loginradius->loginradius_get_photos($lrphoto['lraccesstoken'], $lrphoto['lrphotoid']);
} catch (LoginRadiusException $e) {
    die('<div id="Error">' . $e->getMessage() . '</div>');
}
if (!empty($Userphotos)) {
    ?>
    <h2>photos</h2>
    <table class="gridtable" cellspacing="0">
        <thead>
            <tr>
                <th><?php 
    echo 'ID';
    ?>
</th>
                <th><?php 
    echo 'AlbumId';
    ?>
</th>
                <th><?php 
    echo 'OwnerId';
 function onAfterInitialise()
 {
     $lrdata = array();
     $user_id = '';
     $id = '';
     $email = '';
     $msg = '';
     $defaultUserGroups = '';
     $lr_settings = array();
     $lr_settings = plgSystemSocialLoginTools::sociallogin_getsettings();
     // Get module configration option value
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $config = JFactory::getConfig();
     $language = JFactory::getLanguage();
     $session = JFactory::getSession();
     $language->load('com_users');
     $language->load('com_socialloginandsocialshare', JPATH_ADMINISTRATOR);
     $authorize = JFactory::getACL();
     // Retrive data from LoginRadius.
     $obj = new LoginRadius();
     $lr_settings['apisecret'] = !empty($lr_settings['apisecret']) ? $lr_settings['apisecret'] : "";
     $userprofile = $obj->sociallogin_getapi($lr_settings['apisecret']);
     // Checking user is logged in.
     if ($obj->IsAuthenticated == true && JFactory::getUser()->id) {
         $lrdata = plgSystemSocialLoginTools::get_userprofile_data($userprofile);
         $providerquery = "SELECT provider from #__LoginRadius_users WHERE provider=" . $db->Quote($lrdata['Provider']) . " AND id = " . JFactory::getUser()->id;
         $db->setQuery($providerquery);
         $check_provider = $db->loadResult();
         // Check lr id exist.
         $query = "SELECT LoginRadius_id from #__LoginRadius_users WHERE LoginRadius_id=" . $db->Quote($lrdata['id']) . " AND id = " . JFactory::getUser()->id;
         $db->setQuery($query);
         $check_id = $db->loadResult();
         // Try to map another account.
         if (empty($check_id)) {
             if (empty($check_provider)) {
                 $userImage = plgSystemSocialLoginTools::add_newid_image($lrdata);
                 // Remove.
                 $sql = "DELETE FROM #__LoginRadius_users WHERE LoginRadius_id = " . $db->Quote($lrdata['id']);
                 $db->setQuery($sql);
                 if ($db->query()) {
                     // Add new id to db.
                     $sql = "INSERT INTO #__LoginRadius_users SET id = " . JFactory::getUser()->id . ", LoginRadius_id = " . $db->Quote($lrdata['id']) . ", provider = " . $db->Quote($lrdata['Provider']) . ", lr_picture = " . $db->Quote($userImage);
                     $db->setQuery($sql);
                     $db->query();
                 }
                 $mainframe->enqueueMessage(JText::_('COM_SOCIALLOGIN_ADD_ID'));
                 $mainframe->redirect('index.php?option=com_socialloginandsocialshare&view=profile');
             } else {
                 JError::raiseWarning('', JTEXT::_('COM_SOCIALLOGIN_EXIST_PROVIDER'));
                 $mainframe->redirect('index.php?option=com_socialloginandsocialshare&view=profile');
                 return false;
             }
         } else {
             JError::raiseWarning('', JText::_('COM_SOCIALLOGIN_EXIST_ID'));
             $mainframe->redirect('index.php?option=com_socialloginandsocialshare&view=profile');
             return false;
         }
     }
     // User is not logged in trying to make log in user.
     if ($obj->IsAuthenticated == true && !JFactory::getUser()->id) {
         // Remove the session if any.
         if ($session->get('tmpuser')) {
             $session->clear('tmpuser');
         }
         // Getting all user data.
         $lrdata = plgSystemSocialLoginTools::get_userprofile_data($userprofile);
         if ($lr_settings['dummyemail'] == 0 && $lrdata['email'] == "") {
             // Random email if not true required email.
             $lrdata['email'] = plgSystemSocialLoginTools::get_random_email($lrdata);
         }
         // Find the not activate user.
         $query = "SELECT u.id FROM #__users AS u INNER JOIN #__LoginRadius_users AS lu ON lu.id = u.id WHERE lu.LoginRadius_id = '" . $lrdata['id'] . "' AND u.activation != '' AND u.activation != 0";
         $db->setQuery($query);
         $block_id = $db->loadResult();
         if (!empty($block_id) || $block_id) {
             JError::raiseWarning('', JText::_('COM_SOCIALLOGIN_USER_NOTACTIVATE'));
             return false;
         }
         // Find the block user.
         $query = "SELECT u.id FROM #__users AS u INNER JOIN #__LoginRadius_users AS lu ON lu.id = u.id WHERE lu.LoginRadius_id = '" . $lrdata['id'] . "' AND u.block = 1";
         $db->setQuery($query);
         $block_id = $db->loadResult();
         if (!empty($block_id) || $block_id) {
             JError::raiseWarning('', JText::_('COM_SOCIALLOGIN_USER_BLOCK'));
             return false;
         }
         // Checking user admin mail setting.
         if ($lr_settings['dummyemail'] == 1 && $lrdata['email'] == '') {
             $usersConfig = JComponentHelper::getParams('com_users');
             $useractivation = $usersConfig->get('useractivation');
             $query = "SELECT u.id FROM #__users AS u INNER JOIN #__LoginRadius_users AS lu ON lu.id = u.id WHERE lu.LoginRadius_id = '" . $lrdata['id'] . "'";
             $db->setQuery($query);
             $user_id = $db->loadResult();
             $newuser = true;
             if (isset($user_id)) {
                 $user = JFactory::getUser($user_id);
                 if ($user->id == $user_id) {
                     $newuser = false;
                 }
             } else {
                 if ($useractivation == '0') {
                     $lrdata['email'] = plgSystemSocialLoginTools::get_random_email($lrdata);
                 } else {
                     $title = str_replace("%s", ' <b> ' . $lrdata['Provider'] . ' </b>', $lr_settings['emailtitle']);
                     $msg = str_replace("%s", ' <b> ' . $lrdata['Provider'] . ' </b>', $lr_settings['emailrequiredmessage']);
                     $msgtype = 'msg';
                     // Register session variables.
                     $session->set('tmpuser', $lrdata);
                     plgSystemSocialLoginTools::enterEmailPopup($title, $msg, $msgtype);
                 }
             }
         }
     }
     // Check user click on enter mail popup submit button.
     if (isset($_POST['sociallogin_emailclick'])) {
         $lrdata = $session->get('tmpuser');
         if (isset($_POST['session']) && $_POST['session'] == $lrdata['session'] && !empty($lrdata['session'])) {
             $email = urldecode($_POST['email']);
             if (!JMailHelper::isEmailAddress($email)) {
                 $msgtype = 'warning';
                 $title = str_replace("%s", ' <b> ' . $lrdata['Provider'] . ' </b>', $lr_settings['emailtitle']);
                 $msg = str_replace("%s", ' <b> ' . $lrdata['Provider'] . ' </b>', $lr_settings['emailinvalidmessage']);
                 plgSystemSocialLoginTools::enterEmailPopup($title, $msg, $msgtype);
                 return false;
             } else {
                 $email = $db->getEscaped($email);
                 $query = "SELECT id FROM #__users WHERE email=" . $db->Quote($email);
                 $db->setQuery($query);
                 $user_exist = $db->loadResult();
                 if ($user_exist != 0) {
                     $msgtype = 'warning';
                     $title = str_replace("%s", ' <b> ' . $lrdata['Provider'] . ' </b>', $lr_settings['emailtitle']);
                     $msg = str_replace("%s", ' <b> ' . $lrdata['Provider'] . ' </b>', $lr_settings['emailinvalidmessage']);
                     plgSystemSocialLoginTools::enterEmailPopup($title, $msg, $msgtype);
                     return false;
                 } else {
                     $lrdata = $session->get('tmpuser');
                     $email = $db->getEscaped(urldecode($_POST['email']));
                     $lrdata['email'] = $email;
                 }
             }
         } else {
             $session->clear('tmpuser');
             JError::raiseWarning('', JText::_('COM_SOCIALLOGIN_SESSION_EXPIRED'));
             return false;
         }
     } else {
         if (isset($_POST['cancel'])) {
             // Redirect after Cancel click.
             $session->clear('tmpuser');
             $redirct = JURI::base();
             $mainframe->redirect($redirct);
         }
     }
     if (isset($lrdata['id']) && !empty($lrdata['id']) && !empty($lrdata['email'])) {
         // Filter username form data.
         if (!empty($lrdata['fname']) && !empty($lrdata['lname'])) {
             $username = $lrdata['fname'] . $lrdata['lname'];
             $name = $lrdata['fname'];
         } else {
             $username = plgSystemSocialLoginTools::get_filter_username($lrdata);
             $name = plgSystemSocialLoginTools::get_filter_username($lrdata);
         }
         $query = "SELECT u.id FROM #__users AS u INNER JOIN #__LoginRadius_users AS lu ON lu.id = u.id WHERE lu.LoginRadius_id = '" . $lrdata['id'] . "'";
         $db->setQuery($query);
         $user_id = $db->loadResult();
         // If not then check for email exist.
         if (empty($user_id)) {
             $query = "SELECT id FROM #__users WHERE email='" . $lrdata['email'] . "'";
             $db->setQuery($query);
             $user_id = $db->loadResult();
             if (!empty($user_id)) {
                 $query = "SELECT LoginRadius_id from #__LoginRadius_users WHERE LoginRadius_id=" . $db->Quote($lrdata['id']) . " AND id = " . $user_id;
                 $db->setQuery($query);
                 $check_id = $db->loadResult();
                 if (empty($check_id) && $lr_settings['linkaccount'] == '1') {
                     // Add new id to db.
                     $userImage = plgSystemSocialLoginTools::add_newid_image($lrdata);
                     $sql = "INSERT INTO #__LoginRadius_users SET id = " . $user_id . ", LoginRadius_id = " . $db->Quote($lrdata['id']) . ", provider = " . $db->Quote($lrdata['Provider']) . ", lr_picture = " . $db->Quote($userImage);
                     $db->setQuery($sql);
                     $db->query();
                 }
             }
         }
         $newuser = true;
         if (isset($user_id)) {
             $user = JFactory::getUser($user_id);
             if ($user->id == $user_id) {
                 $newuser = false;
             }
         }
         if ($newuser == true) {
             $user = new JUser();
             $need_verification = false;
             // If user registration is not allowed, show 403 not authorized.
             $usersConfig = JComponentHelper::getParams('com_users');
             if ($usersConfig->get('allowUserRegistration') == '0') {
                 JError::raiseWarning('', JText::_('COM_SOCIALLOGIN_REGISTER_DISABLED'));
                 return false;
             }
             // Default to Registered.
             $defaultUserGroups = $usersConfig->get('new_usertype', 2);
             if (empty($defaultUserGroups)) {
                 $defaultUserGroups = 'Registered';
             }
             // if username already exists
             $username = plgSystemSocialLoginTools::get_exist_username($username);
             // Remove special char if have.
             $username = plgSystemSocialLoginTools::remove_unescapedChar($username);
             $name = plgSystemSocialLoginTools::remove_unescapedChar($name);
             //Insert data
             jimport('joomla.user.helper');
             $userdata = array();
             $userdata['name'] = $db->getEscaped($name);
             $userdata['username'] = $db->getEscaped($username);
             $userdata['email'] = $lrdata['email'];
             $userdata['usertype'] = 'deprecated';
             $userdata['groups'] = array($defaultUserGroups);
             $userdata['registerDate'] = JFactory::getDate()->toMySQL();
             $userdata['password'] = JUserHelper::genRandomPassword();
             $userdata['password2'] = $userdata['password'];
             $useractivation = $usersConfig->get('useractivation');
             if (isset($_POST['sociallogin_emailclick']) and $useractivation != '2') {
                 $need_verification = true;
             }
             if ($useractivation == '2' or $need_verification == true) {
                 $userdata['activation'] = JUtility::getHash(JUserHelper::genRandomPassword());
                 $userdata['block'] = 1;
             } else {
                 $userdata['activation'] = '';
                 $userdata['block'] = 0;
             }
             if (!$user->bind($userdata)) {
                 JError::raiseWarning('', JText::_('COM_USERS_REGISTRATION_BIND_FAILED'));
                 return false;
             }
             //Save the user
             if (!$user->save()) {
                 JError::raiseWarning('', JText::_('COM_SOCIALLOGIN_REGISTER_FAILED'));
                 return false;
             }
             $user_id = $user->get('id');
             // Saving user extra profile.
             //plgSystemSocialLoginTools::save_userprofile_data($user_id, $lrdata);
             // Trying to insert image.
             $profile_Image = $lrdata['thumbnail'];
             if (empty($profile_Image)) {
                 $profile_Image = JURI::root() . 'media' . DS . 'com_socialloginandsocialshare' . DS . 'images' . DS . 'noimage.png';
             }
             $userImage = $username . $user_id . '.jpg';
             $sociallogin_savepath = JPATH_ROOT . DS . 'images' . DS . 'sociallogin' . DS;
             plgSystemSocialLoginTools::insert_user_picture($sociallogin_savepath, $profile_Image, $userImage);
             // Remove.
             $sql = "DELETE FROM #__LoginRadius_users WHERE LoginRadius_id = " . $db->Quote($lrdata['id']);
             $db->setQuery($sql);
             if ($db->query()) {
                 //Add new id to db
                 $sql = "INSERT INTO #__LoginRadius_users SET id = " . $db->quote($user_id) . ",  LoginRadius_id = " . $db->Quote($lrdata['id']) . ", provider = " . $db->Quote($lrdata['Provider']) . ", lr_picture = " . $db->Quote($userImage);
                 $db->setQuery($sql);
                 $db->query();
             }
             // check for the community builder works.
             $query = "SHOW TABLES LIKE '%__comprofiler'";
             $db->setQuery($query);
             $cbtableexists = $db->loadResult();
             if (isset($cbtableexists)) {
                 plgSystemSocialLoginTools::make_cb_user($user, $profile_Image, $userImage, $lrdata);
             }
             // check for the k2 works.
             if (JPluginHelper::isEnabled('system', 'k2')) {
                 plgSystemSocialLoginTools::check_exist_comk2($user_id, $username, $profile_Image, $userImage, $lrdata);
             }
             // Check for kunena profile.
             if (JPluginHelper::isEnabled('system', 'kunena')) {
                 plgSystemSocialLoginTools::check_exist_comkunena($user_id, $username, $profile_Image, $userImage, $lrdata);
             }
             // check for the jom social works.
             $query = "SHOW TABLES LIKE '%__community_users'";
             $db->setQuery($query);
             $jomtableexists = $db->loadResult();
             if (isset($jomtableexists)) {
                 plgSystemSocialLoginTools::make_jomsocial_user($user, $profile_Image, $userImage);
             }
             if (JPluginHelper::isEnabled('user', 'jfusion')) {
                 plgSystemSocialLoginTools::create_jfusion_user($user, $newuser);
             }
             // Handle account activation/confirmation emails.
             if ($useractivation == '2' or $need_verification == true) {
                 if ($need_verification == true) {
                     $usermessgae = 3;
                     $this->_sendMail($user, $usermessgae);
                     $mainframe->enqueueMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE'));
                     $session->clear('tmpuser');
                     return false;
                 } else {
                     $usermessgae = 1;
                     $this->_sendMail($user, $usermessgae);
                     $mainframe->enqueueMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_VERIFY'));
                     $session->clear('tmpuser');
                     return false;
                 }
             } else {
                 $usermessgae = 2;
                 $this->_sendMail($user, $usermessgae);
             }
         }
     }
     if ($user_id) {
         $user = JUser::getInstance((int) $user_id);
         if (JPluginHelper::isEnabled('user', 'jfusion')) {
             plgSystemSocialLoginTools::create_jfusion_user($user, $newuser);
         }
         // Register session variables
         $session = JFactory::getSession();
         $query = "SELECT lr_picture from #__LoginRadius_users WHERE LoginRadius_id=" . $db->Quote($lrdata['id']) . " AND id = " . $user->get('id');
         $db->setQuery($query);
         $check_picture = $db->loadResult();
         $session->set('user_picture', $check_picture);
         $session->set('user_lrid', $lrdata['id']);
         $session->set('user', $user);
         // Getting the session object
         $table = JTable::getInstance('session');
         $table->load($session->getId());
         $table->guest = '0';
         $table->username = $user->get('username');
         $table->userid = intval($user->get('id'));
         $table->usertype = $user->get('usertype');
         $table->gid = $user->get('gid');
         $table->update();
         $user->setLastVisit();
         $user = JFactory::getUser();
         //Redirect after Login
         $redirct = plgSystemSocialLoginTools::getReturnURL();
         $mainframe->redirect(JURI::root() . $redirct);
         $session->clear('tmpuser');
     }
 }
Exemplo n.º 6
0
<?php

include_once 'config.php';
include_once 'LoginRadius_functions.php';
include_once 'LoginRadiusSDK.php';
if (!isset($_REQUEST['title']) || !isset($_REQUEST['status'])) {
    die;
}
$lrpost = $_REQUEST;
$lrpost['lraccesstoken'] = !empty($lrpost['lraccesstoken']) ? $lrpost['lraccesstoken'] : '';
$lrpost['url'] = !empty($lrpost['url']) ? $lrpost['url'] : '';
$lrpost['imageurl'] = !empty($lrpost['imageurl']) ? $lrpost['imageurl'] : '';
$lrpost['status'] = !empty($lrpost['status']) ? $lrpost['status'] : '';
$lrpost['title'] = !empty($lrpost['title']) ? $lrpost['title'] : '';
$lrpost['description'] = !empty($lrpost['description']) ? $lrpost['description'] : '';
$loginradius = new LoginRadius();
try {
    $PostStatus = $loginradius->loginradius_post_status($lrpost['lraccesstoken'], $lrpost['title'], $lrpost['url'], $lrpost['imageurl'], $lrpost['status'], $lrpost['title'], $lrpost['description']);
} catch (LoginRadiusException $e) {
    die('<div id="Error">' . $e->getMessage() . '</div>');
}
if (isset($PostStatus->isPosted) && $PostStatus->isPosted == true) {
    die('<div id="Success">Message has been Posted</div>');
}