Ignore:
Timestamp:
Sep 13, 2009, 10:52:08 PM (11 years ago)
Author:
Eric
Message:
  • Finalization and improvement of resending validation mail with and without new key regeneration. That works fine now.
  • Adding of a new plugin tab to display users management table

-> Left to do :

  • Adding "force validation" function
  • Beta testing
Location:
extensions/NBC_UserAdvManager/trunk/admin
Files:
2 edited

Legend:

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

    r3841 r3845  
    3333               l10n('Tab_ConfirmMail'),
    3434               $my_base_url.'&tab=confirmmail');
    35 /* For futur options */
    36 //$tabsheet->add('Misc_Options',
    37 //               l10n('Tab_Misc_Options'),
    38 //               $my_base_url.'&tab=Misc_Options');
     35$tabsheet->add('usermanager',
     36               l10n('Tab_UserManager'),
     37               $my_base_url.'&tab=usermanager');
    3938$tabsheet->select($page['tab']);
    4039$tabsheet->assign();
     
    304303  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
    305304       
    306   if (isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2]=='true' )
     305  if (isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2]=='true')
    307306  {
    308307    if ( isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_ConfirmMail_TimeOut']) )
    309308                {
    310                 $_POST['UserAdvManager_ConfirmMail_ReMail_Txt'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_ReMail_Txt']));
     309                $_POST['UserAdvManager_ConfirmMail_ReMail_Txt1'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_ReMail_Txt1']));
     310                $_POST['UserAdvManager_ConfirmMail_ReMail_Txt2'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_ReMail_Txt2']));
    311311                 
    312                 $newconf_nbc_UserAdvManager_ConfirmMail = $_POST['UserAdvManager_ConfirmMail_TimeOut'].';'.$_POST['UserAdvManager_ConfirmMail_Delay'].';'.$_POST['UserAdvManager_ConfirmMail_ReMail_Txt'];
     312                $newconf_nbc_UserAdvManager_ConfirmMail = $_POST['UserAdvManager_ConfirmMail_TimeOut'].';'.$_POST['UserAdvManager_ConfirmMail_Delay'].';'.$_POST['UserAdvManager_ConfirmMail_ReMail_Txt1'].';'.$_POST['UserAdvManager_ConfirmMail_Remail'].';'.$_POST['UserAdvManager_ConfirmMail_ReMail_Txt2'];
    313313                 
    314314//NODO:Adding new option [Auto deletion : True | False] - No access to cron functionnalities
     
    328328                }
    329329       
    330                 $conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array();
    331 
     330                $conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array();               
     331
     332          $template->assign(
     333          array(
     334                'UserAdvManager_CONFIRMMAIL_TIMEOUT_TRUE'               => $conf_nbc_UserAdvManager_ConfirmMail[0]=='true' ?  'checked="checked"' : '' ,
     335                'UserAdvManager_CONFIRMMAIL_TIMEOUT_FALSE'      => $conf_nbc_UserAdvManager_ConfirmMail[0]=='false' ?  'checked="checked"' : '' ,
     336                'UserAdvManager_CONFIRMMAIL_DELAY'                                      => $conf_nbc_UserAdvManager_ConfirmMail[1],
     337    'UserAdvManager_CONFIRMMAIL_REMAIL_TXT1'            => $conf_nbc_UserAdvManager_ConfirmMail[2],
     338    'UserAdvManager_CONFIRMMAIL_REMAIL_TXT2'            => $conf_nbc_UserAdvManager_ConfirmMail[4],
     339    'UserAdvManager_CONFIRMMAIL_REMAIL_TRUE'            => $conf_nbc_UserAdvManager_ConfirmMail[3]=='true' ? 'checked="checked"' : '',
     340    'UserAdvManager_CONFIRMMAIL_REMAIL_FALSE'           => $conf_nbc_UserAdvManager_ConfirmMail[3]=='false' ? 'checked="checked"' : '',
     341        )
     342          );           
     343
     344// +-----------------------------------------------------------------------+
     345// |                             errors display                            |
     346// +-----------------------------------------------------------------------+
     347        if ( isset ($errors) and count($errors) != 0)
     348        {
     349          $template->assign('errors',array());
     350                foreach ($errors as $error)
     351          {
     352                        array_push($page['errors'], $error);
     353          }
     354        } 
     355
     356// +-----------------------------------------------------------------------+
     357// |                           templates display                           |
     358// +-----------------------------------------------------------------------+
     359                $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/confirmmail.tpl');
     360    $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');         
     361  }
     362  else
     363  {
     364                array_push($page['infos'], l10n('Err_ConfirmMail_Settings'));
     365  }
     366  break;
     367
     368
     369// +-----------------------------------------------------------------------+
     370// |                           Users manager page                          |
     371// +-----------------------------------------------------------------------+
     372  case 'usermanager':
     373  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
     374  $conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array();
     375       
     376  if (isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2]=='true' and isset($conf_nbc_UserAdvManager_ConfirmMail[0]) and $conf_nbc_UserAdvManager_ConfirmMail[0]=='true' )
     377  {
    332378// +-----------------------------------------------------------------------+
    333379// |                           initialization                              |
     
    396442// +-----------------------------------------------------------------------+
    397443        if (isset($_POST['Del_Selected']) and count($collection) > 0)
    398     {
    399       if (in_array($conf['guest_id'], $collection))
    400           {
    401         array_push($page['errors'], l10n('Guest cannot be deleted'));
    402       }
    403       if (($conf['guest_id'] != $conf['default_user_id']) and
    404         in_array($conf['default_user_id'], $collection))
    405       {
    406         array_push($page['errors'], l10n('Default user cannot be deleted'));
    407       }
    408       if (in_array($conf['webmaster_id'], $collection))
    409       {
    410         array_push($page['errors'], l10n('Webmaster cannot be deleted'));
    411       }
    412       if (in_array($user['id'], $collection))
    413       {
    414         array_push($page['errors'], l10n('You cannot delete your account'));
    415       }
    416 
    417       if (count($page['errors']) == 0)
    418       {
    419         foreach ($collection as $user_id)
     444  {
     445        if (in_array($conf['guest_id'], $collection))
     446        {
     447        array_push($page['errors'], l10n('Guest cannot be deleted'));
     448    }
     449    if (($conf['guest_id'] != $conf['default_user_id']) and
     450        in_array($conf['default_user_id'], $collection))
     451    {
     452        array_push($page['errors'], l10n('Default user cannot be deleted'));
     453    }
     454    if (in_array($conf['webmaster_id'], $collection))
     455    {
     456        array_push($page['errors'], l10n('Webmaster cannot be deleted'));
     457    }
     458    if (in_array($user['id'], $collection))
     459    {
     460        array_push($page['errors'], l10n('You cannot delete your account'));
     461    }
     462
     463    if (count($page['errors']) == 0)
     464    {
     465        foreach ($collection as $user_id)
     466      {
     467        delete_user($user_id);
     468      }
     469        array_push(
     470        $page['infos'],
     471        l10n_dec(
     472        '%d user deleted', '%d users deleted',
     473        count($collection)
     474        )
     475      );
     476
     477      foreach ($page['filtered_users'] as $filter_key => $filter_user)
     478      {
     479        if (in_array($filter_user['id'], $collection))
    420480        {
    421           delete_user($user_id);
    422         }
    423         array_push(
    424           $page['infos'],
    425           l10n_dec(
    426           '%d user deleted', '%d users deleted',
    427           count($collection)
    428           )
    429         );
    430 
    431         foreach ($page['filtered_users'] as $filter_key => $filter_user)
    432         {
    433           if (in_array($filter_user['id'], $collection))
    434           {
    435             unset($page['filtered_users'][$filter_key]);
    436           }
    437         }
    438       }
     481                unset($page['filtered_users'][$filter_key]);
     482        }
     483      }
     484                }
    439485        }
    440486
     
    737783              );
    738784        }
    739           }             
    740 
    741           $template->assign(
    742           array(
    743                 'UserAdvManager_CONFIRMMAIL_TIMEOUT_TRUE'               => $conf_nbc_UserAdvManager_ConfirmMail[0]=='true' ?  'checked="checked"' : '' ,
    744                 'UserAdvManager_CONFIRMMAIL_TIMEOUT_FALSE'      => $conf_nbc_UserAdvManager_ConfirmMail[0]=='false' ?  'checked="checked"' : '' ,
    745                 'UserAdvManager_CONFIRMMAIL_DELAY'                                      => $conf_nbc_UserAdvManager_ConfirmMail[1],
    746     'UserAdvManager_CONFIRMMAIL_REMAIL_TXT'                     => $conf_nbc_UserAdvManager_ConfirmMail[2],
    747         )
    748           );           
     785          }
     786
     787
     788
     789
    749790
    750791// +-----------------------------------------------------------------------+
     
    758799                array_push($page['errors'], $error);
    759800          }
    760         } 
     801        } 
    761802
    762803// +-----------------------------------------------------------------------+
    763804// |                           templates display                           |
    764805// +-----------------------------------------------------------------------+
    765         $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/confirmmail.tpl');
     806        $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/usermanager.tpl');
    766807    $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');         
    767808  }
    768809  else
    769810  {
    770         array_push($page['infos'], l10n('Err_ConfirmMail_Settings'));
     811        array_push($page['infos'], l10n('Err_UserManager_Settings'));
    771812  }
    772   break;
     813  break;
     814 
    773815}
    774816?>
  • extensions/NBC_UserAdvManager/trunk/admin/confirmmail.tpl

    r3841 r3845  
    2121      <br>
    2222            </li>-->
    23                 <li><label>{'UserAdvManager_ConfirmMail_ReMail_Txt'|@translate}</label><br>
    24                 <textarea name="UserAdvManager_ConfirmMail_ReMail_Txt" id="UserAdvManager_ConfirmMail_ReMail_Txt" rows="10" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_REMAIL_TXT}</textarea>
    25       <br>
    26             </li>
     23    <li><label>{'UserAdvManager_ConfirmMail_Remail'|@translate}</label><br>
     24        <input type="radio" value="true" {$UserAdvManager_CONFIRMMAIL_REMAIL_TRUE} name="UserAdvManager_ConfirmMail_Remail"/> {'UserAdvManager_ConfirmMail_Remail_true'|@translate}<br>
     25      <input type="radio" value="false" {$UserAdvManager_CONFIRMMAIL_REMAIL_FALSE} name="UserAdvManager_ConfirmMail_Remail"/> {'UserAdvManager_ConfirmMail_Remail_false'|@translate}<br>
     26    <br>
     27    </li>
     28        {if $UserAdvManager_CONFIRMMAIL_REMAIL_TRUE}
     29                <li><label>{'UserAdvManager_ConfirmMail_ReMail_Txt1'|@translate}</label><br>
     30                <textarea name="UserAdvManager_ConfirmMail_ReMail_Txt1" id="UserAdvManager_ConfirmMail_ReMail_Txt1" rows="10" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_REMAIL_TXT1}</textarea>
     31    <br><br>
     32          </li>
     33                <li><label>{'UserAdvManager_ConfirmMail_ReMail_Txt2'|@translate}</label><br>
     34                <textarea name="UserAdvManager_ConfirmMail_ReMail_Txt2" id="UserAdvManager_ConfirmMail_ReMail_Txt2" rows="10" cols="80" {$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_REMAIL_TXT2}</textarea>
     35    <br>
     36          </li>
     37  {else}
     38                <li><label>{'UserAdvManager_ConfirmMail_ReMail_Txt1'|@translate}</label><br>
     39                <textarea  name="UserAdvManager_ConfirmMail_ReMail_Txt1" id="UserAdvManager_ConfirmMail_ReMail_Txt1" rows="10" cols="80" readonly{$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_REMAIL_TXT1}</textarea>
     40    <br><br>
     41          </li>
     42                <li><label>{'UserAdvManager_ConfirmMail_ReMail_Txt2'|@translate}</label><br>
     43                <textarea name="UserAdvManager_ConfirmMail_ReMail_Txt2" id="UserAdvManager_ConfirmMail_ReMail_Txt2" rows="10" cols="80" readonly {$TAG_INPUT_ENABLED}>{$UserAdvManager_CONFIRMMAIL_REMAIL_TXT2}</textarea>
     44    <br>
     45          </li>
     46        {/if}
    2747    </ul>
    2848        <p><input class="submit" type="submit" value="{'submit'|@translate}" name="submit" {$TAG_INPUT_ENABLED} /></p>
    29       <br><hr><br>
    30     <ul>
    31                 <li><label>{'UserAdvManager_ConfirmMail_User_List'|@translate}</label><br>
    32       <br>
    33 
    34                 <table class="table2" width="97%" summary="">
    35                         <thead>
    36                         <tr class="throw">
    37                         <td>&nbsp;</td>
    38                         <td>{'Username'|@translate}</td>
    39                         <td>{'user_status'|@translate}</td>
    40                         <td>{'Email address'|@translate}</td>
    41                         <td>{'Groups'|@translate}</td>
    42                         <td>{'Registration'|@translate}</td>
    43                         </tr>
    44                         </thead>
    45 
    46                         {foreach from=$users item=user name=users_loop}
    47                                 <tr class="{if $smarty.foreach.users_loop.index is odd}row1{else}row2{/if}">
    48                         <td><input type="checkbox" name="selection[]" value="{$user.ID}" {$user.CHECKED} id="selection-{$user.ID}" /></td>
    49                         <td><label for="selection-{$user.ID}">{$user.USERNAME}</label></td>
    50                         <td>{$user.STATUS}</td>
    51                         <td>{$user.EMAIL}</td>
    52                         <td>{$user.GROUPS}</td>
    53 
    54                         {foreach from=$user.plugin_columns item=data}
    55                         <td>{$data}</td>
    56                         {/foreach}
    57                         <td style="text-align:center;">{$user.REGISTRATION}</td>
    58                         </tr>
    59                 {/foreach}
    60         </table>
    61         <br/>
    62             </li>
    63     </ul>
    64 
    65 <p>
    66   {'target'|@translate}
    67   <label><input type="radio" name="target" value="all" /> {'all'|@translate}</label>
    68   <label><input type="radio" name="target" value="selection" checked="checked" /> {'selection'|@translate}</label>
    69 </p>
    70 
    71 <p>
    72   <input class="submit" type="submit" value="{'Delete_selected'|@translate}" name="Del_Selected" />
    73   <input class="submit" type="submit" value="{'Mail_without_key'|@translate}" name="Mail_Without_Key" />
    74   <input class="submit" type="submit" value="{'Mail_with_key'|@translate}" name="Mail_With_Key" />
    75   <input class="submit" type="submit" value="{'Force_Validation'|@translate}" name="Force_Validation" />
    76   <!--
    77 <input class="submit" type="submit" value="{'submit'|@translate}" name="submit" {$TAG_INPUT_ENABLED} />
    78 -->
    79 </p>
    8049  </fieldset>
    8150</form>
Note: See TracChangeset for help on using the changeset viewer.