Changeset 25593 for trunk/admin


Ignore:
Timestamp:
Nov 19, 2013, 9:19:36 PM (11 years ago)
Author:
plg
Message:

feature 3001: new link "add photos" on album edition page. Patch by msakik

Location:
trunk/admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/cat_modify.php

    r25019 r25593  
    232232      ),
    233233
     234    'U_ADD_PHOTOS_ALBUM' => $base_url.'photos_add&album='.$category['id'],
    234235    'U_CHILDREN' => $cat_list_url.'&parent_id='.$category['id'],
    235236    'U_HELP' => get_root_url().'admin/popuphelp.php?page=cat_modify',
  • trunk/admin/include/photos_add_direct_prepare.inc.php

    r25018 r25593  
    162162$selected_category = array();
    163163
    164 $query = '
     164if (isset($_GET['album']))
     165{
     166  // set the category from get url or ...
     167  check_input_parameter('album', $_GET, false, PATTERN_ID);
     168 
     169  // test if album really exists
     170  $query = '
     171SELECT id
     172  FROM '.CATEGORIES_TABLE.'
     173  WHERE id = '.$_GET['album'].'
     174;';
     175  $result = pwg_query($query);
     176  if (pwg_db_num_rows($result) == 1)
     177  {
     178    $selected_category = array($_GET['album']);
     179   
     180    // lets put in the session to persist in case of upload method switch
     181    $_SESSION['selected_category'] = $selected_category;
     182  }
     183  else
     184  {
     185    fatal_error('[Hacking attempt] the album id = "'.$_GET['album'].'" is not valid');
     186  }
     187}
     188else if (isset($_SESSION['selected_category']))
     189{
     190  $selected_category = $_SESSION['selected_category'];
     191}
     192else
     193{
     194  // we need to know the category in which the last photo was added
     195  $query = '
    165196SELECT category_id
    166197  FROM '.IMAGES_TABLE.' AS i
     
    169200  ORDER BY i.id DESC
    170201  LIMIT 1
    171 ;';
    172 $result = pwg_query($query);
    173 if (pwg_db_num_rows($result) > 0)
    174 {
    175   $row = pwg_db_fetch_assoc($result);
    176  
    177   $selected_category = array($row['category_id']);
     202;
     203';
     204  $result = pwg_query($query);
     205  if (pwg_db_num_rows($result) > 0)
     206  {
     207    $row = pwg_db_fetch_assoc($result);
     208    $selected_category = array($row['category_id']);
     209  }
    178210}
    179211
  • trunk/admin/themes/default/template/cat_modify.tpl

    r23425 r25593  
    3838  <li><a href="{$U_MANAGE_ELEMENTS}">{'manage album photos'|@translate}</a></li>
    3939{/if}
     40
     41  <li style="text-transform:lowercase;"><a href="{$U_ADD_PHOTOS_ALBUM}">{'Add Photos'|translate}</a></li>
    4042
    4143  <li><a href="{$U_CHILDREN}">{'manage sub-albums'|@translate}</a></li>
Note: See TracChangeset for help on using the changeset viewer.