Changeset 17476
- Timestamp:
- Aug 8, 2012, 1:55:06 PM (12 years ago)
- Location:
- extensions/flickr2piwigo
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/flickr2piwigo/admin/import.php
r17313 r17476 3 3 4 4 set_time_limit(600); 5 6 include_once(PICASA_WA_PATH . 'include/functions.inc.php'); 5 7 6 8 // check API parameters and connect to flickr … … 10 12 $_GET['action'] = 'error'; 11 13 } 12 else if ( ! function_exists('curl_init') and !ini_get('allow_url_fopen') )14 else if ( !test_remote_download() ) 13 15 { 14 16 array_push($page['errors'], l10n('No download method available')); … … 154 156 ;'; 155 157 $existing_photos = simple_hash_from_query($query, 'id', 'file'); 156 $existing_photos = array_map(create_function('$p', ' $p=preg_replace("#^'.$flickr_prefix.'([0-9]+)\.([a-z]{3,4})$#i", "$1", $p); return $p;'), $existing_photos);158 $existing_photos = array_map(create_function('$p', 'return preg_replace("#^'.$flickr_prefix.'([0-9]+)\.([a-z]{3,4})$#i", "$1", $p);'), $existing_photos); 157 159 158 160 // remove existing photos … … 199 201 FROM '.CATEGORIES_TABLE.' 200 202 ;'; 201 display_select_cat_wrapper($query, array(), 'associate_options');202 203 display_select_cat_wrapper($query, array(), 'category_parent_options'); 203 204 … … 223 224 224 225 $all_photos = array(); 225 foreach ($all_albums as &$album)226 foreach ($all_albums as $album) 226 227 { 227 228 $album_photos = $flickr->photosets_getPhotos($album['id'], NULL, NULL, 500, NULL, 'photos'); 228 229 $album_photos = $album_photos['photoset']['photo']; 229 230 230 foreach ($album_photos as &$photo)231 foreach ($album_photos as $photo) 231 232 { 232 233 $all_photos[ $photo['id'] ][] = $album['title']; 233 234 } 234 unset($photo); 235 } 236 unset($album); 235 } 237 236 238 237 // get existing photos … … 243 242 ;'; 244 243 $existing_photos = simple_hash_from_query($query, 'id', 'file'); 245 $existing_photos = array_map(create_function('$p', ' $p=preg_replace("#^'.$flickr_prefix.'([0-9]+)\.([a-z]{3,4})$#i", "$1", $p); return $p;'), $existing_photos);244 $existing_photos = array_map(create_function('$p', 'return preg_replace("#^'.$flickr_prefix.'([0-9]+)\.([a-z]{3,4})$#i", "$1", $p);'), $existing_photos); 246 245 247 246 // remove existing photos … … 281 280 FROM '.CATEGORIES_TABLE.' 282 281 ;'; 283 display_select_cat_wrapper($query, array(), 'associate_options', true);284 282 display_select_cat_wrapper($query, array(), 'category_parent_options'); 285 283 break; -
extensions/flickr2piwigo/admin/template/import.list_all.tpl
r17313 r17476 57 57 $("#loader_import").fadeIn(); 58 58 59 if ($("input[name='album_mode'] ").val() == 'identical') {59 if ($("input[name='album_mode']:checked").val() == 'identical') { 60 60 var album = 0; 61 61 } else { … … 115 115 <p id="albumSelectWrapper" style="display:none;"> 116 116 <select style="width:400px" name="associate" id="albumSelect" size="1"> 117 {html_options options=$ associate_options}117 {html_options options=$category_parent_options} 118 118 </select> 119 119 {'... or '|@translate}<a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> -
extensions/flickr2piwigo/admin/template/import.list_photos.tpl
r17313 r17476 405 405 <label for="albumSelect"><b>{'Album'|@translate}:</b></label> 406 406 <select style="width:400px" name="associate" id="albumSelect" size="1"> 407 {html_options options=$ associate_options}407 {html_options options=$category_parent_options} 408 408 </select> 409 409 {'... or '|@translate}<a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a> -
extensions/flickr2piwigo/admin/template/style.css
r16064 r17476 6 6 margin-top:20px; 7 7 } 8 UL.thumbnails span.wrap2 { 9 height: 128px; 10 width: 128px; 11 } -
extensions/flickr2piwigo/include/functions.inc.php
r17312 r17476 1 1 <?php 2 2 if (!defined('FLICKR_PATH')) die('Hacking attempt!'); 3 4 /** 5 * test if a download method is available 6 * @return: bool 7 */ 8 if (!function_exists('test_remote_download')) 9 { 10 function test_remote_download() 11 { 12 return function_exists('curl_init') || ini_get('allow_url_fopen'); 13 } 14 } 3 15 4 16 /** … … 31 43 32 44 curl_setopt($ch, CURLOPT_URL, $src); 33 curl_setopt($ch, CURLOPT_HEADER, 0);45 curl_setopt($ch, CURLOPT_HEADER, false); 34 46 curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-language: en")); 35 47 curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'); 36 48 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 37 49 curl_setopt($ch, CURLOPT_MAXREDIRS, 1); 50 curl_setopt($ch, CURLOPT_TIMEOUT, 30); 38 51 if (strpos($src, 'https://') !== false) 39 52 { … … 50 63 } 51 64 52 if (($out = curl_exec($ch)) === false) 65 $out = curl_exec($ch); 66 curl_close($ch); 67 68 if ($out === false) 53 69 { 54 70 return 'file_error'; 55 71 } 56 57 curl_close($ch); 58 59 if (!$return) 72 else if (!$return) 60 73 { 61 74 fclose($newf); -
extensions/flickr2piwigo/include/ws_functions.inc.php
r17312 r17476 10 10 'ws_images_addFlickr', 11 11 array( 12 ' category' => array('default' => null),13 ' id' => array('default' => null),12 'id' => array(), 13 'category' => array(), 14 14 'fills' => array('default' =>null), 15 15 ), 16 'Used by Flickr2Piwigo , fills € (fill_name,fill_posted,fill_taken,fill_author,fill_tags)'16 'Used by Flickr2Piwigo' 17 17 ); 18 18 } … … 30 30 if ( empty($conf['flickr2piwigo']['api_key']) or empty($conf['flickr2piwigo']['secret_key']) ) 31 31 { 32 return new PwgError( 500, l10n('Please fill your API keys on the configuration tab'));32 return new PwgError(null, l10n('Please fill your API keys on the configuration tab')); 33 33 } 34 34 … … 36 36 include_once(PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php'); 37 37 include_once(FLICKR_PATH . 'include/functions.inc.php'); 38 39 if (test_remote_download() === false) 40 { 41 return new PwgError(null, l10n('No download method available')); 42 } 38 43 39 44 // init flickr API … … 58 63 if (download_remote_file($photo['url'], $photo['path']) == false) 59 64 { 60 return new PwgError( 500, l10n('No download method available'));65 return new PwgError(null, l10n('Can\'t download file')); 61 66 } 62 67 … … 125 130 } 126 131 127 return sprintf(l10n(' %simported'), $photo['title']);132 return sprintf(l10n('Photo "%s" imported'), $photo['title']); 128 133 } 129 134 -
extensions/flickr2piwigo/language/en_UK/description.txt
r16063 r17476 1 Extension for importingpictures from your Flickr account1 Import pictures from your Flickr account -
extensions/flickr2piwigo/language/en_UK/plugin.lang.php
r17313 r17476 9 9 $lang['Import'] = 'Import'; 10 10 $lang['API not authenticated'] = 'API not authenticated'; 11 $lang[' %s imported'] = '%simported';11 $lang['Photo "%s" imported'] = 'Photo "%s" imported'; 12 12 $lang['Flickr logins'] = 'Flickr logins'; 13 13 $lang['API key'] = 'API key'; … … 29 29 $lang['No download method available'] = 'No download method available'; 30 30 $lang['Logued as'] = 'Logued as'; 31 $lang['Logued out'] = 'Logued out'; 31 32 $lang['%d elements ready for importation'] = '%d elements ready for importation'; 32 33 -
extensions/flickr2piwigo/language/fr_FR/description.txt
r16063 r17476 1 Extension permettant d'importerdes photos depuis votre compte Flickr.1 Importez des photos depuis votre compte Flickr. -
extensions/flickr2piwigo/language/fr_FR/plugin.lang.php
r17313 r17476 9 9 $lang['Import'] = 'Importation'; 10 10 $lang['API not authenticated'] = 'API non authentifiée'; 11 $lang[' %s imported'] = '%s importé';11 $lang['Photo "%s" imported'] = 'Photo "%s" importée'; 12 12 $lang['Flickr logins'] = 'Identifiants Flickr'; 13 13 $lang['API key'] = 'Clé API'; … … 29 29 $lang['No download method available'] = 'Aucune méthode de téléchargement n\'est disponible'; 30 30 $lang['Logued as'] = 'Indentifié en tant que'; 31 $lang['Logued out'] = 'Déconnecté'; 31 32 $lang['%d elements ready for importation'] = '%d elements prêts à l\'importation'; 32 33 -
extensions/flickr2piwigo/main.inc.php
r16087 r17476 3 3 Plugin Name: Flickr2Piwigo 4 4 Version: auto 5 Description: Extension for importingpictures from your Flickr account5 Description: Import pictures from your Flickr account 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=612 7 7 Author: Mistic -
extensions/flickr2piwigo/maintain.inc.php
r16071 r17476 37 37 function plugin_uninstall() 38 38 { 39 global $conf; 40 39 41 pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "flickr2piwigo" LIMIT 1;'); 40 42
Note: See TracChangeset
for help on using the changeset viewer.