- Timestamp:
- Jul 12, 2012, 8:28:27 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserCollections/include/UserCollection.class.php
r16625 r16658 24 24 'active' => false, 25 25 'public' => false, 26 'public_id' => null, 26 27 ); 27 28 $this->images = array(); 29 30 // access from public id 31 if ( strlen($col_id) == 10 and strpos($col_id, 'uc') === 0 ) 32 { 33 $query = ' 34 SELECT id 35 FROM '.COLLECTIONS_TABLE.' 36 WHERE public_id = "'.$col_id.'" 37 ;'; 38 $result = pwg_query($query); 39 40 if (!pwg_db_num_rows($result)) 41 { 42 $col_id = 0; 43 } 44 else 45 { 46 list($col_id) = pwg_db_fetch_row($result); 47 } 48 } 28 49 29 50 // load specific collection … … 37 58 nb_images, 38 59 active, 39 public 60 public, 61 public_id 40 62 FROM '.COLLECTIONS_TABLE.' 41 63 WHERE … … 48 70 { 49 71 $this->data['col_id'] = $col_id; 50 list( 51 $this->data['user_id'], 52 $this->data['name'], 53 $this->data['date_creation'], 54 $this->data['nb_images'], 55 $this->data['active'], 56 $this->data['public'] 57 ) = pwg_db_fetch_row($result); 72 $this->data = array_merge( 73 $this->data, 74 pwg_db_fetch_assoc($result) 75 ); 58 76 59 77 // make sur all pictures of the collection exist … … 89 107 $this->data['active'] = $active; 90 108 $this->data['public'] = $public; 109 $this->data['public_id'] = 'uc'.hash('crc32', uniqid(serialize($this->data, true))); 91 110 92 111 $query = ' … … 96 115 date_creation, 97 116 active, 98 public 117 public, 118 public_id 99 119 ) 100 120 VALUES( … … 103 123 NOW(), 104 124 '.(int)$this->data['active'].', 105 '.(int)$this->data['public'].' 125 '.(int)$this->data['public'].', 126 "'.$this->data['public_id'].'" 106 127 ) 107 128 ;'; … … 271 292 'PUBLIC' => (bool)$this->data['public'], 272 293 'DATE_CREATION' => format_date($this->data['date_creation'], true), 273 'U_PUBLIC' => get_absolute_root_url().USER_COLLEC_PUBLIC . 'view/'.$this->data[' col_id'],294 'U_PUBLIC' => get_absolute_root_url().USER_COLLEC_PUBLIC . 'view/'.$this->data['public_id'], 274 295 'IS_TEMP' => $this->data['name'] == 'temp', 275 296 );
Note: See TracChangeset
for help on using the changeset viewer.