Changeset 21441
- Timestamp:
- Mar 10, 2013, 5:12:50 PM (11 years ago)
- Location:
- extensions/Subscribe_to_comments
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Subscribe_to_comments/include/functions.inc.php
r21340 r21441 66 66 AND email != "'.$exclude.'" 67 67 '; 68 $subscriptions = hash_from_query($query, 'email'); 68 $subscriptions = hash_from_query($query, 'id'); 69 70 if (count($subscriptions)==0) return; 69 71 70 72 set_make_full_url(); … … 551 553 function get_picture_infos($image_id, $with_thumb=true) 552 554 { 555 if (empty($image_id)) return array(); 556 553 557 $query = ' 554 558 SELECT … … 584 588 * @return: array (id, name, url, thumbnail) 585 589 */ 586 function get_category_infos($cat_id, $with_thumb=true )590 function get_category_infos($cat_id, $with_thumb=true, $user_id=null) 587 591 { 588 592 global $conf; 593 594 if ($user_id===null) $user_id = $conf['guest_id']; 589 595 590 596 $query = ' … … 593 599 cat.name, 594 600 cat.permalink, 601 ucc.count_images, 602 cat.uppercats, 595 603 img.id AS image_id, 596 604 img.path 597 605 FROM '.CATEGORIES_TABLE.' AS cat 598 606 LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc 599 ON ucc.cat_id = cat.id AND ucc.user_id = '.$ conf['guest_id'].'607 ON ucc.cat_id = cat.id AND ucc.user_id = '.$user_id.' 600 608 LEFT JOIN '.IMAGES_TABLE.' AS img 601 609 ON img.id = ucc.user_representative_picture_id … … 603 611 ;'; 604 612 $element = pwg_db_fetch_assoc(pwg_query($query)); 605 // we use guest_id for user_cache because we don't know the status of recipient606 613 607 614 $element['url'] = make_index_url(array( … … 612 619 if ($with_thumb) 613 620 { 614 $element['thumbnail'] = DerivativeImage::thumb_url(array( 615 'id'=>$element['image_id'], 616 'path'=>$element['path'], 617 )); 621 if (empty($element['image_id']) and $conf['allow_random_representative']) 622 { 623 $image = get_picture_infos(get_random_image_in_category($element)); 624 $element['thumbnail'] = $image['thumbnail']; 625 } 626 else 627 { 628 $element['thumbnail'] = DerivativeImage::thumb_url(array( 629 'id'=>$element['image_id'], 630 'path'=>$element['path'], 631 )); 632 } 618 633 } 619 634 -
extensions/Subscribe_to_comments/include/subscribe_to_comments.inc.php
r21439 r21441 264 264 function stc_on_album() 265 265 { 266 global $page, $template, $ pwg_loaded_plugins, $user, $conf;266 global $page, $template, $user, $conf; 267 267 268 268 if ( 269 script_basename() != 'index' or !isset($page['section']) or 270 !isset($pwg_loaded_plugins['Comments_on_Albums']) or 271 $page['section'] != 'categories' or !isset($page['category']) 269 !defined('COA_ID') or script_basename() != 'index' or 270 @$page['section'] != 'categories' or !isset($page['category']) 272 271 ) 273 272 { -
extensions/Subscribe_to_comments/include/subscribtions_page.inc.php
r21439 r21441 2 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 3 4 global $template, $conf, $page, $ pwg_loaded_plugins;4 global $template, $conf, $page, $user; 5 5 6 6 // check input parameters … … 213 213 case 'album-images': 214 214 case 'album': 215 $subscription['infos'] = get_category_infos($subscription['element_id'] );215 $subscription['infos'] = get_category_infos($subscription['element_id'], true, $user['id']); 216 216 break; 217 217 default: … … 238 238 } 239 239 240 if (isset($pwg_loaded_plugins['Comments_on_Albums']))241 {242 $template->assign('COA_ACTIVATED', true);243 }244 240 245 241 $template->assign(array( 246 242 'SUBSCRIBE_TO_PATH' => SUBSCRIBE_TO_PATH, 247 243 'SUBSCRIBE_TO_ABS_PATH' => realpath(SUBSCRIBE_TO_PATH).'/', 244 'COA_ACTIVATED' => defined('COA_ID'), 248 245 )); 249 246 -
extensions/Subscribe_to_comments/main.inc.php
r21340 r21441 9 9 */ 10 10 11 /* 12 * potential problem : if the permissions of a user change, he receives notifications 13 * about photos and albums he can't see anymore 14 */ 15 11 16 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 12 17 13 18 global $prefixeTable; 14 19 15 define('SUBSCRIBE_TO_PATH' , PHPWG_PLUGINS_PATH . 'Subscribe_to_Comments/'); 20 defined('SUBSCRIBE_TO_ID') or define('SUBSCRIBE_TO_ID', basename(dirname(__FILE__))); 21 define('SUBSCRIBE_TO_PATH' , PHPWG_PLUGINS_PATH . SUBSCRIBE_TO_ID . '/'); 16 22 define('SUBSCRIBE_TO_TABLE', $prefixeTable . 'subscribe_to_comments'); 17 23 define('SUBSCRIBE_TO_VERSION', 'auto'); … … 31 37 if ( 32 38 SUBSCRIBE_TO_VERSION == 'auto' or 33 $pwg_loaded_plugins[ 'Subscribe_to_Comments']['version'] == 'auto' or34 version_compare($pwg_loaded_plugins[ 'Subscribe_to_Comments']['version'], SUBSCRIBE_TO_VERSION, '<')39 $pwg_loaded_plugins[SUBSCRIBE_TO_ID]['version'] == 'auto' or 40 version_compare($pwg_loaded_plugins[SUBSCRIBE_TO_ID]['version'], SUBSCRIBE_TO_VERSION, '<') 35 41 ) 36 42 { … … 38 44 stc_install(); 39 45 40 if ( $pwg_loaded_plugins[ 'Subscribe_to_Comments']['version'] != 'auto' and SUBSCRIBE_TO_VERSION != 'auto' )46 if ( $pwg_loaded_plugins[SUBSCRIBE_TO_ID]['version'] != 'auto' and SUBSCRIBE_TO_VERSION != 'auto' ) 41 47 { 42 48 $query = ' 43 49 UPDATE '. PLUGINS_TABLE .' 44 50 SET version = "'. SUBSCRIBE_TO_VERSION .'" 45 WHERE id = " Subscribe_to_Comments"';51 WHERE id = "'. SUBSCRIBE_TO_ID .'"'; 46 52 pwg_query($query); 47 53 48 $pwg_loaded_plugins[ 'Subscribe_to_Comments']['version'] = SUBSCRIBE_TO_VERSION;54 $pwg_loaded_plugins[SUBSCRIBE_TO_ID]['version'] = SUBSCRIBE_TO_VERSION; 49 55 50 56 if (defined('IN_ADMIN')) … … 92 98 array_push($menu, array( 93 99 'NAME' => 'Subscribe to Comments', 94 'URL' => get_root_url().'admin.php?page=plugin-' . basename(dirname(__FILE__))100 'URL' => get_root_url().'admin.php?page=plugin-' . SUBSCRIBE_TO_ID, 95 101 )); 96 102 return $menu; -
extensions/Subscribe_to_comments/maintain.inc.php
r17923 r21441 2 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 3 4 include_once(PHPWG_PLUGINS_PATH . 'Subscribe_to_Comments/include/install.inc.php'); 4 defined('SUBSCRIBE_TO_ID') or define('SUBSCRIBE_TO_ID', basename(dirname(__FILE__))); 5 include_once(PHPWG_PLUGINS_PATH . SUBSCRIBE_TO_ID . '/include/install.inc.php'); 5 6 6 7
Note: See TracChangeset
for help on using the changeset viewer.