Ignore:
Timestamp:
Jul 13, 2012, 12:09:19 PM (12 years ago)
Author:
mistic100
Message:

-rework the main menu
-bug when a collection is create through AJAX
-add "Remove from collection" on colorbox
-minor interfaces changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserCollections/include/UserCollection.class.php

    r16658 r16688  
    1717   
    1818    $this->data = array(
    19       'col_id' => 0,
     19      'id' => 0,
    2020      'user_id' => $user['id'],
    2121      'name' => null,
     
    5353      $query = '
    5454SELECT
     55    id,
    5556    user_id,
    5657    name,
     
    6970      if (pwg_db_num_rows($result))
    7071      {
    71         $this->data['col_id'] = $col_id;
    7272        $this->data = array_merge(
    7373          $this->data,
     
    8787SELECT image_id
    8888  FROM '.COLLECTION_IMAGES_TABLE.'
    89   WHERE col_id = '.$this->data['col_id'].'
     89  WHERE col_id = '.$this->data['id'].'
    9090;';
    9191        $this->images = array_from_query($query, 'image_id');
     
    107107      $this->data['active'] = $active;
    108108      $this->data['public'] = $public;
    109       $this->data['public_id'] = 'uc'.hash('crc32', uniqid(serialize($this->data, true)));
     109      $this->data['public_id'] = 'uc'.hash('crc32', uniqid(serialize($this->data), true));
    110110     
    111111      $query = '
     
    128128;';
    129129      pwg_query($query);
    130       $this->data['col_id'] = pwg_db_insert_id();
     130      $this->data['id'] = pwg_db_insert_id();
    131131     
    132132      $date = pwg_query('SELECT FROM_UNIXTIME(NOW());');
     
    146146  WHERE
    147147    user_id = '.$this->data['user_id'].'
    148     AND id != '.$this->data['col_id'].'
     148    AND id != '.$this->data['id'].'
    149149;';
    150150        pwg_query($query);
     
    165165  {
    166166    $this->data[$name] = $value;
    167     pwg_query('UPDATE '.COLLECTIONS_TABLE.' SET '.$name.' = "'.$value.'" WHERE id = '.$this->data['col_id'].';');
     167    pwg_query('UPDATE '.COLLECTIONS_TABLE.' SET '.$name.' = "'.$value.'" WHERE id = '.$this->data['id'].';');
    168168  }
    169169 
     
    213213DELETE FROM '.COLLECTION_IMAGES_TABLE.'
    214214  WHERE
    215     col_id = '.$this->data['col_id'].'
     215    col_id = '.$this->data['id'].'
    216216    AND image_id IN('.implode(',', $image_ids).')
    217217;';
     
    237237     
    238238      array_push($this->images, $image_id);
    239       array_push($inserts, array('col_id'=>$this->data['col_id'], 'image_id'=>$image_id));
     239      array_push($inserts, array('col_id'=>$this->data['id'], 'image_id'=>$image_id));
    240240    }
    241241   
     
    275275    $query = '
    276276DELETE FROM '.COLLECTION_IMAGES_TABLE.'
    277   WHERE col_id = '.$this->data['col_id'].'
     277  WHERE col_id = '.$this->data['id'].'
    278278;';
    279279    pwg_query($query);
Note: See TracChangeset for help on using the changeset viewer.