/[drupal]/contributions/modules/false_account/false_account.module
ViewVC logotype

Diff of /contributions/modules/false_account/false_account.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.11, Wed Oct 15 16:20:08 2008 UTC revision 1.11.2.1, Tue Dec 2 17:20:52 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: false_account.module,v 1.10 2008/08/25 15:21:54 introfini Exp $  // $Id: false_account.module,v 1.10 2008/08/25 15:21:54 introfini Exp $
3    
4  define('FALSE_ACCOUNT_DEFAULT', 0);  define('FALSE_ACCOUNT_DEFAULT', 0);
5  define('FALSE_ACCOUNT_WHITELISTED', 1);  define('FALSE_ACCOUNT_WHITELISTED', 1);
6  define('FALSE_ACCOUNT_BLOCKED', 2);  define('FALSE_ACCOUNT_BLOCKED', 2);
7    
8    
9  /**  /**
10   * Implementation of hook_user().   * Implementation of hook_user().
11   */   */
12  function false_account_user($op, &$edit, &$account, $category = NULL) {  function false_account_user($op, &$edit, &$account, $category = NULL) {
13    switch ($op) {    switch ($op) {
14      case 'insert':      case 'insert':
15        if (isset($_COOKIE['fad'])) {        if (isset($_COOKIE['fad'])) {
16          $cdata = explode(',', $_COOKIE['fad']);          $cdata = explode(',', $_COOKIE['fad']);
17          $cid = $cdata[0];          $cid = $cdata[0];
18          $count = db_result(db_query("          $count = db_result(db_query("
19            SELECT COUNT(cid)            SELECT COUNT(cid)
20            FROM {false_accounts}            FROM {false_accounts}
21            WHERE cid = '%s' and status = '%d'",            WHERE cid = '%s' and status = '%d'",
22            $cid, FALSE_ACCOUNT_BLOCKED            $cid, FALSE_ACCOUNT_BLOCKED
23          ));          ));
24          if ($count) {          if ($count) {
25            watchdog('false account', 'Blocked: '. $cid, WATCHDOG_NOTICE);            watchdog('false account', 'Blocked: '. $cid, WATCHDOG_NOTICE);
26            drupal_goto(variable_get('false_account_redirect', '<front>'));            drupal_goto(variable_get('false_account_redirect', '<front>'));
27          }          }
28        }        }
29        break;        break;
30      case 'login':      case 'login':
31        if (!isset($_COOKIE['fad'])) {        if (!isset($_COOKIE['fad'])) {
32          $uniqueid = md5('gsmi789'. uniqid(rand(), TRUE));          $uniqueid = md5('gsmi789'. uniqid(rand(), TRUE));
33          setcookie('fad', $uniqueid .','. $account->uid, time() + 31536000, "/");          setcookie('fad', $uniqueid .','. $account->uid, time() + 31536000, "/");
34        }        }
35        else{        else{
36          $cdata = explode(',', $_COOKIE['fad']);          $cdata = explode(',', $_COOKIE['fad']);
37          $cid = $cdata[0];          $cid = $cdata[0];
38          if (in_array($account->uid, $cdata)) {          if (in_array($account->uid, $cdata)) {
39            break;            break;
40          }          }
41          else{          else{
42            $new_cdata = $_COOKIE['fad'] .','. $account->uid;            $new_cdata = $_COOKIE['fad'] .','. $account->uid;
43            setcookie('fad', $new_cdata, time() + 31536000, "/" );            setcookie('fad', $new_cdata, time() + 31536000, "/" );
44            if (sizeof($cdata) == 2) {            if (sizeof($cdata) >= 2) {
45              db_query("              db_query("
46                INSERT INTO {false_accounts} (cid, uid, created, status)                DELETE FROM {false_accounts}
47                VALUES ('%s', '%d', %d, %d)",                WHERE cid = '%s'",
48                $cid, $cdata[1] , time(), FALSE_ACCOUNT_DEFAULT                $cid
49              );              );
50              db_query("  
51                INSERT INTO {false_accounts} (cid, uid, created, status)              $i = 1;
52                VALUES ('%s', '%d', %d, %d)",              $time = time();
53                $cid, $account->uid , time(), FALSE_ACCOUNT_DEFAULT              while ($i < sizeof($cdata)) {
54              );                db_query("
55            }                  INSERT INTO {false_accounts} (cid, uid, created, status)
56            else if (sizeof($cdata) > 2) {                  VALUES ('%s', %d, %d, %d)",
57              db_query("                  $cid, $cdata[$i++] , $time, FALSE_ACCOUNT_DEFAULT
58                INSERT INTO {false_accounts} (cid, uid, created, status)                );
59                VALUES ('%s', '%d', %d, %d)",              }
60                $cid, $account->uid , time(), FALSE_ACCOUNT_DEFAULT              db_query("
61              );                INSERT INTO {false_accounts} (cid, uid, created, status)
62            }                VALUES ('%s', %d, %d, %d)",
63          }                $cid, $account->uid , $time, FALSE_ACCOUNT_DEFAULT
64        }              );
65        break;            }
66      case 'view':          }
67        if (user_access('manage false account detector')) {        }
68          $res = db_query('SELECT cid FROM {false_accounts} WHERE uid = %d', $account->uid);        break;
69          if (db_num_rows($res) > 0) {      case 'view':
70                                          while ($res_cid = db_fetch_object($res)) {        if (user_access('manage false account detector')) {
71                                                  $ors[] = 'cid = "'. $res_cid->cid .'"';          $res = db_query('SELECT cid FROM {false_accounts} WHERE uid = %d', $account->uid);
72                                          }          if (db_num_rows($res) > 0) {
73                                          $or = implode(' OR ', $ors);                                          while ($res_cid = db_fetch_object($res)) {
74                                          $sql = "SELECT * FROM {false_accounts} WHERE " . $or;                                                  $ors[] = 'cid = "'. $res_cid->cid .'"';
75                                            }
76                                          $header = array(                                          $or = implode(' OR ', $ors);
77                                                  array('data' => t('User Accounts')),                                          $sql = "SELECT * FROM {false_accounts} WHERE " . $or;
78                                                  array('data' => t('Created'), 'field' => 'created', 'sort' => 'desc'),  
79                                          );                                          $header = array(
80                                          $result= pager_query($sql . tablesort_sql($header), 50, 0, NULL);                                                  array('data' => t('User Accounts')),
81                                          $rows = array();                                                  array('data' => t('Created'), 'field' => 'created', 'sort' => 'desc'),
82                                            );
83                                          $cookies = array();                                          $result= pager_query($sql . tablesort_sql($header), 50, 0, NULL);
84                                            $rows = array();
85                                          while ($cookie = db_fetch_object($result)) {  
86                                                  if (array_key_exists($cookie->cid, $cookies)) {                                          $cookies = array();
87                                                          array_push($cookies[$cookie->cid]['users'], $cookie->uid);  
88                                                  }                                          while ($cookie = db_fetch_object($result)) {
89                                                  else {                                                  if (array_key_exists($cookie->cid, $cookies)) {
90                                                          $cookies[$cookie->cid] = array();                                                          array_push($cookies[$cookie->cid]['users'], $cookie->uid);
91                                                          $cookies[$cookie->cid]['users'] = array();                                                  }
92                                                          array_push($cookies[$cookie->cid]['users'], $cookie->uid);                                                  else {
93                                                          $cookies[$cookie->cid]['created'] = $cookie->created;                                                          $cookies[$cookie->cid] = array();
94                                                  }                                                          $cookies[$cookie->cid]['users'] = array();
95                                          }                                                          array_push($cookies[$cookie->cid]['users'], $cookie->uid);
96                                                            $cookies[$cookie->cid]['created'] = $cookie->created;
97                                          $items['fad'] = array(                                                  }
98                                                  'value' => _false_account_build_user_table($header, $cookies, $account->uid),                                          }
99                                          );  
100                                            $items['fad'] = array(
101                                          return array(t('False Account') => $items);                                                  'value' => _false_account_build_user_table($header, $cookies, $account->uid),
102                                  }                                          );
103                                  else {  
104                                    $items['fad'] = array(                                          return array(t('False Account') => $items);
105                                                  'value' => t('No false accounts detected.'),                                  }
106                                          );                                  else {
107                                          return array(t('False Account') => $items);                                    $items['fad'] = array(
108                                  }                                                  'value' => t('No false accounts detected.'),
109        }                                          );
110        break;                                          return array(t('False Account') => $items);
111    }                                  }
112  }        }
113          break;
114  function false_account_menu($may_cache) {    }
115    $access = user_access('manage false account detector');  }
116    if ($may_cache) {  
117      $items[] = array(  function false_account_menu($may_cache) {
118        'path' => 'admin/user/false_account',    $access = user_access('manage false account detector');
119        'title' => t('False Account Detector'),    if ($may_cache) {
120        'callback' => 'false_account_page',      $items[] = array(
121        'callback arguments' => array(FALSE_ACCOUNT_DEFAULT),        'path' => 'admin/user/false_account',
122        'access' => $access,        'title' => t('False Account Detector'),
123        'weight' => 0        'callback' => 'false_account_page',
124      );        'callback arguments' => array(FALSE_ACCOUNT_DEFAULT),
125      $items[] = array(        'access' => $access,
126        'path' => 'admin/user/false_account/default',        'weight' => 0
127        'title' => t('Default'),      );
128        'callback' => 'false_account_page',      $items[] = array(
129        'callback arguments' => array(FALSE_ACCOUNT_DEFAULT),        'path' => 'admin/user/false_account/default',
130        'access' => $access,        'title' => t('Default'),
131        'type' => MENU_DEFAULT_LOCAL_TASK,        'callback' => 'false_account_page',
132        'weight' => 0        'callback arguments' => array(FALSE_ACCOUNT_DEFAULT),
133      );        'access' => $access,
134      $items[] = array(        'type' => MENU_DEFAULT_LOCAL_TASK,
135        'path' => 'admin/user/false_account/whitelisted',        'weight' => 0
136        'title' => t('Whitelisted'),      );
137        'callback' => 'false_account_page',      $items[] = array(
138        'callback arguments' => array(FALSE_ACCOUNT_WHITELISTED),        'path' => 'admin/user/false_account/whitelisted',
139        'access' => $access,        'title' => t('Whitelisted'),
140        'type' => MENU_LOCAL_TASK,        'callback' => 'false_account_page',
141        'weight' => 1        'callback arguments' => array(FALSE_ACCOUNT_WHITELISTED),
142      );        'access' => $access,
143      $items[] = array(        'type' => MENU_LOCAL_TASK,
144        'path' => 'admin/user/false_account/blocked',        'weight' => 1
145        'title' => t('Blocked'),      );
146        'callback' => 'false_account_page',      $items[] = array(
147        'callback arguments' => array(FALSE_ACCOUNT_BLOCKED),        'path' => 'admin/user/false_account/blocked',
148        'access' => $access,        'title' => t('Blocked'),
149        'type' => MENU_LOCAL_TASK,        'callback' => 'false_account_page',
150        'weight' => 1        'callback arguments' => array(FALSE_ACCOUNT_BLOCKED),
151        );        'access' => $access,
152      $items[] = array(        'type' => MENU_LOCAL_TASK,
153        'path' => 'admin/user/false_account/settings',        'weight' => 1
154        'title' => t('Settings'),        );
155        'callback' => 'drupal_get_form',      $items[] = array(
156        'callback arguments' => array('false_account_settings'),        'path' => 'admin/user/false_account/settings',
157        'access' => $access,        'title' => t('Settings'),
158        'type' => MENU_LOCAL_TASK,        'callback' => 'drupal_get_form',
159        'weight' => 2        'callback arguments' => array('false_account_settings'),
160      );        'access' => $access,
161        $items[] = array(        'type' => MENU_LOCAL_TASK,
162        'path' => 'admin/user/false_account/search',        'weight' => 2
163        'title' => t('Search'),      );
164        'callback' => 'false_account_searchfa',        $items[] = array(
165        'access' => $access,        'path' => 'admin/user/false_account/search',
166        'type' => MENU_LOCAL_TASK,        'title' => t('Search'),
167        'weight' => 2        'callback' => 'false_account_searchfa',
168      );        'access' => $access,
169      $items[] = array(        'type' => MENU_LOCAL_TASK,
170        'path' => 'admin/user/false_account/op',        'weight' => 2
171        'callback' => 'false_account_operations',      );
172        'access' => $access,      $items[] = array(
173        'type' => MENU_CALLBACK        'path' => 'admin/user/false_account/op',
174      );        'callback' => 'false_account_operations',
175    }        'access' => $access,
176    return $items;        'type' => MENU_CALLBACK
177  }      );
178      }
179  function false_account_perm() {    return $items;
180    return array('manage false account detector');  }
181  }  
182    function false_account_perm() {
183  /**    return array('manage false account detector');
184  * Define the settings form.  }
185  */  
186  function false_account_settings() {  /**
187    $form['false_account_redirect'] = array(  * Define the settings form.
188      '#type' => 'textfield',  */
189      '#title' => t('Redirect blocked users'),  function false_account_settings() {
190      '#default_value' =>  variable_get('false_account_redirect', '<front>'),    $form['false_account_redirect'] = array(
191      '#description' => t('Indicate the Drupal internal URL to redirect to or insert an external URL.'),      '#type' => 'textfield',
192    );      '#title' => t('Redirect blocked users'),
193        '#default_value' =>  variable_get('false_account_redirect', '<front>'),
194    return system_settings_form($form);      '#description' => t('Indicate the Drupal internal URL to redirect to or insert an external URL.'),
195  }    );
196  function false_account_page($op = FALSE_ACCOUNT_DEFAULT) {  
197      return system_settings_form($form);
198    $content = t('<p>User accounts marked with an * are blocked</p>');  }
199    $sql = 'SELECT * FROM {false_accounts} WHERE status = '. $op ;  function false_account_page($op = FALSE_ACCOUNT_DEFAULT) {
200    $header = array(  
201      array('data' => t('Cookie ID')),    $content = t('<p>User accounts marked with an * are blocked</p>');
202      array('data' => t('User Accounts')),    $sql = 'SELECT * FROM {false_accounts} WHERE status = '. $op;
203      array('data' => t('Created'), 'field' => 'created', 'sort' => 'desc'),    $header = array(
204      array('data' => t('Actions'))      array('data' => t('Cookie ID')),
205    );      array('data' => t('User Accounts')),
206    $result = pager_query($sql . tablesort_sql($header), 50);      array('data' => t('Created'), 'field' => 'created', 'sort' => 'desc'),
207    $rows = array();      array('data' => t('Actions'))
208      );
209    $cookies = array();    $result = pager_query($sql . tablesort_sql($header), 50);
210    
211    while ($cookie = db_fetch_object($result)) {    $rows = array();
212      if (array_key_exists($cookie->cid, $cookies)) {    $cookies = array();
213        array_push($cookies[$cookie->cid]['users'], $cookie->uid);  
214      }    while ($cookie = db_fetch_object($result)) {
215      else {      if (array_key_exists($cookie->cid, $cookies)) {
216        $cookies[$cookie->cid] = array();        array_push($cookies[$cookie->cid]['users'], $cookie->uid);
217        $cookies[$cookie->cid]['users'] = array();      }
218        array_push($cookies[$cookie->cid]['users'], $cookie->uid);      else {
219        $cookies[$cookie->cid]['status'] = $cookie->status;        $cookies[$cookie->cid] = array();
220        $cookies[$cookie->cid]['created'] = $cookie->created;        $cookies[$cookie->cid]['users'] = array();
221      }        array_push($cookies[$cookie->cid]['users'], $cookie->uid);
222    }        $cookies[$cookie->cid]['status'] = $cookie->status;
223          $cookies[$cookie->cid]['created'] = $cookie->created;
224    $content .= _false_account_build_table($header, $cookies, $op);      }
225      }
226   return $content;  
227  }    $content .= _false_account_build_table($header, $cookies, $op);
228    
229  function false_account_operations($op, $cid) {   return $content;
230    $sql = "UPDATE {false_accounts} SET status ='%d' WHERE cid = '%s'";  }
231    db_query($sql, $op, $cid);  
232    drupal_goto('admin/user/false_account');  function false_account_operations($op, $cid) {
233  }    $sql = "UPDATE {false_accounts} SET status ='%d' WHERE cid = '%s'";
234      db_query($sql, $op, $cid);
235  function false_account_searchfa($account = NULL) {    drupal_goto('admin/user/false_account');
236    $content = t('<p>Search false accounts for one specific user.</p>');  }
237    $content .= drupal_get_form('false_account_searchfa_form');  
238    if ($account) {  function false_account_searchfa($account = NULL) {
239      $accountname = user_load(array('uid' => $account));    $content = t('<p>Search false accounts for one specific user.</p>');
240      $content .= '<p>'. t('<strong>User Name: </strong>') . $accountname->name .'<br/>';    $content .= drupal_get_form('false_account_searchfa_form');
241      $content .= t('<strong>User ID: </strong>') . $accountname->uid .'</p>' ;    if ($account) {
242      $res = db_query('SELECT cid FROM {false_accounts} WHERE uid = %d', $accountname->uid);      $accountname = user_load(array('uid' => $account));
243      while ($res_cid = db_fetch_object($res)) {      $content .= '<p>'. t('<strong>User Name: </strong>') . $accountname->name .'<br/>';
244        $ors[] = 'cid = "'. $res_cid->cid .'"';      $content .= t('<strong>User ID: </strong>') . $accountname->uid .'</p>' ;
245      }      $res = db_query('SELECT cid FROM {false_accounts} WHERE uid = %d', $accountname->uid);
246      $or = implode(' OR ', $ors);      while ($res_cid = db_fetch_object($res)) {
247      $sql = "SELECT * FROM {false_accounts} WHERE " . $or;        $ors[] = 'cid = "'. $res_cid->cid .'"';
248      $header = array(      }
249        array('data' => t('Cookie ID')),      $or = implode(' OR ', $ors);
250        array('data' => t('User Accounts')),      $sql = "SELECT * FROM {false_accounts} WHERE " . $or;
251        array('data' => t('Created'), 'field' => 'created', 'sort' => 'desc'),      $header = array(
252        array('data' => t('Actions'))        array('data' => t('Cookie ID')),
253      );        array('data' => t('User Accounts')),
254      $result= pager_query($sql . tablesort_sql($header), 50, 0, NULL);        array('data' => t('Created'), 'field' => 'created', 'sort' => 'desc'),
255      $rows = array();        array('data' => t('Actions'))
256        );
257      $cookies = array();      $result= pager_query($sql . tablesort_sql($header), 50, 0, NULL);
258        $rows = array();
259      while ($cookie = db_fetch_object($result)) {  
260        if (array_key_exists($cookie->cid, $cookies)) {      $cookies = array();
261          array_push($cookies[$cookie->cid]['users'], $cookie->uid);  
262        }      while ($cookie = db_fetch_object($result)) {
263        else {        if (array_key_exists($cookie->cid, $cookies)) {
264          $cookies[$cookie->cid] = array();          array_push($cookies[$cookie->cid]['users'], $cookie->uid);
265          $cookies[$cookie->cid]['users'] = array();        }
266          array_push($cookies[$cookie->cid]['users'], $cookie->uid);        else {
267          $cookies[$cookie->cid]['status'] = $cookie->status;          $cookies[$cookie->cid] = array();
268          $cookies[$cookie->cid]['created'] = $cookie->created;          $cookies[$cookie->cid]['users'] = array();
269        }          array_push($cookies[$cookie->cid]['users'], $cookie->uid);
270      }          $cookies[$cookie->cid]['status'] = $cookie->status;
271            $cookies[$cookie->cid]['created'] = $cookie->created;
272      $content .= _false_account_build_table($header, $cookies, $op);        }
273    }      }
274    return $content;  
275  }      $content .= _false_account_build_table($header, $cookies, $op);
276      }
277      return $content;
278  function false_account_searchfa_form() {  }
279    $form['username'] = array(  
280      '#type' => 'textfield',  
281      '#description' => t('Enter username'),  function false_account_searchfa_form() {
282      '#autocomplete_path' => 'user/autocomplete',    $form['username'] = array(
283      '#maxlength' => USERNAME_MAX_LENGTH,      '#type' => 'textfield',
284      '#size' => 16,      '#description' => t('Enter username'),
285    );      '#autocomplete_path' => 'user/autocomplete',
286    $form['submit'] = array(      '#maxlength' => USERNAME_MAX_LENGTH,
287      '#type' => 'submit',      '#size' => 16,
288      '#value' => t('Search'),    );
289    );    $form['submit'] = array(
290    return $form;      '#type' => 'submit',
291        '#value' => t('Search'),
292  }    );
293      return $form;
294  function false_account_searchfa_form_validate($form_id, $form_values) {  
295    if (!$account = user_load(array('name' => $form_values['username']))) {  }
296      form_set_error('username', t('Username not found'));  
297    }  function false_account_searchfa_form_validate($form_id, $form_values) {
298  }    if (!$account = user_load(array('name' => $form_values['username']))) {
299        form_set_error('username', t('Username not found'));
300  function false_account_searchfa_form_submit($form_id, $form_values) {    }
301    $account = user_load(array('name' => $form_values['username']));  }
302    return 'admin/user/false_account/search/'. $account->uid;  
303  }  function false_account_searchfa_form_submit($form_id, $form_values) {
304      $account = user_load(array('name' => $form_values['username']));
305      return 'admin/user/false_account/search/'. $account->uid;
306  function _false_account_build_table($header, $cookies, $op) {  }
307    
308    foreach ($cookies as $cid => $cookie) {  
309      // user handling  function _false_account_build_table($header, $cookies, $op) {
310      foreach ($cookie['users'] as $user) {  
311        $uid = trim($user);    foreach ($cookies as $cid => $cookie) {
312        $status = user_load(array('uid' => $uid));      // user handling
313        $account[] = l(($status->status == 0) ? $uid .'*' : $uid, 'user/'. $uid);      foreach ($cookie['users'] as $user) {
314      }        $uid = trim($user);
315      $accounts = implode(', ', $account);        $status = user_load(array('uid' => $uid));
316          $account[] = l(($status->status == 0) ? $uid .'*' : $uid, 'user/'. $uid);
317      // actions handling      }
318      switch ($op) {      $accounts = implode(', ', $account);
319        case FALSE_ACCOUNT_DEFAULT:  
320          $actions = l(t('whitelist'), 'admin/user/false_account/op/'. FALSE_ACCOUNT_WHITELISTED .'/'. $cid) .' | '. l(t('block'), 'admin/user/false_account/op/'. FALSE_ACCOUNT_BLOCKED .'/'. $cid);      // actions handling
321          break;      switch ($op) {
322        case FALSE_ACCOUNT_WHITELISTED:        case FALSE_ACCOUNT_DEFAULT:
323          $actions = l(t('default'), 'admin/user/false_account/op/'. FALSE_ACCOUNT_DEFAULT .'/'. $cid) .' | '. l(t('block'), 'admin/user/false_account/op/'. FALSE_ACCOUNT_BLOCKED .'/'. $cid);          $actions = l(t('whitelist'), 'admin/user/false_account/op/'. FALSE_ACCOUNT_WHITELISTED .'/'. $cid) .' | '. l(t('block'), 'admin/user/false_account/op/'. FALSE_ACCOUNT_BLOCKED .'/'. $cid);
324          break;          break;
325        case FALSE_ACCOUNT_BLOCKED:        case FALSE_ACCOUNT_WHITELISTED:
326          $actions = l(t('default'), 'admin/user/false_account/op/'. FALSE_ACCOUNT_DEFAULT .'/'. $cid) .' | '. l(t('whitelist'), 'admin/user/false_account/op/'. FALSE_ACCOUNT_WHITELISTED .'/'. $cid);          $actions = l(t('default'), 'admin/user/false_account/op/'. FALSE_ACCOUNT_DEFAULT .'/'. $cid) .' | '. l(t('block'), 'admin/user/false_account/op/'. FALSE_ACCOUNT_BLOCKED .'/'. $cid);
327        break;          break;
328      }        case FALSE_ACCOUNT_BLOCKED:
329            $actions = l(t('default'), 'admin/user/false_account/op/'. FALSE_ACCOUNT_DEFAULT .'/'. $cid) .' | '. l(t('whitelist'), 'admin/user/false_account/op/'. FALSE_ACCOUNT_WHITELISTED .'/'. $cid);
330      $rows[] = array(        break;
331        $cid,      }
332        $accounts,  
333        date('d-m-Y', $cookie['created']),      $rows[] = array(
334        $actions        $cid,
335        );        $accounts,
336      unset($account);        date('d-m-Y', $cookie['created']),
337    }        $actions
338    if ($rows) {        );
339      $table .= theme('table', $header, $rows);      unset($account);
340      $table .= theme('pager');    }
341    }    if ($rows) {
342    else{      $table .= theme('table', $header, $rows);
343      $table = t('No false accounts detected.');      $table .= theme('pager');
344    }    }
345      else{
346    return $table;      $table = t('No false accounts detected.');
347  }    }
348    
349      return $table;
350  function _false_account_build_user_table($header, $cookies, $userid) {  }
351    
352    foreach ($cookies as $cid => $cookie) {  
353      // user handling  function _false_account_build_user_table($header, $cookies, $userid) {
354      foreach ($cookie['users'] as $user) {  
355        $uid = trim($user);    foreach ($cookies as $cid => $cookie) {
356        $status = user_load(array('uid' => $uid));      // user handling
357                          if ($userid == $uid) {      foreach ($cookie['users'] as $user) {
358          $account[] = ($status->status == 0) ? $status->name .'*' : $status->name;        $uid = trim($user);
359                          }        $status = user_load(array('uid' => $uid));
360                          else {                          if ($userid == $uid) {
361          $account[] = l(($status->status == 0) ? $status->name .'*' : $status->name, 'user/'. $uid);          $account[] = ($status->status == 0) ? $status->name .'*' : $status->name;
362        }                          }
363      }                          else {
364      $accounts = implode(', ', $account);          $account[] = l(($status->status == 0) ? $status->name .'*' : $status->name, 'user/'. $uid);
365          }
366      $rows[] = array(      }
367        $accounts,      $accounts = implode(', ', $account);
368        date('d-m-Y', $cookie['created']),  
369        );      $rows[] = array(
370      unset($account);        $accounts,
371    }        date('d-m-Y', $cookie['created']),
372    if ($rows) {        );
373      $table .= theme('table', $header, $rows);      unset($account);
374      $table .= theme('pager');    }
375    }    if ($rows) {
376    else{      $table .= theme('table', $header, $rows);
377      $table = t('No false accounts detected.');      $table .= theme('pager');
378    }    }
379      else{
380    return $table;      $table = t('No false accounts detected.');
381  }    }
382    
383      return $table;
384    }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.11.2.1

  ViewVC Help
Powered by ViewVC 1.1.2