Ignore:
Timestamp:
02/10/13 22:12:00 (7 years ago)
Author:
mistic100
Message:

get geoloc ig rv_gmaps installed, compatible with safe_mode

Location:
extensions/Google2Piwigo
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • extensions/Google2Piwigo/admin/import.php

    r20645 r20670  
    2323  { 
    2424    $_SESSION['gdata_auth_token'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']); 
    25     $_GET['action'] = 'logued'; 
     25    $_GET['action'] = 'logged'; 
    2626  } 
    2727   
     
    4747  { 
    4848    $login_url = Zend_Gdata_AuthSub::getAuthSubTokenUri( 
    49       get_absolute_root_url().PICASA_WA_ADMIN . '-import', 
     49      get_absolute_root_url() . PICASA_WA_ADMIN . '-import', 
    5050      'https://picasaweb.google.com/data',  
    5151      false, true 
     
    6060   
    6161  // message after login 
    62   case 'logued': 
    63   { 
    64     $_SESSION['page_infos'][] = l10n('Successfully logued to you Google account'); 
     62  case 'logged': 
     63  { 
     64    $_SESSION['page_infos'][] = l10n('Successfully logged to you Google account'); 
    6565    redirect(PICASA_WA_ADMIN . '-import'); 
    6666    break; 
     
    8585  { 
    8686    $template->assign(array( 
    87       'logout_url' => PICASA_WA_ADMIN . '-import&action=logout', 
     87      'username' => $picasa->getUserEntry( $picasa->newUserQuery() )->getGphotoNickname()->getText(), 
     88      'logout_url' =>      PICASA_WA_ADMIN . '-import&action=logout', 
    8889      'list_albums_url' => PICASA_WA_ADMIN . '-import&action=list_albums', 
    89       'import_all_url' => PICASA_WA_ADMIN . '-import&action=list_all', 
     90      'import_all_url' =>  PICASA_WA_ADMIN . '-import&action=list_all', 
    9091      )); 
    9192    break; 
     
    102103    { 
    103104      array_push($albums, array( 
    104         'title' => $userEntry->title->text, 
     105        'title' =>       $userEntry->title->text, 
    105106        'description' => $userEntry->mediaGroup->description->text, 
    106         'photos' => $userEntry->gphotoNumPhotos->text, 
    107         'U_LIST' => PICASA_WA_ADMIN . '-import&action=list_photos&album='.$userEntry->gphotoId->text, 
     107        'photos' =>      $userEntry->gphotoNumPhotos->text, 
     108        'U_LIST' => PICASA_WA_ADMIN . '-import&action=list_photos&album=' . $userEntry->gphotoId->text, 
    108109        )); 
    109110    } 
     
    139140    { 
    140141      array_push($all_photos, array( 
    141         'id' => $albumEntry->getGphotoId()->getText(), 
    142         'name' => $albumEntry->mediaGroup->title->text, 
     142        'id' =>    $albumEntry->getGphotoId()->getText(), 
     143        'name' =>  $albumEntry->mediaGroup->title->text, 
    143144        'thumb' => $albumEntry->mediaGroup->thumbnail[1]->url, 
    144         'src' => $albumEntry->mediaGroup->content[0]->url, 
    145         'url' => $albumEntry->link[2]->href, 
     145        'src' =>   $albumEntry->mediaGroup->content[0]->url, 
     146        'url' =>   $albumEntry->link[2]->href, 
    146147        )); 
    147148    } 
     
    169170    if ($duplicates>0) 
    170171    { 
    171       array_push($page['infos'], l10n_dec('One picture is not displayed because already existing in the database.', '%d pictures are not displayed because already existing in the database.', $duplicates)); 
     172      array_push($page['infos'], l10n_dec( 
     173          'One picture is not displayed because already existing in the database.',  
     174          '%d pictures are not displayed because already existing in the database.', 
     175          $duplicates 
     176        )); 
    172177    } 
    173178     
     
    177182   
    178183    $template->assign(array( 
    179       'nb_thumbs_set' => count($all_photos), 
     184      'nb_thumbs_set' =>  count($all_photos), 
    180185      'nb_thumbs_page' => count($page_photos), 
    181       'thumbnails' => $page_photos, 
    182       'all_elements' => $all_elements, 
    183       'album' => $_GET['album'], 
    184       'F_ACTION' => PICASA_WA_ADMIN.'-import&action=import_set', 
    185       'U_DISPLAY' => $self_url, 
     186      'thumbnails' =>     $page_photos, 
     187      'all_elements' =>   $all_elements, 
     188      'album' =>          $_GET['album'], 
     189      'F_ACTION' =>       PICASA_WA_ADMIN.'-import&action=import_set', 
     190      'U_DISPLAY' =>      $self_url, 
    186191      )); 
    187192       
     
    257262    if ($duplicates>0) 
    258263    { 
    259       array_push($page['infos'], l10n_dec('%d picture is not displayed because already existing in the database.', '%d pictures are not displayed because already existing in the database.', $duplicates)); 
    260     } 
    261      
    262     $template->assign(array( 
    263       'nb_elements' => count($all_photos), 
     264      array_push($page['infos'], l10n_dec( 
     265          '%d picture is not displayed because already existing in the database.',  
     266          '%d pictures are not displayed because already existing in the database.',  
     267          $duplicates 
     268        )); 
     269    } 
     270     
     271    $template->assign(array( 
     272      'nb_elements' =>  count($all_photos), 
    264273      'all_elements' => json_encode($all_photos), 
    265       'F_ACTION' => PICASA_WA_ADMIN . '-import&action=import_set', 
     274      'F_ACTION' =>     PICASA_WA_ADMIN . '-import&action=import_set', 
    266275      )); 
    267276       
     
    287296 
    288297 
    289 $template->assign('ACTION', $_GET['action']); 
    290  
    291 $template->set_filename('picasa_web_albums', dirname(__FILE__) . '/template/import.tpl'); 
     298$template->assign(array( 
     299  'ACTION' => $_GET['action'], 
     300  'GMAPS_LOADED' => !empty($pwg_loaded_plugins['rv_gmaps']), 
     301  )); 
     302 
     303$template->set_filename('picasa_web_albums', realpath(PICASA_WA_PATH . '/admin/template/import.tpl')); 
    292304 
    293305?> 
  • extensions/Google2Piwigo/admin/template/import.list_all.tpl

    r17475 r20670  
    120120      <label><input type="checkbox" name="fill_author" checked="checked"> {'Author'|@translate}</label> 
    121121      <label><input type="checkbox" name="fill_tags" checked="checked"> {'Tags'|@translate}</label> 
    122       <label><input type="checkbox" name="fill_taken" checked="checked"> {'Creation date'|@translate}</label> 
     122      <label><input type="checkbox" name="fill_date" checked="checked"> {'Creation date'|@translate}</label> 
    123123      <label><input type="checkbox" name="fill_description" checked="checked"> {'Description'|@translate}</label> 
     124      {if $GMAPS_LOADED}<label><input type="checkbox" name="fill_geotag" checked="checked"> {'Geolocalization'|@translate}</label>{/if} 
    124125    </p> 
    125126     
  • extensions/Google2Piwigo/admin/template/import.list_photos.tpl

    r17475 r20670  
    418418      <label><input type="checkbox" name="fill_taken" checked="checked"> {'Creation date'|@translate}</label> 
    419419      <label><input type="checkbox" name="fill_description" checked="checked"> {'Description'|@translate}</label> 
     420      {if $GMAPS_LOADED}<label><input type="checkbox" name="fill_geotag" checked="checked"> {'Geolocalization'|@translate}</label>{/if} 
    420421    </p> 
    421422 
  • extensions/Google2Piwigo/admin/template/import.tpl

    r20645 r20670  
    3535 
    3636<p> 
     37  <b>{'Logged in as'|@translate}</b> : {$username}<br><br> 
    3738  <input type="submit" data="{$logout_url}" value="{'Logout'|@translate}"> 
    3839</p> 
  • extensions/Google2Piwigo/include/functions.inc.php

    r17475 r20670  
    2222 * @param: mixed destination file (if true, file content is returned) 
    2323 */ 
    24 function picasa_wa_download_remote_file($src, $dest) 
     24function picasa_wa_download_remote_file($src, $dest, $headers=array()) 
    2525{ 
    2626  if (empty($src)) 
     
    3030   
    3131  $return = ($dest === true) ? true : false; 
     32   
     33  array_push($headers, 'Accept-language: en'); 
    3234   
    3335  /* curl */ 
     
    4244    curl_setopt($ch, CURLOPT_URL, $src); 
    4345    curl_setopt($ch, CURLOPT_HEADER, false); 
    44     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-language: en")); 
     46    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
    4547    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'); 
    46     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
    47     curl_setopt($ch, CURLOPT_MAXREDIRS, 1); 
    4848    curl_setopt($ch, CURLOPT_TIMEOUT, 30); 
     49    if (!ini_get('safe_mode')) 
     50    { 
     51      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
     52      curl_setopt($ch, CURLOPT_MAXREDIRS, 1); 
     53    } 
    4954    if (strpos($src, 'https://') !== false) 
    5055    { 
     
    8792        'method' => "GET", 
    8893        'user_agent' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)', 
    89         'header' => "Accept-language: en", 
     94        'header' => implode("\r\n", $headers), 
    9095      ) 
    9196    ); 
  • extensions/Google2Piwigo/include/ws_functions.inc.php

    r19834 r20670  
    1313      'pwa_album' => array(), 
    1414      'category' => array(), 
    15       'fills' => array('default' =>null), 
     15      'fills' => array('default' => 'fill_name,fill_author,fill_tags,fill_date,fill_description'), 
    1616      ), 
    1717    'Used by Picasa Web Albums' 
     
    2626  } 
    2727   
    28   global $conf; 
     28  global $conf, $pwg_loaded_plugins; 
    2929   
    3030  include_once(PHPWG_ROOT_PATH . 'admin/include/functions.php'); 
     
    5757  $query->setPhotoId($params['id']); 
    5858  $query->setImgMax('d'); 
    59   $photoEntry = $picasa->getPhotoFeed($query); 
    60     
     59  $photoEntry = $picasa->getPhotoEntry($query); 
     60   
    6161  $photo = array( 
    62     'id' => $params['id'], 
    63     'url' => $photoEntry->mediaGroup->content[0]->url, 
    64     'title' => get_filename_wo_extension($photoEntry->mediagroup->title->text), 
    65     'author' => $photoEntry->mediaGroup->credit[0]->text, 
    66     'description' => $photoEntry->mediagroup->description->text, 
    67     'tags' => $photoEntry->mediagroup->keywords->text, 
    68     'timestamp' => substr($photoEntry->gphotoTimestamp->text, 0, -3), 
     62    'id' =>           $params['id'], 
     63    'url' =>          $photoEntry->getMediaGroup()->content[0]->getUrl(), 
     64    'title' =>        get_filename_wo_extension($photoEntry->getMediaGroup()->getTitle()->getText()), 
     65    'author' =>       $photoEntry->getMediaGroup()->credit[0]->getText(), 
     66    'description' =>  $photoEntry->getMediaGroup()->getDescription()->getText(), 
     67    'tags' =>         $photoEntry->getMediaGroup()->getKeywords()->getText(), 
     68    'timestamp' =>    substr($photoEntry->getGphotoTimestamp(), 0, -3), 
     69    'latlon' =>       null, 
    6970    ); 
     71   
    7072  $photo['path'] = PICASA_WA_CACHE . 'picasa-'.$photo['id'].'.'.get_extension($photo['url']); 
    7173   
    72   file_put_contents('dump.txt', print_r($photo, true), FILE_APPEND); 
     74  if ($photoEntry->getGeoRssWhere() !== null && !empty($pwg_loaded_plugins['rv_gmaps'])) 
     75  { 
     76    $photo['latlon'] = $photoEntry->getGeoRssWhere()->getPoint()->getPos()->getText(); 
     77  } 
    7378   
    7479  // copy file 
     
    128133    $updates = array(); 
    129134    if (in_array('fill_name', $params['fills']))        $updates['name'] = pwg_db_real_escape_string($photo['title']);  
    130     if (in_array('fill_taken', $params['fills']))       $updates['date_creation'] = date('Y-m-d H:i:s', $photo['timestamp']); 
     135    if (in_array('fill_date', $params['fills']))        $updates['date_creation'] = date('Y-m-d H:i:s', $photo['timestamp']); 
    131136    if (in_array('fill_author', $params['fills']))      $updates['author'] = pwg_db_real_escape_string($photo['author']); 
    132137    if (in_array('fill_description', $params['fills'])) $updates['comment'] = pwg_db_real_escape_string($photo['description']); 
     138    if (in_array('fill_geotag', $params['fills']) and !empty($photo['latlon']) ) 
     139    { 
     140      $latlon = explode(' ', $photo['latlon']); 
     141      if (count($latlon) == 2) 
     142      { 
     143        $updates['lat'] = pwg_db_real_escape_string($latlon[0]); 
     144        $updates['lon'] = pwg_db_real_escape_string($latlon[1]); 
     145      } 
     146    } 
    133147     
    134148    if (count($updates)) 
  • extensions/Google2Piwigo/language/cs_CZ/plugin.lang.php

    r17475 r20670  
    3838$lang['Processing...'] = 'Zpracovávání...'; 
    3939$lang['Reproduce Google albums'] = 'Vytvořit Google alba'; 
     40$lang['Logged in as'] = 'Přihlášen jako'; 
    4041?> 
  • extensions/Google2Piwigo/language/de_DE/plugin.lang.php

    r17475 r20670  
    3737$lang['Processing...'] = 'Verarbeitung...'; 
    3838$lang['Reproduce Google albums'] = 'Google Album abbilden'; 
    39 $lang['Successfully logued to you Google account'] = 'Erfolgreich beim Google Konto eingeloggt '; 
     39$lang['Successfully logged to you Google account'] = 'Erfolgreich beim Google Konto eingeloggt '; 
    4040$lang['%d elements ready for importation'] = '%d Elemente fertig zum Import'; 
     41$lang['Logged in as'] = 'Login als'; 
    4142?> 
  • extensions/Google2Piwigo/language/el_GR/plugin.lang.php

    r17475 r20670  
    3737$lang['Processing...'] = 'Επεξεργασία ...'; 
    3838$lang['Reproduce Google albums'] = 'Αναπαραγωγή λευκώματος Google '; 
    39 $lang['Successfully logued to you Google account'] = 'Συνδεθήκατε επιτυχώς στο Google λογαριασμό σας'; 
     39$lang['Successfully logged to you Google account'] = 'Συνδεθήκατε επιτυχώς στο Google λογαριασμό σας'; 
    4040$lang['%d elements ready for importation'] = '%d στοιχεία έτοιμα για την εισαγωγή'; 
    4141?> 
  • extensions/Google2Piwigo/language/en_UK/help.lang.html

    r20645 r20670  
    33<li>Write your domain name without the subdomain in the field (eg: <i>mydomain.com</i>, not <i>gallery.mydomain.com</i>) and click on <b>Add domain</b>.</li> 
    44<li>Click on <b>Manage [mydomain.com]</b> and agree with the ToS.</li> 
    5 <li>Write your domain name WITH the subdomain (even if it is <i>www</i>) and <i>http://</i> prefix in the first field and save.</li> 
     5<li>Write your domain name WITH the subdomain (even if it is <i>www</i>) and the <i>http://</i> prefix in the first field and save.</li> 
    66<ol> 
  • extensions/Google2Piwigo/language/en_UK/plugin.lang.php

    r20662 r20670  
    11<?php 
    22 
    3 $lang['Successfully logued to you Google account'] = 'Successfully logged in to your Google account'; 
     3$lang['Successfully logged to you Google account'] = 'Successfully logged to you Google account'; 
    44$lang['One picture is not displayed because already existing in the database.'] = 'One picture is not displayed because already existing in the database.'; 
    55$lang['%d pictures are not displayed because already existing in the database.'] = '%d pictures are not displayed because already existing in the database.'; 
     
    2222$lang['Logged out'] = 'Logged out'; 
    2323$lang['%d elements ready for importation'] = '%d elements ready for importation'; 
     24$lang['Geolocalization'] = 'Geolocalization'; 
     25$lang['Logged in as'] = 'Logged in as'; 
    2426 
    2527?> 
  • extensions/Google2Piwigo/language/es_ES/plugin.lang.php

    r17475 r20670  
    3838$lang['Processing...'] = 'Procesando...'; 
    3939$lang['Reproduce Google albums'] = 'Reproducir álbumes de Google'; 
    40 $lang['Successfully logued to you Google account'] = 'Logueado con éxito en su cuenta de Google'; 
     40$lang['Successfully logged to you Google account'] = 'Logueado con éxito en su cuenta de Google'; 
    4141$lang['%d elements ready for importation'] = '%d elementos listos para importar'; 
     42$lang['Logged in as'] = 'Registrado como'; 
    4243?> 
  • extensions/Google2Piwigo/language/fr_FR/plugin.lang.php

    r18912 r20670  
    11<?php 
    22 
    3 $lang['Successfully logued to you Google account'] = 'Connecté à votre compte Google'; 
     3$lang['Successfully logged to you Google account'] = 'Connecté à votre compte Google'; 
    44$lang['One picture is not displayed because already existing in the database.'] = 'Une photo n\'est pas affichée car elle existe déjà sur la galerie'; 
    55$lang['%d pictures are not displayed because already existing in the database.'] = '%d photo ne sont pas affichées car elles existent déjà sur la galerie'; 
     
    2222$lang['Logged out'] = 'Déconnecté'; 
    2323$lang['%d elements ready for importation'] = '%d elements prêts à l\'importation'; 
     24$lang['Logged in as'] = 'Indentifié en tant que'; 
     25$lang['Geolocalization'] = 'Géolocalisation'; 
    2426 
    2527?> 
  • extensions/Google2Piwigo/language/it_IT/plugin.lang.php

    r17475 r20670  
    3737$lang['Processing...'] = 'Elaborazione...'; 
    3838$lang['Reproduce Google albums'] = 'Riproduci gli album Google'; 
    39 $lang['Successfully logued to you Google account'] = 'Accesso al tuo account Google riuscito'; 
     39$lang['Successfully logged to you Google account'] = 'Accesso al tuo account Google riuscito'; 
     40$lang['Logged in as'] = 'Iscritto come'; 
    4041?> 
  • extensions/Google2Piwigo/language/lv_LV/plugin.lang.php

    r17475 r20670  
    3838$lang['Processing...'] = 'Apstrāde...'; 
    3939$lang['Reproduce Google albums'] = 'Reproducēt Google albūmus'; 
    40 $lang['Successfully logued to you Google account'] = 'Esat veiksmīgi pieteikušies savā Google kontā'; 
     40$lang['Successfully logged to you Google account'] = 'Esat veiksmīgi pieteikušies savā Google kontā'; 
     41$lang['Logged in as'] = 'Pieteicies kā'; 
    4142?> 
  • extensions/Google2Piwigo/language/nl_NL/plugin.lang.php

    r17475 r20670  
    3838$lang['Processing...'] = 'Bewerken ...'; 
    3939$lang['Reproduce Google albums'] = 'Reproduceer Google albums'; 
    40 $lang['Successfully logued to you Google account'] = 'Succesvol ingelogd in Google '; 
     40$lang['Successfully logged to you Google account'] = 'Succesvol ingelogd in Google '; 
     41$lang['Logged in as'] = 'Ingelogd als'; 
    4142?> 
  • extensions/Google2Piwigo/language/pl_PL/plugin.lang.php

    r20646 r20670  
    3737$lang['Processing...'] = 'Przetwarzanie...'; 
    3838$lang['Reproduce Google albums'] = 'Odbuduj albumy Google'; 
    39 $lang['Successfully logued to you Google account'] = 'Udane logowanie do Google'; 
     39$lang['Successfully logged to you Google account'] = 'Udane logowanie do Google'; 
     40$lang['Logged in as'] = 'Zalogowany jako'; 
    4041$lang['%d elements ready for importation'] = '%d elementów gotowych do importu'; 
    4142$lang['API not authenticated'] = 'API nieuwierzytelnione'; 
  • extensions/Google2Piwigo/language/pt_PT/plugin.lang.php

    r17475 r20670  
    3838$lang['Processing...'] = 'Processando...'; 
    3939$lang['Reproduce Google albums'] = 'Reproduzir albuns Google'; 
    40 $lang['Successfully logued to you Google account'] = 'Entrou com sucesso na sua conta Google'; 
     40$lang['Successfully logged to you Google account'] = 'Entrou com sucesso na sua conta Google'; 
    4141$lang['%d elements ready for importation'] = '%d elementos prontos para a importação '; 
     42$lang['Logged in as'] = 'Entrou como'; 
    4243?> 
  • extensions/Google2Piwigo/language/ru_RU/plugin.lang.php

    r17475 r20670  
    3737$lang['Processing...'] = 'Обработка ...'; 
    3838$lang['Reproduce Google albums'] = 'Воспроизведение альбомов Google'; 
    39 $lang['Successfully logued to you Google account'] = 'Вы успешно вошли в свою учетную запись'; 
     39$lang['Successfully logged to you Google account'] = 'Вы успешно вошли в свою учетную запись'; 
    4040?> 
  • extensions/Google2Piwigo/language/sk_SK/plugin.lang.php

    r17475 r20670  
    3838$lang['Processing...'] = 'Spracovávam...'; 
    3939$lang['Reproduce Google albums'] = 'Reprodukovať Google albumy'; 
    40 $lang['Successfully logued to you Google account'] = 'Úspešne prihlásený do Vášho Google konta'; 
     40$lang['Successfully logged to you Google account'] = 'Úspešne prihlásený do Vášho Google konta'; 
     41$lang['Logged in as'] = 'Prihlásený ako'; 
    4142?> 
  • extensions/Google2Piwigo/language/tr_TR/plugin.lang.php

    r17475 r20670  
    3737$lang['Processing...'] = 'İşleniyor...'; 
    3838$lang['Reproduce Google albums'] = 'Google albümlerini yeniden üret'; 
    39 $lang['Successfully logued to you Google account'] = 'Google \'de başarılı olarak oturum açıldı.'; 
     39$lang['Successfully logged to you Google account'] = 'Google \'de başarılı olarak oturum açıldı.'; 
     40$lang['Logged in as'] = 'Oturum açan:'; 
    4041?> 
  • extensions/Google2Piwigo/language/uk_UA/plugin.lang.php

    r17475 r20670  
    2424$lang['Processing...'] = 'Обробка...'; 
    2525$lang['Reproduce Google albums'] = 'Відтворити Google альбоми'; 
    26 $lang['Successfully logued to you Google account'] = 'Успішно увійшли до вашого облікового запису Google'; 
     26$lang['Successfully logged to you Google account'] = 'Успішно увійшли до вашого облікового запису Google'; 
    2727$lang['(%d photos)'] = '(%d зображень)'; 
    2828$lang['Begin transfer'] = 'Почати передачу'; 
Note: See TracChangeset for help on using the changeset viewer.