This file is indexed.

/usr/share/htcheck/php/qryachecks.php is in htcheck-php 1:2.0.0~rc1-2.

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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
<?php

//    qryachecks.php
//    Shows a List of accessibility checks
//
//    Part of the ht://Check package
//
//    Copyright (c) 1999-2004 Comune di Prato - Prato - Italy
//    Author: Valentina Del Sapio - Prato - Italy
//
//    For copyright details, see the file COPYING in your distribution
//    or the GNU General Public License version 2 or later 
//    <http://www.gnu.org/copyleft/gpl.html>
//
//    $Id: qryachecks.php,v 1.5 2004/06/11 11:26:45 angusgb Exp $

///////
   //    Global settings
///////

include ("./include/global.inc.php");


if (!isset($dbname))
{
   // Error
   DisplayErrMsg($strErrorNoDBSelected);
   echo "<a href=\"index.php\">" . $strMainPage . "</A>";
   die;
}

$strSection=$strListAchecks;
$pagetitle = "Database: $dbname - " . $strSection;
eval("\$strhome = \"$strDBHome \";");
$linkbar = "<a href=\"index.php?dbname=". $dbname . "\">". $strhome."</A>";

// A database has been selected

include ("./include/header.inc.php");

if (isset ($cmd))
{

   if (!isset($initpage))
      $initpage=0;

   if (!isset($pagesize))
      $pagesize=30;

   $otherinfo = '&cmd=' . urlencode($cmd);
   $strwhere = " WHERE 1 ";
   
   if (isset($doctype) && $doctype!="AllDocTypes")
   {
      if ($doctype == 'NULL')
      {
         if ($whatdoctype == '!=')
            $whatdoctypetmp = 'not';
         $strwhere = $strwhere . " AND Url.DocType is $whatdoctypetmp $doctype ";
      }
      else
      {
         $strwheretmp = "Url.DocType $whatdoctype '$doctype'";
         if ($whatcharset == '!=')
            $strwhere .= " AND ($strwheretmp OR Url.DocType is NULL) ";
         else
            $strwhere .= " AND $strwheretmp ";
      }

      $otherinfo = $otherinfo . '&whatdoctype=' . urlencode($whatdoctype)
         . '&doctype=' . urlencode($doctype);
   }

   $num=count($url); // Count the elements

   // Set the URL filter   
   for ($i=0; $i<$num; $i++)
   {
      if (isset($url[$i]) && $url[$i] && strlen($url[$i]) > 0)
      {
         if(isset($whaturl[$i]))
         {
            $strwhere = $strwhere . " AND Url.Url " . $whaturl[$i]
               . " '" . $url[$i] . "' ";
            $otherinfo = $otherinfo . "&whaturl[$i]=" . urlencode($whaturl[$i])
               . "&url[$i]=" . urlencode ($url[$i]);
          }
      }
   }

   $num=count($acheckcode); // Count the elements

   // Set the Accessibility Code filter   
   // Codice dell'errore di accessibilità
   if (isset($acheckcode))
   {
      $strwhere .= " AND (";
      $a = 0;
      while (list($chiave, $valore) = each($acheckcode))
      {
         $a++;
         $strwhere .= " Accessibility.Code = $acheckcode[$chiave] ";
         $otherinfo .= "&acheckcode[$chiave]=" . $chiave;

         if ($a < $num)
            $strwhere .= " OR ";
         else
            $strwhere .= ") ";
      }
   }

   // Server
   if (!empty($server))
   {
      $strwhere .= " AND Url.IDServer = $server ";
      $otherinfo .= "&server=$server";
   }

   $strwhere .= " AND Url.IDUrl = Accessibility.IDUrl ";

   // Show all the URLs, retrieved ones as well as not
   $strGenSQL = "SELECT Accessibility.*, Statement, Url FROM Url, Accessibility "
      . "LEFT JOIN HtmlStatement USING (IDUrl, TagPosition) "
      . $strwhere
      . " ORDER BY Url.Url ASC"
      . " LIMIT " . $initpage . ", " . $pagesize;

   if (!isset($count))
   {
      $strCountSQL="select count(*) from Url, Accessibility "
         . "LEFT JOIN HtmlStatement USING (IDUrl, TagPosition) "
         . $strwhere;

      $count = $MyDB->CountEntries($strCountSQL,$dbname,true);
      if ($count<0)
      {
         DisplayErrMsg($MyDB->errmsg);
         return;
      }
      $MyDB->Free();
   }

// HTTP results
   
?>

<h4><?php echo $strSection; ?></h4>
<p>
<?
if ($count) printf ($strListPageInfo, number_format($initpage+1), number_format(($initpage+$pagesize)>$count?$count:$initpage+$pagesize), number_format($count));
?>  
<br>
<?php WritePageLink($initpage, $pagesize, $count, $dbname, $otherinfo); ?>
</p>

<?php

   $result=$MyDB->Query($dbname, $strGenSQL);
   
   if ($result)
   {
      DisplayErrMsg($MyDB->errmsg);
      die;
   }
   
   if ($MyDB->NumRows())
   {
      // At least one occurrence found
?>

<table>
<tr>
<th> N. </th>
<th> ID </th>
<th> Url \ <?php echo $strHTMLStatement; ?> </th>
<th> <?php echo $strAcheckError; ?> </th>
</tr>
      
<?php
      $i=0;
      while ($row = $MyDB->FetchArray())
      {
         // Get next row
         $i++;
         ($i % 2)? $trclass='odd':$trclass='even';
?>
<tr class="<?php echo $trclass; ?>">
   <td align="right"> <?php echo number_format($initpage+$i); ?> </td>
   <td align="right"> <?php echo number_format($row["IDUrl"]); ?> </td>
   <td class="url">
	<a href="showurl.php?dbname=<?php echo $dbname; ?>&IDUrl=<?php echo $row['IDUrl']; ?>"><?php echo GetURL($row['Url']); ?></a>
   <?php
   // HTML Statement
   if ($row['Statement'])
   { ?>
	   <br><strong><?php echo $strHTMLStatement; ?></strong>: &lt;<?php 
	   echo WriteHTML($row['Statement']); ?>&gt;<br>
	   <?php
   }
   ?>
   </td>
   <td align="center">
	<a href="./showacheck.php?dbname=<?php echo $dbname; ?>&IDUrl=<?php echo $row["IDUrl"]; ?>&TagPosition=<?php echo $row['TagPosition']; ?>&AttrPosition=<?php echo $row['AttrPosition']; ?>&acheckcode=<?php echo $row['Code']; ?>"><?php echo $strAchecks[$row['Code']]['error']; ?></a>
   </td>
</tr>
<?php         
      }

?>
</table>
<?php      
      // Page management

      WritePageLink($initpage, $pagesize, $count, $dbname,$otherinfo);
   }
   else
   {
?>
<p><?php echo $strNoOccurrencies; ?></p>

<?php
   }

   $MyDB->Free();

}
else
{
?>
<p><?php echo $strFilterUrls; ?>:</p>

<form action="<?php echo $PHP_SELF; ?>" method="GET">
<input type="hidden" name="dbname" value="<?php echo $dbname; ?>">
<table>

<tr>
<th>
  <?php echo $strUrl; ?> : 
</th>
</tr>

<?php 
$strSQL = "SELECT DISTINCT s.IDServer, s.Server FROM Accessibility a JOIN Url u USING (IDUrl) JOIN Server s USING (IDServer) ORDER BY Server ASC";
$result=$MyDB->Query($dbname, $strSQL);
if ($result == 0)
{
 ?>
<tr>
<td>
<label for="server"><strong><?php echo $strServer; ?></strong></label> :
 <select name="server" id="server">
 <option value="">--- <?php echo $strServer; ?> ---</option><?php
   if ($MyDB->NumRows())
   {
      $i=0;
      while ($row = $MyDB->FetchArray())
      {
        $i++;
        ?>
 <option value="<?php echo $row['IDServer']; ?>" <?php
        if ($server == $row['IDServer'])
           echo " selected";
        ?>><?php echo $row['Server']; ?></option>
 <?php
      }
      $MyDB->Free();
   }
   ?>
 </select>
</td>
</tr><?php
}

   for ($i=0; $i<$NumFilterRows; $i++)
   {
?>

<tr>
<td>
<select name="whaturl[<?php echo $i; ?>]">
 <option value="LIKE"><?php echo $strLike; ?></option>
 <option value="NOT LIKE"><?php echo $strNotLike; ?></option>
 <option value="REGEXP"><?php echo $strRegExp; ?></option>
 <option value="NOT REGEXP"><?php echo $strNotRegExp; ?></option>
</select>
<input name="url[<?php echo $i; ?>]" type="text" value="<?php echo $url[$i]; ?>"
   size="30" maxlength="255">
</td>
</tr>
<?php
   }

   // Retrieving all the DocTypes found
   $strSQL="SELECT count(*) as Count, DocType "
      . "FROM Url, Accessibility "
      . "WHERE Url.IDUrl = Accessibility.IDUrl "
      . "GROUP BY DocType "
      . "ORDER BY DocType ASC";

   $result=$MyDB->Query($dbname, $strSQL);
   
   if ($result)
   {
      DisplayErrMsg($MyDB->errmsg);
      die;
   }
   
   if ($MyDB->NumRows())
   {

?>
<tr>
<td>
<label for="whatdoctype"><strong><?php echo $strDocType; ?></strong></label> :
<select name="whatdoctype" id="whatdoctype">
 <option value="="><?php echo $strLike; ?></option>
 <option value="!="><?php echo $strNotLike; ?></option>
</select>
<select name="doctype">
 <option value="AllDocTypes"><?php echo $strAllDocTypes; ?></option>
<?php
      while ($row = $MyDB->FetchArray())
      {
          if (empty($row['DocType']))
          {
             $dt = 'NULL';
             $strdt = &$strNull;
          }
          else
          {
             $dt = &$row["DocType"];
             if ($dt == 'unknown')
                $strdt = &$strOther;
             else
                $strdt = &$dt;
          }
?>
 <option value="<?php echo $dt; ?>">
   <?php echo $strdt; ?> (<?php echo $row["Count"]; ?>)</option>
<?php
      }
?>
</select>
</td>
</tr>
  <?php
   }
   $MyDB->Free();

   // Retrieving all the Check codes found
   $strSQL="SELECT count(*) as Count, Code "
      . "FROM Accessibility GROUP BY Code "
      . "ORDER BY Code ASC";

   $result=$MyDB->Query($dbname, $strSQL);
   
   if ($result)
   {
      DisplayErrMsg($MyDB->errmsg);
      die;
   }
   
   if ($MyDB->NumRows())
   {
?>
<tr>
<td>
<strong><?php echo $strSelectAchecks; ?></strong><br> 
<?php
      while ($row = $MyDB->FetchArray())
      { 
		$code = $row['Code'];
?>
	<input type="checkbox" name="acheckcode[<?php echo $code; ?>]" value="<?php echo $code; ?>"
	  title="<?php echo $strAcheckCode . " " . $code; ?>" id="acheckcode[<?php echo $code; ?>]">
        <label for="acheckcode[<?php echo $code; ?>]"><?php echo $strAchecks[$code]['error']; ?> (<?php echo $row['Count']; ?>)</label><br>
<?php
      } ?> 
</td>
</tr>
<?php
   }
   $MyDB->Free();
?>

<tr>
<td align="right">
  <input type="submit" name="cmd" value="<?php echo $strLinkSubmit; ?>">
</td>
</tr>
</form>
</table>

<p align="justify">
  <?php echo $strHelpOnString; ?>
</p>
<p align="justify">
  <?php echo $strHelpOnRegExp; ?>
</p>

<?php
}
?>
<br>
<?php include ("./include/footer.inc.php"); ?>