Jump to content

Clear Notifications


Tom Irons

Recommended Posts

  • 4 weeks later...
  • Replies 67
  • Created
  • Last Reply
  • 3 months later...

Hi @Tom Irons I wanted to let you know there's a potential bug in your plugin "Clear Notifications" that triggered a whole mess of system errors on my community :) 

 \IPS\Member::loggedIn() returns a guest object

Another third-party developer kindly suggested you use the following code to stop the error:

public function clearNotifications()
   {
            /* Clear the users notifications */
            if( \IPS\Member::loggedIn()->member_id ){
                \IPS\Db::i()->delete( 'core_notifications', 'member=' . \IPS\Member::loggedIn()->member_id );
            }
           \IPS\Output::i()->redirect( \IPS\Http\Url::internal( NULL ), 'ClearNotifications_complete' );

   }

Hope this helps

Link to comment
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
DELETE FROM `core_notifications` WHERE member=
 | File                                                                       | Function                                                                      | Line No.          |
 |----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------|
 | /system/Db/Db.php                                                          | [IPS\Db\_Exception].__construct                                               | 393               |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
 | /system/Db/Db.php                                                          | [IPS\_Db].preparedQuery                                                       | 946               |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
 | /init.php(443) : eval()'d code                                             | [IPS\_Db].delete                                                              | 10                |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
 |                                                                            | [IPS\core\modules\front\system\hook1313].clearNotifications                   |                   |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
 | /system/Dispatcher/Controller.php                                          | [].call_user_func                                                             | 85                |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
 | /system/Dispatcher/Dispatcher.php                                          | [IPS\Dispatcher\_Controller].execute                                          | 129               |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
 | /index.php                                                                 | [IPS\_Dispatcher].run                                                         | 15                |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'

 

#0 /home/nginx/domains/mywebsite.com/public/init.php(507): IPS\_Log::log('DELETE FROM `co...', 'uncaught_except...')
#1 [internal function]: IPS\IPS::exceptionHandler(Object(IPS\Db\Exception))
#2 {main}

 

Link to comment

I don't think there is anyway someone can maliciously delete someone's notifications. It checks to see if the user is logged in and if they are it will only remove their notifications.

I would assume it wasn't approved cause mine is already on the marketplace. Why would they want more than one plugin to do the same thing?

Link to comment
On 13 января 2017 г. at 6:50 AM, Tom Irons said:

I don't think there is anyway someone can maliciously delete someone's notifications. It checks to see if the user is logged in and if they are it will only remove their notifications.

What will happen if you go directly to the link? Will be removed the notification of the current user. That is, one way or another, can call the address  and run the function of the current user without verifying that the request came from him. For example posting the directly link, shortened link or dynamic image. You don't check CSRF key and it is in this case is a potential vulnerability (see cross site request forgery attack). Suppose that in this case a small, but if it came to the removal of personal correspondence? This is serious.

Link to comment
  • 2 months later...
  • 4 months later...

We've noticed a problem with 1.01 on our forum (v. 4.2.2) when using computer or iPad. When clicking Clear notifications in the 'View all notifications' list an alert appears as below, whereas when clicking Clear notifications on the Notifications popup the feature works as it should.

Clear notifications.png

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...