Vergleich admin/modules/forum/attachments.php - 1.8.11 - 1.8.26

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 229Zeile 229
	// 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']))
{

		/**
* @param string $string
*
* @return 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)
{

		foreach($mybb->input['orphaned_files'] as $file)
{

 
			$file = str_replace('..', '', $file);
$path = MYBB_ROOT.$mybb->settings['uploadspath']."/".$file;
$real_path = realpath($path);

if($real_path === false || strpos(str_replace('\\', '/', $real_path), str_replace('\\', '/', realpath(MYBB_ROOT)).'/') !== 0 || $real_path == realpath(MYBB_ROOT.'install/lock'))
{
$error_count++;
continue;
}


			if(!@unlink(MYBB_ROOT.$mybb->settings['uploadspath']."/".$file))
{
$error_count++;

			if(!@unlink(MYBB_ROOT.$mybb->settings['uploadspath']."/".$file))
{
$error_count++;

Zeile 364Zeile 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 374Zeile 374
			foreach($bad_attachments as $file)
{
$file_path = MYBB_ROOT.$mybb->settings['uploadspath']."/".$file;

			foreach($bad_attachments as $file)
{
$file_path = MYBB_ROOT.$mybb->settings['uploadspath']."/".$file;

				$filesize = get_friendly_size(filesize($file_path));
$table->construct_cell($form->generate_check_box('orphaned_files[]', $file, '', array('checked' => true)));
$table->construct_cell(get_attachment_icon(get_extension($attachment['filename'])), array('width' => 1));
$table->construct_cell("<span class=\"float_right\">{$filesize}</span>{$file}");
$table->construct_cell($lang->reason_not_in_table, array('class' => 'align_center'));
$table->construct_cell(my_date('relative', filemtime($file_path)), array('class' => 'align_center'));
$table->construct_row();







if(file_exists($file_path))
{
$filename = htmlspecialchars_uni($file);
$filesize = get_friendly_size(filesize($file_path));
$table->construct_cell($form->generate_check_box('orphaned_files[]', $file, '', array('checked' => true)));
$table->construct_cell(get_attachment_icon(get_extension($attachment['filename'])), array('width' => 1));
$table->construct_cell("<span class=\"float_right\">{$filesize}</span>{$filename}");
$table->construct_cell($lang->reason_not_in_table, array('class' => 'align_center'));
$table->construct_cell(my_date('relative', filemtime($file_path)), array('class' => 'align_center'));
$table->construct_row();
}

			}
}

if(count($aids) > 0)
{
$query = $db->simple_select("attachments", "*", "aid IN (".implode(",", $aids).")");

			}
}

if(count($aids) > 0)
{
$query = $db->simple_select("attachments", "*", "aid IN (".implode(",", $aids).")");

			while($attachment = $db->fetch_array($query))

			while($attachment = $db->fetch_array($query))

			{
$attachment['filename'] = htmlspecialchars_uni($attachment['filename']);


			{
$attachment['filename'] = htmlspecialchars_uni($attachment['filename']);


Zeile 461Zeile 466
			}
// Check if the thread/post for this attachment is missing
else if(!$attachment['pid'] && $attachment['attachment_pid'])

			}
// Check if the thread/post for this attachment is missing
else if(!$attachment['pid'] && $attachment['attachment_pid'])

			{

			{

				$missing_threads[$attachment['aid']] = $attachment['aid'];
}
// Check if the attachment was uploaded > 24 hours ago but not assigned to a thread

				$missing_threads[$attachment['aid']] = $attachment['aid'];
}
// Check if the attachment was uploaded > 24 hours ago but not assigned to a thread

Zeile 489Zeile 494
			echo $form->generate_hidden_field("missing_threads", $missing_threads);
}
if(is_array($incomplete_attachments) && count($incomplete_attachments) > 0)

			echo $form->generate_hidden_field("missing_threads", $missing_threads);
}
if(is_array($incomplete_attachments) && count($incomplete_attachments) > 0)

		{

		{

			$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);
}

Zeile 497Zeile 502
		echo "<script type=\"text/javascript\">$(function() {
window.setTimeout(
function() {

		echo "<script type=\"text/javascript\">$(function() {
window.setTimeout(
function() {

						$(\"#redirect_form\").submit();

						$(\"#redirect_form\").trigger('submit');

					}, 100
);
});</script>";

					}, 100
);
});</script>";

Zeile 535Zeile 540
					if(is_dir($real_dir.'/'.$file))
{
scan_attachments_directory($false_dir.$file);

					if(is_dir($real_dir.'/'.$file))
{
scan_attachments_directory($false_dir.$file);

					}

					}

					else if(my_substr($file, -7, 7) == ".attach")
{
$attachments_to_check["$false_dir$file"] = $false_dir.$file;

					else if(my_substr($file, -7, 7) == ".attach")
{
$attachments_to_check["$false_dir$file"] = $false_dir.$file;

Zeile 554Zeile 559
							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;
}
}
$attachments_to_check = array();

								else
{
$bad_attachments = $attachments_to_check;
}
}
$attachments_to_check = array();

						}

						}

					}
}
closedir($dh);

					}
}
closedir($dh);

Zeile 608Zeile 613

scan_attachments_directory();
global $bad_attachments;


scan_attachments_directory();
global $bad_attachments;





		$form = new Form("index.php?module=forum-attachments&amp;action=orphans&amp;step=2", "post", "redirect_form", 0, "");
// Scan complete
if(is_array($bad_attachments) && count($bad_attachments) > 0)

		$form = new Form("index.php?module=forum-attachments&amp;action=orphans&amp;step=2", "post", "redirect_form", 0, "");
// Scan complete
if(is_array($bad_attachments) && count($bad_attachments) > 0)

Zeile 620Zeile 625
		echo "<script type=\"text/javascript\">$(function() {
window.setTimeout(
function() {

		echo "<script type=\"text/javascript\">$(function() {
window.setTimeout(
function() {

						$(\"#redirect_form\").submit();

						$(\"#redirect_form\").trigger('submit');

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

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





if(!$mybb->input['action'])
{
$plugins->run_hooks("admin_forum_attachments_start");

if(!$mybb->input['action'])
{
$plugins->run_hooks("admin_forum_attachments_start");

Zeile 649Zeile 654
		}

$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 657Zeile 679

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 799Zeile 830
			$form = new Form("index.php?module=forum-attachments&amp;action=delete", "post");

$table = new Table;

			$form = new Form("index.php?module=forum-attachments&amp;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 827Zeile 858
			if($num_results > $mybb->input['perpage'])
{
$pagination_url = "index.php?module=forum-attachments&amp;results=1";

			if($num_results > $mybb->input['perpage'])
{
$pagination_url = "index.php?module=forum-attachments&amp;results=1";

				$pagination_vars = array('perpage', 'sortby', 'order', 'filename', 'mimetype', 'username', 'fid', 'downloads', 'downloads_dir', 'dateuploaded', 'dateuploaded_dir', 'filesize', 'filesize_dir');

				$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])
{
$pagination_url .= "&{$var}=".urlencode($mybb->input[$var]);

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

 
					}
}
if(is_array($mybb->input['forum']) && !empty($mybb->input['forum']))
{
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'], $mybb->input['perpage'], $num_results, $pagination_url);

Zeile 868Zeile 906
	$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', htmlspecialchars_uni($mybb->get_input('username')), array('id' => 'username')), 'username');

	$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', 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,