mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Use an INI-style configuration file
Replace web/lib/config.inc.php with an INI-style configuration file. This allows us to get rid of several globals and makes it easier to use the same configuration file in external scripts. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
a0a5230708
commit
76343fb915
24 changed files with 200 additions and 216 deletions
|
@ -1,4 +1,4 @@
|
|||
<?php if (!$USE_VIRTUAL_URLS): ?>
|
||||
<?php if (!use_virtual_urls()): ?>
|
||||
<div class="box">
|
||||
<form action="<?= htmlspecialchars(get_pkg_uri($row['Name']), ENT_QUOTES); ?>" method="post">
|
||||
<fieldset>
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<li><a href="<?= get_uri('/logout/'); ?>"><?= __("Logout"); ?></a></li>
|
||||
<?php else: ?>
|
||||
<li><a href="<?= get_uri('/register/'); ?>"><?= __("Register"); ?></a></li>
|
||||
<?php if ($DISABLE_HTTP_LOGIN && empty($_SERVER['HTTPS'])): ?>
|
||||
<?php if (config_get_bool('options', 'disable_http_login') && empty($_SERVER['HTTPS'])): ?>
|
||||
<li><a href="<?= $AUR_LOCATION . get_uri('/login/'); ?>"><?= __("Login"); ?></a></li>
|
||||
<?php else: ?>
|
||||
<li><a href="<?= get_uri('/login/'); ?>"><?= __("Login"); ?></a></li>
|
||||
|
|
|
@ -21,7 +21,8 @@ $updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($r
|
|||
$submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["SubmittedTS"]));
|
||||
$out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($row["OutOfDateTS"]));
|
||||
|
||||
$urlpath = URL_DIR . substr($row['BaseName'], 0, 2) . "/" . $row['BaseName'];
|
||||
$package_url = config_get('options', 'package_url');
|
||||
$urlpath = $package_url . substr($row['BaseName'], 0, 2) . "/" . $row['BaseName'];
|
||||
|
||||
$lics = pkg_licenses($row["ID"]);
|
||||
$grps = pkg_groups($row["ID"]);
|
||||
|
@ -82,7 +83,7 @@ $sources = pkg_sources($row["ID"]);
|
|||
<li><a href="<?= $urlpath . '/' . $row['BaseName'] ?>.tar.gz"><?= __('Download tarball') ?></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 ($USE_VIRTUAL_URLS && $uid): ?>
|
||||
<?php if (use_virtual_urls() && $uid): ?>
|
||||
<?php if ($row["OutOfDateTS"] === NULL): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkgbase_uri($row['BaseName']) . 'flag/'; ?>" method="post">
|
||||
|
@ -281,7 +282,7 @@ if (has_credential(CRED_PKGBASE_CHANGE_CATEGORY, array($row["MaintainerUID"]))):
|
|||
<?php
|
||||
if ($row["SubmitterUID"]):
|
||||
if ($SID):
|
||||
if (!$USE_VIRTUAL_URLS):
|
||||
if (!use_virtual_urls()):
|
||||
?>
|
||||
<td><a href="<?= get_uri('/account/'); ?>?Action=AccountInfo&ID=<?= htmlspecialchars($row['SubmitterUID'], ENT_QUOTES) ?>" title="<?= __('View account information for')?> <?= html_format_username($submitter) ?>"><?= html_format_username($submitter) ?></a></td>
|
||||
<?php else: ?>
|
||||
|
@ -299,7 +300,7 @@ if ($row["SubmitterUID"]):
|
|||
<?php
|
||||
if ($row["MaintainerUID"]):
|
||||
if ($SID):
|
||||
if (!$USE_VIRTUAL_URLS):
|
||||
if (!use_virtual_urls()):
|
||||
?>
|
||||
<td><a href="<?= get_uri('/account/'); ?>?Action=AccountInfo&ID=<?= htmlspecialchars($row['MaintainerUID'], ENT_QUOTES) ?>" title="<?= __('View account information for')?> <?= html_format_username($maintainer) ?>"><?= html_format_username($maintainer) ?></a></td>
|
||||
<?php else: ?>
|
||||
|
@ -317,7 +318,7 @@ if ($row["MaintainerUID"]):
|
|||
<?php
|
||||
if ($row["PackagerUID"]):
|
||||
if ($SID):
|
||||
if (!$USE_VIRTUAL_URLS):
|
||||
if (!use_virtual_urls()):
|
||||
?>
|
||||
<td><a href="<?= get_uri('/account/'); ?>?Action=AccountInfo&ID=<?= htmlspecialchars($row['PackagerUID'], ENT_QUOTES) ?>" title="<?= __('View account information for')?> <?= html_format_username($packager) ?>"><?= html_format_username($packager) ?></a></td>
|
||||
<?php else: ?>
|
||||
|
@ -333,7 +334,7 @@ if ($row["PackagerUID"]):
|
|||
<tr>
|
||||
<th><?= __('Votes') . ': ' ?></th>
|
||||
<?php if (has_credential(CRED_PKGBASE_LIST_VOTERS)): ?>
|
||||
<?php if ($USE_VIRTUAL_URLS): ?>
|
||||
<?php if (use_virtual_urls()): ?>
|
||||
<td><a href="<?= get_pkgbase_uri($row['BaseName']); ?>voters/"><?= $votes ?></a></td>
|
||||
<?php else: ?>
|
||||
<td><a href="<?= get_uri('/voters/'); ?>?N=<?= htmlspecialchars($row['BaseName'], ENT_QUOTES) ?>"><?= $votes ?></a></td>
|
||||
|
|
|
@ -19,7 +19,8 @@ $updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($r
|
|||
$submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["SubmittedTS"]));
|
||||
$out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($row["OutOfDateTS"]));
|
||||
|
||||
$urlpath = URL_DIR . substr($row['Name'], 0, 2) . "/" . $row['Name'];
|
||||
$package_url = config_get('options', 'package_url');
|
||||
$urlpath = $package_url . substr($row['Name'], 0, 2) . "/" . $row['Name'];
|
||||
|
||||
$pkgs = pkgbase_get_pkgnames($base_id);
|
||||
?>
|
||||
|
@ -33,7 +34,7 @@ $pkgs = pkgbase_get_pkgnames($base_id);
|
|||
<li><a href="<?= $urlpath . '/' . $row['Name'] ?>.tar.gz"><?= __('Download tarball') ?></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 ($USE_VIRTUAL_URLS && $uid): ?>
|
||||
<?php if (use_virtual_urls() && $uid): ?>
|
||||
<?php if ($row["OutOfDateTS"] === NULL): ?>
|
||||
<li>
|
||||
<form action="<?= get_pkgbase_uri($row['Name']) . 'flag/'; ?>" method="post">
|
||||
|
@ -140,7 +141,7 @@ if (has_credential(CRED_PKGBASE_CHANGE_CATEGORY, array($row["MaintainerUID"]))):
|
|||
<?php
|
||||
if ($row["SubmitterUID"]):
|
||||
if ($SID):
|
||||
if (!$USE_VIRTUAL_URLS):
|
||||
if (!use_virtual_urls()):
|
||||
?>
|
||||
<td><a href="<?= get_uri('/account/'); ?>?Action=AccountInfo&ID=<?= htmlspecialchars($row['SubmitterUID'], ENT_QUOTES) ?>" title="<?= __('View account information for')?> <?= html_format_username($submitter) ?>"><?= html_format_username($submitter) ?></a></td>
|
||||
<?php else: ?>
|
||||
|
@ -158,7 +159,7 @@ if ($row["SubmitterUID"]):
|
|||
<?php
|
||||
if ($row["MaintainerUID"]):
|
||||
if ($SID):
|
||||
if (!$USE_VIRTUAL_URLS):
|
||||
if (!use_virtual_urls()):
|
||||
?>
|
||||
<td><a href="<?= get_uri('/account/'); ?>?Action=AccountInfo&ID=<?= htmlspecialchars($row['MaintainerUID'], ENT_QUOTES) ?>" title="<?= __('View account information for')?> <?= html_format_username($maintainer) ?>"><?= html_format_username($maintainer) ?></a></td>
|
||||
<?php else: ?>
|
||||
|
@ -176,7 +177,7 @@ if ($row["MaintainerUID"]):
|
|||
<?php
|
||||
if ($row["PackagerUID"]):
|
||||
if ($SID):
|
||||
if (!$USE_VIRTUAL_URLS):
|
||||
if (!use_virtual_urls()):
|
||||
?>
|
||||
<td><a href="<?= get_uri('/account/'); ?>?Action=AccountInfo&ID=<?= htmlspecialchars($row['PackagerUID'], ENT_QUOTES) ?>" title="<?= __('View account information for')?> <?= html_format_username($packager) ?>"><?= html_format_username($packager) ?></a></td>
|
||||
<?php else: ?>
|
||||
|
@ -192,7 +193,7 @@ if ($row["PackagerUID"]):
|
|||
<tr>
|
||||
<th><?= __('Votes') . ': ' ?></th>
|
||||
<?php if (has_credential(CRED_PKGBASE_LIST_VOTERS)): ?>
|
||||
<?php if ($USE_VIRTUAL_URLS): ?>
|
||||
<?php if (use_virtual_urls()): ?>
|
||||
<td><a href="<?= get_pkgbase_uri($row['Name']); ?>voters/"><?= $votes ?></a></td>
|
||||
<?php else: ?>
|
||||
<td><a href="<?= get_uri('/voters/'); ?>?N=<?= htmlspecialchars($row['Name'], ENT_QUOTES) ?>"><?= $votes ?></a></td>
|
||||
|
|
|
@ -34,9 +34,10 @@
|
|||
|
||||
<?php while (list($indx, $row) = each($results)): ?>
|
||||
<?php
|
||||
$due = ($row['Open'] && time() - intval($row['RequestTS']) > $REQUEST_IDLE_TIME);
|
||||
$idle_time = config_get_int('options', 'request_idle_time');
|
||||
$due = ($row['Open'] && time() - intval($row['RequestTS']) > $idle_time);
|
||||
if (!$due) {
|
||||
$time_left = $REQUEST_IDLE_TIME - (time() - intval($row['RequestTS']));
|
||||
$time_left = $idle_time - (time() - intval($row['RequestTS']));
|
||||
if ($time_left > 48 * 3600) {
|
||||
$time_left_fmt = __("~%d days left", round($time_left / (24 * 3600)));
|
||||
} elseif ($time_left > 3600) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
?>
|
||||
<tr class="<?= $c ?>">
|
||||
<td>
|
||||
<?php if (!$USE_VIRTUAL_URLS): ?>
|
||||
<?php if (!use_virtual_urls()): ?>
|
||||
<a href="<?= get_uri('/account/'); ?>?Action=AccountInfo&ID=<?= htmlspecialchars($row['UserID'], ENT_QUOTES) ?>" title="<?= __('View account information for')?> <?= html_format_username($username) ?>"><?= html_format_username($username) ?></a></td>
|
||||
<?php else: ?>
|
||||
<a href="<?= get_uri('/account/') . html_format_username($username) ?>" title="<?= __('View account information for %s', html_format_username($username)) ?>"><?= html_format_username($username) ?></a>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue