Changeset 24347


Ignore:
Timestamp:
Sep 5, 2013, 11:34:16 AM (7 years ago)
Author:
mistic100
Message:

force footer contact link when the form is public

Location:
extensions/ContactForm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/ContactForm/admin/config.php

    r23375 r24347  
    55if (isset($_POST['save_config']))
    66{
    7   $was_ready = $conf['ContactForm']['cf_ready'];
    8  
    97  $conf['ContactForm'] = array(
     8    'cf_ready' =>             $conf['ContactForm']['cf_ready'],
    109    'cf_must_initialize' =>   false,
    1110    'cf_menu_link' =>         isset($_POST['cf_menu_link']),
     
    2625  conf_update_param('ContactForm_after', $conf['ContactForm_after']);
    2726 
    28   $conf['ContactForm']['cf_ready'] = $was_ready;
    29  
    3027  array_push($page['infos'], l10n('Information data registered in database'));
    3128}
  • extensions/ContactForm/include/functions.inc.php

    r23375 r24347  
    6565function contact_form_footer_link($content, &$smarty)
    6666{
    67   global $conf;
    68   if ( !@$conf['ContactForm']['cf_ready'] ) return $content;
    69  
    7067  $search = '<a href="mailto:{$CONTACT_MAIL}?subject={\'A comment on your site\'|@translate|@escape:url}">';
    7168  $replace = '<a href="'.CONTACT_FORM_PUBLIC.'">';
     
    8784    JOIN '.USER_INFOS_TABLE.' AS i
    8885    ON i.user_id =  u.'.$conf['user_fields']['id'].'
    89   WHERE i.status in (\'webmaster\',  \'admin\')
     86  WHERE i.status IN (\'webmaster\',  \'admin\')
    9087    AND '.$conf['user_fields']['email'].' IS NOT NULL
    9188  ORDER BY username
  • extensions/ContactForm/include/install.inc.php

    r23205 r24347  
    2323  {
    2424    $contact_form_default_config = serialize(array(
     25      'cf_ready' => false,
    2526      'cf_must_initialize' => true,
    2627      'cf_menu_link' => true,
     
    5152    {
    5253      // new params
    53       $new_conf['cf_must_initialize'] = false;
    5454      $new_conf['cf_default_subject'] = 'A comment on your site';
    5555      $new_conf['cf_mail_type'] = 'text/html';
     
    9898    }
    9999   
     100    if (!isset($new_conf['cf_ready']))
     101    {
     102      $new_conf['cf_ready'] = false;
     103    }
     104   
    100105    // save config
    101106    $conf['ContactForm'] = serialize($new_conf);
  • extensions/ContactForm/main.inc.php

    r23375 r24347  
    8181  $conf['ContactForm']['cf_ready'] = count(get_contact_emails());
    8282 
    83   $template->set_prefilter('tail', 'contact_form_footer_link');
     83  if ($conf['ContactForm']['cf_ready'] && (!is_a_guest() || $conf['ContactForm']['cf_allow_guest']))
     84  {
     85    $template->assign('CONTACT_MAIL', true);
     86    $template->set_prefilter('tail', 'contact_form_footer_link');
     87  }
    8488}
    8589
Note: See TracChangeset for help on using the changeset viewer.