Vergleich admin/modules/forum/attachments.php - 1.8.27 - 1.8.38

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 40Zeile 40
$plugins->run_hooks("admin_forum_attachments_begin");

$uploadspath_abs = mk_path_abs($mybb->settings['uploadspath']);

$plugins->run_hooks("admin_forum_attachments_begin");

$uploadspath_abs = mk_path_abs($mybb->settings['uploadspath']);

 

$default_perpage = 20;
$perpage = $mybb->get_input('perpage', MyBB::INPUT_INT);
if(!$perpage)
{
$perpage = $default_perpage;
}


if($mybb->input['action'] == "delete")
{
$plugins->run_hooks("admin_forum_attachments_delete");


if($mybb->input['action'] == "delete")
{
$plugins->run_hooks("admin_forum_attachments_delete");


if(!is_array($mybb->get_input('aids')))
{
$mybb->input['aids'] = array($mybb->get_input('aid', MyBB::INPUT_INT));
}
else
{
$mybb->input['aids'] = array_map("intval", $mybb->input['aids']);
}

if(count($mybb->input['aids']) < 1)
{









if(isset($mybb->input['aids']))
{
if(!is_array($mybb->input['aids']))
{
$mybb->input['aids'] = array($mybb->get_input('aid', MyBB::INPUT_INT));
}
else
{
$mybb->input['aids'] = array_map("intval", $mybb->input['aids']);
}
}
else
{
$mybb->input['aids'] = array();
}

if(count($mybb->input['aids']) < 1)
{

		flash_message($lang->error_nothing_selected, 'error');
admin_redirect("index.php?module=forum-attachments");
}

		flash_message($lang->error_nothing_selected, 'error');
admin_redirect("index.php?module=forum-attachments");
}

Zeile 64Zeile 78
	{
require_once MYBB_ROOT."inc/functions_upload.php";


	{
require_once MYBB_ROOT."inc/functions_upload.php";


		$query = $db->simple_select("attachments", "aid,pid,posthash, filename", "aid IN (".implode(",", $mybb->input['aids']).")");

		$query = $db->simple_select("attachments", "aid,pid,posthash,filename", "aid IN (".implode(",", $mybb->input['aids']).")");

		while($attachment = $db->fetch_array($query))
{
if(!$attachment['pid'])

		while($attachment = $db->fetch_array($query))
{
if(!$attachment['pid'])

			{

			{

				remove_attachment(null, $attachment['posthash'], $attachment['aid']);

				remove_attachment(null, $attachment['posthash'], $attachment['aid']);

				// Log admin action

				// Log admin action

				log_admin_action($attachment['aid'], $attachment['filename']);
}
else

				log_admin_action($attachment['aid'], $attachment['filename']);
}
else

Zeile 79Zeile 93
				// Log admin action
log_admin_action($attachment['aid'], $attachment['filename'], $attachment['pid']);
}

				// Log admin action
log_admin_action($attachment['aid'], $attachment['filename'], $attachment['pid']);
}

		}

		}


$plugins->run_hooks("admin_forum_attachments_delete_commit");



$plugins->run_hooks("admin_forum_attachments_delete_commit");


Zeile 103Zeile 117

$query = $db->simple_select("attachments", "COUNT(*) AS total_attachments, SUM(filesize) as disk_usage, SUM(downloads*filesize) as bandwidthused", "visible='1'");
$attachment_stats = $db->fetch_array($query);


$query = $db->simple_select("attachments", "COUNT(*) AS total_attachments, SUM(filesize) as disk_usage, SUM(downloads*filesize) as bandwidthused", "visible='1'");
$attachment_stats = $db->fetch_array($query);





		$page->add_breadcrumb_item($lang->stats);
$page->output_header($lang->stats_attachment_stats);


		$page->add_breadcrumb_item($lang->stats);
$page->output_header($lang->stats_attachment_stats);


Zeile 133Zeile 147
	$table->output($lang->general_stats);

// Fetch the most popular attachments

	$table->output($lang->general_stats);

// Fetch the most popular attachments

	$table = new Table;
$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->thread, array('width' => '25%', 'class' => 'align_center'));

	$table = new Table;
$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->thread, array('width' => '25%', 'class' => 'align_center'));

	$table->construct_header($lang->downloads, array('width' => '10%', 'class' => 'align_center'));
$table->construct_header($lang->date_uploaded, array("class" => "align_center"));


	$table->construct_header($lang->downloads, array('width' => '10%', 'class' => 'align_center'));
$table->construct_header($lang->date_uploaded, array("class" => "align_center"));


Zeile 321Zeile 335
	if($mybb->input['step'] == 3)
{
$plugins->run_hooks("admin_forum_attachments_step3");

	if($mybb->input['step'] == 3)
{
$plugins->run_hooks("admin_forum_attachments_step3");





		$reults = 0;
// Incoming attachments which exist as files but not in database
if(!empty($mybb->input['bad_attachments']))

		$reults = 0;
// Incoming attachments which exist as files but not in database
if(!empty($mybb->input['bad_attachments']))

Zeile 414Zeile 428
				}
$table->construct_cell($form->generate_check_box('orphaned_attachments[]', $attachment['aid'], '', array('checked' => true)));
$table->construct_cell(get_attachment_icon(get_extension($attachment['filename'])), array('width' => 1));

				}
$table->construct_cell($form->generate_check_box('orphaned_attachments[]', $attachment['aid'], '', array('checked' => true)));
$table->construct_cell(get_attachment_icon(get_extension($attachment['filename'])), array('width' => 1));

				$table->construct_cell("<span class=\"float_right\">".get_friendly_size($attachment['filesize'])."</span>{$attachment['filename']}", array('class' => $cell_class));

				$table->construct_cell("<span class=\"float_right\">".get_friendly_size($attachment['filesize'])."</span>{$attachment['filename']}");

				$table->construct_cell($reason, array('class' => 'align_center'));
if($attachment['dateuploaded'])
{

				$table->construct_cell($reason, array('class' => 'align_center'));
if($attachment['dateuploaded'])
{

Zeile 501Zeile 515
		{
$incomplete_attachments = my_serialize($incomplete_attachments);
echo $form->generate_hidden_field("incomplete_attachments", $incomplete_attachments);

		{
$incomplete_attachments = my_serialize($incomplete_attachments);
echo $form->generate_hidden_field("incomplete_attachments", $incomplete_attachments);

		}
$form->end();
echo "<script type=\"text/javascript\">$(function() {
window.setTimeout(
function() {
$(\"#redirect_form\").trigger('submit');
}, 100

		}
$form->end();
echo "<script type=\"text/javascript\">$(function() {
window.setTimeout(
function() {
$(\"#redirect_form\").trigger('submit');
}, 100

				);
});</script>";
exit;

				);
});</script>";
exit;

Zeile 522Zeile 536
		 */
function scan_attachments_directory($dir="")
{

		 */
function scan_attachments_directory($dir="")
{

			global $db, $mybb, $bad_attachments, $attachments_to_check;

			global $db, $mybb, $bad_attachments, $attachments_to_check, $uploadspath_abs;


$real_dir = $uploadspath_abs;
$false_dir = "";


$real_dir = $uploadspath_abs;
$false_dir = "";

Zeile 531Zeile 545
				$real_dir .= "/".$dir;
$false_dir = $dir."/";
}

				$real_dir .= "/".$dir;
$false_dir = $dir."/";
}





			if($dh = opendir($real_dir))
{
while(false !== ($file = readdir($dh)))

			if($dh = opendir($real_dir))
{
while(false !== ($file = readdir($dh)))

Zeile 599Zeile 613
							$bad_attachments = $attachments_to_check;
}
}

							$bad_attachments = $attachments_to_check;
}
}

				}
}

				}
}

		}

		}





		$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 612Zeile 626
		echo "<p class=\"align_center\"><img src=\"styles/{$page->style}/images/spinner_big.gif\" alt=\"{$lang->scanning}\" id=\"spinner\" /></p>";

$page->output_footer(false);

		echo "<p class=\"align_center\"><img src=\"styles/{$page->style}/images/spinner_big.gif\" alt=\"{$lang->scanning}\" id=\"spinner\" /></p>";

$page->output_footer(false);





		flush();

scan_attachments_directory();

		flush();

scan_attachments_directory();

Zeile 646Zeile 660
		$search_sql = '1=1';

$plugins->run_hooks("admin_forum_attachments_commit_start");

		$search_sql = '1=1';

$plugins->run_hooks("admin_forum_attachments_commit_start");





		// Build the search SQL for users

		// 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 657Zeile 671
			{
$search_sql .= " AND a.{$search_field} LIKE '%".$db->escape_string_like($mybb->input[$search_field])."%'";
}

			{
$search_sql .= " AND a.{$search_field} LIKE '%".$db->escape_string_like($mybb->input[$search_field])."%'";
}

		}


		}


		$errors = array();

// Normal users only

		$errors = array();

// Normal users only

Zeile 679Zeile 693
		}

// Username matching

		}

// Username matching

		if($mybb->input['username'])

		if(!empty($mybb->input['username']))

		{
$user = get_user_by_username($mybb->input['username']);


		{
$user = get_user_by_username($mybb->input['username']);


			if(!$user['uid'])

			if(!$user)

			{
if($user_types == 1)
{

			{
if($user_types == 1)
{

Zeile 693Zeile 707
				{
// 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'])."%'";

				{
// 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 705Zeile 719
		$forum_cache = cache_forums();

// Searching for attachments in a specific forum, we need to fetch all child forums too

		$forum_cache = cache_forums();

// Searching for attachments in a specific forum, we need to fetch all child forums too

		if($mybb->get_input('forum'))

		if(!empty($mybb->input['forum']))

		{
if(!is_array($mybb->input['forum']))
{

		{
if(!is_array($mybb->input['forum']))
{

Zeile 716Zeile 730
			foreach($mybb->input['forum'] as $fid)
{
if(!$forum_cache[$fid])

			foreach($mybb->input['forum'] as $fid)
{
if(!$forum_cache[$fid])

				{

				{

					$errors[] = $lang->error_invalid_forums;
break;
}
$child_forums = get_child_list($fid);
$child_forums[] = $fid;
$fid_in = array_merge($fid_in, $child_forums);

					$errors[] = $lang->error_invalid_forums;
break;
}
$child_forums = get_child_list($fid);
$child_forums[] = $fid;
$fid_in = array_merge($fid_in, $child_forums);

			}

			}


if(count($fid_in) > 0)
{
$search_sql .= " AND p.fid IN (".implode(",", $fid_in).")";


if(count($fid_in) > 0)
{
$search_sql .= " AND p.fid IN (".implode(",", $fid_in).")";

			}

			}

		}

// LESS THAN or GREATER THAN

		}

// LESS THAN or GREATER THAN

Zeile 738Zeile 752
			"downloads"    => $mybb->get_input('downloads', MyBB::INPUT_INT)
);


			"downloads"    => $mybb->get_input('downloads', MyBB::INPUT_INT)
);


		if(!empty($mybb->input['dateuploaded']) && $mybb->request_method == "post")

		if(!empty($mybb->input['dateuploaded']))

		{
$direction_fields['dateuploaded'] = TIME_NOW-$direction_fields['dateuploaded']*60*60*24;
}

		{
$direction_fields['dateuploaded'] = TIME_NOW-$direction_fields['dateuploaded']*60*60*24;
}

		if(!empty($mybb->input['filesize']) && $mybb->request_method == "post")

		if(!empty($mybb->input['filesize']))

		{
$direction_fields['filesize'] *= 1024;
}

		{
$direction_fields['filesize'] *= 1024;
}

Zeile 764Zeile 778
						$direction = "=";
}
$search_sql .= " AND a.{$field_name}{$direction}'".$field_content."'";

						$direction = "=";
}
$search_sql .= " AND a.{$field_name}{$direction}'".$field_content."'";

			}

			}

		}
if(!$errors)
{

		}
if(!$errors)
{

Zeile 787Zeile 801
		// Now we fetch the results if there were 100% no errors
if(!$errors)
{

		// Now we fetch the results if there were 100% no errors
if(!$errors)
{

			$mybb->input['perpage'] = $mybb->get_input('perpage', MyBB::INPUT_INT);
if(!$mybb->input['perpage'])
{
$mybb->input['perpage'] = 20;
}


 
			$mybb->input['page'] = $mybb->get_input('page', MyBB::INPUT_INT);
if($mybb->input['page'])
{

			$mybb->input['page'] = $mybb->get_input('page', MyBB::INPUT_INT);
if($mybb->input['page'])
{

				$start = ($mybb->input['page'] - 1) * $mybb->input['perpage'];

				$start = ($mybb->input['page'] - 1) * $perpage;

			}
else
{

			}
else
{

Zeile 855Zeile 863
				LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid)
WHERE {$search_sql}
ORDER BY {$sort_field} {$mybb->input['order']}

				LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid)
WHERE {$search_sql}
ORDER BY {$sort_field} {$mybb->input['order']}

				LIMIT {$start}, {$mybb->input['perpage']}

				LIMIT {$start}, {$perpage}

			");
while($attachment = $db->fetch_array($query))
{

			");
while($attachment = $db->fetch_array($query))
{

Zeile 864Zeile 872

// Need to draw pagination for this result set
$pagination = '';


// Need to draw pagination for this result set
$pagination = '';

			if($num_results > $mybb->input['perpage'])

			if($num_results > $perpage)

			{
$pagination_url = "index.php?module=forum-attachments&amp;results=1";
$pagination_vars = array('perpage', 'sortby', 'order', 'filename', 'mimetype', 'username', 'downloads', 'downloads_dir', 'dateuploaded', 'dateuploaded_dir', 'filesize', 'filesize_dir');
foreach($pagination_vars as $var)
{

			{
$pagination_url = "index.php?module=forum-attachments&amp;results=1";
$pagination_vars = array('perpage', 'sortby', 'order', 'filename', 'mimetype', 'username', 'downloads', 'downloads_dir', 'dateuploaded', 'dateuploaded_dir', 'filesize', 'filesize_dir');
foreach($pagination_vars as $var)
{

					if($mybb->input[$var])

					if($mybb->get_input($var))

					{
$pagination_url .= "&{$var}=".urlencode($mybb->input[$var]);
}
}

					{
$pagination_url .= "&{$var}=".urlencode($mybb->input[$var]);
}
}

				if(is_array($mybb->input['forum']) && !empty($mybb->input['forum']))

				if(!empty($mybb->input['forum']) && is_array($mybb->input['forum']))

				{
foreach($mybb->input['forum'] as $fid)
{
$pagination_url .= "&forum[]=".(int)$fid;
}
}

				{
foreach($mybb->input['forum'] as $fid)
{
$pagination_url .= "&forum[]=".(int)$fid;
}
}

				$pagination = draw_admin_pagination($mybb->input['page'], $mybb->input['perpage'], $num_results, $pagination_url);

				$pagination = draw_admin_pagination($mybb->input['page'], $perpage, $num_results, $pagination_url);

			}

echo $pagination;

			}

echo $pagination;

Zeile 946Zeile 954
		"desc" => $lang->desc
);
$form_container->output_row($lang->sort_results_by, "", $form->generate_select_box('sortby', $sort_options, $mybb->get_input('sortby'), array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('order', $sort_directions, $mybb->get_input('order'), array('id' => 'order')), 'sortby');

		"desc" => $lang->desc
);
$form_container->output_row($lang->sort_results_by, "", $form->generate_select_box('sortby', $sort_options, $mybb->get_input('sortby'), array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('order', $sort_directions, $mybb->get_input('order'), array('id' => 'order')), 'sortby');

	$form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('perpage', $mybb->get_input('perpage', MyBB::INPUT_INT), array('id' => 'perpage', 'min' => 1)), 'perpage');

	$form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('perpage', $perpage, array('id' => 'perpage', 'min' => 1)), 'perpage');

	$form_container->end();

$buttons[] = $form->generate_submit_button($lang->button_find_attachments);

	$form_container->end();

$buttons[] = $form->generate_submit_button($lang->button_find_attachments);