Rather annoying V

Started by TheListener, August 28, 2009, 12:10:13 PM

Previous topic - Next topic

TheListener

Can someone please help get rid of that rather annoying V which I have highlighted in pink.


Norv

Please download the attached file, upload it in your SMF folder, and run it from your browser. Paste here what it reports.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

TheListener

Whereabouts should it go?

The root directory?

Norv

Quote from: Norv on August 28, 2009, 12:25:17 PM
Please download the attached file, upload it in your SMF folder, and run it from your browser.

Your SMF folder is the one that has SSI.php, Settings.php and so on.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

TheListener

I can't see any difference at the moment.

gbsothere

I see it in your page source...        ::)

Of course, my saying that doesn't exactly help...      :-\

v<!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"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="Paranormal Haunt" />



My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Norv

What do you mean, you can't see any difference at the moment?
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

TheListener

==Sorry just got back from a family meal out==

Norv I thought at first I had to look at the forum to see if there was a difference.

Norv

Please run the file, and post here its results. It may help identify the problem, not solve it itself.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

TheListener

I hope this is what you were after. However when I went to delete a mod I found an error which when I looked at the file there was a line of text missing. ( I didn't delete the mod in the end).

I may be wrong but.... that may of been the cause of the bmajor error from the forum.

<?php
// http://www.simplemachines.org/community/index.php?topic=300626.msg1989826#msg1989826

class FileChecker
{
   /**
    * @var string
    */
   var $_file = '';
   
   /**
    * @var boolean
    */
   var $_recursive = false;
   
   /**
    * @var string
    */
   var $_include = false;
   
   /**
    * @var string
    */
   var $_exclude = false;
   
   /**
    * @var array
    */
   var $_errors = array();
   
   /**
    * @param string $file - File or Directory to check
    * @param boolean $recursive - Use recursive checking on directories
    */
   function FileChecker($file = '')
   {
      $this->_file = $file;
   }
   
   function run()
   {
      set_time_limit(300);
      $this->_run($this->_file, $this->_recursive);
   }

   /**
    * Return the count and filesize for files in a directory
    *
    * @param string $dir
    * @param boolean $recursive
    * @param string $ext
    *
    */
   function _run($file, $recursive)
   {
      if (substr($file,-1) == '.')
          $file = substr($file,0,-1);

       if (is_file($file) && is_readable($file))
           return $this->_checkFile($file);
       elseif (!is_dir($file) || !$dir_handle = opendir($file))
       {
           trigger_error('Unable to open directory: ' . $file);
           return;
       }
      
       while(($filename = readdir($dir_handle)) !== false)
       {
           if (($filename == '.') || ($filename == '..'))
              continue;

           $extension = array_pop(explode('.', $filename));
           $real_path = $file . DIRECTORY_SEPARATOR . $filename;
          
           // Are we going to skip this file?
           $skip_file = (($this->_include !== false) && !in_array($extension, $this->_include)) ? true : (($this->_exclude !== false) && in_array($extension, $this->_exclude)) ? true : false;

           if(is_file($real_path) && is_readable($real_path) && !$skip_file)
               $this->_checkFile($real_path);

           elseif(is_dir($real_path) && $recursive && !(($this->_exclude !== false) && in_array($extension, $this->_exclude)))
               $this->_run($real_path, $recursive);
       }
       closedir($dir_handle);
   }

   /**
    * @desc This function can be overloaded to provide custom functionality
    * @param $filepath
    * @return Nothing, fills _error array with array(string filename, array errors)
    */
   function _checkFile($filepath)
   {
      $handle = fopen($filepath, 'r');
      $errors = array();
      
      // Let's go to the front of the file
      fseek($handle, 0);
      
      // BOM Check
      fseek($handle, 0);
      $opening = fgets($handle, 6);
      
      // And now the end of the file
      fseek($handle, -2, SEEK_END);
      $closing = fgets($handle, 3);
      
      if (strcasecmp(substr($opening, 0, 3), pack("CCC",0xef,0xbb,0xbf)) == 0)
      {
         $errors[] = 'UTF-8 BOM found';
         if (strcasecmp(substr($opening, 3), '<?') != 0)
            $errors[] = 'File does not begin with &lt;?php';
      }
      elseif (strcasecmp($opening, '<?php') != 0)
         $errors[] = 'File does not begin with &lt;?php';
      if (strcasecmp($closing, '?>') != 0)
         $errors[] = 'File does not end with ?&gt;';
      
      if (!empty($errors))
      {
         $this->_errors[] = array(
            'file' => $filepath,
            'errors' => $errors,
         );
      }
   }
   
   /**
    * @return false on no errors, or error array if not empty
    */
   function errors()
   {
      if (empty($this->_errors))
         return false;
      else
         return $this->_errors;
   }
   
   /**
    * @param $file
    */
   function setFile($file = '')
   {
      $this->_file = $file;
   }
   
   /**
    * @param false | string $extension | array $extension
    */
   function setInclude($extension)
   {
      $this->_include = ($extension !== false && !is_array($extension)) ? array($extension) : $extension;
   }
   
   /**
    * @param false | string $extension | array $extension
    */
   function setExclude($extension)
   {
      $this->_exclude = ($extension !== false && !is_array($extension)) ? array($extension) : $extension;
   }
   
   /**
    * @desc This will only set recursive to true if the file is a directory
    * @param boolean $recursive
    */
   function setRecursive($recursive = true)
   {
      $this->_recursive = is_dir($this->_file) && $recursive;
   }
   
   /**
    * @return string file
    */
   function getFile()
   {
      return $this->_file;
   }
}

$file_test = new FileChecker(dirname(__FILE__));
$file_test->setRecursive();
$file_test->setInclude('php');
$file_test->setExclude('store');
$file_test->run();

$file_errors = $file_test->errors();



/**/
echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title>SMF File Checker Utility</title>
      <style type="text/css">
         body
         {
            background-color: #E5E5E8;
            margin: 0px;
            padding: 0px;
         }
         body, td
         {
            color: #000000;
            font-size: small;
            font-family: verdana, sans-serif;
         }
         div#header
         {
            background-image: url(Themes/default/images/catbg.jpg);
            background-repeat: repeat-x;
            background-color: #88A6C0;
            padding: 22px 4% 12px 4%;
            color: white;
            font-family: Georgia, serif;
            font-size: xx-large;
            border-bottom: 1px solid black;
            height: 40px;
         }
         div#content
         {
            padding: 20px 30px;
         }

         div.panel
         {
            border: 1px solid gray;
            background-color: #F6F6F6;
            margin: 1ex 0 3ex 0;
            padding: 1.2ex;
         }
         div.panel h2
         {
            margin: 0;
            margin-bottom: 2ex;
            padding-bottom: 3px;
            border-bottom: 1px dashed black;
            font-size: 14pt;
            font-weight: normal;
         }

         dl
         {
            margin-left: 3ex;
         }
         dt
         {
            font-style: italic;
         }
         dd
         {
            margin-bottom: 1ex;
         }

         div .code
         {
            color: #000000;
            background-color: #dddddd;
            font-family: "courier new", "times new roman", monospace;
            font-size: small;
            line-height: 1.3em;
            /* Put a nice border around it. */
            border: 1px solid #000000;
            margin: 1px auto 1px auto;
            padding: 5px;
            width: 95%;
            /* Dont wrap its contents, and show scrollbars. */
            white-space: nowrap;
            overflow: auto;
            /* Stop after about 24 lines, and just show a scrollbar. */
            max-height: 24em;
         }

         /* The "Quote:" and "Code:" header parts... */
         div .codeheader
         {
            color: #000000;
            text-decoration: none;
            font-style: normal;
            font-weight: bold;
            font-size: x-small;
            line-height: 1.2em;
         }

         div.code span.comment
         {
            font-style: italic;
            color: #000066;
         }
      </style>
   </head>
   <body>
      <div id="header">
         <div title="Millenia">SMF File Checker Utility</div>
      </div>
      <div id="content">
         <div class="panel">
            <h2 id="contents">Below are the results of the scan</h2>';
if (empty($file_errors))
   echo '
               <p>Congratulations, no errors have been found in any of your files.</p>';
else
   foreach($file_errors as $file)
   {
      echo '
               <ul>
                  <li>', $file['file'], '
                     <ul>';
      foreach ($file['errors'] as $error)
         echo '
                        <li>', $error, '</li>';
      echo '
                     </ul>
                  </li>
               </ul>';
   }

echo '         </div>
      </div>
</body>
</html>';
?>

Norv

TheListener, I don't understand you. You pasted here the contents of the file I attached. There is no need t do that. We know its contents. It was attached earlier.

Please read what I said:
Quote from: Norv on August 28, 2009, 12:25:17 PM
Please download the attached file, upload it in your SMF folder, and run it from your browser.
Paste here what it reports.

Did you run the file? (file_check.php). If you do, what does it say?
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

TheListener

Quote from: Norv on August 28, 2009, 05:46:17 PM
and run it from your browser.
Paste here what it reports.

Did you run the file? (file_check.php). If you do, what does it say?
[/quote]

How do I run it from the browser?

Norv

Enter its exact address in the browser.

If you uploaded it in your SMF folder, then its exact address will be: http:// yourforumaddress/file_check.php
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

TheListener

Thanks Norv

http://www.visionaryhosting.info/file_check.php



Please ignore where it says Parascifi. That is nothing to do with the current forum in my signature.

Norv

We have more options to try to solve the problem, I take them in the order of probability:

First option:Please post as attachment (as attachment, not in the body of the post) your file ./Themes/default/index.template.php.

Second option: download each of the files below, and check them in a lightweight text editor, like Notepad++. They should normally begin with <?php, and end with ?>, and they don't. See what they have after ?>. If they have a space, or more spaces, or newlines, then delete them. If they have letters, delete them.
If they have some code, attach the files here instead, for us to see.
Quote
    * /home/visionar/public_html/Themes/default/index.template.php
          o File does not end with ?>

    * /home/visionar/public_html/Sources/ManageSettings.php
          o File does not end with ?>

    * /home/visionar/public_html/Sources/ManagePermissions.php
          o File does not end with ?>

    * /home/visionar/public_html/Sources/Subs-Package.php
          o File does not end with ?>

    * /home/visionar/public_html/Sources/usercp.php
          o File does not end with ?>

    * /home/visionar/public_html/Sources/TreasuryUpdate.php
          o File does not end with ?>

    *  /home/visionar/public_html/arcade.php
          o File does not end with ?>

    * /home/visionar/public_html/Themes/default/languages/TreasuryHelp.english-utf8.php
          o File does not end with ?>

    * /home/visionar/public_html/Themes/default/languages/Shout.persian.php
          o UTF-8 BOM found

    * /home/visionar/public_html/Themes/default/languages/index.russian.php
          o File does not begin with <?php
          o File does not end with ?>

    * /home/visionar/public_html/Themes/default/languages/TreasuryHelp.english.php
          o File does not end with ?>

    * /home/visionar/public_html/Themes/default/languages/Packages.english.php
          o File does not end with ?>

    *  /home/visionar/public_html/Themes/default/Packages.template.php
          o File does not end with ?>

    * /home/visionar/public_html/Themes/default/ManageArcade.template.php
          o File does not end with ?>

    * /home/visionar/public_html/Themes/default/usercp.template.php
          o File does not end with ?>

    *  /home/visionar/public_html/chat/lib/lang/hr.php
          o File does not end with ?>

    * /home/visionar/public_html/chat/lib/lang/es.php
          o UTF-8 BOM found

    * /home/visionar/public_html/chat/lib/lang/sl.php
          o UTF-8 BOM found

    * /home/visionar/public_html/chat/lib/lang/kr.php
          o UTF-8 BOM found

    *  /home/visionar/public_html/shoutBox/lib/lang/hr.php
          o File does not end with ?>

    * /home/visionar/public_html/shoutBox/lib/lang/es.php
          o UTF-8 BOM found

    * /home/visionar/public_html/shoutBox/lib/lang/sl.php
          o UTF-8 BOM found

    * /home/visionar/public_html/shoutBox/lib/lang/kr.php
          o UTF-8 BOM found

Third option: What mod you could not uninstall and in what file did it give you an error?
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

TheListener

I had hope the error had been eradicated but apparently not

Undefined index: smf251

/Sources/Subs.php
Line: 3831

TheListener


Norv

Do you have also an index.template.php file in the theme you are using?
That is, ./Themes/your_theme/index.template.php.
If there is one, please attach it as well.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

TheListener

As requested

The file from my theme

Norv

Please use the attached file, in your ./Themes/default/ directory.

It might solve the problem.

If not solved (and even if solved the following will help with other potential issues), I'd recommend to do Option 2.
Modify all those files to remove any white space, or newlines, or single letters after ?>, in each file, in the order I listed them. If the files have something else than white space or newlines after ?>, then post them as attachments here.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

TheListener

Quote from: Norv on August 28, 2009, 07:15:25 PM

If not solved (and even if solved it will help with other potential issues), I'd recommend to do Option 2.
Modify all those files to remove any white space, or newlines, or single letters after ?>, in each file, in the order I listed them. If the files have something else than white space or newlines after ?>, then post them as attachments here.

Have started already.


Norv

Please make sure you keep a copy of your files before modifying them.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

TheListener

Norv I don't know what ya did but not only did ya get rid of that v for me BUT the chat and shoutboxes are working again.

Thanks bud.

Norv

Good to hear you got it sorted out!
Marking as solved then (it's still a good idea to check those files and try t do as outlined above, it may help with other issues). :)
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Advertisement: