Changeset 685 for trunk/lib/App.inc.php


Ignore:
Timestamp:
May 23, 2019 6:40:04 PM (5 years ago)
Author:
anonymous
Message:

Various minor changes:

  • Allow $app->ohref() with no value to return a link to the current page (REQUEST_URI but without the QUERY_STRING).
  • Add some classes to HTML output to support Zurb Foundation 6.
  • Stop prepending scheme://host:port to URLs because we can't guess hte port at a proxy.
  • Include Auth_Simple.inc.php (copied from control.strangecode.com). $auth->login() now requires a callback funtion to verify credentials.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/App.inc.php

    r683 r685  
    764764                switch ($m['type']) {
    765765                case MSG_ERR:
    766                     echo '<div data-alert class="sc-msg-error alert-box alert">' . $m['message'] . '<a href="#" class="close">&times;</a></div>';
     766                    echo '<div data-alert data-closable class="sc-msg-error alert-box callout alert">' . $m['message'] . '<a class="close close-button" aria-label="Dismiss alert" data-close><span aria-hidden="true">&times;</span></a></div>';
    767767                    break;
    768768
    769769                case MSG_WARNING:
    770                     echo '<div data-alert class="sc-msg-warning alert-box warning">' . $m['message'] . '<a href="#" class="close">&times;</a></div>';
     770                    echo '<div data-alert data-closable class="sc-msg-warning alert-box callout warning">' . $m['message'] . '<a class="close close-button" aria-label="Dismiss alert" data-close><span aria-hidden="true">&times;</span></a></div>';
    771771                    break;
    772772
    773773                case MSG_SUCCESS:
    774                     echo '<div data-alert class="sc-msg-success alert-box success">' . $m['message'] . '<a href="#" class="close">&times;</a></div>';
     774                    echo '<div data-alert data-closable class="sc-msg-success alert-box callout success">' . $m['message'] . '<a class="close close-button" aria-label="Dismiss alert" data-close><span aria-hidden="true">&times;</span></a></div>';
    775775                    break;
    776776
    777777                case MSG_NOTICE:
    778778                default:
    779                     echo '<div data-alert class="sc-msg-notice alert-box info">' . $m['message'] . '<a href="#" class="close">&times;</a></div>';
     779                    echo '<div data-alert data-closable class="sc-msg-notice alert-box callout primary info">' . $m['message'] . '<a class="close close-button" aria-label="Dismiss alert" data-close><span aria-hidden="true">&times;</span></a></div>';
    780780                    break;
    781781                }
     
    10791079     * @return string url with attached queries and, if not using cookies, the session id
    10801080     */
    1081     public function url($url, $carry_args=null, $always_include_sid=false, $include_csrf_token=false)
     1081    public function url($url='', $carry_args=null, $always_include_sid=false, $include_csrf_token=false)
    10821082    {
    10831083        if (!$this->running) {
     
    11181118        }
    11191119
     1120        // If the URL is empty, use REQUEST_URI without the QUERY_STRING.
     1121        if ('' == $url) {
     1122            $url = str_replace([getenv('QUERY_STRING'), '?'], '', getenv('REQUEST_URI'));
     1123        }
     1124
    11201125        // Get the first delimiter that is needed in the url.
    11211126        $delim = mb_strpos($url, '?') !== false ? ini_get('arg_separator.output') : '?';
     
    11411146        $url = $parts[0];
    11421147        $anchor = isset($parts[1]) ? $parts[1] : '';
    1143 
    11441148        // $anchor =
    11451149
     
    11771181        }
    11781182
     1183        if ('' == $url) {
     1184            $this->logMsg(sprintf('Generated empty URL. Args: %s', getDump(func_get_args())), LOG_NOTICE, __FILE__, __LINE__);
     1185        }
     1186
    11791187        return $url;
    11801188    }
     
    11891197     * @since   09 Dec 2005 17:58:45
    11901198     */
    1191     public function oHREF($url, $carry_args=null, $always_include_sid=false, $include_csrf_token=false)
     1199    public function oHREF($url='', $carry_args=null, $always_include_sid=false, $include_csrf_token=false)
    11921200    {
    11931201        // Process the URL.
     
    14061414        }
    14071415
    1408         if (preg_match('!^/!', $url)) {
    1409             // If relative URL is given, prepend site_url, which contains: scheme://hostname[:port]
    1410             $url = sprintf('%s%s', $this->getParam('site_url'), $url);
    1411         }
     1416        // FIXME: actually, it seems better to continue using a relative URL since we can't guess the port at the reverse proxy (e.g., port 3000 for browser-sync).
     1417        // if (preg_match('!^/!', $url)) {
     1418        //     // If relative URL is given, prepend site_url, which contains: scheme://hostname[:port]
     1419        //     $url = sprintf('%s%s', $this->getParam('site_url'), $url);k
     1420        // }
    14121421
    14131422        $url = $this->url($url, $carry_args, $always_include_sid);
Note: See TracChangeset for help on using the changeset viewer.