Changeset 20090 for extensions/UserCollections/include/collections.inc.php
- Timestamp:
- Jan 12, 2013, 3:13:08 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserCollections/include/collections.inc.php
r19843 r20090 159 159 $self_url = USER_COLLEC_PUBLIC . 'edit/'.$page['col_id']; 160 160 $template->assign(array( 161 'user_collections' => $conf['user_collections'], 161 162 'USER_COLLEC_PATH' => USER_COLLEC_PATH, 162 163 'F_ACTION' => $self_url, … … 184 185 else 185 186 { 186 $UserCollection->updateParam('name', $_POST['name']); 187 $UserCollection->updateParam('name', stripslashes($_POST['name'])); 188 } 189 if (!$conf['user_collections']['allow_public']) 190 { 191 $_POST['public'] = '0'; 187 192 } 188 193 $UserCollection->updateParam('public', $_POST['public']); 194 } 195 196 // send mail 197 if ( $conf['user_collections']['allow_public'] and $conf['user_collections']['allow_mails'] ) 198 { 199 $contact = array( 200 'sender_name' => $user['username'], 201 'sender_email' => $user['email'], 202 'recipient_name' => null, 203 'recipient_email' => null, 204 'nb_images' => 4, 205 'message' => null, 206 ); 207 208 if ( isset($_POST['send_mail']) and (bool)$UserCollection->getParam('public') ) 209 { 210 $contact = array( 211 'sender_email' => trim($_POST['sender_email']), 212 'sender_name' => trim($_POST['sender_name']), 213 'recipient_email' => trim($_POST['recipient_email']), 214 'recipient_name' => trim($_POST['recipient_name']), 215 'nb_images' => $_POST['nb_images'], 216 'message' => $_POST['message'], 217 ); 218 219 $errors = $UserCollection->sendEmail($contact, @$_POST['key']); 220 if (count($errors)) 221 { 222 $template->assign('uc_mail_errors', $errors); 223 } 224 } 225 226 $contact['KEY'] = get_ephemeral_key(3); 227 $template->assign('contact', $contact); 189 228 } 190 229 … … 202 241 } 203 242 204 // special template 205 add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_in_collection', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 2); // +10 to overload GThumb+ 243 // add links for colorbox 244 add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_in_collection', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 245 246 // add remove item links 206 247 $template->set_prefilter('index_thumbnails', 'user_collections_thumbnails_list_prefilter'); 207 248 208 249 // collection content 209 250 $col = $UserCollection->getCollectionInfo(); 251 $col['DATE_CREATION'] = format_date($col['DATE_CREATION'], true); 210 252 $col['U_CLEAR'] = $self_url.'&action=clear'; 211 253 $col['U_DELETE'] = add_url_params(USER_COLLEC_PUBLIC, array('action'=>'delete','col_id'=>$page['col_id'])); 212 254 $template->assign('collection', $col); 213 214 255 $page['items'] = $UserCollection->getImages(); 215 256 216 // navigation bar 217 $page['start'] = isset($_GET['start']) ? $_GET['start'] : 0; 218 if (count($page['items']) > $page['nb_image_page']) 219 { 220 $page['navigation_bar'] = create_navigation_bar( 221 $self_url, 222 count($page['items']), 223 $page['start'], 224 $page['nb_image_page'], 225 false 226 ); 227 $template->assign('navbar', $page['navigation_bar']); 228 } 229 230 // display 231 include(PHPWG_ROOT_PATH . 'include/category_default.inc.php'); 257 // toolbar buttons 258 $buttons = null; 259 if ($conf['user_collections']['allow_public'] and $conf['user_collections']['allow_mails']) 260 { 261 $buttons.= '<li><a class="mail_colorbox_open" href="#mail_form" title="'.l10n('Send this collection my mail').'" class="pwg-state-default pwg-button" rel="nofollow" '.(!$col['PUBLIC']?'onClick="alert(\''.l10n('The collection must be public in order to send it').'\');return false;"':null).'> 262 <span class="pwg-icon user-collections-delete-icon" style="background:url(\'' . get_root_url().USER_COLLEC_PATH . 'template/resources/mail.png\') center center no-repeat;"> </span><span class="pwg-button-text">'.l10n('Send').'</span> 263 </a></li>'; 264 } 265 $buttons.= ' 266 <li><a href="'. $col['U_CLEAR'] .'" title="'.l10n('Clear this collection').'" class="pwg-state-default pwg-button" rel="nofollow" onClick="return confirm(\''.l10n('Are you sure?').'\');"> 267 <span class="pwg-icon user-collections-delete-icon" style="background:url(\'' . get_root_url().USER_COLLEC_PATH . 'template/resources/bin.png\') center center no-repeat;"> </span><span class="pwg-button-text">'.l10n('Clear').'</span> 268 </a></li> 269 <li><a href="'. $col['U_DELETE'] .'" title="'.l10n('Delete this collection').'" class="pwg-state-default pwg-button" rel="nofollow" onClick="return confirm(\''.l10n('Are you sure?').'\');"> 270 <span class="pwg-icon user-collections-delete-icon" style="background:url(\'' . get_root_url().USER_COLLEC_PATH . 'template/resources/delete.png\') center center no-repeat;"> </span><span class="pwg-button-text">'.l10n('Delete').'</span> 271 </a></li>'; 272 $template->concat('COLLECTION_ACTIONS', $buttons); 273 274 // thumbnails 275 define('USER_COLLEC_REMOVE_GTHUMB', true); 276 include(USER_COLLEC_PATH . '/include/display_thumbnails.inc.php'); 232 277 233 278 $template->concat('TITLE', $conf['level_separator'].$UserCollection->getParam('name')); … … 245 290 { 246 291 // security 247 if ( empty($page['col_id']) or strlen($page['col_id']) != 10 or strpos($page['col_id'], 'uc') === false )292 if ( empty($page['col_id']) or strlen($page['col_id']) != 10 or strpos($page['col_id'], 'uc') === false or !$conf['user_collections']['allow_public'] ) 248 293 { 249 294 $_SESSION['page_errors'][] = l10n('Invalid collection'); … … 257 302 try { 258 303 $UserCollection = new UserCollection($page['col_id']); 259 260 // special template261 add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_in_collection', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 2); // +10 to overload GThumb+262 263 // collection content264 304 $page['items'] = $UserCollection->getImages(); 265 305 266 // navigation bar 267 $page['start'] = isset($_GET['start']) ? $_GET['start'] : 0; 268 if (count($page['items']) > $page['nb_image_page']) 269 { 270 $page['navigation_bar'] = create_navigation_bar( 271 $self_url, 272 count($page['items']), 273 $page['start'], 274 $page['nb_image_page'], 275 false 276 ); 277 $template->assign('navbar', $page['navigation_bar']); 278 } 279 280 // display 281 include(PHPWG_ROOT_PATH . 'include/category_default.inc.php'); 282 306 // thumbnails 307 include(USER_COLLEC_PATH . '/include/display_thumbnails.inc.php'); 308 309 // add username in title 283 310 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 284 311 $template->concat('TITLE', … … 295 322 } 296 323 } 324 297 325 298 326 $template->assign(array(
Note: See TracChangeset
for help on using the changeset viewer.