diff --git a/include/config_default.inc.php b/include/config_default.inc.php index 9b97170a9..7e6b65cf3 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -229,42 +229,6 @@ $conf['users_page'] = 20; // image level permissions available in the admin interface $conf['available_permission_levels'] = array(0,1,2,4,8); -// mail_options: only set it true if you have a send mail warning with -// "options" parameter missing on mail() function execution. -$conf['mail_options'] = false; - -// send_bcc_mail_webmaster: send bcc mail to webmaster. Set true for debug -// or test. -$conf['send_bcc_mail_webmaster'] = false; - -// default_email_format: -// Define the default email format use to send email -// Value could be text/plain or text/html -$conf['default_email_format'] = 'text/html'; - -// alternative_email_format: -// Define the alternative email format use to send email -// Value could be text/plain or text/html -$conf['alternative_email_format'] = 'text/plain'; - -// define the name of sender mail: -// If value is empty, gallery title is used -$conf['mail_sender_name'] = ''; - -// smtp configuration -// (work if fsockopen function is allowed for smtp port) -// smtp_host: smtp server host -// if null, regular mail function is used -// format: hoststring[:port] -// exemple: smtp.pwg.net:21 -// smtp_user/smtp_password: user & password for smtp identication -$conf['smtp_host'] = ''; -$conf['smtp_user'] = ''; -$conf['smtp_password'] = ''; - -// 'ssl' or 'tls' -$conf['smtp_secure'] = null; - // check_upgrade_feed: check if there are database upgrade required. Set to // true, a message will strongly encourage you to upgrade your database if // needed. @@ -306,6 +270,39 @@ $conf['ext_imagick_dir'] = ''; // are array(5,10,20,50,'all') but you can set any other numeric value. $conf['comments_page_nb_comments'] = 10; +// +-----------------------------------------------------------------------+ +// | email | +// +-----------------------------------------------------------------------+ + +// send_bcc_mail_webmaster: send bcc mail to webmaster. Set true for debug +// or test. +$conf['send_bcc_mail_webmaster'] = false; + +// define the name of sender mail: if value is empty, gallery title is used +$conf['mail_sender_name'] = ''; + +// define the email of sender mail: if valie is empty, webmaster email is used +$conf['mail_sender_email'] = ''; + +// set true to allow text/html emails +$conf['allow_html_email'] = true; + +// 'clear' or 'dark' +$conf['mail_theme'] = 'clear'; + +// smtp configuration (work if fsockopen function is allowed for smtp port) +// smtp_host: smtp server host +// if null, regular mail function is used +// format: hoststring[:port] +// exemple: smtp.pwg.net:21 +// smtp_user/smtp_password: user & password for smtp identication +$conf['smtp_host'] = ''; +$conf['smtp_user'] = ''; +$conf['smtp_password'] = ''; + +// 'ssl' or 'tls' +$conf['smtp_secure'] = null; + // +-----------------------------------------------------------------------+ // | metadata | // +-----------------------------------------------------------------------+ diff --git a/include/emogrifier.class.php b/include/emogrifier.class.php new file mode 100644 index 000000000..ef2c49730 --- /dev/null +++ b/include/emogrifier.class.php @@ -0,0 +1,404 @@ +XPath conversion for adjacent sibling selectors and id/class combinations... Thanks Bob V.! + 2011-06-08 Fixed an error where CSS @media types weren't being parsed correctly... Thanks Will W.! + 2011-08-03 Fixed an error where an empty selector at the beginning of the CSS would cause a parse error on the next selector... Thanks Alexei T.! + 2011-10-13 Fully fixed a bug introduced in 2011-06-08 where selectors at the beginning of the CSS would be parsed incorrectly... Thanks Thomas A.! + 2011-10-26 Added an option to allow you to output emogrified code without extended characters being turned into HTML entities. + Moved static references to class attributes so they can be manipulated. + Added the ability to clear out the (formerly) static cache when CSS is reloaded. + 2011-12-22 Fixed a bug that was overwriting existing inline styles from the original HTML... Thanks Sagi L.! + 2012-01-31 Fixed a bug that was introduced with the 2011-12-22 revision... Thanks Sagi L. and M. BÄ…kowski! + Added extraction of #s', $content, $matches); + trigger_error('move_ccs_rules_to_body function is deprecated, use move_css_to_body', E_USER_NOTICE); + + return move_css_to_body($content); +} - if (!empty($matches[1])) +/** + * Moves CSS rules contained in the #s', "", $content); + $filename .= '.txt'; } else { - $content = preg_replace('##s', '', $content); + $filename .= '.html'; } + + $file = fopen($filename, 'w+'); + fwrite($file, implode(', ', $to) ."\n"); + fwrite($file, $mail->Subject ."\n"); + fwrite($file, $mail->createHeader() ."\n"); + fwrite($file, $mail->createBody()); + fclose($file); } - return $content; + + return $result; } -/*Testing block*/ -function pwg_send_mail_test($result, $to, $subject, $content, $headers, $args) -{ - global $conf, $user, $lang_info; - $dir = PHPWG_ROOT_PATH.$conf['data_location'].'tmp'; - if ( mkgetdir( $dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR) ) - { - $filename = $dir.'/mail.'.stripslashes($user['username']).'.'.$lang_info['code'].'.'.$args['theme'].'-'.date('YmdHis'); - if ($args['content_format'] == 'text/plain') - { - $filename .= '.txt'; - } - else - { - $filename .= '.html'; - } - $file = fopen($filename, 'w+'); - fwrite($file, $to ."\n"); - fwrite($file, $subject ."\n"); - fwrite($file, $headers); - fwrite($file, $content); - fclose($file); - } - return $result; -} if ($conf['debug_mail']) - add_event_handler('send_mail', 'pwg_send_mail_test', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 6); +{ + add_event_handler('before_send_mail', 'pwg_send_mail_test', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 4); +} - -add_event_handler('send_mail', 'pwg_send_mail', EVENT_HANDLER_PRIORITY_NEUTRAL, 5); -add_event_handler('send_mail_content', 'move_ccs_rules_to_body'); trigger_action('functions_mail_included'); -?> +?> \ No newline at end of file diff --git a/themes/default/template/mail/text/html/footer.tpl b/themes/default/template/mail/text/html/footer.tpl index b1f1b9317..da17e4473 100644 --- a/themes/default/template/mail/text/html/footer.tpl +++ b/themes/default/template/mail/text/html/footer.tpl @@ -1,22 +1,23 @@ - - - - - - + + + + \ No newline at end of file diff --git a/themes/default/template/mail/text/html/global-mail-css.tpl b/themes/default/template/mail/text/html/global-mail-css.tpl index 072bcb0be..6bfcc1cd1 100644 --- a/themes/default/template/mail/text/html/global-mail-css.tpl +++ b/themes/default/template/mail/text/html/global-mail-css.tpl @@ -1,11 +1,103 @@ -/* Global mail css */ +{strip} +/* page */ +body { + font-family:"Verdana", "Helvetica", "Optima", sans-serif; + font-size:12px; + margin:0px; + padding:0px; +} -body {ldelim} font-family: Univers, Helvetica, Optima; font-size:12px; margin:0px; padding:0px; } -#the_page {ldelim} margin:0px; padding:0px; text-align:left;} -#content {ldelim} margin:0px; padding:30px 0px 0px 30px; width:732px;} -hr {ldelim} width:632px; margin-left:0;} -#copyright {ldelim} font-size:10px; margin:0px; padding:48px 0px 32px 62px;} -.PWG {ldelim} font-family:verdana, sans-serif !important; font-size:0.9em; font-weight:normal; letter-spacing:0px;} -h2 {ldelim} padding:7px 15px; width:617px; font-weight:bold;} -img {ldelim} margin:16px; border:16px solid #aaa; -moz-border-radius: 4px; border-radius: 4px 4px; } -img:hover {ldelim} padding: 15px; border: 1px solid yellow; -moz-border-radius: 4px; border-radius: 4px 4px; } +html, body, #bodyTable { + width:100%; + height:100%; +} + +/* main block */ +#header { + padding:20px; +} +#header #title { + font-size:26px; + font-weight:bold; +} +#header #subtitle { + font-size:20px; +} +#content { + padding:0 20px 20px 20px; +} +#footer { + font-size:10px; + padding:5px; +} +#topSpacer { + margin-bottom:20px; +} + +/* images */ +img { + border:none; +} + +h1, h2, h3, h4, h5 { + margin:0.5em 0 0.25em 0; +} +h1 { font-size:26px; } +h2 { font-size:20px; } +h3 { font-size:16px; } +h4 { font-size:12px; } +h5 { font-size:10px; } + +/* paragraphs */ +p { + margin:0.25em 0 0.5em 0; +} +blockquote { + margin-left:10px; + padding-left:10px; + font-family:"Times",serif; + font-size:14px; +} + +/* list */ +ul, ol { + margin:0.5em 0 0.25em 30px; + padding:0; +} +dl { + margin:0.5em 0 0.25em 10px; +} +dt { + margin:0.25em 0 0 0; + font-weight:bold; +} +dd { + margin:0 0 0.25em 10px; +} + +/* tables */ +#content table { + width:100%; + border-spacing:0; + border-collapse:collapse; +} +#content table td { + padding:2px 3px; +} +#content table th { + font-weight:bold; + text-align:center; + padding:4px 0; +} +#content table tfoot td { + font-size:0.8em; +} + +/* line */ +hr { + border-width:0 0 1px 0; + border-color:#ddd; + border-style:solid; + margin:1em; +} +{/strip} \ No newline at end of file diff --git a/themes/default/template/mail/text/html/header.tpl b/themes/default/template/mail/text/html/header.tpl index 9520bdb20..b98f5be18 100644 --- a/themes/default/template/mail/text/html/header.tpl +++ b/themes/default/template/mail/text/html/header.tpl @@ -1,13 +1,29 @@ - + - -Piwigo Mail - - - - -
-
+ + + Piwigo Mail + + + + + + +
+ + + + +
+{* *} +
+ {* *} \ No newline at end of file diff --git a/themes/default/template/mail/text/html/mail-css-clear.tpl b/themes/default/template/mail/text/html/mail-css-clear.tpl new file mode 100644 index 000000000..b23c2b5d3 --- /dev/null +++ b/themes/default/template/mail/text/html/mail-css-clear.tpl @@ -0,0 +1,73 @@ +{strip} +/* page */ +body { + color:#111; +} + +html, body, #bodyTable { + background:#fff; +} +#contentTable { + width:600px; +} + +/* main block */ +#header { + background:#eee; + background:radial-gradient(ellipse at center, #fefefe, #e5e5e5); + border-top:4px solid #f70; + text-align:center; + text-shadow:1px 1px 0px #fff; +} +#header #subtitle { + color:#e06900; +} +#content { + background:#fefefe; + border-width:1px; + border-style:solid; + border-color:#ddd #eee; + box-shadow:inset 0 0 20px #eee; +} +#footer { + background:#eee; + border-bottom:2px solid #f70; +} + +/* links */ +a { + color:#f70; + text-decoration:none; +} +a:hover { + text-decoration:underline; +} + +/* images */ +img.photo { + border:10px solid #ddd; +} +img.photo:hover { + border-color:#eee; +} + +/* paragraphs */ +blockquote { + border-left:2px solid #aaa; + border-radius:2px; +} + +/* tables */ +#content table td { + border-bottom:1px solid #efefef; +} +#content table th { + background:#aaa; + color:#fff; + border-right:1px solid #ddd; +} +#content table tfoot td { + background:#eee; + border-right:1px solid #fff; +} +{/strip} \ No newline at end of file diff --git a/themes/default/template/mail/text/html/mail-css-dark.tpl b/themes/default/template/mail/text/html/mail-css-dark.tpl new file mode 100644 index 000000000..8299b5ad5 --- /dev/null +++ b/themes/default/template/mail/text/html/mail-css-dark.tpl @@ -0,0 +1,87 @@ +{strip} +/* page */ +body { + color:#fff; +} + +html, body, #bodyTable { + background:#111; +} +#contentTable { + width:600px; +} + +/* main block */ +#header { + background:#444; + background:radial-gradient(ellipse at center, #555, #333); + border:1px solid #000; + border-top:4px solid #f70; + text-align:center; + text-shadow:1px 1px 0px #000; +} +#header #title { + color:#eee; +} +#header #subtitle { + color:#e06900; +} +#content { + background:#111; + border-width:1px; + border-style:solid; + border-color:#666 #000; + box-shadow:inset 0 0 20px #333; +} +#footer { + background:#333; + border:1px solid #000; + border-bottom:2px solid #f70; +} + +/* links */ +a { + color:#f70; + text-decoration:none; +} +a:hover { + text-decoration:underline; +} + +/* images */ +img.photo { + border:10px solid #666; +} +img.photo:hover { + border-color:#999; +} + +h1, h2, h3, h4, h5 { + color:#bbb; +} + +/* paragraphs */ +blockquote { + border-left:2px solid #aaa; + border-radius:2px; +} + +/* tables */ +#content table td { + border-bottom:1px solid #999; +} +#content table th { + background:#666; + border-right:1px solid #aaa; +} +#content table tfoot td { + background:#444; + color:#aaa; + border-right:1px solid #aaa; +} + +/* line */ +hr { + border-color:#555; +} +{/strip} \ No newline at end of file diff --git a/themes/default/template/mail/text/plain/footer.tpl b/themes/default/template/mail/text/plain/footer.tpl index 8574697e6..0f9ef273e 100644 --- a/themes/default/template/mail/text/plain/footer.tpl +++ b/themes/default/template/mail/text/plain/footer.tpl @@ -1,5 +1,7 @@ +{literal} --- +{/literal} +---- {'Sent by'|@translate} "{$GALLERY_TITLE}" {$GALLERY_URL} -{'Contact'|@translate} {$MAIL} -{'Powered by'|@translate} Piwigo {$VERSION} +{'Powered by'|@translate} "Piwigo{if not empty($VERSION)} {$VERSION}{/if}" {$PHPWG_URL} +{'Contact'|@translate}: {$CONTACT_MAIL} \ No newline at end of file diff --git a/themes/default/template/mail/text/plain/header.tpl b/themes/default/template/mail/text/plain/header.tpl index 88cd997fa..31d7456fb 100644 --- a/themes/default/template/mail/text/plain/header.tpl +++ b/themes/default/template/mail/text/plain/header.tpl @@ -1,3 +1,6 @@ +{$MAIL_TITLE} +{if not empty($MAIL_SUBTITLE)}{$MAIL_SUBTITLE} +{/if} +---- {literal} - -{/literal}{*note that there must be an empty line to separate the mime headers*} +{/literal} \ No newline at end of file