Changeset 8271


Ignore:
Timestamp:
Dec 23, 2010, 11:24:37 PM (13 years ago)
Author:
Eric
Message:

bug 2066 second step fix :

  • Add option to enable / disable email send
  • Email function integration in userlist table
  • LCAS_SendMail function coded (not tested)

Database init updated
Translation files updated

Location:
extensions/LCAS/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/LCAS/trunk/admin/LCAS_admin.php

    r8257 r8271  
    2929$version = $plugin['version'];
    3030
    31         if (isset($_POST['submit']) and !is_adviser() and isset($_POST['LCAS_Case_Sensitive']) and isset($_POST['LCAS_Accent_Sensitive']) )
     31        if (isset($_POST['submit']) and !is_adviser() and isset($_POST['LCAS_Case_Sensitive']) and isset($_POST['LCAS_Accent_Sensitive']) and isset($_POST['LCAS_Mail']))
    3232  {
    3333
     
    3838      $_POST['LCAS_Case_Sensitive'],
    3939      $_POST['LCAS_Accent_Sensitive'],
     40      $_POST['LCAS_Mail'],
    4041      $_POST['LCAS_MailText']);
    4142
     
    8990
    9091                                pwg_query($query);
    91                
     92
     93      if (isset($conf_LCAS[2]) and $conf_LCAS[2] = 'true')
     94      {
     95        LCAS_SendMail($lcas_UserToUpdate, $_POST['user-'.$lcas_UserToUpdate]);
     96      }
     97
    9298                                array_push($page['infos'], l10n('LCAS_Info_userlist_username_renamed'));
    9399        }
     
    97103        }
    98104    }
    99 
    100105
    101106
     
    166171
    167172
     173// +-----------------------------------------------------------------------+
     174// |                           templates init                              |
     175// +-----------------------------------------------------------------------+
    168176  $template->assign(
    169177    array(
    170     'LCAS_VERSION'                   => $version,
    171     'LCAS_PATH'                      => LCAS_PATH,
    172     'PWG_insensitive_case_logon'     => $conf['insensitive_case_logon']? 'true'              : 'false',
    173                 'LCAS_Case_Sensitive_TRUE'       => $conf_LCAS[0]=='true'          ? 'checked="checked"' : '' ,
    174                 'LCAS_Case_Sensitive_FALSE'      => $conf_LCAS[0]=='false'         ? 'checked="checked"' : '' ,
    175                 'LCAS_Accent_Sensitive_TRUE'     => $conf_LCAS[1]=='true'          ? 'checked="checked"' : '' ,
    176                 'LCAS_Accent_Sensitive_FALSE'    => $conf_LCAS[1]=='false'         ? 'checked="checked"' : '' ,
    177     'LCAS_MAILTEXT'                  => $conf_LCAS[2]
     178    'LCAS_VERSION'                  => $version,
     179    'LCAS_PATH'                     => LCAS_PATH,
     180    'PWG_insensitive_case_logon'    => $conf['insensitive_case_logon']? 'true'              : 'false',
     181                'LCAS_Case_Sensitive_TRUE'      => $conf_LCAS[0]=='true'          ? 'checked="checked"' : '' ,
     182                'LCAS_Case_Sensitive_FALSE'     => $conf_LCAS[0]=='false'         ? 'checked="checked"' : '' ,
     183                'LCAS_Accent_Sensitive_TRUE'    => $conf_LCAS[1]=='true'          ? 'checked="checked"' : '' ,
     184                'LCAS_Accent_Sensitive_FALSE'   => $conf_LCAS[1]=='false'         ? 'checked="checked"' : '' ,
     185                'LCAS_MAIL_TRUE'                => $conf_LCAS[2]=='true'          ? 'checked="checked"' : '' ,
     186                'LCAS_MAIL_FALSE'               => $conf_LCAS[2]=='false'         ? 'checked="checked"' : '' ,
     187    'LCAS_MAILTEXT'                 => $conf_LCAS[3]
    178188    )
    179189  );
  • extensions/LCAS/trunk/admin/template/global.tpl

    r8257 r8271  
    6464          <br><br>
    6565            <input type="radio" value="false" {$LCAS_Case_Sensitive_FALSE} name="LCAS_Case_Sensitive">
    66               {'LCAS_Case_Sensitive_false'|@translate}<br>
     66              {'LCAS_DisableOption'|@translate}<br>
    6767            <input type="radio" value="true" {$LCAS_Case_Sensitive_TRUE} name="LCAS_Case_Sensitive">
    68               {'LCAS_Case_Sensitive_true'|@translate}
     68              {'LCAS_EnableOption'|@translate}
    6969            <br><br>
    7070          </li>
     
    7676         <br><br>
    7777            <input type="radio" value="false" {$LCAS_Accent_Sensitive_FALSE} name="LCAS_Accent_Sensitive">
    78               {'LCAS_Accent_Sensitive_false'|@translate}<br>
     78              {'LCAS_DisableOption'|@translate}<br>
    7979            <input type="radio" value="true" {$LCAS_Accent_Sensitive_TRUE} name="LCAS_Accent_Sensitive">
    80               {'LCAS_Accent_Sensitive_true'|@translate}<br>
     80              {'LCAS_EnableOption'|@translate}<br>
    8181            <br><br>
    8282                </li>
    8383
    8484          <li>
    85             <label class="cluetip" title="{'LCAS_Email_Customization'|translate}|{'LCAS_Email_Customization_d'|translate}">
    86               {'LCAS_MailText'|@translate}
     85            <label class="cluetip" title="{'LCAS_MailTitle'|translate}|{'LCAS_MailTitle_d'|translate}">
     86              {'LCAS_Mail'|@translate}
    8787            </label>
    8888            <br><br>
    89               <textarea class="LCAS_Mailtextfields" name="LCAS_MailText" id="LCAS_MailText" rows="10" {$TAG_INPUT_ENABLED}>{$LCAS_MAILTEXT}</textarea>
    90             <br><br>
     89              <input type="radio" value="false" {$LCAS_MAIL_FALSE} name="LCAS_Mail">
     90                {'LCAS_DisableOption'|@translate}<br>
     91              <input type="radio" value="true" {$LCAS_MAIL_TRUE} name="LCAS_Mail">
     92                {'LCAS_EnableOption'|@translate}<br>
     93              <br><br>
     94
     95              <ul>
     96                <li>
     97                  <label class="cluetip" title="{'LCAS_Email_Customization'|translate}|{'LCAS_Email_Customization_d'|translate}">
     98                    {'LCAS_MailText'|@translate}
     99                  </label>
     100                <br><br>
     101                  <textarea class="LCAS_Mailtextfields" name="LCAS_MailText" id="LCAS_MailText" rows="10" {$TAG_INPUT_ENABLED}>{$LCAS_MAILTEXT}</textarea>
     102                <br><br>
     103                </li>
     104              </ul>
    91105          </li>
    92106        </ul>
     
    148162                                        <th>{'LCAS_Compare_value_h'|@translate}</th>
    149163                            <th>{'LCAS_Update_h'|@translate}</th>
    150                             <th>{'LCAS_Notify_h'|@translate}</th>
    151164                                        </tr>
    152165                                        </thead>
     
    163176                {/if}
    164177                            <td style="text-align:center;"><a href="javascript:UpdateAUser({$user.ID});">{'LCAS_Update_User'|@translate}</a></td>
    165                             <td style="text-align:center;"><a href="javascript:alert('to do - {$user.ID}');">{'LCAS_Send_Email'|@translate}</a></td>
    166178                            {foreach from=$user.plugin_columns item=data}
    167179                              <td>{$data}</td>
  • extensions/LCAS/trunk/include/functions.inc.php

    r8217 r8271  
    621621
    622622
    623 /* Function called from main.inc.php to send validation email */
    624 function LCAS_SendMail2User($typemail, $id, $username, $password, $email, $confirm)
     623/* Function called from LCAS_admin.php to send notification email */
     624function LCAS_SendMail($id, $username)
    625625{
    626626  global $conf;
     
    629629 
    630630        include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    631  
    632         $infos1_perso = "";
    633   $infos2_perso = "";
    634631
    635632/* We have to get the user's language in database */
     
    656653  }
    657654
    658   switch($typemail)
    659   {
    660     case 1:
    661       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Add of %s', stripslashes($username)));
    662       $password = $password <> '' ? $password : l10n('LCAS_empty_pwd');
    663      
    664       if (isset($conf_LCAS[9]) and $conf_LCAS[9] <> '')
    665       {
    666         if (function_exists('get_user_language_desc'))
    667         {
    668           $infos1_perso = get_user_language_desc($conf_LCAS[9])."\n\n";
    669         }
    670         else $infos1_perso = l10n($conf_LCAS[9])."\n\n";
    671       }
    672      
    673       break;
    674      
    675     case 2:
    676       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Update of %s', stripslashes($username)));
    677       $password = $password <> '' ? $password : l10n('LCAS_empty_pwd');
    678 
    679       break;
    680        
    681     case 3:
    682       $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Update of %s', stripslashes($username)));
    683       $password = $password <> '' ? $password : l10n('LCAS_no_update_pwd');
    684 
    685       break;
    686   }
    687 
    688   if (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'true')
    689   {
    690     $infos1 = array(
    691       get_l10n_args('infos_mail %s', stripslashes($username)),
    692       get_l10n_args('User: %s', stripslashes($username)),
    693       get_l10n_args('Password: %s', $password),
    694       get_l10n_args('Email: %s', $email),
    695       get_l10n_args('', ''),
    696     );
    697   }
    698 
    699 
    700   if ( isset($conf_LCAS[1]) and $conf_LCAS[1] == 'true' and $confirm)
    701   {
    702     $infos2 = array
    703     (
    704       get_l10n_args('Link: %s', AddConfirmMail($id, $email)),
    705       get_l10n_args('', ''),
    706     );
    707 
    708     if (isset($conf_LCAS[10]) and $conf_LCAS[10] <> '')
     655  $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Username_updated_for_%s', stripslashes($username)));
     656
     657  if (isset($conf_LCAS[3]) and $conf_LCAS[3] <> '')
     658  {
     659    if (function_exists('get_user_language_desc'))
    709660    {
    710       if (function_exists('get_user_language_desc'))
    711       {
    712         $infos2_perso = get_user_language_desc($conf_LCAS[10])."\n\n";
    713       }
    714       else $infos2_perso = l10n($conf_LCAS[10])."\n\n";
     661      $customtxt = get_user_language_desc($conf_LCAS[3])."\n\n";
    715662    }
    716   }
    717 
    718 /* Sending the email with subject and contents */
     663    else $customtxt = l10n($conf_LCAS[3])."\n\n";
     664  }
     665
     666/* Send the email with subject and contents */
    719667  pwg_mail($email, array(
    720668    'subject' => $subject,
    721     'content' => (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : "").get_absolute_root_url(),
     669    'content' => ($customtxt),
    722670  ));
    723671
  • extensions/LCAS/trunk/language/en_UK/help/plugin.lang.php

    r8257 r8271  
    55global $lang;
    66
    7 /*TODO*/$lang['LCAS_sensitiveTitle'] = 'Sensibilité à l\'enregistrement et la connexion';
     7/*TODO*/$lang['LCAS_sensitiveTitle'] = 'Sensibilités à l\'enregistrement et l\'identification';
    88/*TODO*/$lang['LCAS_sensitiveTitle_d'] = '
     9Piwigo permet de rendre insensible à la casse mais ne gère pas l\'insensibilité aux accents, et ceci uniquement à l\'inscription des nouveaux utilisateurs. LCAS apporte une gestion plus approfondie des insensibilités à l\'inscription et l\'identification des utilisateurs. Les options suivantes sont proposées:<br><br>
    910- Noms d\'utilisateur sensible ou non à la casse<br>
    10 - Noms d\'utilisateur ensible ou non aux accents<br>
     11- Noms d\'utilisateur sensible ou non aux accents<br>
     12- Personnalisation du texte de l\'email de notification<br><br>
     13<b style=&quot;color: red;&quot;>Important : L\'option de Piwigo &quot;$conf[\'insensitive_case_logon\']&quot; doit être activée pour un fonctionnement optimal.</b>
    1114';
    1215/*TODO*/$lang['LCAS_caseSensitiveTitle'] = 'La casse';
     
    3639
    3740/*TODO*/$lang['LCAS_Email_Customization'] = 'Personnalisation de la notification par email';
    38 /*TODO*/$lang['LCAS_Email_Customization_d'] = 'Si vous souhaitez utiliser la notification par email des utilisateurs que vous avez renommés dans le tableau de vérification, vous pouvez personnaliser le texte à envoyer. Utiliser les balises [lang] pour une personnalisation multi-langues si le plugin Extended Description est actif.';
     41/*TODO*/$lang['LCAS_Email_Customization_d'] = 'Vous pouvez personnaliser le texte à envoyer lors de la notification. Utilisez les balises [lang] pour une personnalisation multi-langues si le plugin Extended Description est actif.';
     42
     43/*TODO*/$lang['LCAS_MailTitle'] = 'Notification par email';
     44/*TODO*/$lang['LCAS_MailTitle_d'] = 'Choisissez ici si un email de notification doit être envoyé automatiquement aux utilisateurs dont le login dû être modifié pour correspondre aux nouvelles règles de sensibilité.';
    3945?>
  • extensions/LCAS/trunk/language/en_UK/plugin.lang.php

    r8257 r8271  
    1111
    1212$lang['LCAS_Case_Sensitive'] = 'Case insensitivity :';
    13 $lang['LCAS_Case_Sensitive_false'] = ' Enable (default value)';
    14 $lang['LCAS_Case_Sensitive_true'] = ' Disable';
    1513
    1614$lang['LCAS_Accent_Sensitive'] = 'Accents insensivity :';
    17 $lang['LCAS_Accent_Sensitive_false'] = ' Enable (default value)';
    18 $lang['LCAS_Accent_Sensitive_true'] = ' Disable';
    1915
    2016$lang['LCAS_currentPWGConfigHeader'] = 'Current Piwigo\'s setting';
     
    5854
    5955$lang['LCAS_PluginSupport'] = 'Official plugin support';
     56
     57$lang['LCAS_Mail'] = 'Notification par email';
     58
     59$lang['LCAS_DisableOption'] = ' Disable (default value)';
     60$lang['LCAS_EnableOption'] = ' Enable';
     61
     62/* Email subject */
     63$lang['Username_updated_for_%s'] = 'Username update for %s';
    6064?>
  • extensions/LCAS/trunk/language/fr_FR/help/plugin.lang.php

    r8257 r8271  
    3636
    3737$lang['LCAS_Email_Customization'] = 'Personnalisation de la notification par email';
    38 $lang['LCAS_Email_Customization_d'] = 'Si vous souhaitez utiliser la notification par email des utilisateurs que vous avez renommés dans le tableau de vérification, vous pouvez personnaliser le texte à envoyer. Utiliser les balises [lang] pour une personnalisation multi-langues si le plugin Extended Description est actif.';
     38$lang['LCAS_Email_Customization_d'] = 'Vous pouvez personnaliser le texte à envoyer lors de la notification. Utilisez les balises [lang] pour une personnalisation multi-langues si le plugin Extended Description est actif.';
     39
     40$lang['LCAS_MailTitle'] = 'Notification par email';
     41$lang['LCAS_MailTitle_d'] = 'Choisissez ici si un email de notification doit être envoyé automatiquement aux utilisateurs dont le login dû être modifié pour correspondre aux nouvelles règles de sensibilité.';
    3942?>
  • extensions/LCAS/trunk/language/fr_FR/plugin.lang.php

    r8257 r8271  
    1111
    1212$lang['LCAS_Case_Sensitive'] = 'Insensible à la casse :';
    13 $lang['LCAS_Case_Sensitive_false'] = ' Désactiver (valeur par défaut)';
    14 $lang['LCAS_Case_Sensitive_true'] = ' Activer';
    1513
    1614$lang['LCAS_Accent_Sensitive'] = 'Insensible aux accents :';
    17 $lang['LCAS_Accent_Sensitive_false'] = ' Désactiver (valeur par défaut)';
    18 $lang['LCAS_Accent_Sensitive_true'] = ' Activer';
    1915
    2016$lang['LCAS_currentPWGConfigHeader'] = 'Paramètre actuel de Piwigo';
     
    5854
    5955$lang['LCAS_PluginSupport'] = 'Support officiel du plugin';
     56
     57$lang['LCAS_Mail'] = 'Notification par email';
     58
     59$lang['LCAS_DisableOption'] = ' Désactiver (valeur par défaut)';
     60$lang['LCAS_EnableOption'] = ' Activer';
     61
     62/* Email subject */
     63$lang['Username_updated_for_%s'] = 'Nom d\'utilisateur mis à jour pour %s';
    6064?>
  • extensions/LCAS/trunk/maintain.inc.php

    r8257 r8271  
    1818        global $conf;
    1919       
    20   $default1 = array('false','false','Example customized content of the notification email');
     20  $default = array('false','false','false','Example customized content of the notification email');
    2121
    2222  $q = '
    2323INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
    24 VALUES ("LoginCaseAccentsSensitivity","'.addslashes(serialize($default1)).'","LCAS parameters")
     24VALUES ("LoginCaseAccentsSensitivity","'.addslashes(serialize($default)).'","LCAS parameters")
    2525  ;';
    2626  pwg_query($q);
Note: See TracChangeset for help on using the changeset viewer.