Changeset 1021 for trunk/include
- Timestamp:
- Feb 1, 2006, 11:07:26 PM (19 years ago)
- Location:
- trunk/include
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/config_default.inc.php
r1018 r1021 183 183 $conf['mail_options'] = false; 184 184 185 // Send bcc mail to webmaster186 // Set true for debug or test185 // send_bcc_mail_webmaster: send bcc mail to webmaster. Set true for debug 186 // or test. 187 187 $conf['send_bcc_mail_webmaster'] = false; 188 188 -
trunk/include/functions.inc.php
r1020 r1021 954 954 return $search_clause; 955 955 } 956 957 /** 958 * Returns webmaster mail address depending on $conf['webmaster_id'] 959 * 960 * @return string 961 */ 962 function get_webmaster_mail_address() 963 { 964 global $conf; 965 966 $query = ' 967 SELECT '.$conf['user_fields']['email'].' 968 FROM '.USERS_TABLE.' 969 WHERE '.$conf['user_fields']['id'].' = '.$conf['webmaster_id'].' 970 ;'; 971 list($email) = mysql_fetch_array(pwg_query($query)); 972 973 return $email; 974 } 956 975 ?> -
trunk/include/functions_mail.inc.php
r1019 r1021 27 27 // +-----------------------------------------------------------------------+ 28 28 29 // Extract mail fonctions of password.php 30 // And Modify pwg_mail (add pararameters + news fonctionnalities) 31 // And var conf_mail, function init_conf_mail, function format_email 32 33 define('PHPWG_ROOT_PATH','./'); 34 include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); 29 /** 30 * - Extract mail fonctions of password.php 31 * - Modify pwg_mail (add pararameters + news fonctionnalities) 32 * - Var conf_mail, function init_conf_mail, function format_email 33 */ 35 34 36 35 // +-----------------------------------------------------------------------+ … … 39 38 40 39 /* 41 * Initialization of global variable $conf_mail 40 * Returns an array of mail configuration parameters : 41 * 42 * - mail_options: see $conf['mail_options'] 43 * - send_bcc_mail_webmaster: see $conf['send_bcc_mail_webmaster'] 44 * - email_webmaster: mail corresponding to $conf['webmaster_id'] 45 * - formated_email_webmaster: the name of webmaster is $conf['gallery_title'] 46 * - text_footer: PhpWebGallery and version 47 * 48 * @return array 42 49 */ 43 function init_conf_mail()50 function get_mail_configuration() 44 51 { 45 global $conf , $conf_mail;52 global $conf; 46 53 47 if (count($conf_mail) == 0) 48 { 49 $conf_mail['mail_options'] = $conf['mail_options']; 50 $conf_mail['send_bcc_mail_webmaster'] = ($conf['send_bcc_mail_webmaster'] == true ? true : false); 51 list($conf_mail['email_webmaster']) = mysql_fetch_array(pwg_query('select '.$conf['user_fields']['email'].' from '.USERS_TABLE.' where '.$conf['user_fields']['id'].' = '.$conf['webmaster_id'].';')); 52 $conf_mail['formated_email_webmaster'] = format_email($conf['gallery_title'], $conf_mail['email_webmaster']); 53 $conf_mail['text_footer'] = "\n\n-- \nPhpWebGallery ".($conf['show_version'] ? PHPWG_VERSION : ''); 54 } 54 $conf_mail = array( 55 'mail_options' => $conf['mail_options'], 56 'send_bcc_mail_webmaster' => $conf['send_bcc_mail_webmaster'], 57 ); 55 58 56 return true; 59 // we have webmaster id among user list, what's his email address ? 60 $conf_mail['email_webmaster'] = get_webmaster_mail_address(); 61 62 // name of the webmaster is the title of the gallery 63 $conf_mail['formated_email_webmaster'] = 64 format_email($conf['gallery_title'], $conf_mail['email_webmaster']); 65 66 // what to display at the bottom of each mail ? 67 $conf_mail['text_footer'] = 68 "\n\n-- \nPhpWebGallery ".($conf['show_version'] ? PHPWG_VERSION : ''); 69 70 return $conf_mail; 57 71 } 58 72 73 /** 74 * Returns an email address with an associated real name 75 * 76 * @param string name 77 * @param string email 78 */ 59 79 function format_email($name, $email) 60 80 { 61 81 if (strpos($email, '<') === false) 82 { 62 83 return $name.' <'.$email.'>'; 84 } 63 85 else 86 { 64 87 return $name.$email; 88 } 65 89 } 66 90 … … 72 96 global $conf, $conf_mail; 73 97 98 if (!isset($conf_mail)) 99 { 100 $conf_mail = get_mail_configuration(); 101 } 102 74 103 $to = format_email('', $to); 75 104 76 if ($from =='') 105 if ($from == '') 106 { 77 107 $from = $conf_mail['formated_email_webmaster']; 108 } 78 109 else 110 { 79 111 $from = format_email('', $from); 112 } 80 113 81 114 $headers = 'From: '.$from."\n"; 82 115 $headers.= 'Reply-To: '.$from."\n"; 116 83 117 if ($conf_mail['send_bcc_mail_webmaster']) 118 { 84 119 $headers.= 'Bcc: '.$conf_mail['formated_email_webmaster']."\n"; 85 86 87 $options = '-f '.$from; 88 120 } 121 89 122 $content = $infos; 90 123 $content.= $conf_mail['text_footer']; … … 92 125 if ($conf_mail['mail_options']) 93 126 { 127 $options = '-f '.$from; 128 94 129 return mail($to, $subject, $content, $headers, $options); 95 130 } … … 99 134 } 100 135 } 101 102 // +-----------------------------------------------------------------------+103 // | Global Variables104 // +-----------------------------------------------------------------------+105 $conf_mail = array();106 107 init_conf_mail();108 109 136 ?> -
trunk/include/functions_notification.inc.php
r1019 r1021 27 27 28 28 29 // Extract news fonctions of feed.php 30 31 define('PHPWG_ROOT_PATH','./'); 32 include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); 29 /** 30 * Extract news fonctions of feed.php 31 */ 33 32 34 33 // +-----------------------------------------------------------------------+ -
trunk/include/page_tail.php
r1012 r1021 37 37 'L_POWERED_BY'=>$lang['powered_by'] 38 38 )); 39 40 //--------------------------------------------------------------------- contact 41 42 if (!$user['is_the_guest']) 43 { 44 $template->assign_block_vars( 45 'contact', 46 array( 47 'MAIL' => get_webmaster_mail_address() 48 ) 49 ); 50 } 51 39 52 //------------------------------------------------------------- generation time 40 53 if ($conf['show_gt']) … … 63 76 } 64 77 65 //--------------------------------------------------------------------- contact66 67 if (!$user['is_the_guest'])68 {69 $query = '70 SELECT '.$conf['user_fields']['email'].'71 FROM '.USERS_TABLE.'72 WHERE '.$conf['user_fields']['id'].' = '.$conf['webmaster_id'].'73 ;';74 list($email) = mysql_fetch_array(pwg_query($query));75 76 $template->assign_block_vars(77 'contact',78 array(79 'MAIL' => $email80 )81 );82 }83 84 78 // 85 79 // Generate the page
Note: See TracChangeset
for help on using the changeset viewer.