During a site build I became aware of a lot of entries in the Recent log entries report of "Page not found" for an image.

Details
Type	page not found
Date	Friday, March 26, 2010 - 01:35
User	_admin
Location	http://my.test.co.uk/images/bar.png
Referrer	http://my.test.co.uk/who-is-the-network-for
Message	images/bar.png
Severity	warning
Hostname	**.***.**.***
Operations

Details
Type	page not found
Date	Friday, March 26, 2010 - 08:03
User	root_admin
Location	http://my.test.co.uk/who-is-the-network-for/images/bar.png
Referrer	http://my.test.co.uk/who-is-the-network-for/join-us
Message	who-is-the-network-for/images/bar.png
Severity	warning
Hostname	**.***.**.***
Operations	

This report was the same for every page on the site. Also while using Garland in the admin area I had the following reports.

warning: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument in /var/www/test/modules/system/system.admin.inc on line 479

I've lost those reports as I was using Backup and Migrate to dump and restore from various backups to find out when this problem was introduced and I can't replicate this second issue while the page not found is replicable.

I pin pointed the cause by doing a search through the entire Drupal and module code for "images/bar.png" and found three occurances in the Terminal module.

terminal.css lines 10 and 15
terminal.js line 13

I'm afraid I haven't time to create a patch but below are the changes I made which stopped the Page not found report.
terminal.module lines 46 onwards

    $settings = array(
      'user' => $user->name,
      'server' => $_SERVER['SERVER_NAME'],
      'sitename' => variable_get('site_name', ''),
      'path' => drupal_get_path('module', 'terminal') . '/',   //added this var
    );

terminal.js line 10 onwards, reordered code so that line 13 came after the variables declarations which includes the new path var.

   // not php of course just used for colouring the code

if (Drupal.jsEnabled) {
  $(document).ready(function() {


    // Corner recover icon
    $('#terminal-corner').text('^---');

    var user = Drupal.settings['terminal']['user'];
    var host = Drupal.settings['terminal']['server'];
    var sitename = Drupal.settings['terminal']['sitename'];
    
    var path = Drupal.settings['terminal']['path'];    // Added this line
    
    var welcome_message = 'Welcome to ' + sitename + '!';
    var prompt = user + '@' + host + ' >';
    
    // Attach the terminal to the bottom, hidden by default
    $('html').append('<div id="terminal-container" style="display: none"></div>').append('<img id="terminal-corner" src="' + Drupal.settings.basePath + path + 'images/bar.png" />');  // added base path and module path vars to image path


Comments

snufkin’s picture

Title: log entries - Page not found » Rework the terminal theming

Changing the issue.

snufkin’s picture

Status: Active » Needs work

I have committed a crude version of the rework. It is not really nice because of the way it hides the overall terminal container div, but works. Now we need a little bit of CSS magic so that when i hide the body div the parent div collapses too. If that is too tricky we'll need to work around it in JS.