summaryrefslogtreecommitdiff
path: root/includes/pages
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2017-08-28 16:21:10 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2017-08-28 17:34:00 +0200
commit73175e2b64c85c7a8c528c76452cd82ffa99f925 (patch)
tree7464fe30c04fe245424646a98cfd6247d060e517 /includes/pages
parente1762e7764d4ee4f37757ecd2630f62a440dbf0e (diff)
#337: Added routing
Diffstat (limited to 'includes/pages')
-rw-r--r--includes/pages/admin_active.php52
-rw-r--r--includes/pages/admin_arrive.php10
-rw-r--r--includes/pages/admin_free.php2
-rw-r--r--includes/pages/admin_groups.php8
-rw-r--r--includes/pages/admin_news.php23
-rw-r--r--includes/pages/admin_questions.php6
-rw-r--r--includes/pages/admin_rooms.php8
-rw-r--r--includes/pages/admin_user.php30
-rw-r--r--includes/pages/guest_login.php7
-rw-r--r--includes/pages/user_atom.php4
-rw-r--r--includes/pages/user_messages.php6
-rw-r--r--includes/pages/user_myshifts.php8
-rw-r--r--includes/pages/user_news.php22
-rw-r--r--includes/pages/user_questions.php6
-rw-r--r--includes/pages/user_shifts.php8
15 files changed, 124 insertions, 76 deletions
diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php
index 2e06f90d..5b91e413 100644
--- a/includes/pages/admin_active.php
+++ b/includes/pages/admin_active.php
@@ -82,9 +82,13 @@ function admin_active()
$limit = '';
$msg = success(_('Marked angels.'), true);
} else {
- $set_active = '<a href="' . page_link_to('admin_active') . '&amp;serach=' . $search . '">&laquo; '
- . _('back') . '</a> | <a href="'
- . page_link_to('admin_active') . '&amp;search=' . $search . '&amp;count=' . $count . '&amp;set_active&amp;ack">'
+ $set_active = '<a href="' . page_link_to('admin_active', ['search' => $search]) . '">&laquo; '
+ . _('back')
+ . '</a> | <a href="'
+ . page_link_to(
+ 'admin_active',
+ ['search' => $search, 'count' => $count, 'set_active' => 1, 'ack' => 1]
+ ) . '">'
. _('apply')
. '</a>';
}
@@ -176,28 +180,46 @@ function admin_active()
$actions = [];
if ($usr['Aktiv'] == 0) {
- $actions[] = '<a href="'
- . page_link_to('admin_active') . '&amp;active=' . $usr['UID']
- . ($show_all_shifts ? '&amp;show_all_shifts=' : '') . '&amp;search=' . $search . '">'
+ $parameters = [
+ 'active' => $usr['UID'],
+ 'search' => $search,
+ ];
+ if ($show_all_shifts) {
+ $parameters['show_all_shifts'] = 1;
+ }
+ $actions[] = '<a href="' . page_link_to('admin_active', $parameters) . '">'
. _('set active')
. '</a>';
}
if ($usr['Aktiv'] == 1 && $usr['Tshirt'] == 0) {
- $actions[] = '<a href="'
- . page_link_to('admin_active') . '&amp;not_active=' . $usr['UID']
- . ($show_all_shifts ? '&amp;show_all_shifts=' : '') . '&amp;search=' . $search . '">'
+ $parametersRemove = [
+ 'not_active' => $usr['UID'],
+ 'search' => $search,
+ ];
+ $parametersShirt = [
+ 'tshirt' => $usr['UID'],
+ 'search' => $search,
+ ];
+ if ($show_all_shifts) {
+ $parametersRemove['show_all_shifts'] = 1;
+ $parametersShirt['show_all_shifts'] = 1;
+ }
+ $actions[] = '<a href="' . page_link_to('admin_active', $parametersRemove) . '">'
. _('remove active')
. '</a>';
- $actions[] = '<a href="'
- . page_link_to('admin_active') . '&amp;tshirt=' . $usr['UID']
- . ($show_all_shifts ? '&amp;show_all_shifts=' : '') . '&amp;search=' . $search . '">'
+ $actions[] = '<a href="' . page_link_to('admin_active', $parametersShirt) . '">'
. _('got t-shirt')
. '</a>';
}
if ($usr['Tshirt'] == 1) {
- $actions[] = '<a href="'
- . page_link_to('admin_active') . '&amp;not_tshirt=' . $usr['UID']
- . ($show_all_shifts ? '&amp;show_all_shifts=' : '') . '&amp;search=' . $search . '">'
+ $parameters = [
+ 'not_tshirt' => $usr['UID'],
+ 'search' => $search,
+ ];
+ if ($show_all_shifts) {
+ $parameters['show_all_shifts'] = 1;
+ }
+ $actions[] = '<a href="' . page_link_to('admin_active', $parameters) . '">'
. _('remove t-shirt')
. '</a>';
}
diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php
index ebeccb8c..2f312b1f 100644
--- a/includes/pages/admin_arrive.php
+++ b/includes/pages/admin_arrive.php
@@ -92,8 +92,14 @@ function admin_arrive()
$usr['rendered_arrival_date'] = $usr['arrival_date'] > 0 ? date('Y-m-d', $usr['arrival_date']) : '-';
$usr['arrived'] = $usr['Gekommen'] == 1 ? _('yes') : '';
$usr['actions'] = $usr['Gekommen'] == 1
- ? '<a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '&search=' . $search . '">' . _('reset') . '</a>'
- : '<a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '&search=' . $search . '">' . _('arrived') . '</a>';
+ ? '<a href="' . page_link_to(
+ 'admin_arrive',
+ ['reset' => $usr['UID'], 'search' => $search]
+ ) . '">' . _('reset') . '</a>'
+ : '<a href="' . page_link_to(
+ 'admin_arrive',
+ ['arrived' => $usr['UID'], 'search' => $search]
+ ) . '">' . _('arrived') . '</a>';
if ($usr['arrival_date'] > 0) {
$day = date('Y-m-d', $usr['arrival_date']);
diff --git a/includes/pages/admin_free.php b/includes/pages/admin_free.php
index ebf227a4..a3c0d17f 100644
--- a/includes/pages/admin_free.php
+++ b/includes/pages/admin_free.php
@@ -94,7 +94,7 @@ function admin_free()
'email' => $usr['email_by_human_allowed'] ? $usr['email'] : glyph('eye-close'),
'actions' =>
in_array('admin_user', $privileges)
- ? button(page_link_to('admin_user') . '&amp;id=' . $usr['UID'], _('edit'), 'btn-xs')
+ ? button(page_link_to('admin_user', ['id' => $usr['UID']]), _('edit'), 'btn-xs')
: ''
];
}
diff --git a/includes/pages/admin_groups.php b/includes/pages/admin_groups.php
index c483a79d..d64afe76 100644
--- a/includes/pages/admin_groups.php
+++ b/includes/pages/admin_groups.php
@@ -38,7 +38,8 @@ function admin_groups()
'name' => $group['Name'],
'privileges' => join(', ', $privileges_html),
'actions' => button(
- page_link_to('admin_groups') . '&action=edit&id=' . $group['UID'],
+ page_link_to('admin_groups',
+ ['action' => 'edit', 'id' => $group['UID']]),
_('edit'),
'btn-xs'
)
@@ -93,7 +94,10 @@ function admin_groups()
$privileges_form[] = form_submit('submit', _('Save'));
$html .= page_with_title(_('Edit group'), [
- form($privileges_form, page_link_to('admin_groups') . '&action=save&id=' . $group_id)
+ form(
+ $privileges_form,
+ page_link_to('admin_groups', ['action' => 'save', 'id' => $group_id])
+ )
]);
} else {
return error('No Group found.', true);
diff --git a/includes/pages/admin_news.php b/includes/pages/admin_news.php
index 7f8ca1ba..a5354da7 100644
--- a/includes/pages/admin_news.php
+++ b/includes/pages/admin_news.php
@@ -31,16 +31,21 @@ function admin_news()
$news = array_shift($news);
$user_source = User($news['UID']);
- $html .= form([
- form_info(_('Date'), date('Y-m-d H:i', $news['Datum'])),
- form_info(_('Author'), User_Nick_render($user_source)),
- form_text('eBetreff', _('Subject'), $news['Betreff']),
- form_textarea('eText', _('Message'), $news['Text']),
- form_checkbox('eTreffen', _('Meeting'), $news['Treffen'] == 1, 1),
- form_submit('submit', _('Save'))
- ], page_link_to('admin_news&action=save&id=' . $news_id));
+ $html .= form(
+ [
+ form_info(_('Date'), date('Y-m-d H:i', $news['Datum'])),
+ form_info(_('Author'), User_Nick_render($user_source)),
+ form_text('eBetreff', _('Subject'), $news['Betreff']),
+ form_textarea('eText', _('Message'), $news['Text']),
+ form_checkbox('eTreffen', _('Meeting'), $news['Treffen'] == 1, 1),
+ form_submit('submit', _('Save'))
+ ],
+ page_link_to('admin_news', ['action' => 'save', 'id' => $news_id])
+ );
- $html .= '<a class="btn btn-danger" href="' . page_link_to('admin_news&action=delete&id=' . $news_id) . '">'
+ $html .= '<a class="btn btn-danger" href="'
+ . page_link_to('admin_news', ['action' => 'delete', 'id' => $news_id])
+ . '">'
. '<span class="glyphicon glyphicon-trash"></span> ' . _('Delete')
. '</a>';
break;
diff --git a/includes/pages/admin_questions.php b/includes/pages/admin_questions.php
index d05bace6..938e63a9 100644
--- a/includes/pages/admin_questions.php
+++ b/includes/pages/admin_questions.php
@@ -52,9 +52,9 @@ function admin_questions()
'answer' => form([
form_textarea('answer', '', ''),
form_submit('submit', _('Save'))
- ], page_link_to('admin_questions') . '&action=answer&id=' . $question['QID']),
+ ], page_link_to('admin_questions', ['action' => 'answer', 'id' => $question['QID']])),
'actions' => button(
- page_link_to('admin_questions') . '&action=delete&id=' . $question['QID'],
+ page_link_to('admin_questions', ['action' => 'delete', 'id' => $question['QID']]),
_('delete'),
'btn-xs'
)
@@ -72,7 +72,7 @@ function admin_questions()
'answered_by' => User_Nick_render($answer_user_source),
'answer' => str_replace("\n", '<br />', $question['Answer']),
'actions' => button(
- page_link_to('admin_questions') . '&action=delete&id=' . $question['QID'],
+ page_link_to('admin_questions', ['action' => 'delete', 'id' => $question['QID']]),
_('delete'),
'btn-xs'
)
diff --git a/includes/pages/admin_rooms.php b/includes/pages/admin_rooms.php
index 3045242b..8a7720d8 100644
--- a/includes/pages/admin_rooms.php
+++ b/includes/pages/admin_rooms.php
@@ -25,8 +25,8 @@ function admin_rooms()
'from_pentabarf' => $room['FromPentabarf'] == 'Y' ? '&#10003;' : '',
'public' => $room['show'] == 'Y' ? '&#10003;' : '',
'actions' => table_buttons([
- button(page_link_to('admin_rooms') . '&show=edit&id=' . $room['RID'], _('edit'), 'btn-xs'),
- button(page_link_to('admin_rooms') . '&show=delete&id=' . $room['RID'], _('delete'), 'btn-xs')
+ button(page_link_to('admin_rooms', ['show' => 'edit', 'id' => $room['RID']]), _('edit'), 'btn-xs'),
+ button(page_link_to('admin_rooms', ['show' => 'delete', 'id' => $room['RID']]), _('delete'), 'btn-xs')
])
];
}
@@ -227,7 +227,7 @@ function admin_rooms()
sprintf(_('Do you want to delete room %s?'), $name),
buttons([
button(
- page_link_to('admin_rooms') . '&show=delete&id=' . $room_id . '&ack',
+ page_link_to('admin_rooms', ['show' => 'delete', 'id' => $room_id, 'ack' => 1]),
_('Delete'),
'delete btn-danger'
)
@@ -238,7 +238,7 @@ function admin_rooms()
return page_with_title(admin_rooms_title(), [
buttons([
- button(page_link_to('admin_rooms') . '&show=edit', _('add'))
+ button(page_link_to('admin_rooms', ['show' => 'edit']), _('add'))
]),
msg(),
table([
diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php
index 510e2292..00113507 100644
--- a/includes/pages/admin_user.php
+++ b/includes/pages/admin_user.php
@@ -46,25 +46,27 @@ function admin_user()
. 'Wenn T-Shirt ein \'Ja\' enth&auml;lt, bedeutet dies, dass der Engel '
. 'bereits sein T-Shirt erhalten hat.<br /><br />' . "\n";
- $html .= '<form action="' . page_link_to('admin_user') . '&action=save&id=' . $user_id . '" method="post">' . "\n";
+ $html .= '<form action="'
+ . page_link_to('admin_user', ['action' => 'save', 'id' => $user_id])
+ . '" method="post">' . "\n";
$html .= '<table border="0">' . "\n";
$html .= '<input type="hidden" name="Type" value="Normal">' . "\n";
$html .= '<tr><td>' . "\n";
$html .= '<table>' . "\n";
- $html .= ' <tr><td>Nick</td><td>' . '<input type="text" size="40" name="eNick" value="' . $user_source['Nick'] . '" class="form-control"></td></tr>' . "\n";
+ $html .= ' <tr><td>Nick</td><td>' . '<input size="40" name="eNick" value="' . $user_source['Nick'] . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Last login</td><td><p class="help-block">'
. date('Y-m-d H:i', $user_source['lastLogIn'])
. '</p></td></tr>' . "\n";
- $html .= ' <tr><td>Name</td><td>' . '<input type="text" size="40" name="eName" value="' . $user_source['Name'] . '" class="form-control"></td></tr>' . "\n";
- $html .= ' <tr><td>Vorname</td><td>' . '<input type="text" size="40" name="eVorname" value="' . $user_source['Vorname'] . '" class="form-control"></td></tr>' . "\n";
- $html .= ' <tr><td>Alter</td><td>' . '<input type="text" size="5" name="eAlter" value="' . $user_source['Alter'] . '" class="form-control"></td></tr>' . "\n";
- $html .= ' <tr><td>Telefon</td><td>' . '<input type="text" size="40" name="eTelefon" value="' . $user_source['Telefon'] . '" class="form-control"></td></tr>' . "\n";
- $html .= ' <tr><td>Handy</td><td>' . '<input type="text" size="40" name="eHandy" value="' . $user_source['Handy'] . '" class="form-control"></td></tr>' . "\n";
- $html .= ' <tr><td>DECT</td><td>' . '<input type="text" size="4" name="eDECT" value="' . $user_source['DECT'] . '" class="form-control"></td></tr>' . "\n";
+ $html .= ' <tr><td>Name</td><td>' . '<input size="40" name="eName" value="' . $user_source['Name'] . '" class="form-control"></td></tr>' . "\n";
+ $html .= ' <tr><td>Vorname</td><td>' . '<input size="40" name="eVorname" value="' . $user_source['Vorname'] . '" class="form-control"></td></tr>' . "\n";
+ $html .= ' <tr><td>Alter</td><td>' . '<input size="5" name="eAlter" value="' . $user_source['Alter'] . '" class="form-control"></td></tr>' . "\n";
+ $html .= ' <tr><td>Telefon</td><td>' . '<input size="40" name="eTelefon" value="' . $user_source['Telefon'] . '" class="form-control"></td></tr>' . "\n";
+ $html .= ' <tr><td>Handy</td><td>' . '<input size="40" name="eHandy" value="' . $user_source['Handy'] . '" class="form-control"></td></tr>' . "\n";
+ $html .= ' <tr><td>DECT</td><td>' . '<input size="4" name="eDECT" value="' . $user_source['DECT'] . '" class="form-control"></td></tr>' . "\n";
if ($user_source['email_by_human_allowed']) {
- $html .= " <tr><td>email</td><td>" . '<input type="text" size="40" name="eemail" value="' . $user_source['email'] . '" class="form-control"></td></tr>' . "\n";
+ $html .= " <tr><td>email</td><td>" . '<input size="40" name="eemail" value="' . $user_source['email'] . '" class="form-control"></td></tr>' . "\n";
}
- $html .= " <tr><td>jabber</td><td>" . '<input type="text" size="40" name="ejabber" value="' . $user_source['jabber'] . '" class="form-control"></td></tr>' . "\n";
+ $html .= " <tr><td>jabber</td><td>" . '<input size="40" name="ejabber" value="' . $user_source['jabber'] . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Size</td><td>'
. html_select_key('size', 'eSize', $tshirt_sizes, $user_source['Size']) . '</td></tr>' . "\n";
@@ -91,7 +93,7 @@ function admin_user()
$html .= ' <tr><td>T-Shirt</td><td>' . "\n";
$html .= html_options('eTshirt', $options, $user_source['Tshirt']) . '</td></tr>' . "\n";
- $html .= ' <tr><td>Hometown</td><td>' . '<input type="text" size="40" name="Hometown" value="' . $user_source['Hometown'] . '" class="form-control"></td></tr>' . "\n";
+ $html .= ' <tr><td>Hometown</td><td>' . '<input size="40" name="Hometown" value="' . $user_source['Hometown'] . '" class="form-control"></td></tr>' . "\n";
$html .= '</table>' . "\n" . '</td><td valign="top"></td></tr>';
@@ -105,7 +107,8 @@ function admin_user()
$html .= form_info('', _('Please visit the angeltypes page or the users profile to manage users angeltypes.'));
$html .= 'Hier kannst Du das Passwort dieses Engels neu setzen:<form action="'
- . page_link_to('admin_user') . '&action=change_pw&id=' . $user_id . '" method="post">' . "\n";
+ . page_link_to('admin_user', ['action' => 'change_pw', 'id' => $user_id])
+ . '" method="post">' . "\n";
$html .= '<table>' . "\n";
$html .= ' <tr><td>Passwort</td><td>' . '<input type="password" size="40" name="new_pw" value="" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Wiederholung</td><td>' . '<input type="password" size="40" name="new_pw2" value="" class="form-control"></td></tr>' . "\n";
@@ -134,7 +137,8 @@ function admin_user()
if ($user_id != $user['UID'] && $my_highest_group <= $his_highest_group) {
$html .= 'Hier kannst Du die Benutzergruppen des Engels festlegen:<form action="'
- . page_link_to('admin_user') . '&action=save_groups&id=' . $user_id . '" method="post">' . "\n";
+ . page_link_to('admin_user', ['action' => 'save_groups', 'id' => $user_id])
+ . '" method="post">' . "\n";
$html .= '<table>';
$groups = DB::select('
diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php
index 106db33a..b83b8382 100644
--- a/includes/pages/guest_login.php
+++ b/includes/pages/guest_login.php
@@ -328,7 +328,7 @@ function guest_register()
'angel_types',
_('What do you want to do?') . sprintf(
' (<a href="%s">%s</a>)',
- page_link_to('angeltypes') . '&action=about',
+ page_link_to('angeltypes', ['action' => 'about']),
_('Description of job types')
),
$angel_types,
@@ -467,7 +467,10 @@ function guest_login()
heading(_('What can I do?'), 2),
'<p>' . _('Please read about the jobs you can do to help us.') . '</p>',
buttons([
- button(page_link_to('angeltypes') . '&action=about', _('Teams/Job description') . ' &raquo;')
+ button(
+ page_link_to('angeltypes', ['action' => 'about']),
+ _('Teams/Job description') . ' &raquo;'
+ )
])
])
])
diff --git a/includes/pages/user_atom.php b/includes/pages/user_atom.php
index a1e2580a..98ace9cc 100644
--- a/includes/pages/user_atom.php
+++ b/includes/pages/user_atom.php
@@ -66,9 +66,9 @@ function make_atom_entry_from_news($news_entry)
{
return ' <entry>
<title>' . htmlspecialchars($news_entry['Betreff']) . '</title>
- <link href="' . page_link_to_absolute('news_comments&amp;nid=') . $news_entry['ID'] . '"/>
+ <link href="' . page_link_to_absolute('news_comments', ['nid' => $news_entry['ID']]) . '"/>
<id>' . preg_replace('#^https?://#', '', page_link_to_absolute('news')) . '-' . $news_entry['ID'] . '</id>
<updated>' . date('Y-m-d\TH:i:sP', $news_entry['Datum']) . '</updated>
- <summary type="html">' . htmlspecialchars($news_entry['Text']) . '</summary>
+ <summary>' . htmlspecialchars($news_entry['Text']) . '</summary>
</entry>' . "\n";
}
diff --git a/includes/pages/user_messages.php b/includes/pages/user_messages.php
index a811970d..320af9df 100644
--- a/includes/pages/user_messages.php
+++ b/includes/pages/user_messages.php
@@ -92,14 +92,14 @@ function user_messages()
if ($message['RUID'] == $user['UID']) {
if ($message['isRead'] == 'N') {
$messages_table_entry['actions'] = button(
- page_link_to('user_messages') . '&action=read&id=' . $message['id'],
+ page_link_to('user_messages', ['action' => 'read', 'id' => $message['id']]),
_('mark as read'),
'btn-xs'
);
}
} else {
$messages_table_entry['actions'] = button(
- page_link_to('user_messages') . '&action=delete&id=' . $message['id'],
+ page_link_to('user_messages', ['action' => 'delete', 'id' => $message['id']]),
_('delete message'),
'btn-xs'
);
@@ -119,7 +119,7 @@ function user_messages()
'text' => _('Message'),
'actions' => ''
], $messages_table)
- ], page_link_to('user_messages') . '&action=send')
+ ], page_link_to('user_messages', ['action' => 'send']))
]);
} else {
switch ($request->input('action')) {
diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php
index 14b5b8ee..572b777a 100644
--- a/includes/pages/user_myshifts.php
+++ b/includes/pages/user_myshifts.php
@@ -38,14 +38,14 @@ function user_myshifts()
if ($request->input('reset') == 'ack') {
User_reset_api_key($user);
success(_('Key changed.'));
- redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']);
+ redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user['UID']]));
}
return page_with_title(_('Reset API key'), [
error(
_('If you reset the key, the url to your iCal- and JSON-export and your atom feed changes! You have to update it in every application using one of these exports.'),
true
),
- button(page_link_to('user_myshifts') . '&reset=ack', _('Continue'), 'btn-danger')
+ button(page_link_to('user_myshifts', ['reset' => 'ack']), _('Continue'), 'btn-danger')
]);
} elseif ($request->has('edit') && preg_match('/^\d*$/', $request->input('edit'))) {
$user_id = $request->input('edit');
@@ -111,7 +111,7 @@ function user_myshifts()
. '. Freeloaded: ' . ($freeloaded ? 'YES Comment: ' . $freeload_comment : 'NO')
);
success(_('Shift saved.'));
- redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']);
+ redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user['UID']]));
}
}
@@ -172,6 +172,6 @@ function user_myshifts()
}
}
- redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']);
+ redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user['UID']]));
return '';
}
diff --git a/includes/pages/user_news.php b/includes/pages/user_news.php
index 9bdcb6fb..2dd141ec 100644
--- a/includes/pages/user_news.php
+++ b/includes/pages/user_news.php
@@ -35,8 +35,8 @@ function user_meetings()
$html = '<div class="col-md-12"><h1>' . meetings_title() . '</h1>' . msg();
$request = request();
- if ($request->has('page') && preg_match('/^\d{1,}$/', $request->input('page'))) {
- $page = $request->input('page');
+ if (preg_match('/^\d{1,}$/', $request->input('page', 0))) {
+ $page = $request->input('page', 0);
} else {
$page = 0;
}
@@ -57,14 +57,14 @@ function user_meetings()
$dis_rows = ceil(count(DB::select('SELECT `ID` FROM `News`')) / $display_news);
$html .= '<div class="text-center">' . '<ul class="pagination">';
for ($i = 0; $i < $dis_rows; $i++) {
- if ($request->has('page') && $i == $request->input('page')) {
+ if ($request->has('page') && $i == $request->input('page', 0)) {
$html .= '<li class="active">';
} elseif (!$request->has('page') && $i == 0) {
$html .= '<li class="active">';
} else {
$html .= '<li>';
}
- $html .= '<a href="' . page_link_to('user_meetings') . '&page=' . $i . '">' . ($i + 1) . '</a></li>';
+ $html .= '<a href="' . page_link_to('user_meetings', ['page' => $i]) . '">' . ($i + 1) . '</a></li>';
}
$html .= '</ul></div></div>';
@@ -89,7 +89,7 @@ function display_news($news)
$html .= '<div class="panel-footer text-muted">';
if (in_array('admin_news', $privileges)) {
$html .= '<div class="pull-right">'
- . button_glyph(page_link_to('admin_news') . '&action=edit&id=' . $news['ID'], 'edit', 'btn-xs')
+ . button_glyph(page_link_to('admin_news', ['action' => 'edit', 'id' => $news['ID']]), 'edit', 'btn-xs')
. '</div>';
}
$html .= '<span class="glyphicon glyphicon-time"></span> ' . date('Y-m-d H:i', $news['Datum']) . '&emsp;';
@@ -98,7 +98,7 @@ function display_news($news)
$html .= User_Nick_render($user_source);
if ($page != 'news_comments') {
- $html .= '&emsp;<a href="' . page_link_to('news_comments') . '&nid=' . $news['ID'] . '">'
+ $html .= '&emsp;<a href="' . page_link_to('news_comments', ['nid' => $news['ID']]) . '">'
. '<span class="glyphicon glyphicon-comment"></span> '
. _('Comments') . ' &raquo;</a> '
. '<span class="badge">'
@@ -167,7 +167,7 @@ function user_news_comments()
$html .= form([
form_textarea('text', _('Message'), ''),
form_submit('submit', _('Save'))
- ], page_link_to('news_comments') . '&nid=' . $news['ID']);
+ ], page_link_to('news_comments', ['nid' => $news['ID']]));
} else {
$html .= _('Invalid request.');
}
@@ -208,8 +208,8 @@ function user_news()
redirect(page_link_to('news'));
}
- if ($request->has('page') && preg_match('/^\d{1,}$/', $request->input('page'))) {
- $page = $request->input('page');
+ if (preg_match('/^\d{1,}$/', $request->input('page', 0))) {
+ $page = $request->input('page', 0);
} else {
$page = 0;
}
@@ -230,14 +230,14 @@ function user_news()
$dis_rows = ceil(count(DB::select('SELECT `ID` FROM `News`')) / $display_news);
$html .= '<div class="text-center">' . '<ul class="pagination">';
for ($i = 0; $i < $dis_rows; $i++) {
- if ($request->has('page') && $i == $request->input('page')) {
+ if ($request->has('page') && $i == $request->input('page', 0)) {
$html .= '<li class="active">';
} elseif (!$request->has('page') && $i == 0) {
$html .= '<li class="active">';
} else {
$html .= '<li>';
}
- $html .= '<a href="' . page_link_to('news') . '&page=' . $i . '">' . ($i + 1) . '</a></li>';
+ $html .= '<a href="' . page_link_to('news', ['page' => $i]) . '">' . ($i + 1) . '</a></li>';
}
$html .= '</ul></div>';
diff --git a/includes/pages/user_questions.php b/includes/pages/user_questions.php
index fdf76aee..20f82eb1 100644
--- a/includes/pages/user_questions.php
+++ b/includes/pages/user_questions.php
@@ -33,7 +33,11 @@ function user_questions()
$question['answer_user'] = User_Nick_render($answer_user_source);
}
- return Questions_view($open_questions, $answered_questions, page_link_to('user_questions') . '&action=ask');
+ return Questions_view(
+ $open_questions,
+ $answered_questions,
+ page_link_to('user_questions', ['action' => 'ask'])
+ );
} else {
switch ($request->input('action')) {
case 'ask':
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index 813cb9b3..cd18a037 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -223,15 +223,15 @@ function view_user_shifts()
'task_notice' =>
'<sup>1</sup>'
. _('The tasks shown here are influenced by the angeltypes you joined already!')
- . ' <a href="' . page_link_to('angeltypes') . '&action=about' . '">'
+ . ' <a href="' . page_link_to('angeltypes', ['action' => 'about']) . '">'
. _('Description of the jobs.')
. '</a>',
'shifts_table' => msg() . $shiftCalendarRenderer->render(),
'ical_text' => '<h2>' . _('iCal export') . '</h2><p>' . sprintf(
_('Export of shown shifts. <a href="%s">iCal format</a> or <a href="%s">JSON format</a> available (please keep secret, otherwise <a href="%s">reset the api key</a>).'),
- page_link_to_absolute('ical') . '&key=' . $user['api_key'],
- page_link_to_absolute('shifts_json_export') . '&key=' . $user['api_key'],
- page_link_to('user_myshifts') . '&reset'
+ page_link_to_absolute('ical', ['key' => $user['api_key']]),
+ page_link_to_absolute('shifts_json_export', ['key' => $user['api_key']]),
+ page_link_to('user_myshifts', ['reset' => 1])
) . '</p>',
'filter' => _('Filter')
])