Пример #1
0
function get_random_pool_by_size($database)
{
    $sizes = get_sizes($database);
    $total = array_sum($sizes);
    $random = mt_rand(0, $total);
    $pointer = 0;
    foreach ($sizes as $index => $size) {
        $pointer += $size;
        if ($pointer >= $random) {
            break;
        }
    }
    return $database[$index];
}
Пример #2
0
 $a[media_tag] = urldecode($a[media_tag]);
 $a[media_size] = convertfilesize($a[media_size]);
 $url = $uploadurl . "/" . $a[slot_name] . "/" . rawurlencode($a[media_tag]);
 if ($a[media_type] == 'image') {
     $img_path = $uploaddir . "/" . $a[slot_name] . "/" . $a[media_tag];
     $img_url = $url;
 } else {
     $img_path = "images/file.gif";
     $img_url = $img_path;
 }
 if (file_exists($img_path)) {
     $thumb_size = get_sizes($img_path, '50');
     $img_size = get_size($img_path);
 } else {
     $img_url = "images/nofile.gif";
     $thumb_size = get_sizes($img_path);
     $img_size = get_size($img_path);
 }
 /* 		$img_size = get_size($url);  */
 print "<tr>";
 /******************************************************************************
  * Media file USE button
  * Use button depends on context 
  * viewsite: no USE button displayed
  * discussion UI: source = discuss
  * image content block: editor = none
  * text content block: editor = html 
  ******************************************************************************/
 print "<td class='td{$color}'>\n";
 if ($comingfrom != "viewsite") {
     // for discussions, get media filename and id
Пример #3
0
$options = getopt($shortopts, $longopts);
//map options to variables
if ($options["a"] == "yes") {
    $unixTime = explode(".", $options["sfile"]);
    $date = date("Y-m-d", $unixTime[1]);
    $dir = $options["dir"] . $date . "/";
    $direc = $options["dir"] . $date . "/";
} else {
    $dir = $options["dir"];
    $direc = $options["dir"] . $date . "/";
}
// $dir = $options["dir"];
// $direc = $options["dir"]; //.$date."/";
$start = $options["sfile"];
$stop = $options["efile"];
$pre = $options["pre"];
//var_dump($options);
//get files to search
$files2search = carve($start, $stop, $dir, $pre);
//$files2search = carve($options);
//get sizes of the files you want to search
$file_sizes = get_sizes($files2search, $dir, $pre);
//construct and call cxt2pcap searches, return generated outfiles
$outputfiles = cxt2pcap($files2search, $file_sizes, $options, $direc);
//take generated outfiles and merge them into one pcap
$fileHandle = mergeFiles($outputfiles);
//return file handle of the merged pcap file
$meta_data = stream_get_meta_data($fileHandle);
$filename = $meta_data["uri"];
print $filename;
return $filename;