input->clean_array_gpc('r', array( 'type' => TYPE_STR, 'userid' => TYPE_UINT, )); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### if ($vbulletin->GPC['userid'] == 0) { $vbulletin->GPC['type'] = 'regcheck'; } if ($vbulletin->GPC['type'] == 'regcheck') { require_once(DIR . '/includes/class_image.html'); $vbulletin->input->clean_array_gpc('r', array( 'imagehash' => TYPE_STR, 'i' => TYPE_STR, )); $moveabout = true; if ($vbulletin->GPC['imagehash'] == '' OR $vbulletin->GPC['imagehash'] == 'test') { $imageinfo = array( 'imagestamp' => 'vBulletin', ); $moveabout = false; } else if (!$vbulletin->options['regimagetype'] OR $vbulletin->GPC['imagehash'] == '' OR !($imageinfo = $db->query_first("SELECT imagestamp FROM " . TABLE_PREFIX . "regimage WHERE regimagehash = '" . $db->escape_string($vbulletin->GPC['imagehash']) . "' AND viewed = 0"))) { header('Content-type: image/gif'); readfile(DIR . '/' . $vbulletin->options['cleargifurl']); exit; } else { $db->query_write(" UPDATE " . TABLE_PREFIX . "regimage SET viewed = 1 WHERE regimagehash = '" . $db->escape_string($vbulletin->GPC['imagehash']) . "' AND viewed = 0 "); if ($db->affected_rows() == 0) { // image managed to get viewed by someone else between the $imageinfo query above and now header('Content-type: image/gif'); readfile(DIR . '/' . $vbulletin->options['cleargifurl']); exit; } } if ($vbulletin->GPC['i'] == 'gd') { $image = new vB_Image_GD($vbulletin); } else if ($vbulletin->GPC['i'] == 'im') { $image = new vB_Image_Magick($vbulletin); } else { $image =& vB_Image::fetch_library($vbulletin, 'regimage'); } $db->close(); $image->print_image_from_string($imageinfo['imagestamp'], $moveabout); } else { $vbulletin->input->clean_array_gpc('r', array( 'dateline' => TYPE_UINT, )); if ($vbulletin->GPC['type'] == 'profile') { $table = 'customprofilepic'; // No permissions to see profile pics if (!$vbulletin->options['profilepicenabled'] OR (!($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseeprofilepic']) AND $vbulletin->userinfo['userid'] != $vbulletin->GPC['userid'])) { exec_shut_down(); // Update location with 'No permission to view profile picture' header('Content-type: image/gif'); readfile(DIR . '/' . $vbulletin->options['cleargifurl']); exit; } } else if ($vbulletin->GPC['type'] == 'sigpic') { $table = 'sigpic'; } else { $table = 'customavatar'; } if ($imageinfo = $db->query_first_slave(" SELECT filedata, dateline, filename FROM " . TABLE_PREFIX . "$table WHERE userid = " . $vbulletin->GPC['userid'] . " AND visible = 1 ")) { header('Cache-control: max-age=31536000'); header('Expires: ' . gmdate('D, d M Y H:i:s', (TIMENOW + 31536000)) . ' GMT'); header('Content-disposition: inline; filename=' . $imageinfo['filename']); header('Content-transfer-encoding: binary'); header('Content-Length: ' . strlen($imageinfo['filedata'])); header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $imageinfo['dateline']) . ' GMT'); header('ETag: "' . $imageinfo['dateline'] . '-' . $vbulletin->GPC['userid'] . '"'); $extension = trim(substr(strrchr(strtolower($imageinfo['filename']), '.'), 1)); if ($extension == 'jpg' OR $extension == 'jpeg') { header('Content-type: image/jpeg'); } else if ($extension == 'png') { header('Content-type: image/png'); } else { header('Content-type: image/gif'); } $db->close(); echo $imageinfo['filedata']; } else { header('Content-type: image/gif'); readfile(DIR . '/' . $vbulletin->options['cleargifurl']); } } /*======================================================================*\ || #################################################################### || # Downloaded: 19:33, Wed Feb 14th 2007 || # CVS: $RCSfile$ - $Revision: 15021 $ || #################################################################### \*======================================================================*/ ?>