GlisWeb framework
_account.gestione.php
Vai alla documentazione di questo file.
1 <?php
2 
13  // tabella gestita
14  $ct['etc']['table'] = 'account';
15 
16  // tendina anagrafica
17  $ct['etc']['id_anagrafica'] = mysqlQuery( $cf['mysql']['connection'], 'SELECT id, __label__ FROM anagrafica_view' );
18 
19  // tendina mail
20  if( isset( $_REQUEST['account']['id_anagrafica'] ) && ! empty( $_REQUEST['account']['id_anagrafica'] ) ) {
21  $ct['etc']['id_mail'] = mysqlQuery( $cf['mysql']['connection'], 'SELECT id, __label__ FROM mail_view WHERE id_anagrafica = ?', array( array( 's' => $_REQUEST['account']['id_anagrafica'] ) ) );
22  }
23 
24  // tendina account
25  // TODO filtrare i gruppi in base all'account connesso
26  $ct['etc']['id_gruppo'] = mysqlQuery( $cf['mysql']['connection'], 'SELECT id, __label__ FROM gruppi_view' );
27 
28  // tendina ruolo
29  $ct['etc']['se_amministratore'] = array(
30  array( 'id' => 1, '__label__' => 'amministratore' ),
31  array( 'id' => 0, '__label__' => 'membro' )
32  );
33 
34  // impedisco che la password cifrata venga inviata al modulo
35  unset( $_REQUEST['account']['password'] );
36 
37  if( isset( $_REQUEST[ $ct['etc']['table'] ]['id'] ) ){
38  // attivazione dell'account
39  if( isset( $_REQUEST['__activation__'] )){
40 # print_r('attiva');
41  // attivo l'account
42  $azione = mysqlQuery( $cf['mysql']['connection'], 'UPDATE account SET se_attivo = 1 WHERE id = ?', array( array('s' => $_REQUEST[ $ct['etc']['table'] ]['id'] ) ) );
43 
44 //print_r($azione);
45  if( $azione ){
46  // se l'attivazione va a buon fine
47  $_REQUEST[ $ct['etc']['table'] ]['se_attivo'] = 1;
48 
49  $account = mysqlSelectRow( $cf['mysql']['connection'], 'SELECT * FROM account_view '.
50  'LEFT JOIN mail ON mail.id = account_view.id_mail '.
51  'WHERE account_view.id = ?',
52  array( array('s' => $_REQUEST[ $ct['etc']['table'] ]['id'] ) ) );
53  // creo il token
54  $tk = md5( $account['username'].$account['password'] );
55  // invio la mail con il link e il token
57  $cf['mysql']['connection'],
58  $cf['mail']['tpl']['DEFAULT_ATTIVAZIONE_ACCOUNT'],
59  array( 'dati' => array( 'tk' => $tk ), 'ct' => $ct ),
60  strtotime( '+2 minutes' ),
61  array( $account['username'] => $account['indirizzo'] ),
62  $cf['localization']['language']['ietf']
63  );
64  }
65  }
66 
67  // disattivazione dell'account
68  if( isset( $_REQUEST['__disabling__'] )){
69  // disattivo l'account
70  $azione = mysqlQuery( $cf['mysql']['connection'], 'UPDATE account SET se_attivo = NULL WHERE id = ?', array( array('s' => $_REQUEST[ $ct['etc']['table'] ]['id'] ) ) );
71 
72  if( $azione ){
73  $_REQUEST[ $ct['etc']['table'] ]['se_attivo']= NULL;
74  // se la disattivazione va a buon fine
75 // $ct['etc']['attivo'] = 0;
76  $account = mysqlSelectRow( $cf['mysql']['connection'], 'SELECT * FROM account_view '.
77  'LEFT JOIN mail ON mail.id = account_view.id_mail '.
78  'WHERE account_view.id = ?',
79  array( array('s' => $_REQUEST[ $ct['etc']['table'] ]['id'] ) ) );
80  // creo il token
81  $tk = md5( $account['username'].$account['password'] );
82  // invio la mail con il link e il token
84  $cf['mysql']['connection'],
85  $cf['mail']['tpl']['DEFAULT_DISATTIVAZIONE_ACCOUNT'],
86  array( 'dati' => array( 'tk' => $tk ), 'ct' => $ct ),
87  strtotime( '+2 minutes' ),
88  array( $account['username'] => $account['indirizzo'] ),
89  $cf['localization']['language']['ietf']
90  );
91  }
92  }
93  }
94 
95  // gestione default
96  require DIRECTORY_BASE . '_src/_inc/_macro/_default.gestione.php';
97 
98 ?>
mysqlSelectRow( $c, $q, $p=false, &$e=array())
mysqlQuery( $c, $q, $p=false, &$e=array())
$cf['ricerca']['template']
Definition: _030.common.php:7
const DIRECTORY_BASE
Definition: _osm.php:3
$ct['etc']['table']
queueMailFromTemplate( $c, $t, $d, $timestamp_invio, $to, $l='it-IT', $to_cc=array(), $to_bcc=array(), $headers=array(), $server=NULL)
accoda una mail utilizzando un template
$_REQUEST['__view__'][ $ct['view']['id']]['__restrict__']['id_progetto']['EQ']