/usr/share/htcheck/php/include/functions.inc.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 | <?php
// include/functions.inc.php
// General functions
//
// Part of the ht://Check package
//
// Copyright (c) 1999-2004 Comune di Prato - Prato - Italy
// Author: Gabriele Bartolini - Prato - Italy <angusgb@users.sourceforge.net>
//
// 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: functions.inc.php,v 1.13 2004/06/29 11:00:39 angusgb Exp $
if ( defined( '__FUNCTIONS_INC' ) ) return;
define( '__FUNCTIONS_INC', 1 );
include ("./include/global.inc.php");
// Get the translation table for characters
$XSS_table = get_html_translation_table(HTML_ENTITIES);
$XSS_table['('] = '(';
$XSS_table[')'] = ')';
// Function for XSS safe writing (www.cgisecurity.com)
function WriteHTML($str)
{
global $XSS_table;
return strtr($str, $XSS_table);
}
function DisplayErrMsg($errmsg)
{
?>
<B><?php echo WriteHTML($errmsg); ?></B><BR>
<?php
}
///////
// Page Management
///////
function WritePageLink($initpage,$pagesize,$count,$dbname,$otherinfo="")
{
if ($count !=0)
{
$nextoffset=$initpage+$pagesize;
$pag=ceil($count/$pagesize);
$numpag = floor(($initpage * $pag)/$count) +1;
$justone=false;
global $PHP_SELF;
global $strNext;
global $strPrevious;
global $strAll;
if ($pag >= 1)
{
$justone=true;
if ($initpage != 0)
{
// Show the first page Link
global $strFirst;
?>
| <A href="<?php echo $PHP_SELF; ?>?dbname=<?php echo $dbname; ?>&initpage=0&pagesize=<?php echo $pagesize; ?>&count=<?php echo $count; ?><?php echo $otherinfo; ?>"><?php echo $strFirst; ?></A>
<?php
}
$i = $numpag - 4;
if ($i < 1)
$i = 1;
for (; $i < $numpag; ++$i)
{
?>
| <a href="<?php echo $PHP_SELF; ?>?dbname=<?php echo $dbname; ?>&initpage=<?php echo $pagesize * ($i - 1); ?>&pagesize=<?php echo $pagesize; ?>&count=<?php echo $count; ?><?php echo $otherinfo; ?>">
<?php echo $i; ?></a>
<?php
}
}
if ($pag > 1)
{
echo ' | <strong>' . $numpag . '</strong>';
}
else
$justone=false;
if ($count > ($initpage + $pagesize))
{
$max = $numpag + 4;
if ($max > $pag)
$max = $pag;
for ($i = $numpag + 1; $i <= $max ; ++$i)
{
?>
| <A href="<?php echo $PHP_SELF; ?>?dbname=<?php echo $dbname; ?>&initpage=<?php echo $pagesize * ($i - 1); ?>&pagesize=<?php echo $pagesize; ?>&count=<?php echo $count; ?><?php echo $otherinfo; ?>">
<?php echo $i; ?></A><?php
}
global $strLast;
$lastoffset=((int)((int)($count-1)/$pagesize))*$pagesize;
?>
| <A href="<?php echo $PHP_SELF; ?>?dbname=<?php echo $dbname; ?>&initpage=<?php echo $lastoffset; ?>&pagesize=<?php echo $pagesize; ?>&count=<?php echo $count; ?><?php echo $otherinfo; ?>"><?php echo $strLast; ?></A>
<?php
}
if ($justone)
{
echo " | ";
if ($pag > 1)
{
// Show the full list Link
?>
<a href="<?php echo $PHP_SELF; ?>?dbname=<?php echo $dbname; ?>&initpage=0&pagesize=<?php echo $count; ?>&count=<?php echo $count; ?><?php echo $otherinfo; ?>"><?php echo $strAll; ?></a>
<?php
}
}
}
}
function GetTextString($str)
{
if (empty($str))
$str='Unknown';
$str2 = "\$str" . (string) $str;
eval("global $str2;");
eval("\$tmp=$str2;");
return $tmp;
}
function GetURL($url)
{
global $MaxURLStrLength;
if ($MaxURLStrLength > 0 && strlen($url) > $MaxURLStrLength)
return WriteHTML(substr($url, 0, $MaxURLStrLength) . '[...]');
else return WriteHTML($url);
}
?>
|