Changeset 24

Show
Ignore:
Timestamp:
2007-11-23 15:36:28 (4 years ago)
Author:
hannes
Message:
  • fixed links added to tree using addAttribute with mod_rewrite being disabled (ticket #9)
    • classes/misc/Format.php: new input variable for link
    • various pages where this occured: added TRUE to link method call
  • set show=index as valid target
    • includes/input.php
Files:

Legend:

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

    r1 r24  
    295295     * Description: link to another forum page using either short names via 
    296296     *              mod_rewrite or longer ones if that module isn't available 
    297      * Input:       $file - page to link to (basically, the class name in 
    298      *                      lowercase characters, so no .php or anything) 
     297     * Input:       $file    - page to link to (basically, the class name in 
     298     *                         lowercase characters, so no .php or anything) 
     299     *              $as_attr - boolean value to signify whether this link is 
     300     *                         added to the tree via addAttribute 
    299301     * Returns:     complete query string 
    300302     **/ 
    301     public function link($file) { 
     303    public function link($file, $as_attr = FALSE) { 
    302304        // get settings 
    303305        global $SETTINGS; 
     
    307309        } else { 
    308310            // regular links 
    309             return 'index.php?show=' . $file . '&'; 
     311            if ($as_attr) { 
     312                // addAttribute automatically converts to & 
     313                return 'index.php?show=' . $file . '&'; 
     314            } else { 
     315                return 'index.php?show=' . $file . '&'; 
     316            } 
    310317        } 
    311318    } /* function link */ 
  • trunk/classes/misc/Postbuttons.php

    r1 r24  
    4747                // topic not closed 
    4848                $a = $this->html->addChild('a', $LANG['Reply']); 
    49                 $a->addAttribute('href', $F->link('reply') . 'id=' . $replyid); 
     49                $a->addAttribute('href', $F->link('reply', TRUE) . 'id=' . $replyid); 
    5050            } else { 
    5151                // topic closed 
     
    5757            // new topic 
    5858            $a = $this->html->addChild('a', $LANG['New_Topic']); 
    59             $a->addAttribute('href', $F->link('newtopic') . 'id=' . $newid); 
     59            $a->addAttribute('href', $F->link('newtopic', TRUE) . 'id=' . $newid); 
    6060            // new poll 
    6161            if ($SETTINGS['polls'] == 1) { 
    6262                $a = $this->html->addChild('a', $LANG['New_Poll']); 
    63                 $a->addAttribute('href', $F->link('newpoll') . 'id=' . $newid); 
     63                $a->addAttribute('href', $F->link('newpoll', TRUE) . 'id=' . $newid); 
    6464            } 
    6565        } 
  • trunk/classes/misc/Postform.php

    r20 r24  
    118118            // show shortcuts to common smileys and board code 
    119119            $_col1 .= '<div id="posthelp"><a href="javascript:addSmiley(\':)\')"><img src="images/smilies/smile.gif" alt=":)" border="0" /></a><a href="javascript:addSmiley(\':(\')"><img src="images/smilies/sad.gif" alt=":(" border="0" /></a><a href="javascript:addSmiley(\';)\')"><img src="images/smilies/wink.gif" alt=";)" border="0" /></a><a href="javascript:addSmiley(\':angry:\')"><img src="images/smilies/angry.gif" alt=":angry:" border="0" /></a><a href="javascript:addSmiley(\':D\')"><img src="images/smilies/biggrin.gif" alt=":D" border="0" /></a><a href="javascript:addSmiley(\':o\')"><img src="images/smilies/shocked.gif" alt=":o" border="0" /></a><a href="javascript:addSmiley(\':P\')"><img src="images/smilies/tongue.gif" alt=":P" border="0" /></a><a href="javascript:addSmiley(\':embarassed:\')"><img src="images/smilies/embarassed.gif" alt=":embarassed:" border="0" /></a><br />'. 
    120             '<input type="button" onclick="javascript:addCode(\'img\')" value=" IMG " /><input type="button" onclick="javascript:addCode(\'i\')" value=" I " /><input type="button" onclick="javascript:addCode(\'b\')" value=" B " /><input type="button" onclick="javascript:addCode(\'url\')" value=" URL " /><input type="button" onclick="javascript:addCode(\'quote\')" value=" QUOTE " /><br /><a href="javascript:void(0);" onclick="' . "window.open('redirectors/postinghelp.php', 'helpwindow', 'width=600, height=450, scrollbars=yes')\">" . $LANG['Formatting_Help'] . '</a></div>'; 
     120            '<input type="button" onclick="javascript:addCode(\'img\')" value=" IMG " /><input type="button" onclick="javascript:addCode(\'i\')" value=" I " /><input type="button" onclick="javascript:addCode(\'b\')" value=" B " /><input type="button" onclick="javascript:addCode(\'url\')" value=" URL " /><input type="button" onclick="javascript:addCode(\'quote\')" value=" QUOTE " /><br /><a href="javascript:void(0);" onclick="' . "window.open('redirectors/postinghelp.php?s=" . session_id() . "', 'helpwindow', 'width=600, height=450, scrollbars=yes')\">" . $LANG['Formatting_Help'] . '</a></div>'; 
    121121        } 
    122122        $_col1 .= '</td>'; 
  • trunk/classes/pages/Category.php

    r21 r24  
    129129                $h2 = $this->html->body->addChild('h2'); 
    130130                $a = $h2->addChild('a', $row['category_name']); 
    131                 $a->addAttribute('href', $F->link('category') . 'id=' . $row['category_id']); 
     131                $a->addAttribute('href', $F->link('category', TRUE) . 'id=' . $row['category_id']); 
    132132                // add newly constructed forums table to parent node 
    133133                $_table = $table->get(); 
  • trunk/classes/pages/Forum.php

    r19 r24  
    7474            $h2 = $this->html->body->addChild('h2'); 
    7575            $a = $h2->addChild('a', $row->forumtitle); 
    76             $a->addAttribute('href', $F->link('forum') . 'id=' . $row->forumid); 
     76            $a->addAttribute('href', $F->link('forum', TRUE) . 'id=' . $row->forumid); 
    7777            // get topic information for the topic list 
    7878            $q2 = $C->prepare('SELECT DISTINCT(p.topic) AS topicid, t.topictitle AS topictitle, COUNT(p.postid) AS posts, t.topic_views AS views, MAX(p.posttime) AS posttime, t.poll AS poll, t.pinned AS pinned FROM ' . $SETTINGS['dbtableprefix'] . 'posts p, ' . $SETTINGS['dbtableprefix'] . 'topics t WHERE t.forum=:forumid AND p.topic=t.topicid GROUP BY p.topic ORDER BY pinned DESC, posttime DESC LIMIT ' . $_start . ',' . $SETTINGS['topicsperpage']); 
  • trunk/classes/pages/Members.php

    r19 r24  
    111111                    $_nonpostercount = $membercount - $_postercount; 
    112112                    // define start and length of database query 
    113                     $_start = $start - $_postercount
     113                    $_start = max($start - $_postercount, 0)
    114114                    $_num = $SETTINGS['topicsperpage'] - count($rows_ordered); 
    115115                    // get the non-poster ids 
  • trunk/classes/pages/Messenger.php

    r20 r24  
    5353        $div->addAttribute('align', 'center'); 
    5454        $a = $div->addChild('a', $LANG['Inbox']); 
    55         $a->addAttribute('href', $F->link('messenger') . 'action=inbox'); 
     55        $a->addAttribute('href', $F->link('messenger', TRUE) . 'action=inbox'); 
    5656        $div->addChild('span', ' - '); 
    5757        $a = $div->addChild('a', $LANG['Outbox']); 
    58         $a->addAttribute('href', $F->link('messenger') . 'action=outbox'); 
     58        $a->addAttribute('href', $F->link('messenger', TRUE) . 'action=outbox'); 
    5959        $div->addChild('span', ' - '); 
    6060        $a = $div->addChild('a', $LANG['Compose']); 
    61         $a->addAttribute('href', $F->link('messenger') . 'action=send'); 
     61        $a->addAttribute('href', $F->link('messenger', TRUE) . 'action=send'); 
    6262        $div->addChild('span', ' - '); 
    6363        $a = $div->addChild('a', $LANG['Address_Book']); 
    64         $a->addAttribute('href', $F->link('messenger') . 'action=addresses'); 
     64        $a->addAttribute('href', $F->link('messenger', TRUE) . 'action=addresses'); 
    6565        $div->addChild('br'); 
    6666        $div->addChild('br'); 
  • trunk/classes/pages/Page.php

    r20 r24  
    9999                $div->addAttribute('id', 'admin_menu'); 
    100100                $a = $div->addChild('a', $LANG['Admin_Main']); 
    101                 $a->addAttribute('href', $F->link('index')); 
     101                $a->addAttribute('href', $F->link('index', TRUE)); 
    102102                $div->addChild('br'); 
    103103                $div->addChild('hr'); 
    104104                $a = $div->addChild('a', $LANG['Settings']); 
    105                 $a->addAttribute('href', $F->link('settings')); 
     105                $a->addAttribute('href', $F->link('settings', TRUE)); 
    106106                $div->addChild('br'); 
    107107                $a = $div->addChild('a', $LANG['Header']); 
    108                 $a->addAttribute('href', $F->link('header')); 
     108                $a->addAttribute('href', $F->link('header', TRUE)); 
    109109                $div->addChild('br'); 
    110110                $a = $div->addChild('a', $LANG['Footer']); 
    111                 $a->addAttribute('href', $F->link('footer')); 
     111                $a->addAttribute('href', $F->link('footer', TRUE)); 
    112112                $div->addChild('br'); 
    113113                $div->addChild('hr'); 
    114114                $a = $div->addChild('a', $LANG['Add_Category']); 
    115                 $a->addAttribute('href', $F->link('addcategory')); 
     115                $a->addAttribute('href', $F->link('addcategory', TRUE)); 
    116116                $div->addChild('br'); 
    117117                $a = $div->addChild('a', $LANG['Modify_Category']); 
    118                 $a->addAttribute('href', $F->link('modifycategory')); 
     118                $a->addAttribute('href', $F->link('modifycategory', TRUE)); 
    119119                $div->addChild('br'); 
    120120                $a = $div->addChild('a', $LANG['Delete_Category']); 
    121                 $a->addAttribute('href', $F->link('deletecategory')); 
     121                $a->addAttribute('href', $F->link('deletecategory', TRUE)); 
    122122                $div->addChild('br'); 
    123123                $div->addChild('hr'); 
    124124                $a = $div->addChild('a', $LANG['Add_Forum']); 
    125                 $a->addAttribute('href', $F->link('addforum')); 
     125                $a->addAttribute('href', $F->link('addforum', TRUE)); 
    126126                $div->addChild('br'); 
    127127                $a = $div->addChild('a', $LANG['Modify_Forum']); 
    128                 $a->addAttribute('href', $F->link('modifyforum')); 
     128                $a->addAttribute('href', $F->link('modifyforum', TRUE)); 
    129129                $div->addChild('br'); 
    130130                $a = $div->addChild('a', $LANG['Delete_Forum']); 
    131                 $a->addAttribute('href', $F->link('deleteforum')); 
     131                $a->addAttribute('href', $F->link('deleteforum', TRUE)); 
    132132                $div->addChild('br'); 
    133133                $a = $div->addChild('a', $LANG['Moderators']); 
    134                 $a->addAttribute('href', $F->link('moderators')); 
     134                $a->addAttribute('href', $F->link('moderators', TRUE)); 
    135135                $div->addChild('br'); 
    136136                $div->addChild('hr'); 
    137137                $a = $div->addChild('a', $LANG['Memberstages']); 
    138                 $a->addAttribute('href', $F->link('memberstages')); 
     138                $a->addAttribute('href', $F->link('memberstages', TRUE)); 
    139139                $div->addChild('br'); 
    140140                $a = $div->addChild('a', $LANG['User_Groups']); 
    141                 $a->addAttribute('href', $F->link('groups')); 
     141                $a->addAttribute('href', $F->link('groups', TRUE)); 
    142142                $div->addChild('br'); 
    143143                $a = $div->addChild('a', $LANG['Edit_Member']); 
    144                 $a->addAttribute('href', $F->link('editmember')); 
     144                $a->addAttribute('href', $F->link('editmember', TRUE)); 
    145145                $div->addChild('br'); 
    146146                $a = $div->addChild('a', $LANG['Banning']); 
    147                 $a->addAttribute('href', $F->link('banning')); 
     147                $a->addAttribute('href', $F->link('banning', TRUE)); 
    148148                $div->addChild('br'); 
    149149            } 
  • trunk/includes/input.php

    r20 r24  
    5353// translate input variables to local names and check their integrity 
    5454$show = $_GET['show']; 
    55 if ($show == '') { $show = 'category'; } 
     55if ($show == '' || $show == 'index') { $show = 'category'; } 
    5656if (preg_match('/^[a-z]+$/', $show) != 1) { die($LANG['error_input']); } 
    5757 
  • trunk/redirectors/forumjump.php

    r19 r24  
    5959    session_start(); 
    6060    // forward to forum / category 
    61     header('Location: ../' . $F->link($_red[0]) . 'id=' . $_red[1] . '&' . strip_tags(SID)); 
     61    header('Location: ../' . $F->link($_red[0], TRUE) . 'id=' . $_red[1] . '&' . strip_tags(SID)); 
    6262    // just in case something went wrong with redirecting, print something 
    6363    print(str_replace('%link%', '<a href="../' . $F->link(strtolower($_red[0])) . 'id='.$_red[1] . '&' . strip_tags(SID) . '">../' . $F->link(strtolower($_red[0])) . 'id=' . $_red[1] . '&' . strip_tags(SID) . '</a>', $LANG['redirection_problem']));