PHP-Nuke: Management and Programming

Chris Karakas

www.karakas—online.de

Claudio Erba

www.spaghettibrain.com

Chris Karakas - Conversion from LyX to DocBook SGML, Index, document generation, PHP-Nuke module, see Credits

Andre Purfield - Translation from italian (v.1.0) and translation project coordination, see Credits

Fortunato Matarazzo - Translation from italian (v.1.0), see Credits

Chris Karakas - Translation from italian (v.1.0), see Credits

Revision History
Revision 2.104.08.2005Revised by: CK
Security bugfix and maintainance release. Fixed typos, made some improvements, closed a security hole in the section on How to include a HTML file and its links (thanks to waraxe for this, see http://www.waraxe.us), closed the same security hole in the PHP-Nuke module version of this document, added code for keycaps, applications, acronyms and product names in the CSS and some enhancements in jadetex.cfg.
Revision 2.016.02.2004Revised by: CK
Added more than 400 pages of additional material. See Credits section for the exact details.
Revision 1.2.122.08.2003Revised by: CK
Now available as PHP-Nuke module too. Link to the module source in the Formats section. Smaller logo.
Revision 1.229.05.2003Revised by: CK
New logo, CSS stylesheet, HTML validation, footer icons. Incorporated LDP reviewer's comments. Created Aknowledgements and Availability of sources sections.
Revision 1.113.02.2003Revised by: AP
Cleaned up the wording and a few typos.
Revision 1.009.01.2003Revised by: CK
First complete version.

There has always been the necessity to have a definitive guide on PHP-Nuke. This guide describes the installation and structure of PHP-Nuke and the details of customizing the front end to suit the users' needs. The architecture of PHP-Nuke, with its modules, blocks, topics and themes is presented in detail, as well as the interplay of PHP and MySQL for the creation of a mighty content management system (CMS).It also delves into more advanced issues, like the programming of PHP-Nuke blocks and modules, security, acceleration, and optimization. Day-to-day operations and miscellaneous topics are also covered.


Table of Contents
1. Terms of distribution
1.1. Disclaimer
1.2. Formats
1.3. Licence
1.4. Availability of sources
1.5. Credits
1.6. Aknowledgements
1.7. Conventions
1.8. The book behind the book
1.9. How to translate this HOWTO
2. Introduction to PHP-Nuke
2.1. Purpose
2.2. What Is PHP-Nuke
2.3. Short history of PHP-Nuke
2.4. The PHP-Nuke Communities
2.5. Why use PHP-Nuke and not static HTML pages
2.6. The PHP-Nuke forks
3. How to install PHP-Nuke
3.1. Prerequisites
3.2. Installation process
3.3. How to install PHP-Nuke through phpMyAdmin
3.4. phpMyAdmin: How to administer MySQL via Web
3.5. How to install PHP-Nuke using nukesql.php
3.6. How to install PHP-Nuke locally
3.7. The config.php file
3.8. Resources
3.9. Common installation problems
3.10. Common miscellaneous errors
4. How to upgrade PHP-Nuke
4.1. From 6.0 to 6.5
4.2. From phpBB to PHP-Nuke
4.3. PHP-Nuke upgrade scripts
5. How to move PHP-Nuke
5.1. Transferring a local installation to the Web
5.2. Changing Web hoster
6. Front end structure: user view
6.1. The preinstalled modules
6.2. Non-installed modules
6.3. The preinstalled blocks
7. Back end structure: administrator view
7.1. The administration functions
7.2. The Preferences Page
8. PHP-Nuke add-ons
8.1. Add-on themes
8.2. Add-on blocks
8.3. Add-on modules
9. Architecture and structure
9.1. Directory structure
9.2. Main page management
9.3. Module management
9.4. Administration management
10. Session management
10.1. How sessions work in the forums
10.2. How to eliminate session checks
11. Editing PHP (-Nuke) files
11.1. vi
11.2. Emacs
11.3. Bluefish
11.4. UltraEdit
11.5. WinSyntax
11.6. HTMLKit
11.7. Crimson Editor
11.8. PHPEd
12. Modifying the PHP-Nuke database
12.1. More than 255 characters of user extra information
13. Modifying PHP-Nuke texts
13.1. General PHP-Nuke texts
13.2. PHP-Nuke module texts
13.3. PHP-Nuke module and block titles
14. Customising PHP-Nuke themes
14.1. Structure of a PHP-Nuke theme
14.2. Modifying the PHP-Nuke theme HTML template
14.3. Modifying the PHP-Nuke theme header
14.4. Modifying the PHP-Nuke theme body
14.5. Modifying the PHP-Nuke theme index
14.6. Modifying the PHP-Nuke theme footer
14.7. Modifying the PHP-Nuke theme icons
14.8. Theme construction: the rules to follow
14.9. How to change a buggy PHP-Nuke theme
14.10. How to prevent users from changing the theme in PHP-Nuke
14.11. How to change the PHP-Nuke theme depending on the module
14.12. How to change the font size in PHP-Nuke
15. Modifying the PHP-Nuke HTML header
15.1. How to implement a favourites icon (favicon.ico)
15.2. How to prevent the statistics module from gathering hits from certain hosts
16. Modifying mainfile.php
16.1. How to allow special HTML tags
16.2. How to change the order of messages
16.3. How to change the duration of a public broadcast message
17. Modifying PHP-Nuke blocks
17.1. How to change a buggy block
17.2. How to build custom module blocks
17.3. How to build RSS blocks with variable number of news items
17.4. How to get scrolling headlines in blocks
18. Modifying PHP-Nuke modules
18.1. Modifying any PHP-Nuke module
18.2. Modifying the PHP-Nuke Homepage
18.3. Modifying the PHP-Nuke FAQ module
18.4. Modifying the PHP-Nuke Reviews module
18.5. Modifying the PHP-Nuke Web_Links module
18.6. Modifying the PHP-Nuke Your_Account module
18.7. Modifying the PHP-Nuke News module
18.8. Modifying the PHP-Nuke Submit News module
18.9. Modifying the PHP-Nuke Sections module
18.10. Modifying the PHP-Nuke Downloads module
18.11. Modifying the PHP-Nuke Stories Archive module
19. Modifying the PHP-Nuke administration panel
19.1. How to set an arbitrary "Stories Number in Home"
19.2. How to allow HTML in the Newsletter
20. Creating PHP-Nuke blocks
20.1. The characteristics of the various types of blocks
20.2. How to create a new block
20.3. Simple Content block
20.4. How to include PHP/HTML files in a PHP-Nuke block
20.5. How to use Javascript in PHP-Nuke blocks
20.6. How to display Flash in PHP-Nuke blocks
20.7. How to show advertisements in PHP-Nuke blocks
20.8. How to display images in PHP-Nuke blocks
20.9. How to display HTML forms in a block: Paypal
21. Creating modules
21.1. Module structure
21.2. Creating fully compatible modules: the rules to follow
21.3. Module creation, the public part
21.4. Module creation, administrator part
21.5. How to include a HTML file in a PHP-Nuke module
21.6. How to include a HTML file and its links in a PHP-Nuke module
21.7. How to include a HTML file and its links using an iframe in a PHP-Nuke module
21.8. How to include a plain text file in a PHP-Nuke module
21.9. How to use Javascript in PHP-Nuke modules
21.10. How to create a Logout module
21.11. How to show advertisements in PHP-Nuke modules
21.12. How to display HTML forms in a module
22. Duplicating PHP-Nuke modules
22.1. Duplicating the PHP-Nuke FAQ module
23. Security
23.1. How secure is PHP-Nuke?
23.2. The impact of bad security record on software popularity
23.3. Common PHP-Nuke security vulnerabilities
23.4. How to guard against security vulnerabilities in PHP-Nuke
23.5. How to ban IP addresses
23.6. Hacked - now what?
24. Accelerating PHP-Nuke
24.1. Caching PHP-Nuke
25. Optimizing PHP-Nuke
25.1. Search engines and dynamic URLs
25.2. mod_rewrite
25.3. Regular expressions
25.4. The .htaccess file
25.5. How to make PHP-Nuke search engine friendly
25.6. How to make PHP-Nuke hot link stealth
25.7. How to make a dynamic CSS
25.8. How to proceed when MySQL is slow
26. How to solve common probems with PHP-Nuke
26.1. How to repair a corrupt table
26.2. How to restore PHP-Nuke from backup
26.3. How to install new modules
26.4. How to install patches and correct errors
26.5. How to find all registration links
26.6. How to allow anonymous web link submissions
26.7. How to disable DEBUG mode
27. Miscellaneous
27.1. How to change the Home module
27.2. How to use PHP-Nuke under SSL
27.3. How to change PHP parameters when you don't have access to php.ini
27.4. How to display HTML code in a FAQ
27.5. How to enter thousands of web links
27.6. How to enter thousands of download links
27.7. How to check the validity of thousands of web links
27.8. How to enter thousands of ephemerids
27.9. How to make the Encyclopedia international
27.10. How to find the user name in a module
27.11. How to correct thousands of users fields
27.12. How to size the select boxes in a module
27.13. How to deal with date and time
27.14. How to deal with quotes in the site's name
27.15. How to embed a Flash object in PHP-Nuke News
27.16. How to backup your MySQL database using only the browser
28. Programmer's tools
28.1. The database tables
28.2. The syntax of HTML code
28.3. The syntax of CSS
28.4. The syntax of PHP code
28.5. The syntax of SQL code
28.6. MySQL Front, how to administer a MySQL DB from Windows
28.7. Foxserv, making PHP-Nuke work on Windows Systems
A. Appendix
A.1. The GNU Free Documentation Licence
Index
List of Tables
6-1. Classification with topics and sections
14-1. <body> tags in theme.php of various themes
16-1. Calls to filter_text from PHP-Nuke modules (v.6.8)
16-2. Calls to check_html from PHP-Nuke modules (v.6.8)
20-1. Help Center Live: setcookie() calls
21-1. Changing HTML links for use in a custom PHP-Nuke module
21-2. Alternative way of changing HTML links for use in a custom PHP-Nuke module
23-1. List of PHP-Nuke security vulnerabilities
25-1. URL replacement with replace_for_mod_rewrite(): dynamic to static.
List of Figures
2-1. phpnuke.org, the official PHP-Nuke site.
3-1. WS_FTP: General connection parameters.
3-2. WS_FTP: Main screen with local and remote windows.
3-3. PHP-Nuke 6.0 file structure
3-4. WS_FTP context menu on right mouse click: chmod (UNIX)
3-5. WS_FTP Remote file permissions window
3-6. PHPMyAdmin start screen.
3-7. phpMyAdmin: Select database.
3-8. phpMyAdmin: Navigation bar.
3-9. phpMyAdmin: field functions.
3-10. phpMyAdmin: SQL function.
3-11. phpMyAdmin: database dump.
3-12. phpMyAdmin: table forum_topics.
3-13. phpMyAdmin: Create database.
3-14. phpMyAdmin: table structure and selection.
3-15. phpMyAdmin: SQL query.
3-16. phpMyAdmin: table data.
3-17. easyPHP: Installation screen.
3-18. easyPHP icon in the bottom bar.
3-19. phpinfo: PHP screen for a Windows system.
3-20. RPMdrake: selecting the Apache package(s) for installation.
3-21. Mandrake Control Center.
3-22. Red Hat Menu: Packages.
3-23. Red Hat: Package Sections.
3-24. Red Hat: Service Configuration Panel.
3-25. analyze.php: MySQL connection transcript.
3-26. analyze.php: MySQL security warning.
3-27. Modules administration panel.
3-28. Security code in the User Login screen.
3-29. phpinfo(): GD library information.
3-30. analyze.php: GD library information.
3-31. User Login screen.
3-32. Administration panel: Forums.
3-33. Administration panel: Forums.
3-34. Administration panel: Edit Admins.
3-35. Administration panel: Edit Admins.
3-36. phpMyAdmin: field functions.
3-37. Gzip compression in the Admin Panel of the Forums module.
3-38. Administration panel: Modules.
3-39. Missing blocks.
6-1. PHP-Nuke Homepage
6-2. Classifying articles
6-3. Downloads module
6-4. Private messages
6-5. Search module
6-6. Statistics module
6-7. Your account
6-8. Splatt Forum.
6-9. phpBB Forum.
6-10. The standard Modules block
6-11. Waiting Content block.
6-12. Who Is Online block.
6-13. Languages block.
6-14. Surveys block.
6-15. Login block.
7-1. Administration panel.
7-2. Administration panel: Add story.
7-3. Attaching a poll to an article awaiting admission.
7-4. Article Poll block.
7-5. Administration panel: Backup DB.
7-6. Administration panel: Banners.
7-7. Administration panel: Blocks.
7-8. Administration panel: Content.
7-9. Administration panel: Downloads.
7-10. Administration panel: Edit Admins.
7-11. Administration panel: Edit Users.
7-12. Administration panel: Encyclopedia.
7-13. Administration panel: Ephemerids.
7-14. Administration panel: FAQ.
7-15. Administration panel: Forums.
7-16. Administration panel: HTTP Referers.
7-17. Administration panel: Messages.
7-18. Administration panel: Modules.
7-19. Modules administration panel.
7-20. Administration panel: Newsletter.
7-21. Administration panel: Optimize DB.
7-22. Administration panel: Preferences.
7-23. Administration panel: Reviews.
7-24. Administration panel: Sections.
7-25. Administration panel: Submissions.
7-26. Administration panel: Surveys.
7-27. Administration panel: Topics.
7-28. Administration panel: Add a new topic.
7-29. Administration panel: Web Links.
7-30. Administration panel: Logout.
7-31. Administration panel: Forums.
7-32. Administration panel: Preferences.
7-33. General site info in the Preferences page.
7-34. Icons in the footer.
7-35. WebMail service options in the Preferences page.
8-1. Moon, Moon & Sun and Sun blocks.
8-2. Meteosat block.
8-3. Menu block with Menu Builder.
8-4. Treemenu block with PHP.
8-5. Treemenu block with Javascript.
8-6. Modules block. created with Sommaire Paramétrable.
8-7. Random Quotes block.
8-8. Event Calendar
8-9. Calendar1 Block
8-10. Calendar2 Block
8-11. Calendar3 Block
8-12. Calendar4 Block
8-13. Calendar5 Block
8-14. Extra options for user management in the NSN Your Account Tweak module.
8-15. Pending applications in the Approve Membership module.
8-16. Approval message in the Approve Membership module.
8-17. E-mail management in the Approve Membership module, part I.
8-18. E-mail management in the Approve Membership module, part II.
8-19. Gallery module.
8-20. Gallery related files at nukedgallery.
8-21. IP Tracking module: IP Tracking Info.
8-22. IP Tracking module: Page View Info.
8-23. camPortal block.
8-24. camPortal module.
8-25. ConquerCam: main window with the Options dialog opened up.
8-26. MyHeadlines Box containing syndicated content.
8-27. MyHeadlines: Subscribing to News sources.
8-28. PHP-Nuke Tools block
8-29. PHP-Nuke Tools module: Module Creator.
8-30. Upload module.
8-31. ODP module.
8-32. Calloways Cart module: Add Product screen.
8-33. Administration panel: WorkBoard.
8-34. WorkBoard module: Administration panel.
9-1. PHP-Nuke directory structure.
12-1. Extra Info field of User Personal Information (Your Info)
14-1. Structure of the NukeNews theme.
14-2. Structure of other themes, without HTML templates.
14-3. Top navigation bar in the NukeNews theme.
14-4. News article: “posted by” does not mean “submitted by”.
16-1. Administration panel: Messages.
17-1. The standard Modules block
17-2. The standard Modules block.
17-3. Treemenu Block.
17-4. Treemenu Block with “Links” expanded.
17-5. Treemenu Block with “My work” expanded.
17-6. Treemenu Block with “Linux” expanded.
18-1. Administration panel: Modules.
18-2. Administration panel: FAQ.
18-3. Administration panel: Reviews.
18-4. Administration panel: Web Links.
18-5. Your Info link in the User Preferences panel.
18-6. Forum Profile link in the Forums module.
18-7. User profile in Your Info.
18-8. User profile in the Forums.
18-9. Administration panel: Add story.
18-10. Administration panel: Submissions.
18-11. Waiting Content block.
18-12. Administration panel: Sections.
18-13. Administration panel: Downloads.
18-14. Administration panel: Add story.
19-1. Administration panel.
19-2. Administration panel: Preferences.
19-3. Administration panel: Newsletter.
20-1. Administration panel: Blocks.
20-2. Block example
20-3. Administration panel: Content.
20-4. Hello World block with Javascript.
20-5. Help Center Live: Main screen.
20-6. Help Center Live block: Live Support is Offline.
20-7. Help Center Live block: Creating a trouble ticket.
20-8. Help Center Live block: Live Support is Online.
20-9. Help Center Live block: Request monitor for the operator.
20-10. Help Center Live block: User notification of the operator's chat request.
20-11. Help Center Live block: User chat request.
20-12. PayPal donation button
20-13. PayPal donation block.
21-1. PHPMyAdmin: inserting values
21-2. Example module.
21-3. PHP-Nuke HOWTO included in a module with the help of an iframe.
21-4. Logout link in the Modules block.
23-1. PHP security warning from analyze.php.
23-2. Site key security warning from analyze.php.
23-3. WebMail security warning from analyze.php.
24-1. Accelerating PHP-Nuke.
24-2. Optimizing PHP code execution.
24-3. Powered by jpcache.
24-4. Cache-Lite is powered by PEAR.
24-5. Turck MMCache.
25-1. Apache section of the phpinfo() output: mod_rewrite is loaded.
25-2. mod_rewrite: The control flow through the rewriting ruleset
25-3. mod_rewrite: The back-reference flow through a rule.
25-4. Pattern matching with a regular expression.
26-1. Administration panel: Backup DB.
26-2. Administration panel: Backup DB.
26-3. phpMyAdmin: SQL query.
26-4. Administration panel: Modules.
26-5. Administration panel: Web Links.
27-1. Administration panel: Modules.
27-2. Modules administration panel.
27-3. Administration panel: FAQ.
27-4. Administration panel: Web Links.
27-5. Administration panel: Downloads.
27-6. Administration panel: Web Links.
27-7. Administration panel: Ephemerids.
27-8. Administration panel: Encyclopedia.
27-9. Administration panel: Downloads.
27-10. Downloads: Add download.
27-11. Downloads: Add download.
27-12. Downloads: Main categories with last download date.
27-13. Your Info profile: Timezone and Date settings.
28-1. CSS page area model.
28-2. MySQL Front: Connection
28-3. MySQL Front: export tables
28-4. MySQL Front: SQL Query