Fixes for tag / source history

This commit is contained in:
Shish 2019-06-09 08:32:01 +01:00
parent fad31ed38d
commit e77f7de7f9
4 changed files with 16 additions and 20 deletions

View file

@ -250,7 +250,7 @@ class Source_History extends Extension
/**
* This function attempts to revert all changes by a given IP within an (optional) timeframe.
*/
public function process_revert_all_changes(string $name, string $ip, string $date)
public function process_revert_all_changes(?string $name, ?string $ip, ?string $date)
{
global $database;
@ -268,16 +268,16 @@ class Source_History extends Extension
}
}
if (!is_null($date)) {
$select_code[] = 'date_set >= ?';
$select_args[] = $date;
}
if (!is_null($ip)) {
$select_code[] = 'user_ip = ?';
$select_args[] = $ip;
}
if (!is_null($date)) {
$select_code[] = 'date_set >= ?';
$select_args[] = $date;
}
if (count($select_code) == 0) {
log_error("source_history", "Tried to mass revert without any conditions");
return;

View file

@ -111,16 +111,14 @@ class Source_HistoryTheme extends Themelet
}
$html = '
Revert source changes/edit by a specific IP address or username.
<br>You can restrict the time frame to revert these edits as well.
<br>(Date format: 2011-10-23)
Revert source changes by a specific IP address or username, optionally limited to recent changes.
'.$validation_msg.'
<br><br>'.make_form(make_link("source_history/bulk_revert"), 'POST')."
<table class='form'>
<tr><th>Username</th> <td><input type='text' name='revert_name' size='15'></td></tr>
<tr><th>IP&nbsp;Address</th> <td><input type='text' name='revert_ip' size='15'></td></tr>
<tr><th>Date&nbsp;range</th> <td><input type='date' name='revert_date' size='15'></td></tr>
<tr><th>Since</th> <td><input type='date' name='revert_date' size='15'></td></tr>
<tr><td colspan='2'><input type='submit' value='Revert'></td></tr>
</table>
</form>

View file

@ -247,7 +247,7 @@ class Tag_History extends Extension
/**
* This function attempts to revert all changes by a given IP within an (optional) timeframe.
*/
public function process_revert_all_changes(string $name, string $ip, string $date)
public function process_revert_all_changes(?string $name, ?string $ip, ?string $date)
{
global $database;
@ -265,16 +265,16 @@ class Tag_History extends Extension
}
}
if (!is_null($date)) {
$select_code[] = 'date_set >= ?';
$select_args[] = $date;
}
if (!is_null($ip)) {
$select_code[] = 'user_ip = ?';
$select_args[] = $ip;
}
if (!is_null($date)) {
$select_code[] = 'date_set >= ?';
$select_args[] = $date;
}
if (count($select_code) == 0) {
log_error("tag_history", "Tried to mass revert without any conditions");
return;

View file

@ -123,16 +123,14 @@ class Tag_HistoryTheme extends Themelet
}
$html = '
Revert tag changes/edit by a specific IP address or username.
<br>You can restrict the time frame to revert these edits as well.
<br>(Date format: 2011-10-23)
Revert tag changes by a specific IP address or username, optionally limited to recent changes.
'.$validation_msg.'
<br><br>'.make_form(make_link("tag_history/bulk_revert"), 'POST')."
<table class='form'>
<tr><th>Username</th> <td><input type='text' name='revert_name' size='15'></td></tr>
<tr><th>IP&nbsp;Address</th> <td><input type='text' name='revert_ip' size='15'></td></tr>
<tr><th>Date&nbsp;range</th> <td><input type='date' name='revert_date' size='15'></td></tr>
<tr><th>Since</th> <td><input type='date' name='revert_date' size='15'></td></tr>
<tr><td colspan='2'><input type='submit' value='Revert'></td></tr>
</table>
</form>