*I* totally didn't, yet I'm in the drawing... why?
RWL Home Page
If you find a bug in the game, contact The Lady Shael, or post a topic in the Bugs forum.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote
function cleanDirectory($directory) {
if (strlen($directory) < 1) { return ""; }
$directory = stripDirectory($directory);
$directory = str_replace('./', '', $directory);
$directory = str_replace('/.', '', $directory);
$directoryparts = explode("/", $directory);
$doubledotcounter = 0;
$newdirectory = "";
for ($i=sizeof($directoryparts)-1; $i>=0; $i = $i - 1) {
if ($directoryparts[$i] == "..") {
$doubledotcounter = $doubledotcounter + 1;
}
else {
if ($doubledotcounter == 0) {
$newdirectory = $directoryparts[$i] . "/" . $newdirectory;
}
elseif ($doubledotcounter > 0) {
$doubledotcounter = $doubledotcounter - 1;
}
}
}
$newdirectory = "/" . stripDirectory($newdirectory);
return $newdirectory;
}
function stripDirectory($directory) {
$directory = trim($directory);
while(substr($directory, 0, 1) == '/') {
$directory = substr($directory, 1, strlen($directory)-1);
}
while(substr($directory, strlen($directory)-1, 1) == '/') {
$directory = substr($directory, 0, strlen($directory)-1);
}
return $directory;
}
QuoteFor source viewer:
if directory: ls -l somedir
if ASCII file: cat somedir/some.file
if zip file: unzip -ql somedir/some.zip
if file inside zip file: unzip -qp somedir/some.zip insidedir/inside.file
if tar.gz file: gunzip somedir/some.tar.gz | tar vtf -
if gz file: gunzip -l somedir/some.gz