Hide url blogs from selection field in the rcc
This commit is contained in:
parent
623395064f
commit
00d3149360
2 changed files with 42 additions and 10 deletions
|
@ -124,8 +124,10 @@ if ($config["rcc"]["rcc"] == "on") {
|
||||||
$blogs = scandir("../blogs/");
|
$blogs = scandir("../blogs/");
|
||||||
foreach ($blogs as $blog) {
|
foreach ($blogs as $blog) {
|
||||||
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
|
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
|
||||||
$blog = substr($blog, 0, -3);
|
if (BlogListGenerator::getExternalLink($blog, '../') == null) {
|
||||||
echo "<option value='$blog'>$blog</option>";
|
$blog = substr($blog, 0, -3);
|
||||||
|
echo "<option value='$blog'>$blog</option>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -149,8 +151,10 @@ if ($config["rcc"]["rcc"] == "on") {
|
||||||
$blogs = scandir("../blogs/");
|
$blogs = scandir("../blogs/");
|
||||||
foreach ($blogs as $blog) {
|
foreach ($blogs as $blog) {
|
||||||
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
|
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
|
||||||
$blog = substr($blog, 0, -3);
|
if (BlogListGenerator::getExternalLink($blog, '../') == null) {
|
||||||
echo "<option value='$blog'>$blog</option>";
|
$blog = substr($blog, 0, -3);
|
||||||
|
echo "<option value='$blog'>$blog</option>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -197,8 +201,10 @@ if ($config["rcc"]["rcc"] == "on") {
|
||||||
$blogs = scandir("../blogs/");
|
$blogs = scandir("../blogs/");
|
||||||
foreach ($blogs as $blog) {
|
foreach ($blogs as $blog) {
|
||||||
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
|
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
|
||||||
$blog = substr($blog, 0, -3);
|
if (BlogListGenerator::getExternalLink($blog, '../') == null) {
|
||||||
echo "<option value='$blog'>$blog</option>";
|
$blog = substr($blog, 0, -3);
|
||||||
|
echo "<option value='$blog'>$blog</option>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -220,8 +226,10 @@ if ($config["rcc"]["rcc"] == "on") {
|
||||||
$blogs = scandir("../blogs/");
|
$blogs = scandir("../blogs/");
|
||||||
foreach ($blogs as $blog) {
|
foreach ($blogs as $blog) {
|
||||||
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
|
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
|
||||||
$blog = substr($blog, 0, -3);
|
if (BlogListGenerator::getExternalLink($blog, '../') == null) {
|
||||||
echo "<option value='$blog'>$blog</option>";
|
$blog = substr($blog, 0, -3);
|
||||||
|
echo "<option value='$blog'>$blog</option>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -251,8 +259,10 @@ if ($config["rcc"]["rcc"] == "on") {
|
||||||
$blogs = scandir("../blogs/");
|
$blogs = scandir("../blogs/");
|
||||||
foreach ($blogs as $blog) {
|
foreach ($blogs as $blog) {
|
||||||
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
|
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") {
|
||||||
$blog = substr($blog, 0, -3);
|
if (BlogListGenerator::getExternalLink($blog, '../') == null) {
|
||||||
echo "<option value='$blog'>$blog</option>";
|
$blog = substr($blog, 0, -3);
|
||||||
|
echo "<option value='$blog'>$blog</option>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -112,4 +112,26 @@ class BlogListGenerator
|
||||||
return $i;
|
return $i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function returning the external linkn of
|
||||||
|
* a blog.
|
||||||
|
*
|
||||||
|
* @param string $blog the blog name
|
||||||
|
* @param string $dir root directory of installation
|
||||||
|
*
|
||||||
|
* @return string link to external page else null
|
||||||
|
*/
|
||||||
|
public function getExternalLink($blog, $dir)
|
||||||
|
{
|
||||||
|
$path = $dir . "/blogs/" . $blog;
|
||||||
|
$blog = file_get_contents($path) . "\n";
|
||||||
|
if (substr($blog, 0, 6) == "%TITLE") {
|
||||||
|
$blog = substr($blog, strpos($blog, "\n") + 1);
|
||||||
|
}
|
||||||
|
if (substr($blog, 0, 4) == "%URL") {
|
||||||
|
return substr($blog, 6, strpos($blog, "\n") - 6);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue