Skip to content
Permalink
Browse files

Too few arguments to function KunenaControllerUser::report()

  • Loading branch information...
810 committed Mar 4, 2019
1 parent f72ab45 commit 05c88e4d9f5d08729ab402849078c606d5adf64f
Showing with 43 additions and 42 deletions.
  1. +43 −42 src/components/com_kunena/controllers/user.php
@@ -28,12 +28,12 @@
class KunenaControllerUser extends KunenaController
{
/**
* @param bool $cachable cachable
* @param bool $urlparams urlparams
* @param bool $cachable cachable
* @param bool $urlparams urlparams
*
* @return \Joomla\CMS\MVC\Controller\BaseController|void
* @throws Exception
* @since Kunena
* @throws Exception
* @throws null
*/
public function display($cachable = false, $urlparams = false)
@@ -102,7 +102,7 @@ public function search()
{
$model = $this->getModel('user');
$uri = new \Joomla\CMS\Uri\Uri('index.php?option=com_kunena&view=user&layout=list');
$uri = new Joomla\CMS\Uri\Uri('index.php?option=com_kunena&view=user&layout=list');
$state = $model->getState();
$search = $state->get('list.search');
@@ -122,8 +122,8 @@ public function search()
}
/**
* @throws Exception
* @since Kunena
* @throws Exception
* @throws null
*/
public function change()
@@ -163,8 +163,8 @@ public function karmadown()
/**
* @return array|null
* @throws Exception
* @since Kunena
* @throws Exception
*/
public function save()
{
@@ -270,8 +270,8 @@ public function save()
}
/**
* @throws Exception
* @since Kunena
* @throws Exception
* @throws null
*/
public function ban()
@@ -319,7 +319,7 @@ public function ban()
$success = $ban->save();
// Send report to stopforumspam
$this->report($user);
$this->report($user, $reason_public);
}
else
{
@@ -520,8 +520,8 @@ public function cancel()
}
/**
* @throws Exception
* @since Kunena
* @throws Exception
* @throws null
*/
public function login()
@@ -560,8 +560,8 @@ public function login()
}
/**
* @throws Exception
* @since Kunena
* @throws Exception
* @throws null
*/
public function logout()
@@ -599,8 +599,8 @@ public function logout()
* Save online status for user
*
* @return void
* @throws Exception
* @since Kunena
* @throws Exception
* @throws null
*/
public function status()
@@ -638,8 +638,8 @@ public function status()
* Set online status text for user
*
* @return void
* @throws Exception
* @since Kunena
* @throws Exception
* @throws null
*/
public function statusText()
@@ -678,8 +678,8 @@ public function statusText()
/**
* @param $karmaDelta
*
* @throws Exception
* @since Kunena
* @throws Exception
* @throws null
*/
protected function karma($karmaDelta)
@@ -778,8 +778,8 @@ protected function karma($karmaDelta)
/**
* @return boolean
*
* @throws Exception
* @since Kunena
* @throws Exception
*/
protected function saveUser()
{
@@ -945,7 +945,7 @@ protected function saveUser()
}
$username = $this->user->get('username');
$user = new \Joomla\CMS\User\User($this->user->id);
$user = new Joomla\CMS\User\User($this->user->id);
// Bind the form fields to the user table and save.
try
@@ -1048,8 +1048,8 @@ protected function saveProfile()
* Delete previoulsy uplaoded avatars from filesystem
*
* @return void
* @throws Exception
* @since Kunena
* @throws Exception
*/
protected function deleteOldAvatars()
{
@@ -1081,8 +1081,8 @@ protected function deleteOldAvatars()
/**
* Upload avatar with AJAX.
*
* @throws null
* @since 5.1
* @throws null
*/
public function upload()
{
@@ -1212,8 +1212,8 @@ public function removeAvatar()
* Get avatar attached to a profile with AJAX.
*
* @return void
* @throws Exception
* @since 5.1
* @throws Exception
*/
public function loadAvatar()
{
@@ -1342,8 +1342,8 @@ public function delfile()
/**
* Reports a user to stopforumspam.com
*
* @param $user
* @param $evidence
* @param mixed $user user
* @param string $evidence evidence
*
* @return boolean
* @since Kunena
@@ -1364,39 +1364,40 @@ protected function report($user, string $evidence)
if (!empty($ip))
{
$options = new \Joomla\Registry\Registry;
$options = new Joomla\Registry\Registry;
$transport = new \Joomla\CMS\Http\Transport\StreamTransport($options);
$transport = new Joomla\CMS\Http\Transport\StreamTransport($options);
// Create a 'stream' transport.
$http = new \Joomla\CMS\Http\Http($options, $transport);
// Create a 'stream' transport.
$http = new Joomla\CMS\Http\Http($options, $transport);
$data = 'username=' . $spammer->username . '&ip_addr=' . $ip . '&email=' . $spammer->email . '&api_key=' . $this->config->stopforumspam_key . '&evidence=' . $evidence;
$data = 'username=' . $spammer->username . '&ip_addr=' . $ip . '&email=' . $spammer->email . '&api_key=' .
$this->config->stopforumspam_key . '&evidence=' . $evidence;
$response = $http->post('https://www.stopforumspam.com/add', $data);
$response = $http->post('https://www.stopforumspam.com/add', $data);
if ($response->code == '200')
{
// Report accepted. There is no need to display the reason
$this->app->enqueueMessage(Text::_('COM_KUNENA_STOPFORUMSPAM_REPORT_SUCCESS'));
if ($response->code == '200')
{
// Report accepted. There is no need to display the reason
$this->app->enqueueMessage(Text::_('COM_KUNENA_STOPFORUMSPAM_REPORT_SUCCESS'));
return true;
}
else
{
// Report failed or refused
$reasons = array();
preg_match('/<p>.*<\/p>/', $response->body, $reasons);
return true;
}
else
{
// Report failed or refused
$reasons = array();
preg_match('/<p>.*<\/p>/', $response->body, $reasons);
// Stopforumspam returns only one reason, which is reasons[0], but we need to strip out the html tags before using it
$this->app->enqueueMessage(Text::sprintf('COM_KUNENA_STOPFORUMSPAM_REPORT_FAILED', strip_tags($reasons[0])), 'error');
// Stopforumspam returns only one reason, which is reasons[0], but we need to strip out the html tags before using it
$this->app->enqueueMessage(Text::sprintf('COM_KUNENA_STOPFORUMSPAM_REPORT_FAILED', strip_tags($reasons[0])), 'error');
return false;
}
return false;
}
}
else
{
$this->app->enqueueMessage(Text::_('COM_KUNENA_STOPFORUMSPAM_REPORT_NO_IP_GIVEN'), 'error');
$this->app->enqueueMessage(Text::_('COM_KUNENA_STOPFORUMSPAM_REPORT_NO_IP_GIVEN'), 'error');
}
}
}

0 comments on commit 05c88e4

Please sign in to comment.
You can’t perform that action at this time.