From 33606444cab50baf24715ed0d08d54f06e33ace2 Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 24 Jan 2012 16:35:35 +0000 Subject: [PATCH 1/3] these should be ignored as full directories; if they aren't, some other problem needs fixing --- .gitignore | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.gitignore b/.gitignore index ed4f7d6a..e0874880 100644 --- a/.gitignore +++ b/.gitignore @@ -65,12 +65,3 @@ ext/upload_cmd ext/wiki ext/word_filter ext/zoom - -/ext/resize/main.php -/ext/resize/style.css -/ext/resize/theme.php -/ext/twitter_soc/main.php -/ext/twitter_soc/script.js -/ext/twitter_soc/style.css -/ext/twitter_soc/test.php -/ext/twitter_soc/theme.php From f38b45e2a982f9efb059e1e9bf394b387d2bd4cc Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 24 Jan 2012 16:40:36 +0000 Subject: [PATCH 2/3] there are some odd cases where anonymous is not user #1, so use the anon_id variable --- ext/user/main.php | 16 ++++++++-------- ext/user/theme.php | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/user/main.php b/ext/user/main.php index d964d6b9..66baa6c5 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -487,14 +487,14 @@ class UserPage extends SimpleExtension { "You need to specify the account number to edit")); } else{ - $rows = $database->get_all("SELECT * FROM images WHERE owner_id = :owner_id", array("owner_id" => $_POST['id'])); - foreach ($rows as $key => $value) - { - $database->Execute("UPDATE images SET owner_id = :owner_id WHERE id = :id;", array("owner_id" => 1, "id" => $value['id'])); - } - $database->execute("DELETE FROM users - WHERE id = :id" - , array("id"=>$_POST['id'])); + $database->Execute( + "UPDATE images SET owner_id = :new_owner_id WHERE owner_id = :old_owner_id", + array("new_owner_id" => $config->get_int('anon_id'), "old_owner_id" => $_POST['id']) + ); + $database->execute( + "DELETE FROM users WHERE id = :id", + array("id" => $_POST['id']) + ); $page->set_mode("redirect"); $page->set_redirect(make_link("post/list")); diff --git a/ext/user/theme.php b/ext/user/theme.php index e258d186..2e807dad 100644 --- a/ext/user/theme.php +++ b/ext/user/theme.php @@ -150,7 +150,7 @@ class UserPageTheme extends Themelet { protected function build_options(User $duser) { global $config, $database, $user; $html = ""; - if($duser->id != 1){ //justa fool-admin protection so they dont mess around with anon users. + if($duser->id != $config->get_int('anon_id')){ //justa fool-admin protection so they dont mess around with anon users. $html .= " ".make_form(make_link("user_admin/change_pass"))." From 0d8124af3b4433c02a42f304adeed46382acef07 Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 24 Jan 2012 16:48:28 +0000 Subject: [PATCH 3/3] consistency for key names --- install.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.php b/install.php index 359642e4..78d85065 100755 --- a/install.php +++ b/install.php @@ -310,8 +310,8 @@ function create_tables() { // {{{ INDEX(image_id), INDEX(tag_id), UNIQUE(image_id, tag_id), - CONSTRAINT foreign_images_tags_image_id FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE, - CONSTRAINT foreign_images_tags_tag_id FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE + CONSTRAINT foreign_image_tags_image_id FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE, + CONSTRAINT foreign_image_tags_tag_id FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE "); $db->execute("INSERT INTO config(name, value) VALUES('db_version', 8)"); }