Issue when viewing events

Forum for questions and support relating to the 1.28.x releases only.
Locked
goosfraba01
Posts: 10
Joined: Wed Mar 12, 2014 8:25 pm

Issue when viewing events

Post by goosfraba01 »

We recently upgraded to ZM 1.28.1 and have noticed an odd issue when viewing events. Most of our users are restricted to a couple of monitors, but when they try to view events the page doesn't load correctly. The image is shrunk, event details are missing, and the controls don't work. If I remove the monitor restriction for that user and let them see all cameras it works correctly.

I have screenshots of what I'm talking about, but the site won't let me link them. If you would like them let me know and I'll get them to you another way.

I was hoping someone else might have seen this or have some ideas on how to fix the issue.

Thanks in advance,

Kenny
Mubashirali1987
Posts: 2
Joined: Thu Mar 05, 2015 8:50 pm

Re: Issue when viewing events

Post by Mubashirali1987 »

recording data issue i check that event folder there is a images not recording data



guide meeee any buddy help me this issue
bbunge
Posts: 2967
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Issue when viewing events

Post by bbunge »

How about some info on your system? Linux distribution and version?

bb
goosfraba01
Posts: 10
Joined: Wed Mar 12, 2014 8:25 pm

Re: Issue when viewing events

Post by goosfraba01 »

Certainly. It's running CentOS 6.5, Linux 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Thanks again,

Kenny
goosfraba01
Posts: 10
Joined: Wed Mar 12, 2014 8:25 pm

Re: Issue when viewing events

Post by goosfraba01 »

Mubashirali1987 wrote:recording data issue i check that event folder there is a images not recording data



guide meeee any buddy help me this issue

Everything in the event folder looks fine as far as I can tell, and everything plays back correctly if they have access to all monitors.

Thanks again,

Kenny
goosfraba01
Posts: 10
Joined: Wed Mar 12, 2014 8:25 pm

Re: Issue when viewing events

Post by goosfraba01 »

It looks like I can post the images now.

Here is what it looks like if I restrict a users monitors.
Image

And here is if they have access to all monitors.
Image

Both images are of the same event.

Thanks,

Kenny
Mubashirali1987
Posts: 2
Joined: Thu Mar 05, 2015 8:50 pm

Re: Issue when viewing events

Post by Mubashirali1987 »

its ubuntu 12.04
goosfraba01
Posts: 10
Joined: Wed Mar 12, 2014 8:25 pm

Re: Issue when viewing events

Post by goosfraba01 »

I have been digging some more and and have found an error using the IE 11 Developer Debugging Tool. This error only comes up when the user has been restricted to certain cameras. I tried to figure out where it is loosing this variable, but haven't been able to find it yet. Hopefully someone with a better understanding of the system can find it.

Image

Thanks again,

Kenny
goosfraba01
Posts: 10
Joined: Wed Mar 12, 2014 8:25 pm

Re: Issue when viewing events

Post by goosfraba01 »

I was able to find the line of code that is causing my issue but I am having a hard time figuring out what it's trying to do.

/var/www/html/zm/skins/classic/views/event.php Line 31

Code: Select all

if ( $user['MonitorIds'] )
    $midSql = " and MonitorId in (".join( ",", preg_split( '/["\'\s]*,["\'\s]*/', dbEscape($user['MonitorIds']) ) ).")";
else
    $midSql = '';
From what I can tell $user['MonitorIds'] is formatted like 31,21,29 which is what the in MYSQL operator would want. If I change the code to the following everything seems to work fine.

Code: Select all

if ( $user['MonitorIds'] )
    $midSql = " and MonitorId in (".$user['MonitorIds'].")";
else
    $midSql = '';
Can someone explain what this code is supposed to be doing?

Code: Select all

join(",", preg_split( '/["\'\s]*,["\'\s]*/', dbEscape($user['MonitorIds']) ) )
My reading it, which is probably way off, looks like dbEscape is stripping slashes if a php setting is set, then preg_split is putting in into an array for join to separate back out into a string in the format X,X,X. But it was already in that format to begin with so I'm don't understand why why it's doing that. I know I'm missing something.

Thanks again,

Kenny
goosfraba01
Posts: 10
Joined: Wed Mar 12, 2014 8:25 pm

Re: Issue when viewing events

Post by goosfraba01 »

Still digging and found something else

/var/www/html/zm/includes/database.php Lines 86-99

Code: Select all

function dbEscape( $string )
{
        global $dbConn;
    if ( version_compare( phpversion(), "4.3.0", "<") )
        if ( get_magic_quotes_gpc() )
            return( $dbConn->quote( stripslashes( $string ) ) );
        else
            return( $dbConn->quote( $string ) );
    else
        if ( get_magic_quotes_gpc() )
            return( $dbConn->quote( stripslashes( $string ) ) );
        else
            return( $dbConn->quote( $string ) );
}
This function is adding quote's around the string so 31,21,29 becomes '31,21,29'. I tested the query in mysql and when the quotes are added it is looking for the exact string '31,21,29' instead of anyone of the three.

I'm not sure the best way to fix this and make sure I don't break anything else so thought I'd see if anyone else has some ideas.

Thanks again,

Kenny
goosfraba01
Posts: 10
Joined: Wed Mar 12, 2014 8:25 pm

Re: Issue when viewing events

Post by goosfraba01 »

For now I changed the following code to fix the issue for us. It may not be the best fix, but it seems to work and doesn't modify any other code.

/var/www/html/zm/skins/classic/views/event.php Lines 30-34

Code: Select all

if ( $user['MonitorIds'] )
//    $midSql = " and MonitorId in (".join( ",", preg_split( '/["\'\s]*,["\'\s]*/', dbEscape($user['MonitorIds']) ) ).")";
    $midSql = " and MonitorId in (".trim(join( ",", preg_split( '/["\'\s]*,["\'\s]*/', dbEscape($user['MonitorIds']) ) ), "'" ).")";
else
    $midSql = '';
Let me know if anyone else has any better ideas.

Thanks again,

Kenny
Locked