Guest User

cb.passgen

a guest
Dec 1st, 2014
172
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /** ensure this file is being included by a parent file */
  2. if ( ! ( defined( '_VALID_CB' ) || defined( '_JEXEC' ) || defined( '_VALID_MOS' ) ) ) { die( 'Direct Access to this location is not allowed.' ); }
  3.  
  4. use CBLib\AhaWow\Controller\Elements\TableBrowser;
  5.  
  6. global $_PLUGINS;
  7. $_PLUGINS->loadPluginGroup( 'user', array( (int) 1 ) );
  8. $_PLUGINS->registerUserFieldTypes( array( 'passgen' => 'CBpassgen' ) );
  9. $_PLUGINS->registerUserFieldParams();
  10.  
  11. class CBpassgen extends TableBrowser {
  12.  
  13.     function draw( $viewType = 'view' ) {
  14.         $this->_performTableActions();
  15.     }
  16.  
  17.     protected function _performTableActions() {
  18.    
  19.         global $_CB_framework;
  20.  
  21.         if ( ! isset( $_REQUEST[$this->name] ) ) {
  22.             return;
  23.         }
  24.         $subtask        =   cbGetParam( $_REQUEST[$this->name], 'subtask', '' );
  25.         if ( ! $subtask ) {
  26.             return;
  27.         }
  28.         $task_parsed    =   explode( '/', $subtask );
  29.        
  30.         switch ( $task_parsed[0] ) {
  31.             case 'setfield':
  32.                 switch ( $task_parsed[1] ) {
  33.                     case 'block':
  34.                         if ($task_parsed[2]==0) {
  35.                             $_CB_framework->enqueueMessage( 'Sent an email with a new generated password!' );
  36.                         }
  37.                         break;
  38.                     default:
  39.                         break;
  40.                 }
  41.                 break;
  42.             default:
  43.                 break;
  44.         }
  45.     }
  46. }
RAW Paste Data