diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2004-05-02 13:06:57 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2004-05-02 13:06:57 +0000 |
commit | 729c3abd02fc564fb99be53ba5fba450a073197f (patch) | |
tree | 625496783aefb4310826381bcb69aec6558858ad /phpBB/includes/functions_admin.php | |
parent | 67d2ac36679f6c38fecaf157d2bc837daa237c41 (diff) | |
download | forums-729c3abd02fc564fb99be53ba5fba450a073197f.tar forums-729c3abd02fc564fb99be53ba5fba450a073197f.tar.gz forums-729c3abd02fc564fb99be53ba5fba450a073197f.tar.bz2 forums-729c3abd02fc564fb99be53ba5fba450a073197f.tar.xz forums-729c3abd02fc564fb99be53ba5fba450a073197f.zip |
fix some issues with oop, fixing small bugs and prepare the next steps...
NOTE TO DEVS: have a look at adm/admin_board.php (new config layout)
git-svn-id: file:///svn/phpbb/trunk@4883 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r-- | phpBB/includes/functions_admin.php | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 865be1065e..4209f72938 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -292,7 +292,8 @@ function move_posts($post_ids, $topic_id, $auto_sync = TRUE) $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " SET topic_id = $topic_id - WHERE post_id IN (" . implode(', ', $post_ids) . ')'; + AND in_message = 0 + WHERE post_msg_id IN (" . implode(', ', $post_ids) . ')'; $db->sql_query($sql); if ($auto_sync) @@ -490,14 +491,14 @@ function delete_attachments($mode, $ids, $resync = TRUE) return false; } - $sql_id = ($mode == 'user') ? 'poster_id' : (($mode == 'post') ? 'post_id' : (($mode == 'topic') ? 'topic_id' : 'attach_id')); + $sql_id = ($mode == 'user') ? 'poster_id' : (($mode == 'post') ? 'post_msg_id' : (($mode == 'topic') ? 'topic_id' : 'attach_id')); $post_ids = $topic_ids = $physical = array(); // Collect post and topics ids for later use if ($mode == 'attach' || $mode == 'user' || ($mode == 'topic' && $resync)) { - $sql = 'SELECT post_id, topic_id, physical_filename, thumbnail, filesize + $sql = 'SELECT post_msg_id as post_id, topic_id, physical_filename, thumbnail, filesize FROM ' . ATTACHMENTS_TABLE . ' WHERE ' . $sql_id . ' IN (' . implode(', ', $ids) . ')'; $result = $db->sql_query($sql); @@ -515,7 +516,8 @@ function delete_attachments($mode, $ids, $resync = TRUE) { $sql = 'SELECT topic_id, physical_filename, thumbnail, filesize FROM ' . ATTACHMENTS_TABLE . ' - WHERE post_id IN (' . implode(', ', $ids) . ')'; + WHERE post_msg_id IN (' . implode(', ', $ids) . ') + AND in_message = 0'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -581,14 +583,15 @@ function delete_attachments($mode, $ids, $resync = TRUE) { $remaining = array(); - $sql = 'SELECT post_id + $sql = 'SELECT post_msg_id FROM ' . ATTACHMENTS_TABLE . ' - WHERE post_id IN (' . implode(', ', $post_ids) . ')'; + WHERE post_msg_id IN (' . implode(', ', $post_ids) . ') + AND in_message = 0'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { - $remaining[] = $row['post_id']; + $remaining[] = $row['post_msg_id']; } $db->sql_freeresult($result); @@ -599,6 +602,28 @@ function delete_attachments($mode, $ids, $resync = TRUE) SET post_attachment = 0 WHERE post_id IN (' . implode(', ', $unset_ids) . ')'); } + + $remaining = array(); + + $sql = 'SELECT post_msg_id + FROM ' . ATTACHMENTS_TABLE . ' + WHERE post_msg_id IN (' . implode(', ', $post_ids) . ') + AND in_message = 1'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $remaining[] = $row['post_msg_id']; + } + $db->sql_freeresult($result); + + $unset_ids = array_diff($post_ids, $remaining); + if (sizeof($unset_ids)) + { + $db->sql_query('UPDATE ' . PRIVMSGS_TABLE . ' + SET message_attachment = 0 + WHERE msg_id IN (' . implode(', ', $unset_ids) . ')'); + } } } |