Changeset 6775

Show
Ignore:
Timestamp:
08/18/10 22:43:18 (3 years ago)
Author:
Eric
Message:

- Bug 1727 partially fixed: New option to redirect users to profile page after their first login only.
- Known problem:
* The redirection doesn't work after registration and after confirmation page (if ConfirmMail is enabled)
* The redirection applies to already registered users including admins, webmaster and generic status.

- Language files updated
- Upgrade of upgradedb.inc.php
- Prepare to new version 2.15.4 encode

Location:
extensions/NBC_UserAdvManager/trunk
Files:
1 removed
17 modified

Legend:

Unmodified
Added
Removed
  • extensions/NBC_UserAdvManager/trunk/admin/UAM_admin.php

    r6754 r6775  
    101101  case 'global': 
    102102 
    103         if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UAM_Mail_Info']) and isset($_POST['UAM_Username_Char']) and isset($_POST['UAM_Confirm_Mail']) and isset($_POST['UAM_No_Comment_Anonymous']) and isset($_POST['UAM_Password_Enforced']) and isset($_POST['UAM_AdminPassword_Enforced']) and isset($_POST['UAM_GhostUser_Tracker']) and isset($_POST['UAM_Admin_ConfMail'])) 
     103        if (isset($_POST['submit']) and !is_adviser() and isset($_POST['UAM_Mail_Info']) and isset($_POST['UAM_Username_Char']) and isset($_POST['UAM_Confirm_Mail']) and isset($_POST['UAM_No_Comment_Anonymous']) and isset($_POST['UAM_Password_Enforced']) and isset($_POST['UAM_AdminPassword_Enforced']) and isset($_POST['UAM_GhostUser_Tracker']) and isset($_POST['UAM_Admin_ConfMail']) and isset($_POST['UAM_RedirToProfile'])) 
    104104  { 
    105105 
     
    140140      $_POST['UAM_GhostTracker_ReminderText'], 
    141141      $_POST['UAM_Add_LastVisit_Column'], 
    142       $_POST['UAM_Admin_ConfMail']); 
     142      $_POST['UAM_Admin_ConfMail'], 
     143      $_POST['UAM_RedirToProfile']); 
    143144 
    144145    $conf['UserAdvManager'] = serialize($newconf_UAM); 
     
    331332    'UAM_ADMINCONFMAIL_TRUE'         => $conf_UAM[20]=='true' ?  'checked="checked"' : '' , 
    332333    'UAM_ADMINCONFMAIL_FALSE'        => $conf_UAM[20]=='false' ?  'checked="checked"' : '' , 
     334    'UAM_REDIRTOPROFILE_TRUE'        => $conf_UAM[21]=='true' ?  'checked="checked"' : '' , 
     335    'UAM_REDIRTOPROFILE_FALSE'       => $conf_UAM[21]=='false' ?  'checked="checked"' : '' , 
    333336                'UAM_PASSWORD_TEST_SCORE'        => $UAM_Password_Test_Score, 
    334337    'UAM_ERROR_REPORTS4'             => $UAM_Exclusionlist_Error, 
  • extensions/NBC_UserAdvManager/trunk/admin/template/global.tpl

    r6754 r6775  
    497497            <input type="radio" value="false" {$UAM_NO_COMMENT_ANO_FALSE} name="UAM_No_Comment_Anonymous">{'UAM_No_Comment_Anonymous_false'|@translate}<br> 
    498498            <input type="radio" value="true" {$UAM_NO_COMMENT_ANO_TRUE} name="UAM_No_Comment_Anonymous">{'UAM_No_Comment_Anonymous_true'|@translate}<br><br> 
     499          </li> 
     500 
     501          <li><label class="cluetip" title="{'UAM_RedirTitle'|translate}|{'UAM_RedirTitle_d'|translate}">{'UAM_RedirToProfile'|@translate}</label><br><br> 
     502            <input type="radio" value="false" {$UAM_REDIRTOPROFILE_FALSE} name="UAM_RedirToProfile">{'UAM_RedirToProfile_false'|@translate}<br> 
     503            <input type="radio" value="true" {$UAM_REDIRTOPROFILE_TRUE} name="UAM_RedirToProfile">{'UAM_RedirToProfile_true'|@translate}<br><br> 
    499504          </li> 
    500505        </ul> 
  • extensions/NBC_UserAdvManager/trunk/changelog.txt.php

    r6757 r6775  
    179179            Bug 1656 fixed - New register validation mode: Manual validation by admin 
    180180            Bug 1687 fixed - Login case sensitivity is no more used in this plugin because already set in Piwigo's core 
    181             Bug 1693  
     181            Bug 1727 partially fixed - New option to redirect users to profile page after their first login only. 
     182              Known problem: The redirection doesn't work after registration and after confirmation page (if ConfirmMail is enabled) 
     183                             The redirection applies to already registered users including admins, webmaster and generic status. 
    182184            Bug 1789 fixed - Escaping double quotes in text fields 
    183185            Bug 1790 fixed - Validation tracking tab is set when correct options are set 
  • extensions/NBC_UserAdvManager/trunk/include/functions.inc.php

    r6757 r6775  
    498498  pwg_query($query); 
    499499} 
     500 
     501 
     502/* Function called from main.inc.php - Triggered on user deletion */ 
     503function DeleteRedir($user_id) 
     504{ 
     505  $tab = array(); 
     506 
     507  $query = " 
     508SELECT value 
     509FROM ".CONFIG_TABLE." 
     510WHERE param = 'UserAdvManager_Redir' 
     511;"; 
     512 
     513  $tab = pwg_db_fetch_row(pwg_query($query)); 
     514   
     515  $values = explode(',', $tab[0]); 
     516 
     517  unset($values[array_search($user_id, $values)]); 
     518      
     519  $query = " 
     520UPDATE ".CONFIG_TABLE." 
     521SET value = \"".implode(',', $values)."\" 
     522WHERE param = 'UserAdvManager_Redir';"; 
     523 
     524  pwg_query($query); 
     525} 
     526 
    500527 
    501528/* Function called from ConfirmMail.php to verify validation key used by user according time limit */ 
     
    11851212  } 
    11861213} 
     1214 
     1215 
     1216// check_consult - Thx to LucMorizur 
     1217// checks if a user id is registered as having already 
     1218// visited his profile.php page. 
     1219// @uid        : the user id 
     1220// @user_idsOK : (returned) array of all users ids having already visited 
     1221//               their profile.php pages 
     1222// 
     1223// @returns    : true or false whether the users has already visited his 
     1224//               profile.php page or not 
     1225function check_consult($uid, &$user_idsOK) 
     1226{ 
     1227  $t = array(); 
     1228  $v = false; 
     1229   
     1230  $query = " 
     1231SELECT value 
     1232FROM ".CONFIG_TABLE." 
     1233WHERE param = 'UserAdvManager_Redir' 
     1234;"; 
     1235   
     1236  if ($v = (($t = pwg_db_fetch_row(pwg_query($query))) !== false)) 
     1237  { 
     1238    $user_idsOK = explode(',', $t[0]); 
     1239    $v = (in_array($uid, $user_idsOK)); 
     1240  } 
     1241  return $v; 
     1242} 
    11871243?> 
  • extensions/NBC_UserAdvManager/trunk/include/upgradedb.inc.php

    r6354 r6775  
    247247  $Newconf_UAM[19] = $Newconf_UAM[20]; 
    248248  $Newconf_UAM[20] = $Newconf_UAM[21]; 
    249   unset($Newconf_UAM[21]); 
     249  $Newconf_UAM[21] = 'false'; 
    250250   
    251251  $update_conf = serialize($Newconf_UAM); 
     
    258258                ;'; 
    259259 
    260                 pwg_query($query); 
     260        pwg_query($query); 
     261 
     262  $query = ' 
     263INSERT INTO '.CONFIG_TABLE.' (param, value, comment) 
     264VALUES ("UserAdvManager_Redir","0","UAM Redirections") 
     265  ;'; 
     266   
     267  pwg_query($query); 
    261268} 
    262269?> 
  • extensions/NBC_UserAdvManager/trunk/language/de_DE/help/plugin.lang.php

    r6754 r6775  
    169169/*TODO*/$lang['UAM_confirmmailTitle_d'] = 'This option allows a user to either confirm registration by clicking on a link received in an email sent upon registration or the administrator to manually activate the registration.<br><br> 
    170170In first case, the e-mail is composed of a customizable part to introduce a little welcome note and a fixed part containing the activation link that is generated from a random key that can possibly regenerate through the &quot;Tracking validations&quot; tab.<br><br> 
    171 Dans le premier cas, le message envoyé comprend une partie fixe, avec le lien d\'activation généré à partir d\'une clef aléatoire (cette clé peut éventuellement être régénérée via l\'onglet &quot;Suivi des validations&quot;), et une partie personnalisable par un texte d\'accueil. 
    172171<br><br> 
    173172In second case, <b><u>there is no validation key send by email!</u></b>. Visitors have to wait until an administrator validate them himself in &quot;Validation tracking&quot; tab. It\s recommanded to activate the Piwigo\'s option &quot;Email admins when a new user registers&quot; (see in Piwigo\'s configuration options) and to use the &quot;Information email to user&quot; to warn new registers to wait on their account activation. 
     
    176175<br><br> 
    177176Diese Option ist in der Regel mit der automatischen Zuordnung der Gruppe und / oder Satzung verwendet. Zum Beispiel, ein Benutzer, der nicht validiert ihre Eintragung in eine bestimmte Gruppe von Nutzern eingestellt werden (mit oder ohne Einschr&auml;nkungen auf der Galerie), w&auml;hrend ein Benutzer, der seine Registrierung best&auml;tigt wird in einem &quot;normalen&quot; Gruppe eingestellt werden.'; 
     177$lang['UAM_RedirTitle'] = 'Umleitung auf &quot;Benutzerdaten&quot; Seite'; 
     178$lang['UAM_RedirTitle_d'] = 'Diese Option automatisch umleiten ein registrierter Benutzer zum sein Benutzerdaten Seite nur bei seinem ersten Anschluss an die Galerie.<br><br> 
     179Bitte beachten Sie: Diese Funktion gilt für alle bereits registrierten Nutzern einschließlich derjenigen mit &quot;admin&quot;, &quot;Webmaster&quot; oder &quot;Generic&quot; Status.'; 
    178180// --------- End: New or revised $lang ---- from version 2.15.4 
    179181?> 
  • extensions/NBC_UserAdvManager/trunk/language/de_DE/plugin.lang.php

    r6757 r6775  
    265265 
    266266// --------- Starting below: New or revised $lang ---- from version 2.15.4 
    267 /*TODO*/$lang['Force_Validation'] = 'Manual validation'; 
    268 /*TODO*/$lang['UAM_Confirm_Mail_true'] = ' Enable - Validation by user'; 
    269 /*TODO*/$lang['UAM_Confirm_Mail_local'] = ' Enable - Validation by admin (no validation key sent)'; 
     267$lang['Force_Validation'] = 'Handbuch Validierung'; 
     268$lang['UAM_Confirm_Mail_true'] = ' Aktivieren - Validation von Benutzer'; 
     269$lang['UAM_Confirm_Mail_local'] = ' Aktivieren - Validation von admin (keine Validierung Key gesendet)'; 
     270$lang['UAM_RedirToProfile'] = 'Umleitung auf "Benutzerdaten" Seite'; 
     271$lang['UAM_RedirToProfile_false'] = ' Deaktivieren (Standard)'; 
     272$lang['UAM_RedirToProfile_true'] = ' Aktivieren'; 
    270273// --------- End: New or revised $lang ---- from version 2.15.4 
    271274?> 
  • extensions/NBC_UserAdvManager/trunk/language/en_UK/help/plugin.lang.php

    r6754 r6775  
    175175<br><br> 
    176176This option is generally used with the automatic assignment of group and/or statutes. For example, a user who has not validated their registration will be set in a specific group of users (with or without restrictions on the gallery) while a user who validated his registration shall be set in a &quot;normal&quot; group.'; 
     177$lang['UAM_RedirTitle'] = 'Redirect to &quot;Customization&quot; page'; 
     178$lang['UAM_RedirTitle_d'] = 'This option automatically redirect a registered user to his customization page only at his first connection to the gallery.<br><br> 
     179Please note: This feature applies to all already registered users including those with &quot;admin&quot;, &quot;webmaster&quot; or &quot;generic&quot; status.'; 
    177180// --------- End: New or revised $lang ---- from version 2.15.4 
    178181?> 
  • extensions/NBC_UserAdvManager/trunk/language/en_UK/plugin.lang.php

    r6757 r6775  
    265265$lang['UAM_Confirm_Mail_true'] = ' Enable - Validation by user'; 
    266266$lang['UAM_Confirm_Mail_local'] = ' Enable - Validation by admin (no validation key sent)'; 
     267$lang['UAM_RedirToProfile'] = 'Redirect to "Customization" page'; 
     268$lang['UAM_RedirToProfile_false'] = ' Disable (default)'; 
     269$lang['UAM_RedirToProfile_true'] = ' Enable'; 
    267270// --------- End: New or revised $lang ---- from version 2.15.4 
    268271?> 
  • extensions/NBC_UserAdvManager/trunk/language/es_ES/help/plugin.lang.php

    r6754 r6775  
    176176<br><br> 
    177177Esta opci&oacute;n se utiliza generalmente con la asignaci&oacute;n autom&aacute;tica de grupo y / o estatutos. Por ejemplo, un usuario que no ha validado su registro se encuentra en un grupo espec&iacute;fico de usuarios (con o sin restricciones a la galer&iacute;a) mientras que un usuario que haya validado su registro se encuentra en un &quot;normal&quot; del grupo.'; 
     178$lang['UAM_RedirTitle'] = 'Redirigir a la página de &quot;personalizaci&oacute;n&quot;'; 
     179$lang['UAM_RedirTitle_d'] = 'Esta opción se redireccionan automáticamente un usuario registrado para su página de personalización sólo en su primera conexión a la galería.<br><br> 
     180Atención: Esta característica se aplica a todos los usuarios ya registrados, incluidos aquellos con estados &quot;admin&quot;, &quot;webmaster&quot; o &quot;generic&quot;.'; 
    178181// --------- End: New or revised $lang ---- from version 2.15.4 
    179182?> 
  • extensions/NBC_UserAdvManager/trunk/language/es_ES/plugin.lang.php

    r6757 r6775  
    264264 
    265265// --------- Starting below: New or revised $lang ---- from version 2.15.4 
    266 /*TODO*/$lang['Force_Validation'] = 'Manual validation'; 
    267 /*TODO*/$lang['UAM_Confirm_Mail_true'] = ' Enable - Validation by user'; 
    268 /*TODO*/$lang['UAM_Confirm_Mail_local'] = ' Enable - Validation by admin (no validation key sent)'; 
     266$lang['Force_Validation'] = 'Validación manual'; 
     267$lang['UAM_Confirm_Mail_true'] = ' Activar - La validación por el usuario'; 
     268$lang['UAM_Confirm_Mail_local'] = ' Activar - La validación por el administrador (sin clave de validación enviado)'; 
     269$lang['UAM_RedirToProfile'] = 'Redirigir a la página de "personalización"'; 
     270$lang['UAM_RedirToProfile_false'] = ' Desactivar (por defecto)'; 
     271$lang['UAM_RedirToProfile_true'] = ' Activar'; 
    269272// --------- End: New or revised $lang ---- from version 2.15.4 
    270273?> 
  • extensions/NBC_UserAdvManager/trunk/language/fr_FR/help/plugin.lang.php

    r6754 r6775  
    171171<br><br> 
    172172Cette option est généralement utilisée avec  l\'attribution automatique de groupe et/ou de statut. Selon qu\'il a validé ou non son inscription, il est en effet possible d\'affecter à l\'utilisateur un groupe différent, avec plus ou moins de restrictions d\'accès à la galerie.'; 
     173$lang['UAM_RedirTitle'] = 'Redirection vers la page &quot;Personnalisation&quot;'; 
     174$lang['UAM_RedirTitle_d'] = 'Cette option permet de rediriger automatiquement un utilisateur inscrit vers sa page de personnalisation uniquement lors de sa première connexion à la galerie.<br><br> 
     175A savoir: Cette fonction s\'applique également à tous les utilisateurs déjà inscrits, y compris ceux disposant du status &quot;admin&quot;, &quot;webmaster&quot; ou &quot;generique&quot;.'; 
    173176// --------- End: New or revised $lang ---- from version 2.15.4 
    174177?> 
  • extensions/NBC_UserAdvManager/trunk/language/fr_FR/plugin.lang.php

    r6757 r6775  
    264264$lang['UAM_Confirm_Mail_true'] = ' Activer - Validation par le visiteur'; 
    265265$lang['UAM_Confirm_Mail_local'] = ' Activer - Validation par l\'administrateur (pas d\'envoi de clé de validation)'; 
     266$lang['UAM_RedirToProfile'] = 'Redirection vers la page "Personnalisation"'; 
     267$lang['UAM_RedirToProfile_false'] = ' Désactiver (valeur par défaut)'; 
     268$lang['UAM_RedirToProfile_true'] = ' Activer'; 
    266269// --------- End: New or revised $lang ---- from version 2.15.4 
    267270?> 
  • extensions/NBC_UserAdvManager/trunk/language/it_IT/help/plugin.lang.php

    r6754 r6775  
    172172<br><br> 
    173173Questa opzione &egrave; generalmente utilizzato con l\'assegnazione automatica di gruppo e / o statuto. Ad esempio, un utente che non ha convalidato la loro registrazione sar&agrave; ambientato in un gruppo specifico di utenti (con o senza le restrizioni alla galleria), mentre un utente che ha convalidato la sua registrazione &egrave; fissato in un &quot;normale&quot; del gruppo.'; 
     174/*TODO*/$lang['UAM_RedirTitle'] = 'Redirect to &quot;Customization&quot; page'; 
     175/*TODO*/$lang['UAM_RedirTitle_d'] = 'This option automatically redirect a registered user to his customization page only at his first connection to the gallery.<br><br> 
     176Please note: This feature applies to all already registered users including those with &quot;admin&quot;, &quot;webmaster&quot; or &quot;generic&quot; status.'; 
    174177// --------- End: New or revised $lang ---- from version 2.15.4 
    175178?> 
  • extensions/NBC_UserAdvManager/trunk/language/it_IT/plugin.lang.php

    r6757 r6775  
    267267/*TODO*/$lang['UAM_Confirm_Mail_true'] = ' Enable - Validation by user'; 
    268268/*TODO*/$lang['UAM_Confirm_Mail_local'] = ' Enable - Validation by admin (no validation key sent)'; 
     269/*TODO*/$lang['UAM_RedirToProfile'] = 'Redirect to "Customization" page'; 
     270$lang['UAM_RedirToProfile_false'] = ' Disattivare (di default)'; 
     271$lang['UAM_RedirToProfile_true'] = ' Attivare'; 
    269272// --------- End: New or revised $lang ---- from version 2.15.4 
    270273?> 
  • extensions/NBC_UserAdvManager/trunk/main.inc.php

    r6757 r6775  
    22/* 
    33Plugin Name: UserAdvManager 
    4 Version: 2.15.4b 
     4Version: 2.15.4 
    55Description: Renforcer la gestion des utilisateurs - Enforce users management 
    66Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=216 
     
    1313/* 
    1414 ***** TODO List ***** 
    15 ++ Adding ASC and DESC ordering for user's lists tables (Ghost Tracker, UserList and Unvalidated) ? 
    16  
    1715++ No validation needed for admins users comments (new trigger needed in comments.php ?) 
    1816 
     
    177175  /* Cleanup for LastVisit table */ 
    178176  DeleteLastVisit($user_id); 
     177  /* Cleanup Redirection settings */ 
     178  DeleteRedir($user_id); 
    179179} 
    180180 
     
    320320 
    321321    $conf_UAM = unserialize($conf['UserAdvManager']); 
     322 
     323    if ((isset($conf_UAM[21]) and $conf_UAM[21] == 'true')) 
     324    { 
     325      $user_idsOK = array(); 
     326      if (!check_consult($user['id'], $user_idsOK)) 
     327      { 
     328        $user_idsOK[] = $user['id']; 
     329         
     330        $query = " 
     331          UPDATE ".CONFIG_TABLE." 
     332          SET value = \"".implode(',', $user_idsOK)."\" 
     333          WHERE param = 'UserAdvManager_Redir';"; 
     334           
     335        pwg_query($query); 
     336      } 
     337    } 
    322338 
    323339    if (isset($_POST['validate']) and !is_admin()) 
     
    399415 
    400416 
     417// RedirectToProfile - Thx to LucMorizur 
     418// redirects a visitor (not generic (forbidden) neither admin) to his 
     419// profile.php page 
     420// 
     421// no variable, no return 
     422add_event_handler('login_success', 'RedirectToProfile'); 
     423 
     424function RedirectToProfile() 
     425{ 
     426  global $conf, $user; 
     427   
     428  $conf_UAM = unserialize($conf['UserAdvManager']); 
     429 
     430  if ((isset($conf_UAM[21]) and $conf_UAM[21] == 'true')) 
     431  { 
     432    $user_idsOK = array(); 
     433    if (!check_consult($user['id'], $user_idsOK)) 
     434      redirect(PHPWG_ROOT_PATH.'profile.php'); 
     435  } 
     436} 
     437 
     438 
    401439add_event_handler('init', 'UAM_InitPage'); 
    402440/* *** Important ! This is necessary to make email exclusion work in admin's users management panel *** */ 
  • extensions/NBC_UserAdvManager/trunk/maintain.inc.php

    r6354 r6775  
    1818        global $conf; 
    1919         
    20   $default1 = array('false','false','false',-1,-1,-1,'false','false','',-1,'','','false','','false',100,'false','false',10,'Hello. 
     20  $default1 = array('false','false',-1,-1,-1,'false','false','',-1,'','','false','','false',100,'false','false',10,'Hello. 
    2121         
    2222This is a reminder because a very long time passed since your last visit on our gallery. 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. 
     
    4848INSERT INTO '.CONFIG_TABLE.' (param, value, comment) 
    4949VALUES ("UserAdvManager_ConfirmMail","'.addslashes(serialize($default2)).'","UAM ConfirmMail parameters") 
     50  ;'; 
     51  pwg_query($q); 
     52   
     53  $q = ' 
     54INSERT INTO '.CONFIG_TABLE.' (param, value, comment) 
     55VALUES ("UserAdvManager_Redir","0","UAM Redirections") 
    5056  ;'; 
    5157  pwg_query($q); 
     
    160166  } 
    161167 
    162 /* Check if old version is > 2.15 */ 
    163 /* ****************************** */ 
    164 // In preparation of next releases 
    165    $query = ' 
     168/* Old version is > 2.15 */ 
     169/* ********************* */ 
     170        $query = ' 
    166171SELECT param 
    167172  FROM '.CONFIG_TABLE.' 
    168 WHERE param LIKE "UserAdvManager%" 
     173WHERE param = "UserAdvManager_Redir" 
    169174;'; 
    170175  $count = pwg_db_num_rows(pwg_query($query)); 
    171176   
    172   if ($count == 2) 
    173   { 
    174     $query = ' 
    175 SELECT value 
    176   FROM '.CONFIG_TABLE.' 
    177 WHERE param = "UserAdvManager" 
    178 ;'; 
    179  
    180     $result = pwg_query($query); 
    181     $conf = pwg_db_fetch_assoc($result); 
    182      
    183     $conf_UAM = unserialize($conf['value']); 
    184     $Nb_values = count($conf_UAM); 
    185     if ($Nb_values = 22) 
    186     { 
    187       upgrade_2153_2154(); 
    188     } 
     177  if ($count == 0) 
     178  { 
     179    upgrade_2153_2154(); 
    189180  } 
    190181