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

  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 148Zeile 162
		LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid)
ORDER BY a.downloads DESC

		LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid)
ORDER BY a.downloads DESC

		LIMIT 5
");

		LIMIT 5
");

	while($attachment = $db->fetch_array($query))
{
build_attachment_row($attachment, $table);

	while($attachment = $db->fetch_array($query))
{
build_attachment_row($attachment, $table);

Zeile 184Zeile 198
	$table = new Table;
$table->construct_header($lang->username);
$table->construct_header($lang->total_size, array('width' => '20%', 'class' => 'align_center'));

	$table = new Table;
$table->construct_header($lang->username);
$table->construct_header($lang->total_size, array('width' => '20%', 'class' => 'align_center'));





	switch($db->type)
{
case "pgsql":

	switch($db->type)
{
case "pgsql":

Zeile 230Zeile 244

// 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']))

	{

	{

		foreach($mybb->input['orphaned_files'] as $file)
{
$file = str_replace('..', '', $file);

		foreach($mybb->input['orphaned_files'] as $file)
{
$file = str_replace('..', '', $file);

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
);
});</script>";

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

		exit;
}
// Running first step, scan the file system

		exit;
}
// Running first step, scan the file system

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 591Zeile 605
					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);

							$bad_attachments = @array_merge($bad_attachments, $attachments_to_check);

						}

						}

						else
{
$bad_attachments = $attachments_to_check;
}
}

						else
{
$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 683Zeile 697
		{
$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 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 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');

			{
$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');

Zeile 875Zeile 883
						$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);