Changeset 770
- Timestamp:
- 12/30/07 18:31:19 (11 months ago)
- Location:
- trunk
- Files:
-
- 4 added
- 3 modified
-
admin/index.php (modified) (1 diff)
-
common/mvblog_admin.php (modified) (29 diffs)
-
common/mvblog_common.php (modified) (1 diff)
-
common/mvblog_log.php (added)
-
upgrades/mysql/2007123000.php (added)
-
upgrades/pgsql/2007123000.php (added)
-
upgrades/sqlite/2007123000.php (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/index.php
r724 r770 173 173 $admin->show_about(); 174 174 break; 175 case "show_userlog" : 176 $admin->show_userlog(); 177 break; 175 178 default : 176 179 $admin->show_index(); -
trunk/common/mvblog_admin.php
r757 r770 47 47 parent::__construct($basedir."plugins/", 1); 48 48 $this->webroot = $this->webroot."admin/"; 49 $this->log = new MvBlog_log($basedir, 1); 49 50 50 51 if (array_key_exists("action", $_POST)) … … 67 68 $this->_selected_menuitem = "manage"; 68 69 $this->_selected_submenuitem = "dossiers"; 70 break; 71 case "show_userlog": 72 $this->_selected_menuitem = "users"; 73 $this->_selected_submenuitem = "log"; 69 74 break; 70 75 case "show_authors" : … … 217 222 $_SESSION["author_website"] = $row["website"]; 218 223 $_SESSION["blog_user"] = 1; 224 $this->log->add_log(mktime(), $row["id"], 1, "Admin logged in"); 219 225 header("Location: index.php"); 220 226 } else { … … 228 234 */ 229 235 public function logout() { 236 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, "Admin logged off"); 230 237 session_destroy(); 231 238 header("Location: index.php"); … … 358 365 <a class="if_menu_item<?php if ($this->_selected_menuitem == "index") { echo "_act"; } ?>" href="./index.php"><?php echo gettext("Main"); ?></a> 359 366 <a class="if_menu_item<?php if ($this->_selected_menuitem == "manage") { echo "_act"; } ?>" href="./index.php?action=show_posts"><?php echo gettext("Manage"); ?></a> 360 <a class="if_menu_item<?php if ($this->_selected_menuitem == "users") { echo "_act"; } ?>" href="./index.php?action=show_ authors"><?php echo gettext("Users"); ?></a> 367 <a class="if_menu_item<?php if ($this->_selected_menuitem == "users") { echo "_act"; } ?>" href="./index.php?action=show_userlog"><?php echo gettext("Users"); ?></a> 361 368 <a class="if_menu_item<?php if ($this->_selected_menuitem == "settings") { echo "_act"; } ?>" href="./index.php?action=show_settings"><?php echo gettext("Settings"); ?></a> 362 369 <a class="if_menu_item<?php if ($this->_selected_menuitem == "plugins") { echo "_act"; } ?>" href="./index.php?action=show_plugins"><?php echo gettext("Plugins"); ?></a> … … 551 558 $cat["id"] 552 559 ); 560 $logmsg = sprintf("Category %d:%s updated", $cat["id"], $cat["name"]); 553 561 } else { 554 562 $query = sprintf("INSERT INTO categories (%s, %s, %s, %s, %s) VALUES ('%s', '%s', %d, %d, '%s')", … … 560 568 $cat["icon"] 561 569 ); 570 $logmsg = sprintf("Category %s created", $cat["name"]); 562 571 } 563 572 $res =& $this->db->exec($query); … … 565 574 die($res->getUserInfo()); 566 575 } 576 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, $logmsg); 567 577 header("Location: index.php?action=show_cats"); 568 578 } … … 580 590 die($res->getUserInfo()); 581 591 } 592 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, sprintf("Category %d deleted", $id)); 582 593 header("Location: index.php?action=show_cats"); 583 594 } … … 677 688 $dossier["id"] 678 689 ); 690 $logmsg = sprintf("Dossier %d:%s updated", $dossier["id"], $dossier["name"]); 679 691 } else { 680 692 $query = sprintf("INSERT INTO dossiers (%s, %s, %s, %s) VALUES ('%s', '%s', %d, %d)", … … 685 697 $dossier["public"] 686 698 ); 699 $logmsg = sprintf("Dossier %s created", $dossier["name"]); 687 700 } 688 701 $res =& $this->db->exec($query); … … 690 703 die($res->getUserInfo()); 691 704 } 705 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, $logmsg); 692 706 header("Location: index.php?action=show_dossiers"); 693 707 } … … 705 719 die($res->getUserInfo()); 706 720 } 721 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, sprintf("Dossier %d deleted", $id)); 707 722 header("Location: index.php?action=show_dossiers"); 708 723 } … … 837 852 } 838 853 $query .= sprintf(" WHERE id = %d", $author["id"]); 854 $logmsg = sprintf("Author %d:%s updated", $author["id"], $author["login"]); 839 855 } else { 840 856 $query = sprintf("INSERT INTO authors (%s, %s, %s, %s, %s, %s) VALUES ('%s', '%s', '%s', '%s', '%s', %d)", … … 847 863 $author["active"] 848 864 ); 865 $logmsg = sprintf("Author %s created", $author["login"]); 849 866 } 850 867 $res =& $this->db->exec($query); … … 852 869 die($res->getUserInfo()); 853 870 } 871 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, $logmsg); 854 872 header("Location: index.php?action=show_authors"); 855 873 } else { … … 1036 1054 } 1037 1055 $query .= sprintf(" WHERE id = %d", $user["id"]); 1056 $logmsg = sprintf("User %d:%s updated", $user["id"], $user["username"]); 1038 1057 } else { 1039 1058 $query = sprintf("INSERT INTO blog_users (%s, %s, %s, %s, %s, %s) VALUES ('%s', '%s', '%s', '%s', '%s', %d)", … … 1046 1065 $user["active"] 1047 1066 ); 1067 $logmsg = sprintf("User %s created", $user["username"]); 1048 1068 } 1049 1069 $res =& $this->db->exec($query); … … 1051 1071 die($res->getUserInfo()); 1052 1072 } 1073 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, $logmsg); 1053 1074 header("Location: index.php?action=show_users"); 1054 1075 } else { … … 1087 1108 } 1088 1109 } 1110 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, sprintf("User %d deleted", $userid)); 1089 1111 header("Location: index.php?action=show_users"); 1090 1112 } … … 1451 1473 $query .= sprintf(", ping_sent = 1, tb_uri = '%s'", preg_quote($tb_uri, "'")); 1452 1474 $query .= sprintf(" WHERE id = %d", $post["id"]); 1475 $logmsg = sprintf("Article %d:%s updated", $post["id"], $post["title"]); 1453 1476 } else { 1454 1477 $query = sprintf("INSERT INTO articles (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", … … 1467 1490 $post["postformat"] 1468 1491 ); 1492 $logmsg = sprintf("Article %s created", $post["title"]); 1469 1493 } 1470 1494 $res =& $this->db->exec($query); … … 1472 1496 die($res->getUserInfo()); 1473 1497 } 1498 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, $logmsg); 1474 1499 if (!$post["id"]) { 1475 1500 /* this is a new post. fetch old data */ … … 1499 1524 die("error"); 1500 1525 } 1526 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, sprintf("Trackback for article %s sent to %s", $post["title"], $post["tb_uri"])); 1501 1527 $sql = sprintf("UPDATE articles SET ping_sent = 1 WHERE id = %d", $post["id"]); 1502 1528 $res =& $db->exec($sql); … … 1523 1549 die($res->getUserInfo()); 1524 1550 } 1551 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, sprintf("Article %d deleted", $id)); 1525 1552 header("Location: index.php?action=show_posts"); 1526 1553 } … … 1601 1628 $sql = sprintf("DELETE FROM comments WHERE id = %d", $id); 1602 1629 $res = $this->db->exec($sql); 1630 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, sprintf("Comment %d deleted", $id)); 1603 1631 header("Location: index.php?action=show_comments"); 1604 1632 } … … 1698 1726 $active_plugins = serialize($this->active_plugins); 1699 1727 $this->save_settings(array("active_plugins" => $active_plugins)); 1728 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, sprintf("Plugin %s activated", $plugin)); 1700 1729 return true; 1701 1730 } … … 1713 1742 $active_plugins = serialize($this->active_plugins); 1714 1743 $this->save_settings(array("active_plugins" => $active_plugins)); 1744 $this->log->add_log(mktime(), $_SESSION["author_id"], 1, sprintf("Plugin %s de-activated", $plugin)); 1715 1745 return true; 1716 1746 } … … 2011 2041 } 2012 2042 /* }}} */ 2043 /* show_userlog {{{ */ 2044 /** 2045 * Show a log of what happened 2046 */ 2047 public function show_userlog() { 2048 $this->log->show_log(); 2049 } 2050 /* }}} */ 2013 2051 } 2014 2052 ?> -
trunk/common/mvblog_common.php
r757 r770 137 137 public function __construct($plugindir="plugins/", $adminmode=0, $upgrade=0) { 138 138 /* start session and output buffering */ 139 session_start(); 139 if (session_id() == "") 140 session_start(); 140 141 ob_start(); 141 142
