Example #1
0
	}

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

	if($upload->type() == "topic") {
		header("Location: ".Link::thread($id));
		exit;
	}

	###########################################################################
	// update pickuplinks
	global $autoplay;

	$autoplay = PickupLink::update($upload);

	if(array_key_exists('loop', $_REQUEST)) {
Example #2
0
function do_random()
{
    global $id_pattern, $main_command, $id_pattern;
    $random_id = get_random_id();
    if (preg_match('/^' . $id_pattern . '$/', $random_id)) {
        build_html($random_id);
        print_jumpto($random_id);
    } else {
        $main_command = 'create';
        do_create();
    }
}
Example #3
0
function create_single_data($table_root, $data)
{
    if (empty($data)) {
        return array(null, null);
    }
    $schema = object_read("{$table_root}/schema.json");
    if (empty($schema)) {
        return array(null, null);
    }
    $new_id = get_random_id($table_root);
    if (!set_data_id($data, $new_id)) {
        return array(null, null);
    }
    $new_data = format_fields($schema, $data);
    $new_id_file = "{$table_root}/{$new_id}.json";
    wh_event_file($new_id_file, 'add');
    return array($new_id, object_save($new_id_file, $new_data));
}