get('You do not have access to this page'); return; } } $addcomparison = 1; break; case 'all': $subselect = ''; break; case 'none': default: $subselect = ' where id = 0'; print $GLOBALS['I18N']->get('You do not have access to this page'); return; break; } if (!$id) { print $GLOBALS['I18N']->get('Select Message to view'); $timerange = ' and date_add(msg.entered,interval 6 month) > now()'; $timerange = ''; $limit = 'limit 10'; $req = Sql_Query(sprintf('select msg.id as messageid,count(um.viewed) as views, count(um.status) as total,subject,date_format(sent,"%%e %%b %%Y") as sent,bouncecount as bounced from %s um,%s msg where um.messageid = msg.id %s %s group by msg.id order by msg.entered desc %s', $GLOBALS['tables']['usermessage'],$GLOBALS['tables']['message'],$subselect,$timerange,$limit)); if (!Sql_Affected_Rows()) { print '

'.$GLOBALS['I18N']->get('There are currently no messages to view').'

'; } $ls = new WebblerListing($GLOBALS['I18N']->get('Available Messages')); while ($row = Sql_Fetch_Array($req)) { $element = $row['messageid'].' '.substr($row['subject'],0,50); $ls->addElement($element); $ls->addColumn($element,$GLOBALS['I18N']->get('date'),$row['sent']); $ls->addColumn($element,$GLOBALS['I18N']->get('sent'),$row['total']); $ls->addColumn($element,$GLOBALS['I18N']->get('bounced'),$row['bounced']); $ls->addColumn($element,$GLOBALS['I18N']->get('views'),$row['views'],$row['views'] ? PageURL2('mviews&id='.$row['messageid']):''); $perc = sprintf('%0.2f',($row['views'] / $row['total'] * 100)); $ls->addColumn($element,$GLOBALS['I18N']->get('rate'),$perc.' %'); } if ($addcomparison) { $total = Sql_Fetch_Array_Query(sprintf('select count(entered) as total from %s um', $GLOBALS['tables']['usermessage'])); $viewed = Sql_Fetch_Array_Query(sprintf('select count(viewed) as viewed from %s um', $GLOBALS['tables']['usermessage'])); $overall = $GLOBALS['I18N']->get('Comparison to other admins'); $ls->addElement($overall); $ls->addColumn($overall,$GLOBALS['I18N']->get('views'),$viewed['viewed']); $perc = sprintf('%0.2f',($viewed['viewed'] / $total['total'] * 100)); $ls->addColumn($overall,$GLOBALS['I18N']->get('rate'),$perc.' %'); } print $ls->display(); return; } print '

'.$GLOBALS['I18N']->get('View Details for a Message').'

'; $messagedata = Sql_Fetch_Array_query("SELECT * FROM {$tables['message']} where id = $id $subselect"); print '
'.$GLOBALS['I18N']->get('Subject').''.$messagedata['subject'].'
'.$GLOBALS['I18N']->get('Entered').''.$messagedata['entered'].'
'.$GLOBALS['I18N']->get('Sent').''.$messagedata['sent'].'

'; $ls = new WebblerListing($GLOBALS['I18N']->get('Message Open Statistics')); $req = Sql_Query(sprintf('select um.userid from %s um,%s msg where um.messageid = %d and um.messageid = msg.id and um.viewed is not null %s group by userid', $GLOBALS['tables']['usermessage'],$GLOBALS['tables']['message'],$id,$subselect)); $total = Sql_Affected_Rows(); $start = sprintf('%d',$_GET['start']); if (isset($start) && $start > 0) { $listing = sprintf($GLOBALS['I18N']->get("Listing user %d to %d"),$start,$start + MAX_USER_PP); $limit = "limit $start,".MAX_USER_PP; } else { $listing = sprintf($GLOBALS['I18N']->get("Listing user %d to %d"),1,MAX_USER_PP); $limit = "limit 0,".MAX_USER_PP; $start = 0; } if ($id) { $url_keep = '&id='.$id; } else { $url_keep = ''; } print $total. " ".$GLOBALS['I18N']->get("Entries")."

"; if ($total) { printf ('
%s
%s%s %s%s


', $listing, PageLink2("mviews$url_keep","<<","start=0"), PageLink2("mviews$url_keep","<",sprintf('start=%d',max(0,$start-MAX_USER_PP))), PageLink2("mviews$url_keep",">",sprintf('start=%d',min($total,$start+MAX_USER_PP))), PageLink2("mviews$url_keep",">>",sprintf('start=%d',$total-MAX_USER_PP))); } $req = Sql_Query(sprintf('select userid,email,um.entered as sent,min(um.viewed) as firstview, max(um.viewed) as lastview, count(um.viewed) as viewcount, abs(unix_timestamp(um.entered) - unix_timestamp(um.viewed)) as responsetime from %s um, %s user, %s msg where um.messageid = %d and um.messageid = msg.id and um.userid = user.id and um.viewed is not null %s group by userid %s', $GLOBALS['tables']['usermessage'],$GLOBALS['tables']['user'],$GLOBALS['tables']['message'],$id,$subselect,$limit)); $summary = array(); while ($row = Sql_Fetch_Array($req)) { $element = ''.$row['email']; $ls->addElement($element,PageUrl2('userhistory&id='.$row['userid'])); $ls->addColumn($element,$GLOBALS['I18N']->get('sent'),formatDateTime($row['sent'])); if ($row['viewcount'] > 1) { $ls->addColumn($element,$GLOBALS['I18N']->get('firstview'),formatDateTime($row['firstview'],1)); $ls->addColumn($element,$GLOBALS['I18N']->get('lastview'),formatDateTime($row['lastview'])); $ls->addColumn($element,$GLOBALS['I18N']->get('views'),$row['viewcount']); } else { $ls->addColumn($element,$GLOBALS['I18N']->get('firstview'),formatDateTime($row['firstview'],1)); $ls->addColumn($element,$GLOBALS['I18N']->get('responsetime'),$row['responsetime'].' '.$GLOBALS['I18N']->get('sec')); } } print $ls->display(); ?>