Ignore:
Timestamp:
May 27, 2012, 2:04:11 PM (12 years ago)
Author:
grum
Message:

feature:2638 - Compatibility with Piwigo 2.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GMaps/gmaps_ajax.php

    r12214 r15345  
    2121  // in this case, PHPWG_ROOT_PATH must be declared as an absolute path...
    2222  define('PHPWG_ROOT_PATH',dirname(dirname(dirname(__FILE__))).'/');
    23 
    2423  /*
    2524   * set ajax module in admin mode if request is used for admin interface
     
    12001199                   GROUP_CONCAT(DISTINCT IF(pct.permalink IS NULL, CONCAT('*', pct.id), pct.permalink) ORDER BY pct.id SEPARATOR ';') AS imageCatsPLink,
    12011200                   pit.name AS imageName,
    1202                    pit.path, pit.tn_ext
     1201                   pit.path
    12031202            FROM (((".$this->tables['cache']." pgc
    12041203                    LEFT JOIN ".IMAGE_CATEGORY_TABLE." pic ON pic.image_id = pgc.imageId)
     
    12311230        {
    12321231          $row['imageName']  =GPCCore::getUserLanguageDesc($row['imageName']);
    1233           $row['imageTnFile']=dirname($row['path']).'/'.$conf['dir_thumbnail'].'/'.$conf['prefix_thumbnail'].get_filename_wo_extension(basename($row['path'])).'.'.$row['tn_ext'];
     1232          $row['imageTnFile']=str_replace(PHPWG_ROOT_PATH, './', DerivativeImage::thumb_url(array('id'=>$row['imageId'], 'path'=>$row['path'])));
    12341233          if(!$this->checkInGroup($row, $groups, $datas['distanceTreshold']))
    12351234          {
     
    12651264            {
    12661265              $tmpCatsNames[$key]=GPCCore::getUserLanguageDesc(substr($tmpCatsNames[$key],7));
    1267 
    1268               $tmpCatsUrl[]=make_picture_url(
    1269                 array(
    1270                   'image_id' => $point['imageId'],
    1271                   'category' => array(
    1272                     'id' => $id,
    1273                     'name' => $tmpCatsNames[$key],
    1274                     'permalink' => (substr($tmpCatsPLinks[$key],0,1)=='*')?'':$tmpCatsPLinks[$key],
     1266              $tmpCatsUrl[]=$this->replaceRoot(str_replace(PHPWG_ROOT_PATH, './',
     1267                make_picture_url(
     1268                  array(
     1269                    'image_id' => $point['imageId'],
     1270                    'category' => array(
     1271                      'id' => $id,
     1272                      'name' => $tmpCatsNames[$key],
     1273                      'permalink' => (substr($tmpCatsPLinks[$key],0,1)=='*')?'':$tmpCatsPLinks[$key],
     1274                    )
    12751275                  )
    12761276                )
    1277               );
     1277              ));
    12781278            }
    12791279
     
    12851285            $coords['lng']+=$point['longitude'];
    12861286
    1287             $coords['imgTn'][]=$this->replaceImgRoot($point['imageTnFile']);
     1287            $coords['imgTn'][]=$this->replaceRoot($point['imageTnFile']);
    12881288            $coords['imgCatsNames'][]=$tmpCatsNames;
    12891289            $coords['imgName'][]=GPCCore::getUserLanguageDesc($point['imageName']);
     
    13481348    /**
    13491349     * replace the root directroy for image
    1350      *  => './galleries/' becomes "G"
    1351      *  => './upload/' becomes "U"
     1350     *  => './_data/i/galleries/' becomes "G"
     1351     *  => './i.php?/galleries/' becomes "I"
     1352     *  => './picture.php?/' becomes "P"
    13521353     *  => other case : no chnages
    13531354     *
     
    13551356     * @returned String :
    13561357     */
    1357     private function replaceImgRoot($value)
    1358     {
    1359       if(preg_match('/^\.\/galleries\//i', $value)>0)
    1360       {
    1361         return("G".substr($value,12));
    1362       }
    1363       elseif(preg_match('/^\.\/upload\//i', $value)>0)
    1364       {
    1365         return("U".substr($value,9));
     1358    private function replaceRoot($value)
     1359    {
     1360      if(preg_match('/^\.\/_data\/i\/galleries\//i', $value)>0)
     1361      {
     1362        return("G".substr($value,20));
     1363      }
     1364      if(preg_match('/^\.\/i\.php\?\/galleries\//i', $value)>0)
     1365      {
     1366        return("I".substr($value,19));
     1367      }
     1368      if(preg_match('/^\.\/picture\.php\?\//i', $value)>0)
     1369      {
     1370        return("P".substr($value,15));
    13661371      }
    13671372      return($value);
Note: See TracChangeset for help on using the changeset viewer.