Changeset 1051 for trunk/include/section_init.inc.php
- Timestamp:
- Feb 23, 2006, 3:30:19 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/section_init.inc.php
r1047 r1051 53 53 or $_GET['cat'] == 'best_rated' 54 54 or $_GET['cat'] == 'recent_pics' 55 or $_GET['cat'] == 'recent_cats' 56 or $_GET['cat'] == 'calendar') 55 or $_GET['cat'] == 'recent_cats') 57 56 { 58 57 $page['cat'] = $_GET['cat']; … … 98 97 $page['nb_image_page'] = $user['nb_image_page']; 99 98 99 if (isset($_COOKIE['pwg_image_order']) 100 and is_numeric($_COOKIE['pwg_image_order']) 101 and $_COOKIE['pwg_image_order'] > 0) 102 { 103 $orders = get_category_preferred_image_orders(); 104 105 $conf['order_by'] = str_replace( 106 'ORDER BY ', 107 'ORDER BY '.$orders[ $_COOKIE['pwg_image_order'] ][1].',', 108 $conf['order_by'] 109 ); 110 $page['super_order_by'] = true; 111 } 112 100 113 if (isset($page['cat'])) 101 114 { 102 if ($page['cat'] != 'most_visited' and $page['cat'] != 'best_rated') 103 { 104 if (isset($_COOKIE['pwg_image_order']) 105 and is_numeric($_COOKIE['pwg_image_order']) 106 and $_COOKIE['pwg_image_order'] > 0) 107 { 108 $orders = get_category_preferred_image_orders(); 109 110 $conf['order_by'] = str_replace( 111 'ORDER BY ', 112 'ORDER BY '.$orders[ $_COOKIE['pwg_image_order'] ][1].',', 113 $conf['order_by'] 114 ); 115 } 116 } 117 115 118 116 // +-----------------------------------------------------------------------+ 119 117 // | category | … … 121 119 if (is_numeric($page['cat'])) 122 120 { 123 $query = '124 SELECT image_id125 FROM '.IMAGE_CATEGORY_TABLE.'126 INNER JOIN '.IMAGES_TABLE.' ON id = image_id127 WHERE category_id = '.$page['cat'].'128 '.$conf['order_by'].'129 ;';130 131 121 $result = get_cat_info($page['cat']); 132 122 133 123 $page = array_merge( 134 124 $page, … … 143 133 'cat_id_uppercat' => $result['id_uppercat'], 144 134 'uppercats' => $result['uppercats'], 145 135 146 136 'title' => get_cat_display_name($result['name'], '', false), 147 'items' => array_from_query($query, 'image_id'), 148 'thumbnails_include' => 137 ) 138 ); 139 if ( !isset($_GET['calendar']) ) 140 { 141 $query = ' 142 SELECT image_id 143 FROM '.IMAGE_CATEGORY_TABLE.' 144 INNER JOIN '.IMAGES_TABLE.' ON id = image_id 145 WHERE category_id = '.$page['cat'].' 146 '.$conf['order_by'].' 147 ;'; 148 $page['items'] = array_from_query($query, 'image_id'); 149 $page['thumbnails_include'] = 149 150 $result['nb_images'] > 0 150 151 ? 'include/category_default.inc.php' 151 : 'include/category_subcats.inc.php', 152 ) 153 ); 152 : 'include/category_subcats.inc.php'; 153 }//otherwise the calendar will requery all subitems 154 154 } 155 155 // special section … … 256 256 else if ($page['cat'] == 'most_visited') 257 257 { 258 $page['super_order_by'] = true; 259 $conf['order_by'] = ' ORDER BY hit DESC, file ASC'; 258 260 $query = ' 259 261 SELECT DISTINCT(id) … … 261 263 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id 262 264 WHERE hit > 0 263 AND '.$forbidden. '264 ORDER BY hit DESC, file ASC265 AND '.$forbidden. 266 $conf['order_by'].' 265 267 LIMIT 0, '.$conf['top_number'].' 266 268 ;'; … … 276 278 } 277 279 // +-----------------------------------------------------------------------+ 278 // | calendar section |279 // +-----------------------------------------------------------------------+280 else if ($page['cat'] == 'calendar')281 {282 $page['cat_nb_images'] = 0;283 $page['title'] = $lang['calendar'];284 if (isset($_GET['year'])285 and preg_match('/^\d+$/', $_GET['year']))286 {287 $page['calendar_year'] = (int)$_GET['year'];288 }289 if (isset($_GET['month'])290 and preg_match('/^(\d+)\.(\d{2})$/', $_GET['month'], $matches))291 {292 $page['calendar_year'] = (int)$matches[1];293 $page['calendar_month'] = (int)$matches[2];294 }295 if (isset($_GET['day'])296 and preg_match('/^(\d+)\.(\d{2})\.(\d{2})$/',297 $_GET['day'],298 $matches))299 {300 $page['calendar_year'] = (int)$matches[1];301 $page['calendar_month'] = (int)$matches[2];302 $page['calendar_day'] = (int)$matches[3];303 }304 if (isset($page['calendar_year']))305 {306 $page['title'] .= ' (';307 if (isset($page['calendar_day']))308 {309 if ($page['calendar_year'] >= 1970)310 {311 $unixdate = mktime(312 0,313 0,314 0,315 $page['calendar_month'],316 $page['calendar_day'],317 $page['calendar_year']318 );319 $page['title'].= $lang['day'][date("w", $unixdate)];320 }321 $page['title'].= ' '.$page['calendar_day'].', ';322 }323 if (isset($page['calendar_month']))324 {325 $page['title'] .= $lang['month'][$page['calendar_month']].' ';326 }327 $page['title'] .= $page['calendar_year'];328 $page['title'] .= ')';329 }330 331 $page['where'] = 'WHERE '.$conf['calendar_datefield'].' IS NOT NULL';332 if (isset($forbidden))333 {334 $page['where'].= ' AND '.$forbidden;335 }336 337 $page['thumbnails_include'] = 'include/category_calendar.inc.php';338 }339 // +-----------------------------------------------------------------------+340 280 // | best rated section | 341 281 // +-----------------------------------------------------------------------+ 342 282 else if ($page['cat'] == 'best_rated') 343 283 { 284 $page['super_order_by'] = true; 285 $conf['order_by'] = ' ORDER BY average_rate DESC, id ASC'; 286 344 287 $query =' 345 288 SELECT DISTINCT(id) … … 347 290 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id 348 291 WHERE average_rate IS NOT NULL 349 AND '.$forbidden. '350 ORDER BY average_rate DESC, id ASC292 AND '.$forbidden. 293 $conf['order_by'].' 351 294 LIMIT 0, '.$conf['top_number'].' 352 295 ;';
Note: See TracChangeset
for help on using the changeset viewer.