Currently there are three files in the cache directory, which don't need to be there:

* /cache/autoloader.php
* /cache/log.php
* /cache/trace.txt

These files ship as empty place-holder files, but will be written to by the application in certain situations. This causes problems with revision control, as the files show up as 'modified' and may end up being committed to the source repository. This is not just a problem in the main ProjectPier repository, but it has down-stream implications too.

The code already creates these files automatically if they don't already exist, but there are a couple of places where errors may be raised if they are not present. This commit contains the necessary modifications to remove these errors:

* When including the autoloader.php, we suppress errors using @ prior to the fopen() statement.
* The __production_error_handler() was logging all errors (except E_STRICT), even if they were deliberately suppressed using @. This patch updates the function so that it ignores suppressed errors. I've also added a comment to explain what 2048 means, and why the E_STRICT constant isn't being used.

This has been logged as a bug at http://www.projectpier.org/node/3245.
Update tools/upload.php

Verify user is logged in before uploading files to prevent remote code execution (http://packetstormsecurity.org/files/117070/projectpier-exec.txt)

I'm positive there is a better way to accomplish this but this is what I'm using in the interim.
Merge branch 'master' of https://github.com/phpfreak/Project-Pier
Updated code that generates parking URLs so that if no URL is defined in the config settings, then no URL is generated at all.  I believe this was intended behaviour (as there is one location where the code checks whether the URL is blank and only adds an option if it isn't) but in all cases the config value had a query string appended, and therefore it would never be blank.

As well as ensuring that the contact's getReserveParkingSpaceUrl() function works properly, I have updated the code on the list_contacts view so that it only outputs the 'reserve parking space' option when a URL is available.  This was the only other place where the function is currently used.
I've removed attributes.php from the uploads directory, as this file is automatically created/updated by the software, and so should not be under version control (it always gets marked as changed, which is incorrect and confusing, and may end up causing the changes to be committed to the repo accidentally).  We also don't want any of the files that the application generates in this directory (the uploads themselves) to be accidentally committed to the repository, so I've added a .gitignore file to ignore everything except itself.  Now that this is present, we no longer need empty.txt, which was originally added to make sure that Git created the directory (as there is no way to create truly empty directories in Git).

I've added a check to FilesController::repair() so that it works correctly when the file is not there, however the code which is used for all normal usage is nicely encapsulated in the FileRepository_Backend_FileSystem class, which already handles things correctly if the file is missing, so that was the only place that needed updating.

The only other reference to attributes.php is in tools/db2fs.php, but this is referring to a local version of the file in that directory, and so is unaffected by this change.
Removed several files from the tools directory that shouldn't be part of the repo:

* attributes.php - created/modified by db2fs.php (though I had to update db2fs.php so that it works correctly when the file is not present).  It is updated to contain the latest attributes once the script has run.
* db2fs.log - stores output of db2fs.php, and created automatically if not already present.  Default contents is already the default value used when reading it in if not already present, therefore safe to remove.
* error_log - not referenced anywhere.  Presumably committed in error.
Removed empty.txt from all 'empty' directories - i.e. directories that are provided as empty by the application, and into which user files will go.

I have instead added .gitignore files to these directories that will ignore everything in them, so that we reduce the risk of accidentally committing user files into the repository, and to make it a lot easier to see the legitimate changes that have been made locally.  The empty.txt files were originally required because Git doesn't allow empty directories, but now we have .gitignore files in them they are no longer empty, so the original file is no longer required.
Adding a .gitignore file to the config directory so that the actual config.php for the local installation doesn't show up in Git change lists, which will also hopefully avoid it getting accidentally committed to the repo.
Added a new config option, 'expose user emails', which defaults to true (to mimic old behaviour).  If set to false, then all e-mail will come from the site address defined in the Mail From field (or automatically calculated if not set).  I also split the code that generates the site e-mail address into a getSiteEmailAddress() function, so that we encapsulate the logic to generate it better - it can now be called from elsewhere, if needed.

This will involve a change to the DB data (to add the new option to the config_options table, and to modify the ordering of a subsequent item).  I have added the necessary changes to initial_data.sql, but I don't know how to manage updates to existing systems.  Here is the code that will need to be run, but I have no idea where to put it, I'm afraid!

    INSERT INTO `<?php echo $table_prefix ?>config_options`
     (`category_name`, `name`, `value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`)
    VALUES
     ('mailing', 'mail_expose_user_emails', '1', 'BoolConfigHandler', 0, 12,
      'Enable to expose user e-mails in the from/reply-to field, or disable to always use the site address, below.');

    UPDATE `<?php echo $table_prefix ?>config_options`
    SET `option_order` = 13
    WHERE `category_name` = 'mailing' AND `name` = 'mail_from';
Merge pull request #27 from noxstyle/master

Proper singleton pattern for Template class
Merge pull request #28 from shawnpwalsh/master

Move timezone field from Account page to Contact page so that changes to it are saved
Merge pull request #29 from Rarian/master

User Creation Fix
Merge pull request #30 from MarkMaldaba/HideParkingStuffIfUnused

Hide parking stuff if unused
Merge pull request #32 from MarkMaldaba/ExposeUserEmailsOption

New config option: Expose user emails
Merge pull request #26 from SleepIT/patch-1

Update tools/upload.php
Merge pull request #31 from MarkMaldaba/SomeMoreTidyingOfUnneededFiles

Some more tidying of unneeded files
Merge branch 'master' of git://github.com/phpfreak/Project-Pier