print_description_row(construct_link_code($vbphrase['restart'], "modlog.php?" . vB::getCurrentSession()->get('sessionurl') . ""), 0, 5, 'thead', vB_Template_Runtime::fetchStyleVar('right')); print_table_header(construct_phrase($vbphrase['moderator_log_viewer_page_x_y_there_are_z_total_log_entries'], vb_number_format($vbulletin->GPC['pagenumber']), vb_number_format($totalpages), vb_number_format($counter['total'])), 6); $headings = array(); $headings[] = $vbphrase['id']; $headings[] = "<a href=\"modlog.php?" . vB::getCurrentSession()->get('sessionurl') . "do=view&modaction=" . $vbulletin->GPC['modaction'] . "&u=" . $vbulletin->GPC['userid'] . "&pp=" . $vbulletin->GPC['perpage'] . "&orderby=user&page=" . $vbulletin->GPC['pagenumber'] . "\">" . str_replace(' ', ' ', $vbphrase['username']) . "</a>"; $headings[] = "<a href=\"modlog.php?" . vB::getCurrentSession()->get('sessionurl') . "do=view&modaction=" . $vbulletin->GPC['modaction'] . "&u=" . $vbulletin->GPC['userid'] . "&pp=" . $vbulletin->GPC['perpage'] . "&orderby=date&page=" . $vbulletin->GPC['pagenumber'] . "\">" . $vbphrase['date'] . "</a>"; $headings[] = "<a href=\"modlog.php?" . vB::getCurrentSession()->get('sessionurl') . "do=view&modaction=" . $vbulletin->GPC['modaction'] . "&u=" . $vbulletin->GPC['userid'] . "&pp=" . $vbulletin->GPC['perpage'] . "&orderby=modaction&page=" . $vbulletin->GPC['pagenumber'] . "\">" . $vbphrase['action'] . "</a>"; $headings[] = str_replace(' ', ' ', $vbphrase['ip_address']); print_cells_row($headings, 1, 0, -3); foreach ($logs as $log) { $cell = array(); $cell[] = $log['moderatorlogid']; $cell[] = "<a href=\"user.php?" . vB::getCurrentSession()->get('sessionurl') . "do=edit&u={$log['userid']}\"><b>{$log['username']}</b></a>"; $cell[] = '<span class="smallfont">' . vbdate($vbulletin->options['logdateformat'], $log['dateline']) . '</span>'; if ($log['type']) { $phrase = vB_Library_Admin::GetModlogAction($log['type']); if (!$log['nodeid']) { // Pre vB5 logs if ($unserialized = @unserialize($log['action'])) { array_unshift($unserialized, $vbphrase[$phrase]); $action = call_user_func_array('construct_phrase', $unserialized); } else { $action = construct_phrase($vbphrase[$phrase], $log['action']); } if ($log['threadtitle']) { $action .= ', \'' . $log['threadtitle'] . '\''; } } else { // vB5 logs $temp = array(); $logdata = @unserialize($log['action']);
/** * Fetches the moderator logs for a node * @param int $nodeid * @return array $logs list of log records */ public function fetchModLogs($nodeid) { if (!vB::getUserContext()->getChannelPermission('moderatorpermissions', 'caneditthreads', $nodeid)) { $node = $this->getNode($nodeid); if ($node['userid'] != vB::getCurrentSession()->get('userid')) { throw new vB_Exception_Api('no_permission'); } else { return array(); } } $logs = array(); $log_res = vB::getDbAssertor()->assertQuery('getModLogs', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED, 'nodeid' => $nodeid)); foreach ($log_res as $log) { $phrase_name = vB_Library_Admin::GetModlogAction($log['type']); $phrase = vB_Api::instanceInternal('phrase')->fetch($phrase_name); if (!isset($phrase[$phrase_name])) { continue; } $phrase = $phrase[$phrase_name]; $log['action'] = vsprintf($phrase, $log['username']); $logs[] = $log; } return $logs; }