Changeset 11546 for extensions
- Timestamp:
- Jun 28, 2011, 3:19:44 PM (13 years ago)
- Location:
- extensions/SmartAlbums
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/SmartAlbums/admin/albums.inc.php
r11392 r11546 65 65 array_push( 66 66 $page['infos'], 67 l10n_args(get_l10n_args( 68 '%d photos associated to album «%s»', 69 array( 70 count($associated_images), 71 trigger_event( 72 'render_category_name', 73 $category['name'], 74 'admin_cat_list' 75 ) 76 ) 77 )) 67 sprintf( 68 l10n('%d photos associated to album %s'), 69 count($associated_images), 70 '«'.trigger_event( 71 'render_category_name', 72 $category['name'], 73 'admin_cat_list' 74 ).'»' 75 ) 78 76 ); 79 77 } … … 85 83 array_push( 86 84 $page['infos'], 87 l10n_args(get_l10n_args( 88 '%d photos associated to album «%s»', 89 array( 90 count($associated_images), 91 trigger_event( 92 'render_category_name', 93 $categories[$_GET['smart_generate']]['name'], 94 'admin_cat_list' 95 ) 96 ) 97 )) 85 sprintf( 86 l10n('%d photos associated to album %s'), 87 count($associated_images), 88 '«'.trigger_event( 89 'render_category_name', 90 $categories[$_GET['smart_generate']]['name'], 91 'admin_cat_list' 92 ).'»' 93 ) 98 94 ); 99 95 } -
extensions/SmartAlbums/include/functions.inc.php
r11381 r11546 9 9 function smart_make_associations($cat_id) 10 10 { 11 pwg_query('DELETE FROM '.IMAGE_CATEGORY_TABLE.' WHERE category_id = '.$cat_id.' AND smart = true;'); 11 $query = ' 12 DELETE FROM '.IMAGE_CATEGORY_TABLE.' 13 WHERE 14 category_id = '.$cat_id.' 15 AND smart = true 16 ;'; 17 pwg_query($query); 12 18 13 19 $images = smart_get_pictures($cat_id); … … 30 36 } 31 37 32 if (!function_exists('set_random_representant')) 33 { 34 include(PHPWG_ROOT_PATH.'admin/include/functions.php'); 35 } 36 set_random_representant(array($cat_id)); 38 // represantant, try to not overwrite if still in images list 39 $query = ' 40 SELECT representative_picture_id 41 FROM '.CATEGORIES_TABLE.' 42 WHERE id = '.$cat_id.' 43 ;'; 44 list($rep_id) = pwg_db_fetch_row(pwg_query($query)); 45 46 if ( !in_array($rep_id, $images) ) 47 { 48 if (!function_exists('set_random_representant')) 49 { 50 include(PHPWG_ROOT_PATH.'admin/include/functions.php'); 51 } 52 set_random_representant(array($cat_id)); 53 } 37 54 38 55 return $images; … … 79 96 if ($filters == null) 80 97 { 98 $filters = array(); 99 81 100 $query = ' 82 101 SELECT * … … 85 104 ORDER BY type ASC, cond ASC 86 105 ;'; 87 $ filters= pwg_query($query);88 89 if (!pwg_db_num_rows($ filters)) return array();90 91 while ($ filter = pwg_db_fetch_assoc($filters))92 { 93 $ temp[] = array(94 'type' => $ filter['type'],95 'cond' => $ filter['cond'],96 'value' => $ filter['value'],106 $result = pwg_query($query); 107 108 if (!pwg_db_num_rows($result)) return $filters; 109 110 while ($row = pwg_db_fetch_assoc($result)) 111 { 112 $filters[] = array( 113 'type' => $row['type'], 114 'cond' => $row['cond'], 115 'value' => $row['value'], 97 116 ); 98 117 } 99 100 $filters = $temp;101 118 } 102 119 … … 110 127 if ($filter['type'] == 'tags') 111 128 { 112 if($filter['cond'] == "all") 113 { 114 $tags_arr = explode(',', $filter['value']); 115 116 foreach($tags_arr as $value) 117 { 118 $join[] = IMAGE_TAG_TABLE.' AS it_'.$i_tags.' ON i.id = it_'.$i_tags.'.image_id'; 119 $where[] = 'it_'.$i_tags.'.tag_id = '.$value; 120 $i_tags++; 121 } 122 } 123 else if ($filter['cond'] == 'one') 129 if($filter['cond'] == "all") 130 { 131 $tags_arr = explode(',', $filter['value']); 132 133 foreach($tags_arr as $value) 124 134 { 125 135 $join[] = IMAGE_TAG_TABLE.' AS it_'.$i_tags.' ON i.id = it_'.$i_tags.'.image_id'; 126 $where[] = 'it_'.$i_tags.'.tag_id IN ('.$filter['value'].')';136 $where[] = 'it_'.$i_tags.'.tag_id = '.$value; 127 137 $i_tags++; 128 138 } 129 else if ($filter['cond'] == 'none') 130 { 131 $sub_query = ' 139 } 140 else if ($filter['cond'] == 'one') 141 { 142 $join[] = IMAGE_TAG_TABLE.' AS it_'.$i_tags.' ON i.id = it_'.$i_tags.'.image_id'; 143 $where[] = 'it_'.$i_tags.'.tag_id IN ('.$filter['value'].')'; 144 $i_tags++; 145 } 146 else if ($filter['cond'] == 'none') 147 { 148 $sub_query = ' 132 149 SELECT it_'.$i_tags.'.image_id 133 150 FROM '.IMAGE_TAG_TABLE.' AS it_'.$i_tags.' … … 137 154 GROUP BY it_'.$i_tags.'.image_id 138 155 '; 139 140 141 142 143 144 156 $where[] = 'NOT EXISTS ('.$sub_query.')'; 157 $i_tags++; 158 } 159 else if ($filter['cond'] == 'only') 160 { 161 $sub_query = ' 145 162 SELECT it_'.$i_tags.'.image_id 146 163 FROM '.IMAGE_TAG_TABLE.' AS it_'.$i_tags.' … … 150 167 GROUP BY it_'.$i_tags.'.image_id 151 168 '; 152 $where[] = 'NOT EXISTS ('.$sub_query.')'; 169 $where[] = 'NOT EXISTS ('.$sub_query.')'; 170 171 $i_tags++; 172 $tags_arr = explode(',', $filter['value']); 153 173 174 foreach($tags_arr as $value) 175 { 176 $join[] = IMAGE_TAG_TABLE.' AS it_'.$i_tags.' ON i.id = it_'.$i_tags.'.image_id'; 177 $where[] = 'it_'.$i_tags.'.tag_id = '.$value; 154 178 $i_tags++; 155 $tags_arr = explode(',', $filter['value']); 156 157 foreach($tags_arr as $value) 158 { 159 $join[] = IMAGE_TAG_TABLE.' AS it_'.$i_tags.' ON i.id = it_'.$i_tags.'.image_id'; 160 $where[] = 'it_'.$i_tags.'.tag_id = '.$value; 161 $i_tags++; 162 } 163 } 179 } 180 } 164 181 } 165 182 // date … … 234 251 /** 235 252 * Check if the filter is proper 236 *237 253 * @param array filter 238 254 * @return array or false … … 246 262 if ($filter['type'] == 'tags') 247 263 { 248 if ($filter['value'] == null) // tags fields musn't be null264 if ($filter['value'] == null) 249 265 { 250 266 $error = true; … … 259 275 else if ($filter['type'] == 'date') 260 276 { 261 if (!preg_match('#([0-9]{4})-([0-9]{2})-([0-9]{2})#', $filter['value'])) // dates must be proper277 if (!preg_match('#([0-9]{4})-([0-9]{2})-([0-9]{2})#', $filter['value'])) 262 278 { 263 279 $error = true; … … 268 284 else if ($filter['type'] == 'limit') 269 285 { 270 if (!preg_match('#([0-9]{1,})#', $filter['value'])) // limit must be an integer286 if (!preg_match('#([0-9]{1,})#', $filter['value'])) 271 287 { 272 288 $error = true; … … 298 314 /** 299 315 * inserts multiple lines in a table, ignore duplicate entries 300 *301 316 * @param string table_name 302 317 * @param array dbfields -
extensions/SmartAlbums/include/init_cat_list.php
r11392 r11546 44 44 array_push( 45 45 $page['infos'], 46 l10n_args(get_l10n_args( 47 '%d photos associated to album «%s»', 48 array( 49 count($associated_images), 50 trigger_event( 51 'render_category_name', 52 $category['name'], 53 'admin_cat_list' 54 ) 55 ) 56 )) 46 sprintf( 47 l10n('%d photos associated to album %s'), 48 count($associated_images), 49 '«'.trigger_event( 50 'render_category_name', 51 $category['name'], 52 'admin_cat_list' 53 ).'»' 54 ) 57 55 ); 58 56 } … … 64 62 array_push( 65 63 $page['infos'], 66 l10n_args(get_l10n_args( 67 '%d photos associated to album «%s»', 68 array( 69 count($associated_images), 70 trigger_event( 71 'render_category_name', 72 $smart_cats[$_GET['smart_generate']]['name'], 73 'admin_cat_list' 74 ) 75 ) 76 )) 64 sprintf( 65 l10n('%d photos associated to album %s'), 66 count($associated_images), 67 '«'.trigger_event( 68 'render_category_name', 69 $smart_cats[$_GET['smart_generate']]['name'], 70 'admin_cat_list' 71 ).'»' 72 ) 77 73 ); 78 74 } … … 113 109 { 114 110 $search[1] = '</ul> 115 </form> 116 {/if}'; 111 </form>'; 117 112 $replacement[1] = $search[1].' 118 113 <form method="post" action="{$SMART_URL.all}"> -
extensions/SmartAlbums/include/init_cat_modify.php
r11392 r11546 62 62 $associated_images = smart_make_associations($cat_id); 63 63 $template->assign('IMAGE_COUNT', l10n_dec('%d photo', '%d photos', count($associated_images))); 64 65 array_push( 66 $page['infos'], 67 sprintf( 68 l10n('%d photos associated to album %s'), 69 count($associated_images), 70 '' 71 ) 72 ); 64 73 65 74 define('SMART_NOT_UPDATE', 1); -
extensions/SmartAlbums/language/en_UK/plugin.lang.php
r11451 r11546 1 1 <?php 2 2 3 $lang['%d photos associated to album «%s»'] = '%d photos associated to album «%s»';3 $lang['%d photos associated to album %s'] = '%d photos associated to album %s'; 4 4 $lang['No filter selected'] = 'No filter selected'; 5 5 $lang['No tag selected'] = 'No tag selected'; -
extensions/SmartAlbums/language/fr_FR/plugin.lang.php
r11451 r11546 1 1 <?php 2 2 3 $lang['%d photos associated to album «%s»'] = '%d photos associées à l\'album «%s»';3 $lang['%d photos associated to album %s'] = '%d photos associées à l\'album %s'; 4 4 $lang['No filter selected'] = 'Aucun filtre sélectionné'; 5 5 $lang['No tag selected'] = 'Aucun tag sélectionné'; -
extensions/SmartAlbums/language/it_IT/plugin.lang.php
r11451 r11546 1 1 <?php 2 2 3 $lang['%d photos associated to album «%s»'] = '%d foto associate all\'album "%s"';3 $lang['%d photos associated to album %s'] = '%d foto associate all\'album %s'; 4 4 $lang['No filter selected'] = 'Nessun filtro selezionato'; 5 5 $lang['No tag selected'] = 'Nessun tag selezionato'; -
extensions/SmartAlbums/language/lv_LV/plugin.lang.php
r11451 r11546 1 1 <?php 2 2 3 $lang['%d photos associated to album «%s»'] = '%d fotogrāfiju saistītas ar albūmu «%s»';3 $lang['%d photos associated to album %s'] = '%d fotogrāfiju saistītas ar albūmu %s'; 4 4 $lang['No filter selected'] = 'Nav izvēlēts neviens no filtriem'; 5 5 $lang['No tag selected'] = 'Nav izvēlēts neviens no tagiem';
Note: See TracChangeset
for help on using the changeset viewer.