Vergleich admin/modules/forum/attachments.php - 1.4.1 - 1.4.8

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * $Id: attachments.php 4046 2008-07-26 03:04:54Z ZiNgaBuRgA $

 * $Id: attachments.php 4304 2009-01-02 01:11:56Z chris $

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 50Zeile 50
	}
else
{

	}
else
{

		array_walk($mybb->input['aids'], "intval");

		$mybb->input['aids'] = array_map("intval", $mybb->input['aids']);

	}

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

	}

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

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


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


	$query = $db->query("
SELECT a.*, u.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
ORDER BY totalsize DESC
LIMIT 5
");















	switch($db->type)
{
case "pgsql":
$query = $db->query("
SELECT a.*, u.uid AS useruid, 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 ".$db->build_fields_string("attachments", "a.").",u.uid,u.username
ORDER BY totalsize DESC
LIMIT 5
");
break;
default:
$query = $db->query("
SELECT a.*, u.uid AS useruid, 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
ORDER BY totalsize DESC
LIMIT 5
");
}

	while($user = $db->fetch_array($query))
{

	while($user = $db->fetch_array($query))
{

		$table->construct_cell(build_profile_link($user['username'], $user['uid']));





		if(!$user['useruid'])
{
$user['username'] = $lang->na;
}
$table->construct_cell(build_profile_link($user['username'], $user['useruid']));

		$table->construct_cell("<a href=\"index.php?module=forum/attachments&amp;results=1&amp;username=".urlencode($user['username'])."\">".get_friendly_size($user['totalsize'])."</a>", array('class' => 'align_center'));
$table->construct_row();
}
$table->output($lang->users_diskspace);

$page->output_footer();

		$table->construct_cell("<a href=\"index.php?module=forum/attachments&amp;results=1&amp;username=".urlencode($user['username'])."\">".get_friendly_size($user['totalsize'])."</a>", array('class' => 'align_center'));
$table->construct_row();
}
$table->output($lang->users_diskspace);

$page->output_footer();

}


}


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");

Zeile 213Zeile 231
		{
return str_replace(array(".."), "", $string);
}

		{
return str_replace(array(".."), "", $string);
}

		array_walk($mybb->input['orphaned_files'], "clean_filename");

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

		foreach($mybb->input['orphaned_files'] as $file)
{
if(!@unlink(MYBB_ROOT.$mybb->settings['uploadspath']."/".$file))

Zeile 226Zeile 244
	// Deleting physical attachments which exist in database
if(is_array($mybb->input['orphaned_attachments']))
{

	// Deleting physical attachments which exist in database
if(is_array($mybb->input['orphaned_attachments']))
{

		array_walk($mybb->input['orphaned_attachments'], "intval");

		$mybb->input['orphaned_attachments'] = array_map("intval", $mybb->input['orphaned_attachments']);

		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))

		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))

		{

		{

			if(!$attachment['pid'])
{
remove_attachment(null, $attachment['posthash'], $attachment['aid']);

			if(!$attachment['pid'])
{
remove_attachment(null, $attachment['posthash'], $attachment['aid']);

Zeile 302Zeile 320
			$incomplete_attachments = unserialize($mybb->input['incomplete_attachments']);
$aids = array_merge($aids, $incomplete_attachments);
}

			$incomplete_attachments = unserialize($mybb->input['incomplete_attachments']);
$aids = array_merge($aids, $incomplete_attachments);
}

 
		
foreach($aids as $key => $aid)
{
$aids[$key] = intval($aid);
}


		$results += count($aids);

if($results == 0)

		$results += count($aids);

if($results == 0)

Zeile 489Zeile 513
						// In allotments of 20, query the database for these attachments
if(count($attachments_to_check) >= 20)
{

						// In allotments of 20, query the database for these attachments
if(count($attachments_to_check) >= 20)
{

							array_walk($attachments_to_check, array($db, "escape_string"));

							$attachments_to_check = array_map(array($db, "escape_string"), $attachments_to_check);

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

Zeile 517Zeile 541
				// Any reamining to check?
if(count($attachments_to_check) > 0)
{

				// Any reamining to check?
if(count($attachments_to_check) > 0)
{

					array_walk($attachments_to_check, array($db, "escape_string"));

					$attachments_to_check = array_map(array($db, "escape_string"), $attachments_to_check);

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

Zeile 586Zeile 610
		// Build the search SQL for users

// List of valid LIKE search fields

		// Build the search SQL for users

// List of valid LIKE search fields

		$user_like_fields = array("filename", "mimetype");

		$user_like_fields = array("filename", "filetype");

		foreach($user_like_fields as $search_field)
{
if($mybb->input[$search_field])

		foreach($user_like_fields as $search_field)
{
if($mybb->input[$search_field])

Zeile 767Zeile 791
			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('filename', 'mimetype', 'username', 'fid', 'downloads', 'downloads_dir', 'dateuploaded', 'dateuploaded_dir', 'filesize', 'filesize_dir');

				$pagination_vars = array('filename', 'filetype', 'username', 'fid', 'downloads', 'downloads_dir', 'dateuploaded', 'dateuploaded_dir', 'filesize', 'filesize_dir');

				foreach($pagination_vars as $var)
{
if($mybb->input[$var])

				foreach($pagination_vars as $var)
{
if($mybb->input[$var])

Zeile 805Zeile 829

$form_container = new FormContainer($lang->find_where);
$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 = new FormContainer($lang->find_where);
$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->type_contains, "", $form->generate_text_box('filetype', $mybb->input['filetype'], array('id' => 'filetype')), 'filetype');

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