Ticket #342: button-htmlentities.diff

File button-htmlentities.diff, 5.5 kB (added by alex@…, 6 years ago)

patch

  • .0.1/php/settings.php

    Seulement dans cur-maia-1.0.1/php: config.php
    diff -ur maia-1.0.1/php/settings.php cur-maia-1.0.1/php/settings.php
    old new  
    121121     
    122122    // Pressed the "Update This Address' Settings" button or the 
    123123    // "Update ALL Addresses' Settings" button 
    124     if ($button == $lang['button_update_address'] || 
    125         $button == $lang['button_update_all_addresses']) { 
     124    if (htmlentities($button) == $lang['button_update_address'] || 
     125        htmlentities($button) == $lang['button_update_all_addresses']) { 
    126126 
    127127        if (isset($_POST["policy"])) { // actually, I think we prefer not to use this, in favor of what's in the  
    128128            $policy_id = trim($_POST["policy"]); // users.policy_id 
     
    310310                                    "spam_kill_level = ? " . 
    311311                  "WHERE id = ?"; 
    312312 
    313         if ($button == $lang['button_update_all_addresses']) { 
     313        if (htmlentities($button) == $lang['button_update_all_addresses']) { 
    314314            $select = "SELECT policy_id FROM users WHERE maia_user_id = ? "; 
    315315            $sth = $dbh->query($select, array($euid)); 
    316316            while ($row = $sth->fetchrow()) { 
     
    356356        $message = $lang['text_settings_updated']; 
    357357 
    358358    // Pressed the "Update Miscellaneous Settings" button 
    359     } elseif ($button == $lang['button_update_misc']) { 
     359    } elseif (htmlentities($button) == $lang['button_update_misc']) { 
    360360 
    361361        if (isset($_POST["reminder"])) { 
    362362            $reminder = (trim($_POST["reminder"]) == "yes" ? "Y" : "N"); 
     
    429429 
    430430 
    431431    // Pressed the "Add E-Mail Address" button 
    432     } elseif ($button == $lang['button_add_email_address']) { 
     432    } elseif (htmlentities($button) == $lang['button_add_email_address']) { 
    433433 
    434434        if (isset($_POST["login"])) { 
    435435            $login = trim($_POST["login"]); 
     
    477477        } 
    478478 
    479479    // Pressed the "Update Login Credentials" button 
    480     } elseif ($button == $lang['button_change_login_info'] && $auth_method == "internal") { 
     480    } elseif (htmlentities($button) == $lang['button_change_login_info'] && $auth_method == "internal") { 
    481481 
    482482        if (isset($_POST["new_login_name"])) { 
    483483            $new_login = trim($_POST["new_login_name"]); 
  • .0.1/php/wblist.php

    diff -ur maia-1.0.1/php/wblist.php cur-maia-1.0.1/php/wblist.php
    old new  
    112112 
    113113   // User pressed the "Add to List" button to add an address to the 
    114114   // whitelist or blacklist. 
    115    if ($addaddress == $lang['button_add_to_list']) 
     115   if (htmlentities($addaddress) == $lang['button_add_to_list']) 
    116116   { 
    117117      if ($newaddr != "") { 
    118118         $list = trim($_POST["list"]); 
     
    122122 
    123123   // User pressed the "Update" button to modify the whitelist/blacklist 
    124124   // settings. 
    125    elseif ($addchange == $lang['button_update']) 
     125   elseif (htmlentities($addchange) == $lang['button_update']) 
    126126   { 
    127127          $message = $lang['text_lists_updated']; 
    128128      foreach($_POST as $varname => $value) 
  • .0.1/php/welcome.php

    diff -ur maia-1.0.1/php/welcome.php cur-maia-1.0.1/php/welcome.php
    old new  
    107107      $maxitemid = 0; 
    108108   } 
    109109    
    110    if ($button == $lang['button_delete_all_items']) 
     110   if (htmlentities($button) == $lang['button_delete_all_items']) 
    111111   { 
    112112      $select = "SELECT mail_id FROM maia_mail_recipients " . 
    113113                "WHERE (type = 'S' " . 
     
    128128   } 
    129129    
    130130    
    131    if ($button == $lang['button_change_protection'] && isset($_POST['protection_level'])) { 
     131   if (htmlentities($button) == $lang['button_change_protection'] && isset($_POST['protection_level'])) { 
    132132    $select = "SELECT policy_id FROM users WHERE maia_user_id = ?";  
    133133    $sth = $dbh->query($select, $euid); 
    134134  
  • .0.1/php/xdomainsettings.php

    diff -ur maia-1.0.1/php/xdomainsettings.php cur-maia-1.0.1/php/xdomainsettings.php
    old new  
    8787    require_once ("./locale/$display_language/domainsettings.php"); // shared with domainsettings.php 
    8888 
    8989    require_once ("smarty.php"); 
    90      
     90 
    9191    if (isset($_POST["domain_id"])) { 
    9292        $domain_id = trim($_POST["domain_id"]); 
    9393    } else { 
     
    113113    } 
    114114 
    115115    // Pressed the "Update This Domain's Settings" button 
    116     if ($button == $lang['button_update_domain']) { 
     116     if ( htmlentities($button) == $lang['button_update_domain']) { 
    117117 
    118118        $select = "SELECT enable_charts, reminder_threshold_count, " . 
    119119                         "enable_spamtraps " . 
     
    335335 
    336336        $message = $lang['text_settings_updated']; 
    337337    // Pressed the "Revoke Administrator Privileges" button 
    338     } elseif ($super && ($button == $lang['button_revoke'])) { 
     338    } elseif ($super && (htmlentities($button) == $lang['button_revoke'])) { 
    339339 
    340340        // Register the full set of POST variables. 
    341341        foreach($_POST as $varname => $value) 
     
    379379        $message = $lang['text_admins_revoked']; 
    380380 
    381381    // Pressed the "Grant Administrator Privileges" button 
    382     } elseif ($super && ($button == $lang['button_grant'])) { 
     382    } elseif ($super && (htmlentities($button) == $lang['button_grant'])) { 
    383383 
    384384        // Note that $admins is an array 
    385385        if (isset($_POST["administrators"])) {