Changeset 12450 for extensions/PWG_Stuffs
- Timestamp:
- Oct 15, 2011, 5:16:32 PM (13 years ago)
- Location:
- extensions/PWG_Stuffs/trunk/modules
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PWG_Stuffs/trunk/modules/BestRated/main.inc.php
r12401 r12450 4 4 5 5 global $page, $user, $conf, $template; 6 7 $page_save = $page; 8 $tpl_save = $template->get_template_vars('THUMBNAILS'); 6 9 7 10 if (script_basename() == 'picture' … … 44 47 ;'; 45 48 46 $pictures = array(); 47 $selection = array_from_query($query, 'id'); 48 49 if (count($selection) > 0) 49 $page['items'] = array_from_query($query, 'id'); 50 $page['start'] = 0; 51 $page['nb_image_page'] = $datas['nb_images']; 52 $page['section'] = 'best_rated'; 53 54 include(PHPWG_ROOT_PATH.'include/category_default.inc.php'); 55 56 if (!empty($tpl_thumbnails_var)) 50 57 { 51 $rank_of = array_flip($selection); 52 53 $query = ' 54 SELECT * 55 FROM '.IMAGES_TABLE.' 56 WHERE id IN ('.implode(',', $selection).') 57 ;'; 58 $result = pwg_query($query); 59 while ($row = mysql_fetch_assoc($result)) 60 { 61 $row['rank'] = $rank_of[ $row['id'] ]; 62 63 array_push($pictures, $row); 64 } 65 66 usort($pictures, 'rank_compare'); 67 unset($rank_of); 68 } 69 70 if (count($pictures) > 0) 71 { 72 if ($user['show_nb_comments']) 73 { 74 $query = ' 75 SELECT image_id, COUNT(*) AS nb_comments 76 FROM '.COMMENTS_TABLE.' 77 WHERE validated = \'true\' 78 AND image_id IN ('.implode(',', $selection).') 79 GROUP BY image_id 80 ;'; 81 $nb_comments_of = simple_hash_from_query($query, 'image_id', 'nb_comments'); 82 } 83 84 // template thumbnail initialization 85 trigger_action('loc_begin_index_thumbnails', $pictures); 86 $block['thumbnails'] = array(); 87 88 foreach ($pictures as $row) 89 { 90 // link on picture.php page 91 $url = duplicate_picture_url( 92 array( 93 'image_id' => $row['id'], 94 'image_file' => $row['file'] 95 ), 96 array('start') 97 ); 98 $url = add_url_params($url, array('pwgs_br' => implode(',',$selection))); 99 100 $tpl_var = 101 array( 102 'ID' => $row['id'], 103 'TN_SRC' => get_thumbnail_url($row), 104 'TN_ALT' => $row['file'], 105 'TN_TITLE' => get_thumbnail_title($row), 106 'ICON_TS' => get_icon($row['date_available']), 107 'URL' => $url, 108 109 /* Fields for template-extension usage */ 110 'FILE_PATH' => $row['path'], 111 'FILE_POSTED' => $row['date_available'], 112 'FILE_CREATED' => $row['date_creation'], 113 'FILE_DESC' => $row['comment'], 114 'FILE_AUTHOR' => $row['author'], 115 'FILE_HIT' => $row['hit'], 116 'FILE_SIZE' => $row['filesize'], 117 'FILE_WIDTH' => $row['width'], 118 'FILE_HEIGHT' => $row['height'], 119 'FILE_METADATE' => $row['date_metadata_update'], 120 'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ? 121 true:false, /* lack of include/functions_picture.inc.php */ 122 ); 123 124 if ($user['show_nb_hits']) 125 { 126 $tpl_var['NB_HITS'] = $row['hit']; 127 } 128 129 if (isset($row['name']) and $row['name'] != '') 130 { 131 $name = $row['name']; 132 } 133 else 134 { 135 $name = str_replace('_', ' ', get_filename_wo_extension($row['file'])); 136 } 137 138 $tpl_var['NAME'] = '('.$row['rating_score'].') '.$name; 139 140 if ( isset($nb_comments_of) ) 141 { 142 $tpl_var['NB_COMMENTS'] = (int)@$nb_comments_of[$row['id']]; 143 } 144 145 $block['thumbnails'][] = $tpl_var; 146 } 147 148 $block['thumbnails'] = trigger_event('loc_end_index_thumbnails', $block['thumbnails'], $pictures); 149 58 $block['thumbnails'] = $tpl_thumbnails_var; 150 59 $block['TEMPLATE'] = 'stuffs_thumbnails.tpl'; 151 60 } 152 61 62 $page = $page_save; 63 $template->assign('THUMBNAILS', $tpl_save); 64 153 65 ?> -
extensions/PWG_Stuffs/trunk/modules/FeaturedPhotos/main.inc.php
r12401 r12450 4 4 5 5 global $page, $user, $conf, $template; 6 7 $page_save = $page; 8 $tpl_save = $template->get_template_vars('THUMBNAILS'); 6 9 7 10 $forbidden = get_sql_condition_FandF … … 25 28 '.$forbidden.';'; 26 29 27 $pictures = array(); 28 $selection = array_from_query($query, 'id'); 30 $page['items'] = array_from_query($query, 'id'); 31 $page['start'] = 0; 32 $page['nb_image_page'] = $datas['nb_images']; 33 $page['section'] = 'category'; 29 34 30 if (count($selection) > 0) 35 include(PHPWG_ROOT_PATH.'include/category_default.inc.php'); 36 37 if (!empty($tpl_thumbnails_var)) 31 38 { 32 $rank_of = array_flip($selection); 33 34 $query = ' 35 SELECT * 36 FROM '.IMAGES_TABLE.' 37 WHERE id IN ('.implode(',', $selection).') 38 ;'; 39 $result = pwg_query($query); 40 while ($row = mysql_fetch_assoc($result)) 41 { 42 $row['rank'] = $rank_of[ $row['id'] ]; 43 44 array_push($pictures, $row); 45 } 46 47 usort($pictures, 'rank_compare'); 48 unset($rank_of); 49 } 50 51 if (count($pictures) > 0) 52 { 53 if ($user['show_nb_comments']) 54 { 55 $query = ' 56 SELECT image_id, COUNT(*) AS nb_comments 57 FROM '.COMMENTS_TABLE.' 58 WHERE validated = \'true\' 59 AND image_id IN ('.implode(',', $selection).') 60 GROUP BY image_id 61 ;'; 62 $nb_comments_of = simple_hash_from_query($query, 'image_id', 'nb_comments'); 63 } 64 65 // template thumbnail initialization 66 trigger_action('loc_begin_index_thumbnails', $pictures); 67 $block['thumbnails'] = array(); 68 69 foreach ($pictures as $row) 70 { 71 // link on picture.php page 72 $url = duplicate_picture_url( 73 array( 74 'image_id' => $row['id'], 75 'image_file' => $row['file'] 76 ), 77 array('start') 78 ); 79 $url = add_url_params($url, array('pwgs_ra' => implode(',',$selection))); 80 81 $tpl_var = 82 array( 83 'ID' => $row['id'], 84 'TN_SRC' => get_thumbnail_url($row), 85 'TN_ALT' => $row['file'], 86 'TN_TITLE' => get_thumbnail_title($row), 87 'ICON_TS' => get_icon($row['date_available']), 88 'URL' => $url, 89 90 /* Fields for template-extension usage */ 91 'FILE_PATH' => $row['path'], 92 'FILE_POSTED' => $row['date_available'], 93 'FILE_CREATED' => $row['date_creation'], 94 'FILE_DESC' => $row['comment'], 95 'FILE_AUTHOR' => $row['author'], 96 'FILE_HIT' => $row['hit'], 97 'FILE_SIZE' => $row['filesize'], 98 'FILE_WIDTH' => $row['width'], 99 'FILE_HEIGHT' => $row['height'], 100 'FILE_METADATE' => $row['date_metadata_update'], 101 'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ? 102 true:false, /* lack of include/functions_picture.inc.php */ 103 ); 104 105 if ($user['show_nb_hits']) 106 { 107 $tpl_var['NB_HITS'] = $row['hit']; 108 } 109 110 if (isset($row['name']) and $row['name'] != '') 111 { 112 $name = $row['name']; 113 } 114 else 115 { 116 $name = str_replace('_', ' ', get_filename_wo_extension($row['file'])); 117 } 118 119 $tpl_var['NAME'] = $name; 120 121 if ( isset($nb_comments_of) ) 122 { 123 $tpl_var['NB_COMMENTS'] = (int)@$nb_comments_of[$row['id']]; 124 } 125 126 $block['thumbnails'][] = $tpl_var; 127 } 128 129 $block['thumbnails'] = trigger_event('loc_end_index_thumbnails', $block['thumbnails'], $pictures); 130 39 $block['thumbnails'] = $tpl_thumbnails_var; 131 40 $block['TEMPLATE'] = 'stuffs_thumbnails.tpl'; 132 41 } 133 42 43 $page = $page_save; 44 $template->assign('THUMBNAILS', $tpl_save); 45 134 46 ?> -
extensions/PWG_Stuffs/trunk/modules/MostVisited/main.inc.php
r12401 r12450 3 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 4 5 global $page, $user, $conf, $template, $pwg_event_handlers, $yop; 5 global $page, $user, $conf, $template; 6 7 $page_save = $page; 8 $tpl_save = $template->get_template_vars('THUMBNAILS'); 6 9 7 10 if (script_basename() == 'picture' … … 44 47 ;'; 45 48 46 $pictures = array(); 47 $selection = array_from_query($query, 'id'); 48 49 if (count($selection) > 0) 49 $page['items'] = array_from_query($query, 'id'); 50 $page['start'] = 0; 51 $page['nb_image_page'] = $datas['nb_images']; 52 $page['section'] = 'most_visited'; 53 54 include(PHPWG_ROOT_PATH.'include/category_default.inc.php'); 55 56 if (!empty($tpl_thumbnails_var)) 50 57 { 51 $rank_of = array_flip($selection); 52 53 $query = ' 54 SELECT * 55 FROM '.IMAGES_TABLE.' 56 WHERE id IN ('.implode(',', $selection).') 57 ;'; 58 $result = pwg_query($query); 59 while ($row = mysql_fetch_assoc($result)) 60 { 61 $row['rank'] = $rank_of[ $row['id'] ]; 62 63 array_push($pictures, $row); 64 } 65 66 usort($pictures, 'rank_compare'); 67 unset($rank_of); 68 } 69 70 if (count($pictures) > 0) 71 { 72 if ($user['show_nb_comments']) 73 { 74 $query = ' 75 SELECT image_id, COUNT(*) AS nb_comments 76 FROM '.COMMENTS_TABLE.' 77 WHERE validated = \'true\' 78 AND image_id IN ('.implode(',', $selection).') 79 GROUP BY image_id 80 ;'; 81 $nb_comments_of = simple_hash_from_query($query, 'image_id', 'nb_comments'); 82 } 83 84 // template thumbnail initialization 85 trigger_action('loc_begin_index_thumbnails', $pictures); 86 $block['thumbnails'] = array(); 87 88 foreach ($pictures as $row) 89 { 90 // link on picture.php page 91 $url = duplicate_picture_url( 92 array( 93 'image_id' => $row['id'], 94 'image_file' => $row['file'] 95 ), 96 array('start') 97 ); 98 $url = add_url_params($url, array('pwgs_mv' => implode(',',$selection))); 99 100 $tpl_var = 101 array( 102 'ID' => $row['id'], 103 'TN_SRC' => get_thumbnail_url($row), 104 'TN_ALT' => $row['file'], 105 'TN_TITLE' => get_thumbnail_title($row), 106 'ICON_TS' => get_icon($row['date_available']), 107 'URL' => $url, 108 109 /* Fields for template-extension usage */ 110 'FILE_PATH' => $row['path'], 111 'FILE_POSTED' => $row['date_available'], 112 'FILE_CREATED' => $row['date_creation'], 113 'FILE_DESC' => $row['comment'], 114 'FILE_AUTHOR' => $row['author'], 115 'FILE_HIT' => $row['hit'], 116 'FILE_SIZE' => $row['filesize'], 117 'FILE_WIDTH' => $row['width'], 118 'FILE_HEIGHT' => $row['height'], 119 'FILE_METADATE' => $row['date_metadata_update'], 120 'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ? 121 true:false, /* lack of include/functions_picture.inc.php */ 122 ); 123 124 if ($user['show_nb_hits']) 125 { 126 $tpl_var['NB_HITS'] = $row['hit']; 127 } 128 129 if (isset($row['name']) and $row['name'] != '') 130 { 131 $name = $row['name']; 132 } 133 else 134 { 135 $name = str_replace('_', ' ', get_filename_wo_extension($row['file'])); 136 } 137 138 if ( !$user['show_nb_hits']) 139 { 140 $name = '('.$row['hit'].') '.$name; 141 } 142 143 $tpl_var['NAME'] = $name; 144 145 if ( isset($nb_comments_of) ) 146 { 147 $tpl_var['NB_COMMENTS'] = (int)@$nb_comments_of[$row['id']]; 148 } 149 150 $block['thumbnails'][] = $tpl_var; 151 } 152 153 $block['thumbnails'] = trigger_event('loc_end_index_thumbnails', $block['thumbnails'], $pictures); 154 58 $block['thumbnails'] = $tpl_thumbnails_var; 155 59 $block['TEMPLATE'] = 'stuffs_thumbnails.tpl'; 156 60 } 157 61 62 $page = $page_save; 63 $template->assign('THUMBNAILS', $tpl_save); 64 158 65 ?> -
extensions/PWG_Stuffs/trunk/modules/Random/main.inc.php
r12401 r12450 4 4 5 5 global $page, $user, $conf, $template; 6 7 $page_save = $page; 8 $tpl_save = $template->get_template_vars('THUMBNAILS'); 6 9 7 10 if (script_basename() == 'picture' … … 43 46 ;'; 44 47 45 $pictures = array(); 46 $selection = array_from_query($query, 'id'); 47 48 if (count($selection) > 0) 48 $page['items'] = array_from_query($query, 'id'); 49 $page['start'] = 0; 50 $page['nb_image_page'] = $datas['nb_images']; 51 $page['section'] = 'category'; 52 53 include(PHPWG_ROOT_PATH.'include/category_default.inc.php'); 54 55 if (!empty($tpl_thumbnails_var)) 49 56 { 50 $rank_of = array_flip($selection); 51 52 $query = ' 53 SELECT * 54 FROM '.IMAGES_TABLE.' 55 WHERE id IN ('.implode(',', $selection).') 56 ;'; 57 $result = pwg_query($query); 58 while ($row = mysql_fetch_assoc($result)) 59 { 60 $row['rank'] = $rank_of[ $row['id'] ]; 61 62 array_push($pictures, $row); 63 } 64 65 usort($pictures, 'rank_compare'); 66 unset($rank_of); 67 } 68 69 if (count($pictures) > 0) 70 { 71 if ($user['show_nb_comments']) 72 { 73 $query = ' 74 SELECT image_id, COUNT(*) AS nb_comments 75 FROM '.COMMENTS_TABLE.' 76 WHERE validated = \'true\' 77 AND image_id IN ('.implode(',', $selection).') 78 GROUP BY image_id 79 ;'; 80 $nb_comments_of = simple_hash_from_query($query, 'image_id', 'nb_comments'); 81 } 82 83 // template thumbnail initialization 84 trigger_action('loc_begin_index_thumbnails', $pictures); 85 $block['thumbnails'] = array(); 86 87 foreach ($pictures as $row) 88 { 89 // link on picture.php page 90 $url = duplicate_picture_url( 91 array( 92 'image_id' => $row['id'], 93 'image_file' => $row['file'] 94 ), 95 array('start') 96 ); 97 $url = add_url_params($url, array('pwgs_ra' => implode(',',$selection))); 98 99 $tpl_var = 100 array( 101 'ID' => $row['id'], 102 'TN_SRC' => get_thumbnail_url($row), 103 'TN_ALT' => $row['file'], 104 'TN_TITLE' => get_thumbnail_title($row), 105 'ICON_TS' => get_icon($row['date_available']), 106 'URL' => $url, 107 108 /* Fields for template-extension usage */ 109 'FILE_PATH' => $row['path'], 110 'FILE_POSTED' => $row['date_available'], 111 'FILE_CREATED' => $row['date_creation'], 112 'FILE_DESC' => $row['comment'], 113 'FILE_AUTHOR' => $row['author'], 114 'FILE_HIT' => $row['hit'], 115 'FILE_SIZE' => $row['filesize'], 116 'FILE_WIDTH' => $row['width'], 117 'FILE_HEIGHT' => $row['height'], 118 'FILE_METADATE' => $row['date_metadata_update'], 119 'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ? 120 true:false, /* lack of include/functions_picture.inc.php */ 121 ); 122 123 if ($user['show_nb_hits']) 124 { 125 $tpl_var['NB_HITS'] = $row['hit']; 126 } 127 128 if (isset($row['name']) and $row['name'] != '') 129 { 130 $name = $row['name']; 131 } 132 else 133 { 134 $name = str_replace('_', ' ', get_filename_wo_extension($row['file'])); 135 } 136 137 $tpl_var['NAME'] = $name; 138 139 if ( isset($nb_comments_of) ) 140 { 141 $tpl_var['NB_COMMENTS'] = (int)@$nb_comments_of[$row['id']]; 142 } 143 144 $block['thumbnails'][] = $tpl_var; 145 } 146 147 $block['thumbnails'] = trigger_event('loc_end_index_thumbnails', $block['thumbnails'], $pictures); 148 57 $block['thumbnails'] = $tpl_thumbnails_var; 149 58 $block['TEMPLATE'] = 'stuffs_thumbnails.tpl'; 150 59 } 151 60 61 $page = $page_save; 62 $template->assign('THUMBNAILS', $tpl_save); 63 152 64 ?> -
extensions/PWG_Stuffs/trunk/modules/Recent/main.inc.php
r12414 r12450 4 4 5 5 global $page, $user, $conf, $template; 6 7 $page_save = $page; 8 $tpl_save = $template->get_template_vars('THUMBNAILS'); 6 9 7 10 if (script_basename() == 'picture' … … 44 47 LIMIT 0, '.$datas['nb_images'].' 45 48 ;'; 49 50 $page['items'] = array_from_query($query, 'id'); 51 $page['start'] = 0; 52 $page['nb_image_page'] = $datas['nb_images']; 53 $page['section'] = 'best_rated'; 46 54 47 $pictures = array(); 48 $selection = array_from_query($query, 'id'); 49 50 if (count($selection) > 0) 55 include(PHPWG_ROOT_PATH.'include/category_default.inc.php'); 56 57 if (!empty($tpl_thumbnails_var)) 51 58 { 52 $query = ' 53 SELECT * 54 FROM '.IMAGES_TABLE.' 55 WHERE id IN ('.implode(',', $selection).') 56 ORDER BY date_available DESC, id DESC 57 ;'; 58 $result = pwg_query($query); 59 while ($row = mysql_fetch_assoc($result)) 60 { 61 array_push($pictures, $row); 62 } 63 } 64 65 if (count($pictures) > 0) 66 { 67 if ($user['show_nb_comments']) 68 { 69 $query = ' 70 SELECT image_id, COUNT(*) AS nb_comments 71 FROM '.COMMENTS_TABLE.' 72 WHERE validated = \'true\' 73 AND image_id IN ('.implode(',', $selection).') 74 GROUP BY image_id 75 ;'; 76 $nb_comments_of = simple_hash_from_query($query, 'image_id', 'nb_comments'); 77 } 78 79 // template thumbnail initialization 80 trigger_action('loc_begin_index_thumbnails', $pictures); 81 $block['thumbnails'] = array(); 82 83 foreach ($pictures as $row) 84 { 85 // link on picture.php page 86 $url = duplicate_picture_url( 87 array( 88 'image_id' => $row['id'], 89 'image_file' => $row['file'] 90 ), 91 array('start') 92 ); 93 $url = add_url_params($url, array('pwgs_re' => implode(',',$selection))); 94 95 $tpl_var = 96 array( 97 'ID' => $row['id'], 98 'TN_SRC' => get_thumbnail_url($row), 99 'TN_ALT' => $row['file'], 100 'TN_TITLE' => get_thumbnail_title($row), 101 'ICON_TS' => get_icon($row['date_available']), 102 'URL' => $url, 103 104 /* Fields for template-extension usage */ 105 'FILE_PATH' => $row['path'], 106 'FILE_POSTED' => $row['date_available'], 107 'FILE_CREATED' => $row['date_creation'], 108 'FILE_DESC' => $row['comment'], 109 'FILE_AUTHOR' => $row['author'], 110 'FILE_HIT' => $row['hit'], 111 'FILE_SIZE' => $row['filesize'], 112 'FILE_WIDTH' => $row['width'], 113 'FILE_HEIGHT' => $row['height'], 114 'FILE_METADATE' => $row['date_metadata_update'], 115 'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ? 116 true:false, /* lack of include/functions_picture.inc.php */ 117 ); 118 119 if ($user['show_nb_hits']) 120 { 121 $tpl_var['NB_HITS'] = $row['hit']; 122 } 123 124 if (isset($row['name']) and $row['name'] != '') 125 { 126 $name = $row['name']; 127 } 128 else 129 { 130 $name = str_replace('_', ' ', get_filename_wo_extension($row['file'])); 131 } 132 133 $tpl_var['NAME'] = $name; 134 135 if ( isset($nb_comments_of) ) 136 { 137 $tpl_var['NB_COMMENTS'] = (int)@$nb_comments_of[$row['id']]; 138 } 139 140 $block['thumbnails'][] = $tpl_var; 141 } 142 143 $block['thumbnails'] = trigger_event('loc_end_index_thumbnails', $block['thumbnails'], $pictures); 144 59 $block['thumbnails'] = $tpl_thumbnails_var; 145 60 $block['TEMPLATE'] = 'stuffs_thumbnails.tpl'; 146 61 } 147 62 63 $page = $page_save; 64 $template->assign('THUMBNAILS', $tpl_save); 65 148 66 ?>
Note: See TracChangeset
for help on using the changeset viewer.