Changeset 10828


Ignore:
Timestamp:
May 9, 2011, 11:09:37 PM (10 years ago)
Author:
mistic100
Message:

warnings if image_verso table empty

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Back2Front/Back2Front.php

    r10823 r10828  
    3333    if (is_admin())
    3434    {
    35       $template->assign('VERSO_U_ADMIN', get_root_url().'admin.php?page=picture_modify&cat_id=&image_id='.$verso['id']);
     35      $template->assign('VERSO_U_ADMIN', get_root_url().'admin.php?page=picture_modify&image_id='.$verso['id']);
    3636      $template->set_filename('B2F_admin_button', dirname(__FILE__).'/template/admin_button.tpl');
    3737      $template->concat('PLUGIN_PICTURE_ACTIONS', $template->parse('B2F_admin_button', true));
     
    7979      $query = "SELECT image_id, verso_id
    8080        FROM ".B2F_TABLE.";";
    81       $all_recto_verso = array_combine(array_from_query($query, 'image_id'), array_from_query($query, 'verso_id'));
     81      $rectos = array_from_query($query, 'image_id');
     82      $versos = array_from_query($query, 'verso_id');
     83      if (count($rectos) != 0)
     84      {
     85        $all_recto_verso = array_combine($rectos, $versos);
     86      }
     87      else
     88      {
     89        $all_recto_verso = array(0=>0);
     90      }
     91      unset($rectos, $versos);
    8292     
    8393      /* verso don't exists */
     
    95105      {
    96106          $recto_current_verso['id'] = $all_recto_verso[$_POST['b2f_front_id']];
    97           $recto_current_verso['link'] = get_root_url().'admin.php?page=picture_modify&cat_id=&image_id='.$recto_current_verso['id'];
     107          $recto_current_verso['link'] = get_root_url().'admin.php?page=picture_modify&image_id='.$recto_current_verso['id'];
    98108          $template->append('errors', l10n('This picture has already a backside : ').'<a href="'.$recto_current_verso['link'].'">'.$recto_current_verso['id'].'</a>');
    99109      }
     
    102112      {
    103113          $recto_is_verso['id'] = $_POST['b2f_front_id'];
    104           $recto_is_verso['link'] = get_root_url().'admin.php?page=picture_modify&amp;cat_id=&amp;image_id='.$recto_is_verso['id'];
     114          $recto_is_verso['link'] = get_root_url().'admin.php?page=picture_modify&amp;image_id='.$recto_is_verso['id'];
    105115          $template->append('errors', l10n('This picture is already a backside : ').'<a href="'.$recto_is_verso['link'].'">'.$recto_is_verso['id'].'</a>');
    106116      }
     
    229239        $template->assign(array(
    230240          'B2F_VERSO_ID' => $item['id'],
    231           'B2F_VERSO_URL' => get_root_url().'admin.php?page=picture_modify&amp;cat_id=&amp;image_id='.$item['id'],
     241          'B2F_VERSO_URL' => get_root_url().'admin.php?page=picture_modify&amp;image_id='.$item['id'],
    232242          'B2F_VERSO_NAME' => get_image_name($item['name'], $item['file']),
    233243        ));
Note: See TracChangeset for help on using the changeset viewer.