Changeset 16597 for extensions/UserCollections/include
- Timestamp:
- Jul 10, 2012, 5:37:33 PM (12 years ago)
- Location:
- extensions/UserCollections/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserCollections/include/collections.inc.php
r16591 r16597 8 8 switch ($page['sub_section']) 9 9 { 10 /* list */ 10 11 case 'list': 11 12 { 13 if (is_a_guest()) access_denied(); 14 12 15 $template->set_filename('index', dirname(__FILE__) . '/../template/list.tpl'); 13 16 … … 125 128 { 126 129 $col['date_creation'] = format_date($col['date_creation'], true); 127 $col['U_VIEW'] = USER_COLLEC_PUBLIC.'view/'.$col['id'];128 130 $col['U_EDIT'] = USER_COLLEC_PUBLIC.'edit/'.$col['id']; 129 131 $col['U_ACTIVE'] = USER_COLLEC_PUBLIC.'&action=set_active&col_id='.$col['id']; … … 133 135 { 134 136 $col['name'] = 'temp #'.$col['id']; 137 $col['U_VIEW'] = $col['U_EDIT']; 135 138 $col['U_SAVE'] = USER_COLLEC_PUBLIC.'&action=save&col_id='.$col['id']; 136 139 $template->append('temp_col', $col); … … 138 141 else 139 142 { 143 $col['U_VIEW'] = USER_COLLEC_PUBLIC.'view/'.$col['id']; 140 144 $template->append('collections', $col); 141 145 } … … 145 149 break; 146 150 } 147 151 152 /* edit */ 148 153 case 'edit': 149 154 { … … 165 170 try { 166 171 $UserCollection = new UserCollection($page['col_id']); 172 173 if (!is_admin() and $UserCollection->getParam('user_id') != $user['id']) 174 { 175 access_denied(); 176 } 167 177 168 178 // save properties … … 199 209 200 210 include(PHPWG_ROOT_PATH . 'include/category_default.inc.php'); 211 212 $template->concat('TITLE', $conf['level_separator'].$UserCollection->getParam('name')); 201 213 } 202 214 catch (Exception $e) … … 208 220 } 209 221 222 /* view */ 210 223 case 'view': 211 224 { … … 234 247 235 248 $template->assign('collection', $UserCollection->getCollectionInfo()); 236 237 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');238 $template->assign('OWNER', get_username($UserCollection->getParam('user_id')));239 249 240 250 $page['start'] = isset($_GET['start']) ? $_GET['start'] : 0; … … 254 264 255 265 include(PHPWG_ROOT_PATH . 'include/category_default.inc.php'); 266 267 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 268 $template->concat('TITLE', 269 $conf['level_separator'].$UserCollection->getParam('name'). 270 ' ('.sprintf(l10n('by %s'), get_username($UserCollection->getParam('user_id'))).')' 271 ); 256 272 } 257 273 catch (Exception $e) 258 274 { 259 a rray_push($page['errors'], $e->getMessage());275 access_denied(); 260 276 } 261 277 262 278 break; 263 279 } 264 265 // case 'send':266 // {267 268 // break;269 // }270 280 } 271 281 -
extensions/UserCollections/include/events.inc.php
r16591 r16597 7 7 function user_collections_init() 8 8 { 9 global $conf;10 11 // $conf['user_collections'] = unserialize($conf['user_collections']);12 9 load_language('plugin.lang', USER_COLLEC_PATH); 13 10 } … … 24 21 $page['title'] = '<a href="'.USER_COLLEC_PUBLIC.'">'.l10n('Collections').'</a>'; 25 22 26 switch (@$tokens[1]) 27 { 28 case 'edit': 29 $page['sub_section'] = 'edit'; 30 $page['title'].= $conf['level_separator'].' '.l10n('Edit'); 31 break; 32 case 'view': 33 $page['sub_section'] = 'view'; 34 $page['title'].= $conf['level_separator'].' '.l10n('View'); 35 break; 36 // case 'send': 37 // $page['sub_section'] = 'send'; 38 // $page['title'].= $conf['level_separator'].' '.l10n('Send'); 39 // break; 40 default: 41 $page['sub_section'] = 'list'; 23 if (in_array(@$tokens[1], array('edit','view','list'))) 24 { 25 $page['sub_section'] = $tokens[1]; 26 } 27 else 28 { 29 $page['sub_section'] = 'list'; 42 30 } 43 31 … … 64 52 function user_collections_index_actions() 65 53 { 54 if (is_a_guest()) return; 55 66 56 global $page, $UserCollection; 67 57 … … 80 70 function user_collections_thumbnails_list($tpl_thumbnails_var, $pictures) 81 71 { 72 if (is_a_guest()) return $tpl_thumbnails_var; 73 82 74 global $page, $template, $UserCollection; 83 75 … … 99 91 $collection = array(); 100 92 } 101 102 93 103 94 … … 142 133 function user_collections_picture_page() 143 134 { 135 if (is_a_guest()) return; 136 144 137 global $template, $picture, $UserCollection; 145 138 … … 186 179 function user_collections_add_menublock($menu_ref_arr) 187 180 { 181 if (is_a_guest()) return; 182 183 global $user; 184 188 185 $menu = &$menu_ref_arr[0]; 189 186 if ($menu->get_id() != 'menubar') return; 190 187 191 if (get_current_collection_id(false) === false) return; 192 193 $menu->register_block(new RegisteredBlock('mbUserCollection', l10n('Download Basket'), 'UserCollection')); 188 $query = ' 189 SELECT id 190 FROM '.COLLECTIONS_TABLE.' 191 WHERE user_id = '.$user['id'].' 192 LIMIT 1 193 ;'; 194 $result = pwg_query($query); 195 196 if (!pwg_db_num_rows($result)) return; 197 198 $menu->register_block(new RegisteredBlock('mbUserCollection', l10n('Collections'), 'UserCollection')); 194 199 } 195 200 … … 201 206 if (($block = $menu->get_block('mbUserCollection')) != null) 202 207 { 203 if (empty($UserCollection)) 204 { 205 $UserCollection = new UserCollection(get_current_collection_id()); 206 } 207 208 $data = array( 209 'U_LIST' => USER_COLLEC_PUBLIC, 210 'current' => array( 211 'NAME' => $UserCollection->getParam('name'), 212 'NB_IMAGES' => $UserCollection->getParam('nb_images'), 213 ), 214 'links' => array(), 215 ); 216 217 if ($data['current']['NB_IMAGES'] > 0) 218 { 219 $data['links'] = array( 220 array( 221 'URL' => USER_COLLEC_PUBLIC.'view/'.$UserCollection->getParam('col_id'), 222 'NAME' => l10n('View'), 208 if (($col_id = get_current_collection_id(false)) !== false) 209 { 210 if (empty($UserCollection)) 211 { 212 $UserCollection = new UserCollection($col_id); 213 } 214 215 $data = array( 216 'current' => array( 217 'NAME' => $UserCollection->getParam('name'), 218 'NB_IMAGES' => $UserCollection->getParam('nb_images'), 223 219 ), 224 array( 225 'URL' => USER_COLLEC_PUBLIC.'&action=clear&col_id='.$UserCollection->getParam('col_id'), 226 'NAME' => l10n('Clear'), 227 ), 220 'links' => array(), 228 221 ); 229 } 222 223 if ($data['current']['NB_IMAGES'] > 0) 224 { 225 $data['links'] = array( 226 array( 227 'URL' => USER_COLLEC_PUBLIC.'edit/'.$UserCollection->getParam('col_id'), 228 'NAME' => l10n('Display collection'), 229 ), 230 array( 231 'URL' => USER_COLLEC_PUBLIC.'&action=clear&col_id='.$UserCollection->getParam('col_id'), 232 'NAME' => l10n('Clear collection'), 233 ), 234 ); 235 } 236 } 237 238 $data['U_LIST'] = USER_COLLEC_PUBLIC; 230 239 231 240 $template->set_template_dir(USER_COLLEC_PATH . 'template/');
Note: See TracChangeset
for help on using the changeset viewer.