Changeset 25872


Ignore:
Timestamp:
12/09/13 17:34:37 (6 years ago)
Author:
mistic100
Message:

update for 2.6

Location:
extensions/ContactForm
Files:
5 added
5 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • extensions/ContactForm/admin.php

    r23207 r25872  
    77 
    88// tabsheet 
    9 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');     
     9include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 
    1010$tabsheet = new tabsheet(); 
    1111$tabsheet->add('config', l10n('Configuration'), CONTACT_FORM_ADMIN . '-config'); 
     
    1717include(CONTACT_FORM_PATH . 'admin/' . $page['tab'] . '.php'); 
    1818 
    19 if (!$conf['ContactForm']['cf_ready']) 
     19if (!$conf['ContactForm_ready']) 
    2020{ 
    21   array_push($page['errors'], l10n('No active email address')); 
     21  $page['errors'][] = l10n('No active email address'); 
    2222} 
    2323 
     
    2929 
    3030$template->assign_var_from_handle('ADMIN_CONTENT', 'contact_form'); 
    31  
    32 ?> 
  • extensions/ContactForm/admin/config.php

    r24348 r25872  
    55if (isset($_POST['save_config'])) 
    66{ 
    7   $was_ready = $conf['ContactForm']['cf_ready']; 
    8    
     7  if ($_POST['cf_redirect_url']=='http://') 
     8  { 
     9    $_POST['cf_redirect_url'] = null; 
     10  } 
     11  else if (!empty($_POST['cf_redirect_url'])) 
     12  { 
     13    if (strpos($_POST['cf_redirect_url'], 'http') !== 0) 
     14    { 
     15      $_POST['cf_redirect_url'] = 'http://' . $_POST['cf_redirect_url']; 
     16    } 
     17    if (!url_check_format($_POST['cf_redirect_url'])) 
     18    { 
     19      $page['errors'][] = l10n('Invalid redirect URL'); 
     20      $_POST['cf_redirect_url'] = $conf['ContactForm']['cf_redirect_url']; 
     21    } 
     22  } 
     23 
    924  $conf['ContactForm'] = array( 
    1025    'cf_must_initialize' =>   false, 
     
    1631    'cf_mandatory_name' =>    isset($_POST['cf_mandatory_name']), 
    1732    'cf_mail_type' =>         $_POST['cf_mail_type'], 
    18     'cf_redirect_url' =>      ($_POST['cf_redirect_url']!='http://') ? $_POST['cf_redirect_url'] : null, 
    19     'cf_theme' =>             $_POST['cf_theme'], 
     33    'cf_redirect_url' =>      $_POST['cf_redirect_url'], 
    2034    ); 
    2135  $conf['ContactForm_before'] = $_POST['cf_before']; 
    2236  $conf['ContactForm_after'] = $_POST['cf_after']; 
    23    
     37 
    2438  conf_update_param('ContactForm', serialize($conf['ContactForm'])); 
    2539  conf_update_param('ContactForm_before', $conf['ContactForm_before']); 
    2640  conf_update_param('ContactForm_after', $conf['ContactForm_after']); 
    27    
    28   $conf['ContactForm']['cf_ready'] = $was_ready; 
    29    
    30   array_push($page['infos'], l10n('Information data registered in database')); 
     41 
     42  $page['infos'][] = l10n('Information data registered in database'); 
    3143} 
    3244 
     
    4052 
    4153$template->set_filename('contact_form', realpath(CONTACT_FORM_PATH . 'admin/template/config.tpl')); 
    42  
    43 ?> 
  • extensions/ContactForm/admin/emails.php

    r23207 r25872  
    99  { 
    1010    if (isset($entry['delete'])) continue; 
    11      
    12     if ( empty($entry['email']) or !check_email_validity($entry['email']) ) 
     11 
     12    if ( empty($entry['email']) or !email_check_format($entry['email']) ) 
    1313    { 
    14       array_push($page['errors'], l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)')); 
     14      $page['errors'][] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'); 
    1515    } 
    1616    else 
    1717    { 
     18      if (empty($entry['name'])) $entry['name'] = $entry['email']; 
    1819      if ($entry['group_name'] == -1) $entry['group_name'] = null; 
    19        
    20       array_push($emails, array( 
     20 
     21      $emails[] = array( 
    2122        'name' => $entry['name'], 
    2223        'email' => $entry['email'], 
    2324        'group_name' => $entry['group_name'], 
    2425        'active' => boolean_to_string(isset($entry['active'])), 
    25         )); 
     26        ); 
    2627    } 
    2728  } 
    28    
     29 
    2930  pwg_query('TRUNCATE TABLE `'. CONTACT_FORM_TABLE. '`;'); 
    30    
     31 
    3132  mass_inserts( 
    3233    CONTACT_FORM_TABLE, 
     
    3435    $emails 
    3536    ); 
    36      
    37   $conf['ContactForm']['cf_ready'] = count($emails); 
    38    
    39   array_push($page['infos'], l10n('Information data registered in database')); 
     37 
     38  $conf['ContactForm_ready'] = count($emails); 
     39 
     40  $page['infos'][] = l10n('Information data registered in database'); 
    4041} 
    4142 
     
    5556{ 
    5657  $data['active'] = get_boolean($data['active']); 
    57   array_push($emails, $data); 
     58  $emails[] = $data; 
    5859  if (!empty($data['group_name'])) 
    5960  { 
    60     array_push($groups, $data['group_name']); 
     61    $groups[] = $data['group_name']; 
    6162  } 
    6263} 
     
    6869 
    6970$template->set_filename('contact_form', realpath(CONTACT_FORM_PATH . 'admin/template/emails.tpl')); 
    70  
    71 ?> 
  • extensions/ContactForm/admin/template/config.tpl

    r23205 r25872  
    1 {combine_css path=$CONTACT_FORM_PATH|@cat:"admin/template/style.css"} 
    2 {include file='include/colorbox.inc.tpl'} 
    3  
    4 {footer_script}{literal} 
    5 jQuery("a.preview-box").colorbox(); 
    6  
    7 jQuery("input[name='cf_theme']").change(function() { 
    8   jQuery("input[name='cf_theme']").parents(".themeBox").removeClass("themeDefault"); 
    9   jQuery(this).parents(".themeBox").addClass("themeDefault"); 
    10 }); 
    11 {/literal}{/footer_script} 
     1{combine_css path=$CONTACT_FORM_PATH|cat:"admin/template/style.css"} 
    122 
    133<div class="titrePage"> 
     
    177<form method="post" action="{$CONTACT_FORM_ADMIN}-config" class="properties"> 
    188  <fieldset> 
    19     <legend>{'General configuration'|@translate}</legend> 
     9    <legend>{'General configuration'|translate}</legend> 
    2010    <ul> 
    2111      <li> 
    2212        <label> 
    2313          <input type="checkbox" name="cf_menu_link" value="1" {if $cf_menu_link}checked="checked"{/if}> 
    24           {'Add link in menu'|@translate} 
     14          {'Add link in menu'|translate} 
    2515        </label> 
    2616      </li> 
     
    2818        <label> 
    2919          <input type="checkbox" name="cf_allow_guest" value="1" {if $cf_allow_guest}checked="checked"{/if}> 
    30           {'Allow guests to see the form'|@translate} 
     20          {'Allow guests to see the form'|translate} 
    3121        </label> 
    3222      </li> 
     
    3424        <label> 
    3525          <input type="checkbox" name="cf_mandatory_mail" value="1" {if $cf_mandatory_mail}checked="checked"{/if}> 
    36           {'E-mail address is mandatory'|@translate} 
     26          {'E-mail address is mandatory'|translate} 
    3727        </label> 
    3828      </li> 
     
    4030        <label> 
    4131          <input type="checkbox" name="cf_mandatory_name" value="1" {if $cf_mandatory_name}checked="checked"{/if}> 
    42           {'Name is mandatory'|@translate} 
     32          {'Name is mandatory'|translate} 
    4333        </label> 
    4434      </li> 
     
    4636        <label> 
    4737          <input type="text" name="cf_redirect_url" value="{if $cf_redirect_url}{$cf_redirect_url}{else}http://{/if}" size="50"> 
    48           {'Redirect after sending email (optional)'|@translate} 
     38          {'Redirect after sending email (optional)'|translate} 
    4939        </label> 
    5040      </li> 
    5141    </ul> 
    5242  </fieldset> 
    53    
     43 
    5444  <fieldset> 
    55     <legend>{'E-mail configuration'|@translate}</legend> 
     45    <legend>{'E-mail configuration'|translate}</legend> 
    5646    <ul> 
    5747      <li> 
    58         {'E-mail format :'|@translate} 
     48        {'E-mail format :'|translate} 
    5949        <label> 
    6050          <input type="radio" name="cf_mail_type" value="text/html" {if $cf_mail_type == 'text/html'}checked="checked"{/if}> 
     
    6353        <label> 
    6454          <input type="radio" name="cf_mail_type" value="text/plain" {if $cf_mail_type == 'text/plain'}checked="checked"{/if}> 
    65           {'Plain text'|@translate} 
     55          {'Plain text'|translate} 
    6656        </label> 
    6757      </li> 
     
    6959        <label> 
    7060          <input type="text" name="cf_default_subject" value="{$cf_default_subject}" size="50"> 
    71           {'Default e-mail subject'|@translate} ({'can be translated with LocalFiles Editor plugin'|@translate}) 
     61          {'Default e-mail subject'|translate} ({'can be translated with LocalFiles Editor plugin'|translate}) 
    7262        </label> 
    7363      </li> 
     
    7565        <label> 
    7666          <input type="text" name="cf_subject_prefix" value="{$cf_subject_prefix}" size="50"> 
    77           {'Prefix of the sent e-mail subject'|@translate} ({'you can use "%gallery_title%"'|@translate}) 
     67          {'Prefix of the sent e-mail subject'|translate} ({'you can use "%gallery_title%"'|translate}) 
    7868        </label> 
    7969      </li> 
    8070    </ul> 
    8171  </fieldset> 
    82    
     72 
    8373  <fieldset> 
    84     <legend>{'Theme'|@translate}</legend> 
    85      
    86     <div class="themeBoxes"> 
    87       <div class="themeBox {if $cf_theme=='clear'}themeDefault{/if}"> 
    88         <div class="themeName"><label> 
    89           <input type="radio" name="cf_theme" value="clear" {if $cf_theme=='clear'}checked{/if}> 
    90           Clear 
    91         </label></div> 
    92         <div class="themeShot"> 
    93           <a href="{$CONTACT_FORM_PATH}admin/template/prev-clear.jpg" class="preview-box"><img src="{$CONTACT_FORM_PATH}admin/template/prev-clear.jpg" width="150"/></a> 
    94         </div> 
    95       </div> 
    96       <div class="themeBox {if $cf_theme=='dark'}themeDefault{/if}"> 
    97         <div class="themeName"><label> 
    98           <input type="radio" name="cf_theme" value="dark" {if $cf_theme=='dark'}checked{/if}> 
    99           Dark 
    100         </label></div> 
    101         <div class="themeShot"> 
    102           <a href="{$CONTACT_FORM_PATH}admin/template/prev-dark.jpg" class="preview-box"><img src="{$CONTACT_FORM_PATH}admin/template/prev-dark.jpg" width="150"/></a> 
    103         </div> 
    104       </div> 
    105     </div> 
    106   </fieldset> 
    107    
    108   <fieldset> 
    109     <legend>{'Text before the contact form'|@translate}</legend> 
     74    <legend>{'Text before the contact form'|translate}</legend> 
    11075    <textarea rows="4" cols="80" class="description" name="cf_before">{$cf_before}</textarea> 
    11176  </fieldset> 
    11277 
    11378  <fieldset> 
    114     <legend>{'Text after the contact form'|@translate}</legend> 
     79    <legend>{'Text after the contact form'|translate}</legend> 
    11580    <textarea rows="4" cols="80" class="description" name="cf_after">{$cf_after}</textarea> 
    11681  </fieldset> 
    11782 
    118   <p style="text-align:left;"><input type="submit" name="save_config" value="{'Submit'|@translate}" class="submit"></p> 
     83  <p style="text-align:left;"><input type="submit" name="save_config" value="{'Submit'|translate}" class="submit"></p> 
    11984</form> 
  • extensions/ContactForm/admin/template/emails.tpl

    r18407 r25872  
    1 {combine_css path=$CONTACT_FORM_PATH|@cat:"admin/template/style.css"} 
    2  
     1{combine_css path=$CONTACT_FORM_PATH|cat:"admin/template/style.css"} 
    32 
    43<div class="titrePage"> 
     
    65</div> 
    76 
    8  
    97<form method="post" action="{$CONTACT_FORM_ADMIN}-emails" class="properties"> 
    108  <table class="table2" id="emails"> 
    119    <tr class="throw"> 
    12       <th>{'Name'|@translate}</th> 
    13       <th>{'Email address'|@translate}</th> 
    14       <th>{'Category'|@translate}</th> 
    15       <th>{'Active'|@translate}</th> 
    16       <th>{'Delete'|@translate}</th> 
     10      <th>{'Name'|translate}</th> 
     11      <th>{'Email address'|translate}</th> 
     12      <th>{'Category'|translate}</th> 
     13      <th>{'Active'|translate}</th> 
     14      <th>{'Delete'|translate}</th> 
    1715    </tr> 
    1816  {counter start=0 assign=i} 
     
    4240    <tr class="{if $i is odd}row1{else}row2{/if}" id="addEntryContainer"> 
    4341      <td colspan="2" style="text-align:center;"> 
    44         <a id="addEntry">{'+ Add an email'|@translate}</a> 
     42        <a id="addEntry">{'+ Add an email'|translate}</a> 
    4543      </td> 
    4644      <td> 
    47         <a id="addGroup">{'+ Add a category'|@translate}</a> 
     45        <a id="addGroup">{'+ Add a category'|translate}</a> 
    4846      </td> 
    4947      <td colspan="2"  style="text-align:center;"> 
    50         <input type="submit" name="save_emails" value="{'Submit'|@translate}" class="submit"> 
     48        <input type="submit" name="save_emails" value="{'Submit'|translate}" class="submit"> 
    5149      </td> 
    5250    </tr> 
     
    5654 
    5755<div class="infos tip"> 
    58 <b>{'Tip'|@translate}:</b> 
    59 {'Each category is displayed as a distinct "service" on the contact form (example: "Technical", "Commercial", "General question"). Using categories is not mandatory.'|@translate} 
     56<b>{'Tip'|translate}:</b> 
     57{'Each category is displayed as a distinct "service" on the contact form (example: "Technical", "Commercial", "General question"). Using categories is not mandatory.'|translate} 
    6058</div> 
    61  
    6259 
    6360 
     
    6865{/foreach} 
    6966 
    70 {literal} 
    71 var doBlink = function(obj,start,finish) { jQuery(obj).fadeOut(300).fadeIn(300); if(start!=finish) { start=start+1; doBlink(obj,start,finish); } }; 
    72 jQuery.fn.blink = function(start,finish) { return this.each(function() { doBlink(this,start,finish) }); }; 
     67var doBlink = function(obj,start,finish) { 
     68  jQuery(obj).fadeOut(300).fadeIn(300); 
     69  if(start!=finish) { 
     70    start=start+1; doBlink(obj,start,finish); 
     71  } 
     72}; 
     73jQuery.fn.blink = function(start,finish) { 
     74  return this.each(function() { 
     75    doBlink(this,start,finish); 
     76  }); 
     77}; 
    7378 
    7479jQuery(document).on('change', '.delete', function() { 
    7580  if ($(this).is(':checked')) { 
    7681    $(this).parents('tr').addClass('delete'); 
    77   } else { 
     82  } 
     83  else { 
    7884    $(this).parents('tr').removeClass('delete'); 
    7985  } 
     
    8389  entry++; 
    8490  i = entry; 
    85    
     91 
    8692  content = 
    8793    '<tr class="row'+ (i%2+1) +'">'+ 
     
    108114    '</tr>' 
    109115  $('#emails').append(content); 
    110      
     116 
    111117  $('#addEntryContainer') 
    112118    .removeClass('row1 row2') 
     
    116122 
    117123jQuery('#addGroup').click(function() { 
    118   name = prompt("{/literal}{'Name'|@translate}{literal}:"); 
     124  name = prompt("{'Name'|translate}:"); 
    119125  if (name != null && name != "") { 
    120126    name = name.replace(new RegExp('"','g'),"'"); 
     
    124130  } 
    125131}); 
    126 {/literal}{/footer_script} 
     132{/footer_script} 
  • extensions/ContactForm/admin/template/style.css

    r23205 r25872  
    2626  border-radius:5px; 
    2727} 
    28  
    29 .themeBox { 
    30   height:auto; 
    31   padding-bottom:5px; 
    32 } 
  • extensions/ContactForm/include/contact_form.inc.php

    r23207 r25872  
    44global $template, $user, $conf, $page, $pwg_loaded_plugins; 
    55 
    6 if ( (!is_classic_user() and !$conf['ContactForm']['cf_allow_guest']) or !$conf['ContactForm']['cf_ready'] ) 
     6if ( (!is_classic_user() and !$conf['ContactForm']['cf_allow_guest']) or !$conf['ContactForm_ready'] ) 
    77{ 
    88  redirect(get_absolute_root_url()); 
     
    2222    'send_copy' => isset($_POST['send_copy']), 
    2323   ); 
    24    
     24 
    2525  $comment_action = send_contact_form($contact, @$_POST['key']); 
    2626 
     
    105105  )); 
    106106 
    107 $template->set_filename('index', realpath(CONTACT_FORM_PATH . 'template/contact_form.tpl')); 
    108  
    109 ?> 
     107$template->set_filename('contactform', realpath(CONTACT_FORM_PATH . 'template/contact_form.tpl')); 
     108$template->assign_var_from_handle('CONTENT', 'contactform'); 
  • extensions/ContactForm/include/functions.inc.php

    r24347 r25872  
    88{ 
    99  global $tokens, $page, $conf; 
    10    
     10 
    1111  if ($tokens[0] == 'contact') 
    1212  { 
    13     add_event_handler('loc_begin_page_header', 'contact_form_header'); 
    14      
    1513    $page['section'] = 'contact'; 
     14    $page['title'] = l10n('Contact'); 
     15    $page['body_id'] = 'theContactPage'; 
     16    $page['is_external'] = true; 
    1617    $page['is_homepage'] = false; 
    17      
    18     $page['title'] = l10n('Contact'); 
    19     $page['section_title'] = $page['section_title'] = '<a href="'.get_absolute_root_url().'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.CONTACT_FORM_PUBLIC.'">'.l10n('Contact').'</a>';   
    20   } 
    21 } 
    22 function contact_form_header() 
     18 
     19    $page['section_title'] = '<a href="'.get_absolute_root_url().'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.CONTACT_FORM_PUBLIC.'">'.l10n('Contact').'</a>'; 
     20  } 
     21} 
     22 
     23/** 
     24 * contact page 
     25 */ 
     26function contact_form_page() 
    2327{ 
    2428  global $page; 
    25   $page['body_id'] = 'theContactPage'; 
    26 } 
    27  
    28 /** 
    29  * contact page  
    30  */ 
    31 function contact_form_page() 
    32 { 
    33   global $page; 
    3429 
    3530  if (isset($page['section']) and $page['section'] == 'contact') 
    3631  { 
    37     include(CONTACT_FORM_PATH . '/include/contact_form.inc.php'); 
    38   } 
    39 } 
    40  
    41 /**  
    42  * public menu link  
     32    include(CONTACT_FORM_PATH . 'include/contact_form.inc.php'); 
     33  } 
     34} 
     35 
     36/** 
     37 * public menu link 
    4338 */ 
    4439function contact_form_applymenu($menu_ref_arr) 
    4540{ 
    4641  global $conf; 
    47    
    48   if ( !$conf['ContactForm']['cf_menu_link'] ) return; 
    49   if ( !is_classic_user() and !$conf['ContactForm']['cf_allow_guest'] ) return; 
    50   if ( !$conf['ContactForm']['cf_ready'] ) return; 
     42 
     43  if (!$conf['ContactForm']['cf_menu_link']) return; 
     44  if (!is_classic_user() and !$conf['ContactForm']['cf_allow_guest']) return; 
     45  if (!$conf['ContactForm_ready']) return; 
    5146 
    5247  $menu = &$menu_ref_arr[0]; 
    5348  if (($block = $menu->get_block('mbMenu')) != null) 
    5449  { 
    55     array_push($block->data, array( 
     50    $block->data[] = array( 
    5651      'URL' => CONTACT_FORM_PUBLIC, 
    5752      'NAME' => l10n('Contact'), 
    58     )); 
    59   } 
    60 } 
    61  
    62 /** 
    63  * change contact on link on footer 
     53      ); 
     54  } 
     55} 
     56 
     57/** 
     58 * change contact link in footer 
    6459 */ 
    6560function contact_form_footer_link($content, &$smarty) 
    6661{ 
    6762  $search = '<a href="mailto:{$CONTACT_MAIL}?subject={\'A comment on your site\'|@translate|@escape:url}">'; 
    68   $replace = '<a href="'.CONTACT_FORM_PUBLIC.'">'; 
     63  $replace = '<a href="{$CONTACT_FORM_PUBLIC}">'; 
    6964  return str_replace($search, $replace, $content); 
    7065} 
    7166 
    7267/** 
     68 * change contact link in mail footer 
     69 */ 
     70function contact_form_mail_template($cache_key, $content_type) 
     71{ 
     72  global $conf_mail; 
     73 
     74  $template = &$conf_mail[$cache_key]['theme']; 
     75  $template->assign('CONTACT_FORM_PUBLIC', CONTACT_FORM_PUBLIC); 
     76 
     77  if ($content_type == 'text/html') 
     78  { 
     79    $template->set_prefilter('mail_footer', 'contact_form_mail_template_html'); 
     80  } 
     81  else 
     82  { 
     83    $template->set_prefilter('mail_footer', 'contact_form_mail_template_plain'); 
     84  } 
     85} 
     86function contact_form_mail_template_html($content) 
     87{ 
     88  return str_replace( 
     89    'mailto:{$CONTACT_MAIL}?subject={\'A comment on your site\'|translate|escape:url}', 
     90    '{$CONTACT_FORM_PUBLIC}', 
     91    $content 
     92    ); 
     93} 
     94function contact_form_mail_template_plain($content) 
     95{ 
     96  return str_replace( 
     97    '{$CONTACT_MAIL}', 
     98    '{$CONTACT_FORM_PUBLIC}', 
     99    $content 
     100    ); 
     101} 
     102 
     103/** 
    73104 * init emails list 
    74105 */ 
     
    76107{ 
    77108  global $conf; 
    78    
     109 
    79110  $query = ' 
    80111SELECT 
     
    89120;'; 
    90121  $result = pwg_query($query); 
    91    
     122 
    92123  $emails = array(); 
    93124  while ($row = pwg_db_fetch_assoc($result)) 
    94125  { 
    95     array_push($emails, array( 
     126    $emails[] = array( 
    96127      'name' => $row['username'], 
    97128      'email' => $row['email'], 
    98129      'active' => 'true', 
    99       )); 
    100   } 
    101    
     130      ); 
     131  } 
     132 
    102133  mass_inserts( 
    103134    CONTACT_FORM_TABLE, 
     
    105136    $emails 
    106137    ); 
    107    
     138 
    108139  $conf['ContactForm']['cf_must_initialize'] = false; 
    109140  conf_update_param('ContactForm', serialize($conf['ContactForm'])); 
     
    116147function send_contact_form(&$comm, $key) 
    117148{ 
    118   global $conf, $page, $template, $conf_mail; 
    119    
    120   if (!isset($conf_mail)) 
    121   { 
    122     $conf_mail = get_mail_configuration(); 
    123   } 
    124    
     149  global $conf, $page, $template; 
     150 
    125151  $query = ' 
    126152SELECT DISTINCT group_name 
     
    129155;'; 
    130156  $groups = array_from_query($query, 'group_name'); 
    131    
     157 
    132158  $comm = array_merge($comm, 
    133159    array( 
     
    138164 
    139165  $comment_action='validate'; 
    140    
     166 
    141167  // check key 
    142168  if (!verify_ephemeral_key(@$key)) 
     
    146172 
    147173  // check author 
    148   if ( $conf['ContactForm']['cf_mandatory_name'] and empty($comm['author']) ) 
    149   { 
    150     array_push($page['errors'], l10n('Please enter a name')); 
    151     $comment_action='reject'; 
    152   } 
    153    
     174  if ($conf['ContactForm']['cf_mandatory_name'] and empty($comm['author'])) 
     175  { 
     176    $page['errors'][] = l10n('Please enter a name'); 
     177    $comment_action='reject'; 
     178  } 
     179 
    154180  // check email 
    155   if ( $conf['ContactForm']['cf_mandatory_mail'] and empty($comm['email']) ) 
    156   { 
    157     array_push($page['errors'], l10n('Please enter an e-mail')); 
    158     $comment_action='reject'; 
    159   } 
    160   else if ( !empty($comm['email']) and !check_email_validity($comm['email']) ) 
    161   { 
    162     array_push($page['errors'], l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)')); 
     181  if ($conf['ContactForm']['cf_mandatory_mail'] and empty($comm['email'])) 
     182  { 
     183    $page['errors'][] = l10n('Please enter an e-mail'); 
     184    $comment_action='reject'; 
     185  } 
     186  else if (!empty($comm['email']) and !email_check_format($comm['email'])) 
     187  { 
     188    $page['errors'][] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'); 
    163189    $comment_action='reject'; 
    164190  } 
     
    167193  if (empty($comm['subject'])) 
    168194  { 
    169     array_push($page['errors'], l10n('Please enter a subject')); 
     195    $page['errors'][] = l10n('Please enter a subject'); 
    170196    $comment_action='reject'; 
    171197  } 
    172198  else if (strlen($comm['subject']) > 100) 
    173199  { 
    174     array_push($page['errors'], sprintf(l10n('%s must not be more than %d characters long'), l10n('Subject'), 100)); 
    175     $comment_action='reject'; 
    176   } 
    177    
     200    $page['errors'][] = sprintf(l10n('%s must not be more than %d characters long'), l10n('Subject'), 100); 
     201    $comment_action='reject'; 
     202  } 
     203 
    178204  // check group 
    179   if ( count($groups) > 1 and $comm['group'] == -1 ) 
     205  if (count($groups) > 1 and $comm['group'] == -1) 
    180206  { 
    181207    $comm['group'] = true; 
    182     array_push($page['errors'], l10n('Please choose a category')); 
    183     $comment_action='reject'; 
    184   } 
    185    
     208    $page['errors'][] = l10n('Please choose a category'); 
     209    $comment_action='reject'; 
     210  } 
     211 
    186212  // check content 
    187213  if (empty($comm['content'])) 
    188214  { 
    189     array_push($page['errors'], l10n('Please enter a message')); 
     215    $page['errors'][] = l10n('Please enter a message'); 
    190216    $comment_action='reject'; 
    191217  } 
    192218  else if (strlen($comm['subject']) > 2000) 
    193219  { 
    194     array_push($page['errors'], sprintf(l10n('%s must not be more than %d characters long'), l10n('Message'), 2000)); 
    195     $comment_action='reject'; 
    196   } 
    197    
     220    $page['errors'][] = sprintf(l10n('%s must not be more than %d characters long'), l10n('Message'), 2000); 
     221    $comment_action='reject'; 
     222  } 
     223 
    198224  include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php'); 
    199225  include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 
    200    
     226 
    201227  add_event_handler('contact_form_check', 'user_comment_check', 
    202228    EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 
    203    
     229 
    204230  // perform more spam check 
    205231  $comment_action = trigger_event('contact_form_check', $comment_action, $comm); 
    206    
     232 
    207233  // get admin emails 
    208234  $emails = get_contact_emails($comm['group']); 
    209235  if (!count($emails)) 
    210236  { 
    211     array_push($page['errors'], l10n('Error while sending e-mail')); 
     237    $page['errors'][] = l10n('Error while sending e-mail'); 
    212238    $comment_action='reject'; 
    213239  } 
     
    215241  if ($comment_action == 'validate') 
    216242  { 
    217     // format subject 
    218243    $prefix = str_replace('%gallery_title%', $conf['gallery_title'], $conf['ContactForm']['cf_subject_prefix']); 
    219     $subject = '['.$prefix.'] '.$comm['subject']; 
    220     $subject = trim(preg_replace('#[\n\r]+#s', '', $subject)); 
    221     $subject = encode_mime_header($subject); 
    222      
    223     // format content 
    224     $comm['content'] = trigger_event('render_contact_content', $comm['content']); 
    225     if ($conf['ContactForm']['cf_mail_type'] == 'text/html') 
     244 
     245    $from = $Cc = null; 
     246    if (!empty($comm['email'])) 
    226247    { 
    227       $comm['content'] = nl2br($comm['content']); 
     248      $from = array( 
     249        'name' => $comm['author'], 
     250        'email' => $comm['email'], 
     251        ); 
     252      if ($comm['send_copy']) 
     253      { 
     254        $Cc = $from; 
     255      } 
    228256    } 
    229      
    230     // format expeditor 
    231     if (empty($comm['email'])) 
    232     { 
    233       $args['from'] = $conf_mail['formated_email_webmaster']; 
    234     } 
    235     else 
    236     { 
    237       $args['from'] = format_email($comm['author'], $comm['email']); 
    238     } 
    239      
    240     // hearders 
    241     $headers = 'From: '.$args['from']."\n";   
    242     $headers.= 'MIME-Version: 1.0'."\n"; 
    243     $headers.= 'X-Mailer: Piwigo Mailer'."\n"; 
    244     $headers.= 'Content-Transfer-Encoding: 8bit'."\n"; 
    245     $headers.= 'Content-Type: '.$conf['ContactForm']['cf_mail_type'].'; charset="'.get_pwg_charset().'";'."\n"; 
    246      
    247     set_make_full_url(); 
     257 
    248258    switch_lang_to(get_default_language()); 
    249259    load_language('plugin.lang', CONTACT_FORM_PATH); 
    250      
    251     // template 
    252     if ($conf['ContactForm']['cf_mail_type'] == 'text/html') 
    253     { 
    254       $mail_css = file_get_contents(dirname(__FILE__).'/../template/mail/style-'.$conf['ContactForm']['cf_theme'].'.css'); 
    255       $template->set_filename('contact_mail', dirname(__FILE__).'/../template/mail/content_html.tpl'); 
    256     } 
    257     else 
    258     { 
    259       $mail_css = null; 
    260       $template->set_filename('contact_mail', dirname(__FILE__).'/../template/mail/content_plain.tpl'); 
    261     } 
    262      
    263     $comm['show_ip'] = isset($conf['contact_form_show_ip']) ? $conf['contact_form_show_ip'] : false; 
    264      
    265     $template->assign(array( 
    266       'cf_prefix' => $prefix, 
    267       'contact' => $comm, 
    268       'GALLERY_URL' => get_gallery_home_url(), 
    269       'PHPWG_URL' => PHPWG_URL, 
    270       'CONTACT_MAIL_CSS' => $mail_css, 
    271       )); 
    272      
    273     // mail content 
    274     $content = $template->parse('contact_mail', true); 
    275     $content = wordwrap($content, 70, "\n", true); 
    276      
    277     // send mail 
    278     $result = 
    279       trigger_event('send_mail', 
    280         false, /* Result */ 
    281         trigger_event('send_mail_to', implode(',', $emails)), 
    282         trigger_event('send_mail_subject', $subject), 
    283         trigger_event('send_mail_content', $content), 
    284         trigger_event('send_mail_headers', $headers), 
    285         $args 
     260 
     261    $result = pwg_mail( 
     262      $emails, 
     263      array( 
     264        'subject' => '['.$prefix.'] '.$comm['subject'], 
     265        'mail_title' => $prefix, 
     266        'mail_subtitle' => $comm['subject'], 
     267        'content_format' => 'text/html', 
     268        'from' => $from, 
     269        'Cc' => $Cc, 
     270        ), 
     271      array( 
     272        'filename' => 'mail', 
     273        'dirname' => realpath(CONTACT_FORM_PATH . 'template'), 
     274        'assign' => array( 
     275          'CONTACT' => $comm, 
     276          ), 
     277        ) 
    286278      ); 
    287        
    288     if ( $comm['send_copy'] and !empty($comm['email']) ) 
    289     { 
    290       trigger_event('send_mail', 
    291         false, /* Result */ 
    292         trigger_event('send_mail_to', $args['from']), 
    293         trigger_event('send_mail_subject', $subject), 
    294         trigger_event('send_mail_content', $content), 
    295         trigger_event('send_mail_headers', $headers), 
    296         $args 
    297       ); 
    298     } 
    299      
    300     unset_make_full_url(); 
     279 
    301280    switch_lang_back(); 
    302281    load_language('plugin.lang', CONTACT_FORM_PATH); 
    303      
     282 
    304283    if ($result == false) 
    305284    { 
    306       array_push($page['errors'], l10n('Error while sending e-mail')); 
     285      $page['errors'][] = l10n('Error while sending e-mail'); 
    307286      $comment_action='reject'; 
    308287    } 
    309288  } 
    310    
     289 
    311290  return $comment_action; 
    312291} 
     
    322301{ 
    323302  global $conf; 
    324    
     303 
    325304  include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 
    326    
     305 
    327306  $where = '1=1'; 
    328307  if ($group!==true) 
     
    337316    } 
    338317  } 
    339    
     318 
    340319  $query = ' 
    341 SELECT * 
     320SELECT name, email 
    342321  FROM '. CONTACT_FORM_TABLE .' 
    343   WHERE  
     322  WHERE 
    344323    '.$where.' 
    345324    AND active = "true" 
    346325  ORDER BY name ASC 
    347326'; 
    348   $result = pwg_query($query); 
    349    
    350   $emails = array(); 
    351   while ($data = pwg_db_fetch_assoc($result)) 
    352   { 
    353     array_push($emails, format_email($data['name'], $data['email'])); 
    354   } 
    355    
     327  $emails = array_from_query($query); 
     328 
    356329  return $emails; 
    357330} 
    358  
    359  
    360 /** 
    361  * check if email is valid  
    362  */ 
    363 function check_email_validity($mail_address) 
    364 { 
    365   if (function_exists('email_check_format')) 
    366   { 
    367     return email_check_format($mail_address); // Piwigo 2.5 
    368   } 
    369   else if (version_compare(PHP_VERSION, '5.2.0') >= 0) 
    370   { 
    371     return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false; 
    372   } 
    373   else 
    374   { 
    375     $atom   = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';   // before  arobase 
    376     $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name 
    377     $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i'; 
    378  
    379     return (bool)preg_match($regex, $mail_address); 
    380   } 
    381 } 
    382  
    383 ?> 
  • extensions/ContactForm/language/en_UK/plugin.lang.php

    r19180 r25872  
    5959$lang['Send'] = 'Send'; 
    6060$lang['Send copy to my email'] = 'Send copy to my email'; 
     61$lang['Invalid redirect URL'] = 'Invalid redirect URL'; 
     62$lang['Name'] = 'Name'; 
    6163 
    6264?> 
  • extensions/ContactForm/language/fr_FR/plugin.lang.php

    r19180 r25872  
    6060$lang['Send'] = 'Envoyer'; 
    6161$lang['Send copy to my email'] = 'Envoyer une copie à mon email'; 
     62$lang['Invalid redirect URL'] = 'URL de redirection invalide'; 
     63$lang['Name'] = 'Nom'; 
    6264 
    6365?> 
  • extensions/ContactForm/main.inc.php

    r24347 r25872  
    3131  add_event_handler('loc_end_section_init', 'contact_form_section_init'); 
    3232  add_event_handler('loc_end_index', 'contact_form_page'); 
    33   add_event_handler('blockmanager_apply', 'contact_form_applymenu', EVENT_HANDLER_PRIORITY_NEUTRAL+10); 
    3433} 
     34 
     35add_event_handler('blockmanager_apply', 'contact_form_applymenu', EVENT_HANDLER_PRIORITY_NEUTRAL+10); 
     36add_event_handler('before_parse_mail_template', 'contact_form_mail_template', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 
    3537 
    3638include(CONTACT_FORM_PATH . 'include/functions.inc.php'); 
     
    4345{ 
    4446  global $conf, $template, $pwg_loaded_plugins; 
    45    
    46   if ( 
    47     CONTACT_FORM_VERSION == 'auto' or 
    48     $pwg_loaded_plugins[CONTACT_FORM_ID]['version'] == 'auto' or 
    49     version_compare($pwg_loaded_plugins[CONTACT_FORM_ID]['version'], CONTACT_FORM_VERSION, '<') 
    50   ) 
    51   { 
    52     include_once(CONTACT_FORM_PATH . 'include/install.inc.php'); 
    53     contact_form_install(); 
    54      
    55     if ( $pwg_loaded_plugins[CONTACT_FORM_ID]['version'] != 'auto' and CONTACT_FORM_VERSION != 'auto' ) 
    56     { 
    57       $query = ' 
    58 UPDATE '. PLUGINS_TABLE .' 
    59 SET version = "'. CONTACT_FORM_VERSION .'" 
    60 WHERE id = "'. CONTACT_FORM_ID .'"'; 
    61       pwg_query($query); 
    62        
    63       $pwg_loaded_plugins[CONTACT_FORM_ID]['version'] = CONTACT_FORM_VERSION; 
    64        
    65       if (defined('IN_ADMIN')) 
    66       { 
    67         $_SESSION['page_infos'][] = 'ContactForm updated to version '. CONTACT_FORM_VERSION; 
    68       } 
    69     } 
    70   } 
    71    
     47 
     48  include_once(CONTACT_FORM_PATH . 'maintain.inc.php'); 
     49  $maintain = new ContactForm_maintain(CONTACT_FORM_ID); 
     50  $maintain->autoUpdate(CONTACT_FORM_VERSION, 'install'); 
     51 
    7252  $conf['ContactForm'] = unserialize($conf['ContactForm']); 
    7353  load_language('plugin.lang', CONTACT_FORM_PATH); 
    7454  load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true)); 
    75    
     55 
    7656  if ($conf['ContactForm']['cf_must_initialize']) 
    7757  { 
    7858    contact_form_initialize_emails(); 
    7959  } 
    80    
    81   $conf['ContactForm']['cf_ready'] = count(get_contact_emails()); 
    82    
    83   if ($conf['ContactForm']['cf_ready'] && (!is_a_guest() || $conf['ContactForm']['cf_allow_guest'])) 
     60 
     61  $conf['ContactForm_ready'] = count(get_contact_emails()); 
     62 
     63  if ($conf['ContactForm_ready'] && (!is_a_guest() || $conf['ContactForm']['cf_allow_guest'])) 
    8464  { 
    85     $template->assign('CONTACT_MAIL', true); 
     65    $template->assign(array( 
     66      'CONTACT_MAIL' => true, 
     67      'CONTACT_FORM_PUBLIC' => CONTACT_FORM_PUBLIC, 
     68      )); 
    8669    $template->set_prefilter('tail', 'contact_form_footer_link'); 
    8770  } 
     
    8972 
    9073/** 
    91  * admin plugins menu link  
     74 * admin plugins menu link 
    9275 */ 
    93 function contact_form_admin_menu($menu)  
     76function contact_form_admin_menu($menu) 
    9477{ 
    95   array_push($menu, array( 
     78  $menu[] = array( 
    9679    'URL' => CONTACT_FORM_ADMIN, 
    9780    'NAME' => 'Contact Form', 
    98   )); 
     81  ); 
    9982  return $menu; 
    10083} 
    101  
    102 ?> 
  • extensions/ContactForm/maintain.inc.php

    r24348 r25872  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
    33 
    4 defined('CONTACT_FORM_ID') or define('CONTACT_FORM_ID', basename(dirname(__FILE__))); 
    5 include_once(PHPWG_PLUGINS_PATH . CONTACT_FORM_ID . '/include/install.inc.php'); 
     4class ContactForm_maintain extends PluginMaintain 
     5{ 
     6  private $installed = false; 
    67 
    7 function plugin_install()  
    8 { 
    9   contact_form_install(); 
    10   define('contact_form_installed', true); 
    11 } 
     8  function install($plugin_version, &$errors=array()) 
     9  { 
     10    global $conf, $prefixeTable; 
    1211 
    13 function plugin_activate() 
    14 { 
    15   if (!defined('contact_form_installed')) 
     12    // email table 
     13  $query = ' 
     14CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'contact_form` ( 
     15  `id` smallint(5) NOT NULL AUTO_INCREMENT, 
     16  `name` varchar(128) NOT NULL, 
     17  `email` varchar(128) NOT NULL, 
     18  `active` enum("true","false") NOT NULL DEFAULT "true", 
     19  `group_name` varchar(128) DEFAULT NULL, 
     20  PRIMARY KEY (`id`), 
     21  UNIQUE KEY `UNIQUE` (`email`,`group_name`) 
     22) ENGINE=MyISAM DEFAULT CHARSET=utf8;'; 
     23    pwg_query($query); 
     24 
     25    // configuration 
     26    if (empty($conf['ContactForm'])) 
     27    { 
     28      $conf['ContactForm'] = serialize(array( 
     29        'cf_must_initialize' => true, 
     30        'cf_menu_link' => true, 
     31        'cf_subject_prefix' => '%gallery_title%', 
     32        'cf_default_subject' => 'A comment on your site', 
     33        'cf_allow_guest' => true, 
     34        'cf_mandatory_mail' => true, 
     35        'cf_mandatory_name' => true, 
     36        'cf_mail_type' => 'text/html', 
     37        'cf_redirect_url' => null, 
     38        )); 
     39 
     40      $conf['ContactForm_before'] = null; 
     41      $conf['ContactForm_after'] = null; 
     42 
     43      conf_update_param('ContactForm', $conf['ContactForm']); 
     44      conf_update_param('ContactForm_before', $conf['ContactForm_before']); 
     45      conf_update_param('ContactForm_after', $conf['ContactForm_after']); 
     46    } 
     47    else 
     48    { 
     49      $new_conf = is_string($conf['ContactForm']) ? unserialize($conf['ContactForm']) : $conf['ContactForm']; 
     50 
     51      // migration 2.4 -> 2.5 
     52      if (!isset($new_conf['cf_must_initialize'])) 
     53      { 
     54        // new params 
     55        $new_conf['cf_default_subject'] = 'A comment on your site'; 
     56        $new_conf['cf_mail_type'] = 'text/html'; 
     57        $new_conf['cf_redirect_url'] = null; 
     58 
     59        // move emails to database 
     60        $emails = array(); 
     61        foreach ($new_conf['cf_admin_mails'] as $email => $data) 
     62        { 
     63          $emails[] = array( 
     64            'email' => $email, 
     65            'name' => $data['NAME'], 
     66            'active' => boolean_to_string($data['ACTIVE']), 
     67            ); 
     68        } 
     69 
     70        $new_conf['cf_must_initialize'] = empty($emails); 
     71 
     72        mass_inserts( 
     73          $prefixeTable .'contact_form', 
     74          array('name','email','active'), 
     75          $emails 
     76          ); 
     77 
     78        // old params 
     79        unset( 
     80          $new_conf['comment'], $new_conf['cf_redirect_delay'], 
     81          $new_conf['cf_separator'], $new_conf['cf_separator_length'], 
     82          $new_conf['cf_admin_mails'] 
     83          ); 
     84 
     85        // save config 
     86        $conf['ContactForm_before'] = stripslashes(@$conf['persoformtop']); 
     87        $conf['ContactForm_after'] = stripslashes(@$conf['persoformbottom']); 
     88 
     89        conf_update_param('ContactForm_before', $conf['ContactForm_before']); 
     90        conf_update_param('ContactForm_after', $conf['ContactForm_after']); 
     91 
     92        conf_delete_param(array('persoformtop','persoformbottom')); 
     93      } 
     94 
     95      // save config 
     96      $conf['ContactForm'] = serialize($new_conf); 
     97      conf_update_param('ContactForm', $conf['ContactForm']); 
     98    } 
     99 
     100    // just in case something went wrong in a previous version 
     101    if (empty($conf['ContactForm_before'])) 
     102    { 
     103      $conf['ContactForm_before'] = null; 
     104      conf_update_param('ContactForm_before', $conf['ContactForm_before']); 
     105    } 
     106 
     107    if (empty($conf['ContactForm_after'])) 
     108    { 
     109      $conf['ContactForm_after'] = null; 
     110      conf_update_param('ContactForm_after', $conf['ContactForm_after']); 
     111    } 
     112  } 
     113 
     114  function activate($plugin_version, &$errors=array()) 
    16115  { 
    17     contact_form_install(); 
     116    if (!$this->installed) 
     117    { 
     118      $this->install($plugin_version, $errors); 
     119    } 
     120  } 
     121 
     122  function deactivate() 
     123  { 
     124  } 
     125 
     126 
     127  function uninstall() 
     128  { 
     129    global $prefixeTable; 
     130 
     131    pwg_query('DROP TABLE IF EXISTS `'. $prefixeTable .'contact_form`;'); 
     132 
     133    conf_delete_param(array('ContactForm','ContactForm_before','ContactForm_after')); 
    18134  } 
    19135} 
    20  
    21 function plugin_uninstall()  
    22 { 
    23   global $prefixeTable, $conf; 
    24    
    25   pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param LIKE "ContactForm%";'); 
    26   pwg_query('DROP TABLE IF EXISTS `'. $prefixeTable .'contact_form`;'); 
    27    
    28   unset($conf['ContactForm'], $conf['ContactForm_before'], $conf['ContactForm_after']); 
    29 } 
    30  
    31 ?> 
  • extensions/ContactForm/template/contact_form.tpl

    r19180 r25872  
    1 {combine_css path=$CONTACT_FORM_PATH|@cat:"template/style.css"} 
    2 {combine_script id="livevalidation" load="footer" path=$CONTACT_FORM_PATH|@cat:"template/livevalidation.min.js"} 
     1{combine_css path=$CONTACT_FORM_PATH|cat:"template/style.css"} 
     2{combine_script id="livevalidation" load="footer" path=$CONTACT_FORM_PATH|cat:"template/livevalidation.min.js"} 
    33 
    44{footer_script require='livevalidation'} 
    55{if $contact.mandatory_name and !$contact.is_logged} 
    66var author = new LiveValidation('author', {ldelim} onlyOnSubmit: true }); 
    7 author.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a name'|@translate}" }); 
     7author.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a name'|translate}" }); 
    88{/if} 
    99 
    1010{if $contact.mandatory_mail and (!$contact.is_logged or empty($contact.email))} 
    1111var email = new LiveValidation('email', {ldelim} onlyOnSubmit: true }); 
    12 email.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter an e-mail'|@translate}" }); 
    13 email.add(Validate.Email, {ldelim} failureMessage: "{'mail address must be like xxx@yyy.eee (example : jack@altern.org)'|@translate}" }); 
     12email.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter an e-mail'|translate}" }); 
     13email.add(Validate.Email, {ldelim} failureMessage: "{'mail address must be like xxx@yyy.eee (example : jack@altern.org)'|translate}" }); 
    1414{/if} 
    1515 
    1616{if $GROUPS} 
    1717var group = new LiveValidation('group', {ldelim} onlyOnSubmit: true }) 
    18 group.add(Validate.Exclusion, {ldelim} within: ['-1'], failureMessage: "{'Please choose a category'|@translate}" }); 
     18group.add(Validate.Exclusion, {ldelim} within: ['-1'], failureMessage: "{'Please choose a category'|translate}" }); 
    1919{/if} 
    2020 
    2121var subject = new LiveValidation('subject', {ldelim} onlyOnSubmit: true }); 
    22 subject.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a subject'|@translate}" }); 
     22subject.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a subject'|translate}" }); 
    2323subject.add(Validate.Length, {ldelim} maximum: 100, 
    24   tooLongMessage: "{'%s must not be more than %d characters long'|@translate|@sprintf:'':100}"  
     24  tooLongMessage: "{'%s must not be more than %d characters long'|translate:'':100}" 
    2525  }); 
    2626 
    2727var content = new LiveValidation('cf_content', {ldelim} onlyOnSubmit: true }); 
    28 content.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a message'|@translate}" }); 
     28content.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a message'|translate}" }); 
    2929content.add(Validate.Length, {ldelim} maximum: 2000, 
    30   tooLongMessage: "{'%s must not be more %d characters long'|@translate|@sprintf:'':2000}", 
     30  tooLongMessage: "{'%s must not be more than %d characters long'|translate:'':2000}", 
    3131  }); 
    3232{/footer_script} 
    3333 
    34  
    35 {* <!-- Menubar & titrePage --> *} 
    36 {if $themeconf.name == "stripped" or $themeconf.parent == "stripped"} 
    37   {include file=$CONTACT_FORM_ABS_PATH|@cat:'template/themes/stripped.tpl'} 
    38   {assign var="clear" value="true"} 
    39 {elseif $themeconf.name == "simple-grey" or $themeconf.parent == "simple"} 
    40   {include file=$CONTACT_FORM_ABS_PATH|@cat:'template/themes/simple.tpl'} 
    41   {assign var="clear" value="true"} 
    42 {else} 
    43   {include file=$CONTACT_FORM_ABS_PATH|@cat:'template/themes/default.tpl'} 
    44 {/if} 
    45  
    46  
    47 {if isset($errors) or not empty($infos)} 
    48 {include file='infos_errors.tpl'} 
    49 {/if} 
    5034 
    5135{if $ContactForm_before} 
     
    5741    <table> 
    5842      <tr> 
    59         <td class="title"><label for="author">{'Your name'|@translate}</label></td> 
     43        <td class="title"><label for="author">{'Your name'|translate}</label></td> 
    6044        <td> 
    6145        {if $contact.is_logged} 
     
    6852      </tr> 
    6953      <tr> 
    70         <td class="title"><label for="email">{'Your e-mail'|@translate}</label></td> 
     54        <td class="title"><label for="email">{'Your e-mail'|translate}</label></td> 
    7155        <td> 
    7256        {if $contact.is_logged and !empty($contact.email)} 
     
    8064      {if $GROUPS} 
    8165      <tr> 
    82         <td class="title"><label for="group">{'Category'|@translate}</label></td> 
     66        <td class="title"><label for="group">{'Category'|translate}</label></td> 
    8367        <td> 
    8468          <select name="group" id="group"> 
     
    9074      {/if} 
    9175      <tr> 
    92         <td class="title"><label for="subject">{'Subject'|@translate}</label></td> 
     76        <td class="title"><label for="subject">{'Subject'|translate}</label></td> 
    9377        <td><input type="text" name="subject" id="subject" style="width:400px;" value="{$contact.subject}"></td> 
    9478      </tr> 
    9579      <tr> 
    96         <td class="title"><label for="cf_content">{'Message'|@translate}</label></td> 
     80        <td class="title"><label for="cf_content">{'Message'|translate}</label></td> 
    9781        <td><textarea name="content" id="cf_content" rows="10" style="width:400px;">{$contact.content}</textarea></td> 
    9882      </tr> 
     
    10084        <td class="title">&nbsp;</td> 
    10185        <td> 
    102           <input class="submit" type="submit" name="send_mail" value="{'Send'|@translate}"> 
    103           <label><input type="checkbox" name="send_copy"> {'Send copy to my email'|@translate}</label> 
     86          <input class="submit" type="submit" name="send_mail" value="{'Send'|translate}"> 
     87          <label><input type="checkbox" name="send_copy"> {'Send copy to my email'|translate}</label> 
    10488        </td> 
    10589      </tr> 
    10690    </table> 
    107      
     91 
    10892    <input type="hidden" name="key" value="{$KEY}" /> 
    10993  </form> 
     
    11397<div class="contact desc">{$ContactForm_after}</div> 
    11498{/if} 
    115  
    116 {if $clear}<div style="clear: both;"></div> 
    117 </div>{/if} 
    118 </div>{* <!-- content --> *} 
  • extensions/ContactForm/template/style.css

    r17945 r25872  
    3737  color:#cc0000; 
    3838} 
    39 .LV_invalid_field,  
    40 input.LV_invalid_field:hover,  
     39.LV_invalid_field, 
     40input.LV_invalid_field:hover, 
    4141input.LV_invalid_field:active, 
    42 textarea.LV_invalid_field:hover,  
     42textarea.LV_invalid_field:hover, 
    4343textarea.LV_invalid_field:active { 
    4444  border: 1px solid #cc0000; 
Note: See TracChangeset for help on using the changeset viewer.