Changeset 105

Show
Ignore:
Timestamp:
2007-12-19 20:17:32 (1 year ago)
Author:
hannes
Message:

escaping & characters in the right places so they don't break posts (ticket #60)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/classes/misc/Post.php

    r90 r105  
    9292        } 
    9393        // add this post 
    94         $table->addRow(Array('<td valign="top" width="' . ($SETTINGS['maxavatarsize'] + 10) . '">' . $_member->getPostside() . '</td>', '<td valign="top">' . $_post . '</td>'), FALSE, TRUE); 
     94        $table->addRow(Array('<td valign="top" width="' . ($SETTINGS['maxavatarsize'] + 10) . '">' . $_member->getPostside() . '</td>', '<td valign="top">' . str_replace('&amp;', '&amp;amp;', $_post) . '</td>'), FALSE, TRUE); 
    9595        // post footer 
    9696        $table->addRow(Array(''), Array('colspan'=>'2', 'class'=>'postfooter')); 
     
    106106     **/ 
    107107    public function save($show_orig) { 
    108         global $C, $SETTINGS, $LANG; 
     108        global $C, $F, $SETTINGS, $LANG; 
    109109        // post data 
    110110        global $reply, $subject, $forum, $pollchoices, $user, $post, $password, $email, $subscribe; 
     
    380380                            $q = $C->prepare('INSERT INTO ' . $SETTINGS['dbtableprefix'] . 'posts (topic, post, poster, posteremail, posttime, ip, attachment, postedbymember) VALUES (:reply, :post, :user, :email, :ts, :ip, :attachment, :member)'); 
    381381                            $q->bindParam(':reply', $reply, PDO::PARAM_INT, 12); 
    382                             $q->bindParam(':post', $post, PDO::PARAM_STR); 
    383                             $q->bindParam(':user', $user, PDO::PARAM_STR); 
     382                            $q->bindParam(':post', $F->htmlentities($post, TRUE), PDO::PARAM_STR); 
     383                            $q->bindParam(':user', $F->htmlentities($user, TRUE), PDO::PARAM_STR); 
    384384                            $q->bindParam(':email', $email, PDO::PARAM_STR); 
    385385                            // current time in UTC 
  • trunk/redirectors/preview.php

    r39 r105  
    8282    } 
    8383    // decode post 
    84     $row->post = base64_decode(strtr($post, '-_', '+/')); 
     84    $row->post = $F->htmlentities(base64_decode(strtr($post, '-_', '+/')), TRUE); 
    8585    $row->postid = 0; 
    8686    // construct and format timestamp