Changeset 214 for trunk/docs


Ignore:
Timestamp:
Dec 12, 2006 12:28:01 AM (17 years ago)
Author:
quinn
Message:

Q - Final check-in before releasing trunk as version 2.1

Location:
trunk/docs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/coding_standards.txt

    r209 r214  
    77======================================================================
    88
    9 We're following the PEAR coding standards, with minor modifications.
    10 
    11 This is essential reading:
     9Our standards follow closely the PEAR coding standards.
     10
     11Essential reading:
    1212http://pear.php.net/manual/en/standards.php
    1313
     
    2424                        remains "Auth_SQL"
    2525
    26 some_file.ihtml         HTML file, which may or may not have some PHP,
     26some_file.inc.html      HTML file, which may or may not have some PHP,
    2727                        but will be included by some other PHP file. Never
    2828                        includes sensitive code as these files may be accessed
     
    3030
    3131script.cli.php          A command-line executable script, possibly executed
    32                         with CRON, usually outputs TEXT, not HTML.
    33 
    34 dbname.mysql            Database schema file that goes with the application.
     32                        with CRON. Outputs TEXT if any instead of HTML.
     33
     34schema.mysql            Database schema file that goes with the application.
    3535
    3636main.screen.css         CSS file with media: screen/print/all
     
    182182        // Here comes the HTML...
    183183        ?>
    184         <div align="right" class="sc-tiny">
    185         [&nbsp;<a href="<?php echo $app->oHREF('contact.php') ?>">Contact us</a>&nbsp;]
     184        <div class="sc-tiny">
     185            <a href="<?php echo $app->ohref('/contact.php') ?>">Contact us</a>
    186186        </div>
    187187        <?php
     
    200200http://java.sun.com/products/jdk/javadoc/writingdoccomments/index.html
    201201
     202Here is an example of the codebase method Email::validEmail():
     203
    202204    <?php
    203205    /**
    204      * Description of function.
     206     * Validates an email address based on the recommendations in RFC 3696.
     207     * Is more loose than restrictive, to allow the many valid variants of
     208     * email addresses while catching the most common mistakes. Checks an array too.
     209     * http://www.faqs.org/rfcs/rfc822.html
     210     * http://www.faqs.org/rfcs/rfc2822.html
     211     * http://www.faqs.org/rfcs/rfc3696.html
     212     * http://www.faqs.org/rfcs/rfc1035.html
    205213     *
    206214     * @access  public
    207      * @param   string  $db_table   Database table.
    208      * @param   string  $db_column  Database column containing set or enum datatype.
    209      * @return  array               The set/enum values or false on failure.
     215     * @param   mixed  $email  Address to check, string or array.
     216     * @return  bool    Validity of address.
    210217     * @author  Quinn Comendant <quinn@strangecode.com>
    211      * @version 1.0
    212      * @since   24 Feb 2004 19:34:04
     218     * @since   30 Nov 2005 22:00:50
    213219     */
    214     function getSetEnumFieldValues()
     220    function validEmail($email)
    215221    {
    216         $db =& DB::getInstance();
    217        
    218         $qid = $db->query("SHOW COLUMNS FROM $db_table LIKE '$db_col'",false);
    219 
    220         $row = mysql_fetch_row($qid);
    221         if (preg_match('/^enum|^set/i', $row[1]) && preg_match_all("/'([^']*)'/", $row[1], $match)) {
    222             return $match[1];
     222        $app =& App::getInstance();
     223   
     224        // If an array, check values recursively.
     225        if (is_array($email)) {
     226            foreach ($email as $e) {
     227                if (!$this->validEmail($e)) {
     228                    return false;
     229                }
     230            }
     231            return true;
    223232        } else {
    224             return false;
     233            // To be valid email address must match regex and fit within the lenth constraints.
     234            if (preg_match($this->getParam('regex'), $email, $e_parts) && strlen($e_parts[2]) < 64 && strlen($e_parts[3]) < 255) {
     235                return true;
     236            } else {
     237                $app->logMsg(sprintf('Invalid email: %s', $email), LOG_INFO, __FILE__, __LINE__);
     238                return false;
     239            }
    225240        }
    226241    }
  • trunk/docs/file_layout.txt

    r137 r214  
    1 Updated: 26 Aug 2005 14:37:42
    2 
    3 ======================================================================================
    4 Codebase can be located anywhere, as long as it is in the application's include path.
    5 ======================================================================================
     1Updated: 11 Dec 2006 16:25:10
     2=====================================================================
    63
    74codebase/
    8     bin/
    9         (generic command-line scripts and applications)
     5    bin/ (generic command-line scripts and applications)
     6        acl.cli.php (Tool for managing the permissions of an ACL.inc.php based system)
     7        extract_gettext.pl (tool for exporting all the strings called by the _("Gettext function") )
    108        file_importer.php
    119        install.sh
    12         pedit_permissions.sh
    1310        module_maker/ (scripts for generating modules)
    1411            _config.inc.php
     
    1613            list_template.cli.php
    1714            module.cli.php
    18             skel/
    19                 (templates for generating modules)
     15            skel/ (templates for generating modules)
    2016                adm_form.ihtml
    2117                adm_list.ihtml
     
    2622            sql.cli.php
    2723            validation.cli.php
     24        pedit_permissions.sh
     25    css/ (generic CSS files to be included using lib/CSS.inc.php)
     26        admin.inc.css (CSS for the generic Strangecode administration system)
     27        codebase.inc.css (CSS for html output by codebase libraries)
     28        utilities.inc.css (generic CSS tools)
    2829    docs/
    29         codebase_script_template.php
    3030        coding_standards.txt
     31        example_config.inc.php (an example of the _config.inc.php site-boot document)
     32        example_script_template.php
    3133        example_virtualhost_directive.txt
    3234        file_layout.txt
    33         software_licence.txt
    34         todo.txt
     35        gpl.txt
     36        revision_history.txt
     37        version.txt (the version number of this codebase)
    3538    lib/
    36         App.inc.php (functions dealing with sessions, href/url/IP manipulation, directories.)
    37         Auth_File.inc.php (file-based authentication system.)
    38         Auth_SQL.inc.php (sql-based authentication system.)
     39        ACL.inc.php (provides Access Control List functionality)
     40        App.inc.php (provides global application functionality: sessions, href/url/IP manipulation, directories)
     41        Auth_File.inc.php (file-based authentication system)
     42        Auth_SQL.inc.php (sql-based authentication system)
    3943        AuthorizeNet.inc.php (routines for connection to authorize.net's advanced processing interface)
    40         CSS.inc.php
    41         DB.inc.php (database abstraction layer.)
    42         DBSessionHandler.inc.php (database session handler.)
    43         FormValidator.inc.php (validation routines used to test incoming user data.)
     44        Cache.inc.php (provides session-based caching functionality for quick retreival of all PHP data types)
     45        CSS.inc.php (manage and deliver CSS data)
     46        DB.inc.php (minimal database abstraction layer)
     47        DBSessionHandler.inc.php (database session handler)
     48        Email.inc.php (provides email validation and sending functionality)
     49        FormValidator.inc.php (validation routines used to test incoming user data)
    4450        Google_API.inc.php (class for connecting to, querying, and dealing with data of the Google API)
    45         ImageThumb.inc.php (automated image thumbnailing routines.)
     51        Heirarchy.php (class for manipulation of heirarchies)
     52        Image.inc.php (manage printing of images related to db records)
     53        ImageThumb.inc.php (automated image thumbnailing routines)
     54        Lock.inc.php (db record locking system)
    4655        MCVE.inc.php
    47         Nav.inc.php (navigation element management class))
    48         NodeHeirarchy.php (class for manipulation of node heirarchies.)
     56        Navigation.inc.php (navigation element management class))
    4957        PageNumbers.inc.php (class for managing and printing various elements of page numbers and pagenation)
    5058        PageSequence.inc.php (manage a sequence of steps and data from step form elements, like order checkout or signup)
     
    5260        PEdit.inc.php (page-by-page file-based content management system)
    5361        Prefs.inc.php (class for semi-permenent storage of values)
    54         Lock.inc.php (db record locking system)
    55         Version.inc.php (db record versioning system)
    5662        ScriptTimer.inc.php (timer for scripts)
    57         Cache.inc.php (class for accessing a cache in a users session, stores any variables for quick retreival)
    5863        SortOrder.inc.php (class dealing with sorting of columns in database generated lists)
    5964        SpellCheck.inc.php
    60         TemplateGlue.inc.php (functions that generating html.)
    61         Upload.inc.php (class that manages uploading of files.)
    62         Utilities.inc.php (functions for general utility: setting defaults, num/string functions, etc.)
    63     services/
    64         (codebase scripts that are only useful when web accessible, i.e. to be used in a doc root)
     65        TemplateGlue.inc.php (functions that generating html)
     66        Upload.inc.php (class that manages uploading of files)
     67        Utilities.inc.php (functions for general utility: setting defaults, num/string functions, etc)
     68        Version.inc.php (db record versioning system)
     69    services/ (codebase scripts that are only useful when web accessible, i.e. to be used in a doc root)
    6570        admins.php
    6671        css.php
     
    7176        password.php
    7277        phpinfo.php
    73         templates
     78        provides
     79        templates/
    7480        versions.php
     81    tests/ (unit-based tests for all codebase libraries)
     82
     83===================================================================================
     84Group of applications and related files, usually installed at /home/user/www.domain.com/
    7585
    7686
    77 ======================================================================================
    78 Group of applications and related files, usually installed at /home/user/www.domain.com/
    79 ======================================================================================
    80 
    81 global/
    82     (global level configuration and libraries for a group of sites/apps)
     87global/ (global level configuration and libraries for a group of sites/apps)
    8388    config.inc.php (system-wide configuration)
    8489    db_auth.inc.php (db-authentication for CLI scripts. chown'ed by user executing cron, NOT apache).
    8590
    86 docs/
    87     (documents specific to a group of sites/apps)
    88     tei_db.mysql (db schema)
     91docs/ (documents specific to a group of sites/apps)
     92    schema.mysql
    8993
    90 bin/
    91     (global level command-line scripts)
     94bin/ (global level command-line scripts)
    9295
    93 admin/
    94     (DocumentRoot for the admin application)
     96admin/ (DocumentRoot for the admin application)
    9597    _config.inc.php
    9698    _templates/ (templates used for the admin docroot)
     
    107109    versions.php (manage db record versions)
    108110
    109 html/
    110     (DocumentRoot of main site application)
    111     _config.inc.php (configuration options and defaults specific to this site. included first in each script.)
     111html/(DocumentRoot of main site application)
     112    _config.inc.php (configuration options and defaults specific to this site. included first in each script)
    112113    _templates/ (site specific templates. templates here override global codebase templates with same name)
    113114    css.php (style sheets loader)
Note: See TracChangeset for help on using the changeset viewer.