Issue 0000639: Force selected page on index.php

Continue the Radu idea, restrict more use of random list

Issue 0000598: NBM: Add new informations
Add css on mail
Use user template for mail (on next commit, best control)

Comment mass_inserts because don't with MySQL 4.1.9


git-svn-id: http://piwigo.org/svn/trunk@1792 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rub 2007-02-08 22:04:36 +00:00
parent 1f53608976
commit 5b038de717
8 changed files with 84 additions and 39 deletions

View file

@ -525,10 +525,13 @@ function mass_inserts($table_name, $dbfields, $datas)
{ {
$first = true; $first = true;
$query = 'SHOW VARIABLES where variable_name = \'max_allowed_packet\';'; /*$query = 'SHOW VARIABLES where variable_name = \'max_allowed_packet\';';
list(, $packet_size) = mysql_fetch_row(pwg_query($query)); list(, $packet_size) = mysql_fetch_row(pwg_query($query));
$packet_size = $packet_size - 2000; // The last list of values MUST not exceed 2000 character $packet_size = $packet_size - 2000; // The last list of values MUST not exceed 2000 character*/
/* DON T WORK WITH MySQL 4.1.9 */
$packet_size = 1000000;
$query = '';
foreach ($datas as $insert) foreach ($datas as $insert)
{ {
if (strlen($query) >= $packet_size) if (strlen($query) >= $packet_size)

View file

@ -265,6 +265,8 @@ function set_user_on_env_nbm($user_id, $is_action_send)
$user['id'] = $user_id; $user['id'] = $user_id;
$user = array_merge($user, getuserdata($user['id'], true)); $user = array_merge($user, getuserdata($user['id'], true));
list($user['template'], $user['theme']) = explode('/', $user['template']);
if ($env_nbm['last_language'] != $user['language']) if ($env_nbm['last_language'] != $user['language'])
{ {
$env_nbm['last_language'] = $user['language']; $env_nbm['last_language'] = $user['language'];

View file

@ -103,12 +103,10 @@ function format_email($name, $email)
*/ */
function get_mail_template($email_format) function get_mail_template($email_format)
{ {
global $conf; global $user;
// for mail, default template are used $mail_template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template'], $user['theme']);
list($tmpl, $thm) = explode('/', $conf['default_template']); $mail_template->set_rootdir(PHPWG_ROOT_PATH.'template/'.$user['template'].'/mail/'.$email_format);
$mail_template = new Template(PHPWG_ROOT_PATH.'template/'.$tmpl, $thm);
$mail_template->set_rootdir(PHPWG_ROOT_PATH.'template/'.$tmpl.'/mail/'.$email_format);
return $mail_template; return $mail_template;
} }
@ -128,7 +126,7 @@ function get_str_email_format($is_html)
*/ */
function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $format_infos = 'text/plain', $email_format = null) function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $format_infos = 'text/plain', $email_format = null)
{ {
global $conf, $conf_mail, $lang_info, $page; global $conf, $conf_mail, $lang_info, $page, $user;
$cvt7b_subject = str_translate_to_ascii7bits($subject); $cvt7b_subject = str_translate_to_ascii7bits($subject);
@ -177,7 +175,7 @@ function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $for
$content = ''; $content = '';
if (!isset($conf_mail[$email_format][$lang_info['charset']])) if (!isset($conf_mail[$email_format][$lang_info['charset']][$user['template']][$user['theme']]))
{ {
if (!isset($mail_template)) if (!isset($mail_template))
{ {
@ -190,10 +188,6 @@ function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $for
$mail_template->assign_vars( $mail_template->assign_vars(
array( array(
//Header //Header
'BODY_ID' =>
isset($page['body_id']) ?
$page['body_id'] : '',
'CONTENT_ENCODING' => $lang_info['charset'], 'CONTENT_ENCODING' => $lang_info['charset'],
'LANG' => $lang_info['code'], 'LANG' => $lang_info['code'],
'DIR' => $lang_info['direction'], 'DIR' => $lang_info['direction'],
@ -213,15 +207,21 @@ function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $for
)); ));
// what are displayed on the header of each mail ? // what are displayed on the header of each mail ?
$conf_mail[$email_format][$lang_info['charset']]['header'] = $conf_mail[$email_format]
$mail_template->parse('mail_header', true); [$lang_info['charset']]
[$user['template']][$user['theme']]['header'] =
$mail_template->parse('mail_header', true);
// what are displayed on the footer of each mail ? // what are displayed on the footer of each mail ?
$conf_mail[$email_format][$lang_info['charset']]['footer'] = $conf_mail[$email_format]
$mail_template->parse('mail_footer', true); [$lang_info['charset']]
[$user['template']][$user['theme']]['footer'] =
$mail_template->parse('mail_footer', true);
} }
$content.= $conf_mail[$email_format][$lang_info['charset']]['header']; $content.= $conf_mail[$email_format]
[$lang_info['charset']]
[$user['template']][$user['theme']]['header'];
if (($format_infos == 'text/plain') and ($email_format == 'text/html')) if (($format_infos == 'text/plain') and ($email_format == 'text/html'))
{ {
@ -232,7 +232,9 @@ function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $for
$content.= $infos; $content.= $infos;
} }
$content.= $conf_mail[$email_format][$lang_info['charset']]['footer']; $content.= $conf_mail[$email_format]
[$lang_info['charset']]
[$user['template']][$user['theme']]['footer'];
// Undo Compute root_path in order have complete path // Undo Compute root_path in order have complete path
if ($email_format == 'text/html') if ($email_format == 'text/html')
@ -257,8 +259,7 @@ function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $for
fwrite($file, $content); fwrite($file, $content);
fclose($file); fclose($file);
return true; return true;
} }*/
*/
if ($conf_mail['mail_options']) if ($conf_mail['mail_options'])
{ {

View file

@ -269,23 +269,34 @@ else if ('list' == @$tokens[$next_token])
else else
{ {
$page['section'] = 'categories'; $page['section'] = 'categories';
if (script_basename() == 'picture')
{//access a picture only by id, file or id-file without given section switch (script_basename())
$page['flat_cat'] = true;
}
elseif (!empty($conf['random_index_redirect']) and empty($tokens[$next_token]) )
{ {
$random_index_redirect = array(); case 'picture':
foreach ($conf['random_index_redirect'] as $random_url => $random_url_condition)
{ {
if (empty($random_url_condition) or eval($random_url_condition)) //access a picture only by id, file or id-file without given section
{ $page['flat_cat'] = true;
$random_index_redirect[] = $random_url; break;
}
} }
if (!empty($random_index_redirect)) case 'index':
{ {
redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]); // No section defined, go to selected url
if (!empty($conf['random_index_redirect']) and empty($tokens[$next_token]) )
{
$random_index_redirect = array();
foreach ($conf['random_index_redirect'] as $random_url => $random_url_condition)
{
if (empty($random_url_condition) or eval($random_url_condition))
{
$random_index_redirect[] = $random_url;
}
}
if (!empty($random_index_redirect))
{
redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]);
}
}
break;
} }
} }
} }

View file

@ -1,4 +1,5 @@
<div id="nbm_mail_content"> <div id="nbm_mail_content">
<h2>{lang:Notification}</h2>
<p>{lang:nbm_content_hello_1}{USERNAME}{lang:nbm_content_hello_2}</p> <p>{lang:nbm_content_hello_1}{USERNAME}{lang:nbm_content_hello_2}</p>
<!-- BEGIN subscribe_by_admin --> <!-- BEGIN subscribe_by_admin -->
@ -42,11 +43,13 @@
<hr><br/> <hr><br/>
</p> </p>
<!-- BEGIN recent_post --> <!-- BEGIN recent_post -->
<p> </div>
</div>
<div id="content">
<div id="nbm_mail_recent_post">
<!-- BEGIN recent_post_block --> <!-- BEGIN recent_post_block -->
<h2>{recent_post.recent_post_block.TITLE}</h2> <h2>{recent_post.recent_post_block.TITLE}</h2>
{recent_post.recent_post_block.HTML_DATA} {recent_post.recent_post_block.HTML_DATA}
<!-- END recent_post_block --> <!-- END recent_post_block -->
</p>
<!-- END recent_post --> <!-- END recent_post -->
</div> </div>

View file

@ -0,0 +1,8 @@
/* $Id$ */
BODY#theMailPage #content
{
margin: 2em;
text-align: left;
}

View file

@ -1,3 +1,4 @@
</div> <!-- content -->
<div id="copyright"> <div id="copyright">
<HR> <HR>
<!-- Please, do not remove this copyright. If you really want to, <!-- Please, do not remove this copyright. If you really want to,

View file

@ -5,6 +5,22 @@
<meta http-equiv="Content-Type" content="text/html; charset={CONTENT_ENCODING}"> <meta http-equiv="Content-Type" content="text/html; charset={CONTENT_ENCODING}">
</head> </head>
<body id="{BODY_ID}"> <link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/layout.css">
<div id="the_mail"> <link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/mail/text/html/default-layout.css">
<!-- the next css is used to fix khtml (Konqueror/Safari) issue
the "text/nonsense" prevents gecko based browsers to load it -->
<link rel="stylesheet" type="text/nonsense" href="{pwg_root}template/{themeconf:template}/fix-khtml.css">
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/fix-ie5-ie6.css">
<![endif]-->
<!--[if gt IE 6]>
<link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/fix-ie7.css">
<![endif]-->
<link rel="stylesheet" type="text/css" media="print" href="{pwg_root}template/{themeconf:template}/print.css">
<link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/default-colors.css">
<link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/theme/{themeconf:theme}/theme.css">
<body id="theMailPage">
<div id="the_page">
<div id="content">