Skip to content

Commit

Permalink
remove unused vars
Browse files Browse the repository at this point in the history
fix notices
  • Loading branch information
davydovct committed Oct 29, 2018
1 parent 159e396 commit abd56ff
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
48 changes: 26 additions & 22 deletions Antispam/Antispam.body.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,33 +243,37 @@ public static function SendAdminEmail( $title, $body ) {

if ( file_exists($wgCTDataStoreFile) ) {
$settings = file_get_contents ( $wgCTDataStoreFile );
if ( $settings ) {
if ( $settings )
{
$settings = json_decode($settings, true);
if (!isset($settings['lastAdminNotificaionSent']))
{
$fp = fopen( $wgCTDataStoreFile, 'w' ) or error_log( 'Could not open file:' . $wgCTDataStoreFile );
$settings['lastAdminNotificaionSent'] = time();
fwrite( $fp, json_encode($settings) );
fclose( $fp );
}
// Skip notification if permitted interval doesn't exhaust
if ( isset( $settings['lastAdminNotificaionSent'] ) && time() - $settings['lastAdminNotificaionSent'] < $wgCTAdminNotificaionInteval ) {
return false;
}

$u = User::newFromId( $wgCTAdminAccountId );

$status = $u->sendMail( $title , $body );

if ( $status->ok ) {
$fp = fopen( $wgCTDataStoreFile, 'w' ) or error_log( 'Could not open file:' . $wgCTDataStoreFile );
$settings['lastAdminNotificaionSent'] = time();
fwrite( $fp, json_encode($settings) );
fclose( $fp );
}
return $status->ok;
}
}
if (!isset($settings['lastAdminNotificaionSent']))
{
$settings['lastAdminNotificaionSent'] = time();
fwrite( $fp, json_encode($settings) );
fclose( $fp );
}
// Skip notification if permitted interval doesn't exhaust
if ( isset( $settings['lastAdminNotificaionSent'] ) && time() - $settings['lastAdminNotificaionSent'] < $wgCTAdminNotificaionInteval ) {
return false;
}

$u = User::newFromId( $wgCTAdminAccountId );

$status = $u->sendMail( $title , $body );

if ( $status->ok ) {
$fp = fopen( $wgCTDataStoreFile, 'w' ) or error_log( 'Could not open file:' . $wgCTDataStoreFile );
$settings['lastAdminNotificaionSent'] = time();
fwrite( $fp, json_encode($settings) );
fclose( $fp );
}
return false;

return $status->ok;
}
}

Expand Down
6 changes: 3 additions & 3 deletions Antispam/Antispam.hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CTHooks {
* @return none
*/
public static function onUploadFilter ( $upload, $mime, &$error ) {
global $wgCTAccessKey, $wgCTServerURL, $wgRequest, $wgCTAgent, $wgCTExtName, $wgCTNewEditsOnly, $wgCTMinEditCount, $wgUser;
global $wgRequest, $wgCTExtName, $wgCTMinEditCount, $wgUser;

# Skip spam check if error exists already
if ($error !== TRUE) {
Expand Down Expand Up @@ -73,7 +73,7 @@ public static function onUploadFilter ( $upload, $mime, &$error ) {
* @return bool
*/
public static function onEditFilter ( $editor, $text, $section, &$error, $summary ) {
global $wgCTAccessKey, $wgCTServerURL, $wgRequest, $wgCTAgent, $wgCTExtName, $wgCTNewEditsOnly, $wgCTMinEditCount;
global $wgCTExtName, $wgCTNewEditsOnly, $wgCTMinEditCount;

$allowEdit = true;

Expand Down Expand Up @@ -146,7 +146,7 @@ public static function onEditFilter ( $editor, $text, $section, &$error, $summa
* @return bool
*/
public static function onAbortNewAccount ( $user, &$message ) {
global $wgCTAccessKey, $wgCTServerURL, $wgRequest, $wgCTAgent, $wgCTExtName;
global $wgCTExtName;

$allowAccount = true;

Expand Down

0 comments on commit abd56ff

Please sign in to comment.