Changeset 1029


Ignore:
Timestamp:
Feb 8, 2006, 2:17:07 AM (18 years ago)
Author:
rvelices
Message:
  • remake of Remote sites and Synchronize:
    • synchronization for remote and local sites are done by the same code
    • remote sites can update metadata now (not before) - bug 279
    • fixes bug 82: has_high column
  • improve feature 280: user sort by filename
  • fix path to template mimetypes icons
  • bug 284: session cookie lifetime, deletion on logout and corrected issue

when db upgrades were missing

Location:
trunk
Files:
6 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin.php

    r1007 r1029  
    6666$template->assign_vars(
    6767  array(
     68    'U_SITE_MANAGER'=> $link_start.'site_manager',
    6869    'U_HISTORY'=> $link_start.'stats',
    6970    'U_FAQ'=> $link_start.'help',
  • trunk/admin/include/functions_metadata.php

    r903 r1029  
    176176 *
    177177 * @param int id_uppercat
     178 * @param int site_id
    178179 * @param boolean recursive ?
    179180 * @param boolean only newly added files ?
    180181 * @return array
    181182 */
    182 function get_filelist($category_id = '', $recursive = false, $only_new = false)
     183function get_filelist($category_id = '', $site_id=1, $recursive = false,
     184                      $only_new = false)
    183185{
    184186  // filling $cat_ids : all categories required
     
    188190SELECT id
    189191  FROM '.CATEGORIES_TABLE.'
    190   WHERE site_id = 1
     192  WHERE site_id = '.$site_id.'
    191193    AND dir IS NOT NULL';
    192194  if (is_numeric($category_id))
  • trunk/admin/update.php

    r967 r1029  
    744744  }
    745745  $start = get_moment();
    746   $files = get_filelist($opts['category_id'],
     746  $files = get_filelist($opts['category_id'], 1,
    747747                        $opts['recursive'],
    748748                        $opts['only_new']);
  • trunk/category.php

    r1022 r1029  
    3838  session_unset();
    3939  session_destroy();
    40   setcookie(session_name(),'',0,'/');
     40  setcookie(session_name(),'',0, cookie_path() );
    4141  $url = 'category.php';
    4242  redirect( $url );
  • trunk/identification.php

    r1004 r1029  
    5252      $session_length = $conf['remember_me_length'];
    5353    }
     54    session_set_cookie_params($session_length);
    5455    session_start();
    5556    $_SESSION['id'] = $row['id'];
  • trunk/include/common.inc.php

    r1027 r1029  
    148148  if (count(array_diff($existing, $applied)) > 0)
    149149  {
     150    ob_start();// buffer output so that cookies work
    150151    echo
    151152      '<p>'
  • trunk/include/functions.inc.php

    r1027 r1029  
    975975
    976976/**
     977 * returns the $str in current language if possible or $str enclosed
     978 * in special chars
     979 */
     980function get_lang($str)
     981{
     982  global $lang;
     983  if ( isset($lang[$str]) )
     984  {
     985    return $lang[$str];
     986  }
     987  return '@@'.$str.'@@';
     988}
     989
     990/**
    977991 * which upgrades are available ?
    978992 *
  • trunk/include/functions_category.inc.php

    r1022 r1029  
    322322function get_category_preferred_image_orders()
    323323{
    324   global $lang, $conf;
     324  global $conf;
    325325  return array(
    326326        array('Default', '', true),
    327         array($lang['best_rated_cat'],   'average_rate DESC', $conf['rate']),
    328         array($lang['most_visited_cat'], 'hit DESC', true),
    329         array($lang['Creation date'], 'date_creation DESC', true),
    330         array($lang['Availability date'], 'date_available DESC', true)
     327        array(get_lang('best_rated_cat'),   'average_rate DESC', $conf['rate']),
     328        array(get_lang('most_visited_cat'), 'hit DESC', true),
     329        array(get_lang('Creation date'), 'date_creation DESC', true),
     330        array(get_lang('Availability date'), 'date_available DESC', true),
     331        array(get_lang('File name'), 'file ASC', true)
    331332  );
    332333}
  • trunk/include/functions_session.inc.php

    r1023 r1029  
    7070  ini_set('session.use_trans_sid', intval($conf['session_use_trans_sid']));
    7171  ini_set('session.name', $conf['session_name']);
    72   ini_set('session.cookie_path', dirname($_SERVER['PHP_SELF']));
     72  ini_set('session.cookie_path', cookie_path() );
     73}
     74
     75// cookie_path returns the path to use for the PhpWebGallery cookie.
     76// If PhpWebGallery is installed on :
     77// http://domain.org/meeting/gallery/category.php
     78// cookie_path will return : "/meeting/gallery"
     79function cookie_path()
     80{
     81  if ( isset($_SERVER['REDIRECT_URL']) )
     82  { // mod_rewrite is activated for upper level directories. we must set the
     83    // cookie to the path shown in the browser otherwise it will be discarded.
     84    $scr = $_SERVER['REDIRECT_URL'];
     85  }
     86  else
     87  {
     88    $scr = $_SERVER['PHP_SELF'];
     89  }
     90  return substr($scr,0,strrpos( $scr,'/'));
    7391}
    7492
  • trunk/language/en_UK.iso-8859-1/common.lang.php

    r1020 r1029  
    6565$lang['Error sending email'] = 'Error sending email';
    6666$lang['File'] = 'File';
     67$lang['File name'] = 'File name';
    6768$lang['Filesize'] = 'Filesize';
    6869$lang['Filter and display'] = 'Filter and display';
  • trunk/language/fr_FR.iso-8859-1/common.lang.php

    r1025 r1029  
    6464$lang['Error sending email'] = 'Erreur à l\'envoi du mail';
    6565$lang['File'] = 'Fichier';
     66$lang['File name'] = 'Nom du fichier';
    6667$lang['Filesize'] = 'Poids';
    6768$lang['Filter and display'] = 'Filtrer et afficher';
  • trunk/picture.php

    r1020 r1029  
    250250    if ($i == 'current')
    251251    {
    252       $url_high=$cat_directory.'/pwg_high/'.$row['file'];
    253       if (url_is_remote($cat_directory))
     252      if ($row['has_high']=='true')
    254253      {
    255         if ($row['has_high'])
    256         {
    257           $picture[$i]['high'] = $url_high;
    258         }
    259       }
    260       else
    261       {
    262         if (@fopen($url_high, 'r'))
    263         {
    264           $picture[$i]['high'] = $url_high;
    265         }
     254        $url_high=$cat_directory.'/pwg_high/'.$row['file'];
     255        $picture[$i]['high'] = $url_high;
    266256      }
    267257    }
     
    10551045  // navigation bar creation
    10561046  $url = PHPWG_ROOT_PATH.'picture.php';
    1057   $url.= get_query_string_diff(array('rate','add_fav'));
     1047  $url.= get_query_string_diff(array('rate','add_fav','start'));
    10581048
    10591049  if (!isset( $_GET['start'] )
  • trunk/template/yoga/admin.tpl

    r963 r1029  
    1515      <ul>
    1616        <li><a href="{U_FAQ}">{lang:instructions}</a></li>
     17        <li><a href="{U_SITE_MANAGER}">{lang:Site manager}</a></li>
    1718        <li><a href="{U_SITES}">{lang:remote_sites}</a></li>
    1819        <li><a href="{U_HISTORY}">{lang:history}</a></li>
     
    6869<div id="content">
    6970  <!-- BEGIN errors -->
    70   <div id="errors">
     71  <div class="errors">
    7172    <ul>
    7273      <!-- BEGIN error -->
  • trunk/template/yoga/theme/clear/themeconf.inc.php

    r960 r1029  
    55  'icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon',
    66  'admin_icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon/admin',
    7   'mime_icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon/mymetypes'
     7  'mime_icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon/mimetypes/'
    88);
    99?>
  • trunk/template/yoga/theme/dark/themeconf.inc.php

    r960 r1029  
    55  'icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon',
    66  'admin_icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon/admin',
    7   'mime_icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon/mymetypes'
     7  'mime_icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon/mimetypes/'
    88);
    99?>
  • trunk/tools/create_listing_file.php

    r1020 r1029  
    4545$conf['version'] = '%PWGVERSION%';
    4646
    47 // $conf['use_exif'] set to true if you want to use Exif Date as "creation
    48 // date" for the element, otherwise, set to false
     47// $conf['use_exif'] set to true if you want to use Exif information
    4948$conf['use_exif'] = true;
     49
     50// use_exif_mapping: same behaviour as use_iptc_mapping
     51$conf['use_exif_mapping'] = array(
     52  'date_creation' => 'DateTimeOriginal'
     53  );
    5054
    5155// $conf['use_iptc'] set to true if you want to use IPTC informations of the
     
    321325      if ($file != '.'
    322326          and $file != '..'
     327          and $file != '.svn'
    323328          and $file != 'thumbnail'
    324329          and $file != 'pwg_high'
     
    345350    $dirs.= "\n".$indent.'</dir'.$level.'>';
    346351  }
    347   return $dirs;         
     352  return $dirs;   
    348353}
    349354
     
    426431          if ($exif = @read_exif_data($dir.'/'.$fs_file))
    427432          {
    428             if (isset($exif['DateTime']))
     433            foreach ($conf['use_exif_mapping'] as $pwg_key => $exif_key )
    429434            {
    430               preg_match('/^(\d{4}):(\d{2}):(\d{2})/'
    431                          ,$exif['DateTime']
    432                          ,$matches);
    433               $element['date_creation'] =
    434                 $matches[1].'-'.$matches[2].'-'.$matches[3];
     435              if (isset($exif[$exif_key]))
     436              {
     437                if ( in_array($pwg_key, array('date_creation','date_available') ) )
     438                {
     439                   if (preg_match('/^(\d{4}):(\d{2}):(\d{2})/'
     440                         ,$exif[$exif_key]
     441                         ,$matches))
     442                   {
     443                     $element[$pwg_key] =
     444                        $matches[1].'-'.$matches[2].'-'.$matches[3];
     445                   }
     446                }
     447                else
     448                {
     449                  $element[$pwg_key] = $exif[$exif_key];
     450                }
     451              }
    435452            }
    436453          }
     
    525542    $listing.= ' generation_date="'.date('Y-m-d').'"';
    526543    $listing.= ' phpwg_version="'.$conf{'version'}.'"';
     544   
     545    $attrs=array();
     546    if ($conf['use_iptc'])
     547    {
     548      $attrs = array_merge($attrs, array_keys($conf['use_iptc_mapping']) );
     549    }
     550    if ($conf['use_exif'])
     551    {
     552      $attrs = array_merge($attrs, array_keys($conf['use_exif_mapping']) );
     553    }
     554    $listing.= ' metadata="'.implode(',',array_unique($attrs)).'"';
    527555   
    528556    $end = strrpos($_SERVER['PHP_SELF'], '/') + 1;
Note: See TracChangeset for help on using the changeset viewer.