53 lines
No EOL
1.8 KiB
PHP
53 lines
No EOL
1.8 KiB
PHP
<?php
|
|
if (!defined('SVRJS_MOD_DIRECTORY')) die;
|
|
include 'header.php';
|
|
?>
|
|
<section class="hero">
|
|
<div class="wrapper">
|
|
<h1>Expand SVR.JS functionality with mods</h1>
|
|
<p>SVR.JS Mods directory allows you to find SVR.JS mods to expand the functionality of your SVR.JS web server, and enhance your SVR.JS experience.</p>
|
|
<form action="<?php echo htmlspecialchars((URL_REWRITTEN ? APP_ROOT : APP_ROOT . APP_FILENAME . '/') . 'search') ?>" method="get" class="search-form">
|
|
<input type="text" name="q" placeholder="Search for SVR.JS mods...">
|
|
<input type="submit" value="Search">
|
|
</form>
|
|
</div>
|
|
</section>
|
|
<main class="content">
|
|
<h2 class="category-headline">Categories</h2>
|
|
<?php
|
|
$result = $connection->query("SELECT
|
|
categories.id AS id,
|
|
categories.name AS name,
|
|
categories.slug AS slug,
|
|
(
|
|
SELECT COUNT(mods.id)
|
|
FROM mods
|
|
JOIN users ON users.id = mods.user
|
|
WHERE mods.category = categories.id
|
|
AND mods.is_removed = 0
|
|
AND users.is_suspended = 0
|
|
AND users.is_verified = 1
|
|
AND users.is_deleted = 0
|
|
LIMIT 1
|
|
) AS count
|
|
FROM categories;");
|
|
if (!$result) {
|
|
echo "<p>An unexpected error occurred while fetching categories.</p>";
|
|
} else {
|
|
$categoriesPresent = false;
|
|
while ($category = $result->fetch_assoc()) {
|
|
$categoriesPresent = true;
|
|
echo '<div class="category">
|
|
<h3><a href="' . htmlspecialchars((URL_REWRITTEN ? APP_ROOT : APP_ROOT . APP_FILENAME . '/') . 'category/' . urlencode($category['slug'])) . '">' . htmlspecialchars($category['name']) . '</a></h3>
|
|
<p>Mods: ' . htmlspecialchars(number_format($category['count'], 0)) . '</p>
|
|
</div>';
|
|
}
|
|
if (!$categoriesPresent) {
|
|
echo '<p>No categories.</p>';
|
|
}
|
|
}
|
|
?>
|
|
</main>
|
|
<?php
|
|
include 'footer.php';
|
|
?>
|