// distinct base IP addresses.
function IPv4NetworkCmp ($netA, $netB)
{
- return bccomp ("${netA['db_first']}", "${netB['db_first']}");
+// return bccomp ("${netA['db_first']}", "${netB['db_first']}");
+ // There's a problem just substracting one u32 integer from another,
+ // because the result may happen big enough to become a negative i32
+ // integer itself (PHP tries to cast everything it sees to signed int)
+ if ($netA['db_first'] > $netB['db_first'])
+ return 1;
+ elseif ($netA['db_first'] < $netB['db_first'])
+ return -1;
+ else
+ return 0;
}
// Modify the given tag tree so, that each level's items are sorted alphabetically.
$image['find']['path'] = 'pix/tango-system-search.png';
$image['find']['width'] = 16;
$image['find']['height'] = 16;
-$image['spacer']['path'] = 'pix/pixel.png';
-$image['spacer']['width'] = 16;
-$image['spacer']['height'] = 16;
$image['next']['path'] = 'pix/tango-go-next.png';
$image['next']['width'] = 32;
$image['next']['height'] = 32;
function renderTagRowForViewer ($taginfo, $level = 0)
{
+ if (!count ($taginfo['kids']))
+ $level++; // Shift instead of placing a spacer. This won't impact any nested nodes.
echo "<tr><td align=left style='padding-left: " . ($level * 16) . "px;'>";
if (count ($taginfo['kids']))
printImageHREF ('node-expanded-static');
- else
- printImageHREF ('spacer');
echo '<span title="id = ' . $taginfo['id'] . '">';
echo $taginfo['tag'] . '</span>';
echo "</td></tr>\n";
function renderTagRowForCloud ($taginfo, $realm, $level = 0)
{
global $root;
- echo '<tr><td align=left>';
- for ($i = 0; $i < $level; $i++)
- printImageHREF ('spacer');
+ echo "<tr><td align=left style='padding-left: " . ($level * 16) . "px;'>";
echo "<a href='${root}?page=objgroup&group_id=0&tagfilter[]=${taginfo['id']}'>";
echo $taginfo['tag'] . '</a>';
if (isset ($taginfo['refcnt'][$realm]))
function renderTagRowForEditor ($taginfo, $level = 0)
{
global $root, $pageno, $tabno, $taglist;
+ if (!count ($taginfo['kids']))
+ $level++; // Idem
echo "<tr><td align=left style='padding-left: " . ($level * 16) . "px;'>";
if (count ($taginfo['kids']))
printImageHREF ('node-expanded-static');
- else
- printImageHREF ('spacer');
$nrefs = 0;
foreach ($taginfo['refcnt'] as $part)
$nrefs += $part;
imagedestroy ($img);
}
-function renderAccessDeniedImage ()
-{
- $img = imagecreatefrompng ('pix/pixel.png');
- header("Content-type: image/png");
- imagepng ($img);
- imagedestroy ($img);
-}
-
// Having a local caching array speeds things up. A little.
function colorFromHex ($image, $hex)
{
imagedestroy ($img);
}
+function renderAccessDeniedImage ()
+{
+ $img = @imagecreatetruecolor (1, 1);
+ imagefilledrectangle ($img, 0, 0, 1, 1, colorFromHex ($img, '000000'));
+ header("Content-type: image/png");
+ imagepng ($img);
+ imagedestroy ($img);
+}
+
?>