File: sections.php

package info (click to toggle)
tetex-base 3.0.dfsg.3-5etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 239,592 kB
  • ctags: 10,610
  • sloc: xml: 103,461; perl: 9,398; ruby: 2,850; python: 1,551; php: 1,067; sh: 981; lisp: 494; makefile: 371; awk: 88
file content (81 lines) | stat: -rw-r--r-- 1,859 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- License: public domain.
     Distribution: http://lcr.math.ist.utl.pt/texdoc-php/ 
     Author: Joao P Matos jmatos@math.ist.utl.pt -->
<head>
<title>Sections</title>
<?php
include("css.php");
?>
</head>
<body>
<h3>Sections</h3>
<table>
<?php

include("config.php");

### Changes should make possible to use an arbitrary set of texmf trees

### Detecting the absolute location of this script both 
### in the file system and url space

$ourfs = dirname($_SERVER['SCRIPT_FILENAME']);
$oururl = dirname($_SERVER['PHP_SELF']);

##### Parse the texdoc data files


$numsec=0;
$query = "";
if ( $_SERVER['QUERY_STRING'] <> "" )
{
  $query= "&amp;" . $_SERVER['QUERY_STRING'];
}
while (list( $treekey, $treepath) = each($texmftrees['fs']))
{
  if ($_GET[$treekey] <> "no")
    {
      if ($treekey == "local")
	{
	  $class = " class=\"local\" ";
	}
      else
	{
	  $class = "";
	}
      $texdocdat=$treepath . "texdoctk/" . $texmftrees['datname'][$treekey] ;
      if (file_exists($texdocdat))
	{
	  $row = 0;
	  $handle = fopen ($texdocdat,"r");
	  while ($data[$row] = fgetcsv ($handle, 1000, ";")) 
	    {
	      if ( strpos($data[$row][0],"#") === false )
		{
		  if ( count($data[$row]) == 1 )
		    {
#### Check for repeated section names
#### likely with more than one data file
		      $sectionname = str_replace("@", "", $data[$row][0]);
		      if (! $section or ! in_array($sectionname, $section))
			{
			  $section[$numsec] = $sectionname;
			  echo "<tr><td><a  " . $class . " href=\"items.php?section=" . $section[$numsec] . $query . "\" target=\"items\">" . $section[$numsec] . "</a></td></tr>\n";
			  $numsec=$numsec+1;
			}
		    }
		}
	      $row++;
	    }
	  fclose ($handle);
	}
    }
}

?>
</table>
</body>
</html>