Zeile 187 | Zeile 187 |
---|
{ case "pgsql": $query = $db->query("
|
{ case "pgsql": $query = $db->query("
|
SELECT a.*, u.uid AS useruid, u.username, SUM(a.filesize) as totalsize
| SELECT a.uid, u.username, SUM(a.filesize) as totalsize
|
FROM ".TABLE_PREFIX."attachments a LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid)
|
FROM ".TABLE_PREFIX."attachments a LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid)
|
GROUP BY ".$db->build_fields_string("attachments", "a.").",u.uid,u.username
| GROUP BY a.uid, u.username
|
ORDER BY totalsize DESC LIMIT 5 "); break; default: $query = $db->query("
|
ORDER BY totalsize DESC LIMIT 5 "); break; default: $query = $db->query("
|
SELECT a.*, u.uid AS useruid, u.username, SUM(a.filesize) as totalsize
| SELECT a.uid, u.username, SUM(a.filesize) as totalsize
|
FROM ".TABLE_PREFIX."attachments a LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid) GROUP BY a.uid
| FROM ".TABLE_PREFIX."attachments a LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid) GROUP BY a.uid
|
Zeile 207 | Zeile 207 |
---|
} while($user = $db->fetch_array($query)) {
|
} while($user = $db->fetch_array($query)) {
|
if(!$user['useruid'])
| if(!$user['uid'])
|
{ $user['username'] = $lang->na; }
|
{ $user['username'] = $lang->na; }
|
$table->construct_cell(build_profile_link($user['username'], $user['useruid'], "_blank"));
| $table->construct_cell(build_profile_link(htmlspecialchars_uni($user['username']), $user['uid'], "_blank"));
|
$table->construct_cell("<a href=\"index.php?module=forum-attachments&results=1&username=".urlencode($user['username'])."\" target=\"_blank\">".get_friendly_size($user['totalsize'])."</a>", array('class' => 'align_center')); $table->construct_row(); }
| $table->construct_cell("<a href=\"index.php?module=forum-attachments&results=1&username=".urlencode($user['username'])."\" target=\"_blank\">".get_friendly_size($user['totalsize'])."</a>", array('class' => 'align_center')); $table->construct_row(); }
|
Zeile 223 | Zeile 223 |
---|
if($mybb->input['action'] == "delete_orphans" && $mybb->request_method == "post") { $plugins->run_hooks("admin_forum_attachments_delete_orphans");
|
if($mybb->input['action'] == "delete_orphans" && $mybb->request_method == "post") { $plugins->run_hooks("admin_forum_attachments_delete_orphans");
|
| $success_count = $error_count = 0;
|
// Deleting specific attachments from uploads directory if(is_array($mybb->input['orphaned_files']))
| // Deleting specific attachments from uploads directory if(is_array($mybb->input['orphaned_files']))
|
Zeile 235 | Zeile 237 |
---|
function clean_filename($string) { return str_replace(array(".."), "", $string);
|
function clean_filename($string) { return str_replace(array(".."), "", $string);
|
}
| }
|
$mybb->input['orphaned_files'] = array_map("clean_filename", $mybb->input['orphaned_files']); foreach($mybb->input['orphaned_files'] as $file) { if(!@unlink(MYBB_ROOT.$mybb->settings['uploadspath']."/".$file))
|
$mybb->input['orphaned_files'] = array_map("clean_filename", $mybb->input['orphaned_files']); foreach($mybb->input['orphaned_files'] as $file) { if(!@unlink(MYBB_ROOT.$mybb->settings['uploadspath']."/".$file))
|
{ $error = true; } } }
| { $error_count++; } else { $success_count++; } } }
|
// Deleting physical attachments which exist in database if(is_array($mybb->input['orphaned_attachments'])) { $mybb->input['orphaned_attachments'] = array_map("intval", $mybb->input['orphaned_attachments']);
|
// Deleting physical attachments which exist in database if(is_array($mybb->input['orphaned_attachments'])) { $mybb->input['orphaned_attachments'] = array_map("intval", $mybb->input['orphaned_attachments']);
|
require_once MYBB_ROOT."inc/functions_upload.php";
| require_once MYBB_ROOT."inc/functions_upload.php";
|
$query = $db->simple_select("attachments", "aid,pid,posthash", "aid IN (".implode(",", $mybb->input['orphaned_attachments']).")"); while($attachment = $db->fetch_array($query)) {
| $query = $db->simple_select("attachments", "aid,pid,posthash", "aid IN (".implode(",", $mybb->input['orphaned_attachments']).")"); while($attachment = $db->fetch_array($query)) {
|
Zeile 263 | Zeile 269 |
---|
{ remove_attachment($attachment['pid'], null, $attachment['aid']); }
|
{ remove_attachment($attachment['pid'], null, $attachment['aid']); }
|
| $success_count++;
|
} }
| } }
|
Zeile 270 | Zeile 277 |
---|
// Log admin action log_admin_action();
|
// Log admin action log_admin_action();
|
if($error == true) { flash_message($lang->error_not_all_removed, 'error'); } else { flash_message($lang->success_orphan_deleted, 'success'); } admin_redirect("index.php?module=forum-attachments");
| $message = ''; $status = 'success'; if($error_count > 0) { $status = 'error'; $message = $lang->sprintf($lang->error_count, $error_count); }
if($success_count > 0) { if($error_count > 0) { $message .= '<br />'.$lang->sprintf($lang->success_count, $success_count); } else { $message = $lang->success_orphan_deleted; } } flash_message($message, $status); admin_redirect('index.php?module=forum-attachments');
|
}
if($mybb->input['action'] == "orphans")
| }
if($mybb->input['action'] == "orphans")
|
Zeile 305 | Zeile 324 |
---|
{ $bad_attachments = my_unserialize($mybb->input['bad_attachments']); $results = count($bad_attachments);
|
{ $bad_attachments = my_unserialize($mybb->input['bad_attachments']); $results = count($bad_attachments);
|
}
| }
|
$aids = array(); if($mybb->input['missing_attachment_files'])
| $aids = array(); if($mybb->input['missing_attachment_files'])
|
Zeile 318 | Zeile 337 |
---|
{ $missing_threads = my_unserialize($mybb->input['missing_threads']); $aids = array_merge($aids, $missing_threads);
|
{ $missing_threads = my_unserialize($mybb->input['missing_threads']); $aids = array_merge($aids, $missing_threads);
|
}
| }
|
if($mybb->input['incomplete_attachments']) {
| if($mybb->input['incomplete_attachments']) {
|
Zeile 329 | Zeile 348 |
---|
foreach($aids as $key => $aid) { $aids[$key] = (int)$aid;
|
foreach($aids as $key => $aid) { $aids[$key] = (int)$aid;
|
}
| }
|
$results += count($aids);
if($results == 0)
| $results += count($aids);
if($results == 0)
|
Zeile 345 | Zeile 364 |
---|
$form = new Form("index.php?module=forum-attachments&action=delete_orphans", "post");
$table = new Table;
|
$form = new Form("index.php?module=forum-attachments&action=delete_orphans", "post");
$table = new Table;
|
$table->construct_header($form->generate_check_box('checkall', '1', '', array('class' => 'checkall')), array( 'width' => 1));
| $table->construct_header($form->generate_check_box('allbox', '1', '', array('class' => 'checkall')), array( 'width' => 1));
|
$table->construct_header($lang->size_attachments, array('colspan' => 2)); $table->construct_header($lang->reason_orphaned, array('width' => '20%', 'class' => 'align_center')); $table->construct_header($lang->date_uploaded, array("class" => "align_center"));
| $table->construct_header($lang->size_attachments, array('colspan' => 2)); $table->construct_header($lang->reason_orphaned, array('width' => '20%', 'class' => 'align_center')); $table->construct_header($lang->date_uploaded, array("class" => "align_center"));
|
Zeile 535 | Zeile 554 |
---|
if(count($attachments_to_check) > 0) { if($bad_attachments)
|
if(count($attachments_to_check) > 0) { if($bad_attachments)
|
{
| {
|
$bad_attachments = @array_merge($bad_attachments, $attachments_to_check); } else
| $bad_attachments = @array_merge($bad_attachments, $attachments_to_check); } else
|
Zeile 555 | Zeile 574 |
---|
$attachment_names = "'".implode("','", $attachments_to_check)."'"; $query = $db->simple_select("attachments", "aid, attachname", "attachname IN ($attachment_names)"); while($attachment = $db->fetch_array($query))
|
$attachment_names = "'".implode("','", $attachments_to_check)."'"; $query = $db->simple_select("attachments", "aid, attachname", "attachname IN ($attachment_names)"); while($attachment = $db->fetch_array($query))
|
{
| {
|
unset($attachments_to_check[$attachment['attachname']]); }
| unset($attachments_to_check[$attachment['attachname']]); }
|
Zeile 574 | Zeile 593 |
---|
} } }
|
} } }
|
|
|
$page->output_header("{$lang->orphan_attachments_search} - {$lang->step1}");
$page->output_nav_tabs($sub_tabs, 'find_orphans');
| $page->output_header("{$lang->orphan_attachments_search} - {$lang->step1}");
$page->output_nav_tabs($sub_tabs, 'find_orphans');
|
Zeile 586 | Zeile 605 |
---|
$page->output_footer(false);
flush();
|
$page->output_footer(false);
flush();
|
|
|
scan_attachments_directory(); global $bad_attachments;
$form = new Form("index.php?module=forum-attachments&action=orphans&step=2", "post", "redirect_form", 0, ""); // Scan complete if(is_array($bad_attachments) && count($bad_attachments) > 0)
|
scan_attachments_directory(); global $bad_attachments;
$form = new Form("index.php?module=forum-attachments&action=orphans&step=2", "post", "redirect_form", 0, ""); // Scan complete if(is_array($bad_attachments) && count($bad_attachments) > 0)
|
{
| {
|
$bad_attachments = my_serialize($bad_attachments); echo $form->generate_hidden_field("bad_attachments", $bad_attachments); }
| $bad_attachments = my_serialize($bad_attachments); echo $form->generate_hidden_field("bad_attachments", $bad_attachments); }
|
Zeile 612 | Zeile 631 |
---|
if(!$mybb->input['action']) { $plugins->run_hooks("admin_forum_attachments_start");
|
if(!$mybb->input['action']) { $plugins->run_hooks("admin_forum_attachments_start");
|
|
|
if($mybb->request_method == "post" || $mybb->input['results'] == 1) { $search_sql = '1=1';
// Build the search SQL for users
|
if($mybb->request_method == "post" || $mybb->input['results'] == 1) { $search_sql = '1=1';
// Build the search SQL for users
|
|
|
// List of valid LIKE search fields $user_like_fields = array("filename", "filetype"); foreach($user_like_fields as $search_field)
| // List of valid LIKE search fields $user_like_fields = array("filename", "filetype"); foreach($user_like_fields as $search_field)
|
Zeile 630 | Zeile 649 |
---|
}
$errors = array();
|
}
$errors = array();
|
| // Normal users only if($mybb->get_input('user_types', MyBB::INPUT_INT) == 1) { $user_types = 1; } // Guests only elseif($mybb->get_input('user_types', MyBB::INPUT_INT) == -1) { $user_types = -1; $search_sql .= " AND a.uid='0'"; } // Users & Guests else { $user_types = 0; }
|
// Username matching if($mybb->input['username'])
| // Username matching if($mybb->input['username'])
|
Zeile 638 | Zeile 674 |
---|
if(!$user['uid']) {
|
if(!$user['uid']) {
|
$errors[] = $lang->error_invalid_username;
| if($user_types == 1) { $errors[] = $lang->error_invalid_username; } else { // Don't error if we are searching for guests or users & guests $search_sql .= " AND p.username LIKE '%".$db->escape_string_like($mybb->input['username'])."%'"; }
|
} else {
| } else {
|
Zeile 780 | Zeile 825 |
---|
$form = new Form("index.php?module=forum-attachments&action=delete", "post");
$table = new Table;
|
$form = new Form("index.php?module=forum-attachments&action=delete", "post");
$table = new Table;
|
$table->construct_header($form->generate_check_box('checkall', '1', '', array('class' => 'checkall')), array( 'width' => 1));
| $table->construct_header($form->generate_check_box('allbox', '1', '', array('class' => 'checkall')), array( 'width' => 1));
|
$table->construct_header($lang->attachments, array('colspan' => 2)); $table->construct_header($lang->size, array('width' => '10%', 'class' => 'align_center')); $table->construct_header($lang->posted_by, array('width' => '20%', 'class' => 'align_center'));
| $table->construct_header($lang->attachments, array('colspan' => 2)); $table->construct_header($lang->size, array('width' => '10%', 'class' => 'align_center')); $table->construct_header($lang->posted_by, array('width' => '20%', 'class' => 'align_center'));
|
Zeile 848 | Zeile 893 |
---|
$form_container->output_row($lang->name_contains, $lang->name_contains_desc, $form->generate_text_box('filename', $mybb->input['filename'], array('id' => 'filename')), 'filename'); $form_container->output_row($lang->type_contains, "", $form->generate_text_box('mimetype', $mybb->input['mimetype'], array('id' => 'mimetype')), 'mimetype'); $form_container->output_row($lang->forum_is, "", $form->generate_forum_select('forum[]', $mybb->input['forum'], array('multiple' => true, 'size' => 5, 'id' => 'forum')), 'forum');
|
$form_container->output_row($lang->name_contains, $lang->name_contains_desc, $form->generate_text_box('filename', $mybb->input['filename'], array('id' => 'filename')), 'filename'); $form_container->output_row($lang->type_contains, "", $form->generate_text_box('mimetype', $mybb->input['mimetype'], array('id' => 'mimetype')), 'mimetype'); $form_container->output_row($lang->forum_is, "", $form->generate_forum_select('forum[]', $mybb->input['forum'], array('multiple' => true, 'size' => 5, 'id' => 'forum')), 'forum');
|
$form_container->output_row($lang->username_is, "", $form->generate_text_box('username', $mybb->input['username'], array('id' => 'username')), 'username');
| $form_container->output_row($lang->username_is, "", $form->generate_text_box('username', htmlspecialchars_uni($mybb->get_input('username')), array('id' => 'username')), 'username'); $form_container->output_row($lang->poster_is, "", $form->generate_select_box('user_types', array('0' => $lang->poster_is_either, '1' => $lang->poster_is_user, '-1' => $lang->poster_is_guest), $mybb->get_input('user_types', MyBB::INPUT_INT), array('id' => 'guests')), 'user_types');
|
$more_options = array( "less_than" => $lang->more_than,
| $more_options = array( "less_than" => $lang->more_than,
|
Zeile 945 | Zeile 991 |
---|
if($attachment['user_username']) {
|
if($attachment['user_username']) {
|
$attachment['username'] = $attachment['username'];
| $attachment['username'] = $attachment['user_username'];
|
}
|
}
|
$table->construct_cell(build_profile_link($attachment['username'], $attachment['uid'], "_blank"), array("class" => "align_center"));
| $table->construct_cell(build_profile_link(htmlspecialchars_uni($attachment['username']), $attachment['uid'], "_blank"), array("class" => "align_center"));
|
$table->construct_cell("<a href=\"../".get_post_link($attachment['pid'])."\" target=\"_blank\">".htmlspecialchars_uni($attachment['subject'])."</a>", array("class" => "align_center")); $table->construct_cell(my_number_format($attachment['downloads']), array("class" => "align_center")); if($attachment['dateuploaded'] > 0)
| $table->construct_cell("<a href=\"../".get_post_link($attachment['pid'])."\" target=\"_blank\">".htmlspecialchars_uni($attachment['subject'])."</a>", array("class" => "align_center")); $table->construct_cell(my_number_format($attachment['downloads']), array("class" => "align_center")); if($attachment['dateuploaded'] > 0)
|