Changeset 1792


Ignore:
Timestamp:
Feb 8, 2007, 11:04:36 PM (17 years ago)
Author:
rub
Message:

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

Location:
trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r1790 r1792  
    526526    $first = true;
    527527     
    528     $query = 'SHOW VARIABLES where variable_name = \'max_allowed_packet\';';
     528    /*$query = 'SHOW VARIABLES where variable_name = \'max_allowed_packet\';';
    529529    list(, $packet_size) = mysql_fetch_row(pwg_query($query));
    530     $packet_size = $packet_size - 2000; // The last list of values MUST not exceed 2000 character
    531    
     530    $packet_size = $packet_size - 2000; // The last list of values MUST not exceed 2000 character*/
     531    /* DON T WORK WITH MySQL 4.1.9 */
     532    $packet_size = 1000000;
     533    $query = '';
     534
    532535    foreach ($datas as $insert)
    533536    {
  • trunk/admin/include/functions_notification_by_mail.inc.php

    r1784 r1792  
    266266  $user = array_merge($user, getuserdata($user['id'], true));
    267267
     268  list($user['template'], $user['theme']) = explode('/', $user['template']);
     269
    268270  if ($env_nbm['last_language'] != $user['language'])
    269271  {
  • trunk/include/functions_mail.inc.php

    r1784 r1792  
    104104function get_mail_template($email_format)
    105105{
    106   global $conf;
    107 
    108   // for mail, default template are used
    109   list($tmpl, $thm) = explode('/', $conf['default_template']);
    110   $mail_template = new Template(PHPWG_ROOT_PATH.'template/'.$tmpl, $thm);
    111   $mail_template->set_rootdir(PHPWG_ROOT_PATH.'template/'.$tmpl.'/mail/'.$email_format);
     106  global $user;
     107
     108  $mail_template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template'], $user['theme']);
     109  $mail_template->set_rootdir(PHPWG_ROOT_PATH.'template/'.$user['template'].'/mail/'.$email_format);
    112110
    113111  return $mail_template;
     
    129127function pwg_mail($to, $from = '', $subject = 'PhpWebGallery', $infos = '', $format_infos = 'text/plain', $email_format = null)
    130128{
    131   global $conf, $conf_mail, $lang_info, $page;
     129  global $conf, $conf_mail, $lang_info, $page, $user;
    132130
    133131  $cvt7b_subject = str_translate_to_ascii7bits($subject);
     
    178176  $content = '';
    179177
    180   if (!isset($conf_mail[$email_format][$lang_info['charset']]))
     178  if (!isset($conf_mail[$email_format][$lang_info['charset']][$user['template']][$user['theme']]))
    181179  {
    182180    if (!isset($mail_template))
     
    191189      array(
    192190        //Header
    193         'BODY_ID' =>
    194           isset($page['body_id']) ?
    195             $page['body_id'] : '',
    196 
    197191        'CONTENT_ENCODING' => $lang_info['charset'],
    198192        'LANG' => $lang_info['code'],
     
    214208
    215209    // what are displayed on the header of each mail ?
    216     $conf_mail[$email_format][$lang_info['charset']]['header'] =
    217       $mail_template->parse('mail_header', true);
     210    $conf_mail[$email_format]
     211      [$lang_info['charset']]
     212      [$user['template']][$user['theme']]['header'] =
     213        $mail_template->parse('mail_header', true);
    218214
    219215    // what are displayed on the footer of each mail ?
    220     $conf_mail[$email_format][$lang_info['charset']]['footer'] =
    221       $mail_template->parse('mail_footer', true);
    222   }
    223 
    224   $content.= $conf_mail[$email_format][$lang_info['charset']]['header'];
     216    $conf_mail[$email_format]
     217      [$lang_info['charset']]
     218      [$user['template']][$user['theme']]['footer'] =
     219        $mail_template->parse('mail_footer', true);
     220  }
     221
     222  $content.= $conf_mail[$email_format]
     223              [$lang_info['charset']]
     224              [$user['template']][$user['theme']]['header'];
    225225
    226226  if (($format_infos == 'text/plain') and ($email_format == 'text/html'))
     
    233233  }
    234234
    235   $content.= $conf_mail[$email_format][$lang_info['charset']]['footer'];
     235  $content.= $conf_mail[$email_format]
     236              [$lang_info['charset']]
     237              [$user['template']][$user['theme']]['footer'];
    236238 
    237239   // Undo Compute root_path in order have complete path
     
    258260    fclose($file);
    259261    return true;
    260   }
    261   */
     262  }*/
    262263
    263264  if ($conf_mail['mail_options'])
  • trunk/include/section_init.inc.php

    r1789 r1792  
    270270{
    271271  $page['section'] = 'categories';
    272   if (script_basename() == 'picture')
    273   {//access a picture only by id, file or id-file without given section
    274     $page['flat_cat'] = true;
    275   }
    276   elseif (!empty($conf['random_index_redirect']) and empty($tokens[$next_token]) )
    277   {
    278     $random_index_redirect = array();
    279     foreach ($conf['random_index_redirect'] as $random_url => $random_url_condition)
    280     {
    281       if (empty($random_url_condition) or eval($random_url_condition))
     272
     273  switch (script_basename())
     274  {
     275    case 'picture':
     276    {
     277      //access a picture only by id, file or id-file without given section
     278      $page['flat_cat'] = true;
     279      break;
     280    }
     281    case 'index':
     282    {
     283      // No section defined, go to selected url
     284      if (!empty($conf['random_index_redirect']) and empty($tokens[$next_token]) )
    282285      {
    283         $random_index_redirect[] = $random_url;
     286        $random_index_redirect = array();
     287        foreach ($conf['random_index_redirect'] as $random_url => $random_url_condition)
     288        {
     289          if (empty($random_url_condition) or eval($random_url_condition))
     290          {
     291            $random_index_redirect[] = $random_url;
     292          }
     293        }
     294        if (!empty($random_index_redirect))
     295        {
     296          redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]);
     297        }
    284298      }
    285     }
    286     if (!empty($random_index_redirect))
    287     {
    288       redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]);
     299      break;
    289300    }
    290301  }
  • trunk/template/yoga/mail/text/html/admin/notification_by_mail.tpl

    r1785 r1792  
    11<div id="nbm_mail_content">
     2<h2>{lang:Notification}</h2>
    23<p>{lang:nbm_content_hello_1}{USERNAME}{lang:nbm_content_hello_2}</p>
    34
     
    4344</p>
    4445<!-- BEGIN recent_post -->
    45 <p>
     46</div>
     47</div>
     48<div id="content">
     49<div id="nbm_mail_recent_post">
    4650  <!-- BEGIN recent_post_block -->
    4751  <h2>{recent_post.recent_post_block.TITLE}</h2>
    4852  {recent_post.recent_post_block.HTML_DATA}
    4953  <!-- END recent_post_block -->
    50 </p>
    5154<!-- END recent_post -->
    5255</div>
  • trunk/template/yoga/mail/text/html/footer.tpl

    r1784 r1792  
     1</div> <!-- content -->
    12<div id="copyright">
    23<HR>
  • trunk/template/yoga/mail/text/html/header.tpl

    r1784 r1792  
    66</head>
    77
    8 <body id="{BODY_ID}">
    9 <div id="the_mail">
     8<link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/layout.css">
     9<link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/mail/text/html/default-layout.css">
     10<!-- the next css is used to fix khtml (Konqueror/Safari) issue
     11the "text/nonsense" prevents gecko based browsers to load it -->
     12<link rel="stylesheet" type="text/nonsense" href="{pwg_root}template/{themeconf:template}/fix-khtml.css">
     13<!--[if lt IE 7]>
     14  <link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/fix-ie5-ie6.css">
     15<![endif]-->
     16<!--[if gt IE 6]>
     17  <link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/fix-ie7.css">
     18<![endif]-->
     19<link rel="stylesheet" type="text/css" media="print" href="{pwg_root}template/{themeconf:template}/print.css">
     20<link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/default-colors.css">
     21<link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/theme/{themeconf:theme}/theme.css">
    1022
     23<body id="theMailPage">
     24<div id="the_page">
     25<div id="content">
     26
Note: See TracChangeset for help on using the changeset viewer.