Spurious text "keyword" appears at the head of the body of every page. Spurious text "keyword" appears at the head of the body of every page.
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Spurious text "keyword" appears at the head of the body of every page.

Started by Leonard Will, June 27, 2017, 08:52:58 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Leonard Will

Spurious text "keyword" appears on a grey bar at the head of the body of every page. It appears where I would expect {CUSTOM_HEADER} to appear, but I have not defined any custom header. Indeed if I remove the placeholder {CUSTOM_HEADER} from template.html the word "keyword" is still displayed. It occurs in other templates - I have tried Classic and Rainy Day as well as my custom template and "keyword" appears in all of them. If I add some text to the template alongside the {CUSTOM_HEADER} placeholder, that text shows just after the "keyword" text.

<!-- $Id: template.html 4100 2007-12-02 23:05:48Z nibbler999 $ -->
</head>
<body>
{CUSTOM_HEADER}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>

Looking at the source file of a displayed page, using "inspect element" shows that it occurs between <body> and the first <meta> header, as shown in the attached snip. It looks as though it is a bit of spurious text that should be removed, but I can't find where it occurs. Any help please?

I am using Coppermine 1.5.46 under Windows 10.

ron4mac

Start by renaming the 'plugins' folder in the root of you CPG installation (e.g. to 'pplugins'). That will eliminate the problem coming from a plugin. If the "keyword" doesn't show anymore, it is coming from a plugin.

Report back with the results and we'll go from there.

Leonard Will

Thanks. I tried that, and the text "keyword" still appears at the top of every page even when the plugins folder is renamed.

ron4mac

That would indicate that it is coming from a core file. Did you make any modifications to any core files lately?

Things to do:
  check anycontent.php (if you have the option set to display it)
  look at the modification dates of core files ... suspect one that is newer than the others

PHP files have start and end tags ( <?php and ?> ). Anything outside of those tags gets displayed. There may be a file with a misplaced PHP tag and the word "keyword" is erroneously being displayed.

Since it is showing up on every page, I would suspect files such as:
include/init.inc.php
include/functions.inc.php

Also: you can use the VersionCheck function to see which files may have been changed.

Joe Carver

Also, try a standard theme, like Curve.
Check to make certain your custom theme is in the correct folder, compare to standard themes.

Also, please always post a link to your Coppermine - board rules and it makes support more efficient.
(For all current and future readers too)

Leonard Will

Thanks for your responses. My gallery is at http://www.enfieldsociety.org.uk/photographs/

The problem occurs in all themes, including Curve. The source of the displayed home page starts like this:

keyword<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Pragma" content="no-cache" />
<title>Home - TES photographs</title>
<link rel="stylesheet" href="css/coppermine.css" type="text/css" />
<link rel="stylesheet" href="themes/tes/style.css" type="text/css" />



You will see that the text "keyword" appears at the very start, before the doctype declaration. It also occurs in help boxes such as the one shown in the first attachment. The source text for that box starts like this, again showing "keyword" at the very start:
keyword<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
    <head>
        <title>Help</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" href="css/coppermine.css" type="text/css" />
        <link rel="stylesheet" href="themes/tes/style.css" type="text/css" />
        <script src="docs/js/jquery.js" type="text/javascript"></script>
        <script src="docs/js/help.js" type="text/javascript"></script>
    </head>
    <body class="nobgimage">
        <div id="cpg_main_block">


Curiously this specifies <body class="nobgimage">, but that definition occurs only in the style.css of the Curve theme, which is not being used. I tried adding it to the style.css of my own theme, "tes", but it made no difference.

I have spent a day checking through all the files to look for a spurious "keyword" text, but have not found any. I reloaded the core files, as unzipped from the dowload file cpg1.5.46.zip and have not modified them. Version check, however, shows many of them as "modified" - see the second attachment. The file sizes on the server are slightly less than on my Windows 10 machine, but I presume that that is just due to the format in which they are held - comparing the content of sample files shows no difference. I have not created anything in "anycontent.php".

Any more help or suggestions would be most appreciated.

phill104

Either use grep, or copy all the files to your desktop and use a tool such as wingrep to search for the "keyword" term. These tools will search through all files and folders looking for the string and hopefully will help you locate it.

*Edit - I have just discovered wingrep is no longer available which is a shame as it was an excellent tool. Here are some alternatives

http://stefanstools.sourceforge.net/grepWin.html

http://astrogrep.sourceforge.net/

It is a mistake to think you can solve any major problems just with potatoes.

Leonard Will

Quote from: Phill Luckhurst on June 29, 2017, 12:26:26 PM
Either use grep, or copy all the files to your desktop and use a tool such as wingrep to search for the "keyword" term. These tools will search through all files and folders looking for the string and hopefully will help you locate it.


I did that yesterday using astrogrep. Unfortunately the text "keyword" occurs in many files. I tried using regular expressions to isolate it to find occurrences at the start of a line, excluding "$keyword", "keywords", and so on, but could not find the rogue instance.

phill104

Is there any way I can access the files to take a look for you? If so send me the details via PM and I will take a look later today.
It is a mistake to think you can solve any major problems just with potatoes.

phill104

Thanks for the files. It seems some are missing, or not quite as they should be. It might be a good start to perform an upgrade. Simply overwrite your existing files with the latest 1.5.x release. This should fix the inconsistencies.
It is a mistake to think you can solve any major problems just with potatoes.

Leonard Will

Quote from: Phill Luckhurst on June 30, 2017, 10:37:24 AM
Thanks for the files. It seems some are missing, or not quite as they should be. It might be a good start to perform an upgrade. Simply overwrite your existing files with the latest 1.5.x release. This should fix the inconsistencies.

Thanks for your help. I downloaded a fresh copy of cpg1.5.46 and reinstalled all the files. The problem has now disappeared, so it seems that something must have been corrupted in my previous installation.

I still find, though, that "version check" reports many of the files as modified. Is there a discrepancy between the files in in zip download and those in the repository which version check compares them with? All seems to be working correctly, but it would be reassuring to have a clean report from version check.

Αndré

This usually happens when you upload the files with a Windows machine in text mode. Try to upload the files in binary mode to keep the EOL as-is (usually unix style in Coppermine).

Leonard Will

Quote from: Αndré on July 03, 2017, 03:49:00 PM
This usually happens when you upload the files with a Windows machine in text mode. Try to upload the files in binary mode to keep the EOL as-is (usually unix style in Coppermine).
Thanks, yes, uploading everything in binary mode now shows them all as unmodified (except for my deliberate modifications). It might be worth noting this in the documentation, as php, js and htm files are essentially text rather than binary, and Filezilla in auto mode interprets them as text for uploading.

phill104

It is more of a windows problem, than a mode problem. If you use the auto mode on a Linux box the EOL does not get altered in this way. I will have a think about how to adjust this section of the docs - http://documentation.coppermine-gallery.net/en/install_faq.htm#installFTP_mode
It is a mistake to think you can solve any major problems just with potatoes.

Αndré

It should/will also happen with Mac OS in text mode, as the default EOL on Mac is \r  ;)

Αndré

The only advantage I can think of uploading files in text or auto mode is that users can open text files in an editor that doesn't support the different types of line ending (e.g. notepad.exe). I personally use Notepad++ on Windows and Geany on Linux, both can handle all EOL types (\r, \r\n, \n). However, it's maybe easier to just recommend binary mode, so versioncheck will work as expected. Maybe this "problem" disappears with cpg1.6.x, as people will start to use the built-in updater respectively the installer.

phill104

I agree. I often wondered why we had the recommendation in the docs as we did when at the same time in the forum we were usually suggesting the use of binar mode.
It is a mistake to think you can solve any major problems just with potatoes.

Αndré