Ignore:
Timestamp:
Jun 27, 2012, 1:53:21 AM (12 years ago)
Author:
mistic100
Message:

code cleanup, don't ask username anymore (prohibit importing photos from another account)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/flickr2piwigo/maintain.inc.php

    r16070 r16071  
    77    'api_key' => null,
    88    'secret_key' => null,
    9     'username' => null,
    109    ))
    1110  );
    12  
     11
    1312
    1413function plugin_install()
    1514{
    1615  global $conf;
     16 
    1717  conf_update_param('flickr2piwigo', flickr2piwigo_default_config);
     18 
    1819  mkdir($conf['data_location'].'flickr_cache/', 0755);
    1920}
     
    3031  if (!file_exists($conf['data_location'].'flickr_cache/'))
    3132  {
    32     mdir($conf['data_location'].'flickr_cache/', 0755);
     33    mkdir($conf['data_location'].'flickr_cache/', 0755);
    3334  }
    3435}
     
    3738{
    3839  pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "flickr2piwigo" LIMIT 1;');
     40 
     41  rrmdir($conf['data_location'].'flickr_cache/');
    3942}
    4043
     44function rrmdir($dir)
     45{
     46  if (!is_dir($dir))
     47  {
     48    return false;
     49  }
     50  $dir = rtrim($dir, '/');
     51  $objects = scandir($dir);
     52  $return = true;
     53 
     54  foreach ($objects as $object)
     55  {
     56    if ($object !== '.' && $object !== '..')
     57    {
     58      $path = $dir.'/'.$object;
     59      if (filetype($path) == 'dir')
     60      {
     61        $return = $return && rrmdir($path);
     62      }
     63      else
     64      {
     65        $return = $return && @unlink($path);
     66      }
     67    }
     68  }
     69 
     70  return $return && @rmdir($dir);
     71}
     72
    4173?>
Note: See TracChangeset for help on using the changeset viewer.