| Revision 852,
1.3 KB
checked in by cdleonard@…, 4 years ago
(diff) |
|
svn:eol-style native in trunk. Also svn:executable on all scripts
|
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | #! /usr/bin/env php |
|---|
| 2 | <?php |
|---|
| 3 | |
|---|
| 4 | require_once(dirname($argv[0]) . "/config.php"); |
|---|
| 5 | require_once(IA_ROOT_DIR . "common/common.php"); |
|---|
| 6 | require_once(IA_ROOT_DIR . "common/log.php"); |
|---|
| 7 | require_once(IA_ROOT_DIR . "common/db/smf.php"); |
|---|
| 8 | require_once(IA_ROOT_DIR . "common/db/user.php"); |
|---|
| 9 | require_once(IA_ROOT_DIR . "common/db/textblock.php"); |
|---|
| 10 | db_connect(); |
|---|
| 11 | |
|---|
| 12 | $query = <<<SQL |
|---|
| 13 | SELECT * |
|---|
| 14 | FROM `ia_user` |
|---|
| 15 | SQL; |
|---|
| 16 | |
|---|
| 17 | $users = db_fetch_all($query); |
|---|
| 18 | $full_name_errors = 0; |
|---|
| 19 | $email_errors = 0; |
|---|
| 20 | $username_errors = 0; |
|---|
| 21 | foreach ($users as $user) { |
|---|
| 22 | $chg = false; |
|---|
| 23 | $old_user = $user; |
|---|
| 24 | |
|---|
| 25 | if (!is_user_name($user['username'])) { |
|---|
| 26 | $new_username = preg_replace('/[^a-z_\.\-\@]/i', '_', $user['username']); |
|---|
| 27 | $user['username'] = $new_username; |
|---|
| 28 | $chg = true; |
|---|
| 29 | ++$username_errors; |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | if (!is_valid_email($user['email'])) { |
|---|
| 33 | $user['email'] = $user['username'] . '@necunoscut.com'; |
|---|
| 34 | $chg = true; |
|---|
| 35 | ++$email_errors; |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | if (!is_user_full_name($user['full_name'])) { |
|---|
| 39 | $user['full_name'] = "Unknown"; |
|---|
| 40 | $chg = true; |
|---|
| 41 | ++$full_name_errors; |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | if ($chg) { |
|---|
| 45 | log_assert_valid(user_validate($user)); |
|---|
| 46 | } |
|---|
| 47 | } |
|---|
| 48 | log_print("full_name: $full_name_errors"); |
|---|
| 49 | log_print("email: $email_errors"); |
|---|
| 50 | log_print("username: $username_errors"); |
|---|
| 51 | |
|---|
| 52 | ?> |
|---|
| 53 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.