summaryrefslogtreecommitdiffstats
path: root/web/template
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-10-24 08:31:47 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-10-24 10:03:54 +0200
commit76343fb91511b9f53e58b6c01b258bfe00ddb4c6 (patch)
tree60eb4d3727bae159a1807915a58348b210ead206 /web/template
parenta0a523070847230565c2ad5993ee058ff475a8e1 (diff)
downloadaurweb-76343fb91511b9f53e58b6c01b258bfe00ddb4c6.tar.xz
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>
Diffstat (limited to 'web/template')
-rw-r--r--web/template/actions_form.php2
-rw-r--r--web/template/header.php2
-rw-r--r--web/template/pkg_details.php13
-rw-r--r--web/template/pkgbase_details.php13
-rw-r--r--web/template/pkgreq_results.php5
-rw-r--r--web/template/tu_last_votes_list.php2
6 files changed, 20 insertions, 17 deletions
diff --git a/web/template/actions_form.php b/web/template/actions_form.php
index 389297b..f18c01c 100644
--- a/web/template/actions_form.php
+++ b/web/template/actions_form.php
@@ -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>
diff --git a/web/template/header.php b/web/template/header.php
index d10b162..dd1d480 100644
--- a/web/template/header.php
+++ b/web/template/header.php
@@ -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>
diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php
index d09b3d8..faec0dc 100644
--- a/web/template/pkg_details.php
+++ b/web/template/pkg_details.php
@@ -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&amp;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&amp;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&amp;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>
diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php
index fb11e60..406408b 100644
--- a/web/template/pkgbase_details.php
+++ b/web/template/pkgbase_details.php
@@ -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&amp;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&amp;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&amp;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>
diff --git a/web/template/pkgreq_results.php b/web/template/pkgreq_results.php
index 3d50c82..24ee877 100644
--- a/web/template/pkgreq_results.php
+++ b/web/template/pkgreq_results.php
@@ -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) {
diff --git a/web/template/tu_last_votes_list.php b/web/template/tu_last_votes_list.php
index e897a6a..0b0ee48 100644
--- a/web/template/tu_last_votes_list.php
+++ b/web/template/tu_last_votes_list.php
@@ -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&amp;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>