Changeset 32191 for extensions
- Timestamp:
- May 9, 2020, 3:57:19 AM (4 years ago)
- Location:
- extensions/photos_from_one_year_ago
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/photos_from_one_year_ago/language/en_UK/plugin.lang.php
r32155 r32191 23 23 $lang['more photos'] = 'more photos'; 24 24 $lang['Display X photos from one year ago in the gallery or a album'] = 'Display X photos from one year ago in the gallery or a album'; 25 25 $lang['Photos from %d years ago'] = 'Photos from %d years ago'; 26 $lang['Photos from %d'] = 'Photos from %d'; 27 $lang['Photos from'] = 'Photos from'; -
extensions/photos_from_one_year_ago/language/fr_FR/plugin.lang.php
r32155 r32191 24 24 $lang['more photos'] = 'plus de photos'; 25 25 $lang['Display X photos from one year ago in the gallery or a album'] = 'Afficher les X photos d\'il y a 1 ans de la galerie ou de l\'album'; 26 $lang['Photos from %d years ago'] = 'Photos d\'il y a %d ans'; 27 $lang['Photos from %d'] = 'Photos du %d'; 28 $lang['Photos from'] = 'Photos du'; -
extensions/photos_from_one_year_ago/main.inc.php
r32184 r32191 38 38 } 39 39 40 add_event_handler('blockmanager_apply' , 'add_link_pfoya'); 41 add_event_handler('loc_end_section_init', 'section_init_pfoya'); 42 43 function add_link_pfoya($menu_ref_arr){ 44 global $conf; 45 $menu = &$menu_ref_arr[0]; 46 $position = (isset($conf['pfoya_position']) and is_numeric($conf['pfoya_position'])) ? $conf['pfoya_position'] : 5; 47 if (($block = $menu->get_block('mbSpecials')) != null){ 48 array_splice($block->data, $position-1, 0, 49 array('photos_from_one_year_ago' => 50 array( 51 'URL' => make_index_url(array('section' => 'photos_from_one_year_ago')), 52 'TITLE' => l10n('Displays photos from one year ago'), 53 'NAME' => l10n('Photos from one year ago') 54 ) 55 ) 56 ); 57 } 58 } 40 59 41 add_event_handler('blockmanager_apply' , 'add_link_pfoya'); 42 add_event_handler('loc_end_section_init', 'section_init_pfoya'); 43 44 function add_link_pfoya($menu_ref_arr){ 45 global $conf; 46 $menu = &$menu_ref_arr[0]; 47 $position = (isset($conf['pfoya_position']) and is_numeric($conf['pfoya_position'])) ? $conf['pfoya_position'] : 5; 48 if (($block = $menu->get_block('mbSpecials')) != null){ 49 array_splice($block->data, $position-1, 0, array('photos_from_one_year_ago' => 50 array( 51 'URL' => make_index_url(array('section' => 'photos_from_one_year_ago')), 52 'TITLE' => l10n('Displays photos from one year ago'), 53 'NAME' => l10n('Photos from one year ago') 54 ) 55 ) 56 ); 57 } 58 } 60 function section_init_pfoya(){ 61 global $tokens, $page, $conf, $template; 62 $testurl = explode('photos_from_', $_SERVER['REQUEST_URI']); 63 if(!empty($testurl[1])){ 59 64 60 function section_init_pfoya() 61 { 62 global $tokens, $page, $conf,$template; 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 68 if (!in_array('photos_from_one_year_ago', $tokens)) 69 { 70 return; 71 } 72 73 74 $page['section'] = 'photos_from_one_year_ago'; 75 $page['title'] = '<a href="' . duplicate_index_url() . '">' . l10n('Photos from one year ago') . '</a>'; 76 $page['section_title'] = '<a href="'.get_gallery_home_url().'">' . l10n('Home') . '</a>' 77 . $conf['level_separator'] . $page['title']; 65 $datepfoya = (isset($conf['pfoya_dateb'])) ? $conf['pfoya_dateb'] : "date_available"; 66 $daydatemax= (isset($conf['pfoya_datemax'])) ? $conf['pfoya_datemax'] : 5; 78 67 79 $query = ' 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 84 WHERE ' . 85 get_sql_condition_FandF( 86 array( 87 'forbidden_categories' => 'category_id', 88 'visible_categories' => 'category_id', 89 'visible_images' => 'image_id', 90 ), 91 '', true 92 ); 93 $query .= ' 94 and DATE ('.$datepfoya.') ="'.$daydate.'";'; 95 96 $page['items'] = query2array($query, null, 'id'); 97 68 if($daydatemax>1)$template->assign('pfoya','a'); 69 70 for ($i = 1; $i <= $daydatemax; $i++) { 71 $daydate=date("Y-m-d", strtotime('-'.$i.' year')); 72 $query = ' 73 SELECT COUNT(DISTINCT(i.id)) as count 74 FROM '.IMAGES_TABLE.' AS i 75 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON i.id = ic.image_id 76 INNER JOIN '.CATEGORIES_TABLE.' AS c ON ic.category_id = c.id 77 WHERE ' . 78 get_sql_condition_FandF( 79 array( 80 'forbidden_categories' => 'category_id', 81 'visible_categories' => 'category_id', 82 'visible_images' => 'image_id', 83 ), 84 '', true 85 ); 86 $query .= ' 87 and DATE ('.$datepfoya.') ="'.$daydate.'";'; 88 89 $row = pwg_db_fetch_assoc(pwg_query($query)); 90 91 if ($i == 1){ 92 $items = array( 93 'NB_IMAGES' => $row['count'], 94 'URL' => make_index_url(array('section' => 'photos_from_one_year_ago')), 95 'LABEL' => l10n('Photos from one year ago'), 96 ); 97 $template->append('pfoyas', $items); 98 }else{ 99 $items = array( 100 'NB_IMAGES' => $row['count'], 101 'URL' => make_index_url(array('section' => 'photos_from_'.$i.'_year_ago')), 102 'LABEL' => l10n('Photos from %d years ago',$i), 103 ); 104 $template->append('pfoyas', $items); 105 } 106 } 107 if($testurl[1]=='one_year_ago'){ 108 if (!in_array('photos_from_one_year_ago', $tokens)){return;} 109 $daydate=date("Y-m-d", strtotime('-1 year')); 110 $query = ' 111 SELECT DISTINCT(i.id) 112 FROM '.IMAGES_TABLE.' AS i 113 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON i.id = ic.image_id 114 INNER JOIN '.CATEGORIES_TABLE.' AS c ON ic.category_id = c.id 115 WHERE ' . 116 get_sql_condition_FandF( 117 array( 118 'forbidden_categories' => 'category_id', 119 'visible_categories' => 'category_id', 120 'visible_images' => 'image_id', 121 ), 122 '', true 123 ); 124 $query .= ' 125 and DATE ('.$datepfoya.') ="'.$daydate.'";'; 126 $page['section'] = 'photos_from_one_year_ago'; 127 $page['title'] = '<a href="' . duplicate_index_url() . '">' . l10n('Photos from one year ago') . '</a>'; 128 $page['section_title'] = '<a href="'.get_gallery_home_url().'">' . l10n('Home') . '</a>' 129 . $conf['level_separator'] . $page['title']; 130 $page['items'] = query2array($query, null, 'id'); 131 $template->assign('pfoyadata',l10n('Photos from').' '.format_date($daydate)); 132 133 }else{ 134 $yurl=explode('_year_ago', $testurl[1]); 135 $yurl=$yurl[0]; 136 if (!in_array('photos_from_'.$yurl.'_year_ago', $tokens)){return;} 137 $daydate=date("Y-m-d", strtotime('-'.$yurl.' year')); 138 $query = ' 139 SELECT DISTINCT(i.id) 140 FROM '.IMAGES_TABLE.' AS i 141 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON i.id = ic.image_id 142 INNER JOIN '.CATEGORIES_TABLE.' AS c ON ic.category_id = c.id 143 WHERE ' . 144 get_sql_condition_FandF( 145 array( 146 'forbidden_categories' => 'category_id', 147 'visible_categories' => 'category_id', 148 'visible_images' => 'image_id', 149 ), 150 '', true 151 ); 152 $query .= ' 153 and DATE ('.$datepfoya.') ="'.$daydate.'";'; 154 $page['section'] = 'photos_from_'.$yurl.'_year_ago'; 155 $page['title'] = '<a href="' . duplicate_index_url() . '">' . l10n('Photos from %d years ago',$yurl) . '</a>'; 156 $page['section_title'] = '<a href="'.get_gallery_home_url().'">' . l10n('Home') . '</a>' 157 . $conf['level_separator'] . $page['title']; 158 $page['items'] =query2array($query, null, 'id'); 159 $template->assign('pfoyadata',l10n('Photos from').' '.format_date($daydate)); 160 } 161 162 163 } 164 165 $template->set_filename('PFOYA', realpath(PFOYA_PATH . 'pfoya.tpl')); 166 $template->assign_var_from_handle('CONTENT', 'PFOYA'); 167 98 168 } 99 169
Note: See TracChangeset
for help on using the changeset viewer.