Changeset 32184 for extensions
- Timestamp:
- May 6, 2020, 11:50:47 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/photos_from_one_year_ago/main.inc.php
r32155 r32184 62 62 global $tokens, $page, $conf,$template; 63 63 $template->assign('PFOAYALINK',make_index_url(array('section' => 'photos_from_one_year_ago'))); 64 65 $datepfoya = (isset($conf['pfoya_dateb'])) ? $conf['pfoya_dateb'] : "date_available"; 66 $daydate= (isset($conf['pfoya_date'])) ? $conf['pfoya_date'] : date("Y-m-d", strtotime('-1 year')); 67 64 68 if (!in_array('photos_from_one_year_ago', $tokens)) 65 69 { … … 74 78 75 79 $query = ' 76 SELECT DISTINCT image_id 77 FROM ' . IMAGE_CATEGORY_TABLE . ' 80 SELECT DISTINCT(i.id) 81 FROM '.IMAGES_TABLE.' AS i 82 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON i.id = ic.image_id 83 INNER JOIN '.CATEGORIES_TABLE.' AS c ON ic.category_id = c.id 78 84 WHERE ' . 79 85 get_sql_condition_FandF( … … 84 90 ), 85 91 '', true 86 ) 87 . ' 88 ;'; 89 90 $img = query2array($query, null, 'image_id'); 91 92 if (empty($img)) 93 { 94 $page['items'] = array(); 95 } 96 else 97 { 98 $datepfoya = (isset($conf['pfoya_dateb'])) ? $conf['pfoya_dateb'] : "date_available"; 99 $daydate= (isset($conf['pfoya_date'])) ? $conf['pfoya_date'] : date("Y-m-d", strtotime('-1 year')); 100 $query = 'SELECT id,date_available FROM ' . IMAGES_TABLE . ' AS img WHERE img.id IN (' . implode(',', $img) . ') and DATE('.$datepfoya.') ="'.$daydate.'"'; 92 ); 93 $query .= ' 94 and DATE ('.$datepfoya.') ="'.$daydate.'";'; 95 101 96 $page['items'] = query2array($query, null, 'id'); 102 103 add_event_handler('loc_end_index_thumbnails', 'add_nb_pfoya');104 }105 106 function add_nb_pfoya($tpl_thumbnails_var){107 global $template, $user, $selection;108 109 // unsed sort order110 $template->clear_assign('image_orders');111 112 $query = 'SELECT id, date_available FROM '.IMAGES_TABLE.' WHERE id IN ('.implode(',', $selection).');';113 $nb_download = query2array($query, 'id', 'date_available');114 115 foreach ($tpl_thumbnails_var as &$row)116 {117 $row['date_available'] = $nb_download[$row['id']];118 }119 unset($row);120 121 122 return $tpl_thumbnails_var;123 }124 97 125 98 }
Note: See TracChangeset
for help on using the changeset viewer.