Python CMS Code
Status: Beta
Brought to you by:
eric3_14159
This is a collection of useful scripts and files. To use, they should all be placed in a directory reachable by a web server on the system, which allows Python CGI scripts with the executable bit set and the extension .cgi This is most easily achieved by moving the directory this package expanded in to to the spot it should be accessed, say, /var/www or /var/www/website (it will not interfere with any web site files in directories above itself). The minimum files necessary are: bodies/ cgi_error.py editor.cgi extract_tags.py file-editor.cgi file-uploader.html frame.html local_cgi.py merge.py password.py save-file.cgi save-uploaed-file.cgi style.css update-all.cgi update.cgi viewer.cgi The owner of the webserver process will need write access to this directory and the bodies/ subdirectory. The file frame.html defines the elements which should be the same on every page. It must be a complete HTML file, with three tokens. "INSERT TITLE HERE" must appear in between the <title> tags, /* INSERT CSS HERE */ must appear in the <style> tags, and <!-- INSERT HTML HERE --> must appear somewhere in the body. Other than that, it is a completely normal page, and so can define its own CSS and surrounding content, such as a banner and navigation links, and then indicate where the unique page content will be filled in. Editing the website should not be done through direct access of the files. Instead, use a web browser to go to viewer.cgi in the root of the website. From here, there are links to create a new page as well as edit links for all pages created with this system. Either will take you to an editor, which has the filename as it should be typed in a URL, spaces for either the name of a background image which is already loaded or a file to be uploaded, a block for the CSS, and the body. The page body should be HTML which is assumed to be directly inserted into frame.html, so it does not require any of the <html>, <head>, or <body> type tags. Finally, there is a password prompt for security next to the save button. frame.html and the default CSS, style.css can also be edited from special links in viewer.cgi . This should be done carefully, as they impact the entire site and errors could break everything. They also use a password for authentication. If you absolutely must edit the files directly, the bodies are stored in the bodies/ subdirectory, with the same name as they appear in the main directory. After editing them, run the script update-all.cgi, either as a python script or accessing it through a web browser. Files which do not need to conform to the standard web page as defined in frame.html can just be loaded normally, and will be ignored by the system. To cause backups to be recorded, just visit backup.cgi in a web browser or execute backup.sh . backup.cgi may need to be removed if unauthorized users attempt to use it to cause a DoS attack on the system. To delete a page created in the editor, the delete-page.sh script will take a list of pages and deletes both the visible page and the body stored in the bodies/ directory. It is best to use this script to remove a page rather than deleting the files by hand so that they correctly disappear from both the publicly reachable files and the list in viewer.cgi . To change the password, run the create-password.sh script. Neither this nor delete-page.sh are executable, to prevent unauthorized execution of them as CGI scripts. WARNING: Due to the nature of these scripts, if someone learns the password to the website, they may be able to gain access to a shell! Guard the password carefully!