Fixes for tag / source history
This commit is contained in:
parent
fad31ed38d
commit
e77f7de7f9
4 changed files with 16 additions and 20 deletions
|
@ -250,7 +250,7 @@ class Source_History extends Extension
|
||||||
/**
|
/**
|
||||||
* This function attempts to revert all changes by a given IP within an (optional) timeframe.
|
* 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;
|
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)) {
|
if (!is_null($ip)) {
|
||||||
$select_code[] = 'user_ip = ?';
|
$select_code[] = 'user_ip = ?';
|
||||||
$select_args[] = $ip;
|
$select_args[] = $ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_null($date)) {
|
||||||
|
$select_code[] = 'date_set >= ?';
|
||||||
|
$select_args[] = $date;
|
||||||
|
}
|
||||||
|
|
||||||
if (count($select_code) == 0) {
|
if (count($select_code) == 0) {
|
||||||
log_error("source_history", "Tried to mass revert without any conditions");
|
log_error("source_history", "Tried to mass revert without any conditions");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -111,16 +111,14 @@ class Source_HistoryTheme extends Themelet
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = '
|
$html = '
|
||||||
Revert source changes/edit by a specific IP address or username.
|
Revert source changes by a specific IP address or username, optionally limited to recent changes.
|
||||||
<br>You can restrict the time frame to revert these edits as well.
|
|
||||||
<br>(Date format: 2011-10-23)
|
|
||||||
'.$validation_msg.'
|
'.$validation_msg.'
|
||||||
|
|
||||||
<br><br>'.make_form(make_link("source_history/bulk_revert"), 'POST')."
|
<br><br>'.make_form(make_link("source_history/bulk_revert"), 'POST')."
|
||||||
<table class='form'>
|
<table class='form'>
|
||||||
<tr><th>Username</th> <td><input type='text' name='revert_name' size='15'></td></tr>
|
<tr><th>Username</th> <td><input type='text' name='revert_name' size='15'></td></tr>
|
||||||
<tr><th>IP Address</th> <td><input type='text' name='revert_ip' size='15'></td></tr>
|
<tr><th>IP Address</th> <td><input type='text' name='revert_ip' size='15'></td></tr>
|
||||||
<tr><th>Date 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>
|
<tr><td colspan='2'><input type='submit' value='Revert'></td></tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -247,7 +247,7 @@ class Tag_History extends Extension
|
||||||
/**
|
/**
|
||||||
* This function attempts to revert all changes by a given IP within an (optional) timeframe.
|
* 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;
|
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)) {
|
if (!is_null($ip)) {
|
||||||
$select_code[] = 'user_ip = ?';
|
$select_code[] = 'user_ip = ?';
|
||||||
$select_args[] = $ip;
|
$select_args[] = $ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_null($date)) {
|
||||||
|
$select_code[] = 'date_set >= ?';
|
||||||
|
$select_args[] = $date;
|
||||||
|
}
|
||||||
|
|
||||||
if (count($select_code) == 0) {
|
if (count($select_code) == 0) {
|
||||||
log_error("tag_history", "Tried to mass revert without any conditions");
|
log_error("tag_history", "Tried to mass revert without any conditions");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -123,16 +123,14 @@ class Tag_HistoryTheme extends Themelet
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = '
|
$html = '
|
||||||
Revert tag changes/edit by a specific IP address or username.
|
Revert tag changes by a specific IP address or username, optionally limited to recent changes.
|
||||||
<br>You can restrict the time frame to revert these edits as well.
|
|
||||||
<br>(Date format: 2011-10-23)
|
|
||||||
'.$validation_msg.'
|
'.$validation_msg.'
|
||||||
|
|
||||||
<br><br>'.make_form(make_link("tag_history/bulk_revert"), 'POST')."
|
<br><br>'.make_form(make_link("tag_history/bulk_revert"), 'POST')."
|
||||||
<table class='form'>
|
<table class='form'>
|
||||||
<tr><th>Username</th> <td><input type='text' name='revert_name' size='15'></td></tr>
|
<tr><th>Username</th> <td><input type='text' name='revert_name' size='15'></td></tr>
|
||||||
<tr><th>IP Address</th> <td><input type='text' name='revert_ip' size='15'></td></tr>
|
<tr><th>IP Address</th> <td><input type='text' name='revert_ip' size='15'></td></tr>
|
||||||
<tr><th>Date 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>
|
<tr><td colspan='2'><input type='submit' value='Revert'></td></tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
|
Reference in a new issue