Add dockapps section.
[whome.git] / dockapps / index.php
blobc97fbf29ff0f043b8e16e3549b4e27dd4f3f02af
1 <?php
2 $dockapps = parse_ini_file("dockapps.db", true);
4 $name = $_GET["name"];
5 $category = $_GET["category"];
6 $download = $_GET["download"];
8 function getCategory($dockapp) {
9 return $dockapp["category"];
12 if ($download) {
13 $download=str_replace(" ", "+", $download);
14 preg_match("/([\w\-+.]+)-([\w+.]+).tar.gz/", $download, $matches);
15 header("Location: http://repo.or.cz/w/dockapps.git/snapshot/" .
16 $dockapps[$matches[1]]["version-$matches[2]"] . ".tar.gz");
17 die();
20 <html xmlns="http://www.w3.org/1999/xhtml">
21 <head>
22 <meta name="generator" content="HTML Tidy for Linux (vers 25 March 2009), see www.w3.org" />
24 <title>Window Maker: Dockapps</title>
25 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
26 <link href="../title.css" rel="stylesheet" type="text/css" />
27 </head>
28 <?php
29 echo "<body>\n";
30 include("../dock.php");
31 include("../header.php");?>
32 <div>
33 <table class="inner" border="0" cellpadding="1" cellspacing="1">
34 <tr>
35 <td content="content" colspan="2" valign="top">
36 <br />
37 <br />
38 <h1><a href=".">Dockapps</a></h1>
39 <?php
40 if ($name) {
41 echo "<h2>$name</h2>\n";
42 echo "<b>Category:</b> <a href=\"?category=" .
43 $dockapps[$name]["category"] . "\">" .
44 $dockapps[$name]["category"] .
45 "</a><br/>\n";
46 if ($dockapps[$name]["url"])
47 echo "<b>Website</b>: <a href=\"" . $dockapps[$name]["url"] .
48 "\">" . $dockapps[$name]["url"] . "</a><br/>\n";
49 echo "<b>Description:</b> " . nl2br($dockapps[$name]["description"]) .
50 "<br/>\n";
51 $images = explode(",", $dockapps[$name]["image"]);
52 if ($images) {
53 echo "<h3>Screenshots:</h3>\n";
54 foreach ($images as $image)
55 echo "<img src=\"img/$image\"/>\n";
57 echo "<h3>Available Versions:</h3>\n";
58 $versions = array();
59 $info = $dockapps[$name];
60 foreach ($info as $key => $value) {
61 if (substr($key, 0, 8) == "version-")
62 array_push($versions,
63 substr($key, strrpos($key, "-")+1));
65 rsort($versions);
66 foreach ($versions as $version) {
67 echo "<a href=\"?download=$name-$version.tar.gz\">" .
68 "$name-$version</a><br/>\n";
70 }?>
71 <p/>
72 <i>Note:</i> By default, the above tarballs will save as
73 dockapps-$string.tar.gz, where $string is a long string of hexadecimal
74 characters. You may wish to right click and use the <i>Save Link As...</i>
75 option.
77 <?php
78 } else if ($category) {
79 echo "<h2>$category</h2>\n";
80 $matches = array();
81 foreach ($dockapps as $dockapp => $info)
82 if ($info["category"] == $category)
83 array_push($matches, $dockapp);
84 sort($matches);
85 foreach ($matches as $dockapp)
86 echo "<a href=\"?name=" . urlencode($dockapp) .
87 "\">$dockapp</a><br/>\n";
89 } else {?>
90 Here you can download git snapshots of a number of Window Maker dockapps which
91 are no longer maintained by their original developers and have been adopted by
92 the Window Maker Developers Team. You can browse the repository itself at
93 <a href="http://repo.or.cz/dockapps.git">http://repo.or.cz/dockapps.git</a>.
94 <p/>
95 If you would like to submit a patch to an existing dockapp or add a new dockapp
96 to the repository, please follow <a href="http://repo.or.cz/w/wmaker-crm.git/blob/HEAD:/The-perfect-Window-Maker-patch.txt">these directions</a>.
98 <h2>Categories</h2>
99 <?php
100 $categories = array_unique(array_map("getCategory", $dockapps));
101 sort($categories);
102 foreach ($categories as $category)
103 echo "<a href=\"?category=$category\">$category</a><br/>\n";
105 </td>
106 </tr>
107 </table>
109 <?php
110 include("../footer.php");