/trunk/private/.htaccess |
---|
0,0 → 1,2 |
Order Deny,Allow |
Deny From All |
/trunk/private/old_messenger/chat.php |
---|
0,0 → 1,29 |
<?php |
if (!isset($_COOKIE['mov_nick'])) { |
header('location:index.php'); |
die(); |
} |
if (isset($_GET['show'])) { |
$show = $_GET['show']; |
} else { |
$show = 20; |
} |
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> |
<html> |
<head> |
<title>MOV Alpha</title> |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
</head> |
<frameset rows="*,90" cols="*" framespacing="1" frameborder="yes" border="1" bordercolor="#FF0000"> |
<frame src="messages.php?show=<?php echo $show; ?>" name="mainFrame"> |
<frame src="input.php" name="bottomFrame" scrolling="NO" noresize > |
</frameset> |
<noframes><body> |
</body></noframes> |
</html> |
/trunk/private/old_messenger/col.inc.php |
---|
0,0 → 1,57 |
<?php |
// http://www.actionscript.org/forums/archive/index.php3/t-50746.html |
function HSV_TO_RGB ($H, $S, $V) // HSV Values:Number 0-1 |
{ // RGB Results:Number 0-255 |
$RGB = array(); |
if($S == 0) |
{ |
$R = $G = $B = $V * 255; |
} |
else |
{ |
$var_H = $H * 6; |
$var_i = floor( $var_H ); |
$var_1 = $V * ( 1 - $S ); |
$var_2 = $V * ( 1 - $S * ( $var_H - $var_i ) ); |
$var_3 = $V * ( 1 - $S * (1 - ( $var_H - $var_i ) ) ); |
if ($var_i == 0) { $var_R = $V ; $var_G = $var_3 ; $var_B = $var_1 ; } |
else if ($var_i == 1) { $var_R = $var_2 ; $var_G = $V ; $var_B = $var_1 ; } |
else if ($var_i == 2) { $var_R = $var_1 ; $var_G = $V ; $var_B = $var_3 ; } |
else if ($var_i == 3) { $var_R = $var_1 ; $var_G = $var_2 ; $var_B = $V ; } |
else if ($var_i == 4) { $var_R = $var_3 ; $var_G = $var_1 ; $var_B = $V ; } |
else { $var_R = $V ; $var_G = $var_1 ; $var_B = $var_2 ; } |
$R = $var_R * 255; |
$G = $var_G * 255; |
$B = $var_B * 255; |
} |
$RGB['R'] = $R; |
$RGB['G'] = $G; |
$RGB['B'] = $B; |
return $RGB; |
} |
function str_to_color($str) { |
$str = md5(strtolower($str)); |
$sum = 0; |
for ($i=0; $i<strlen($str); $i++) { |
$c = substr($str,$i,1); |
$sum += ord($c); |
} |
$a = $sum % 255; |
$r = HSV_TO_RGB($a/255, 1, 0.75); |
return '#'.str_pad(dechex($r['R']), 2, '0', STR_PAD_LEFT). |
str_pad(dechex($r['G']), 2, '0', STR_PAD_LEFT). |
str_pad(dechex($r['B']), 2, '0', STR_PAD_LEFT); |
} |
?> |
/trunk/private/old_messenger/files/DirectoryHashCalculator.class.php |
---|
0,0 → 1,98 |
<?php |
class DirectoryHashCalculator { |
/* |
Directory Hash V3 by Daniel Marschall |
<directoryhash> ::= SHA1(<directorycontext>) |
<directorycontext> ::= "" | <entry> |
<entries> ::= <entry> ["|" <entry>] |
IMPORTANT: (MD5) SORTED ASCENDING! |
<entry> ::= <file_md5_hash> <filenames> |
<filenames> ::= "*" <relative_directory> <filename> [<filenames>] |
IMPORTANT: (RelativeDir+Filename) SORTED ASCENDING! |
<file_md5_hash> ::= MD5(FILECONTENT(<relative_directory> <filename>)) |
<filename> ::= given. |
IMPORTANT: All directories (this automatically |
excludes "", "." and "..") and non-existing resp. |
non-readable files are not included. |
addFile() will return false. |
<relative_directory> ::= given. |
Note: Usually, the directory is in relative diction. |
IMPORTANT: "./" is always stripped from beginning! |
IMPORTANT: "\" is made to "/"! |
Example: |
"" --> Empty directory |
<hash1>*<file1_with_hash1>*<file2_with_hash1>|<hash2>*<file1_with_hash2> |
*/ |
private $hashes; |
function __construct() { |
$this->clear(); |
} |
private static function makeFilenameConsistently(&$filename) { |
// Rule 1: Cut off "./" from beginning |
if (substr($filename, 0, 2) == './') { |
$filename = substr($filename, 2, strlen($filename)-2); |
} |
// Rule 2: Use "/" instead of "\" |
$filename = str_replace('\\', '/', $filename); |
} |
/* |
@return |
MD5-Hash of the file or FALSE is calculation/adding |
was not successful. |
*/ |
public function addFile($file) { |
if (!file_exists($file)) return false; |
// if (!is_readable($file)) return false; |
// if (basename($file) == '') return false; |
// if (basename($file) == '.') return false; |
// if (basename($file) == '..') return false; |
self::makeFilenameConsistently($file); |
$file_md5 = md5_file($file); |
if ($file_md5 === false) return false; // Error... |
$this->hashes[$file_md5][] = $file; |
return $file_md5; |
} |
public function clear() { |
$this->hashes = array(); |
} |
private function getDirectoryContext() { |
if (count($this->hashes) == 0) return ''; |
$directory_context = ''; |
// Sort md5 hashes ascending (so that the result is equal at every machine) |
ksort($this->hashes); |
foreach ($this->hashes as $hash => $filenames) { |
// Sort filenames ascending (so that the result is equal at every machine) |
sort($filenames); |
$directory_context .= $hash; |
foreach ($filenames as $filename) { |
$directory_context .= '*'.$filename; |
} |
$directory_context .= '|'; |
} |
$directory_context = substr($directory_context, 0, strlen($directory_context)-1); |
return $directory_context; |
} |
public function calculateDirectoryHash() { |
$directory_context = $this->getDirectoryContext(); |
return sha1($directory_context); |
} |
function getVersionDescription() { |
return 'Marschall V3'; |
} |
} |
?> |
/trunk/private/old_messenger/files/index.php |
---|
0,0 → 1,134 |
<?php |
require 'DirectoryHashCalculator.class.php'; |
define('VER', '09.03.2010 21:30'); |
error_reporting(E_ALL | E_NOTICE); |
$path = dirname($_SERVER['SCRIPT_NAME']); |
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
"http://www.w3.org/TR/html4/loose.dtd"> |
<html> |
<head> |
<title>Index für <?php echo $path; ?></title> |
</head> |
<body> |
<h1>Index für <?php echo $path; ?></h1> |
<hr> |
<br><table border="1" width="100%"> |
<tr> |
<td><b>Dateiname</b></td> |
<td><b>Hochgeladen / Aktualisiert</b> (Sort)</td> |
<td align="right"><b>Dateigröße</b></td> |
<td align="right"><b>MD5-Hash</b></td> |
</tr><?php |
$outarray = array(); |
$sizesum = 0; |
$filesum = 0; |
$hash_calculator = new DirectoryHashCalculator(); |
dir_rekursiv('', $outarray, $sizesum, $filesum, $hash_calculator); |
ksort($outarray); |
foreach ($outarray as $value) { |
echo $value; |
} |
?> |
</table><br> |
<?php |
$filesum = number_format($filesum, 0, ',', '.'); |
$sizesum = number_format($sizesum, 0, ',', '.'); |
/* |
Note: |
In this solution, ".*" and "index.html" (this script) and |
"DirectoryHashCalculator.class.php" (required by this script) |
are not calculated in because dir_rekursiv() ignored them, |
so the Directory-Hash-Result may differ from other applications which |
implement it. |
*/ |
$directory_hash = $hash_calculator->calculateDirectoryHash(); |
$hash_alg = $hash_calculator->getVersionDescription(); |
echo '<p><code>Berechnung abgeschlossen am '.date('Y-m-d H:i:s \G\M\TO').'<br>'; |
echo "$filesum Dateien mit $sizesum Byte Größe.<br>"; |
echo "Directory-Hash ($hash_alg): $directory_hash.</code></p>"; |
echo '<hr>'; |
echo '<p><i>Directory Listing Script Version '.VER.' © 2010 <a href="http://www.viathinksoft.de/">ViaThinkSoft</a>.</i></p>'; |
?> |
</body> |
</html><?php |
// Ref: http://www.php.net/manual/de/function.urlencode.php#96256 |
function encode_full_url($url) { |
$url = urlencode($url); |
$url = str_replace("%2F", "/", $url); |
$url = str_replace("%3A", ":", $url); |
$url = str_replace("+", "%20", $url); // Neu |
return $url; |
} |
function dir_rekursiv($verzeichnis, &$outarray, &$sizesum, &$filesum, $hash_calculator) { |
if ($verzeichnis == '') $verzeichnis = './'; |
$handle = opendir($verzeichnis); |
while ($datei = readdir($handle)) |
{ |
if (($datei != '.') && ($datei != '..')) |
{ |
$file = $verzeichnis.$datei; |
if (is_dir($file)) // Wenn Verzeichniseintrag ein Verzeichnis ist |
{ |
// Erneuter Funktionsaufruf, um das aktuelle Verzeichnis auszulesen |
dir_rekursiv($file.'/', $outarray, $sizesum, $filesum, $hash_calculator); |
} else { |
// Wenn Verzeichnis-Eintrag eine Datei ist, diese ausgeben |
if (substr($file, 0, 2) == './') { |
$file = substr($file, 2, strlen($file)-2); // './' entfernen |
} |
if (($file != 'index.php') && |
($file != 'DirectoryHashCalculator.class.php') && |
(substr($file, 0, 1) != '.')) { |
$filesize = filesize($file); |
$sizesum += $filesize; |
$filesum++; |
$sizeformat = number_format($filesize, 0, ',', '.'); |
$file_md5 = $hash_calculator->addFile($file); |
if ($file_md5 === false) $file_md5 = '<b>ERROR!</b>'; |
$mtime = filemtime($file); |
$date = date('Y-m-d H:i:s \G\M\TO', $mtime); |
if (!isset($outarray[$mtime])) $outarray[$mtime] = ''; |
$outarray[$mtime] .= '<tr> |
<td><a href="'.encode_full_url($file).'" target="_blank">'.str_replace('/', ' / ', $file).'</a></td> |
<td>'.$date.'</td> |
<td align="right">'.$sizeformat.'</td> |
<td align="right"><code>'.$file_md5.'</code></td> |
</tr>'; |
} |
} |
} |
} |
closedir($handle); |
} |
?> |
/trunk/private/old_messenger/index.php |
---|
0,0 → 1,27 |
<?php |
include 'col.inc.php'; |
if(!isset($_POST['nickname'])){ |
echo"<style type=\"text/css\">BODY{font-family:Verdana, Arial, Helvetica, sans-serif}</style> |
<h1>MOV Login</h1> |
<form method=\"post\" action=\"index.php\"> |
<p>Please enter your name code:</p> |
<input name=\"nickname\" type=\"text\" id=\"nickname\"> |
<input type=\"submit\" value=\" Login \"> |
</form> |
<p><a href=\"messages.php?show=all\" target=\"_blank\">Show only message log</a></p> |
</body> |
</html>"; |
} |
else{ |
setcookie("mov_nick",$_POST['nickname'],0/*,0,"/",""*/); |
$fileOpen=@fopen("messages.txt", "a"); |
@fwrite($fileOpen,date("d.m.Y H:i:s")." <font color=\"".str_to_color($_POST['nickname'])."\"><b>".$_POST['nickname']."</b> <i>betritt den Raum</i></font><br>\n"); |
fclose($fileOpen); |
header("Location:chat.php"); |
} |
?> |
/trunk/private/old_messenger/input.php |
---|
0,0 → 1,33 |
<?php |
include 'col.inc.php'; |
if ($_POST['txt']!="") { |
$fileOpen=@fopen("messages.txt", "a"); |
$_POST['txt'] = stripslashes($_POST['txt']); |
$_POST['txt'] = htmlentities($_POST['txt']); |
$_POST['txt'] = str_replace('"', '"', $_POST['txt']); |
@fwrite($fileOpen,date('d.m.Y H:i:s')." <font color=\"".str_to_color($_COOKIE['mov_nick'])."\"><b>".$_COOKIE['mov_nick']." -- </b></font>".$_POST['txt']."<br>\n"); |
@fclose($fileOpen); |
} |
echo "<style type=\"text/css\">BODY{font-family:Verdana, Arial, Helvetica, sans-serif}</style> |
<form method=\"post\" action=\"input.php\" name=\"inpform\"> |
<input name=\"txt\" type=\"text\" size=\"75\" id=\"txt\"> |
<input type=\"submit\" name=\"Submit\" value=\" Chat! \"> |
</form> <a href=\"logoff.php\" target=\"_top\">Log Off</a> |
-- <a href=\"messages.php?show=all\" target=\"_blank\">Show full history</a> |
-- <a href=\"files/\" target=\"_blank\">Show shared files</a><br> |
<script type=\"text/javascript\" language=\"JavaScript\"> |
<!-- |
self.focus(); |
document.inpform.txt.focus(); |
// --> |
</script> |
"; |
?> |
/trunk/private/old_messenger/logoff.php |
---|
0,0 → 1,16 |
<?php |
setcookie ("mov_nick", "", time() - 3600); |
include 'col.inc.php'; |
$fileOpen=@fopen("messages.txt", "a"); |
@fwrite($fileOpen,date("d.m.Y H:i:s")." <font color=\"".str_to_color($_COOKIE['mov_nick'])."\"><b>".$_COOKIE['mov_nick']."</b> <i>hat dem Raum verlasssen</i></font><br>\n"); |
fclose($fileOpen); |
//echo "<style type=\"text/css\">BODY{font-family:Verdana, Arial, Helvetica, sans-serif}</style><a href=\"index.php\" target=\"_top\">Login Again!</a>"; |
unset($_COOKIE['mov_nick']); |
header("Location:index.php"); |
?> |
/trunk/private/old_messenger/messages.php |
---|
0,0 → 1,34 |
<?php |
if ($_GET['show'] != 'all') { |
echo '<meta http-equiv="refresh" content="2">'; |
} |
echo '<style type="text/css">BODY{font-family:Verdana, Arial, Helvetica, sans-serif}</style>'; |
$fileRead = file_get_contents("messages.txt"); |
$expl = explode("\n", $fileRead); |
$e = count($expl); |
// -1, da am Dateiende immer "\n" (Leerzeile) |
if ($_GET['show'] == 'all') { |
$s = count($expl); |
} else { |
$s = $_GET['show']; |
} |
$s = count($expl)-$s-1; |
if ($s < 0) $s = 0; |
for ($i=$s; $i<count($expl)-1; $i++) { |
echo "[".str_pad($i+1, 4, '0', STR_PAD_LEFT)."] ".$expl[$i]; |
} |
?> |
<!-- <script> |
scrollto(0,2048); |
</script> --> |
/trunk/private/old_messenger/messages.txt |
---|
___________________________________________________________________ |
Added: svn:mime-type |
## -0,0 +1 ## |
+text/plain |
\ No newline at end of property |