Skip to content

Commit

Permalink
MDL-29661 - lib/googleapi.php - Switch to SSL urls
Browse files Browse the repository at this point in the history
I am not sure why I did not use these in the first instance, I don't
think Google supported SSL in the first versions of their API.

They do now, and it seems that this week they stopped supporting non-ssl
requests.
  • Loading branch information
danpoltawski authored and Sam Hemelryk committed Oct 10, 2011
1 parent 7757237 commit e0daa84
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions lib/googleapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ public static function get_auth_header_name(){
*/
class google_docs {
// need both docs and the spreadsheets realm
const REALM = 'http://docs.google.com/feeds/ http://spreadsheets.google.com/feeds/ http://docs.googleusercontent.com/';
const DOCUMENTFEED_URL = 'http://docs.google.com/feeds/default/private/full';
const REALM = 'https://docs.google.com/feeds/ https://spreadsheets.google.com/feeds/ https://docs.googleusercontent.com/';
const DOCUMENTFEED_URL = 'https://docs.google.com/feeds/default/private/full';
const USER_PREF_NAME = 'google_authsub_sesskey';

private $google_curl = null;
Expand Down Expand Up @@ -292,8 +292,6 @@ public function get_file_list($search = ''){
$xml = new SimpleXMLElement($content);




$files = array();
foreach($xml->entry as $gdoc){
$docid = (string) $gdoc->children('http://schemas.google.com/g/2005')->resourceId;
Expand All @@ -307,15 +305,15 @@ public function get_file_list($search = ''){
switch($type){
case 'document':
$title = $gdoc->title.'.rtf';
$source = 'http://docs.google.com/feeds/download/documents/Export?id='.$docid.'&exportFormat=rtf';
$source = 'https://docs.google.com/feeds/download/documents/Export?id='.$docid.'&exportFormat=rtf';
break;
case 'presentation':
$title = $gdoc->title.'.ppt';
$source = 'http://docs.google.com/feeds/download/presentations/Export?id='.$docid.'&exportFormat=ppt';
$source = 'https://docs.google.com/feeds/download/presentations/Export?id='.$docid.'&exportFormat=ppt';
break;
case 'spreadsheet':
$title = $gdoc->title.'.xls';
$source = 'http://spreadsheets.google.com/feeds/download/spreadsheets/Export?key='.$docid.'&exportFormat=xls';
$source = 'https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key='.$docid.'&exportFormat=xls';
break;
case 'pdf':
$title = (string)$gdoc->title;
Expand Down Expand Up @@ -374,10 +372,10 @@ public function download_file($url, $fp){
class google_picasa {
const REALM = 'http://picasaweb.google.com/data/';
const USER_PREF_NAME = 'google_authsub_sesskey_picasa';
const UPLOAD_LOCATION = 'http://picasaweb.google.com/data/feed/api/user/default/albumid/default';
const ALBUM_PHOTO_LIST = 'http://picasaweb.google.com/data/feed/api/user/default/albumid/';
const PHOTO_SEARCH_URL = 'http://picasaweb.google.com/data/feed/api/user/default?kind=photo&q=';
const LIST_ALBUMS_URL = 'http://picasaweb.google.com/data/feed/api/user/default';
const UPLOAD_LOCATION = 'https://picasaweb.google.com/data/feed/api/user/default/albumid/default';
const ALBUM_PHOTO_LIST = 'https://picasaweb.google.com/data/feed/api/user/default/albumid/';
const PHOTO_SEARCH_URL = 'https://picasaweb.google.com/data/feed/api/user/default?kind=photo&q=';
const LIST_ALBUMS_URL = 'https://picasaweb.google.com/data/feed/api/user/default';

private $google_curl = null;

Expand Down

0 comments on commit e0daa84

Please sign in to comment.