Changeset 24815


Ignore:
Timestamp:
Oct 9, 2013, 3:18:02 PM (7 years ago)
Author:
mistic100
Message:

fix bug with quotes, add batch manager prefilter

Location:
extensions/flickr2piwigo
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/flickr2piwigo/admin/config.php

    r16071 r24815  
    1010  unset($_SESSION['phpFlickr_auth_token']);
    1111  conf_update_param('flickr2piwigo', serialize($conf['flickr2piwigo']));
     12  $page['infos'][] = l10n('Information data registered in database');
    1213}
    1314
  • extensions/flickr2piwigo/admin/import.php

    r19537 r24815  
    171171    if ($duplicates>0)
    172172    {
    173       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));
     173      $page['infos'][] = '<a href="admin.php?page=batch_manager&amp;prefilter=flickr">'
     174          .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)
     175        .'</a>';
    174176    }
    175177   
     
    266268    if ($duplicates>0)
    267269    {
    268       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));
     270      $page['infos'][] = '<a href="admin.php?page=batch_manager&amp;prefilter=flickr">'
     271          .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)
     272        .'</a>';
    269273    }
    270274   
  • extensions/flickr2piwigo/include/ws_functions.inc.php

    r24660 r24815  
    108108 
    109109    $updates = array();
    110     if (in_array('fill_name', $photo['fills']))   $updates['name'] = $photo['title'];
     110    if (in_array('fill_name', $photo['fills']))   $updates['name'] = pwg_db_real_escape_string($photo['title']);
    111111    if (in_array('fill_posted', $photo['fills'])) $updates['date_available'] = date('Y-m-d H:i:s', $photo['dates']['posted']);
    112112    if (in_array('fill_taken', $photo['fills']))  $updates['date_creation'] = $photo['dates']['taken'];
    113     if (in_array('fill_author', $photo['fills'])) $updates['author'] = $photo['owner']['username'];
     113    if (in_array('fill_author', $photo['fills'])) $updates['author'] = pwg_db_real_escape_string($photo['owner']['username']);
    114114   
    115115    if (count($updates))
  • extensions/flickr2piwigo/main.inc.php

    r24660 r24815  
    2121{
    2222  add_event_handler('get_admin_plugin_menu_links', 'flickr_admin_menu');
     23  add_event_handler('get_batch_manager_prefilters', 'flickr_add_batch_manager_prefilters');
     24  add_event_handler('perform_batch_manager_prefilters', 'flickr_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     25  add_event_handler('loc_begin_admin_page', 'flickr_prefilter_from_url');
    2326
    2427  function flickr_admin_menu($menu)
     
    3033    return $menu;
    3134  }
     35 
     36  function flickr_add_batch_manager_prefilters($prefilters)
     37  {
     38    array_push($prefilters, array(
     39      'ID' => 'flickr',
     40      'NAME' => l10n('Imported from Flickr'),
     41    ));
     42    return $prefilters;
     43  }
     44
     45  function flickr_perform_batch_manager_prefilters($filter_sets, $prefilter)
     46  {
     47    if ($prefilter == 'flickr')
     48    {
     49      $query = '
     50  SELECT id
     51    FROM '.IMAGES_TABLE.'
     52    WHERE file LIKE "flickr-%"
     53  ;';
     54      $filter_sets[] = array_from_query($query, 'id');
     55    }
     56   
     57    return $filter_sets;
     58  }
     59 
     60  function flickr_prefilter_from_url()
     61  {
     62    global $page;
     63    if ($page['page'] == 'batch_manager' && @$_GET['prefilter'] == 'flickr')
     64    {
     65      $_SESSION['bulk_manager_filter'] = array('prefilter' => 'flickr');
     66      unset($_GET['prefilter']);
     67    }
     68  }
    3269}
    3370
  • extensions/flickr2piwigo/maintain.inc.php

    r19831 r24815  
    3939  global $conf;
    4040 
    41   pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "flickr2piwigo" LIMIT 1;');
     41  pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "flickr2piwigo";');
     42  unset($conf['flickr2piwigo']);
    4243 
    4344  rrmdir(PHPWG_ROOT_PATH . $conf['data_location'] . 'flickr_cache/');
Note: See TracChangeset for help on using the changeset viewer.