Fixed some php notices

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@40776 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2007-08-23 23:50:53 +00:00
parent 0793806405
commit acff378781
3 changed files with 10 additions and 5 deletions

View File

@ -508,6 +508,8 @@ function htmlEmail($to, $from, $subject, $htmlContent, $attachedFiles = false, $
* Send a plain text e-mail
*/
function plaintextEmail($to, $from, $subject, $plainContent, $attachedFiles, $customheaders = false) {
$subjectIsUnicode = false;
$plainEncoding = false; // Not ensurely where this is supposed to be set, but defined it false for now to remove php notices
if ($customheaders && is_array($customheaders) == false) {
echo "htmlEmail($to, $from, $subject, ...) could not send mail: improper \$customheaders passed:<BR>";
@ -556,7 +558,7 @@ function plaintextEmail($to, $from, $subject, $plainContent, $attachedFiles, $cu
$headers["From"] = validEmailAddr($from);
// Messages with the X-SilverStripeMessageID header can be tracked
if($customheaders["X-SilverStripeMessageID"]) {
if(isset($customheaders["X-SilverStripeMessageID"])) {
$bounceAddress = BOUNCE_EMAIL;
// Get the human name from the from address, if there is one
if(ereg('^([^<>]+)<([^<>])> *$', $from, $parts))
@ -567,7 +569,9 @@ function plaintextEmail($to, $from, $subject, $plainContent, $attachedFiles, $cu
// $headers["Sender"] = $from;
$headers["X-Mailer"] = X_MAILER;
if (! $customheaders["X-Priority"]) $headers["X-Priority"] = 3;
if(!isset($customheaders["X-Priority"])) {
$headers["X-Priority"] = 3;
}
$headers = array_merge((array)$headers, (array)$customheaders);
@ -656,6 +660,7 @@ function wrapImagesInline_rewriter($url) {
* Combine headers w/ the body into a single string
*/
function processHeaders($headers, $body = false) {
$res = '';
if(is_array($headers)) while(list($k, $v) = each($headers))
$res .= "$k: $v\n";
if($body) $res .= "\n$body";

View File

@ -335,7 +335,7 @@ class SSViewer_FromString extends SSViewer {
fwrite($fh, $template);
fclose($fh);
if($_GET['showtemplate']) {
if(isset($_GET['showtemplate'])) {
$lines = file($tmpFile);
echo "<h2>Template: $tmpFile</h2>";
echo "<pre>";

View File

@ -468,7 +468,7 @@ class DataObject extends Controller {
$this->extend('augmentWrite', $manipulation);
// New records have their insert into the base data table done first, so that they can pass the
// generated ID on to the rest of the manipulation
if(isset($isNewRecord) && $isNewRecord && $manipulation[$baseTable]) {
if(isset($isNewRecord) && $isNewRecord && isset($manipulation[$baseTable])) {
$manipulation[$baseTable]['command'] = 'update';
}
DB::manipulate($manipulation);