Ignore:
Timestamp:
Jan 1, 2011, 11:16:52 AM (13 years ago)
Author:
rub
Message:

Facebook_Integration plugin is inactivated when FacebookPlug is activating
Get representative image for category or random picture (and not only first picture)
Allow Facebook to access private index page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/FacebookPlug/Plugin/include/index.inc.php

    r8402 r8420  
    8282  global $page;
    8383
    84   if (count($categories) > 0)
     84  $C = count($categories);
     85  if ($C > 0)
    8586  {
    8687    include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
    87     $category = reset($categories);
    88     $query = '
     88    //~ $category = reset($categories);
     89    $category = $categories[rand(0, $C-1)];
     90    if (is_numeric($category['representative_picture_id']))
     91    {
     92      $query = '
    8993SELECT id, path, tn_ext
    9094FROM '.IMAGES_TABLE.'
    9195WHERE id = '.$category['representative_picture_id'].'
    9296;';
    93     $result = pwg_query($query);
    94     if($row = pwg_db_fetch_assoc($result))
    95     {
    96       set_make_full_url();
    97       $page['fbp']['url_image'] = get_thumbnail_url($row);
    98       unset_make_full_url();
     97      $result = pwg_query($query);
     98      if($row = pwg_db_fetch_assoc($result))
     99      {
     100        set_make_full_url();
     101        $page['fbp']['url_image'] = get_thumbnail_url($row);
     102        unset_make_full_url();
     103      }
    99104    }
    100105  }
     
    105110  global $page;
    106111
    107   if (count($pictures) > 0)
     112  if (isset($page['category']['representative_picture_id']))
    108113  {
    109     include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
    110     $picture = reset($pictures);
    111     set_make_full_url();
    112     $page['fbp']['url_image'] = get_thumbnail_url($picture);
    113     unset_make_full_url();
     114    fbp_loc_begin_index_category_thumbnails(array($page['category']));
     115  }
     116  else
     117  {
     118    $C = count($pictures);
     119    if ($C > 0)
     120    {
     121      include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
     122      $picture = reset($pictures);
     123      $picture = $pictures[rand(0, $C-1)];
     124      set_make_full_url();
     125      $page['fbp']['url_image'] = get_thumbnail_url($picture);
     126      unset_make_full_url();
     127    }
    114128  }
    115129}
Note: See TracChangeset for help on using the changeset viewer.