Changeset 23396 for trunk/index.php
- Timestamp:
- Jun 20, 2013, 1:06:38 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r20609 r23396 69 69 } 70 70 } 71 71 72 //-------------------------------------------------------------- initialization 72 73 73 // navigation bar 74 74 $page['navigation_bar'] = array(); … … 108 108 $template->assign('U_CANONICAL', $canonical_url); 109 109 110 //----------------------------------------------------- template initialization 111 // 112 // Start output of page 113 // 110 //-------------------------------------------------------------- page title 114 111 $title = $page['title']; 115 $page['body_id'] = 'theCategoryPage';116 117 $template->set_filenames( array('index'=>'index.tpl') );118 //-------------------------------------------------------------- category title119 112 $template_title = $page['section_title']; 120 113 if (count($page['items']) > 0) … … 124 117 $template->assign('TITLE', $template_title); 125 118 126 if (isset($page['flat']) or isset($page['chronology_field'])) 127 { 128 $template->assign( 129 'U_MODE_NORMAL', 130 duplicate_index_url( array(), array('chronology_field', 'start', 'flat') ) 131 ); 132 } 133 134 if ($conf['index_flat_icon'] and !isset($page['flat']) and 'categories' == $page['section']) 135 { 136 $template->assign( 137 'U_MODE_FLAT', 138 duplicate_index_url(array('flat' => ''), array('start', 'chronology_field')) 139 ); 140 } 141 142 if (!isset($page['chronology_field'])) 143 { 144 $chronology_params = 145 array( 146 'chronology_field' => 'created', 147 'chronology_style' => 'monthly', 148 'chronology_view' => 'list', 149 ); 150 if ($conf['index_created_date_icon']) 151 { 152 $template->assign( 153 'U_MODE_CREATED', 154 duplicate_index_url( $chronology_params, array('start', 'flat') ) 155 ); 156 } 157 if ($conf['index_posted_date_icon']) 158 { 159 $chronology_params['chronology_field'] = 'posted'; 160 $template->assign( 161 'U_MODE_POSTED', 162 duplicate_index_url( $chronology_params, array('start', 'flat') ) 163 ); 164 } 165 } 166 else 167 { 168 if ($page['chronology_field'] == 'created') 169 { 170 $chronology_field = 'posted'; 119 //-------------------------------------------------------------- menubar 120 include( PHPWG_ROOT_PATH.'include/menubar.inc.php'); 121 122 123 // +-----------------------------------------------------------------------+ 124 // | index page (categories, thumbnails, search, calendar, random, etc.) | 125 // +-----------------------------------------------------------------------+ 126 if ( empty($page['is_external']) or !$page['is_external'] ) 127 { 128 //----------------------------------------------------- template initialization 129 $page['body_id'] = 'theCategoryPage'; 130 131 $template->set_filename('index', 'index.tpl'); 132 133 if (isset($page['flat']) or isset($page['chronology_field'])) 134 { 135 $template->assign( 136 'U_MODE_NORMAL', 137 duplicate_index_url( array(), array('chronology_field', 'start', 'flat') ) 138 ); 139 } 140 141 if ($conf['index_flat_icon'] and !isset($page['flat']) and 'categories' == $page['section']) 142 { 143 $template->assign( 144 'U_MODE_FLAT', 145 duplicate_index_url(array('flat' => ''), array('start', 'chronology_field')) 146 ); 147 } 148 149 if (!isset($page['chronology_field'])) 150 { 151 $chronology_params = array( 152 'chronology_field' => 'created', 153 'chronology_style' => 'monthly', 154 'chronology_view' => 'list', 155 ); 156 if ($conf['index_created_date_icon']) 157 { 158 $template->assign( 159 'U_MODE_CREATED', 160 duplicate_index_url( $chronology_params, array('start', 'flat') ) 161 ); 162 } 163 if ($conf['index_posted_date_icon']) 164 { 165 $chronology_params['chronology_field'] = 'posted'; 166 $template->assign( 167 'U_MODE_POSTED', 168 duplicate_index_url( $chronology_params, array('start', 'flat') ) 169 ); 170 } 171 171 } 172 172 else 173 173 { 174 $chronology_field = 'created'; 175 } 176 if ($conf['index_'.$chronology_field.'_date_icon']) 177 { 178 $url = duplicate_index_url( 179 array('chronology_field'=>$chronology_field ), 180 array('chronology_date', 'start', 'flat') 181 ); 182 $template->assign( 183 'U_MODE_'.strtoupper($chronology_field), 184 $url 185 ); 186 } 187 } 188 189 if ('search' == $page['section']) 190 { 191 $template->assign( 192 'U_SEARCH_RULES', 193 get_root_url().'search_rules.php?search_id='.$page['search'] 194 ); 195 } 196 197 if (isset($page['category']) and is_admin()) 198 { 199 $template->assign( 200 'U_EDIT', 201 get_root_url().'admin.php?page=album-'.$page['category']['id'] 202 ); 203 } 204 205 if (is_admin() and !empty($page['items'])) 206 { 207 $template->assign( 208 'U_CADDIE', 209 add_url_params(duplicate_index_url(), array('caddie'=>1) ) 210 ); 211 } 212 213 if ( $page['section']=='search' and $page['start']==0 and 214 !isset($page['chronology_field']) and isset($page['qsearch_details']) ) 215 { 216 $template->assign('QUERY_SEARCH', 217 htmlspecialchars($page['qsearch_details']['q']) ); 218 219 $cats = array_merge( 220 (array)@$page['qsearch_details']['matching_cats_no_images'], 221 (array)@$page['qsearch_details']['matching_cats'] ); 222 if (count($cats)) 223 { 224 usort($cats, 'name_compare'); 225 $hints = array(); 226 foreach ( $cats as $cat ) 227 { 228 $hints[] = get_cat_display_name( array($cat), '', false ); 229 } 230 $template->assign( 'category_search_results', $hints); 231 } 232 233 $tags = (array)@$page['qsearch_details']['matching_tags']; 234 foreach ( $tags as $tag ) 235 { 236 $tag['URL'] = make_index_url(array('tags'=>array($tag))); 237 $template->append( 'tag_search_results', $tag); 238 } 239 } 240 241 242 if ( $conf['index_sort_order_input'] 243 and count($page['items']) > 0 244 and $page['section'] != 'most_visited' 245 and $page['section'] != 'best_rated') 246 { 247 // image order 248 $order_idx = pwg_get_session_var( 'image_order', 0 ); 249 250 $url = add_url_params( 251 duplicate_index_url(), 252 array('image_order' => '') 174 if ($page['chronology_field'] == 'created') 175 { 176 $chronology_field = 'posted'; 177 } 178 else 179 { 180 $chronology_field = 'created'; 181 } 182 if ($conf['index_'.$chronology_field.'_date_icon']) 183 { 184 $url = duplicate_index_url( 185 array('chronology_field'=>$chronology_field ), 186 array('chronology_date', 'start', 'flat') 187 ); 188 $template->assign( 189 'U_MODE_'.strtoupper($chronology_field), 190 $url 253 191 ); 254 foreach (get_category_preferred_image_orders() as $order_id => $order) 255 { 256 if ($order[2]) 192 } 193 } 194 195 if ('search' == $page['section']) 196 { 197 $template->assign( 198 'U_SEARCH_RULES', 199 get_root_url().'search_rules.php?search_id='.$page['search'] 200 ); 201 } 202 203 if (isset($page['category']) and is_admin()) 204 { 205 $template->assign( 206 'U_EDIT', 207 get_root_url().'admin.php?page=album-'.$page['category']['id'] 208 ); 209 } 210 211 if (is_admin() and !empty($page['items'])) 212 { 213 $template->assign( 214 'U_CADDIE', 215 add_url_params(duplicate_index_url(), array('caddie'=>1) ) 216 ); 217 } 218 219 if ( $page['section']=='search' and $page['start']==0 and 220 !isset($page['chronology_field']) and isset($page['qsearch_details']) ) 221 { 222 $template->assign('QUERY_SEARCH', 223 htmlspecialchars($page['qsearch_details']['q']) ); 224 225 $cats = array_merge( 226 (array)@$page['qsearch_details']['matching_cats_no_images'], 227 (array)@$page['qsearch_details']['matching_cats'] ); 228 if (count($cats)) 229 { 230 usort($cats, 'name_compare'); 231 $hints = array(); 232 foreach ( $cats as $cat ) 233 { 234 $hints[] = get_cat_display_name( array($cat), '', false ); 235 } 236 $template->assign( 'category_search_results', $hints); 237 } 238 239 $tags = (array)@$page['qsearch_details']['matching_tags']; 240 foreach ( $tags as $tag ) 241 { 242 $tag['URL'] = make_index_url(array('tags'=>array($tag))); 243 $template->append( 'tag_search_results', $tag); 244 } 245 } 246 247 248 if ( $conf['index_sort_order_input'] 249 and count($page['items']) > 0 250 and $page['section'] != 'most_visited' 251 and $page['section'] != 'best_rated') 252 { 253 // image order 254 $order_idx = pwg_get_session_var( 'image_order', 0 ); 255 256 $url = add_url_params( 257 duplicate_index_url(), 258 array('image_order' => '') 259 ); 260 foreach (get_category_preferred_image_orders() as $order_id => $order) 261 { 262 if ($order[2]) 263 { 264 $template->append( 265 'image_orders', 266 array( 267 'DISPLAY' => $order[0], 268 'URL' => $url.$order_id, 269 'SELECTED' => ($order_idx == $order_id ? true:false), 270 ) 271 ); 272 } 273 } 274 } 275 276 // category comment 277 if ($page['start']==0 and !isset($page['chronology_field']) and !empty($page['comment']) ) 278 { 279 $template->assign('CONTENT_DESCRIPTION', $page['comment'] ); 280 } 281 282 if ( isset($page['category']['count_categories']) and $page['category']['count_categories']==0 ) 283 {// count_categories might be computed by menubar - if the case unassign flat link if no sub albums 284 $template->clear_assign('U_MODE_FLAT'); 285 } 286 287 //------------------------------------------------------ main part : thumbnails 288 if ( 0==$page['start'] 289 and !isset($page['flat']) 290 and !isset($page['chronology_field']) 291 and ('recent_cats'==$page['section'] or 'categories'==$page['section']) 292 and (!isset($page['category']['count_categories']) or $page['category']['count_categories']>0 ) 293 ) 294 { 295 include(PHPWG_ROOT_PATH.'include/category_cats.inc.php'); 296 } 297 298 if ( !empty($page['items']) ) 299 { 300 include(PHPWG_ROOT_PATH.'include/category_default.inc.php'); 301 $url = add_url_params( 302 duplicate_index_url(), 303 array('display' => '') 304 ); 305 306 $selected_type = $template->get_template_vars('derivative_params')->type; 307 $template->clear_assign( 'derivative_params' ); 308 $type_map = ImageStdParams::get_defined_type_map(); 309 unset($type_map[IMG_XXLARGE], $type_map[IMG_XLARGE]); 310 311 foreach($type_map as $params) 257 312 { 258 313 $template->append( 259 'image_ orders',314 'image_derivatives', 260 315 array( 261 'DISPLAY' => $order[0],262 'URL' => $url.$ order_id,263 'SELECTED' => ($ order_idx == $order_id? true:false),316 'DISPLAY' => l10n($params->type), 317 'URL' => $url.$params->type, 318 'SELECTED' => ($params->type == $selected_type ? true:false), 264 319 ) 265 320 ); 266 321 } 267 322 } 268 } 269 270 // category comment 271 if ($page['start']==0 and !isset($page['chronology_field']) and !empty($page['comment']) ) 272 { 273 $template->assign('CONTENT_DESCRIPTION', $page['comment'] ); 274 } 275 276 // include menubar 277 include( PHPWG_ROOT_PATH.'include/menubar.inc.php'); 278 279 if ( isset($page['category']['count_categories']) and $page['category']['count_categories']==0 ) 280 {// count_categories might be computed by menubar - if the case unassign flat link if no sub albums 281 $template->clear_assign('U_MODE_FLAT'); 282 } 283 284 //------------------------------------------------------ main part : thumbnails 285 if ( 0==$page['start'] 286 and !isset($page['flat']) 287 and !isset($page['chronology_field']) 288 and ('recent_cats'==$page['section'] or 'categories'==$page['section']) 289 and (!isset($page['category']['count_categories']) or $page['category']['count_categories']>0 ) 290 ) 291 { 292 include(PHPWG_ROOT_PATH.'include/category_cats.inc.php'); 293 } 294 295 if ( !empty($page['items']) ) 296 { 297 include(PHPWG_ROOT_PATH.'include/category_default.inc.php'); 298 $url = add_url_params( 299 duplicate_index_url(), 300 array('display' => '') 301 ); 302 $selected_type = $template->get_template_vars('derivative_params')->type; 303 $template->clear_assign( 'derivative_params' ); 304 $type_map = ImageStdParams::get_defined_type_map(); 305 unset($type_map[IMG_XXLARGE], $type_map[IMG_XLARGE]); 306 foreach($type_map as $params) 307 { 308 $template->append( 309 'image_derivatives', 310 array( 311 'DISPLAY' => l10n($params->type), 312 'URL' => $url.$params->type, 313 'SELECTED' => ($params->type == $selected_type ? true:false), 314 ) 315 ); 316 } 317 } 318 //------------------------------------------------------- category informations 319 320 // slideshow 321 // execute after init thumbs in order to have all picture informations 322 if (!empty($page['cat_slideshow_url'])) 323 { 324 if (isset($_GET['slideshow'])) 325 { 326 redirect($page['cat_slideshow_url']); 327 } 328 elseif ($conf['index_slideshow_icon']) 329 { 330 $template->assign('U_SLIDESHOW', $page['cat_slideshow_url']); 331 } 332 } 333 323 324 // slideshow 325 // execute after init thumbs in order to have all picture informations 326 if (!empty($page['cat_slideshow_url'])) 327 { 328 if (isset($_GET['slideshow'])) 329 { 330 redirect($page['cat_slideshow_url']); 331 } 332 elseif ($conf['index_slideshow_icon']) 333 { 334 $template->assign('U_SLIDESHOW', $page['cat_slideshow_url']); 335 } 336 } 337 } 338 // +-----------------------------------------------------------------------+ 339 // | other pages (added by plugins) | 340 // +-----------------------------------------------------------------------+ 341 else 342 { 343 $template->set_filename('index', 'common_page.tpl'); 344 } 345 346 //------------------------------------------------------------ end 334 347 include(PHPWG_ROOT_PATH.'include/page_header.php'); 335 348 trigger_action('loc_end_index'); … … 337 350 $template->parse_index_buttons(); 338 351 $template->pparse('index'); 352 339 353 //------------------------------------------------------------ log informations 340 354 pwg_log();
Note: See TracChangeset
for help on using the changeset viewer.