forked from trhoppe/roadraceautox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblog_attachment.php
97 lines (82 loc) · 3.62 KB
/
blog_attachment.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 4.2.0 Patch Level 3 - Licence Number VBFBED0615
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2012 vBulletin Solutions Inc. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
/*
* This file is present for backwards compatibility only.
* No current links should point here, instead they should use the
* integrated attachment functionality.
*/
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NOSHUTDOWNFUNC', 1);
define('NOCOOKIES', 1);
define('THIS_SCRIPT', 'blog_attachment');
define('CSRF_PROTECTION', true);
define('VB_AREA', 'Forum');
define('SKIP_SESSIONCREATE', 1);
define('SKIP_USERINFO', 1);
define('SKIP_DEFAULTDATASTORE', 1);
define('NOPMPOPUP', 1);
define('NONOTICES', 1);
// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array();
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
define('CWD', (($getcwd = getcwd()) ? $getcwd : '.'));
require_once(CWD . '/includes/init.php');
$vbulletin->input->clean_array_gpc('r', array(
'attachmentid' => TYPE_UINT,
));
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
$imageinfo = false;
if ($vbulletin->GPC['attachmentid'])
{
$imageinfo = $db->query_first_slave("
SELECT newattachmentid
FROM " . TABLE_PREFIX . "blog_attachmentlegacy
WHERE oldattachmentid = " . $vbulletin->GPC['attachmentid'] . "
");
}
if ($imageinfo)
{
exec_header_redirect("attachment.php?attachmentid=$imageinfo[newattachmentid]", 301);
}
else
{
$filedata = vb_base64_decode('R0lGODlhAQABAIAAAMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
$filesize = strlen($filedata);
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1
header('Pragma: no-cache'); // HTTP/1.0
header("Content-disposition: inline; filename=clear.gif");
header('Content-transfer-encoding: binary');
header("Content-Length: $filesize");
header('Content-type: image/gif');
echo $filedata;
exit;
}
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 16:29, Sun Dec 9th 2012
|| # CVS: $RCSfile$ - $Revision: 32138 $
|| ####################################################################
\*======================================================================*/
?>