id: 35 name: PageNotFoundLogReport description: 'PageNotFoundLogReport snippet for LogPageNotFound.' category: LogPageNotFound properties: 'a:2:{s:11:"table_width";a:7:{s:4:"name";s:11:"table_width";s:4:"desc";s:21:"lpnf_table_width_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:3:"80%";s:7:"lexicon";s:26:"logpagenotfound:properties";s:4:"area";s:0:"";}s:10:"cell_width";a:7:{s:4:"name";s:10:"cell_width";s:4:"desc";s:20:"lpnf_cell_width_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:2:"30";s:7:"lexicon";s:26:"logpagenotfound:properties";s:4:"area";s:0:"";}}' ----- /** * PageNotFoundLogReport * Copyright 2011-2015 Bob Ray * * PageNotFoundLogReport is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) any * later version. * * PageNotFoundLogReport is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * PageNotFoundLogReport; if not, write to the Free Software Foundation, Inc., 59 Temple Place, * Suite 330, Boston, MA 02111-1307 USA * * @package logpagenotfound * @author Bob Ray * * Description: The PageNotFoundLogReport snippet presents the contents of the Page Not Found log as a table. * * / /* Modified: January, 2013 */ $file = MODX_CORE_PATH . '/logs/pagenotfound.log'; $cellWidth = empty($scriptProperties['cell_width'])? 30 : $scriptProperties['cell_width']; if (isset($_POST['clearlog'])) { file_put_contents($file, ""); } $tableWidth = empty($scriptProperties['table_width'])? '80%' : $scriptProperties['table_width']; $fp = fopen ($file, 'r'); $output = ''; if ($fp) { $output = ''; $output .= "\n" . ' '; $output .= "\n" .' '; $output .= "\n" .' '; $output .= "\n" .' '; $output .= "\n" .' '; $output .= "\n" .' '; $output .= "\n" .' '; $output .= "\n" .' '; while (($line = fgets($fp)) !== false) { $line = trim($line); if (strpos($line,'#' == 0) || empty($line)) continue; $lineArray = explode('`',$line); $output .= "\n "; foreach($lineArray as $item) { $item = urldecode($item); $item = strip_tags($item); $item = htmlspecialchars($item, ENT_QUOTES, 'UTF-8'); $item = str_replace('&', '&', $item); $output .= "\n " . ''; } $output .= "\n "; } $output .= "\n
PageTimeIPHostUser AgentReferer
' . $item . '
"; fclose($fp); } else { $output = 'Could not open: ' . $file; } return $output;