Changeset 29317 for extensions
- Timestamp:
- Aug 29, 2014, 2:19:11 PM (10 years ago)
- Location:
- extensions/UserCollections
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserCollections/admin/config.php
r28854 r29317 5 5 { 6 6 $conf['user_collections'] = array( 7 'allow_public' => isset($_POST['allow_public']), 8 'allow_mails' => isset($_POST['allow_mails']) && isset($_POST['allow_public']), 7 'allow_public' => isset($_POST['allow_public']), 8 'allow_mails' => isset($_POST['allow_mails']) && isset($_POST['allow_public']), 9 'allow_send_admin' => isset($_POST['allow_send_admin']), 9 10 ); 10 11 … … 12 13 } 13 14 14 $template->assign(array( 15 'user_collections' => $conf['user_collections'], 16 )); 17 15 $template->assign('user_collections', $conf['user_collections']); 18 16 19 17 $template->set_filename('user_collections', realpath(USER_COLLEC_PATH . 'admin/template/config.tpl')); -
extensions/UserCollections/admin/template/config.tpl
r25678 r29317 26 26 </label> 27 27 </li> 28 <li> 29 <label> 30 <input type="checkbox" name="allow_send_admin" {if $user_collections.allow_send_admin}checked="checked"{/if}> 31 <b>{'Allow users to send their collections (public or not) to the admin'|translate}</b> 32 </label> 33 </li> 28 34 </ul> 29 35 </fieldset> -
extensions/UserCollections/include/UserCollection.class.php
r27604 r29317 448 448 449 449 $comment_action = 'validate'; 450 $for_admin = $comm['to'] == 'admin'; 450 451 451 452 // check author … … 455 456 $comment_action = 'reject'; 456 457 } 457 if ( empty($comm['recipient_name']))458 if (!$for_admin && empty($comm['recipient_name'])) 458 459 { 459 460 $errors[] = l10n('Please enter the recipient name'); … … 472 473 $comment_action = 'reject'; 473 474 } 474 if (empty($comm['recipient_email'])) 475 { 476 $errors[] = l10n('Please enter the recipient e-mail'); 477 $comment_action = 'reject'; 478 } 479 else if (!empty($comm['recipient_email']) and !email_check_format($comm['recipient_email'])) 480 { 481 $errors[] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'); 482 $comment_action = 'reject'; 475 if (!$for_admin) 476 { 477 if (empty($comm['recipient_email'])) 478 { 479 $errors[] = l10n('Please enter the recipient e-mail'); 480 $comment_action = 'reject'; 481 } 482 else if (!empty($comm['recipient_email']) and !email_check_format($comm['recipient_email'])) 483 { 484 $errors[] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'); 485 $comment_action = 'reject'; 486 } 483 487 } 484 488 … … 493 497 if ($comment_action == 'validate') 494 498 { 495 // switch to guest user for get_sql_condition_FandF 496 $user_save = $user; 497 $user = build_user($conf['guest_id'], true); 499 if (!$for_admin) 500 { 501 // switch to guest user for get_sql_condition_FandF 502 $user_save = $user; 503 $user = build_user($conf['guest_id'], true); 504 } 498 505 499 506 // get pictures … … 517 524 $pictures = hash_from_query($query, 'id'); 518 525 519 // switch back to current user 520 $user = $user_save; 521 unset($user_save); 522 523 $share_key = array('share_key'=>'mail-' . substr(sha1($this->data['id'].$conf['secret_key']), 0, 11)); 524 525 $tpl_vars = array( 526 'COL_URL' => $this->addShare($share_key, false), 527 'PARAMS' => $comm, 528 'derivative_params' => ImageStdParams::get_by_type(IMG_SQUARE), 529 ); 526 if (!$for_admin) 527 { 528 // switch back to current user 529 $user = $user_save; 530 unset($user_save); 531 } 530 532 531 533 // pictures infos 532 534 set_make_full_url(); 535 $thumbnails = array(); 533 536 534 537 foreach ($pictures as $row) … … 536 539 $name = render_element_name($row); 537 540 538 $t pl_vars['THUMBNAILS'][] = array(541 $thumbnails[] = array( 539 542 'TN_ALT' => htmlspecialchars(strip_tags($name)), 540 543 'NAME' => $name, … … 546 549 unset_make_full_url(); 547 550 548 $result = pwg_mail( 549 array( 550 'name' => $comm['recipient_name'], 551 'email' => $comm['recipient_email'], 552 ), 553 array( 554 'subject' => '['.$conf['gallery_title'].'] '.l10n('A photo collection by %s', $comm['sender_name']), 555 'mail_title' => $this->getParam('name'), 556 'mail_subtitle' => l10n('by %s', $comm['sender_name']), 557 'content_format' => 'text/html', 558 'from' => array( 559 'name' => $comm['sender_name'], 560 'email' => $comm['sender_email'], 561 ) 562 ), 563 array( 564 'filename' => 'mail', 565 'dirname' => realpath(USER_COLLEC_PATH . 'template'), 566 'assign' => $tpl_vars, 551 if ($for_admin) 552 { 553 $col_url = USER_COLLEC_PUBLIC.'edit/'.$this->data['id']; 554 } 555 else 556 { 557 $share_key = array('share_key'=>'mail-' . substr(sha1($this->data['id'].$conf['secret_key']), 0, 11)); 558 $col_url = $this->addShare($share_key, false); 559 } 560 561 $mail_config = array( 562 'subject' => '['.$conf['gallery_title'].'] '.l10n('A photo collection by %s', $comm['sender_name']), 563 'mail_title' => $this->getParam('name'), 564 'mail_subtitle' => l10n('by %s', $comm['sender_name']), 565 'content_format' => 'text/html', 566 'from' => array( 567 'name' => $comm['sender_name'], 568 'email' => $comm['sender_email'], 567 569 ) 568 570 ); 571 $mail_tpl = array( 572 'filename' => 'mail', 573 'dirname' => realpath(USER_COLLEC_PATH . 'template'), 574 'assign' => array( 575 'COL_URL' => $col_url, 576 'PARAMS' => $comm, 577 'derivative_params' => ImageStdParams::get_by_type(IMG_SQUARE), 578 'THUMBNAILS' => $thumbnails, 579 ) 580 ); 581 582 if ($for_admin) 583 { 584 $result = pwg_mail_admins($mail_config, $mail_tpl); 585 } 586 else 587 { 588 $result = pwg_mail( 589 array( 590 'name' => $comm['recipient_name'], 591 'email' => $comm['recipient_email'], 592 ), 593 $mail_config, 594 $mail_tpl 595 ); 596 } 569 597 570 598 if ($result == false) -
extensions/UserCollections/include/collections.inc.php
r28626 r29317 173 173 174 174 // send mail 175 if ($conf['user_collections']['allow_mails'] && $conf['user_collections']['allow_public']) 175 if (($conf['user_collections']['allow_public'] && $conf['user_collections']['allow_mails']) 176 || $conf['user_collections']['allow_send_admin']) 176 177 { 177 178 if (isset($_POST['send_mail'])) … … 180 181 'sender_email' => trim($_POST['sender_email']), 181 182 'sender_name' => trim($_POST['sender_name']), 183 'to' => $_POST['to'], 182 184 'recipient_email' => trim($_POST['recipient_email']), 183 185 'recipient_name' => trim($_POST['recipient_name']), … … 249 251 USER_COLLEC_PUBLIC . 'view/' . $page['col_id'] .'-' 250 252 ); 251 252 if ($conf['user_collections']['allow_mails']) 253 { 254 user_collections_add_button('mail', 'U_MAIL', true); 255 } 253 } 254 255 if (($conf['user_collections']['allow_public'] && $conf['user_collections']['allow_mails']) 256 || $conf['user_collections']['allow_send_admin']) 257 { 258 user_collections_add_button('mail', 'U_MAIL', true); 256 259 } 257 260 … … 265 268 ); 266 269 267 $template->assign('UC_TKEY', get_ephemeral_key(3)); 270 $template->assign(array( 271 'UC_TKEY' => get_ephemeral_key(3), 272 'UC_CONFIG' => $conf['user_collections'] 273 )); 268 274 269 275 // modify page title -
extensions/UserCollections/language/en_UK/plugin.lang.php
r26058 r29317 31 31 $lang['Allow users to set their collections as public'] = 'Allow users to set their collections as public'; 32 32 $lang['Allow users to send their public collections by mail'] = 'Allow users to send their public collections by mail'; 33 $lang['Allow users to send their collections (public or not) to the admin'] = 'Allow users to send their collections (public or not) to the admin'; 33 34 $lang['Fields'] = 'Fields'; 34 35 $lang['Active'] = 'Active'; … … 69 70 $lang['Name'] = 'Name'; 70 71 $lang['Send'] = 'Send'; 72 $lang['To'] = 'To'; 73 $lang['Administrator'] = 'Administrator'; 74 $lang['Someone else'] = 'Someone else'; 71 75 72 76 ?> -
extensions/UserCollections/language/fr_FR/plugin.lang.php
r26058 r29317 31 31 $lang['Allow users to set their collections as public'] = 'Les utilisateurs peuvent rendre leurs collections publiques'; 32 32 $lang['Allow users to send their public collections by mail'] = 'Les utilisateurs peuvent envoyer leurs collections publiques par mail'; 33 $lang['Allow users to send their collections (public or not) to the admin'] = 'Les utilisateurs peuvent envoyer leurs collections (publiques ou non) à l\'administrateur'; 33 34 $lang['Fields'] = 'Champs'; 34 35 $lang['Active'] = 'Actifs'; … … 69 70 $lang['Name'] = 'Nom'; 70 71 $lang['Send'] = 'Envoyer'; 72 $lang['To'] = 'Pour'; 73 $lang['Administrator'] = 'Administrateur'; 74 $lang['Someone else'] = 'Quelqu\'un d\'autre'; 71 75 72 76 ?> -
extensions/UserCollections/maintain.class.php
r28854 r29317 9 9 10 10 private $default_conf = array( 11 'allow_send_admin' => true, 11 12 'allow_mails' => true, 12 13 'allow_public' => true, … … 30 31 { 31 32 conf_update_param('user_collections', $this->default_conf, true); 33 } 34 else 35 { 36 $old_conf = safe_unserialize($conf['user_collections']); 37 38 if (!isset($old_conf['allow_send_admin'])) 39 { 40 $old_conf['allow_send_admin'] = true; 41 conf_update_param('user_collections', $old_conf, true); 42 } 32 43 } 33 44 -
extensions/UserCollections/template/collection_edit.tpl
r25678 r29317 130 130 }); 131 131 132 jQuery('#mail_form [name=to]').on('change', function() { 133 $('.recipient-input').toggle(jQuery(this).val() == 'email'); 134 jQuery.colorbox.resize(); 135 }); 132 136 133 137 jQuery('#mail_form').css('background-color', bg_color); … … 258 262 </td> 259 263 </tr> 260 <tr> 264 {if $UC_CONFIG.allow_send_admin && !$UC_CONFIG.allow_mails} 265 <tr> 266 <td class="title">{'To'|translate}</td> 267 <td>{'Administrator'|translate}</td> 268 </tr> 269 {/if} 270 <tr {if !$UC_CONFIG.allow_send_admin || !$UC_CONFIG.allow_mails}style="display:none"{/if}> 271 <td class="title">{'To'|translate}</td> 272 <td> 273 <label><input type="radio" name="to" value="admin" checked> {'Administrator'|translate}</label> 274 <label><input type="radio" name="to" value="email"> {'Someone else'|translate}</label> 275 </td> 276 </tr> 277 <tr style="display:none" class="recipient-input"> 261 278 <td class="title"><label for="recipient_name">{'Recipient name'|translate}</label></td> 262 279 <td> … … 264 281 </td> 265 282 </tr> 266 <tr >283 <tr style="display:none" class="recipient-input"> 267 284 <td class="title"><label for="recipient_email">{'Recipient e-mail'|translate}</label></td> 268 285 <td>
Note: See TracChangeset
for help on using the changeset viewer.