function conv_ringtone($infile, $outbase)
 {
     /*
     $outfile = $outbase .'.wav';
     */
     $outfile = $outbase . '.mp3';
     if (strToLower(subStr($infile, -4, 4)) === '.mp3') {
         if (fileSize($infile) <= 1000000) {
             # 1 MB
             if (!@copy($infile, $outfile)) {
                 return false;
             }
             return $outfile;
         }
     }
     /*
     if     (is_executable( '/usr/local/bin/mpg123' ))
     	$mpg123 = '/usr/local/bin/mpg123';
     elseif (is_executable( '/usr/bin/mpg123' ))
     	$mpg123 = '/usr/bin/mpg123';
     elseif (is_executable( '/bin/mpg123' ))
     	$mpg123 = '/bin/mpg123';
     else
     	$mpg123 = 'mpg123';
     
     if (strToLower(subStr($infile, -4, 4)) === '.mp3') {
     	# convert mp3 to wav first
     	$wavfile = $infile .'.wav';
     	$cmd = $mpg123 .' -m -w - -n 1000 -q '. qsa($infile) .' > '. qsa($wavfile) .' 2>>/dev/null';
     	# cuts file after 1000 frames (around 2.3 MB, depending on the rate)
     	# don't use -r 8000 as that doesn't really work for VBR encoded MP3s
     	@exec($cmd, $out, $err);
     	if ($err != 0) {
     		if (is_file($wavfile)) @unlink( $wavfile );
     		return false;
     	}
     	$infile = $wavfile;
     	$rm_tmp = $wavfile;
     } else
     	$rm_tmp = false;
     
     $cmd = 'sox '. qsa($infile) .' -r 8000 -c 1 -w '. qsa($outfile) .' trim 0 125000s 2>>/dev/null';
     # WAV, PCM, 8 kHz, 16 bit, mono
     # "The time for loading the file should not be longer then 3 seconds.
     # Size < 250 KByte."
     # cuts file after 125000 samples (around 245 kB, 15 secs)
     @exec($cmd, $out, $err);
     if ($err != 0) {
     	# $err == 2 would be unknown format
     	if (is_file($outfile)) @unlink( $outfile );
     	if ($rm_tmp && is_file($rm_tmp)) @unlink($rm_tmp);
     	return false;
     }
     return $outfile;
     */
     //return false;
     return null;
     # not implemented
 }
function drawScores()
{
    $scoresFile = fopen("highscores.txt", "r") or die("Unable to open file!");
    $lines = explode("\n", fread($scoresFile, fileSize("highscores.txt")));
    fclose($scoresFile);
    echo "<ol style='color:white;'>";
    foreach ($lines as $line) {
        echo "<li>";
        echo $line;
        echo "</li>";
    }
    echo "</ol>";
}
 private function uploadCreate($file_name)
 {
     $fileSize = fileSize($file_name);
     $url = 'http://' . $this->upload_server_ip . '/gupload/create_file';
     $param = array('upload_token' => $this->upload_token, 'file_size' => $fileSize, 'slice_length' => 1024, 'ext' => $this->getFileExt($file_name));
     try {
         $result = json_decode(Http::post($url, $param));
         if (isset($result->error)) {
             $error = $result->error;
             throw new UploadException($error->description, $error->code);
         }
     } catch (UploadException $e) {
         echo $e->getError();
         exit;
     }
     return $result;
 }
示例#4
0
function addScore($score, $name)
{
    $maxScores = 10;
    // Open the scores file for reading
    $scoresFile = fopen("highscores.txt", "r") or die("Unable to open file!");
    // Read in the scores
    $lines = explode("\n", fread($scoresFile, fileSize("highscores.txt")));
    // Close the file
    fclose($scoresFile);
    // Sort the scores
    $scores = array($name => intval($score));
    //array_push($scores, intval($score));
    foreach ($lines as $line) {
        $data = explode(" ", $line);
        $name = $data[0];
        $score = intval($data[1]);
        if (empty($scores[$name]) || $score > $scores[$name]) {
            $scores[$name] = $score;
        }
    }
    arsort($scores);
    // Remove excess scores
    while (count($scores) > $maxScores) {
        array_pop($scores);
    }
    // Open the scores file for reading
    $scoresFile = fopen("highscores.txt", "w") or die("Unable to open file!");
    // Write the scores
    $i;
    $len = count($scores);
    foreach ($scores as $name => $score) {
        fwrite($scoresFile, $name . " " . strval($score));
        if ($i < $len - 1) {
            fwrite($scoresFile, "\n");
        }
        $i += 1;
    }
    // Close the file
    fclose($scoresFile);
}
示例#5
0
 public function __construct($path, $name = null)
 {
     // Make sure error logs are ready.
     if ($this->logging === TRUE) {
         $this->prepareLogs();
     }
     // See what kind of file we should be working with
     // If path is simply a pointer to directory we will look to create a new file with name
     // Otherwise if it is pointing to file, let's open that file.
     if (is_dir($path) && $name) {
         // Create a file with that name in this path
         $this->file = fopen($path . $name, 'w');
         $this->path = $path . $name;
     } else {
         if (is_file($path) && is_writable($path)) {
             // Then let's go ahead and read it.
             $this->file = fopen($path, 'a+');
             $this->path = $path;
         }
     }
     // If by this point no file is set, error out.
     if (!$this->file) {
         return $this->processError($this->error[100]);
         die;
     }
     // Set some member variables.
     $this->isOpen = TRUE;
     $this->fileSize = fileSize($path) . ' bytes';
     $this->type = substr(strrchr($path, '.'), 1);
     $this->contentString = file_get_contents($path);
 }
示例#6
0
function getSize($a)
{
    if (file_exists($a)) {
        return fileSize($a);
    }
}
 /**
  * Download file
  *
  * @param int $id
  *
  * @return Response
  */
 public function downloadFile($id)
 {
     $file = FmFile::where('status', Constants::$COMMON_STATUSES['public'])->find($id);
     if (empty($file)) {
         App::abort('404');
     }
     $filePath = Utilities::getFileUploadPath() . $file->name;
     $content = file_get_contents($filePath);
     $contentLength = fileSize($filePath);
     $headers = array('Content-Length' => $contentLength, 'Content-disposition' => 'attachment; filename=' . $file->original_name);
     $finfo = new \finfo(FILEINFO_MIME_TYPE);
     $contentType = $finfo->buffer($content);
     if ($contentType == 'audio/mpeg') {
         $headers['Content-Type'] = 'application/octet-stream';
     }
     $response = Response::make($content);
     foreach ($headers as $headerName => $headerValue) {
         $response->header($headerName, $headerValue);
     }
     return $response;
 }
示例#8
0
<!DOCTYPE html>
<html>
<head>
    <title>Course list</title>
    <meta charset="utf-8" />
    <link href="courses.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div id="header">
    <h1>Courses at CSE</h1>
<!-- Ex. 1: File of Courses -->
    <p>
    <?php 
$courses = file("courses.tsv");
$fileSize = fileSize("courses.tsv");
?>
        Course list has <?php 
echo count($courses);
?>
 total courses
        and
        size of <?php 
echo $fileSize;
?>
 bytes.
    </p>
</div>
<div class="article">
    <div class="section">
        <h2>Today's Courses</h2>
<!-- Ex. 2: Today’s Courses & Ex 6: Query Parameters -->
示例#9
0
文件: commit.php 项目: TDLive/pre2013
<?php

echo "Hold on, opening files...\n";
$fh = fopen("version.txt", "r");
$version = fread($fh, fileSize("version.txt"));
fclose($fh);
echo "Calculating stuffs...";
$version = $version++;
echo "You are committing version r{$version}.";
$fh = fopen("version.txt", "w");
fwrite($fh, $version);
fclose($fh);
// loop through each element in the $argv array
$i = 0;
foreach ($argv as $value) {
    if (!$i == 0) {
        $commitdata = $commitdata . $value;
    }
    $i++;
}
system("git commit -a -m 'r{$version} - {$commitdata}'");
echo "Done! Run git push to see it on GitHub.";
示例#10
0
        return;
    }
    sleep(4);
    clearStatCache();
}
# download in progress?
#
if (file_exists('/tmp/gpbx-downloading-upgrade.pid') || (int) @shell_exec('sudo ps ax 2>>/dev/null | grep gpbx-upgrade-download | grep -v grep | wc -l') > 0) {
    echo '<br /><p>', 'Momentan wird ein Upgrade heruntergeladen.', '</p>', "\n";
    $upgrade_info = @gs_file_get_contents($gpbx_userdata . 'upgrades/upgrade-info');
    //$upgrade_info = ' gpbx_upgrade_size = 250420000 ';
    if (preg_match('/^\\s*gpbx_upgrade_size\\s*=\\s*([^\\s]*)/m', $upgrade_info, $m)) {
        $upgrade_size = (int) _upgrade_info_decode_val($m[1]);
        if ($upgrade_size > 50) {
            if (file_exists($gpbx_userdata . 'upgrades/dl/download')) {
                $download_size = @fileSize($gpbx_userdata . 'upgrades/dl/download');
                //$download_size = 210420000;
                if ($download_size !== false) {
                    echo '<p>', 'Fortschritt', ': &nbsp; <b>', number_format($download_size / $upgrade_size * 100, 1, ',', ''), ' %</b>';
                    if ($upgrade_size > 1000000) {
                        $factor = 1000000;
                        $units = 'MB';
                    } elseif ($upgrade_size > 1000) {
                        $factor = 1000;
                        $units = 'kB';
                    } else {
                        $factor = 1;
                        $units = 'B';
                    }
                    echo ' &nbsp; (', round($download_size / $factor), ' / ', round($upgrade_size / $factor), ' ', $units, ')</p>', "\n";
                    echo '<pre>';
<html>
    <head>
        <title>Candace's Phonebook</title>
        <link href="css/bootstrap.min.css"
              rel="stylesheet"
              type="text/css" />
        <link href="css/indexStylesheet.css"
              rel="stylesheet"
              type="text/css" />
    </head>
    <body>
        <div id="contactList" class="container">
            <?php 
//This will generate the list of phonebook entries on this page
$phonesFile = fopen("phones.dat", "r") or die("Unable to open file");
if (fileSize("phones.dat") > 0) {
    $allEntries = fread($phonesFile, filesize("phones.dat"));
    $entries = explode("\r\n", $allEntries);
    foreach ($entries as $entry) {
        if ($entry != $entries[count($entries) - 1]) {
            echo '<a href="' . "update.php?entry={$entry}" . '">' . $entry . '</a> (<a href="' . "delete.php?entry={$entry}" . '">x</a>)<br />';
        }
    }
} else {
    $allEntries = "No entries";
    echo $allEntries . "\r\n";
}
?>

            <br /><button id="addButton">Add a Phone Number</button>
        </div>
示例#12
0
 public function Test_of_binary_data_on_database()
 {
     $ar_path = AK_FRAMEWORK_DIR . DS . 'active_record' . DS . 'base.php';
     $long_string = file_get_contents($ar_path);
     $_tmp_file = fopen($ar_path, "rb");
     $binary_data = fread($_tmp_file, fileSize($ar_path));
     $i = 1;
     $details = array('varchar_field' => "{$i} string ", 'longtext_field' => $long_string, 'text_field' => "{$i} text", 'logblob_field' => $binary_data, 'date_field' => "2005/05/{$i}", 'datetime_field' => "2005/05/{$i}", 'tinyint_field' => $i, 'integer_field' => $i, 'smallint_field' => $i, 'bigint_field' => $i, 'double_field' => "{$i}.{$i}", 'numeric_field' => $i, 'bytea_field' => $binary_data, 'timestamp_field' => "2005/05/{$i} {$i}:{$i}:{$i}", 'boolean_field' => !($i % 2), 'int2_field' => "{$i}", 'int4_field' => $i, 'int8_field' => $i, 'foat_field' => "{$i}.{$i}", 'varchar4000_field' => "{$i} text", 'clob_field' => "{$i} text", 'nvarchar2000_field' => "{$i} text", 'blob_field' => $binary_data, 'nvarchar_field' => "{$i}", 'decimal1_field' => "{$i}", 'decimal3_field' => $i, 'decimal5_field' => $i, 'decimal10_field' => "{$i}", 'decimal20_field' => $i, 'decimal_field' => $i);
     $AkTestField = new AkTestField($details);
     $this->assertEqual($long_string, $binary_data);
     $this->assertTrue($AkTestField->save());
     $AkTestField = new AkTestField($AkTestField->getId());
     $this->assertEqual($AkTestField->longtext_field, $long_string);
     $this->assertEqual($AkTestField->bytea_field, $binary_data);
     $this->assertEqual($AkTestField->blob_field, $binary_data);
     $this->assertEqual($AkTestField->logblob_field, $binary_data);
 }
示例#13
0
   	private function isVaild($file ,$validate)
	{
		
		if($validate === []) return true ; 
		if(array_key_exists("isVaildSize" , $validate))
		{
			$size = strtolower($validate["isVaildSize"]);
			$sizes = [
				"b"=> 1,
				"kb" => 1024 ,
				"mb" => 1024*1024 ,
				"gb" => 1024*1024*1024,
				"tb" => 1024*1024*1024*1024,
			];
			
			if(preg_match("/kb|mb|gb|tb|byte/" , $validate["isVaildSize"] , $output))
			{
				if(preg_match("/[\>\<\:\=]{1,2}/" ,$validate["isVaildSize"] , $x))
				{
					$validate["isVaildSize"] = str_replace($x[0] , "" , $validate["isVaildSize"]) ;
				}
				$size = (int) str_replace($output[0] , "" ,$validate["isVaildSize"]) ;
				$size*=$sizes[$output[0]] ;
				if(!$this->isVaildRange(fileSize($file) , $x[0].$size))
				{
					$this->latestValidateError = "inVaildSize" ;
					return false ; 
				}
			}
		} 
		
		if(in_array("isVaildImage" , $validate) || array_key_exists("isVaildDim" , $validate))
		{
			if($d = getimagesize($file))
			{
				if(array_key_exists("isVaildDim" , $validate))
				{
					$dims = explode("x" , strtolower($validate["isVaildDim"]));
					if(isset($dims[0]))
					{
						if(!$this->isVaildRange($d[0] , $dims[0]))
						{
							$this->latestValidateError = "notVaildWidth" ;
							return false ; 
						}
					}
					if(isset($dims[1]))
					{
						if(!$this->isVaildRange($d[1] , $dims[1]))
						{
							$this->latestValidateError = "notVaildHeight" ;
							return false ; 
						}
					}
					
				}
			}
			else
			{
				
				$this->latestValidateError = "notVaildImage" ;
				return false ;
				
			}
			
		}
		return true ; 
	}
示例#14
0
function imagecreatefromblp($fileName, $imgId = 0)
{
    if (!CLISetup::fileExists($fileName)) {
        CLISetup::log('file ' . $fileName . ' could not be found', CLISetup::LOG_ERROR);
        return;
    }
    $file = fopen($fileName, 'rb');
    if (!$file) {
        CLISetup::log('could not open file ' . $fileName, CLISetup::LOG_ERROR);
        return;
    }
    $fileSize = fileSize($fileName);
    if ($fileSize < 16) {
        CLISetup::log('file ' . $fileName . ' is too small for a BLP file', CLISetup::LOG_ERROR);
        return;
    }
    $data = fread($file, $fileSize);
    fclose($file);
    // predict replacement patch files
    // ref: http://www.zezula.net/en/mpq/patchfiles.html
    if (substr($data, 0x0, 0x4) == "PTCH") {
        // strip patch header
        if (substr($data, 0x40, 0x43) == "COPY") {
            $data = substr($data, 0x44);
        } else {
            CLISetup::log('file ' . $fileName . ' is an incremental patch file and cannot be used by this script.', CLISetup::LOG_ERROR);
            return;
        }
    }
    if (substr($data, 0, 4) != "BLP2") {
        CLISetup::log('file ' . $fileName . ' has incorrect/unsupported magic bytes', CLISetup::LOG_ERROR);
        return;
    }
    $header = unpack("Vformat/Ctype/CalphaBits/CalphaType/Cmips/Vwidth/Vheight", substr($data, 4, 16));
    $header['mipsOffs'] = unpack("V16", substr($data, 20, 64));
    $header['mipsSize'] = unpack("V16", substr($data, 84, 64));
    $debugStr = ' header = ' . print_r($header, true);
    if ($header['format'] != 1) {
        CLISetup::log('file ' . $fileName . ' has unsupported format' . $debugStr, CLISetup::LOG_ERROR);
        return;
    }
    $offs = $header['mipsOffs'][$imgId + 1];
    $size = $header['mipsSize'][$imgId + 1];
    while ($imgId > 0) {
        $header['width'] /= 2;
        $header['height'] /= 2;
        $imgId--;
    }
    if ($size == 0) {
        CLISetup::log('file ' . $fileName . ' contains zeroes in a mips table' . $debugStr, CLISetup::LOG_ERROR);
        return;
    }
    if ($offs + $size > $fileSize) {
        CLISetup::log('file ' . $fileName . ' is corrupted/incomplete' . $debugStr, CLISetup::LOG_ERROR);
        return;
    }
    if ($header['type'] == 1) {
        $img = icfb1($header['width'], $header['height'], substr($data, 148, 1024), substr($data, $offs, $size));
    } else {
        if ($header['type'] == 2) {
            $img = icfb2($header['width'], $header['height'], substr($data, $offs, $size), $header['alphaBits'], $header['alphaType']);
        } else {
            if ($header['type'] == 3) {
                $img = icfb3($header['width'], $header['height'], substr($data, $offs, $size));
            } else {
                CLISetup::log('file ' . $fileName . ' has unsupported type' . $debugStr, CLISetup::LOG_ERROR);
                return;
            }
        }
    }
    return $img;
}
示例#15
0
function tAdventure($start = 0, $pts = 0, $items = array(), $said = false, $name)
{
    if ($start == 0) {
        $rdat["locname"] = "Grand Hallway";
        $rdat["locdesc"] = "The grandest hallway of the entire mansion.";
        $rdat["isItems"] = false;
        $rdat["connectsLeft"] = true;
        $rdat["connectsLeftId"] = 1;
        $rdat["connectsRight"] = true;
        $rdat["connectsRightId"] = 5;
        $rdat["connectsStraight"] = false;
        $rdat["connectsBack"] = false;
    } elseif ($start == 1) {
        $rdat["locname"] = "Bedroom Hallway";
        $rdat["locdesc"] = "The hall with all of the bedrooms.";
        $rdat["isItems"] = true;
        $rdat["items"] = 1;
        $rdat["connectsLeft"] = true;
        $rdat["connectsLeftId"] = 2;
        $rdat["connectsRight"] = false;
        $rdat["connectsStraight"] = true;
        $rdat["connectsStraightId"] = 3;
        $rdat["connectsBack"] = true;
        $rdat["connectsBackId"] = 0;
    } elseif ($start == 2) {
        $rdat["locname"] = "TDLive's Room";
        $rdat["locdesc"] = "TDLive's bedroom.";
        $rdat["isItems"] = true;
        $rdat["items"] = 2;
        $rdat["connectsLeft"] = false;
        $rdat["connectsRight"] = false;
        $rdat["connectsStraight"] = false;
        $rdat["connectsBack"] = true;
        $rdat["connectsBackId"] = 1;
    } elseif ($start == 3) {
        $rdat["locname"] = "{$name}'s Room";
        $rdat["locdesc"] = "Your room!";
        $rdat["isItems"] = false;
        $rdat["connectsLeft"] = true;
        $rdat["connectsLeftId"] = 4;
        $rdat["connectsRight"] = false;
        $rdat["connectsStraight"] = false;
        $rdat["connectsBack"] = true;
        $rdat["connectsBackId"] = 1;
    } elseif ($start == 4) {
        $rdat["locname"] = "{$name}'s Bathroom";
        $rdat["locdesc"] = "Your bathroom!";
        $rdat["isItems"] = true;
        $rdat["items"] = 3;
        $rdat["connectsLeft"] = true;
        $rdat["connectsLeftId"] = 2;
        $rdat["connectsRight"] = false;
        $rdat["connectsStraight"] = false;
        $rdat["connectsBack"] = true;
        $rdat["connectsBackId"] = 3;
    } elseif ($start == 5) {
        $rdat["locname"] = "The Main Hallway";
        $rdat["locdesc"] = "Turn 'left' to start the real game.";
        $rdat["isItems"] = false;
        $rdat["items"] = null;
        $rdat["connectsLeft"] = true;
        $rdat["connectsLeftId"] = 6;
        $rdat["connectsRight"] = false;
        $rdat["connectsStraight"] = false;
        $rdat["connectsBack"] = true;
        $rdat["connectsBackId"] = 0;
    } elseif ($start == 6) {
        if (!$said) {
            echo "\n\nAs you close the door, you realize that \nyou are at the point of no return.\n\n";
        }
        $rdat["locname"] = "The Dungeon";
        $rdat["locdesc"] = "A very dark and dank room. You swear\nthat you can hear breathing in the distance.";
        $rdat["isItems"] = true;
        $rdat["items"] = 4;
        $rdat["connectsLeft"] = false;
        $rdat["connectsRight"] = false;
        $rdat["connectsStraight"] = true;
        $rdat["connectsStraightId"] = 7;
        $rdat["connectsBack"] = false;
    } elseif ($start == 7) {
        $rdat["locname"] = "Cell 1";
        $rdat["locdesc"] = "The first cell in the dungeon. You hear\nmany barks.";
        $rdat["isItems"] = true;
        $rdat["items"] = 5;
        $rdat["connectsLeft"] = false;
        $rdat["connectsRight"] = false;
        $rdat["connectsStraight"] = true;
        $rdat["connectsStraightId"] = 8;
        $rdat["connectsBack"] = true;
        $rdat["connectsBackId"] = 6;
    } elseif ($start == 8) {
        $rdat["locname"] = "Cell 2";
        $rdat["locdesc"] = "The second cell in the dungeon. You hear\nmany barks.";
        $rdat["isItems"] = false;
        $rdat["connectsLeft"] = false;
        $rdat["connectsRight"] = false;
        $rdat["connectsStraight"] = false;
        $rdat["connectsBack"] = true;
        $rdat["connectsBackId"] = 7;
    } else {
        die("Error in your save file; the location in it\nwas not found. If you are using a greater version\nof tAdventure than before (or, ahem, cheaters), you\nmay need to delete your save file (sorry) and start\nagain.");
    }
    $darkrooms = array(8);
    if (!$said) {
        echo $rdat["locname"] . "\n\n";
        echo $rdat["locdesc"] . "\n\n";
        if (!$rdat["isItems"]) {
            echo "There are no items in this room.\n";
        } else {
            if ($rdat['isItems']) {
                $itemdata = items($rdat["items"]);
                $taken = false;
                foreach ($itemus as $value) {
                    if ($value == $rdat["items"]) {
                        $taken = true;
                    }
                }
                if (!$taken) {
                    $name2 = $itemdata["name"];
                    $desc = $itemdata["desc"];
                    echo "There is a {$name2} in here!\n{$desc}\n";
                } else {
                    echo "There are no items in this room.";
                }
            }
        }
    }
    $cmd = cmd();
    if (!@isset($cmd) || $cmd == "") {
        tadventure($start, $pts, $items, true, $name);
    } elseif ($cmd == 'quit') {
        if (file_exists(".shocked.tmp")) {
            unlink(".shocked.tmp");
        }
        if (file_exists(".torch.tmp")) {
            unlink(".torch.tmp");
        }
        echo "Thanks for playing!\n";
        exit;
    } elseif ($cmd == 'save') {
        echo "Saving...\n";
        $fh = fopen("tadventure_save.txt", 'w') or tAdventure($start, $pts, $items, true, $name);
        fwrite($fh, "{$start}/{$pts}");
        foreach ($items as $value) {
            fwrite($fh, "/{$value}");
        }
        echo "Game saved!\n";
        tAdventure($start, $pts, $items, true, $name);
    } elseif ($cmd == "update") {
        system("wget --version > /dev/null", $wgetv);
        if (!$wgetv == 0) {
            echo "Error! wget is not installed!\n";
            tAdventure($start, $pts, $items, true);
        }
        echo "Checking the version...\n";
        system("wget -q https://raw.github.com/TDLive/tAdventure/master/version.txt -O version.txt");
        $fh = fopen("version.txt", "r");
        $version = fread($fh, fileSize("version.txt"));
        fclose($fh);
        if ($version == VERSION || $version < VERSION) {
            echo "Your version is too new/the latest!\n";
            tAdventure($start, $pts, $items, true, $name);
        } else {
            echo "Getting tAdventure...\n";
            system("wget -q https://raw.github.com/TDLive/tAdventure/master/adventure.php -O adventure.php");
            echo "Starting tAdventure...\n\n";
            system("php adventure.php", $exitcode);
            exit($exitcode);
        }
    } elseif ($cmd == "room") {
        echo "\n";
        tAdventure($start, $pts, $items);
    } elseif ($cmd == "left") {
        if ($rdat["connectsLeft"]) {
            foreach ($darkrooms as $value) {
                if ($rdat["connectsLeftId"] == $value) {
                    if (!file_exists(".torch.tmp")) {
                        echo "It's too dark to go down this way!\n";
                        tAdventure($start, $pts, $items, true, $name);
                    }
                }
            }
            tAdventure($rdat["connectsLeftId"], $pts, $items, false, $name);
        } else {
            echo "You can't go left.\n";
            tAdventure($start, $pts, $items, true, $name);
        }
    } elseif ($cmd == "right") {
        if ($rdat["connectsRight"]) {
            foreach ($darkrooms as $value) {
                if ($rdat["connectsRightId"] == $value) {
                    if (!file_exists(".torch.tmp")) {
                        echo "It's too dark to go down this way!\n";
                        tAdventure($start, $pts, $items, true, $name);
                    }
                }
            }
            tAdventure($rdat["connectsRightId"], $pts, $items, false, $name);
        } else {
            echo "You can't go right.\n";
            tAdventure($start, $pts, $items, true, $name);
        }
    } elseif ($cmd == "back") {
        if ($rdat["connectsBack"]) {
            foreach ($darkrooms as $value) {
                if ($rdat["connectsBackId"] == $value) {
                    if (!file_exists(".torch.tmp")) {
                        echo "It's too dark to go down this way!\n";
                        tAdventure($start, $pts, $items, true, $name);
                    }
                }
            }
            tAdventure($rdat["connectsBackId"], $pts, $items, false, $name);
        } else {
            echo "You can't go back.\n";
            tAdventure($start, $pts, $items, true, $name);
        }
    } elseif ($cmd == "straight") {
        if ($rdat["connectsStraight"]) {
            foreach ($darkrooms as $value) {
                if ($rdat["connectsStraightId"] == $value) {
                    if (!file_exists(".torch.tmp")) {
                        echo "It's too dark to go down this way!\n";
                        tAdventure($start, $pts, $items, true, $name);
                    }
                }
            }
            tAdventure($rdat["connectsStraightId"], $pts, $items, false, $name);
        } else {
            echo "You can't go straight.\n";
            tAdventure($start, $pts, $items, true, $name);
        }
    } elseif ($cmd == "pickup") {
        if (!$rdat['isItems']) {
            echo "There isn't anything I can pick up here.\n";
            tAdventure($start, $pts, $items, true, $name);
        } else {
            if ($rdat["items"] == 2) {
                if (!file_exists(".shocked.tmp")) {
                    echo "The moment you pick the computer up,\nit shocks you, and TDLive runs in to put it\nback on his desk.\n";
                    $fh = fopen(".shocked.tmp", 'w');
                    fclose($fh);
                } else {
                    echo "TDLive: SO YOU DIDN'T LEARN, HUH?!?\n";
                    echo "You: AAAAHHHHHHHHHHHHHHH\n";
                    echo "YOU ARE DEAD!\n";
                    unlink(".shocked.tmp");
                    sleep(5);
                    tAdventure(null, null, null, null, $name);
                }
                tAdventure($start, $pts, $items, true, $name);
            }
            foreach ($items as $value) {
                if ($value == $rdat["items"]) {
                    echo "You can't have two {$value}.\n";
                    tAdventure($start, $pts, $items, true, $name);
                }
            }
            $itemdata = items($rdat["items"]);
            $name1 = $itemdata["name"];
            $desc = $itemdata["desc"];
            echo "You picked up a {$name1}!\n";
            $items[] = $rdat["items"];
            tAdventure($start, $pts, $items, true, $name);
        }
    } elseif ($cmd == "version") {
        echo "This is TDLive tAdventure.\n";
        tAdventure($start, $pts, $items, true, $name);
    } elseif ($cmd == "inventory") {
        foreach ($items as $value) {
            $itemdat = items($value);
            $name2 = $itemdat["name"];
            $desc = $itemdat["desc"];
            echo "{$name2} - {$desc}\n";
        }
        tAdventure($start, $pts, $items, true, $name);
    } elseif ($cmd == "brush") {
        foreach ($items as $value) {
            if ($value == 3) {
                $can = true;
            }
        }
        if ($can && $start == 4) {
            echo "You brush your teeth. Your teeth feel minty.\n";
            tAdventure($start, $pts, $items, true, $name);
        } else {
            echo "You must posess the toothbrush and toothpaste\nand be in a bathroom to do this.\n";
            tAdventure($start, $pts, $items, true, $name);
        }
    } elseif ($cmd == "torch") {
        foreach ($items as $value) {
            if ($value == 4) {
                $can1 = true;
            } elseif ($value == 5) {
                $can2 = true;
            }
        }
        if (@$can1 && @$can2 && !file_exists(".torch.tmp")) {
            echo "You light up the torch and savor its\nlight.\n";
            $fh = fopen(".torch.tmp", "w");
            fclose($fh);
            tAdventure($start, $pts, $items, true, $name);
        } elseif (!@$can1 || !@$can2) {
            echo "You need the Torch and Matches to do this.\n";
            tAdventure($start, $pts, $items, true, $name);
        } elseif (file_exists('.torch.tmp')) {
            echo "Your torch is already lit.\n";
            tAdventure($start, $pts, $items, true, $name);
        }
    } elseif ($cmd == "laugh") {
        if (!$start == 2) {
            echo "There isn't anything to laugh at.\n";
        } else {
            echo "Haha. Octocats.\n";
        }
        tAdventure($start, $pts, $items, true, $name);
    } else {
        echo "I don't know what '{$cmd}' is!\n";
        tAdventure($start, $pts, $items, true, $name);
    }
}
示例#16
0
文件: faxdown.php 项目: rkania/GS3
$raw_file = realPath('/tmp/' . $file);
if (empty($raw_file) || subStr($raw_file, 0, 5) !== '/tmp/') {
    header('HTTP/1.0 500 Internal Server Error', true, 500);
    header('Status: 500 Internal Server Error', true, 500);
    header('Content-Type: text/plain');
    die('Error. Bad filename.');
}
if ($raw) {
    # TIFF
    header('Content-Type: image/tiff');
    header('Content-Disposition: attachment; filename="' . $file . '"');
    header('Content-Length: ' . (int) @fileSize('/tmp/' . $file));
    @readFile('/tmp/' . $file);
    @unlink('/tmp/' . $file);
} else {
    #PDF
    $pdf_file = basename($file, '.tif') . '.pdf';
    @system('cd /var/spool/hylafax/ && /var/spool/hylafax/bin/tiff2pdf -o ' . qsa('/tmp/' . $pdf_file) . ' ' . qsa('/tmp/' . $file));
    unlink('/tmp/' . $file);
    if (!file_exists('/tmp/' . $pdf_file)) {
        header('HTTP/1.0 500 Internal Server Error', true, 500);
        header('Status: 500 Internal Server Error', true, 500);
        header('Content-Type: text/plain');
        die('Error. Failed to convert fax to PDF.');
    }
    header('Content-Type: application/pdf');
    header('Content-Disposition: attachment; filename="' . $pdf_file . '"');
    header('Content-Length: ' . (int) @fileSize('/tmp/' . $pdf_file));
    @readFile('/tmp/' . $pdf_file);
    @unlink('/tmp/' . $pdf_file);
}
示例#17
0
    return;
}
if (file_exists('/var/lib/dhcp3/dhcpd.leases')) {
    # Debian 4
    $leases_file = '/var/lib/dhcp3/dhcpd.leases';
} elseif (file_exists('/var/lib/dhcp/dhcpd.leases')) {
    # Debian 5?
    $leases_file = '/var/lib/dhcp/dhcpd.leases';
} elseif (file_exists('/var/lib/dhcpd/dhcpd.leases')) {
    # RedHat
    $leases_file = '/var/lib/dhcpd/dhcpd.leases';
} else {
    echo 'dhcpd.leases not found.';
    return;
}
if (@fileSize($leases_file) > 1000000) {
    # around 4000 leases
    echo 'Leases file too large to read.';
    return;
}
function un_octal_escape($str)
{
    return preg_replace_callback('/\\\\([0-7]{1,3})/S', create_function('$m', 'return chr(octDec($m[1]));'), $str);
}
function binary_to_hex($str)
{
    $ret = '';
    $c = strLen($str);
    for ($i = 0; $i < $c; ++$i) {
        if ($i !== 0) {
            $ret .= '-';
示例#18
0
 function Test_of_binary_data_on_database()
 {
     $long_string = file_get_contents(AK_LIB_DIR . DS . 'AkActiveRecord.php');
     $_tmp_file = fopen(AK_LIB_DIR . DS . 'AkActiveRecord.php', "rb");
     $binary_data = fread($_tmp_file, fileSize(AK_LIB_DIR . DS . 'AkActiveRecord.php'));
     $i = 1;
     $details = array('varchar_field' => "{$i} string ", 'longtext_field' => $long_string, 'text_field' => "{$i} text", 'logblob_field' => $binary_data, 'date_field' => "2005/05/{$i}", 'datetime_field' => "2005/05/{$i}", 'tinyint_field' => $i, 'integer_field' => $i, 'smallint_field' => $i, 'bigint_field' => $i, 'double_field' => "{$i}.{$i}", 'numeric_field' => $i, 'bytea_field' => $binary_data, 'timestamp_field' => "2005/05/{$i} {$i}:{$i}:{$i}", 'boolean_field' => !($i % 2), 'int2_field' => "{$i}", 'int4_field' => $i, 'int8_field' => $i, 'foat_field' => "{$i}.{$i}", 'varchar4000_field' => "{$i} text", 'clob_field' => "{$i} text", 'nvarchar2000_field' => "{$i} text", 'blob_field' => $binary_data, 'nvarchar_field' => "{$i}", 'decimal1_field' => "{$i}", 'decimal3_field' => $i, 'decimal5_field' => $i, 'decimal10_field' => "{$i}", 'decimal20_field' => $i, 'decimal_field' => $i);
     $AkTestField = new AkTestField($details);
     $this->assertEqual($long_string, $binary_data);
     $this->assertTrue($AkTestField->save());
     $AkTestField = new AkTestField($AkTestField->getId());
     $this->assertEqual($AkTestField->longtext_field, $long_string);
     $this->assertEqual($AkTestField->bytea_field, $binary_data);
     $this->assertEqual($AkTestField->blob_field, $binary_data);
     $this->assertEqual($AkTestField->logblob_field, $binary_data);
     //Now we add some more records for next tests
     foreach (range(2, 10) as $i) {
         $details = array('varchar_field' => "{$i} string", 'text_field' => "{$i} text", 'date_field' => "2005/05/{$i}", 'datetime_field' => "2005/05/{$i}", 'tinyint_field' => $i, 'integer_field' => $i, 'smallint_field' => $i, 'bigint_field' => $i, 'double_field' => "{$i}.{$i}", 'numeric_field' => $i, 'timestamp_field' => "2005/05/{$i} {$i}:{$i}:{$i}", 'boolean_field' => !($i % 2), 'int2_field' => "{$i}", 'int4_field' => $i, 'int8_field' => $i, 'foat_field' => "{$i}.{$i}", 'varchar4000_field' => "{$i} text", 'clob_field' => "{$i} text", 'nvarchar2000_field' => "{$i} text", 'nvarchar_field' => "{$i}", 'decimal3_field' => $i, 'decimal5_field' => $i, 'decimal10_field' => "{$i}", 'decimal20_field' => $i, 'decimal_field' => $i);
         $AkTestField = new AkTestField($details);
         $this->assertTrue($AkTestField->save());
     }
 }
示例#19
0
文件: gif.php 项目: hugcoday/wiki
 function getSize($lpszFileName, &$width, &$height)
 {
     if (!($fh = @fOpen($lpszFileName, "rb"))) {
         return false;
     }
     $data = @fRead($fh, @fileSize($lpszFileName));
     @fClose($fh);
 }
示例#20
0
function readDataFile($data_file)
{
    global $node;
    $datafilep = @fOpen($data_file, 'rb');
    if (!$datafilep) {
        write_log("Cannot open {$data_file} for reading! Using cluster data from configuration. This will reset *all* states!");
        return 1;
    }
    $datafilesize = fileSize($data_file);
    $save_struct = @fRead($datafilep, $datafilesize);
    $node = unSerialize($save_struct);
    fClose($datafilep);
}
    static function CompleteStructure()
    {
        define("PAGE_ID", isset($_GET['PageID']) ? $_GET['PageID'] : "");
        switch (PAGE_ID) {
            case 'FileEditor':
                define("DIRECTORY", !is_file($_GET['directory']) ? Others::redirect("?") : realpath(urldecode($_GET['directory'])));
                define("EDIRECTORY", urlencode(DIRECTORY));
                define("ODIRECTORY", dirname(DIRECTORY));
                unset($dirName);
                define("FILEINODE", fileinode(DIRECTORY));
                define("FILENAME", basename(DIRECTORY));
                define("FILEBYTE", filesize(DIRECTORY));
                define("FILECTIME", filectime(DIRECTORY));
                define("FILEATIME", fileatime(DIRECTORY));
                define("FILEOWNER", fileowner(DIRECTORY));
                define("FILETYPE", strtolower(substr(strrchr(FILENAME, "."), 1)));
                if (FILEBYTE / 1024 > 1024) {
                    die('Dosya çok büyük <button onClick="javascript:window.close();">Kapat</button>');
                }
                if (isset($_POST['fileContents']) && is_string($_POST['fileContents'])) {
                    file_put_contents(DIRECTORY, urldecode($_POST['fileContents']));
                    Others::redirect(URLm::url("fileEditor", array("file" => DIRECTORY)));
                }
                Page::write("editor", array("Title" => "Dosya.Düzenle \"" . FILENAME . "\"", "CSSFile" => Settings::get("CSSFilePath"), "File" => DIRECTORY));
                break;
            default:
                if (isset($_GET['directory']) && !is_dir($_GET['directory'])) {
                    Others::redirect("?");
                }
                if (isset($_GET['directory']) && is_dir($_GET['directory'])) {
                    $directoryPath = (string) $_GET['directory'];
                } elseif (isset($_SERVER['DOCUMENT_ROOT']) && is_dir($_SERVER['DOCUMENT_ROOT'])) {
                    $directoryPath = $_SERVER['DOCUMENT_ROOT'];
                } else {
                    $directory = ".";
                }
                define("DIRECTORY", realpath($directoryPath));
                define("EDIRECTORY", urlencode(DIRECTORY));
                if (isset($_REQUEST['procName']) && isset($_REQUEST['filesArray'])) {
                    $filesExp = explode("{}", $_REQUEST['filesArray']);
                    $var = (string) $_REQUEST['variable'];
                    switch ($_REQUEST['procName']) {
                        case 'Move':
                            foreach ($filesExp as $dd) {
                                if (is_dir(DIRECTORY . "/" . $dd) || is_file(DIRECTORY . "/" . $dd)) {
                                    rename(DIRECTORY . "/" . $dd, $var . "/" . $dd);
                                }
                            }
                            break;
                        case 'Copy':
                            foreach ($filesExp as $dd) {
                                if (is_dir(DIRECTORY . "/" . $dd)) {
                                    File::copyDirectory(DIRECTORY . "/" . $dd, $var . "/" . $dd);
                                } elseif (is_file(DIRECTORY . "/" . $dd)) {
                                    copy(DIRECTORY . "/" . $dd, $var . "/" . $dd);
                                }
                            }
                            break;
                        case 'CHMOD':
                            foreach ($filesExp as $dd) {
                                if ($var >= 0 && $var <= 777) {
                                    chmod(DIRECTORY . "/" . $dd, $var);
                                }
                            }
                            break;
                        case 'Delete':
                            foreach ($filesExp as $dd) {
                                if (is_dir(DIRECTORY . "/" . $dd)) {
                                    File::deleteDirectory(DIRECTORY . "/" . $dd);
                                } elseif (is_file(DIRECTORY . "/" . $dd)) {
                                    unlink(DIRECTORY . "/" . $dd);
                                }
                            }
                    }
                    Others::redirect(URLm::url("folderView", array("dir" => DIRECTORY)));
                }
                if (isset($_GET['proc'])) {
                    switch ($_GET['proc']) {
                        case 'move':
                            if ($_GET['var'] != "") {
                                rename(DIRECTORY, $_GET['var']);
                                Others::redirect(URLm::url("folderView", array("dir" => $_GET['var'])));
                            }
                            break;
                        case 'copy':
                            if ($_GET['var'] != "") {
                                File::copyDirectory(DIRECTORY, $_GET['var']);
                                Others::redirect(URLm::url("folderView", array("dir" => $_GET['var'])));
                            }
                            break;
                        case 'create':
                            if ($_GET['var'] != "") {
                                $exp = explode(":", $_GET['var']);
                                switch ($exp['0']) {
                                    case 'f':
                                        File::makeFile(DIRECTORY . "/" . $exp[1]);
                                        break;
                                    case 'd':
                                        if ($exp[1] != 0 && $exp[1] != null) {
                                            File::makeDir(DIRECTORY . "/" . $exp[1], intval($exp[2]));
                                        } else {
                                            File::forceDirectory(DIRECTORY . "/" . $exp[1]);
                                        }
                                }
                                Others::redirect(URLm::url("folderView", array("dir" => DIRECTORY)));
                            }
                            break;
                        case 'jump':
                            if ((string) $_GET['var'] != "") {
                                $var = $_GET['var'];
                                if (is_file($var)) {
                                    Others::redirect(URLm::url("fileView", array("filePath" => realpath($var))));
                                } elseif (is_dir($var)) {
                                    Others::redirect(URLm::url("folderView", array("dir" => realpath($var))));
                                }
                            }
                            break;
                        case 'delete':
                            if (DIRECTORY != realpath($_SERVER['DOCUMENT_ROOT'])) {
                                File::deleteDirectory(DIRECTORY);
                            }
                            $dirName = explode("/", DIRECTORY);
                            array_pop($dirName);
                            $dirName = implode("/", $dirName);
                            Others::redirect(URLm::url("folderView", array("dir" => $dirName)));
                            break;
                        case 'addFav':
                            if ((string) $_GET['var'] != "") {
                                DBLite::addFavorite($_GET['var'], DIRECTORY);
                            }
                            Others::redirect(URLm::url("folderView", array("dir" => DIRECTORY)));
                            break;
                        case 'deleteFav':
                            DBLite::deleteFavorite(DIRECTORY);
                            Others::redirect(URLm::url("folderView", array("dir" => DIRECTORY)));
                            break;
                        case 'compress':
                            if ((string) $_GET['var'] != "") {
                                $zip = new ZipArchive();
                                if (!$zip->open($_GET['var'], ZipArchive::OVERWRITE)) {
                                    Others::redirect(URLm::url("folderView", array("dir" => DIRECTORY)));
                                    exit;
                                }
                                foreach (File::getFileList(DIRECTORY, array("method" => "explode")) as $File) {
                                    $FullPath = str_replace(dirname(DIRECTORY) . "/", "", $File);
                                    $zip->addFile($File, $FullPath);
                                }
                                $zip->addFromString("CreatedBy", "This zip file created by OOP File Manager\n\n\t- vtWebApp ®\n\t- veli.tasali@gmail.com");
                                $zip->close();
                                Others::redirect(URLm::url("fileView", array("filePath" => $_GET['var'])));
                            }
                            break;
                        case 'iFile':
                            $var = (string) $_REQUEST['var'];
                            if ($var != "") {
                                set_time_limit(5000);
                                $url = parse_url($var);
                                $fName = $url['path'] == "" ? $url['host'] . "_file_" . time() : $url['path'];
                                $fName = preg_replace("/([^a-zA-Z0-9._-])/si", "", $fName);
                                touch(DIRECTORY . "/" . $fName);
                                // $write = fopen(DIRECTORY."/".$fName);
                                $dt = fopen(urldecode($var), "rb");
                                if (is_file(DIRECTORY . "/" . $fName)) {
                                    fseek($dt, filesize(DIRECTORY . "/" . $fName));
                                }
                                if ($dt) {
                                    while (!feof($dt)) {
                                        file_put_contents(DIRECTORY . "/" . $fName, fread($dt, 8192), FILE_APPEND);
                                    }
                                    fclose($dt);
                                }
                                // $source = Others::quickCurl(urldecode($var));
                                Others::redirect(URLm::url("fileView", array("filePath" => DIRECTORY . "/" . $fName)));
                            }
                            unset($var);
                    }
                }
                if (DBLite::isFavorite(DIRECTORY)) {
                    $Shortcuts = '<a href="' . URLm::url("proc", array("dir" => DIRECTORY, "procName" => "deleteFav")) . '">Fav. Çıkart</a>';
                } else {
                    $Shortcuts = '<a href="javascript:sendPrompt(\'Favori Adı Belirleyin\', \'' . URLm::url("procVar", array("dir" => DIRECTORY, "variable" => "%s", "procName" => "addFav")) . '\', {value: \'' . basename(DIRECTORY) . '\'});">Fav. Ekle</a>';
                }
                $Shortcuts .= '
<a href="' . URLm::url("upload", array("dir" => DIRECTORY)) . '">Yükle</a>
<a href="javascript:sendPrompt(\'Bir dosya belirtin.\\n* Kısır döngüleri önlemek için aynı klasörler ile çakıştırmayın\\n\\nDosya: /sdcard/Dosya.zip\\nSıkıştır: /sdcard \\nYukarıdaki gibi bir durum kısır döngüye yol açabilir\', \'' . URLm::url("procVar", array("dir" => DIRECTORY, "variable" => "%s", "procName" => "compress")) . '\', {value: \'' . DIRECTORY . '.zip' . '\'});">Sıkıştır</a>
<a href="javascript:sendPrompt(\'Başka sunuculardan dosya indirin\', \'' . URLm::url("procVar", array("dir" => DIRECTORY, "variable" => "%s", "procName" => "iFile")) . '\', {value:\'http://\', urlEncode: true});">i-Dosya</a>
<a href="javascript:sendPrompt(\'Şu Dosya Yoluna Atla\', \'' . URLm::url("procVar", array("dir" => DIRECTORY, "variable" => "%s", "procName" => "jump")) . '\', {value: \'' . DIRECTORY . '\', urlEncode: true});">Atla</a>
<a href="javascript:checkConfirm(\'Bu klasörü silmek üzeresiniz\\n' . DIRECTORY . '\', \'' . URLm::url("proc", array("dir" => DIRECTORY, "procName" => "delete")) . '\');">Sil</a>
<a href="javascript:sendPrompt(\'Kopyala\', \'' . URLm::url("procVar", array("dir" => DIRECTORY, "variable" => "%s", "procName" => "copy")) . '\', {value: \'' . DIRECTORY . '-Copy\', urlEncode: true});">Kopyala</a>
<a href="javascript:sendPrompt(\'Taşı: \\nYeni tam klasör yolunu girin\', \'' . URLm::url("procVar", array("dir" => DIRECTORY, "variable" => "%s", "procName" => "move")) . '\', {value: \'' . DIRECTORY . '\', urlEncode: true});">Taşı</a>
<a href="javascript:sendPrompt(\'f - Dosya , d - Klasör\\nÖrnek: f:dosya_adi\', \'' . URLm::url("procVar", array("dir" => DIRECTORY, "variable" => "%s", "procName" => "create")) . '\', {value: \'\'});">Oluştur</a>
				';
                $favsRes = DBLite::query("SELECT * FROM `favorites`");
                if (DBLite::querySingle("SELECT * FROM `favorites`", TRUE)) {
                    $Favorites = null;
                    while ($Favs = $favsRes->fetchArray()) {
                        $Favorites .= Html::writef("DirListSC", array("dir" => $Favs['value'], "dirname" => $Favs['name']));
                    }
                } else {
                    $Favorites = Html::export("NoFavMsg");
                }
                Page::write("Top", array("Title" => "Klasör \"" . basename(DIRECTORY) . "\"", "CSSFile" => Settings::get("CSSFilePath"), "BodyTop" => Page::returnPage("Shortcuts", array("SiteName" => "FileManager v1.0", "ShortcutsLinks" => $Shortcuts, "Contents" => Html::writef("Title", array("Title" => "Aygıt Listesi")) . $Favorites . Html::writef("Title", array("Title" => "Disk Özeti")) . Html::writef("DirInfo", array("info" => "Toplam", "value" => File::sizeExpression(File::diskSpace(DIRECTORY, TOTAL)))) . Html::writef("DirInfo", array("info" => "Kullanılan", "value" => File::sizeExpression(File::diskSpace(DIRECTORY, USED)))) . Html::writef("DirInfo", array("info" => "Kullanılabilir", "value" => File::sizeExpression(File::diskSpace(DIRECTORY, FREE)))) . Html::writef("DirInfo", array("info" => "Dol. Oranı", "value" => ceil(File::diskSpace(DIRECTORY, PER_USED)) . "%")) . Html::writef("DirInfo", array("info" => "Boş. Oranı", "value" => ceil(File::diskSpace(DIRECTORY, PER_FREE)) . "%"))))));
                $files = array();
                $folders = array();
                if (is_readable(DIRECTORY)) {
                    $openDir = opendir(DIRECTORY);
                    while ($Name = readdir($openDir)) {
                        $fName = DIRECTORY . "/" . $Name;
                        if ($Name == "." || $Name == "..") {
                            continue;
                        }
                        if (is_file($fName)) {
                            $files[] = $Name;
                        }
                        if (is_dir($fName)) {
                            $folders[] = $Name;
                        }
                    }
                }
                $Counter = array("files" => count($files), "folders" => count($folders));
                $Counter['total'] = $Counter['files'] + $Counter['folders'];
                if ($Counter['total'] == "") {
                    Html::write("Info", "Bu klasörde içerik bulunmuyor");
                } else {
                    echo Html::writef("Title", array("Title" => basename(DIRECTORY) != "" ? strtoupper(basename(DIRECTORY)) : "İsim Yok"));
                }
                echo '
<script>Selector.PRO_FOLDER = "' . DIRECTORY . '";</script>
<form name="multiProc" action="' . URLm::url("folderView", array("dir" => DIRECTORY)) . '" method="post">
	<input type="hidden" name="variable" value="" />
	<input type="hidden" name="procName" value="" />
	<input type="hidden" name="filesArray" value="" />
				';
                if ($Counter['folders'] > 0) {
                    sort($folders);
                    foreach ($folders as $folder) {
                        $fDir = DIRECTORY . "/" . $folder;
                        Html::cloneObject("DirList", "currDirItem");
                        Html::editObject("currDirItem", array("id" => $folder), ARG);
                        if (!is_readable($fDir)) {
                            Html::editObject("currDirItem", array("onMouseOver" => "", "onMouseOut" => ""), ARG);
                        }
                        echo Html::writef("currDirItem", array("dir" => $fDir, "dirname" => $folder, "extras" => '<input type="checkbox" id="input' . $folder . '" name="selected" value="' . $folder . '" onClick="Selector.select(\'' . $folder . '\', Selector.SELECT_AUTO)"/> &nbsp; '));
                    }
                }
                if ($Counter['files'] > 0) {
                    sort($files);
                    foreach ($files as $file) {
                        $fFile = DIRECTORY . "/" . $file;
                        $fileSize = File::sizeExpression(fileSize($fFile));
                        $fileinfo = pathinfo($fFile);
                        if (isset($fileinfo['extension']) && ($fileinfo['extension'] == "jpg" || $fileinfo['extension'] == "png" || $fileinfo['extension'] == "gif")) {
                            Html::editObject("FileListImg", array("id" => $file), ARG);
                            $isize = getimagesize($fFile);
                            echo Html::writef("FileListImg", array("resolution" => $isize[0] . "x" . $isize[1], "img" => URLm::url("imgCache", array("file" => urlencode($fFile))), "size" => $fileSize, "filename" => $file, "filePath" => $fFile, "extras" => '<input type="checkbox" id="input' . $file . '" name="selected" value="' . $file . '" onClick="Selector.select(\'' . $file . '\', Selector.SELECT_AUTO)"/> &nbsp; '));
                        } else {
                            Html::editObject("FileList", array("id" => $file), ARG);
                            echo Html::writef("FileList", array("size" => $fileSize, "filename" => $file, "filePath" => $fFile, "extras" => '<input type="checkbox" id="input' . $file . '" name="selected" value="' . $file . '" onClick="Selector.select(\'' . $file . '\', Selector.SELECT_AUTO)"/> &nbsp; '));
                        }
                    }
                }
                $NavigateDir = null;
                if (is_dir(DIRECTORY)) {
                    if (DIRECTORY == "/") {
                        $NavigateDir .= '<a href="' . URLm::url("folderView", array("dir" => "/")) . '">/ {Kök} </a>';
                    } else {
                        $directoryPath = File::pathListing(DIRECTORY);
                        $countDP = 0;
                        foreach ($directoryPath as $dP) {
                            $dP[0] = $dP[0] == "" ? '<span style="color: green;">/</span>' : $dP[0];
                            $dP[1] = $dP[1] == "" ? '/' : $dP[1];
                            if ($countDP > 0) {
                                $NavigateDir .= ' <b>&gt;</b> ';
                            }
                            $NavigateDir .= '<a href="' . URLm::url("folderView", array("dir" => $dP[1])) . '">' . $dP[0] . '</a>';
                            $countDP++;
                        }
                    }
                }
                Page::write("Bottom", array("Extras" => '</form>', "DirNavigation" => $NavigateDir));
                break;
            case 'file':
                define("DIRECTORY", !is_file($_GET['directory']) ? Others::redirect("?") : realpath(urldecode($_GET['directory'])));
                define("EDIRECTORY", urlencode(DIRECTORY));
                $dirName = explode("/", DIRECTORY);
                array_pop($dirName);
                define("ODIRECTORY", implode("/", $dirName));
                unset($dirName);
                define("FILEINODE", fileinode(DIRECTORY));
                define("FILENAME", basename(DIRECTORY));
                define("FILEBYTE", filesize(DIRECTORY));
                define("FILECTIME", filectime(DIRECTORY));
                define("FILEATIME", fileatime(DIRECTORY));
                define("FILEOWNER", fileowner(DIRECTORY));
                define("FILETYPE", strtolower(substr(strrchr(FILENAME, "."), 1)));
                if (isset($_GET['proc'])) {
                    switch ($_GET['proc']) {
                        case 'move':
                            if ($_GET['var'] != "") {
                                rename(DIRECTORY, $_GET['var']);
                                Others::redirect(URLm::url("fileView", array("filePath" => $_GET['var'])));
                            }
                            break;
                        case 'copy':
                            if ($_GET['var'] != "") {
                                copy(DIRECTORY, $_GET['var']);
                                Others::redirect(URLm::url("fileView", array("filePath" => $_GET['var'])));
                            }
                            break;
                        case 'delete':
                            unlink(DIRECTORY);
                            Others::redirect(URLm::url("folderView", array("dir" => ODIRECTORY)));
                            break;
                        case 'download':
                            Others::redirect(URLm::url("imgCache", array("file" => DIRECTORY)));
                            break;
                        case 'makeApart':
                            if ($_GET['var'] != "") {
                                $currentKB = FILEBYTE / 1024;
                                $var = (int) $_GET['var'];
                                if ($currentKB > $var && $var > 1) {
                                    $parts = array();
                                    $dt = fopen(DIRECTORY, "rd");
                                    $partInfoFile = DIRECTORY . ".partInfo";
                                    touch($partInfoFile);
                                    file_put_contents($partInfoFile, "Aparted file notifier. Use this file when unaparting");
                                    for ($i = 0; $i < $currentKB; $i += $var) {
                                        if ($i + $var > $currentKB) {
                                            $parts[] = $currentKB * 1024;
                                        } else {
                                            $parts[] = ($i + $var) * 1024;
                                        }
                                    }
                                    foreach ($parts as $pNum => $currSize) {
                                        $partFile = DIRECTORY . ".part" . $pNum;
                                        touch($partFile);
                                        if ($dt) {
                                            while (ftell($dt) <= $currSize && !feof($dt)) {
                                                file_put_contents($partFile, fread($dt, 8192), FILE_APPEND);
                                            }
                                        }
                                    }
                                    fclose($dt);
                                }
                                Others::redirect(URLm::url("fileView", array("filePath" => $partInfoFile)));
                            }
                            break;
                        case 'unapart':
                            $fileInfo = pathinfo(DIRECTORY);
                            $pref = $fileInfo['dirname'] . "/" . $fileInfo['filename'];
                            $presearch = glob($pref . ".part*");
                            if (is_file($pref)) {
                                rename($pref, $pref . "_moved");
                            } else {
                                touch($pref);
                            }
                            for ($i = 0; $i <= count($presearch); $i++) {
                                $tf = $pref . ".part" . $i;
                                if (!is_file($tf)) {
                                    break;
                                }
                                $dt = fopen($tf, "rd");
                                if ($dt) {
                                    while (!feof($dt)) {
                                        file_put_contents($pref, fread($dt, 8192), FILE_APPEND);
                                    }
                                    fclose($dt);
                                }
                            }
                            Others::redirect(URLm::url("fileView", array("filePath" => $pref)));
                            break;
                        case 'deleteParts':
                            $fileInfo = pathinfo(DIRECTORY);
                            $pref = $fileInfo['dirname'] . "/" . $fileInfo['filename'] . ".part";
                            $presearch = glob($pref . "*");
                            foreach ($presearch as $path) {
                                if (is_file($path)) {
                                    @unlink($path);
                                }
                            }
                            Others::redirect(URLm::url("folderView", array("dir" => ODIRECTORY)));
                            break;
                        case 'uncompress':
                            if ($_GET['var'] != "" && is_dir($_GET['var'])) {
                                $Zip = new ZipArchive();
                                $isZip = $Zip->open(DIRECTORY);
                                if ($isZip) {
                                    $l = $Zip->extractTo(realpath($_GET['var']));
                                    if ($l) {
                                        Others::redirect(URLm::url("folderView", array("dir" => $_GET['var'])));
                                    }
                                }
                            }
                    }
                }
                $Shortcuts = '
<a href="javascript:sendPrompt(\'Şu Dosya Yoluna Atla\', \'' . URLm::url("procVar", array("dir" => DIRECTORY, "variable" => "%s", "procName" => "jump")) . '\', {value: \'' . DIRECTORY . '\'});">Atla</a>
<a href="javascript:checkConfirm(\'Bu dosyayı silmek üzeresiniz\\n' . DIRECTORY . '\', \'' . URLm::url("procFile", array("dir" => DIRECTORY, "procName" => "delete")) . '\');">Sil</a>
<a href="javascript:sendPrompt(\'Kopyala\', \'' . URLm::url("procFileVar", array("dir" => DIRECTORY, "variable" => "%s", "procName" => "copy")) . '\', {value: \'' . DIRECTORY . '-Copy\'});">Kopyala</a>
<a href="javascript:sendPrompt(\'Taşı: \\nYeni tam dosya yolunu girin\', \'' . URLm::url("procFileVar", array("dir" => DIRECTORY, "variable" => "%s", "procName" => "move")) . '\', {value: \'' . DIRECTORY . '\'});">Taşı</a>
<a href="' . URLm::url("procFile", array("dir" => DIRECTORY, "procName" => "download")) . '">İndir</a>
<a href="#" onClick="window.open(\'' . URLm::url("fileEditor", array("file" => DIRECTORY)) . '\');">Düzenle</a>
<a href="javascript:sendPrompt(\'Dosyayı parçalara ayırın (kB cinsinden boyut girin)\', \'' . URLm::url("procFileVar", array("dir" => DIRECTORY, "variable" => "%s", "procName" => "makeApart")) . '\', {value: \'20000\'});">Ayır</a>
				';
                if (FILETYPE == "zip") {
                    $Shortcuts .= '
<a href="javascript:sendPrompt(\'Klasöre Çıkart\', \'' . URLm::url("procFileVar", array("dir" => DIRECTORY, "variable" => "%s", "procName" => "uncompress")) . '\', {value: \'' . DIRECTORY . '\'});">Çıkart</a>
					';
                }
                if (FILETYPE == "partinfo") {
                    $Shortcuts .= '
<a href="' . URLm::url("procFile", array("dir" => DIRECTORY, "procName" => "unapart")) . '">Birleştir</a>
<a href="javascript:checkConfirm(\'Parçalanmış dosyayı parçaları ile birlikte silmek üzeresiniz\', \'' . URLm::url("procFile", array("dir" => DIRECTORY, "procName" => "deleteParts")) . '\');">Parçaları Sil</a>
					';
                }
                $favsRes = DBLite::query("SELECT * FROM `favorites`");
                $Favorites = null;
                if (DBLite::querySingle("SELECT * FROM `favorites`", TRUE)) {
                    while ($Favs = $favsRes->fetchArray()) {
                        $Favorites .= Html::writef("DirListSC", array("dir" => $Favs['value'], "dirname" => $Favs['name']));
                    }
                } else {
                    $Favorites = Html::export("NoFavMsg");
                }
                Page::write("Top", array("Title" => "Dosya \"" . FILENAME . "\"", "CSSFile" => Settings::get("CSSFilePath"), "BodyTop" => Page::returnPage("Shortcuts", array("SiteName" => "Dosyayı Görüntüle", "ShortcutsLinks" => $Shortcuts, "Contents" => Html::writef("Title", array("Title" => "Aygıt Listesi")) . $Favorites . Html::writef("Title", array("Title" => "Disk Özeti")) . Html::writef("DirInfo", array("info" => "Toplam", "value" => File::sizeExpression(File::diskSpace(ODIRECTORY, TOTAL)))) . Html::writef("DirInfo", array("info" => "Kullanılan", "value" => File::sizeExpression(File::diskSpace(ODIRECTORY, USED)))) . Html::writef("DirInfo", array("info" => "Kullanılabilir", "value" => File::sizeExpression(File::diskSpace(ODIRECTORY, FREE)))) . Html::writef("DirInfo", array("info" => "Dol. Oranı", "value" => ceil(File::diskSpace(ODIRECTORY, PER_USED)) . "%")) . Html::writef("DirInfo", array("info" => "Boş. Oranı", "value" => ceil(File::diskSpace(ODIRECTORY, PER_FREE)) . "%"))))));
                if (is_file(DIRECTORY)) {
                    if (DIRECTORY == "/") {
                        $NavigateDir .= '<a href="' . URLm::url("folderView", array("dir" => "/")) . '">/ {Kök} </a>';
                    } else {
                        $directoryPath = File::pathListing(DIRECTORY);
                        $countDP = 0;
                        $NavigateDir = null;
                        foreach ($directoryPath as $dP) {
                            $dP[0] = $dP[0] == "" ? '<span style="color: green;">/</span>' : $dP[0];
                            $dP[1] = $dP[1] == "" ? '/' : $dP[1];
                            if ($countDP > 0) {
                                $NavigateDir .= ' <b>&gt;</b> ';
                            }
                            $NavigateDir .= '<a href="' . URLm::url("folderView", array("dir" => $dP[1])) . '">' . $dP[0] . '</a>';
                            $countDP++;
                        }
                    }
                }
                if (FILETYPE == "partinfo") {
                    echo Html::write("Info", "Parçalanmış Dosya Bilgi Dosyası (*.partInfo)");
                }
                echo Html::writef("Title", array("Title" => basename(DIRECTORY) != "" ? strtoupper(basename(DIRECTORY)) : "İsim Yok"));
                echo Html::writef("FileInfo", array("info" => "Dosya Boyutu", "value" => File::sizeExpression(FILEBYTE)));
                echo Html::writef("FileInfo", array("info" => "Değiştirilme Tarihi", "value" => date("Y/m/d H:i", FILECTIME)));
                echo Html::writef("FileInfo", array("info" => "Son Erişim Tarihi", "value" => date("Y/m/d H:i", FILEATIME)));
                echo Html::writef("FileInfo", array("info" => "Düğüm Numarası", "value" => FILEINODE));
                echo Html::writef("FileInfo", array("info" => "Dosya Sahibi", "value" => FILEOWNER));
                if (FILETYPE == "partinfo") {
                    $fileInfo = pathinfo(DIRECTORY);
                    $pref = $fileInfo['dirname'] . "/" . $fileInfo['filename'];
                    $presearch = glob($pref . ".part*");
                    Html::cloneObject("List", "FileM");
                    Html::editObject("FileM", array(), '<a href="%eval{return URLm::url("fileView", array("filePath" => "%{file}%"));}%">%{(basename)file}% &nbsp;</a> <small>%{size}%</small>');
                    if (count($presearch) > 0) {
                        echo "<br />\n" . Html::writef("Title", array("Title" => "İlişkili Olabilecek Dosyalar"));
                        foreach ($presearch as $fid) {
                            echo Html::writef("FileM", array("file" => $fid, "size" => filesize($fid) . " B"));
                        }
                    }
                }
                if (FILEBYTE < 102400 && (FILETYPE == "php" || FILETYPE == "txt" || FILETYPE == "html" || FILETYPE == "js" || FILETYPE == "xml" || FILETYPE == "dump")) {
                    echo Html::writef("List", array("Content" => str_replace(array("\n", "\t"), array('<br />', " &nbsp; &nbsp; "), String::escapeHTML(file_get_contents(DIRECTORY)))));
                }
                if (FILETYPE == "jpg" || FILETYPE == "png" || FILETYPE == "gif") {
                    Html::cloneObject("List", "Img");
                    Html::editObject("Img", array("style" => "text-align: center;"), '<img src="%{img}%" style="width: 250px;" />
					');
                    echo Html::writef("Img", array("img" => URLm::url("imgCache", array("file" => DIRECTORY))));
                }
                if (FILETYPE == "mp3" || FILETYPE == "m4a" || FILETYPE == "aac" || FILETYPE == "ogg") {
                    Html::cloneObject("List", "MP3");
                    Html::editObject("MP3", array("style" => "text-align: center;"), '<audio style="width: 90%;" controls>
							<source src="%{src}%">
						</audio>
						');
                    echo Html::writef("MP3", array("src" => URLm::url("imgCache", array("file" => DIRECTORY))));
                }
                if (FILETYPE == "mp4" || FILETYPE == "avi" || FILETYPE == "m4a") {
                    Html::cloneObject("List", "VideoArea");
                    Html::editObject("VideoArea", array("style" => "text-align: center;"), '<video style="width: 90%;" controls>
							<source src="%{src}%">
						</video>
						');
                    echo Html::writef("VideoArea", array("src" => URLm::url("imgCache", array("file" => DIRECTORY))));
                }
                Page::write("Bottom", array("DirNavigation" => $NavigateDir));
                break;
            case 'upload':
                define("DIRECTORY", !is_dir($_GET['directory']) ? Others::redirect("?") : realpath($_GET['directory']));
                // define ( "DIRECTORY", ((! is_dir ( $_GET ['directory'] )) ? realpath ( $_SERVER ['DOCUMENT_ROOT'] ) : realpath ( $_GET ['directory'] )) );
                define("EDIRECTORY", urlencode(DIRECTORY));
                $Shortcuts = '
<a href="' . URLm::url("folderView", array("dir" => DIRECTORY)) . '">Geri Dön</a>
<a href="javascript:alert(\'Yükleyeceğiniz dosyayı seçin. Ardından yükle butonuna basın ve sabırlı olun dosya yüklendikten sonra yönlendirileceksiniz\');">Nasıl Yüklerim?</a>
				';
                $favsRes = DBLite::query("SELECT * FROM `favorites`");
                $Favorites = null;
                if (DBLite::querySingle("SELECT * FROM `favorites`", TRUE)) {
                    while ($Favs = $favsRes->fetchArray()) {
                        $Favorites .= Html::writef("DirListSC", array("dir" => $Favs['value'], "dirname" => $Favs['name']));
                    }
                } else {
                    $Favorites = Html::export("NoFavMsg");
                }
                if (isset($_FILES['file'])) {
                    $baseName = str_replace(array("\"", "'", "{", "}", "^", "<", ">"), "", $_FILES['file']['name']);
                    $tp = DIRECTORY . "/" . $baseName;
                    if (is_file($tp)) {
                        rename($tp, $tp . "_old");
                    }
                    move_uploaded_file($_FILES['file']['tmp_name'], $tp);
                    Others::redirect(URLm::url("folderView", array("dir" => DIRECTORY)));
                }
                Page::write("Top", array("Title" => "Klasör.Upload \"" . basename(DIRECTORY) . "\"", "CSSFile" => Settings::get("CSSFilePath"), "BodyTop" => Page::returnPage("Shortcuts", array("SiteName" => "FileManager.Upload", "ShortcutsLinks" => $Shortcuts, "Contents" => Html::writef("Title", array("Title" => "Aygıt Listesi")) . $Favorites . Html::writef("Title", array("Title" => "Disk Özeti")) . Html::writef("DirInfo", array("info" => "Toplam", "value" => File::sizeExpression(File::diskSpace(DIRECTORY, TOTAL)))) . Html::writef("DirInfo", array("info" => "Kullanılan", "value" => File::sizeExpression(File::diskSpace(DIRECTORY, USED)))) . Html::writef("DirInfo", array("info" => "Kullanılabilir", "value" => File::sizeExpression(File::diskSpace(DIRECTORY, FREE)))) . Html::writef("DirInfo", array("info" => "Dol. Oranı", "value" => ceil(File::diskSpace(DIRECTORY, PER_USED)) . "%")) . Html::writef("DirInfo", array("info" => "Boş. Oranı", "value" => ceil(File::diskSpace(DIRECTORY, PER_FREE)) . "%"))))));
                echo Html::writef("Title", array("Title" => "Dosya Yükleyin")) . '
<form enctype="multipart/form-data" action="' . URLm::url("upload", array("dir" => DIRECTORY)) . '" method="POST">
					' . Html::export("List", '
	<input name="file" type="file" style="width: 80%; margin-bottom: 8px;" />
					', array("style" => "text-align: center;")) . Html::writef("ListSubmit", array("Content" => '
	<input type="submit" value="Yükle" />
					')) . '
</form>
<br />
				' . Html::writef("Title", array("Title" => "i-Dosya ile Karşı Sunucudan Yükle")) . '
<form enctype="multipart/form-data" action="' . URLm::url("procVar", array("dir" => DIRECTORY, "variable" => "%s", "procName" => "iFile")) . '" method="POST">
					' . Html::export("List", '
	<input name="var" type="text" style="width: 80%; margin-bottom: 8px;" value="http://" />
					', array("style" => "text-align: center;")) . Html::writef("ListSubmit", array("Content" => '
	<input type="submit" value="Bağlan ve İndir" />
					')) . '
</form>
				';
                $NavigateDir = null;
                if (is_dir(DIRECTORY)) {
                    if (DIRECTORY == "/") {
                        $NavigateDir = '<a href="' . URLy::url("folderView", array("dir" => "/")) . '">/ {Kök} </a>';
                    } else {
                        $directoryPath = File::pathListing(DIRECTORY);
                        $countDP = 0;
                        foreach ($directoryPath as $dP) {
                            $dP[0] = $dP[0] == "" ? '<span style="color: green;">/</span>' : $dP[0];
                            $dP[1] = $dP[1] == "" ? '/' : $dP[1];
                            if ($countDP > 0) {
                                $NavigateDir .= ' <b>&gt;</b> ';
                            }
                            $NavigateDir .= '<a href="' . URLm::url("folderView", array("dir" => $dP[1])) . '">' . $dP[0] . '</a>';
                            $countDP++;
                        }
                    }
                }
                Page::write("Bottom", array("DirNavigation" => $NavigateDir));
        }
    }
示例#22
0
文件: todo.php 项目: 0-oo/todo.php
 /**
  *  カテゴリを削除する
  *  @return boolean 削除できたかどうか
  */
 private function _deleteCat()
 {
     $path = $this->getPath();
     if (!is_file($path) || fileSize($path)) {
         //todoが残っている場合は削除させない
         return false;
     }
     $this->cat = null;
     return unlink($path);
 }
示例#23
0
 public static function setExistingFileInfo($fileId)
 {
     static $smartCounter = 0;
     //Populates the class array $existingFiles with their old file size and the size of file that's being replaced
     self::$existingFiles["name"][$smartCounter] = $_FILES["docs"]["name"][$fileId];
     //Old file size
     self::$existingFiles["oldFileSize"][$smartCounter] = fileSize(self::$subDir . $_FILES["docs"]["name"][$fileId]);
     //New file size
     self::$existingFiles["newFileSize"][$smartCounter] = $_FILES["docs"]["size"][$fileId];
     $smartCounter++;
 }
示例#24
0
if (!file_exists($outfile)) {
    gs_log(GS_LOG_WARNING, 'Failed to convert voicemail file.');
    _server_error('Failed to convert file.');
}
@header('Content-Type: ' . $formats[$fmt]['mime']);
$fake_filename = preg_replace('/[^0-9a-z\\-_.]/i', '', 'vm_' . $ext . '_' . date('Ymd_Hi', $info['orig_time']) . '_' . subStr(md5(date('s', $info['orig_time']) . $info['cidnum']), 0, 4) . '.' . $formats[$fmt]['ext']);
@header('Content-Disposition: ' . ($attach ? 'attachment' : 'inline') . '; filename="' . $fake_filename . '"');
@header('ETag: ' . $etag);
# set Content-Length to prevent Apache(/PHP?) from using
# "Transfer-Encoding: chunked" which makes the sound file appear too
# short in QuickTime and maybe other players
@header('Transfer-Encoding: identity');
if ($fmt === 'wav-pcma') {
    @header('Content-Length: ' . ((int) strLen($wav_alaw_header) + (int) @fileSize($origfile)));
    echo $wav_alaw_header;
    @readFile($origfile);
} else {
    @header('Content-Length: ' . (int) @fileSize($outfile));
    @readFile($outfile);
}
@ob_start();
# so there's no output after the content
if (!@$info['listened_to']) {
    @$DB->execute('UPDATE `vm_msgs` SET `listened_to`=1
WHERE
	`user_id`=\'' . $user_id . '\' AND
	`folder`=\'' . $DB->escape($fld) . '\' AND
	`file`=\'' . $DB->escape($file) . '\'');
}
//@exec( 'sudo rm -rf '. qsa($outfile) .' 1>>/dev/null 2>>/dev/null' );
@ob_clean();
示例#25
0
//toilet -f mono12  Linux
$boxes = '|boxes -d santa';
//boxes -d <boxid>
$cusfuncshell = 'echo "Your Message here"|boxes';
//justom function what you want. JUST TERMINAL CODES like echo "some think" or "cd /somedir" etc.
###############################################################
$cusfunc = "  " . $cusfuncshell;
###############################################################
//PocketControl
$control1 = shell_exec("dpkg -s figlet");
if (strstr($control1, "install ok installed")) {
    $control2 = shell_exec("dpkg -s boxes");
    if (strstr($control2, "install ok installed")) {
        //Bashrc Control
        $dosya_ici = fOpen("/root/.bashrc", "r");
        $dosya_oku = fRead($dosya_ici, fileSize("/root/.bashrc"));
        fClose($dosya_ici);
        //somecommands
        $whoami = shell_exec("whoami");
        $say = count($_SERVER['argv']);
        $argum = $_SERVER['argv'];
        if (strstr($dosya_oku, "php CusTerm.php", true)) {
            ###############################################################
            if (@$argum[1] == "--help") {
                echo "yardım mı lazımdır?";
                exit;
            }
            if ($ne == "standard") {
                $nick = exec("whoami");
                echo $figlet = shell_exec($figlet . " " . $nick . $boxes);
                echo $customch = shell_exec($cusfunc);
示例#26
0
 function getSize($lpszFileName, &$width, &$height)
 {
     if (!($fh = @fOpen($lpszFileName, "rb"))) {
         return false;
     }
     $data = @fRead($fh, @fileSize($lpszFileName));
     @fClose($fh);
     $gfh = new CGIFFILEHEADER();
     if (!$gfh->load($data, $len = 0)) {
         return false;
     }
     $width = $gfh->m_nWidth;
     $height = $gfh->m_nHeight;
     return true;
 }
示例#27
0
 /**
  * This function returns the HTML(or other) template from the given file
  *
  * @param string $file_name the file we wanna load
  * @param string $part non-required param, it specifies the part of the given file, if there is not set, the first will be selected
  * @return string the file (also part of it) we wanted
  */
 function getTpl($file_name, $part = 'main')
 {
     $file_name = $this->getFilePath($file_name);
     if (!in_array($file_name, self::$cache)) {
         $file_handle = fopen($file_name, 'r');
         $file_content = fread($file_handle, fileSize($file_name));
         fclose($file_handle);
         self::$cache[$file_name] = $file_content;
     } else {
         $file_content = self::$cache[$file_name];
     }
     $template = new SimpleXMLElement($file_content);
     if (!$part) {
         $part = $template['defaultPart'];
     }
     $result = $template->xpath("/template/part[@id='" . strtolower($part) . "']");
     return substr($result[0], 0, 1) == "\n" ? substr($result[0], 1) : $result[0];
 }