Displaying flag, notify, vote and file requet buttons for users which did not authenticate themselves and letting those fake buttons link to the login page. Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com> --- web/template/pkg_details.php | 37 +++++++++++++++++++++++++++++++++++++ web/template/pkgbase_details.php | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php index c1c07ba..fdb0a6c 100644 --- a/web/template/pkg_details.php +++ b/web/template/pkg_details.php @@ -88,6 +88,7 @@ $sources = pkg_sources($row["ID"]); <li><a href="<?= $cgit_uri . $row['BaseName'] . '.git' ?>/snapshot/master.tar.gz"><?= __('Download snapshot') ?></a></li> <li><a href="https://wiki.archlinux.org/index.php/Special:Search?search=<?= urlencode($row['Name']) ?>"><?= __('Search wiki') ?></a></li> <li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li> + <?php if ($uid): ?> <?php if ($row["OutOfDateTS"] === NULL): ?> <li> @@ -143,6 +144,42 @@ $sources = pkg_sources($row["ID"]); <li><a href="<?= get_pkgbase_uri($row['BaseName']) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li> <li><a href="<?= get_pkgbase_uri($row['BaseName']) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li> <?php endif; ?> + <?php else: ?> + <?php if ($row["OutOfDateTS"] === NULL): ?> + <li> + <?php if (config_get_bool('options', 'disable_http_login') && empty($_SERVER['HTTPS'])): ?> + <form action="<?= get_uri('/login/', true); ?>" method="post"> + <?php else: ?> + <form action="<?= get_uri('/login/'); ?>" method="post"> + <?php endif; ?> + <input type="submit" class="button text-button" name="do_Flag" value="<?= __('Flag package out-of-date') ?>" /> + </form> + </li> + <?php endif; ?> + <li> + <?php if (config_get_bool('options', 'disable_http_login') && empty($_SERVER['HTTPS'])): ?> + <form action="<?= get_uri('/login/', true); ?>" method="post"> + <?php else: ?> + <form action="<?= get_uri('/login/'); ?>" method="post"> + <?php endif; ?> + <input type="submit" class="button text-button" name="do_Vote" value="<?= __('Vote for this package') ?>" /> + </form> + </li> + <li> + <?php if (config_get_bool('options', 'disable_http_login') && empty($_SERVER['HTTPS'])): ?> + <form action="<?= get_uri('/login/', true); ?>" method="post"> + <?php else: ?> + <form action="<?= get_uri('/login/'); ?>" method="post"> + <?php endif; ?> + <input type="submit" class="button text-button" name="do_Notify" value="<?= __('Notify of new comments') ?>" /> + </form> + </li> + <li><span class="flagged"><?php if ($row["RequestCount"] > 0) { echo _n('%d pending request', '%d pending requests', $row["RequestCount"]); } ?></span></li> + <?php if (config_get_bool('options', 'disable_http_login') && empty($_SERVER['HTTPS'])): ?> + <li><a href="<?= get_uri('/login/', true); ?>"><?= __('File Request'); ?></a></li> + <?php else: ?> + <li><a href="<?= get_uri('/login/'); ?>"><?= __('File Request'); ?></a></li> + <?php endif; ?> <?php endif; ?> <?php if ($uid && $row["MaintainerUID"] === NULL): ?> diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php index 98a7219..d11e0e3 100644 --- a/web/template/pkgbase_details.php +++ b/web/template/pkgbase_details.php @@ -39,6 +39,7 @@ $pkgs = pkgbase_get_pkgnames($base_id); <li><a href="<?= $cgit_uri . $row['Name'] . '.git' ?>/snapshot/master.tar.gz"><?= __('Download snapshot') ?></a></li> <li><a href="https://wiki.archlinux.org/index.php/Special:Search?search=<?= urlencode($row['Name']) ?>"><?= __('Search wiki') ?></a></li> <li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li> + <?php if ($uid): ?> <?php if ($row["OutOfDateTS"] === NULL): ?> <li> @@ -94,6 +95,42 @@ $pkgs = pkgbase_get_pkgnames($base_id); <li><a href="<?= get_pkgbase_uri($row['Name']) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li> <li><a href="<?= get_pkgbase_uri($row['Name']) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li> <?php endif; ?> + <?php else: ?> + <?php if ($row["OutOfDateTS"] === NULL): ?> + <li> + <?php if (config_get_bool('options', 'disable_http_login') && empty($_SERVER['HTTPS'])): ?> + <form action="<?= get_uri('/login/', true); ?>" method="post"> + <?php else: ?> + <form action="<?= get_uri('/login/'); ?>" method="post"> + <?php endif; ?> + <input type="submit" class="button text-button" name="do_Flag" value="<?= __('Flag package out-of-date') ?>" /> + </form> + </li> + <?php endif; ?> + <li> + <?php if (config_get_bool('options', 'disable_http_login') && empty($_SERVER['HTTPS'])): ?> + <form action="<?= get_uri('/login/', true); ?>" method="post"> + <?php else: ?> + <form action="<?= get_uri('/login/'); ?>" method="post"> + <?php endif; ?> + <input type="submit" class="button text-button" name="do_Vote" value="<?= __('Vote for this package') ?>" /> + </form> + </li> + <li> + <?php if (config_get_bool('options', 'disable_http_login') && empty($_SERVER['HTTPS'])): ?> + <form action="<?= get_uri('/login/', true); ?>" method="post"> + <?php else: ?> + <form action="<?= get_uri('/login/'); ?>" method="post"> + <?php endif; ?> + <input type="submit" class="button text-button" name="do_Notify" value="<?= __('Notify of new comments') ?>" /> + </form> + </li> + <li><span class="flagged"><?php if ($row["RequestCount"] > 0) { echo _n('%d pending request', '%d pending requests', $row["RequestCount"]); } ?></span></li> + <?php if (config_get_bool('options', 'disable_http_login') && empty($_SERVER['HTTPS'])): ?> + <li><a href="<?= get_uri('/login/', true); ?>"><?= __('File Request'); ?></a></li> + <?php else: ?> + <li><a href="<?= get_uri('/login/'); ?>"><?= __('File Request'); ?></a></li> + <?php endif; ?> <?php endif; ?> <?php if ($uid && $row["MaintainerUID"] === NULL): ?> -- 2.4.2