function imgPath($timestamp, $id, $filename) {
	if(!is_intger($timestamp, $id, $filename))
		$timestamp = strtotime($timestamp);
	
	$year = date( "Y", $timestamp );
	$month = date( "m", $timestamp );
	$day = date( "d", $timestamp );
	
	$path = "offensive/uploads/$year/$month/$day/image/" . $id . "_" . $filename;
	
	return($path);
}
	
	
	function getFileSize( $fpath ) {
		$k = "";
		if( file_exists( $fpath ) ) {
			$size = filesize( $fpath );
			$k = round( ($size/1024) ) . "k";		
		}
		return $k;
	}

	
	if(!isset($link) || !$link) $link = openDbConnection();
	
	$startNum = is_intger( $_REQUEST['start'] ) ? $_REQUEST['start'] : 0;
	$numItems = is_intger( $_REQUEST['num'] ) ? $_REQUEST['num'] : 100;	

	$sql = "select offensive_uploads.*, users.username, offensive_count_cache.*
			FROM offensive_uploads
				LEFT JOIN users ON offensive_uploads.userid = users.userid
				LEFT JOIN offensive_count_cache on threadid=offensive_uploads.id
			WHERE type='image' AND status='normal'
			ORDER BY offensive_uploads.timestamp DESC
			LIMIT $startNum, $numItems";

	$result = mysql_query( $sql );

	while( $row = mysql_fetch_assoc( $result ) ) {
	
		$nsfw = $row['nsfw'] == 1 ? "[nsfw]" : "";
		
Example #3
0
	require_once("offensive/assets/functions.inc");
	require_once( 'admin/mysqlConnectionInfo.inc' );
	if(!isset($link) || !$link) $link = openDbConnection();
	require_once("offensive/assets/classes.inc");
	require_once("offensive/assets/core.inc");
	require_once("offensive/classes/assets.inc");

	mustLogIn();
	time_start($ptime);

	$id = "";
	if(array_key_exists("id", $_REQUEST)) {
		$id = $_REQUEST["id"];
	}

	if(!is_intger($id)) {
		header( "Location: /offensive/" );
		exit;
	}

	$upload = core_getupload($id);
	if(!$upload->exists()) {
		header( "Location: /offensive/" );
		exit;
	}
	PickupLink::content($upload->type());

	if(array_key_exists("random", $_REQUEST)) {
		header("Location: ".Link::upload(get_random_id($upload)));
		exit;
	}
// this code grabs all the different pieces of user info that we'd like to
// show on a google infowindow.

set_include_path("../..");
require_once( 'offensive/assets/header.inc' );
require_once( "offensive/assets/activationFunctions.inc" );
require_once( 'admin/mysqlConnectionInfo.inc' );
if(!isset($link) || !$link) $link = openDbConnection();
require_once("offensive/assets/functions.inc");
require_once("offensive/assets/classes.inc");

// authentication
mustLogIn(array("prompt" => "http",
                "token" => null));

$user = (isset($_GET['user']) && is_intger($_GET['user'])) ? $_GET['user'] : "";
if($user == "") trigger_error("no user argument", E_USER_ERROR);

$user = new User($user);
$avatar = $user->yearbook();

if($avatar == false) {
	// show a default image if there is no thumbnail
	$thumb = "<img src='/tmbologo.gif' width='50' height='33' />";
} else {
	if(strlen($avatar->thumb())) {
		$info = getimagesize($avatar->thumb());
	}
	
	// XXX: this could do with some filtering.
	$thumb = "<a href='".Link::upload($avatar)."' target='_blank'><img src='" . $avatar->thumbURL() . "' ".(is_array($info) ? $info[3] : "")." border='0' /></a>";
Example #5
0
					<div class="blackbar"></div>
				</div>

				<div class="contentbox">
					<div class="blackbar"></div>
					<div class="heading">contact:</div>
					<div class="bluebox">
						<a href="/contact/">email</a><br>
						aim: <a href="aim:goim?screenname=themaxxcom">themaxxcom</a><br>
					</div>
					<div class="blackbar"></div>
				</div><?
					if($c != "comments" && $c != "online" && me()->status() == "admin") { whosOn(); }
					else if($c == "comments") {
						if(!array_key_exists("fileid", $_REQUEST)
						|| !is_intger($_REQUEST['fileid']))
						{ trigger_error("non-numeric fileid!", E_USER_ERROR); }
						$upload = core_getupload($_REQUEST['fileid']);
						if($upload->uploader()->id() == me()->id() || me()->status() == "admin")
						{ whosubscribed($upload); }
					}
			} // archive <--> bottom restricted block ?>
		</div> <!-- end left column -->
		
		<div id="rightcol">
		
		<?
		if(isset($downtime)) {
		  $left = $downtime - time();
		  if($left >= 0 && $left < 14400) { // 4h
		    $message = "tmbo is going ";
if(!isset($link) || !$link) $link = openDbConnection();
require_once("offensive/assets/classes.inc");
require_once("offensive/assets/core.inc");
require_once("offensive/assets/id3.inc");

function fail() {
	header("Location: http://{$_SERVER['HTTP_HOST']}/offensive/404.php", true, 301);
	exit;
}

$id = "";
if(array_key_exists("id", $_REQUEST)) {
	$id = $_REQUEST["id"];
}

if(!is_intger($id)) fail();

$upload = core_getupload($id);
if($upload->type() != "audio" || !$upload->file()) fail();

$fp = fopen($upload->file(), 'r');
$id3 = new getid3_id3v2($fp, $info);

// check for a valid id3 tag
if(!array_key_exists('id3v2', $info)) fail();

$artdata = false;

// different kinds of embeddable images:
if(array_key_exists('APIC', $info['id3v2'])
   && count($info['id3v2']['APIC']) > 0
	function userRowFromCode( $code ) {
	
		$id = id_from_hash( $code );
		if( is_intger( $id ) && $id > 1 ) {
			$sql = "SELECT * FROM users WHERE userid = $id";
			$result = tmbo_query( $sql );
			if( mysql_num_rows( $result ) == 1 ) {
				$row = mysql_fetch_assoc( $result );
				$hash = hashFromUserRow( $row );
				if( $hash == $code ) {
					return $row;
				}
			}
		}
		return false;
	}
Example #8
0
	function format_data(&$data) {
		global $rtype;
		
		if(is_object($data)) return;
		
		if(is_array($data)) {
			foreach($data as $key => $val) {
				format_data($data[$key]);
			}
		/* plists get a special date format as their output,
		 * due to spec restrictions.
		 */
		} else if(strtotime($data) > 0 && !is_numeric($data) && $rtype == "plist") {
			$data = gmdate('c', strtotime($data));
		} else if(is_numeric($data)) {
			if(is_intger($data)) {
				$data = (int)$data;
			} else {
				$data = (double)$data;
			}
		} else if($data === "true") {
			$data = true;
		} else if($data === "false") {
			$data = false;
		}
		if(is_string($data) && $rtype == "xml") {
			$data = str_replace(array("&", "<", ">"), array("&amp;", "&lt;", "&gt;"), $data);
		}
	}
<?php
	set_include_path("..");
	require_once('offensive/assets/header.inc');

	mustLogIn();

	require_once( 'admin/mysqlConnectionInfo.inc' ); 
	if(!isset($link) || !$link) $link = openDbConnection();
	require_once('offensive/assets/functions.inc');
	require_once("offensive/assets/classes.inc");
	
	$prefname = sqlEscape( array_key_exists("p", $_REQUEST) ? $_REQUEST['p'] : "");
	$value = sqlEscape( array_key_exists("v", $_REQUEST) ?$_REQUEST['v'] : "");

	if(strlen($prefname) > 0) {
		me()->setPref($prefname, $value);
	}

	if( array_key_exists("sq", $_REQUEST) && is_intger( $_REQUEST['sq'] ) ) {
		me()->squelch($_REQUEST['sq']);
	}

	if( array_key_exists("unsq", $_REQUEST) && is_intger( $_REQUEST['unsq'] ) ) {
		me()->unsquelch($_REQUEST['unsq']);
	}

	if(array_key_exists("HTTP_REFERER", $_SERVER)) {
		header( "Location: " . $_SERVER['HTTP_REFERER'] );
	} else { ?>
		<html><head><script type="text/javascript">history.go(-1);</script></head><body /></html>
	<? } ?>
// check for inconsistent data state
if(!file_exists($indexfile) || !file_exists($lastcfile)) {
	if(file_exists($lastcfile)) {
		rmr($lastcfile);
	}
	if(file_exists($indexfile)) {
		rmr($indexfile);
	}
}

// pick up where we left off
if(file_exists($lastcfile)) {
	$lastc = trim(file_get_contents($lastcfile));
	// if the file is corrupted, we have to start from scratch
	if(!is_intger($lastc)) {
		// throw out the corrupt file and the index
		rmr($lastcfile);
		// XXX: usually I don't find myself saying this, but this would be a great time to have a goto instruction
		if(!file_exists($indexfile))
			rmr($indexfile);
	}
}
if(!file_exists($lastcfile)) {
	// if we've never left off before, just start at 1.  it'll figure itself out.
	$lastc = 0;
}

// ok, here we go
try {
	// set up the Xapian environment