[21] | 1 | <?php |
---|
[362] | 2 | // +-----------------------------------------------------------------------+ |
---|
[8728] | 3 | // | Piwigo - a PHP based photo gallery | |
---|
[2297] | 4 | // +-----------------------------------------------------------------------+ |
---|
[8728] | 5 | // | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org | |
---|
[2297] | 6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
| 7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
| 8 | // +-----------------------------------------------------------------------+ |
---|
| 9 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 10 | // | it under the terms of the GNU General Public License as published by | |
---|
| 11 | // | the Free Software Foundation | |
---|
| 12 | // | | |
---|
| 13 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 16 | // | General Public License for more details. | |
---|
| 17 | // | | |
---|
| 18 | // | You should have received a copy of the GNU General Public License | |
---|
| 19 | // | along with this program; if not, write to the Free Software | |
---|
| 20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 21 | // | USA. | |
---|
| 22 | // +-----------------------------------------------------------------------+ |
---|
[21] | 23 | |
---|
[632] | 24 | if (!defined('PHPWG_ROOT_PATH')) |
---|
[403] | 25 | { |
---|
[632] | 26 | die('Hacking attempt!'); |
---|
[403] | 27 | } |
---|
[1072] | 28 | |
---|
[1895] | 29 | include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); |
---|
[1072] | 30 | |
---|
| 31 | // +-----------------------------------------------------------------------+ |
---|
| 32 | // | Check Access and exit when user status is not ok | |
---|
| 33 | // +-----------------------------------------------------------------------+ |
---|
| 34 | check_status(ACCESS_ADMINISTRATOR); |
---|
| 35 | |
---|
[5933] | 36 | trigger_action('loc_begin_cat_modify'); |
---|
| 37 | |
---|
[21] | 38 | //---------------------------------------------------------------- verification |
---|
[403] | 39 | if ( !isset( $_GET['cat_id'] ) || !is_numeric( $_GET['cat_id'] ) ) |
---|
[21] | 40 | { |
---|
[2490] | 41 | trigger_error( 'missing cat_id param', E_USER_ERROR); |
---|
[21] | 42 | } |
---|
[403] | 43 | |
---|
[21] | 44 | //--------------------------------------------------------- form criteria check |
---|
[825] | 45 | if (isset($_POST['submit'])) |
---|
[21] | 46 | { |
---|
[825] | 47 | $data = |
---|
| 48 | array( |
---|
| 49 | 'id' => $_GET['cat_id'], |
---|
| 50 | 'name' => @$_POST['name'], |
---|
[4367] | 51 | 'commentable' => isset($_POST['commentable'])?$_POST['commentable']:'false', |
---|
[825] | 52 | 'comment' => |
---|
| 53 | $conf['allow_html_descriptions'] ? |
---|
[2490] | 54 | @$_POST['comment'] : strip_tags(@$_POST['comment']), |
---|
[825] | 55 | ); |
---|
[38] | 56 | |
---|
[825] | 57 | mass_updates( |
---|
| 58 | CATEGORIES_TABLE, |
---|
| 59 | array( |
---|
| 60 | 'primary' => array('id'), |
---|
| 61 | 'update' => array_diff(array_keys($data), array('id')) |
---|
| 62 | ), |
---|
| 63 | array($data) |
---|
| 64 | ); |
---|
[1131] | 65 | |
---|
[2490] | 66 | // retrieve cat infos before continuing (following updates are expensive) |
---|
| 67 | $cat_info = get_cat_info($_GET['cat_id']); |
---|
[345] | 68 | |
---|
[2490] | 69 | if ($cat_info['visible'] != get_boolean( $_POST['visible'] ) ) |
---|
[1500] | 70 | { |
---|
[2490] | 71 | set_cat_visible(array($_GET['cat_id']), $_POST['visible']); |
---|
[1500] | 72 | } |
---|
[2653] | 73 | if ($cat_info['status'] != $_POST['status'] ) |
---|
[1500] | 74 | { |
---|
[2490] | 75 | set_cat_status(array($_GET['cat_id']), $_POST['status']); |
---|
[1500] | 76 | } |
---|
[2490] | 77 | |
---|
[12576] | 78 | // in case the use moves his album to the gallery root, we force |
---|
| 79 | // $_POST['parent'] from 0 to null to be compared with |
---|
| 80 | // $cat_info['id_uppercat'] |
---|
| 81 | if (empty($_POST['parent'])) |
---|
[1500] | 82 | { |
---|
[12576] | 83 | $_POST['parent'] = null; |
---|
| 84 | } |
---|
[12591] | 85 | |
---|
| 86 | // only move virtual albums |
---|
| 87 | if (empty($cat_info['dir']) and $cat_info['id_uppercat'] != $_POST['parent']) |
---|
[12576] | 88 | { |
---|
[2490] | 89 | move_categories( array($_GET['cat_id']), $_POST['parent'] ); |
---|
[1500] | 90 | } |
---|
| 91 | |
---|
[6988] | 92 | array_push($page['infos'], l10n('Album updated successfully')); |
---|
[21] | 93 | } |
---|
[2490] | 94 | elseif (isset($_POST['set_random_representant'])) |
---|
[633] | 95 | { |
---|
| 96 | set_random_representant(array($_GET['cat_id'])); |
---|
| 97 | } |
---|
[2490] | 98 | elseif (isset($_POST['delete_representant'])) |
---|
[809] | 99 | { |
---|
| 100 | $query = ' |
---|
| 101 | UPDATE '.CATEGORIES_TABLE.' |
---|
| 102 | SET representative_picture_id = NULL |
---|
| 103 | WHERE id = '.$_GET['cat_id'].' |
---|
| 104 | ;'; |
---|
| 105 | pwg_query($query); |
---|
| 106 | } |
---|
[2490] | 107 | elseif (isset($_POST['submitAdd'])) |
---|
[1064] | 108 | { |
---|
| 109 | $output_create = create_virtual_category( |
---|
| 110 | $_POST['virtual_name'], |
---|
| 111 | (0 == $_POST['parent'] ? null : $_POST['parent']) |
---|
| 112 | ); |
---|
[1131] | 113 | |
---|
[1064] | 114 | if (isset($output_create['error'])) |
---|
| 115 | { |
---|
| 116 | array_push($page['errors'], $output_create['error']); |
---|
| 117 | } |
---|
| 118 | else |
---|
| 119 | { |
---|
[6969] | 120 | // Virtual album creation succeeded |
---|
[1064] | 121 | // |
---|
| 122 | // Add the information in the information list |
---|
| 123 | array_push($page['infos'], $output_create['info']); |
---|
[1131] | 124 | |
---|
[1064] | 125 | // Link the new category to the current category |
---|
[1121] | 126 | associate_categories_to_categories( |
---|
| 127 | array($_GET['cat_id']), |
---|
| 128 | array($output_create['id']) |
---|
| 129 | ); |
---|
[21] | 130 | |
---|
[1121] | 131 | // information |
---|
[1064] | 132 | array_push( |
---|
[1121] | 133 | $page['infos'], |
---|
| 134 | sprintf( |
---|
[8727] | 135 | l10n('Album photos associated to the following albums: %s'), |
---|
[1121] | 136 | '<ul><li>' |
---|
| 137 | .get_cat_display_name_from_id($output_create['id']) |
---|
| 138 | .'</li></ul>' |
---|
[1064] | 139 | ) |
---|
| 140 | ); |
---|
| 141 | } |
---|
| 142 | } |
---|
[2490] | 143 | elseif (isset($_POST['submitDestinations']) |
---|
[1121] | 144 | and isset($_POST['destinations']) |
---|
| 145 | and count($_POST['destinations']) > 0) |
---|
[1064] | 146 | { |
---|
[1121] | 147 | associate_categories_to_categories( |
---|
| 148 | array($_GET['cat_id']), |
---|
| 149 | $_POST['destinations'] |
---|
| 150 | ); |
---|
[1064] | 151 | |
---|
[1121] | 152 | $category_names = array(); |
---|
| 153 | foreach ($_POST['destinations'] as $category_id) |
---|
[1064] | 154 | { |
---|
| 155 | array_push( |
---|
[1121] | 156 | $category_names, |
---|
| 157 | get_cat_display_name_from_id($category_id) |
---|
[1064] | 158 | ); |
---|
| 159 | } |
---|
| 160 | |
---|
[1121] | 161 | array_push( |
---|
| 162 | $page['infos'], |
---|
| 163 | sprintf( |
---|
[8727] | 164 | l10n('Album photos associated to the following albums: %s'), |
---|
[1121] | 165 | '<ul><li>'.implode('</li><li>', $category_names).'</li></ul>' |
---|
| 166 | ) |
---|
[1064] | 167 | ); |
---|
| 168 | } |
---|
| 169 | |
---|
[632] | 170 | $query = ' |
---|
| 171 | SELECT * |
---|
| 172 | FROM '.CATEGORIES_TABLE.' |
---|
| 173 | WHERE id = '.$_GET['cat_id'].' |
---|
| 174 | ;'; |
---|
[4325] | 175 | $category = pwg_db_fetch_assoc( pwg_query( $query ) ); |
---|
[530] | 176 | // nullable fields |
---|
[809] | 177 | foreach (array('comment','dir','site_id', 'id_uppercat') as $nullable) |
---|
[530] | 178 | { |
---|
| 179 | if (!isset($category[$nullable])) |
---|
| 180 | { |
---|
| 181 | $category[$nullable] = ''; |
---|
| 182 | } |
---|
| 183 | } |
---|
[345] | 184 | |
---|
[809] | 185 | $category['is_virtual'] = empty($category['dir']) ? true : false; |
---|
| 186 | |
---|
[2324] | 187 | $query = 'SELECT DISTINCT category_id |
---|
| 188 | FROM '.IMAGE_CATEGORY_TABLE.' |
---|
| 189 | WHERE category_id = '.$_GET['cat_id'].' |
---|
| 190 | LIMIT 1'; |
---|
| 191 | $result = pwg_query($query); |
---|
[4325] | 192 | $category['has_images'] = pwg_db_num_rows($result)>0 ? true : false; |
---|
[2223] | 193 | |
---|
[403] | 194 | // Navigation path |
---|
[834] | 195 | $navigation = get_cat_display_name_cache( |
---|
[635] | 196 | $category['uppercats'], |
---|
[2286] | 197 | get_root_url().'admin.php?page=cat_modify&cat_id=' |
---|
[834] | 198 | ); |
---|
[345] | 199 | |
---|
[2286] | 200 | $form_action = get_root_url().'admin.php?page=cat_modify&cat_id='.$_GET['cat_id']; |
---|
[403] | 201 | |
---|
| 202 | //----------------------------------------------------- template initialization |
---|
[2530] | 203 | $template->set_filename( 'categories', 'cat_modify.tpl'); |
---|
[809] | 204 | |
---|
[2286] | 205 | $base_url = get_root_url().'admin.php?page='; |
---|
[809] | 206 | $cat_list_url = $base_url.'cat_list'; |
---|
[1131] | 207 | |
---|
[809] | 208 | $self_url = $cat_list_url; |
---|
| 209 | if (!empty($category['id_uppercat'])) |
---|
| 210 | { |
---|
| 211 | $self_url.= '&parent_id='.$category['id_uppercat']; |
---|
| 212 | } |
---|
| 213 | |
---|
[2223] | 214 | $template->assign( |
---|
[1131] | 215 | array( |
---|
[1082] | 216 | 'CATEGORIES_NAV' => $navigation, |
---|
[2777] | 217 | 'CAT_ID' => $category['id'], |
---|
[2223] | 218 | 'CAT_NAME' => @htmlspecialchars($category['name']), |
---|
| 219 | 'CAT_COMMENT' => @htmlspecialchars($category['comment']), |
---|
[1131] | 220 | |
---|
[2223] | 221 | 'status_values' => array('public','private'), |
---|
[1131] | 222 | |
---|
[2223] | 223 | 'CAT_STATUS' => $category['status'], |
---|
[4385] | 224 | 'CAT_VISIBLE' => boolean_to_string($category['visible']), |
---|
| 225 | 'CAT_COMMENTABLE' => boolean_to_string($category['commentable']), |
---|
[2223] | 226 | |
---|
[1082] | 227 | 'U_JUMPTO' => make_index_url( |
---|
| 228 | array( |
---|
[1861] | 229 | 'category' => $category |
---|
[1082] | 230 | ) |
---|
| 231 | ), |
---|
[1131] | 232 | |
---|
[1916] | 233 | 'MAIL_CONTENT' => empty($_POST['mail_content']) |
---|
| 234 | ? '' : stripslashes($_POST['mail_content']), |
---|
[1082] | 235 | 'U_CHILDREN' => $cat_list_url.'&parent_id='.$category['id'], |
---|
[5920] | 236 | 'U_HELP' => get_root_url().'admin/popuphelp.php?page=cat_modify', |
---|
[1131] | 237 | |
---|
[1082] | 238 | 'F_ACTION' => $form_action, |
---|
| 239 | ) |
---|
| 240 | ); |
---|
[633] | 241 | |
---|
[809] | 242 | |
---|
| 243 | if ('private' == $category['status']) |
---|
| 244 | { |
---|
[2223] | 245 | $template->assign( 'U_MANAGE_PERMISSIONS', |
---|
| 246 | $base_url.'cat_perm&cat='.$category['id'] |
---|
[809] | 247 | ); |
---|
| 248 | } |
---|
| 249 | |
---|
[6988] | 250 | // manage album elements link |
---|
[2324] | 251 | if ($category['has_images']) |
---|
[633] | 252 | { |
---|
[2517] | 253 | $template->assign( |
---|
| 254 | 'U_MANAGE_ELEMENTS', |
---|
[8417] | 255 | $base_url.'batch_manager&cat='.$category['id'] |
---|
[2223] | 256 | ); |
---|
| 257 | } |
---|
| 258 | |
---|
[9051] | 259 | $template->assign( |
---|
| 260 | 'U_MANAGE_RANKS', |
---|
| 261 | $base_url.'element_set_ranks&cat_id='.$category['id'] |
---|
| 262 | ); |
---|
| 263 | |
---|
[2223] | 264 | if ($category['is_virtual']) |
---|
| 265 | { |
---|
| 266 | $template->assign( |
---|
[809] | 267 | array( |
---|
[5335] | 268 | 'U_DELETE' => $self_url.'&delete='.$category['id'].'&pwg_token='.get_pwg_token(), |
---|
[809] | 269 | ) |
---|
| 270 | ); |
---|
| 271 | } |
---|
[2223] | 272 | else |
---|
[1500] | 273 | { |
---|
[2223] | 274 | $category['cat_full_dir'] = get_complete_dir($_GET['cat_id']); |
---|
| 275 | $template->assign( |
---|
| 276 | array( |
---|
| 277 | 'CAT_FULL_DIR' => preg_replace('/\/$/', |
---|
| 278 | '', |
---|
| 279 | $category['cat_full_dir'] ) |
---|
| 280 | ) |
---|
| 281 | ); |
---|
[11041] | 282 | |
---|
| 283 | if ($conf['enable_synchronization']) |
---|
| 284 | { |
---|
| 285 | $template->assign( |
---|
| 286 | 'U_SYNC', |
---|
| 287 | $base_url.'site_update&site=1&cat_id='.$category['id'] |
---|
| 288 | ); |
---|
| 289 | } |
---|
| 290 | |
---|
[1500] | 291 | } |
---|
| 292 | |
---|
[809] | 293 | // representant management |
---|
[2324] | 294 | if ($category['has_images'] |
---|
[809] | 295 | or !empty($category['representative_picture_id'])) |
---|
| 296 | { |
---|
[2223] | 297 | $tpl_representant = array(); |
---|
[809] | 298 | |
---|
| 299 | // picture to display : the identified representant or the generic random |
---|
| 300 | // representant ? |
---|
| 301 | if (!empty($category['representative_picture_id'])) |
---|
| 302 | { |
---|
| 303 | $query = ' |
---|
[12796] | 304 | SELECT id,representative_ext,path |
---|
[633] | 305 | FROM '.IMAGES_TABLE.' |
---|
| 306 | WHERE id = '.$category['representative_picture_id'].' |
---|
| 307 | ;'; |
---|
[4325] | 308 | $row = pwg_db_fetch_assoc(pwg_query($query)); |
---|
[12796] | 309 | $src = DerivativeImage::thumb_url($row); |
---|
[2286] | 310 | $url = get_root_url().'admin.php?page=picture_modify'; |
---|
[809] | 311 | $url.= '&image_id='.$category['representative_picture_id']; |
---|
[1131] | 312 | |
---|
[2223] | 313 | $tpl_representant['picture'] = |
---|
[809] | 314 | array( |
---|
| 315 | 'SRC' => $src, |
---|
| 316 | 'URL' => $url |
---|
| 317 | ); |
---|
| 318 | } |
---|
| 319 | |
---|
| 320 | // can the admin choose to set a new random representant ? |
---|
[2324] | 321 | $tpl_representant['ALLOW_SET_RANDOM'] = ($category['has_images']) ? true : false; |
---|
[809] | 322 | |
---|
| 323 | // can the admin delete the current representant ? |
---|
| 324 | if ( |
---|
[2324] | 325 | ($category['has_images'] |
---|
[809] | 326 | and $conf['allow_random_representative']) |
---|
| 327 | or |
---|
[2324] | 328 | (!$category['has_images'] |
---|
[809] | 329 | and !empty($category['representative_picture_id']))) |
---|
| 330 | { |
---|
[2223] | 331 | $tpl_representant['ALLOW_DELETE'] = true; |
---|
[809] | 332 | } |
---|
[2223] | 333 | $template->assign('representant', $tpl_representant); |
---|
[633] | 334 | } |
---|
| 335 | |
---|
[2223] | 336 | if ($category['is_virtual']) |
---|
[68] | 337 | { |
---|
[809] | 338 | // the category can be moved in any category but in itself, in any |
---|
| 339 | // sub-category |
---|
| 340 | $unmovables = get_subcat_ids(array($category['id'])); |
---|
[1131] | 341 | |
---|
[809] | 342 | $query = ' |
---|
| 343 | SELECT id,name,uppercats,global_rank |
---|
| 344 | FROM '.CATEGORIES_TABLE.' |
---|
| 345 | WHERE id NOT IN ('.implode(',', $unmovables).') |
---|
| 346 | ;'; |
---|
[1131] | 347 | |
---|
[809] | 348 | display_select_cat_wrapper( |
---|
| 349 | $query, |
---|
| 350 | empty($category['id_uppercat']) ? array() : array($category['id_uppercat']), |
---|
[2223] | 351 | 'move_cat_options' |
---|
[809] | 352 | ); |
---|
| 353 | } |
---|
| 354 | |
---|
[403] | 355 | |
---|
[2223] | 356 | // create virtual in parent and link |
---|
[1064] | 357 | $query = ' |
---|
| 358 | SELECT id,name,uppercats,global_rank |
---|
| 359 | FROM '.CATEGORIES_TABLE.' |
---|
| 360 | ;'; |
---|
| 361 | display_select_cat_wrapper( |
---|
| 362 | $query, |
---|
| 363 | array(), |
---|
[2223] | 364 | 'create_new_parent_options' |
---|
[1064] | 365 | ); |
---|
| 366 | |
---|
[2223] | 367 | |
---|
[1064] | 368 | // destination categories |
---|
| 369 | $query = ' |
---|
[1121] | 370 | SELECT id,name,uppercats,global_rank |
---|
[1064] | 371 | FROM '.CATEGORIES_TABLE.' |
---|
[1121] | 372 | WHERE id != '.$category['id'].' |
---|
[1064] | 373 | ;'; |
---|
[1121] | 374 | display_select_cat_wrapper( |
---|
| 375 | $query, |
---|
| 376 | array(), |
---|
[2223] | 377 | 'category_destination_options' |
---|
[1064] | 378 | ); |
---|
| 379 | |
---|
[1895] | 380 | // info by email to an access granted group of category informations |
---|
[2140] | 381 | if (isset($_POST['submitEmail']) and !empty($_POST['group'])) |
---|
[1895] | 382 | { |
---|
[1904] | 383 | set_make_full_url(); |
---|
| 384 | |
---|
[5335] | 385 | /* TODO: if $category['representative_picture_id'] |
---|
[1904] | 386 | is empty find child representative_picture_id */ |
---|
| 387 | if (!empty($category['representative_picture_id'])) |
---|
| 388 | { |
---|
| 389 | $query = ' |
---|
[12796] | 390 | SELECT id, file, path, representative_ext |
---|
[1904] | 391 | FROM '.IMAGES_TABLE.' |
---|
| 392 | WHERE id = '.$category['representative_picture_id'].' |
---|
[1895] | 393 | ;'; |
---|
[1064] | 394 | |
---|
[1904] | 395 | $result = pwg_query($query); |
---|
[4325] | 396 | if (pwg_db_num_rows($result) > 0) |
---|
[1904] | 397 | { |
---|
[4325] | 398 | $element = pwg_db_fetch_assoc($result); |
---|
[1904] | 399 | |
---|
| 400 | $img_url = '<a href="'. |
---|
| 401 | make_picture_url(array( |
---|
| 402 | 'image_id' => $element['id'], |
---|
| 403 | 'image_file' => $element['file'], |
---|
| 404 | 'category' => $category |
---|
| 405 | )) |
---|
[12796] | 406 | .'" class="thumblnk"><img src="'.DerivativeImage::thumb_url($element).'"></a>'; |
---|
[1904] | 407 | } |
---|
| 408 | } |
---|
[5335] | 409 | |
---|
[1904] | 410 | if (!isset($img_url)) |
---|
[1895] | 411 | { |
---|
[1904] | 412 | $img_url = ''; |
---|
| 413 | } |
---|
| 414 | |
---|
| 415 | // TODO Mettre un array pour traduction subjet |
---|
| 416 | pwg_mail_group( |
---|
| 417 | $_POST['group'], |
---|
| 418 | get_str_email_format(true), /* TODO add a checkbox in order to choose format*/ |
---|
[7024] | 419 | get_l10n_args('[%s] Visit album %s', |
---|
[1916] | 420 | array($conf['gallery_title'], $category['name'])), |
---|
[1904] | 421 | 'cat_group_info', |
---|
| 422 | array |
---|
| 423 | ( |
---|
| 424 | 'IMG_URL' => $img_url, |
---|
[1916] | 425 | 'CAT_NAME' => $category['name'], |
---|
[1904] | 426 | 'LINK' => make_index_url( |
---|
[1895] | 427 | array( |
---|
| 428 | 'category' => array( |
---|
| 429 | 'id' => $category['id'], |
---|
| 430 | 'name' => $category['name'], |
---|
[1904] | 431 | 'permalink' => $category['permalink'] |
---|
| 432 | ))), |
---|
[1916] | 433 | 'CPL_CONTENT' => empty($_POST['mail_content']) |
---|
| 434 | ? '' : stripslashes($_POST['mail_content']) |
---|
[1904] | 435 | ), |
---|
| 436 | '' /* TODO Add listbox in order to choose Language selected */); |
---|
[1895] | 437 | |
---|
[1904] | 438 | unset_make_full_url(); |
---|
| 439 | |
---|
[1895] | 440 | $query = ' |
---|
| 441 | SELECT |
---|
| 442 | name |
---|
| 443 | FROM '.GROUPS_TABLE.' |
---|
| 444 | WHERE id = '.$_POST['group'].' |
---|
| 445 | ;'; |
---|
[4325] | 446 | list($group_name) = pwg_db_fetch_row(pwg_query($query)); |
---|
[5335] | 447 | |
---|
[1895] | 448 | array_push( |
---|
| 449 | $page['infos'], |
---|
| 450 | sprintf( |
---|
[5207] | 451 | l10n('An information email was sent to group "%s"'), |
---|
[1895] | 452 | $group_name |
---|
| 453 | ) |
---|
| 454 | ); |
---|
| 455 | } |
---|
| 456 | |
---|
| 457 | if ('private' == $category['status']) |
---|
| 458 | { |
---|
| 459 | $query = ' |
---|
| 460 | SELECT |
---|
| 461 | group_id |
---|
| 462 | FROM '.GROUP_ACCESS_TABLE.' |
---|
| 463 | WHERE cat_id = '.$category['id'].' |
---|
| 464 | ;'; |
---|
| 465 | } |
---|
| 466 | else |
---|
| 467 | { |
---|
| 468 | $query = ' |
---|
| 469 | SELECT |
---|
| 470 | id AS group_id |
---|
| 471 | FROM '.GROUPS_TABLE.' |
---|
| 472 | ;'; |
---|
| 473 | } |
---|
| 474 | $group_ids = array_from_query($query, 'group_id'); |
---|
| 475 | |
---|
| 476 | if (count($group_ids) > 0) |
---|
| 477 | { |
---|
| 478 | $query = ' |
---|
| 479 | SELECT |
---|
| 480 | id, |
---|
| 481 | name |
---|
| 482 | FROM '.GROUPS_TABLE.' |
---|
| 483 | WHERE id IN ('.implode(',', $group_ids).') |
---|
| 484 | ORDER BY name ASC |
---|
| 485 | ;'; |
---|
[2223] | 486 | $template->assign('group_mail_options', |
---|
| 487 | simple_hash_from_query($query, 'id', 'name') |
---|
| 488 | ); |
---|
[1895] | 489 | } |
---|
| 490 | |
---|
[5933] | 491 | trigger_action('loc_end_cat_modify'); |
---|
| 492 | |
---|
[21] | 493 | //----------------------------------------------------------- sending html code |
---|
[403] | 494 | $template->assign_var_from_handle('ADMIN_CONTENT', 'categories'); |
---|
[7024] | 495 | ?> |
---|