Source of trunk/cp_userinfo.php at revision 363 (05/07/2008 10:05:26, 2965 bytes, 82 lines, language: php) [download]:
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | ** Control Panel :: User Info |
| 5 | ** for CodewiseBlog Multi-User |
| 6 | ** |
| 7 | |
| 8 | ** Copyright (c) 2005-2008 Codewise.org |
| 9 | */ |
| 10 | |
| 11 | /* |
| 12 | ** This file is part of CodewiseBlog |
| 13 | ** |
| 14 | ** CodewiseBlog is free software; you can redistribute it and/or modify |
| 15 | ** it under the terms of the GNU General Public License as published by |
| 16 | ** the Free Software Foundation; either version 2 of the License, or |
| 17 | ** (at your option) any later version. |
| 18 | ** |
| 19 | ** CodewiseBlog is distributed in the hope that it will be useful, |
| 20 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | ** GNU General Public License for more details. |
| 23 | ** |
| 24 | ** You should have received a copy of the GNU General Public License |
| 25 | ** along with CodewiseBlog; if not, write to the Free Software |
| 26 | ** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 27 | */ |
| 28 | |
| 29 | $current = "userinfo"; |
| 30 | |
| 31 | if($_POST) |
| 32 | { |
| 33 | if(isset($_POST['chpasswd'])) |
| 34 | { |
| 35 | if($_POST['password1'] != $_POST['password2']) |
| 36 | { |
| 37 | $GLOBALS['NOTIFY'] = "Passwords do not match"; |
| 38 | } else { |
| 39 | $data = array( |
| 40 | "password" => md5($_POST['password1']), |
| 41 | ); |
| 42 | |
| 43 | $db->update("blogs", $data, array("blogid" => BLOGID)); |
| 44 | |
| 45 | $GLOBALS['NOTIFY'] = "Password updated successfully."; |
| 46 | } |
| 47 | } elseif($_POST['email'] == "") { |
| 48 | $GLOBALS['NOTIFY'] = "Email address must not be empty"; |
| 49 | } elseif($_POST['title'] == "") { |
| 50 | $GLOBALS['NOTIFY'] = "Site Title must not be empty"; |
| 51 | } else { |
| 52 | |
| 53 | $data = array( |
| 54 | "email" => $_POST['email'], |
| 55 | "realname" => $_POST['realname'] == "" ? NULL : htmlspecialchars($_POST['realname']), |
| 56 | "birthday" => $_POST['birthday'] == "" ? NULL : $_POST['birthday'], |
| 57 | "location" => $_POST['location'] == "" ? NULL : htmlspecialchars($_POST['location']), |
| 58 | "interests" => $_POST['interests'] == "" ? NULL : $_POST['interests'], |
| 59 | "links" => $_POST['links'] == "" ? NULL : $_POST['links'], |
| 60 | "photo" => $_POST['photo'] == "" ? NULL : htmlspecialchars($_POST['photo']), |
| 61 | "homepage" => $_POST['homepage'] == "" ? NULL : htmlspecialchars($_POST['homepage']), |
| 62 | "title" => str_replace(" ", " ", htmlspecialchars($_POST['title'])), |
| 63 | "custom_url" => $_POST['custom_url'] == "" ? NULL : $_POST['custom_url'], |
| 64 | ); |
| 65 | |
| 66 | $db->update("blogs", $data, array("blogid" => BLOGID)); |
| 67 | |
| 68 | $GLOBALS['NOTIFY'] = "User info successfully changed"; |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | $q = $db->issue_query("SELECT email,realname,birthday,location,interests,links,photo,homepage,title,custom_url FROM blogs WHERE blogid = '" . BLOGID . "'"); |
| 73 | $userinfo = $db->fetch_row($q, 0, L1SQL_ASSOC); |
| 74 | |
| 75 | $data = array( |
| 76 | "posturl" => INDEX_URL . "?controlpanel:userinfo", |
| 77 | ); |
| 78 | |
| 79 | $body = skinvoodoo("controlpanel_userinfo", "", array_merge($userinfo, $data)); |
| 80 | |
| 81 | ?> |
| 82 |