CodeSort

Apr 14, 2005, , , ,

CodeSort

codesort2.zip
90.44 KB

CodeSort (formerly known as phpCodeSort) is a script designed to upload, categorize and manage link images/buttons/codes for all your owned fanlistings from one convenient admin panel. It works something like a mini photo gallery.

Latest version: CodeSort 2.0
Released February 17, 2007. Minor bugfixes February 25, 2007.

NOTE: I have no plans to continue developing this script. CodeSort will remain available as is, but no new releases are planned, and I will not answer any support requests.

Features

  • Manage the codes/link graphics for all your fanlistings plus your collective site in one place.

  • Upload/rename/delete images through the admin panel—no need for FTP after installation. (Depending on your server configuration, this may require the images directory to be world-writeable, which is a potential security risk. You can also use CodeSort to categorize images without file system access.)

  • New with version 2.0: Images can now be added/updated en masse, with master controls to set the same parameters for all.

  • New with version 2.0: Unique image names are checked. If a newly uploaded file has the same name as an existing file, it is renamed to include a timestamp to avoid overwriting. Unlike previous versions, images are not renamed with an unreadable hash.

  • If you delete an image from the database, the file itself is also deleted off the server (this was not the case with earlier versions). This helps keep a tidy images folder, if you have space concerns.

  • New with version 2.0: There is a batch images cleanup script to find any lingering old, no longer used images and delete them.

  • Can use the fanlisting tables of three popular collective management scripts (Enthusiast 3, Flinx Collective, and Fan Admin) or function separately. (CodeSort must be installed in the same database as said management script.) New with version 2.0: The advanced user can configure CodeSort to read the fanlistings table of any additional collective scripts, as long as it contains a unique integer ID and subject/title field.

  • Sort images by user-defined sizes and categories.

  • Categories are optional; if you don’t use them on a given fanlisting then image categories won’t be displayed on that site.

  • Optional automatic text link to the donor of any donated graphics.

  • A form to accept image donations directly. The image is uploaded and donor details are entered into the database. You will receive an email when a image has been donated, so you can login to the admin panel and approve or delete it. Donated images will not be displayed on your site until they have been approved (much like fanlisting members). New with version 2.0: Now with an (optional) captcha to prevent non-human/spam submissions.

  • Easily include the script into your own page design with a small PHP snippet.

  • New with version 2.0: Notification via the admin panel when a newer version is available, so you never forget to update.

  • Requires PHP 4 and MySQL 4. (May work with earlier versions of MySQL, but has not been tested. May possibly work with other databases if you edit the SqlConnection class.)

  • All HTML output should validate XHTML 1.0 Strict.

Demos

View CodeSort frontend demo. This is what the default uncustomized installation of CodeSort looks like. You can easily edit the CSS for styling, and even the PHP coding if you feel confident.

View CodeSort admin area demo. This is what the admin panel for CodeSort looks like. Username: admin. Password: pass. Feel free to test it out by adding data; I periodically go through and purge the database.

Installation Instructions

Follow the instructions (included in readme.txt in the download above) below to install CodeSort version 2.0. If you are upgrading from version 1.5 or 1.6, you will need to enter your current config settings into the NEW codes-config.php file; there are some important changes to that and the old one won’t work. There is currently no upgrade script for version 1.0, because no one seems to be using it anymore.

Fresh Install / Version 1.6 or 1.5 Upgrade

  1. Edit the config file:
    Open the file codes-config.php in a plain text editor. Edit the variables for your site. You MUST change the DATABASE VARIABLES for your MySQL database and the ADMIN VARIABLES for your username and password. The TABLE VARIABLES only need to be changed if you want to use CodeSort in conjunction with one of the supported collective management scripts (Enthusiast 3, Flinx Collective, or Fan Admin). If so, you must install CodeSort in THE SAME database as said management script.
  2. Upload CodeSort files:
    Upload all of the CodeSort files to an http-accessible directory on your webserver. (Overwrite your current files if you are upgrading.)
  3. Create images folder: (if upgrading, you’ve already got this. skip to step 4)
    You will need to create a folder for your images/codes—the default is as a direct sub-directory of your CodeSort directory (ie CodeSort/images). The install script will determine the server path and URL setting for this location, so you should use that if you have no reason not to.
  4. Run install script:
    Run the install.php script by going to
    http://yoursite.com/CODESORT_FOLDER/install.php
    You’ll need to set some more options for your site here, including the location of your images folder. Then submit the form to create or update the CodeSort database tables.
  5. Once you have successfully run the installation script, be sure to DELETE it from you webserver (you won’t need it anymore). Then you can begin managing codes from the admin panel. If you are using the script stand-alone you’ll first need to add the names of your fanlistings in the ‘Fanlistings’ tab (you won’t have this option if you’re accessing your list of fanlistings from another collective management script).
  6. Try uploading a code/image. If you get errors about permission denied to move uploaded file, see the note below about folder permissions:

Important: a security note on CHMOD 777

Folder permissions of 777 may be needed to allow PHP to upload files (and there is really no simple alternative), but it is also a very big security risk—it can allow malicious people to upload any files they like into that folder because it is world writable. If your server requires 777 for your own uploads to work (e.g., you get permission denied errors when trying to upload a file with CodeSort), the safest thing you can do is to NOT use CodeSort to upload your images (set do_upload = n in the install options and use your preferred FTP client) and just give CodeSort the file name. You could also manually change the permissions to 777 (via your FTP client), use the CodeSort admin panel with do_upload = y, and then change permissions back to 755 when you are done.

Displaying Codes

To display your codes for a single fanlisting or for your entire collective, visit the admin panel home page and click the buttons for ‘get snippet.’ This will generate a code snippet that you can copy-and-paste into any .php page to display your codes (and donation upload form, if you want to use it).

Please note: This snippet is not compatible with NL-ConvertToPHP/dynamic includes pages! This means you can’t put the inclusion snippet within any PHP coding similar to
if ($_SERVER['QUERY_STRING'] == 'codes') {
If you’re not sure, the best bet is to put the snippet for CodeSort in its own .php page, along with whatever other content you want on your codes page. You CAN put the codes and donation form snippets on the same page, if you like.

Mods

show-codes.mod.zip
A modified version of show-codes.php that mixes donated graphics in with the rest, and links them directly to the donor’s website (rather than under a separate heading, as in the standard version).