Changeset 767


Ignore:
Timestamp:
Jun 7, 2022 6:41:24 AM (22 months ago)
Author:
anonymous
Message:

Add App param ‘template_ext’ used to inform services where to find header and footer templates. Minor fixes.

Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1dev/lib/FormValidator.inc.php

    r584 r767  
    452452    function validateStrDate($form_name, $msg='')
    453453    {
    454         if (($timestamp = strtotime(getFormData($form_name))) === -1) {
     454        if (false === strtotime($val)) {
    455455            $this->addError($form_name, $msg);
    456456            logMsg(sprintf('The string date %s is not valid.', getFormData($form_name)), LOG_DEBUG, __FILE__, __LINE__);
  • trunk/bin/module_maker/skel/admin.php

    r718 r767  
    203203********************************************************************/
    204204
    205 $nav->set('body_id', '%NAME_PLURAL%');
     205$nav->set('id', '%NAME_PLURAL%');
    206206
    207207include 'header.ihtml';
  • trunk/docs/coding_standards.txt

    r334 r767  
    1111Essential reading:
    1212http://pear.php.net/manual/en/standards.php
     13
     14
     15=====================================================================
     16General guidelines
     17=====================================================================
     18
     19- Respect these coding styles.
     20- Don't add npm dependencies if you can avoid it. If a new dependency is unavoidable, be mindful of its size, freshness and added value.
     21- Use Svelte for all UI needs.
     22- Try to not shoehorn your code into existing functions or components.
     23- Simple is better. OOP is not inevitable. Simple functions often work as well, if not better.
     24- If you must use OOP, avoid inheritance as much as possible, no one likes digging several layers of abstraction.
     25- Comment the code. What, why, how, just make your intent clear.
    1326
    1427
     
    4558
    4659Use an indent of 4 spaces, with no tabs. Code and especially comments should
    47 usually be wrapped <= 80 characters. Exceptions are made in the case where 
     60usually be wrapped <= 80 characters. Exceptions are made in the case where
    4861code readability is significantly improved with longer lines.
    4962
     
    224237    {
    225238        $app =& App::getInstance();
    226    
     239
    227240        // If an array, check values recursively.
    228241        if (is_array($email)) {
     
    284297All code should work with register_globals = Off. This means using
    285298$_REQUEST, $_GET, $_POST, $_COOKIE, $_SESSION, $_SERVER, and $_ENV
    286 to access all request, get, post, cookie, session, server, and 
     299to access all request, get, post, cookie, session, server, and
    287300environment data, respectively.
    288301
  • trunk/lib/App.inc.php

    r763 r767  
    8888        'site_version' => '', // Version of this application (set automatically during start() if site_version_file is used).
    8989        'site_version_file' => 'docs/version.txt', // File containing version number of this app, relative to the include path.
     90        'template_ext' => 'ihtml', // Legacy template file send in .ihtml, newer sites use .inc.html or .inc.php.
    9091
    9192        // The location the user will go if the system doesn't know where else to send them.
  • trunk/lib/Email.inc.php

    r759 r767  
    3737    'subject' => 'Your account has been activated',
    3838));
    39 $email->setTemplate('email_registration_confirm.ihtml');
     39$email->setTemplate('email_registration_confirm.eml');
    4040// $email->setString('Or you can pass your message body as a string, also with {VARIABLES}.');
    4141$email->replace(array(
  • trunk/lib/Validator.inc.php

    r737 r767  
    404404        }
    405405
    406         $timestamp = strtotime($val);
    407         if (!$timestamp || $timestamp < 1) {
     406        if (false === strtotime($val)) {
    408407            $app->logMsg(sprintf('%s (line %s) failed: %s', __METHOD__, __LINE__, getDump($val)), $type, $file, $line);
    409408            return false;
  • trunk/services/admins.php

    r762 r767  
    208208 *****************************************************************************/
    209209
    210 $nav->set('body_id', 'admins');
    211 
    212 include 'header.ihtml';
     210$nav->set('id', 'admins');
     211
     212include 'header.' . $app->getParam('template_ext');
    213213$app->carryQuery($locally_carried_queries);
    214214include 'codebase/services/templates/' . $main_template;
    215 include 'footer.ihtml';
     215include 'footer.' . $app->getParam('template_ext');
    216216
    217217/********************************************************************
  • trunk/services/lock.php

    r762 r767  
    7171
    7272// Templates.
    73 include 'header.ihtml';
     73include 'header.' . $app->getParam('template_ext');
    7474// $lock->printErrorHTML();
    7575include 'lock.ihtml';
    76 include 'footer.ihtml';
     76include 'footer.' . $app->getParam('template_ext');
    7777
  • trunk/services/login.php

    r762 r767  
    7070        }
    7171    } else {
    72         $app->raiseMsg(_("Login failed, please try again."), MSG_NOTICE, __FILE__, __LINE__);
    73         $app->logMsg(sprintf('User %s failed login (encrypted password: %s)', $frm['username'], $auth->encryptPassword($frm['password'])), LOG_NOTICE, __FILE__, __LINE__);
     72        $app->raiseMsg(_("Log in failed, please try again."), MSG_NOTICE, __FILE__, __LINE__);
     73        $app->logMsg(sprintf('User %s failed log in (encrypted password: %s)', $frm['username'], $auth->encryptPassword($frm['password'])), LOG_NOTICE, __FILE__, __LINE__);
    7474    }
    7575}
    7676
    7777// Titles and navigation header.
    78 $nav->add(_("Login"));
     78$nav->add(_("Log in"));
    7979$nav->set('id', 'login');
    8080
    8181// Templates.
    82 include 'header.ihtml';
     82include 'header.' . $app->getParam('template_ext');
    8383include 'login_form.ihtml';
    84 include 'footer.ihtml';
     84include 'footer.' . $app->getParam('template_ext');
    8585
  • trunk/services/logs.php

    r763 r767  
    148148$page->calculate();
    149149
    150 include 'header.ihtml';
     150include 'header.' . $app->getParam('template_ext');
    151151if ('output' == $main_template) {
    152152    printLog($tmp_prefs->get('log_file'));
     
    154154    include $main_template;
    155155}
    156 include 'footer.ihtml';
     156include 'footer.' . $app->getParam('template_ext');
    157157
    158158
  • trunk/services/password.php

    r763 r767  
    9090
    9191// Templates.
    92 include 'header.ihtml';
     92include 'header.' . $app->getParam('template_ext');
    9393include 'password.ihtml';
    94 include 'footer.ihtml';
     94include 'footer.' . $app->getParam('template_ext');
    9595
  • trunk/services/reset_password.php

    r763 r767  
    9090$nav->set('id', 'reset_password');
    9191
    92 include 'header.ihtml';
     92include 'header.' . $app->getParam('template_ext');
    9393include 'reset_password.ihtml';
    94 include 'footer.ihtml';
     94include 'footer.' . $app->getParam('template_ext');
    9595
  • trunk/services/versions.php

    r762 r767  
    142142 *****************************************************************************/
    143143
    144 include 'header.ihtml';
     144include 'header.' . $app->getParam('template_ext');
    145145include 'codebase/services/templates/' . $main_template;
    146 include 'footer.ihtml';
     146include 'footer.' . $app->getParam('template_ext');
    147147
Note: See TracChangeset for help on using the changeset viewer.