Changeset 763 for trunk/lib


Ignore:
Timestamp:
Feb 24, 2022 10:05:48 PM (2 years ago)
Author:
anonymous
Message:

Include boomerang in hidden input on login form so the user will be redirected if the revisit the login form after session is garbage collected. Add escape values used in html attributes.

Location:
trunk/lib
Files:
5 edited

Legend:

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

    r762 r763  
    13351335                    foreach ($val as $subval) {
    13361336                        if ('' != $key && '' != $subval) {
    1337                             $out .= sprintf('<input type="hidden" name="%s[]" value="%s" />', $key, $subval);
     1337                            $out .= sprintf('<input type="hidden" name="%s[]" value="%s" />', oTxt($key), oTxt($subval));
    13381338                        }
    13391339                    }
    13401340                } else if ('' != $key && '' != $val) {
    1341                     $out .= sprintf('<input type="hidden" name="%s" value="%s" />', $key, $val);
     1341                    $out .= sprintf('<input type="hidden" name="%s" value="%s" />', oTxt($key), oTxt($val));
    13421342                }
    13431343            }
     
    13551355        && $this->getParam('session_use_trans_sid')
    13561356        ) {
    1357             $out .= sprintf('<input type="hidden" name="%s" value="%s" />', session_name(), session_id());
     1357            $out .= sprintf('<input type="hidden" name="%s" value="%s" />', oTxt(session_name()), oTxt(session_id()));
    13581358        }
    13591359
     
    13611361        // This token can be validated upon form submission with $app->verifyCSRFToken() or $app->requireValidCSRFToken()
    13621362        if ($this->getParam('csrf_token_enabled') && $include_csrf_token) {
    1363             $out .= sprintf('<input type="hidden" name="%s" value="%s" />', $this->getParam('csrf_token_name'), $this->getCSRFToken());
     1363            $out .= sprintf('<input type="hidden" name="%s" value="%s" />', oTxt($this->getParam('csrf_token_name')), oTxt($this->getCSRFToken()));
    13641364        }
    13651365
     
    15301530        } else {
    15311531            // Fallback: die using meta refresh instead.
    1532             printf('<meta http-equiv="refresh" content="0;url=%s" />', $url);
     1532            printf('<meta http-equiv="refresh" content="0;url=%s" />', oTxt($url));
    15331533            $this->logMsg(sprintf('dieURL (refresh): %s; headers already sent (output started in %s : %s)', $url, $h_file, $h_line), LOG_NOTICE, __FILE__, __LINE__);
    15341534        }
  • trunk/lib/HTML.inc.php

    r713 r763  
    7878                echo '<li><a';
    7979                foreach (array_diff_key($b, array('value' => null)) as $key => $value) {
    80                     printf(' %s="%s"', $key, oTxt($value));
     80                    printf(' %s="%s"', oTxt($key), oTxt($value));
    8181                }
    8282                echo '>' . oTxt($b['value']) . '</a></li>';
     
    8888                echo '<li><input';
    8989                foreach ($b as $key => $value) {
    90                     printf(' %s="%s"', $key, oTxt($value));
     90                    printf(' %s="%s"', oTxt($key), oTxt($value));
    9191                }
    9292                echo ' /></li>';
     
    247247            printf('<option value="%s"%s%s%s>%s</option>',
    248248                oTxt($o['value']),
    249                 (isset($o['class']) && sprintf(' class="%s"', $o['class']) ? : ''),
    250                 (isset($o['selected']) && $o['selected'] ? ' selected="selected"' : ''),
    251                 (isset($o['disabled']) && $o['disabled'] ? ' disabled="disabled"' : ''),
     249                (isset($o['class']) && sprintf(' class="%s"', oTxt($o['class'])) ? : ''),
     250                (isset($o['selected']) && oTxt($o['selected']) ? ' selected="selected"' : ''),
     251                (isset($o['disabled']) && oTxt($o['disabled']) ? ' disabled="disabled"' : ''),
    252252                oTxt($o['text'])
    253253            );
     
    280280        foreach ($options as $value => $text) {
    281281            printf('<option value="%s"%s>%s</option>',
    282                 $value,
     282                oTxt($value),
    283283                $preselected == $value ? ' selected="selected"' : '',
    284                 $text
     284                oTxt($text)
    285285            );
    286286        }
  • trunk/lib/Image.inc.php

    r502 r763  
    152152
    153153        return sprintf('<img src="%s" %s alt="%s" %s />',
    154             $src,
     154            oTxt($src),
    155155            $image_size,
    156156            oTxt($alt),
  • trunk/lib/PayPal.inc.php

    r502 r763  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    212212    {
    213213        ?>
    214         <form action="<?php echo $this->_buttons[$name]['options']['button_url']; ?>" method="post">
     214        <form action="<?php echo oTxt($this->_buttons[$name]['options']['button_url']); ?>" method="post">
    215215        <?php
    216216        if (is_array($this->_buttons[$name]['options']) && !empty($this->_buttons[$name]['options'])) {
     
    218218                if (!in_array($key, array('button_url', 'link_url', 'submit_img', 'submit_text'))) {
    219219                    ?>
    220                     <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $val; ?>" />
     220                    <input type="hidden" name="<?php echo oTxt($key); ?>" value="<?php echo oTxt($val); ?>" />
    221221                    <?php
    222222                }
     
    224224        }
    225225        ?>
    226         <input type="image" src="<?php echo $this->_buttons[$name]['options']['submit_img']; ?>" border="0" name="submit" alt="<?php echo $this->_buttons[$name]['options']['submit_text']; ?>" />
     226        <input type="image" src="<?php echo oTxt($this->_buttons[$name]['options']['submit_img']); ?>" border="0" name="submit" alt="<?php echo oTxt($this->_buttons[$name]['options']['submit_text']); ?>" />
    227227        </form>
    228228        <?php
     
    257257    {
    258258        $app =& App::getInstance();
    259    
     259
    260260        if (array_key_exists($param, $this->_params)) {
    261261            return $this->_params[$param];
  • trunk/lib/Utilities.inc.php

    r759 r763  
    319319            // Remove http schemas, and any single trailing / to make the display URL.
    320320            $display_url = preg_replace(['!^https?://!u', '!^([^/]+)/$!u'], ['', '$1'], $url);
    321             return sprintf('<a href="%s">%s</a>', oTxt($absolute_url), $display_url);
     321            return sprintf('<a href="%s">%s</a>', oTxt($absolute_url), oTxt($display_url));
    322322        } else {
    323323            // Truncated URL.
    324324            // Remove http schemas, and any single trailing / to make the display URL.
    325325            $display_url = preg_replace(['!^https?://!u', '!^([^/]+)/$!u'], ['', '$1'], trim($truncated_url));
    326             return sprintf('<a href="%s">%s%s</a>', oTxt($absolute_url), $display_url, $delim);
     326            return sprintf('<a href="%s">%s%s</a>', oTxt($absolute_url), oTxt($display_url), $delim);
    327327        }
    328328    }, $text);
     
    349349        if ('' != trim($w)) {
    350350            $search[] = '/\b(' . preg_quote($w) . ')\b/i' . $app->getParam('preg_u');
    351             $replace[] = '<span class="' . $class . '">$1</span>';
     351            $replace[] = '<span class="' . oTxt($class) . '">$1</span>';
    352352        }
    353353    }
Note: See TracChangeset for help on using the changeset viewer.