- Timestamp:
- Dec 17, 2005 9:11:26 AM (19 years ago)
- Location:
- trunk/lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/App.inc.php
r40 r41 119 119 'log_to_sms_address' => null, 120 120 121 // The from address used for system emails.122 'envelope_sender_address' => '',123 124 121 // A key for calculating simple cryptographic signatures. Set using as an environment variables in the httpd.conf with 'SetEnv SIGNING_KEY <key>'. 125 122 'signing_key' => 'aae6abd6209d82a691a9f96384a7634a', … … 314 311 // and is used whenever a URL need be used to the current site. 315 312 // Not available on cli scripts obviously. 316 if (isset($_SERVER['HTTP_HOST']) && '' != $_SERVER['HTTP_HOST'] && '' != $this->getParam('site_url')) {313 if (isset($_SERVER['HTTP_HOST']) && '' != $_SERVER['HTTP_HOST'] && '' == $this->getParam('site_url')) { 317 314 $this->setParam(array('site_url' => sprintf('%s://%s', ('on' == getenv('HTTPS') ? 'https' : 'http'), getenv('HTTP_HOST')))); 318 315 } … … 323 320 } 324 321 325 // Used as the fifth parameter to mail() to set the return address for sent messages. Requires safe_mode off.326 if ('' != $this->getParam('site_email') && !$this->getParam('envelope_sender_address')) {327 $this->setParam(array('envelope_sender_address' => '-f ' . $this->getParam('site_email')));328 }329 330 322 // Character set. This should also be printed in the html header template. 331 323 header('Content-type: text/html; charset=' . $this->getParam('character_set')); … … 496 488 $subject = sprintf('[%s %s] %s', getenv('HTTP_HOST'), $event['type'], $message); 497 489 $email_msg = sprintf("A %s log event occured on %s\n\n", $event['type'], getenv('HTTP_HOST')); 498 $headers = "From: codebase@strangecode.com \r\n";490 $headers = "From: codebase@strangecode.com"; 499 491 foreach ($event as $k=>$v) { 500 492 $email_msg .= sprintf("%-11s%s\n", $k, $v); … … 506 498 if ($this->getParam('log_sms_priority') && $priority <= $this->getParam('log_sms_priority')) { 507 499 $subject = sprintf('[%s %s]', getenv('HTTP_HOST'), $priority); 508 $sms_msg = sprintf('%s :%s %s', basename($file), $line, $event['message']);509 $headers = "From: codebase@strangecode.com \r\n";500 $sms_msg = sprintf('%s [%s:%s]', $event['message'], basename($file), $line); 501 $headers = "From: codebase@strangecode.com"; 510 502 mail($this->getParam('log_to_sms_address'), $subject, $sms_msg, $headers, '-f codebase@strangecode.com'); 511 503 } -
trunk/lib/Auth_SQL.inc.php
r40 r41 757 757 // Update password query. 758 758 $this->setPassword($user_id, $password); 759 760 // Subject for email. Do not use double-quote marks inside. 761 $email_subject = sprintf('%s password change', App::getParam('site_name')); 762 763 // Body for email. Do not touch lines with 'EOF'. 759 760 // Body for email. 764 761 $email_body = <<<EOF 765 Hello %s,766 767 Your password at %s has been reset. %s762 Hello {NAME}, 763 764 Your password at {SITE_NAME} has been reset. {REASON} 768 765 Your new login information is: 769 766 770 USERNAME: %s771 PASSWORD: %s772 773 If you have any questions or concerns please reply to this email or go the the addressbelow.767 USERNAME: {USERNAME} 768 PASSWORD: {PASSWORD} 769 770 If you have any questions or concerns please reply to this email or visit the website below. 774 771 775 772 Thank you, 776 %s 777 %s 773 {SITE_NAME} 774 {SITE_URL}/ 778 775 779 776 EOF; 780 $email_body = wordwrap(sprintf($email_body, 781 $user_data[$this->_params['db_username_column']], 782 App::getParam('site_name'), 783 $reason, 784 $user_data[$this->_params['db_username_column']], 785 $password, 786 App::getParam('site_name'), 787 App::getParam('site_url') 777 778 $email = new Email(array( 779 'to' => $user_data['email'], 780 'from' => sprintf('%s <%s>', App::getParam('site_name'), App::getParam('site_email')), 781 'subject' => sprintf('%s password change', App::getParam('site_name')) 788 782 )); 789 790 // Email the user with the new account information. 791 mail($user_data['email'], $email_subject, $email_body, sprintf("From: %s <%s>\r\n", App::getParam('site_name'), App::getParam('site_email')), App::getParam('envelope_sender_address')); 783 $email->setString($email_body); 784 $email->replace(array( 785 'site_name' => App::getParam('site_name'), 786 'site_url' => App::getParam('site_url'), 787 'name' => ('' != $user_data['first_name'] . $user_data['last_name'] ? $user_data['first_name'] . ' ' . $user_data['last_name'] : $user_data[$this->_params['db_username_column']]), 788 'username' => $user_data[$this->_params['db_username_column']], 789 'password' => $password, 790 'reason' => $reason, 791 )); 792 $email->send(); 792 793 793 794 return array( -
trunk/lib/Email.inc.php
r40 r41 16 16 )); 17 17 $email->setTemplate('email_registration_confirm.ihtml'); 18 // $email->setString('Or you can pass your message body as a string, also with {VARIABLES}.'); 18 19 $email->replace(array( 19 20 'site_name' => App::getParam('site_name'), … … 153 154 { 154 155 // Load file, using include_path. 155 if ('' == $string) {156 if ('' == trim($string)) { 156 157 App::logMsg(sprintf('Empty string provided.', null), LOG_ERR, __FILE__, __LINE__); 157 158 $this->_template_replaced = null; 158 159 return false; 159 160 } else { 160 $ _template = $string;161 $this->_template = $string; 161 162 // This could be a new template, so reset the _template_replaced. 162 163 $this->_template_replaced = null; … … 244 245 // Ensure all placeholders have been replaced. Find anything with {...} characters. 245 246 if (preg_match('/({[^}]+})/', $final_body, $unreplaced_match)) { 246 App::logMsg(sprintf('Cannot send email. Variables left unreplaced in template: %s', (isset($unreplaced_match ) ? $unreplaced_match[1] : '')), LOG_ERR, __FILE__, __LINE__);247 App::logMsg(sprintf('Cannot send email. Variables left unreplaced in template: %s', (isset($unreplaced_match[1]) ? $unreplaced_match[1] : '')), LOG_ERR, __FILE__, __LINE__); 247 248 return false; 248 249 } -
trunk/lib/Utilities.inc.php
r40 r41 516 516 } 517 517 if (isset($_POST[$var])) { 518 return dispelMagicQuotes($_POST[$var]);518 return trim(dispelMagicQuotes($_POST[$var])); 519 519 } else if (isset($_GET[$var])) { 520 return dispelMagicQuotes($_GET[$var]);520 return trim(dispelMagicQuotes($_GET[$var])); 521 521 } else { 522 522 return $default; … … 526 526 { 527 527 if (is_null($var)) { 528 return dispelMagicQuotes($_POST);528 return trim(dispelMagicQuotes($_POST)); 529 529 } 530 530 if (isset($_POST[$var])) { 531 return dispelMagicQuotes($_POST[$var]);531 return trim(dispelMagicQuotes($_POST[$var])); 532 532 } else { 533 533 return $default; … … 537 537 { 538 538 if (is_null($var)) { 539 return dispelMagicQuotes($_GET);539 return trim(dispelMagicQuotes($_GET)); 540 540 } 541 541 if (isset($_GET[$var])) { 542 return dispelMagicQuotes($_GET[$var]);542 return trim(dispelMagicQuotes($_GET[$var])); 543 543 } else { 544 544 return $default;
Note: See TracChangeset
for help on using the changeset viewer.