Ignore:
Timestamp:
Dec 26, 2013, 12:48:21 PM (10 years ago)
Author:
mistic100
Message:

update for 2.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/instagram2piwigo/include/ws_functions.inc.php

    r19583 r26199  
    11<?php
    2 if (!defined('INSTAG_PATH')) die('Hacking attempt!');
     2defined('INSTAG_PATH') or die('Hacking attempt!');
    33
    44function instagram_add_ws_method($arr)
     
    1414      'fills' => array('default' =>null),
    1515      ),
    16     'Used by Instagram2Piwigo'
     16    'Used by Instagram2Piwigo',
     17    null,
     18    array('hidden'=>true)
    1719    );
    1820}
     
    2628 
    2729  global $conf;
    28   $conf['Instagram2Piwigo'] = unserialize($conf['Instagram2Piwigo']);
    2930 
    30   if ( empty($conf['Instagram2Piwigo']['api_key']) or empty($conf['Instagram2Piwigo']['secret_key']) )
     31  if (empty($conf['Instagram2Piwigo']['api_key']) or empty($conf['Instagram2Piwigo']['secret_key']))
    3132  {
    3233    return new PwgError(null, l10n('Please fill your API keys on the configuration tab'));
     
    6566    'username' => $photo_f->getUser()->getFullName(true),
    6667    'tags' => $photo_f->getTags()->toArray(),
     68    'location' => $photo_f->getLocation(),
    6769    );
    6870  $photo = array_merge($param, $photo);
     
    9597 
    9698    $updates = array();
    97     if (in_array('fill_name', $photo['fills']))   $updates['name'] = $photo['title'];
     99    if (in_array('fill_name', $photo['fills']))   $updates['name'] = pwg_db_real_escape_string($photo['title']);
    98100    if (in_array('fill_taken', $photo['fills']))  $updates['date_creation'] = $photo['date'];
    99     if (in_array('fill_author', $photo['fills'])) $updates['author'] = $photo['username'];
     101    if (in_array('fill_author', $photo['fills'])) $updates['author'] = pwg_db_real_escape_string($photo['username']);
     102    if (in_array('fill_geotag', $photo['fills']) and !empty($photo['location']) )
     103    {
     104      $updates['latitude'] = pwg_db_real_escape_string($photo['location']->getLat());
     105      $updates['longitude'] = pwg_db_real_escape_string($photo['location']->getLng());
     106    }
    100107   
    101108    if (count($updates))
     
    108115    }
    109116   
    110     if ( !empty($photo['tags']) and in_array('fill_tags', $photo['fills']) )
     117    if (!empty($photo['tags']) and in_array('fill_tags', $photo['fills']))
    111118    {
    112119      $raw_tags = implode(',', $photo['tags']);
     
    115122  }
    116123 
    117   return sprintf(l10n('Photo "%s" imported'), $photo['title']);
     124  return l10n('Photo "%s" imported', $photo['title']);
    118125}
    119 
    120 ?>
Note: See TracChangeset for help on using the changeset viewer.