- Timestamp:
- 01/06/08 13:47:35 (11 months ago)
- Location:
- trunk/common
- Files:
-
- 3 modified
-
mvblog.php (modified) (4 diffs)
-
mvblog_common.php (modified) (3 diffs)
-
mvblog_log.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/mvblog.php
r761 r775 78 78 public function __construct ($basedir="") { 79 79 parent::__construct($basedir."plugins/"); 80 $this->log = new MvBlog_log($basedir, 0); 80 81 } 81 82 /* }}} */ … … 1109 1110 $_SESSION["blog_user"]["email"] = $row["email"]; 1110 1111 $_SESSION["blog_user"]["website"] = $row["website"]; 1112 $this->log->add_log(mktime(), $row["id"], 2, sprintf("User %s logged in", $row["username"])); 1111 1113 return true; 1112 1114 } else { … … 1223 1225 $email, $website, $regcode, $email_public 1224 1226 ); 1227 $logmsg = sprintf("User %s registered", $username); 1225 1228 } else { 1226 1229 if ($password) … … 1234 1237 $sql = sprintf("UPDATE blog_users SET realname = '%s'%s, email = '%s', website = '%s', email_public = %d WHERE id = %d", 1235 1238 $realname, $passwdq, $email, $website, $email_public, $_SESSION["blog_user"]["user_id"]); 1239 $logmsg = sprintf("User %d:%s updated", $_SESSION["blog_user"]["id"], $_SESSION["blog_user"]["username"]); 1236 1240 } 1237 1241 $this->db->exec($sql); 1242 $this->log->add_log(mktime(), 0, 2, $logmsg); 1238 1243 if ($register) { 1239 1244 if (array_key_exists("HTTPS", $_SERVER) && $_SERVER["HTTPS"] == "on") -
trunk/common/mvblog_common.php
r770 r775 61 61 public $authors = array(); 62 62 /** 63 * @var array $users Array with all active users. 64 * The array looks like this: 65 * <pre> 66 * array ( 67 * [id] => "fullname", 68 * [id] => "fullname" 69 * ) 70 * </pre> 71 */ 72 public $users = array(); 73 /** 63 74 * @var array $categories Array with all active categories. 64 75 * The array looks like this: … … 187 198 /* populate the authors array */ 188 199 $this->_get_authors(); 200 201 /* populate the users array */ 202 $this->_get_users(); 189 203 190 204 /* populate the categories array */ … … 607 621 } 608 622 $this->authors = $authors; 623 } 624 /* }}} */ 625 /* _get_users() {{{ */ 626 /** 627 * Get all the users into an array. 628 */ 629 public function _get_users() { 630 /* user with id 0 is for a new user. */ 631 $authors = array( 632 0 => array( 633 "login" => "login", 634 "password" => "", 635 "email" => "", 636 "fullname" => "", 637 "active" => 1, 638 "website" => "" 639 ) 640 ); 641 642 $res =& $this->db->query("SELECT * FROM blog_users"); 643 if (PEAR::isError($res)) { 644 die($res->getMessage()); 645 } 646 while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) { 647 $users[$row["id"]] = array( 648 "username" => $row["username"], 649 "password" => $row["password"], 650 "email" => $row["email"], 651 "realname" => $row["realname"], 652 "active" => $row["active"], 653 "website" => $row["website"] 654 ); 655 } 656 $this->users = $users; 609 657 } 610 658 /* }}} */ -
trunk/common/mvblog_log.php
r773 r775 80 80 while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) { 81 81 $row["human_time"] = date("Y-m-d H:i:s", $row["time"]); 82 $row["username"] = $this->authors[$row["user_id"]]["login"]; 83 $row["fullname"] = $this->authors[$row["user_id"]]["fullname"]; 82 if ($row["user_type"] == 1) { 83 $row["username"] = $this->authors[$row["user_id"]]["login"]; 84 $row["fullname"] = $this->authors[$row["user_id"]]["fullname"]; 85 } elseif ($row["user_type"] == 2) { 86 $row["username"] = $this->users[$row["user_id"]]["username"]; 87 $row["fullname"] = $this->users[$row["user_id"]]["realname"]; 88 } 84 89 $logrecords[] = $row; 85 90 }
