This file is indexed.

/usr/share/stacks/php/index.php is in stacks-web 2.0Beta8c+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
//
// Copyright 2010-2016, Julian Catchen <jcatchen@illinois.edu>
//
// This file is part of Stacks.
//
// Stacks is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Stacks is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Stacks.  If not, see <http://www.gnu.org/licenses/>.
//
require_once("header.php");

$database = isset($_GET['db']) ? $_GET['db'] : "";

if (strlen($database) == 0)
    write_database_list($database);
else
    write_database($database);

function write_database_list($database) {
    global $db_user, $db_pass, $db_host, $root_path, $img_path, $mysql_bin;

    $databases = array();

    exec("$mysql_bin --user=$db_user --password=$db_pass -h $db_host -N -B -e \"SHOW DATABASES LIKE '%_radtags'\"", $databases);

    $page_title = "Stacks Databases";
    write_header($page_title);

    echo <<< EOQ
<h4 class="info_head">
  <img id="sources_img" src="$img_path/caret-d.png" />
  <a onclick="toggle_div('sources', '$img_path', 'page_state');">Stacks Databases</a>
</h4>

<a name="results_top"></a>
<table class="db" style="width: 35%;">
<tr>
  <th style="width: 100%;">Database</th>
</tr>

EOQ;

    foreach ($databases as $dbase) {
        print
            "<tr>\n" .
            "  <td><a href=\"$root_path/index.php?db=" . $dbase . "\">$dbase</a></td>\n" .
            "</tr>\n";
    }

    echo <<< EOQ
</table>

EOQ;

    write_footer();
}

function write_database($database) {
    global $root_path, $img_path;

    //
    // Connect to the database
    //
    $db = db_connect($database);

    //
    // Prepare some SQL queries
    //
    $query = 
        "SELECT id, date, description, type FROM batches";
    if (!($db['batch_sth'] = $db['dbh']->prepare($query)))
        write_db_error($db['dbh'], __FILE__, __LINE__);

    $page_title = "RAD-Tag Analyses";
    write_header($page_title);

    echo <<< EOQ
<h4 class="info_head">
  <img id="sources_img" src="$img_path/caret-d.png" />
  <a onclick="toggle_div('sources', '$img_path', 'page_state');">RAD-Tag Samples</a>
</h4>

<a name="results_top"></a>
<table class="db" style="width: 75%;">
<tr>
  <th style="width: 10%;">&nbsp;</th>
  <th style="width: 10%;">&nbsp;</th>
  <th style="width: 10%;">Batch ID</th>
  <th style="width: 10%;">Date</th>
  <th style="width: 10%;">Type</th> 
  <th style="width: 50%;">Description</th>
</tr>

EOQ;

    if (!$db['batch_sth']->execute())
	write_db_error($db['batch_sth'], __FILE__, __LINE__);
    $res = $db['batch_sth']->get_result();

    while ($row = $res->fetch_assoc()) {
        print
            "<tr>\n" .
            "  <td class=\"s\"><a href=\"$root_path/catalog.php?db=$database&id=$row[id]\">Catalog</a></td>\n" .
            "  <td class=\"s\"><a href=\"$root_path/samples.php?db=$database&id=$row[id]\">Samples</a></td>\n" .
            "  <td>" . $row['id'] . "</td>\n" .
            "  <td>" . $row['date'] . "</td>\n" .
            "  <td>" . $row['type'] . "</td>\n" .
            "  <td>" . $row['description'] . "</td>\n" .
            "</tr>\n";
    }

    echo <<< EOQ
</table>

EOQ;

    write_footer();
}
 
?>