Ignore:
Timestamp:
Sep 30, 2011, 1:50:32 PM (13 years ago)
Author:
Eric
Message:
  • Bug 2447 fixed : Pre-filled text are localized for installation from scratch. If language is not supported by the plugin, the default language remains English.
  • maintain.inc.php refactory : Simplify installation from scratch and make code more readable.
  • Comments in all code are more readable.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserAdvManager/trunk/maintain.inc.php

    r12247 r12271  
    99include_once (UAM_PATH.'include/functions.inc.php');
    1010
     11load_language('plugin.lang', UAM_PATH);
     12
    1113
    1214function plugin_install()
     
    1820/* ****************************************************************** */
    1921
     22  $defaultUAM = array();
     23  $defaultConfirmMail = array();
     24
    2025  // Default global parameters for UserAdvManager conf
    21   $default1 = array('false','false',-1,-1,-1,'false','',-1,'','','false','','false',100,'false','false',10,'Hello [username].
    22        
    23 This is a reminder because a very long time passed since your last visit on our gallery [mygallery]. If you do not want anymore to use your access account, please let us know by replying to this email. Your account will be deleted.
    24 
    25 On receipt of this message and no new visit within 15 days, we would be obliged to automatically delete your account.
    26 
    27 Best regards,
    28 
    29 The admin of the gallery.','false','false','false','false','false','Sorry [username], your account has been deleted due to a too long time passed since your last visit at [mygallery].','Sorry [username], your account has been deprecated due to a too long time passed since your last visit at [mygallery]. Please, use the following link to revalidate your account.',-1,-1,'Thank you for registering at [mygallery]. Your account has been manually validated by _admin_. You may now log in at _link_to_site_ and make any appropriate changes to your profile. Welcome to _name_of_site_!','false','You have requested a password reset on our gallery. Please, find below your new connection settings.','false','Sorry, your account has been deleted because you have not validated your registration in requested time. Please, try registration with a valid and non blocked email account.','false','false','false',-1,-1,-1,'false');
    30 
     26  // -------------------------------------------------
     27  $defaultUAM[0] = 'false';                                   // UAM_MAIL_INFO_TRUE/FALSE
     28  $defaultUAM[1] = 'false';                                   // UAM_CONFIRM_MAIL_TRUE/FALSE
     29  $defaultUAM[2] = '-1';                                      // UAM_No_Confirm_Group
     30  $defaultUAM[3] = '-1';                                      // UAM_Validated_Group
     31  $defaultUAM[4] = '-1';                                      // UAM_Validated_Status
     32  $defaultUAM[5] = 'false';                                   // UAM_USERNAME_CHAR_TRUE
     33  $defaultUAM[6] = '';                                        // UAM_USERNAME_CHAR_LIST
     34  $defaultUAM[7] = '-1';                                      // UAM_No_Confirm_Status
     35  $defaultUAM[8] = l10n('UAM_Default_InfoMail_Txt');          // UAM_MAILINFO_TEXT
     36  $defaultUAM[9] = l10n('UAM_Default_ConfirmMail_Txt');       // UAM_CONFIRMMAIL_TEXT
     37  $defaultUAM[10] = 'false';                                  // UAM_MAILEXCLUSION_TRUE/FALSE
     38  $defaultUAM[11] = '';                                       // UAM_MAILEXCLUSION_LIST
     39  $defaultUAM[12] = 'false';                                  // UAM_PASSWORDENF_TRUE/FALSE
     40  $defaultUAM[13] = '100';                                    // UAM_PASSWORD_SCORE
     41  $defaultUAM[14] = 'false';                                  // UAM_ADMINPASSWENF_TRUE/FALSE
     42  $defaultUAM[15] = 'false';                                  // UAM_GHOSTRACKER_TRUE/FALSE
     43  $defaultUAM[16] = '10';                                     // UAM_GHOSTRACKER_DAYLIMIT
     44  $defaultUAM[17] = l10n('UAM_Default_GhstReminder_Txt');     // UAM_GHOSTRACKER_REMINDERTEXT
     45  $defaultUAM[18] = 'false';                                  // UAM_ADDLASTVISIT_TRUE/FALSE
     46  $defaultUAM[19] = 'false';                                  // UAM_ADMINCONFMAIL_TRUE/FALSE
     47  $defaultUAM[20] = 'false';                                  // UAM_REDIRTOPROFILE_TRUE/FALSE
     48  $defaultUAM[21] = 'false';                                  // UAM_GTAUTO_TRUE/FALSE
     49  $defaultUAM[22] = 'false';                                  // UAM_GTAUTOMAIL_TRUE/FALSE
     50  $defaultUAM[23] = l10n('UAM_Default_GhstDeletion_Txt');     // UAM_GTAUTODEL_TEXT
     51  $defaultUAM[24] = l10n('UAM_Default_GhstDemotion_Txt');     // UAM_GTAUTOMAILTEXT
     52  $defaultUAM[25] = '-1';                                     // UAM_Downgrade_Group
     53  $defaultUAM[26] = '-1';                                     // UAM_Downgrade_Status
     54  $defaultUAM[27] = l10n('UAM_Default_AdminValidation_Txt');  // UAM_ADMINVALIDATIONMAIL_TEXT
     55  $defaultUAM[28] = 'false';                                  // UAM_CUSTOMPASSWRETR_TRUE/FALSE
     56  $defaultUAM[29] = l10n('UAM_Default_PwdRequest_Txt');       // UAM_CUSTOMPASSWRETR_TEXT
     57  $defaultUAM[30] = 'false';                                  // UAM_USRAUTO_TRUE/FALSE
     58  $defaultUAM[31] = l10n('UAM_Default_ValidationTimeout_Txt');// UAM_USRAUTODEL_TEXT
     59  $defaultUAM[32] = 'false';                                  // UAM_USRAUTOMAIL_TRUE/FALSE
     60  $defaultUAM[33] = 'false';                                  // UAM_STUFFS_TRUE/FALSE
     61  $defaultUAM[34] = 'false';                                  // UAM_HIDEPASSW_TRUE/FALSE
     62  $defaultUAM[35] = '-1';                                     // UAM_NO_VALID_LEVEL
     63  $defaultUAM[36] = '-1';                                     // UAM_VALID_LEVEL
     64  $defaultUAM[37] = '-1';                                     // UAM_DOWNGRADE_LEVEL
     65  $defaultUAM[38] = 'false';                                  // UAM_PWDRESET_TRUE/FALSE
     66 
    3167  // Default specific parameters for UserAdvManager ConfirmMail conf
    32   $default2 = array('false',5,'Hello [username].
    33                
    34 This is a reminder message because you registered on our gallery [mygallery] but you do not validate your registration and your validation key has expired. To still allow you to access to our gallery, your validation period has been reset. You have again 5 days to validate your registration.
    35 
    36 Note: After this period, your account will be permanently deleted.','false','Hello [username].
    37 
    38 This is a reminder message because you registered on our gallery [mygallery] but you do not validate your registration and your validation key will expire. To allow you access to our gallery, you have 2 days to confirm your registration by clicking on the link in the message you should have received when you registered.
    39 
    40 Note: After this period, your account will be permanently deleted.','You have confirmed that you are human and may now use [mygallery]! Welcome [username]!','Your activation key is incorrect or expired or you have already validated your account, please contact the webmaster to fix this problem.');
    41 
     68  // ---------------------------------------------------------------
     69  $defaultConfirmMail[0] = 'false';                                 // UAM_CONFIRMMAIL_TIMEOUT_TRUE/FALSE
     70  $defaultConfirmMail[1] = '5';                                     // UAM_CONFIRMMAIL_DELAY
     71  $defaultConfirmMail[2] = l10n('UAM_Default_CfmMail_Remail_Txt1'); // UAM_CONFIRMMAIL_REMAIL_TXT1
     72  $defaultConfirmMail[3] = 'false';                                 // UAM_CONFIRMMAIL_REMAIL_TRUE/FALSE
     73  $defaultConfirmMail[4] = l10n('UAM_Default_CfmMail_Remail_Txt2'); // UAM_CONFIRMMAIL_REMAIL_TXT2
     74  $defaultConfirmMail[5] = l10n('UAM_Default_CfmMail_Custom_Txt1'); // UAM_CONFIRMMAIL_CUSTOM_TXT1
     75  $defaultConfirmMail[6] = l10n('UAM_Default_CfmMail_Custom_Txt2'); // UAM_CONFIRMMAIL_CUSTOM_TXT2
     76 
    4277  // Set current plugin version in config table
     78  // ------------------------------------------
    4379  $plugin =  PluginInfos(UAM_PATH);
    4480  $version = $plugin['version'];
     
    5490
    5591  // Create UserAdvManager conf if not already exists
     92  // ------------------------------------------------
    5693        $query = '
    5794SELECT param
     
    65102    $q = '
    66103INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
    67 VALUES ("UserAdvManager","'.pwg_db_real_escape_string(serialize($default1)).'","UAM parameters")
     104VALUES ("UserAdvManager","'.pwg_db_real_escape_string(serialize($defaultUAM)).'","UAM parameters")
    68105  ;';
    69106    pwg_query($q);
     
    71108
    72109  // Create UserAdvManager_ConfirmMail conf if not already exists
     110  // ------------------------------------------------------------
    73111        $query = '
    74112SELECT param
     
    82120    $q = '
    83121INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
    84 VALUES ("UserAdvManager_ConfirmMail","'.pwg_db_real_escape_string(serialize($default2)).'","UAM ConfirmMail parameters")
     122VALUES ("UserAdvManager_ConfirmMail","'.pwg_db_real_escape_string(serialize($defaultConfirmMail)).'","UAM ConfirmMail parameters")
    85123  ;';
    86124    pwg_query($q);
     
    88126
    89127  // Create UserAdvManager_Redir conf if not already exists
     128  // ------------------------------------------------------
    90129        $query = '
    91130SELECT param
     
    105144
    106145  // Create UserAdvManager_Version conf if not already exists
     146  // --------------------------------------------------------
    107147        $query = '
    108148SELECT param
     
    122162
    123163  // Create USER_CONFIRM_MAIL_TABLE
     164  // ------------------------------
    124165        $q = "
    125166CREATE TABLE IF NOT EXISTS ".USER_CONFIRM_MAIL_TABLE." (
     
    136177
    137178  // Create USER_LASTVISIT_TABLE
     179  // ---------------------------
    138180        $q = "
    139181CREATE TABLE IF NOT EXISTS ".USER_LASTVISIT_TABLE." (
     
    147189
    148190  // Piwigo's native tables modifications for password reset function - Add pwdreset column if not already exists
     191  // ------------------------------------------------------------------------------------------------------------
    149192  $query = '
    150193SHOW COLUMNS FROM '.USERS_TABLE.'
     
    277320
    278321/* Check database upgrade since version 2.16.0 */
     322/* ******************************************* */
    279323  if (isset($conf['UserAdvManager_Version']))
    280324  {
     
    316360
    317361  // Update plugin version number in #_config table and check consistency of #_plugins table
     362  // ---------------------------------------------------------------------------------------
    318363  UAM_version_update();
    319364
Note: See TracChangeset for help on using the changeset viewer.