[www] r793 - trunk/packs.matroska.org/data

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2004-11-16 19:38:27 +0300 (Tue, 16 Nov 2004)
New Revision: 793

Added:
   trunk/packs.matroska.org/data/helper.php
Removed:
   trunk/packs.matroska.org/data/links.txt
Modified:
   trunk/packs.matroska.org/data/download.php
   trunk/packs.matroska.org/data/index.php.de
   trunk/packs.matroska.org/data/index.php.en
   trunk/packs.matroska.org/data/index.php.fr
   trunk/packs.matroska.org/data/index.php.nl
   trunk/packs.matroska.org/data/index.php.pt
   trunk/packs.matroska.org/data/ircstats.php
   trunk/packs.matroska.org/data/showlog.php
Log:
hopefully the commit process will be safe this time...

Modified: trunk/packs.matroska.org/data/download.php
===================================================================
--- trunk/packs.matroska.org/data/download.php	2004-11-16 16:34:46 UTC (rev 792)
+++ trunk/packs.matroska.org/data/download.php	2004-11-16 16:38:27 UTC (rev 793)
@@ -3,7 +3,7 @@
 $logfilename = "logs.txt";
 
 // get the list of File/Location pairs
-include("links.txt");
+include("helper.php");
 
 if (($links <> "") && isset($_REQUEST["ver"]) && isset($_REQUEST["id"]))
 {
@@ -26,14 +26,23 @@
 	}
 
 	// Save Download Stats
-	$download = unserialize(safe_read_file($logfilename));
-	
-	// Make sure we opened the logfile correctly, otherwise we're gonna trash it
-	if (count($download) != 0)
+	$fp = fopen($logfilename,"r+");
+	if($fp)
 	{
-		$download[$version][$_REQUEST["id"]]++;
-		safe_write_file($logfilename,serialize($download));
-	}
+		if (flock($fp, LOCK_EX)) { // exclusive lock
+			$download = unserialize(fread($fp, filesize($file)));
+		
+			// Make sure we opened the logfile correctly, otherwise we're gonna trash it
+			if (count($download) != 0)
+			{
+				fseek($fp, 0);
+				$download[$version][$_REQUEST["id"]]++;
+				fwrite($fp, serialize($download));
+			}
+			flock($fp, LOCK_UN);
+		}
+		fclose($fp);
+	}    
 	
 	// Create New Header
 	header("Location: $link");    

Copied: trunk/packs.matroska.org/data/helper.php (from rev 792, trunk/packs.matroska.org/data/links.txt)
===================================================================
--- trunk/packs.matroska.org/data/links.txt	2004-11-16 16:34:46 UTC (rev 792)
+++ trunk/packs.matroska.org/data/helper.php	2004-11-16 16:38:27 UTC (rev 793)
@@ -0,0 +1,78 @@
+<?php
+
+$latest = "1.0.3";
+$stable = "1.0.2";
+
+// ----- 1.0.3 -----
+
+$links["1.0.3"]["Matroska_Pack_Full"] = "http://packs.matroska.org/packs/Matroska_Pack_Full_v1.0.3.exe";
+$links["1.0.3"]["Matroska_Pack_Lite"] = "http://packs.matroska.org/packs/Matroska_Pack_Lite_v1.0.3.exe";
+$links["1.0.3"]["Matroska_Pack_MPEG4"] = "http://packs.matroska.org/packs/Matroska_Pack_MPEG4_v1.0.3.exe";
+
+$filesize["1.0.3"]["Matroska_Pack_Full"] = 3416305;
+$filesize["1.0.3"]["Matroska_Pack_Lite"] = 768931;
+$filesize["1.0.3"]["Matroska_Pack_MPEG4"] = 2235499;
+
+$release["1.0.3"] = "2004-08-21";
+
+// ----- 1.0.2 -----
+
+$links["1.0.2"]["Matroska_Pack_Full"] = "http://christian.hj.wiesner.bei.t-online.de/packs/Matroska_Pack_Full_v1.0.2.exe";
+$links["1.0.2"]["Matroska_Pack_Lite"] = "http://christian.hj.wiesner.bei.t-online.de/packs/Matroska_Pack_Lite_v1.0.2.exe";
+$links["1.0.2"]["Matroska_Pack_MPEG4"] = "http://matroska.free.fr/packs/Matroska_Pack_MPEG4_v1.0.2.exe";
+
+$filesize["1.0.2"]["Matroska_Pack_Full"] = 2637117;
+$filesize["1.0.2"]["Matroska_Pack_Lite"] = 749170;
+$filesize["1.0.2"]["Matroska_Pack_MPEG4"] = 1498652;
+
+$release["1.0.2"] = "2004-04-01";
+
+// ----- 1.0.1 -----
+
+$links["1.0.1"]["Matroska_Pack_Full"] = "/packs/Matroska_Pack_Full_v1.0.1.exe";
+$links["1.0.1"]["Matroska_Pack_MPEG4"] = "/packs/Matroska_Pack_MPEG4_v1.0.1.exe";
+$links["1.0.1"]["Matroska_Pack_RealMedia"] = "/packs/Matroska_Pack_RealMedia_v1.0.1.exe";
+
+$filesize["1.0.1"]["Matroska_Pack_Full"] = 1745724;
+$filesize["1.0.1"]["Matroska_Pack_MPEG4"] = 1442829;
+$filesize["1.0.1"]["Matroska_Pack_RealMedia"] = 984972;
+
+$release["1.0.1"] = "2004-01-08";
+
+// ----- Some helper functions -----
+
+	function totalCount($packname) {
+		global $download;
+		
+	  $total = 0;	  	  
+    foreach ($download as $packversionstat) {
+	    $total += $packversionstat[$packname];
+	  }
+	  return $total;
+	}
+	
+	function printFileSizeShort($packversion,$packname) {
+	  global $filesize;
+	  echo round($filesize[$packversion][$packname] / 1024 / 1024, 2) . " MB";
+	}
+	
+	function printFileSize($packversion,$packname) {
+	  global $filesize;
+	  
+		echo round($filesize[$packversion][$packname] / 1024 / 1024, 2) . " MB";
+		echo " / ";
+		echo number_format($filesize[$packversion][$packname], 0, '.', '\'') . " Bytes";
+	}
+
+	function read_file($file)
+	{
+		$return = "";
+		$fp = fopen($file,"r");
+		if($fp)
+		{
+			$return = fread($fp, filesize($file));
+			fclose($fp);
+		}    
+		return $return;
+	}
+?>

Modified: trunk/packs.matroska.org/data/index.php.de
===================================================================
--- trunk/packs.matroska.org/data/index.php.de	2004-11-16 16:34:46 UTC (rev 792)
+++ trunk/packs.matroska.org/data/index.php.de	2004-11-16 16:38:27 UTC (rev 793)
@@ -1,6 +1,6 @@
 <?php
-	include("links.txt");
-	$download = unserialize(safe_read_file('logs.txt'));
+	include("helper.php");
+	$download = unserialize(read_file('logs.txt'));
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html>

Modified: trunk/packs.matroska.org/data/index.php.en
===================================================================
--- trunk/packs.matroska.org/data/index.php.en	2004-11-16 16:34:46 UTC (rev 792)
+++ trunk/packs.matroska.org/data/index.php.en	2004-11-16 16:38:27 UTC (rev 793)
@@ -1,6 +1,6 @@
 <?php	
-	include("links.txt");
-	$download = unserialize(safe_read_file('logs.txt'));
+	include("helper.php");
+	$download = unserialize(read_file('logs.txt'));
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html>

Modified: trunk/packs.matroska.org/data/index.php.fr
===================================================================
--- trunk/packs.matroska.org/data/index.php.fr	2004-11-16 16:34:46 UTC (rev 792)
+++ trunk/packs.matroska.org/data/index.php.fr	2004-11-16 16:38:27 UTC (rev 793)
@@ -1,6 +1,6 @@
 <?php
-	include("links.txt");
-	$download = unserialize(safe_read_file('logs.txt'));
+	include("helper.php");
+	$download = unserialize(read_file('logs.txt'));
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html>

Modified: trunk/packs.matroska.org/data/index.php.nl
===================================================================
--- trunk/packs.matroska.org/data/index.php.nl	2004-11-16 16:34:46 UTC (rev 792)
+++ trunk/packs.matroska.org/data/index.php.nl	2004-11-16 16:38:27 UTC (rev 793)
@@ -1,6 +1,6 @@
 <?php	
-	include("links.txt");
-	$download = unserialize(safe_read_file('logs.txt'));
+	include("helper.php");
+	$download = unserialize(read_file('logs.txt'));
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html>

Modified: trunk/packs.matroska.org/data/index.php.pt
===================================================================
--- trunk/packs.matroska.org/data/index.php.pt	2004-11-16 16:34:46 UTC (rev 792)
+++ trunk/packs.matroska.org/data/index.php.pt	2004-11-16 16:38:27 UTC (rev 793)
@@ -1,6 +1,6 @@
 <?php
-	include("links.txt");
-	$download = unserialize(safe_read_file('logs.txt'));
+	include("helper.php");
+	$download = unserialize(read_file('logs.txt'));
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html>

Modified: trunk/packs.matroska.org/data/ircstats.php
===================================================================
--- trunk/packs.matroska.org/data/ircstats.php	2004-11-16 16:34:46 UTC (rev 792)
+++ trunk/packs.matroska.org/data/ircstats.php	2004-11-16 16:38:27 UTC (rev 793)
@@ -3,8 +3,8 @@
 header("Content-Type: text/plain");
 
 $logfilename = "logs.txt";
-include("links.txt");
-$download = unserialize(safe_read_file($logfilename));
+include("helper.php");
+$download = unserialize(read_file($logfilename));
 
 $totalcount = 0;
 $totalsize = 0;

Deleted: trunk/packs.matroska.org/data/links.txt

Modified: trunk/packs.matroska.org/data/showlog.php
===================================================================
--- trunk/packs.matroska.org/data/showlog.php	2004-11-16 16:34:46 UTC (rev 792)
+++ trunk/packs.matroska.org/data/showlog.php	2004-11-16 16:38:27 UTC (rev 793)
@@ -3,7 +3,7 @@
 <pre>
 <?php
 $logfilename = "logs.txt";
-$download = unserialize(safe_read_file($logfilename));
+$download = unserialize(read_file($logfilename));
 print_r($download);
 ?>
 </pre>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.