Skip to content

Commit

Permalink
Merge pull request #525 from ryanhowdy/3.6.2
Browse files Browse the repository at this point in the history
3.6.2
  • Loading branch information
ryanhowdy committed Mar 4, 2016
2 parents 2af94ea + 7a92baf commit 43ae593
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 74 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: php
php:
- 5.2
- 5.3
- 5.4
- 5.5
Expand Down
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
3.6.2
#524 - FCMS 3.6.0 - Google/YouTube db updates missing from install

3.6.1
#516 - Update version, added blank state to blue-chrome, updated changelog

3.6.0
#395 - Update Youtube API to v 3.0
#484 - Import Pictures from Facebook
Expand Down
6 changes: 3 additions & 3 deletions README
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

Family Connections 3.6.1
Family Connections 3.6.2


Installation
------------

1. Upload the familyconnections/ directory in FCMS_3.6.1.zip to your web host.
1. Upload the familyconnections/ directory in FCMS_3.6.2.zip to your web host.

2. Run the online installation script by visiting your website.

Expand All @@ -15,7 +15,7 @@



Upgrading from 2.6+ to 3.6.1
Upgrading from 2.6+ to 3.6.2
---------------------------

** DO NOT DELETE THE FOLLOWING FILE **
Expand Down
9 changes: 6 additions & 3 deletions familyconnections/inc/install_inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ function installConfig ($sitename, $contact, $version)
('debug', '0'),
('country', 'US'),
('instagram_client_id', NULL),
('instagram_client_secret', NULL)";
('instagram_client_secret', NULL),
('google_client_id', NULL),
('google_client_secret', NULL)";
mysql_query($sql) or die($sql . '<br/>' . mysql_error());
}

Expand Down Expand Up @@ -133,7 +135,7 @@ function installNavigation ($sections)
('admin_polls', 6, 5, 1),
('admin_scheduler', 6, 10, 1),
('admin_facebook', 6, 6, 1),
('admin_youtube', 6, 7, 1),
('admin_google', 6, 7, 1),
('admin_foursquare', 6, 8, 1),
('admin_instagram', 6, 9, 1)";
mysql_query($sql) or die("$sql<br/>".mysql_error());
Expand Down Expand Up @@ -243,10 +245,11 @@ function installUsers ($fname, $lname, $email, $dobYear, $dobMonth, $dobDay, $us
`wordpress` VARCHAR(255) NULL,
`posterous` VARCHAR(255) NULL,
`fb_access_token` VARCHAR(255) NULL,
`youtube_session_token` VARCHAR(255) NULL,
`google_session_token` VARCHAR(255) NULL,
`instagram_access_token` VARCHAR(255) NULL,
`instagram_auto_upload` TINYINT(1) DEFAULT 0,
`picasa_session_token` VARCHAR(255) NULL,
`fb_user_id` VARCHAR(255) NULL,
PRIMARY KEY (`id`),
KEY `user_ind` (`user`)
)
Expand Down
2 changes: 1 addition & 1 deletion familyconnections/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ function displayStepFive ($error = '0')
$_POST['contact'] = mysql_real_escape_string($_POST['contact']);

// Setup Config
installConfig($_POST['sitename'], $_POST['contact'], 'Family Connections 3.6.1');
installConfig($_POST['sitename'], $_POST['contact'], 'Family Connections 3.6.2');

// Setup Navigation
$order = 0;
Expand Down
143 changes: 77 additions & 66 deletions familyconnections/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1434,93 +1434,104 @@ function displayEditGoogle ()
$config = getGoogleConfigData();
$user = getGoogleUserData($this->fcmsUser->id);

// If google hasn't been configured, warn the user
if (empty($config['google_client_id']) || empty($config['google_client_secret']))
{
echo '
<div class="info-alert">
<h2>'.T_('Google isn\'t Configured Yet.').'</h2>
<p>'.T_('Unfortunately, your website administrator has not set up Google yet.').'</p>
<p>'.T_('You will not be able to upload photos from Picasa or upload videos from YouTube, until this is complete.').'</p>
</div>';

$this->displayFooter();
return;
}

// Setup url for callbacks
$callbackUrl = getDomainAndDir();
$callbackUrl .= 'settings.php?view=google&oauth2callback';

$_SESSION['callback_url'] = $callbackUrl;

if (!empty($config['google_client_id']) || !empty($config['google_client_secret']))
{
$googleClient = new Google_Client();
$googleClient->setClientId($config['google_client_id']);
$googleClient->setClientSecret($config['google_client_secret']);
$googleClient->setAccessType('offline');
$googleClient->setScopes(array(
'https://www.googleapis.com/auth/youtube.force-ssl',
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile',
'https://picasaweb.google.com/data/'
));
$googleClient->setRedirectUri($callbackUrl);
$googleClient = new Google_Client();
$googleClient->setClientId($config['google_client_id']);
$googleClient->setClientSecret($config['google_client_secret']);
$googleClient->setAccessType('offline');
$googleClient->setScopes(array(
'https://www.googleapis.com/auth/youtube.force-ssl',
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile',
'https://picasaweb.google.com/data/'
));
$googleClient->setRedirectUri($callbackUrl);

// We still have a token saved
if (isset($_SESSION['googleSessionToken']))
// We still have a token saved
if (isset($_SESSION['googleSessionToken']))
{
try
{
try
{
$googleClient->setAccessToken($_SESSION['googleSessionToken']);
// Make sure our access token is still good
if ($googleClient->isAccessTokenExpired()) {
$googleClient->refreshToken($user['google_session_token']);
}
}
catch (Exception $e)
{
$failure = 1;
$googleClient->setAccessToken($_SESSION['googleSessionToken']);
// Make sure our access token is still good
if ($googleClient->isAccessTokenExpired()) {
$googleClient->refreshToken($user['google_session_token']);
}
}
// We need to use our refresh token from the db to get an access token
elseif (!empty($user['google_session_token']))
catch (Exception $e)
{
try
{
$googleClient->refreshToken($user['google_session_token']);
$failure = 1;
}
}
// We need to use our refresh token from the db to get an access token
elseif (!empty($user['google_session_token']))
{
try
{
$googleClient->refreshToken($user['google_session_token']);

$_SESSION['googleSessionToken'] = $googleClient->getAccessToken();
}
catch (Exception $e)
{
$failure = 1;
}
$_SESSION['googleSessionToken'] = $googleClient->getAccessToken();
}
catch (Exception $e)
{
$failure = 1;
}
}

if (!isset($failure) && isset($_SESSION['googleSessionToken']))
if (!isset($failure) && isset($_SESSION['googleSessionToken']))
{
try
{
try
{
$youtube = new Google_Service_YouTube($googleClient);
$channel = $youtube->channels->listChannels('id', array(
'mine' => 'true',
));
}
catch (Exception $e)
{
echo '<div class="error-alert">ERROR: '.$e->getMessage().'</div>';
$this->displayFooter();
return;
}
$youtube = new Google_Service_YouTube($googleClient);
$channel = $youtube->channels->listChannels('id', array(
'mine' => 'true',
));
}
catch (Exception $e)
{
echo '<div class="error-alert">ERROR: '.$e->getMessage().'</div>';
$this->displayFooter();
return;
}

$oAuth = new Google_Service_Oauth2($googleClient);
$oAuth = new Google_Service_Oauth2($googleClient);

$userInfo = $oAuth->userinfo->get();
$userInfo = $oAuth->userinfo->get();

$user = '<a href="http://www.youtube.com/channel/'.$channel->items[0]['id'].'">'.$userInfo->email.'</a>';
$status = sprintf(T_('Currently connected as: %s'), $user);
$link = '<a class="disconnect" href="?revoke=google">'.T_('Disconnect').'</a>';
}
else
{
$state = mt_rand();
$googleClient->setState($state);
$user = '<a href="http://www.youtube.com/channel/'.$channel->items[0]['id'].'">'.$userInfo->email.'</a>';
$status = sprintf(T_('Currently connected as: %s'), $user);
$link = '<a class="disconnect" href="?revoke=google">'.T_('Disconnect').'</a>';
}
else
{
$state = mt_rand();
$googleClient->setState($state);

$_SESSION['state'] = $state;
$_SESSION['state'] = $state;

$url = $googleClient->createAuthUrl();
$url = $googleClient->createAuthUrl();

$status = T_('Not Connected');
$link = '<a href="'.$url.'">'.T_('Connect').'</a>';
}
$status = T_('Not Connected');
$link = '<a href="'.$url.'">'.T_('Connect').'</a>';
}

echo '
Expand Down

0 comments on commit 43ae593

Please sign in to comment.