Changeset 768


Ignore:
Timestamp:
Jun 9, 2022 7:24:04 PM (23 months ago)
Author:
anonymous
Message:

Minor improvements

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/module_maker/list_template.cli.php

    r664 r768  
    117117            'longblob' == $type
    118118        ) {
    119             $listrows[] = "<\x3fphp echo mb_strlen(\$list[\$i]['$field'])<50 \x3f oTxt(\$list[\$i]['$field'], true) : oTxt(trim(mb_substr(\$list[\$i]['$field'], 0, 50)) . '...'); \x3f>";
     119            $listrows[] = "<\x3fphp echo mb_strlen(\$list[\$i]['$field'])<50 \x3f oTxt(\$list[\$i]['$field']) : oTxt(trim(mb_substr(\$list[\$i]['$field'], 0, 50)) . '...'); \x3f>";
    120120        } else if (preg_match('/.*(begin|start).*date.*/i', $field)) {
    121121            $listrows[] = "<\x3fphp echo \$db->getParam('zero_date') == \$list[\$i]['$field'] ? '' : date(\$app->getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>";
     
    135135            $listrows[] = "<input type=\"text\" name=\"rank[<\x3fphp echo \$list[\$i]['$primary_key']; \x3f>]\" value=\"<\x3fphp echo \$list[\$i]['rank']; \x3f>\" size=\"5\" />";
    136136        } else {
    137             $listrows[] = "<\x3fphp echo oTxt(\$list[\$i]['$field'], true); \x3f>";
     137            $listrows[] = "<\x3fphp echo oTxt(\$list[\$i]['$field']); \x3f>";
    138138        }
    139139    }
  • trunk/lib/App.inc.php

    r767 r768  
    430430            // DB credentials for CLI scripts stored in a JSON file with read rights given only to the user who will be executing the scripts: -r--------
    431431            // But not if all DB credentials have been defined already by other means.
    432             if ($this->cli && '' != $this->getParam('db_auth_file') && (!$this->getParam('db_server') || !$this->getParam('db_name') || !$this->getParam('db_user') || !$this->getParam('db_pass'))) {
     432            if ('' != $this->getParam('db_auth_file') && (!$this->getParam('db_server') || !$this->getParam('db_name') || !$this->getParam('db_user') || !$this->getParam('db_pass'))) {
    433433                if (false !== ($db_auth_file = stream_resolve_include_path($this->getParam('db_auth_file')))) {
    434434                    if (is_readable($db_auth_file)) {
     
    664664            if ($num_queries > 0 && true === $this->getParam('enable_db_pdo')) {
    665665                // If the app wants to use PDO, warn if any legacy db queries are made.
    666                 $this->logMsg(sprintf('%s queries using legacy DB functions', $num_queries), LOG_WARNING, __FILE__, __LINE__);
     666                $this->logMsg(sprintf('%s queries using legacy DB functions', $num_queries), LOG_DEBUG, __FILE__, __LINE__);
    667667            }
    668668            $this->db->close();
  • trunk/lib/Auth_Simple.inc.php

    r745 r768  
    1111
    1212    // Namespace of this auth object.
    13     var $_ns;
     13    protected $_ns;
    1414
    1515    // Parameters to be configured by setParam.
    16     var $_params = array();
    17     var $_default_params = array(
     16    protected $_params = array();
     17    protected $_default_params = array(
    1818
    1919        // The URL to the login script.
  • trunk/lib/PageNumbers.inc.php

    r635 r768  
    7171    {
    7272        // Default options for the quantity per page links.
    73         $this->per_page_options = array(25, 50, 100, 200);
     73        $this->per_page_options = array(50, 100, 250, 1000);
    7474
    7575        // Default options for the page number links.
  • trunk/lib/Utilities.inc.php

    r765 r768  
    998998    }
    999999    return $url_args;
     1000}
     1001
     1002/*
     1003* Encode/decode a string that is safe for URLs.
     1004*
     1005* @access   public
     1006* @param    string   $string    Input string
     1007* @return   string              Encoded/decoded string.
     1008* @author   Rasmus Schultz <https://www.php.net/manual/en/function.base64-encode.php#123098>
     1009* @since    09 Jun 2022 07:50:49
     1010*/
     1011function base64_encode_url($string) {
     1012    return str_replace(['+','/','='], ['-','_',''], base64_encode($string));
     1013}
     1014function base64_decode_url($string) {
     1015    return base64_decode(str_replace(['-','_'], ['+','/'], $string));
    10001016}
    10011017
  • trunk/lib/Validator.inc.php

    r767 r768  
    348348        }
    349349
    350         if ($strict) {
    351             // Strict tests.
    352             if (ip2long($domain) === false && function_exists('checkdnsrr') && !checkdnsrr($domain . '.', 'MX') && gethostbyname($domain) == $domain) {
    353                 // Check domain exists: It's a domain if ip2long fails; checkdnsrr ensures a MX record exists; gethostbyname() ensures the domain exists.
    354                 $app->logMsg(sprintf('%s (line %s) failed: %s', __METHOD__, __LINE__, getDump($val)), $type, $file, $line);
    355                 return self::EMAIL_MX_FAIL;
    356             }
     350        if ($strict && getmxrr('checkdnsrr') && !getmxrr($domain)) {
     351            // Strict tests: check if MX record exists.
     352            $app->logMsg(sprintf('%s (line %s) failed: %s', __METHOD__, __LINE__, getDump($val)), $type, $file, $line);
     353            return self::EMAIL_MX_FAIL;
    357354        }
    358355
  • trunk/services/templates/admin_list.ihtml

    r497 r768  
    6868                }
    6969            ?></td>
    70             <td class="sc-nowrap"><?php echo gethostbyaddr($list[$i]['last_login_ip']); ?></td>
     70            <td class="sc-nowrap"><?php echo ipInRange($list[$i]['last_login_ip'], ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16']) ? "(Private IP)" : sprintf('<a href="https://ip.me/ip/%1$s">%1$s</a>', $list[$i]['last_login_ip']); ?></td>
    7171            <td class="sc-nowrap"><?php echo Validator::validateStrDate($list[$i]['added_datetime']) ? date($app->getParam('date_format'), strtotime($list[$i]['added_datetime'])) : ''; ?></td>
    7272            <td class="sc-nowrap"><?php echo oTxt($list[$i]['added_admin_username'], true); ?></td>
Note: See TracChangeset for help on using the changeset viewer.