Browse Source

allow non 200 codes in search results (page could be available in explore mode / snap cache) #10

main
ghost 7 months ago
parent
commit
400233bfe6
  1. 2
      example/environment/sphinx.conf
  2. 20
      src/public/explore.php
  3. 10
      src/public/search.php

2
example/environment/sphinx.conf

@ -41,7 +41,7 @@ source hostPage : common @@ -41,7 +41,7 @@ source hostPage : common
WHERE `hostPageDescription`.`hostPageId` = `hostPage`.`hostPageId`) AS `keywords` \
FROM `hostPage` \
JOIN `host` ON (`host`.`hostId` = `hostPage`.`hostId`) \
WHERE `hostPage`.`httpCode` = 200 AND `hostPage`.`timeBanned` IS NULL AND `hostPage`.`mime` IS NOT NULL \
WHERE `hostPage`.`httpCode` != 0 AND `hostPage`.`httpCode` IS NOT NULL AND `hostPage`.`mime` IS NOT NULL \
sql_attr_uint = rank
sql_attr_string = mime

20
src/public/explore.php

@ -192,7 +192,7 @@ $placeholder = Filter::plural($totalPages, [sprintf(_('Over %s page or enter the @@ -192,7 +192,7 @@ $placeholder = Filter::plural($totalPages, [sprintf(_('Over %s page or enter the
margin: 0 auto;
padding: 16px 0;
border-top: 1px #000 dashed;
font-size: 14px
font-size: 14px;
}
span {
@ -210,6 +210,10 @@ $placeholder = Filter::plural($totalPages, [sprintf(_('Over %s page or enter the @@ -210,6 +210,10 @@ $placeholder = Filter::plural($totalPages, [sprintf(_('Over %s page or enter the
font-size: 11px;
}
.text-warning {
color: #db6161;
}
</style>
</head>
<body>
@ -241,6 +245,14 @@ $placeholder = Filter::plural($totalPages, [sprintf(_('Over %s page or enter the @@ -241,6 +245,14 @@ $placeholder = Filter::plural($totalPages, [sprintf(_('Over %s page or enter the
</a>
</div>
<div>
<p><?php echo _('HTTP') ?></p>
<?php if ($hostPage->httpCode == 200) { ?>
<p><?php echo $hostPage->httpCode ?></p>
<?php } else { ?>
<p class="text-warning">
<?php echo $hostPage->httpCode ?>
</p>
<?php } ?>
<?php if (!empty($hostPage->mime)) { ?>
<p><?php echo _('MIME') ?></p>
<p><?php echo $hostPage->mime ?></p>
@ -287,6 +299,12 @@ $placeholder = Filter::plural($totalPages, [sprintf(_('Over %s page or enter the @@ -287,6 +299,12 @@ $placeholder = Filter::plural($totalPages, [sprintf(_('Over %s page or enter the
<img src="<?php echo WEBSITE_DOMAIN; ?>/file.php?type=identicon&query=<?php echo urlencode(str_replace(['[',']'], false, $host->name)) ?>" alt="identicon" width="16" height="16" class="icon" />
<?php echo htmlentities(urldecode($host->url) . (mb_strlen(urldecode($hostPage->uri)) > 28 ? '...' . mb_substr(urldecode($hostPage->uri), -28) : urldecode($hostPage->uri))) ?>
</a>
<?php if ($hostPage->httpCode != 200) { ?>
|
<span class="text-warning">
<?php echo $hostPage->httpCode ?>
</span>
<?php } ?>
|
<a href="<?php echo WEBSITE_DOMAIN; ?>/explore.php?hp=<?php echo $hostPage->hostPageId ?>">
<?php echo _('explore'); ?>

10
src/public/search.php

@ -285,6 +285,10 @@ if ($queueTotal = $memory->getByMethodCallback( @@ -285,6 +285,10 @@ if ($queueTotal = $memory->getByMethodCallback(
font-size: 11px;
}
.text-warning {
color: #db6161;
}
</style>
</head>
<body>
@ -330,6 +334,12 @@ if ($queueTotal = $memory->getByMethodCallback( @@ -330,6 +334,12 @@ if ($queueTotal = $memory->getByMethodCallback(
<img src="<?php echo WEBSITE_DOMAIN; ?>/file.php?type=identicon&query=<?php echo urlencode(str_replace(['[',']'], false, $host->name)) ?>" alt="identicon" width="16" height="16" class="icon" />
<?php echo htmlentities(urldecode($host->url) . (mb_strlen(urldecode($hostPage->uri)) > 28 ? '...' . mb_substr(urldecode($hostPage->uri), -28) : urldecode($hostPage->uri))) ?>
</a>
<?php if ($hostPage->httpCode != 200) { ?>
|
<span class="text-warning">
<?php echo $hostPage->httpCode ?>
</span>
<?php } ?>
|
<a href="<?php echo WEBSITE_DOMAIN; ?>/explore.php?hp=<?php echo $result->id ?>">
<?php echo _('explore'); ?>

Loading…
Cancel
Save