967 |
967 |
968 function err_access_denied() |
968 function err_access_denied() |
969 { |
969 { |
970 global $db, $session, $paths, $template, $plugins; // Common objects |
970 global $db, $session, $paths, $template, $plugins; // Common objects |
971 |
971 |
|
972 // Log it for crying out loud |
|
973 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary,page_text) VALUES(\'security\', \'illegal_page\', '.time().', \''.date('d M Y h:i a').'\', \''.$db->escape($session->username).'\', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\', \'' . $db->escape(serialize(array($this->page_id, $this->namespace))) . '\')'); |
|
974 |
972 $ob = ''; |
975 $ob = ''; |
973 $template->tpl_strings['PAGE_NAME'] = 'Access denied'; |
976 //$template->tpl_strings['PAGE_NAME'] = 'Access denied'; |
|
977 $template->tpl_strings['PAGE_NAME'] = htmlspecialchars( $this->title ); |
974 |
978 |
975 if ( $this->send_headers ) |
979 if ( $this->send_headers ) |
976 { |
980 { |
977 $ob .= $template->getHeader(); |
981 $ob .= $template->getHeader(); |
|
982 } |
|
983 |
|
984 if ( count($this->redirect_stack) > 0 ) |
|
985 { |
|
986 $stack = array_reverse($this->redirect_stack); |
|
987 foreach ( $stack as $oldtarget ) |
|
988 { |
|
989 $url = makeUrlNS($oldtarget[1], $oldtarget[0], 'redirect=no', true); |
|
990 $page_id_key = $paths->nslist[ $oldtarget[1] ] . $oldtarget[0]; |
|
991 $page_data = $paths->pages[$page_id_key]; |
|
992 $title = ( isset($page_data['name']) ) ? $page_data['name'] : $paths->nslist[$oldtarget[1]] . htmlspecialchars( str_replace('_', ' ', dirtify_page_id( $oldtarget[0] ) ) ); |
|
993 $a = '<a href="' . $url . '">' . $title . '</a>'; |
|
994 |
|
995 $url = makeUrlNS($this->namespace, $this->page_id, 'redirect=no', true); |
|
996 $page_id_key = $paths->nslist[ $this->namespace ] . $this->page_id; |
|
997 $page_data = $paths->pages[$page_id_key]; |
|
998 $title = ( isset($page_data['name']) ) ? $page_data['name'] : $paths->nslist[$this->namespace] . htmlspecialchars( str_replace('_', ' ', dirtify_page_id( $this->page_id ) ) ); |
|
999 $b = '<a href="' . $url . '">' . $title . '</a>'; |
|
1000 |
|
1001 $ob .= '<small>(Redirected to ' . $b . ' from ' . $a . ')<br /></small>'; |
|
1002 } |
978 } |
1003 } |
979 |
1004 |
980 $ob .= '<div class="error-box"><b>Access to this page is denied.</b><br />This may be because you are not logged in or you have not met certain criteria for viewing this page.</div>'; |
1005 $ob .= '<div class="error-box"><b>Access to this page is denied.</b><br />This may be because you are not logged in or you have not met certain criteria for viewing this page.</div>'; |
981 |
1006 |
982 if ( $this->send_headers ) |
1007 if ( $this->send_headers ) |