Changeset 18

Show
Ignore:
Timestamp:
2007-11-23 11:20:03 (4 years ago)
Author:
hannes
Message:
  • setting all database handles to NULL after they're finished
  • fixing mail sending for subscriptions
  • various minor fixes
  • running fine on SQLite again
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/admin/classes/pages/Addcategory.php

    r17 r18  
    4545                $q->execute(); 
    4646                $neworder = $q->fetchColumn(); 
    47                 $q->closeCursor()
     47                $q = NULL
    4848                $neworder++; 
    4949                // add category 
     
    5252                $q->bindParam(':order', $neworder, PDO::PARAM_INT, 12); 
    5353                $q->execute(); 
     54                $q = NULL; 
    5455                $div = $this->html->body->addChild('div', $LANG['category_added']); 
    5556                $div->addAttribute('id', 'admin_main'); 
  • trunk/admin/classes/pages/Addforum.php

    r17 r18  
    4646                $q->execute(); 
    4747                $neworder = $q->fetchColumn() + 1; 
    48                 $q->closeCursor()
     48                $q = NULL
    4949                // add forum 
    5050                $q = $C->prepare('INSERT INTO ' . $SETTINGS['dbtableprefix'] . 'forums (forumtitle, forumdescription, forum_category, forum_order) VALUES (:title, :desc, :id, :order)'); 
     
    5454                $q->bindParam(':order', $neworder, PDO::PARAM_INT, 12); 
    5555                $q->execute(); 
     56                $q = NULL; 
    5657                $div = $this->html->body->addChild('div', $LANG['forum_added']); 
    5758                $div->addAttribute('id', 'admin_main'); 
  • trunk/admin/classes/pages/Category.php

    r1 r18  
    4242        } else { 
    4343            // login form 
    44             $this->permissionDenied($F->link('index'), NULL, TRUE); 
     44            $this->permissionDenied($SETTINGS['webpath'] . 'admin/', NULL, TRUE); 
    4545        } 
    4646    } /* constructor */ 
  • trunk/admin/classes/pages/Deletecategory.php

    r1 r18  
    4343                if ($newcategory == '0') { 
    4444                    // no moving necessary 
    45                     $q = $C->query('SELECT forumid FROM ' . $SETTINGS['dbtableprefix'] . 'forums WHERE forum_category = :id'); 
     45                    $q = $C->prepare('SELECT forumid FROM ' . $SETTINGS['dbtableprefix'] . 'forums WHERE forum_category = :id'); 
    4646                    $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    4747                    $q->execute(); 
    48                     while ($row = $q->fetchObject()) { 
     48                    $rows = $q->fetchAll()M 
     49                    $q = NULL; 
     50                    foreach ($rows as $row) { 
    4951                        // iterate over forums in this category 
    5052                        $q2->prepare('SELECT topicid, poll FROM ' . $SETTINGS['dbtableprefix'] . 'topics WHERE forum = :id'); 
    51                         $q2->bindParam(':id', $row->forumid, PDO::PARAM_INT, 12); 
     53                        $q2->bindParam(':id', $row['forumid'], PDO::PARAM_INT, 12); 
    5254                        $q2->execute(); 
    53                         while ($row2 = $q2->fetchObject()) { 
     55                        $rows2 = $q2->fetchAll(); 
     56                        $q2 = NULL; 
     57                        forach ($rows2 as $row2) { 
    5458                            // delete posts in this forum 
    5559                            $q3 = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'posts WHERE topic = :id'); 
    56                             $q3->bindParam(':id', $row2->topicid, PDO::PARAM_INT, 12); 
     60                            $q3->bindParam(':id', $row2['topicid'], PDO::PARAM_INT, 12); 
    5761                            $q3->execute(); 
     62                            $q3 = NULL; 
    5863                            // delete polls 
    59                             if ($row2->poll != '') { 
     64                            if ($row2['poll'] != '') { 
    6065                                $q3 = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'polls WHERE pollid = :id'); 
    61                                 $q3->bindParam(':id', $row2->poll, PDO::PARAM_INT, 12); 
     66                                $q3->bindParam(':id', $row2['poll'], PDO::PARAM_INT, 12); 
    6267                                $q3->execute(); 
     68                                $q3 = NULL; 
    6369                            } 
    6470                            // delete topic 
    6571                            $q3 = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'topics WHERE topicid = :id'); 
    66                             $q3->bindParam(':id', $row2->topicid, PDO::PARAM_INT, 12); 
     72                            $q3->bindParam(':id', $row2['topicid'], PDO::PARAM_INT, 12); 
    6773                            $q3->execute(); 
     74                            $q3 = NULL; 
    6875                        } 
    6976                        // delete forum 
    7077                        $q3 = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'forums WHERE forumid = :id'); 
    71                         $q3->bindParam(':id', $row->forumid, PDO::PARAM_INT, 12); 
     78                        $q3->bindParam(':id', $row['forumid'], PDO::PARAM_INT, 12); 
    7279                        $q3->execute(); 
     80                        $q3 = NULL; 
    7381                    } 
    7482                } else { 
     
    7886                    $q3->bindParam(':oldid', $id, PDO::PARAM_INT, 12); 
    7987                    $q3->execute(); 
     88                    $q3 = NULL; 
    8089                } 
    8190                // delete category 
     
    8392                $q3->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    8493                $q3->execute(); 
     94                $q3 = NULL; 
    8595                $div = $this->html->body->addChild('div', $LANG['category_deleted']); 
    8696                $div->addAttribute('id', 'admin_main'); 
  • trunk/admin/classes/pages/Deleteforum.php

    r1 r18  
    4747                        $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    4848                        $q->execute(); 
    49                         while ($row = $q->fetchObject()) { 
     49                        $rows = $q->fetchAll(); 
     50                        $q = NULL; 
     51                        foreach ($rows as $row) { 
    5052                            // delete posts 
    5153                            $q2 = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'posts WHERE topic = :id'); 
    52                             $q2->bindParam(':id', $row->topicid, PDO::PARAM_INT, 12); 
     54                            $q2->bindParam(':id', $row['topicid'], PDO::PARAM_INT, 12); 
    5355                            $q2->execute(); 
     56                            $q2 = NULL; 
    5457                            // delete poll 
    5558                            $q2 = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'polls WHERE pollid = :poll'); 
    56                             $q2->bindParam(':poll', $row->poll, PDO::PARAM_INT, 12); 
     59                            $q2->bindParam(':poll', $row['poll'], PDO::PARAM_INT, 12); 
    5760                            $q2->execute(); 
     61                            $q2 = NULL; 
    5862                            // delete topic itself 
    5963                            $q2 = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'topics WHERE topicid = :id'); 
    60                             $q2->bindParam(':id', $row->topicid, PDO::PARAM_INT, 12); 
     64                            $q2->bindParam(':id', $row['topicid'], PDO::PARAM_INT, 12); 
    6165                            $q2->execute(); 
     66                            $q2 = NULL; 
    6267                        } 
    6368                    } else { 
     
    6772                        $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    6873                        $q->execute(); 
     74                        $q = NULL; 
    6975                    } 
    7076                    // delete forum 
     
    7278                    $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    7379                    $q->execute(); 
     80                    $q = NULL; 
    7481                    $div = $this->html->body->addChild('div', $LANG['forum_deleted']); 
    7582                    $div->addAttribute('id', 'admin_main'); 
  • trunk/admin/classes/pages/Editmember.php

    r17 r18  
    5151                $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    5252                if ($q->execute() && $q->fetchColumn() == 1) { 
    53                     $q->closeCursor()
     53                    $q = NULL
    5454                    if ($submit == $LANG['Submit']) { 
    5555                        // write new member profile into database 
     
    109109                                $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    110110                                $q->execute(); 
     111                                $q = NULL; 
    111112                                // update name in the posts table, too, if necessary 
    112113                                if ($user != $row->membername) { 
     
    116117                                    $q->bindValue(':one', 1, PDO::PARAM_INT); 
    117118                                    $q->execute(); 
     119                                    $q = NULL; 
    118120                                } 
    119121                                // if the crucial rest has been entered, update it one by one 
     
    123125                                    $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    124126                                    $q->execute(); 
     127                                    $q = NULL; 
    125128                                } 
    126129                                // update rest in bulk 
     
    142145                                $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    143146                                $q->execute(); 
     147                                $q = NULL; 
    144148                                // translate status to group membership 
    145149                                // first, delete previous entries 
     
    150154                                        $q2->execute(); 
    151155                                        $_groupid = $q2->fetchColumn(); 
    152                                         $q2->closeCursor()
     156                                        $q2 = NULL
    153157                                        $q = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'groupmemberships WHERE member = :id AND usergroup = :group'); 
    154158                                        $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    155159                                        $q->bindParam(':group', $_groupid, PDO::PARAM_INT, 12); 
    156160                                        $q->execute(); 
     161                                        $q = NULL; 
    157162                                    } 
    158163                                } 
     
    163168                                    $q2->execute(); 
    164169                                    $_groupid = $q2->fetchColumn(); 
    165                                     $q2->closeCursor()
     170                                    $q2 = NULL
    166171                                    $q = $C->prepare('INSERT INTO ' . $SETTINGS['dbtableprefix'] . 'groupmemberships (member, usergroup) VALUES (:id, :group)'); 
    167172                                    $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    168173                                    $q->bindParam(':group', $_groupid, PDO::PARAM_INT, 12); 
    169174                                    $q->execute(); 
     175                                    $q = NULL; 
    170176                                } 
    171177                                // success 
     
    184190                        $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    185191                        $q->execute(); 
     192                        $q = NULL; 
    186193                        // delete subscriptions 
    187194                        $q = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'subscriptions WHERE member = :id'); 
    188195                        $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    189196                        $q->execute(); 
     197                        $q = NULL; 
    190198                        // done 
    191199                        $div = $this->html->body->addChild('div', $LANG['member_deleted']); 
     
    202210                                $q->bindParam(':group', $row['id'], PDO::PARAM_INT, 12); 
    203211                                $q->execute(); 
     212                                $q = NULL; 
    204213                                if (isset($newgroupmemberships[$row['id']]) && $newgroupmemberships[$row['id']] == 1) { 
    205214                                    // insert 
     
    208217                                    $q->bindParam(':group', $row['id'], PDO::PARAM_INT, 12); 
    209218                                    $q->execute(); 
     219                                    $q = NULL; 
    210220                                } 
    211221                            } 
     
    216226                    } 
    217227                } else { 
    218                     $q->closeCursor()
     228                    $q = NULL
    219229                    $div = $this->html->body->addChild('div', $LANG['error_id']); 
    220230                    $div->addAttribute('id', 'admin_main'); 
     
    413423                        $q->execute(); 
    414424                        $row = $q->fetchObject(); 
    415                         $q->closeCursor()
     425                        $q = NULL
    416426                        $this->html->body->addElement(new XMLElement('<div><b>' . $LANG['Member'] . ': ' . $row->membername . '</b></div>')); 
    417427                        $this->html->body->addChild('br'); 
     
    436446                                $_col2 .= ' checked="checked"'; 
    437447                            } 
    438                             $q3->closeCursor()
     448                            $q3 = NULL
    439449                            $_col2 .= ' value="1" /></td>'; 
    440450                            $form->addRawTableRow(Array($_col1, $_col2)); 
  • trunk/admin/classes/pages/Groups.php

    r1 r18  
    5454                            $q->bindParam(':id', $row['id'], PDO::PARAM_INT, 12); 
    5555                            $q->execute(); 
     56                            $q = NULL; 
    5657                            // delete group 
    5758                            $q = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'usergroups WHERE id = :id'); 
    5859                            $q->bindParam(':id', $row['id'], PDO::PARAM_INT, 12); 
    5960                            $q->execute(); 
     61                            $q = NULL; 
    6062                        } else { 
    6163                            // update group 
     
    6971                            $q->bindParam(':id', $row['id'], PDO::PARAM_INT, 12); 
    7072                            $q->execute(); 
     73                            $q = NULL; 
    7174                        } 
    7275                    } 
     
    8285                    } 
    8386                    $q->execute(); 
     87                    $q = NULL; 
    8488                } 
    8589                // done 
  • trunk/admin/classes/pages/Moderators.php

    r17 r18  
    5252                        $q->bindParam(':name', trim($_mod), PDO::PARAM_STR); 
    5353                        if ($q->execute() && $row2 = $q->fetchObject()) { 
    54                             $q->closeCursor()
     54                            $q = NULL
    5555                            if ($row2->memberstatus == 'Moderator') { 
    5656                                // valid 
     
    6262                        } else { 
    6363                            // invalid 
    64                             $q->closeCursor()
     64                            $q = NULL
    6565                            $_invalid[] = $_mod; 
    6666                        } 
     
    7070                    $q->bindParam(':id', $row['forumid'], PDO::PARAM_INT, 12); 
    7171                    $q->execute(); 
     72                    $q = NULL; 
    7273                    // enter new (valid) moderators 
    7374                    foreach ($_newmods_ids as $_memberid) { 
     
    7677                        $q->bindParam(':member', $_memberid, PDO::PARAM_INT, 12); 
    7778                        $q->execute(); 
     79                        $q = NULL; 
    7880                    } 
    7981                    // print out warnings about invalid member names 
     
    114116                        $_mods .= $row2->membername; 
    115117                    } 
     118                    $q = NULL; 
    116119                    // editing row for this specific forum 
    117120                    $form->addTableRow($row['forumtitle'], 'text', 'newdesc[' . $row['forumid'] . ']', $_mods); 
  • trunk/admin/classes/pages/Modifycategory.php

    r17 r18  
    4949                    $q->bindParam(':id', $row['category_id'], PDO::PARAM_INT, 12); 
    5050                    $q->execute(); 
     51                    $q = NULL; 
    5152                } 
    5253                $div = $this->html->body->addChild('div', $LANG['categories_changed']); 
     
    6768                $q->execute(); 
    6869                $_num = $q->fetchColumn(); 
    69                 $q->closeCursor()
     70                $q = NULL
    7071                // get category data 
    7172                foreach ($C->query('SELECT * FROM ' . $SETTINGS['dbtableprefix'] . 'categories ORDER BY category_order ASC') as $row) { 
  • trunk/admin/classes/pages/Modifyforum.php

    r17 r18  
    5151                    $q->bindParam(':id', $row['forumid'], PDO::PARAM_INT, 12); 
    5252                    $q->execute(); 
     53                    $q = NULL; 
    5354                } 
    5455                $div = $this->html->body->addChild('div', $LANG['forums_changed']); 
     
    8081                    $q3->execute(); 
    8182                    $_num = $q3->fetchColumn(); 
    82                     $q3->closeCursor()
     83                    $q3 = NULL
    8384                    for ($i = 1; $i <= $_num; $i++) { 
    8485                        $_col4 .= '<option value="' . $i . '"'; 
  • trunk/admin/classes/pages/Permissions.php

    r17 r18  
    5656                $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    5757                if ($q->execute() && $row = $q->fetchObject()) { 
    58                     $q->closeCursor()
     58                    $q = NULL
    5959                    // delete previously set permissions of this group 
    6060                    $q2 = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'rights WHERE usergroup = :id'); 
    6161                    $q2->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    6262                    $q2->execute(); 
     63                    $q2 = NULL; 
    6364                    if ($submit == $LANG['Restore_Defaults']) { 
    6465                        // shove defaults from one table to the other 
     
    6667                        $q3->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    6768                        $q3->execute(); 
    68                         while ($row3 = $q3->fetchObject()) { 
     69                        $rows3 = $q3->fetchAll(); 
     70                        $q3 = NULL; 
     71                        foreach ($rows3 as $row3) { 
    6972                            $q4 = $C->prepare('INSERT INTO ' . $SETTINGS['dbtableprefix'] . 'rights (page, usergroup, read, write) VALUES (:page, :group, :read, :write)'); 
    70                             $q4->bindParam(':page', $row3->page, PDO::PARAM_STR); 
     73                            $q4->bindParam(':page', $row3['page'], PDO::PARAM_STR); 
    7174                            $q4->bindParam(':group', $id, PDO::PARAM_INT, 12); 
    72                             $q4->bindParam(':read', $row3->read, PDO::PARAM_INT, 12); 
    73                             $q4->bindParam(':write', $row3->write, PDO::PARAM_INT, 12); 
     75                            $q4->bindParam(':read', $row3['read'], PDO::PARAM_INT, 12); 
     76                            $q4->bindParam(':write', $row3['write'], PDO::PARAM_INT, 12); 
    7477                            $q4->execute(); 
     78                            $q4 = NULL; 
    7579                        } 
    7680                        // if the group to reset is 'Admin', add all rights on all forums 
     
    8488                                    $q5->bindValue(':write', 1, PDO::PARAM_INT); 
    8589                                    $q5->execute(); 
     90                                    $q5 = NULL; 
    8691                                } 
    8792                            } 
     
    104109                            } 
    105110                            $q2->execute(); 
     111                            $q2 = NULL; 
    106112                        } 
    107113                    } 
     
    111117                } else { 
    112118                    // invalid group 
    113                     $q->closeCursor()
     119                    $q = NULL
    114120                    $div = $this->html->body->addChild('div', $LANG['error_id']); 
    115121                    $div->addAttribute('id', 'admin_main'); 
     
    126132                $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    127133                if ($q->execute() && $row = $q->fetchObject()) { 
    128                     $q->closeCursor()
     134                    $q = NULL
    129135                    $form = new Form($F->link('permissions')); 
    130136                    $form->addInput('hidden', 'id', $id); 
     
    156162                                        $_row = $q2->fetchObject(); 
    157163                                    } 
    158                                     $q2->closeCursor()
     164                                    $q2 = NULL
    159165                                    if (!isset($_row->read)) { 
    160166                                        // nothing set yet, so 'default deny' 
     
    188194                            $_row = $q2->fetchObject(); 
    189195                        } 
    190                         $q2->closeCursor()
     196                        $q2 = NULL
    191197                        if (!isset($_row->read)) { 
    192198                            // nothing set yet, so 'default deny' 
     
    217223                                $_row = $q2->fetchObject(); 
    218224                            } 
    219                             $q2->closeCursor()
     225                            $q2 = NULL
    220226                            if (!isset($_row->read)) { 
    221227                                // nothing set yet, so 'default deny' 
     
    242248                } else { 
    243249                    // invalid group 
    244                     $q->closeCursor()
     250                    $q = NULL
    245251                    $div = $this->html->body->addChild('div', $LANG['error_id']); 
    246252                    $div->addAttribute('id', 'admin_main'); 
  • trunk/classes/misc/Forumjump.php

    r1 r18  
    4040        $q = $C->prepare('SELECT category_id, category_name FROM ' . $SETTINGS['dbtableprefix'] . 'categories ORDER BY category_order ASC'); 
    4141        if ($q->execute()) { 
    42             while ($row = $q->fetchObject()) { 
     42            $rows = $q->fetchAll(); 
     43            $q = NULL; 
     44            foreach ($rows as $row) { 
    4345                // offer only categories which the user may read 
    44                 if (Member::checkRights('Category', 'read', $row->category_id)) { 
     46                if (Member::checkRights('Category', 'read', $row['category_id'])) { 
    4547                    // set number of forums in this category to zero 
    4648                    $n = 0; 
    4749                    // add this category's name 
    48                     $_cat = '<option value="category=' . $row->category_id . '">&gt; ' . $row->category_name . '</option>'; 
     50                    $_cat = '<option value="category=' . $row['category_id'] . '">&gt; ' . $row['category_name'] . '</option>'; 
    4951                    // list forums in this category 
    5052                    $q2 = $C->prepare('SELECT forumid, forumtitle FROM ' . $SETTINGS['dbtableprefix'] . 'forums WHERE forum_category=:category ORDER BY forum_order ASC'); 
    51                     $q2->bindParam(':category', $row->category_id, PDO::PARAM_INT, 12); 
     53                    $q2->bindParam(':category', $row['category_id'], PDO::PARAM_INT, 12); 
    5254                    if ($q2->execute()) { 
    53                         while ($row2 = $q2->fetchObject()) { 
     55                        $rows2 = $q2->fetchAll(); 
     56                        $q2 = NULL; 
     57                        foreach ($rows2 as $row2) { 
    5458                            // offer only forums which the user may read 
    55                             if (Member::checkRights('Forum', 'read', $row2->forumid)) { 
     59                            if (Member::checkRights('Forum', 'read', $row2['forumid'])) { 
    5660                                // increase number of forums 
    5761                                $n++; 
    5862                                // add this forum as an option 
    59                                 $_cat .= '<option value="forum=' . $row2->forumid . '">' .  $row2->forumtitle . '</option>'; 
     63                                $_cat .= '<option value="forum=' . $row2['forumid'] . '">' .  $row2['forumtitle'] . '</option>'; 
    6064                            } 
    6165                        } 
  • trunk/classes/misc/Member.php

    r17 r18  
    6969            $q->bindParam(':id', $username, PDO::PARAM_INT, 12); 
    7070            $s = $q->execute(); 
     71            $row = $q->fetchObject(); 
     72            $q = NULL; 
    7173            // set flag that step a few lines below can be skipped 
    7274            $member = 2; 
     
    7880                $q->bindParam(':name', $username, PDO::PARAM_STR); 
    7981                $s = $q->execute(); 
    80             } 
    81             if ($s && $row = $q->fetchObject()) { 
    82                 $q->closeCursor(); 
     82                $row = $q->fetchObject(); 
     83                $q = NULL; 
     84            } 
     85            if ($s && is_object($row)) { 
    8386                // member found - put information in object variables 
    8487                $this->id = $row->memberid; 
     
    128131                    $row2->posts = 0; 
    129132                } 
    130                 $q2->closeCursor()
     133                $q2 = NULL
    131134                $this->posts = $row2->posts; 
    132135                // determine stage by number of posts 
     
    139142                } 
    140143            } else { 
    141                 $q->closeCursor(); 
    142144                // member hasn't been found - deleted member 
    143145                $this->id = 0; 
     
    422424            $password = '*'; 
    423425        } 
    424         $q->closeCursor()
     426        $q = NULL
    425427        // check if member's name exists 
    426428        $q = $C->prepare('SELECT memberpassword FROM ' . $SETTINGS['dbtableprefix'] . 'members WHERE membername=:user'); 
     
    429431        $_fail = 0; 
    430432        if ($s && $row = $q->fetchObject()) { 
    431             $q->closeCursor()
     433            $q = NULL
    432434            // check if password is correct 
    433435            if ($row->memberpassword === $password) { 
     
    440442        } else { 
    441443            // username doesn't even exist 
    442             $q->closeCursor()
     444            $q = NULL
    443445            $_fail = 1; 
    444446        } 
     
    519521        $q->bindParam(':userid', $userid, PDO::PARAM_INT, 12); 
    520522        $q->execute(); 
     523        $q = NULL; 
    521524    } /* function setPassword */ 
    522525 
     
    538541            if ($_SESSION['memberid'] > 0) { 
    539542                // get member's groups 
    540                 $q = $C->prepare('SELECT usergroup FROM '.$SETTINGS['dbtableprefix'].'groupmemberships WHERE member=:id'); 
     543                $q = $C->prepare('SELECT usergroup FROM ' . $SETTINGS['dbtableprefix'] . 'groupmemberships WHERE member=:id'); 
    541544                $q->bindParam(':id', $_SESSION['memberid'], PDO::PARAM_INT, 12); 
    542545                $q->execute(); 
     
    546549                    $_groups[] = $row->usergroup; 
    547550                } 
    548                 $q->closeCursor()
     551                $q = NULL
    549552                // check for each of the user's groups 
    550553                foreach ($_groups as $key=>$val) { 
     
    559562                        $_permit = TRUE; 
    560563                    } 
    561                     $q->closeColumn()
     564                    $q = NULL
    562565                } 
    563566            } 
     
    576579                    $_groups[] = $row->usergroup; 
    577580                } 
     581                $q = NULL; 
    578582            } else { 
    579583                // set group to 'Guest' 
     
    584588                // result WILL exist, because if that group doesn't exist, the board isn't correctly set up anyway 
    585589                $row = $q->fetchObject(); 
    586                 $q->closeCursor()
     590                $q = NULL
    587591                $_groups[0] = $row->id; 
    588592            } 
     
    602606                        $_permit = TRUE; 
    603607                    } 
    604                     $q->closeCursor()
     608                    $q = NULL
    605609                } 
    606610                // done 
     
    613617                    $q2->execute(); 
    614618                    $row = $q2->fetchObject(); 
    615                     $q2->closeCursor()
     619                    $q2 = NULL
    616620                    $id = $row->forum; 
    617621                } 
     
    629633                        $_permit = TRUE; 
    630634                    } 
    631                     $q->closeCursor()
     635                    $q = NULL
    632636                } 
    633637                // done 
     
    647651                        $_permit = TRUE; 
    648652                    } 
    649                     $q->closeCursor()
     653                    $q = NULL
    650654                } 
    651655                if ($_permit === FALSE) { 
     
    657661                        $q->execute(); 
    658662                        $row = $q->fetchObject(); 
    659                         $q->closeCursor()
     663                        $q = NULL
    660664                        if ($row->postedbymember == 1 && $row->poster == $_SESSION['membername']) { 
    661665                            // it IS the topic starter 
     
    669673                        $q->execute(); 
    670674                        $row = $q->fetchObject(); 
    671                         $q->closeCursor()
     675                        $q = NULL
    672676                        if ($row->postedbymember == 1 && $row->poster == $_SESSION['membername']) { 
    673677                            // it IS the poster 
     
    684688                            // overwrite $id for the following steps 
    685689                            $id = $q->fetchColumn(); 
    686                             $q->closeCursor()
     690                            $q = NULL
    687691                        } 
    688692                        // $id given as topic id, so get forum id first 
     
    691695                        $q->execute(); 
    692696                        $_forumid = $q->fetchColumn(); 
    693                         $q->closeCursor()
     697                        $q = NULL
    694698                        // check if this person IS a moderator of this particular forum 
    695699                        $q = $C->prepare('SELECT COUNT(*) FROM ' . $SETTINGS['dbtableprefix'] . 'moderators WHERE forum=:forum AND member=:member'); 
     
    701705                            $_permit = TRUE; 
    702706                        } 
    703                         $q->closeCursor()
     707                        $q = NULL
    704708                    } 
    705709                } 
  • trunk/classes/misc/Post.php

    r17 r18  
    4444                $this->post = $q->fetchObject(); 
    4545            } 
    46             $q->closeCursor()
     46            $q = NULL
    4747        } 
    4848    } /* constructor */ 
     
    140140            if ($s) { 
    141141                $row = $q->fetchObject(); 
    142                 $q->closeCursor()
     142                $q = NULL
    143143                if ($row->closed == '1') { 
    144144                    // topic closed - error 
     
    148148            } else { 
    149149                // topic not found in database - error 
     150                $q = NULL; 
    150151                $ok = 0; 
    151152                $_error = $LANG['error_id']; 
     
    167168                $_error = $LANG['error_id']; 
    168169            } 
    169             $q->closeCursor()
     170            $q = NULL
    170171        } 
    171172        if ($show_orig === 'newpoll') { 
     
    189190                if (($_SESSION['lastposttime'] + $SETTINGS['floodcontrol'] >= time()) && ($q->fetchColumn() + $SETTINGS['floodcontrol'] >= time())) { 
    190191                    // too little time between posts 
    191                     $q->closeCursor()
     192                    $q = NULL
    192193                    $_error = $LANG['error_floodcontrol']; 
    193194                    $ok = 0; 
    194195                } else { 
    195196                    // sort out IP banning 
    196                     $q->closeCursor()
     197                    $q = NULL
    197198                    foreach ($bannedip as $_ip) { 
    198199                        if (strpos($_SERVER['REMOTE_ADDR'], $_ip) !== FALSE) { 
     
    211212                            if ($s && $q->fetchColumn() >= 1) { 
    212213                                // name taken 
    213                                 $q->closeCursor()
     214                                $q = NULL
    214215                                $ok = 0; 
    215216                                $_error = $LANG['error_name_taken']; 
    216217                            } else { 
    217218                                // check if session password has been correctly entered 
    218                                 $q->closeCursor()
     219                                $q = NULL
    219220                                if ($password !== $_SESSION['pw']) { 
    220221                                    $ok = 0; 
     
    243244                            if ($s) { 
    244245                                $row = $q->fetchObject(); 
    245                                 $q->closeCursor()
     246                                $q = NULL
    246247                                // check if he's banned 
    247248                                if ($row->memberstatus != 'Banned') { 
     
    256257                                    $ok = 0; 
    257258                                } 
     259                            } else { 
     260                                $q = NULL; 
    258261                            } 
    259262                        } 
     
    332335                                $q->bindValue(':voters', '', PDO::PARAM_STR); 
    333336                                $q->execute(); 
     337                                $q = NULL; 
    334338                                // get new poll's id 
    335339                                $q = $C->prepare('SELECT MAX(pollid) FROM ' . $SETTINGS['dbtableprefix'] . 'polls'); 
    336340                                $q->execute(); 
    337341                                $row = $q->fetchColumn(); 
    338                                 $q->closeCursor()
     342                                $q = NULL
    339343                                $pollid = $row; 
    340344                                @$C->query('UNLOCK TABLE ' . $SETTINGS['dbtableprefix'] . 'polls'); 
     
    344348                                @$C->query('LOCK TABLE ' . $SETTINGS['dbtableprefix'] . 'topics'); 
    345349                                $subject = trim($subject); 
    346                                 $q = $C->prepare('INSERT INTO ' . $SETTINGS['dbtableprefix'] . 'topics (forum, topictitle, poll, subscribed) values (:id, :subject, :poll, :subs)'); 
     350                                $q = $C->prepare('INSERT INTO ' . $SETTINGS['dbtableprefix'] . 'topics (forum, topictitle, poll) values (:id, :subject, :poll)'); 
    347351                                $q->bindParam(':id', $forum, PDO::PARAM_INT,12); 
    348352                                $q->bindParam(':subject', $subject, PDO::PARAM_STR); 
    349353                                $q->bindParam(':poll', $pollid, PDO::PARAM_INT, 12); 
    350                                 $q->bindValue(':subs', '', PDO::PARAM_STR); 
    351354                                $q->execute(); 
     355                                $q = NULL; 
    352356                                // get new topic id 
    353357                                $q = $C->prepare('SELECT MAX(topicid) FROM ' . $SETTINGS['dbtableprefix'] . 'topics'); 
    354358                                $q->execute(); 
    355359                                $row = $q->fetchColumn(); 
    356                                 $q->closeCursor()
     360                                $q = NULL
    357361                                // topicid is called 'reply' in following statements 
    358362                                $reply = $row; 
     
    376380                            $q->bindParam(':member', $postedbymember, PDO::PARAM_INT, 1); 
    377381                            $q->execute(); 
     382                            $q = NULL; 
    378383                            // set 'last post time' for flood control 
    379384                            $_SESSION['lastposttime'] = time(); 
     
    382387                            $q->bindParam(':sess', session_id(), PDO::PARAM_STR); 
    383388                            $q->execute(); 
     389                            $q = NULL; 
    384390                            // topic subscription 
    385391                            if (isset($_SESSION['memberid']) && $_SESSION['memberid'] > 0) { 
     
    389395                                $q->bindParam(':member', $_SESSION['memberid'], PDO::PARAM_INT, 12); 
    390396                                $q->execute(); 
     397                                $q = NULL; 
    391398                                // if subscription flag set, insert 
    392399                                if ($subscribe == '1') { 
     
    395402                                    $q->bindParam(':member', $_SESSION['memberid'], PDO::PARAM_INT, 12); 
    396403                                    $q->execute(); 
     404                                    $q = NULL; 
    397405                                } 
    398406                            } 
     
    402410                            $q->execute(); 
    403411                            $row = $q->fetchColumn(); 
    404                             $q->closeCursor()
     412                            $q = NULL
    405413                            // calculate page 
    406414                            $page = ceil($row / $SETTINGS['postsperpage']); 
    407415                            // send e-mail notifications (using the language the receipient has set) 
    408                             $q = $C->prepare('SELECT subscribed FROM '.  $SETTINGS['dbtableprefix'] . 'topics WHERE topicid=:id'); 
     416                            $q = $C->prepare('SELECT member FROM ' . $SETTINGS['dbtableprefix'] . 'WHERE topic = :id'); 
    409417                            $q->bindParam(':id', $reply, PDO::PARAM_INT, 12); 
    410418                            $q->execute(); 
    411                             $row = $q->fetchObject(); 
    412                             $q->closeCursor(); 
    413                             $subscribed = explode(',', $row->subscribed); 
     419                            $subscribed = $q->fetchAll(); 
     420                            $q = NULL; 
    414421                            foreach ($subscribed as $subscriber) { 
    415422                                // don't notify of one's own posts 
    416                                 if ($subscriber != '' && $subscriber != $_SESSION['memberid']) { 
     423                                if ($subscriber['member'] != '' && $subscriber['member'] != $_SESSION['memberid']) { 
    417424                                    $q2 = $C->prepare('SELECT memberemail,lang FROM ' . $SETTINGS['dbtableprefix'] . 'members WHERE memberid=:id'); 
    418                                     $q2->bindParam(':id', $subscriber, PDO::PARAM_INT, 12); 
     425                                    $q2->bindParam(':id', $subscriber['member'], PDO::PARAM_INT, 12); 
    419426                                    $s = $q2->execute(); 
    420427                                    if ($s) { 
    421428                                        $row2 = $q2->fetchObject(); 
    422                                         $q2->closeCursor()
     429                                        $q2 = NULL
    423430                                        // use receipient's language 
    424431                                        if ($row2->lang != '') { 
     
    432439                                        $q->bindParam(':body', str_replace(Array('%topictitle%', '%topic%', '%page%'), Array(Topic::getTitle($reply), $reply, $page)), $LANG['mail_notification_body']); 
    433440                                        $q->execute(); 
     441                                        $q = NULL; 
    434442                                        // back to user's language 
    435443                                        include('includes/lang/' . $_SESSION['lang'] . '.php'); 
  • trunk/classes/pages/Calendar.php

    r1 r18  
    124124                    } 
    125125                } 
     126                $q = NULL; 
    126127                $cols[] = $_col . '</td>'; 
    127128                $day++; 
  • trunk/classes/pages/Category.php

    r17 r18  
    5454        } 
    5555        $query->execute(); 
     56        $rows = $query->fetchAll(); 
     57        $query = NULL; 
    5658        // for each category... 
    57         while ($row = $query->fetchObject()) { 
     59        foreach ($rows as $row) { 
    5860            // category header 
    5961            // get forums in this category 
    6062            $q2 = $C->prepare('SELECT * FROM ' . $SETTINGS['dbtableprefix'] . 'forums WHERE forum_category=:category ORDER BY forum_order ASC'); 
    61             $q2->bindParam(':category', $row->category_id, PDO::PARAM_INT, 12); 
     63            $q2->bindParam(':category', $row['category_id'], PDO::PARAM_INT, 12); 
    6264            $q2->execute(); 
     65            $rows2 = $q2->fetchAll(); 
     66            $q2 = NULL; 
    6367            // construct list of forums in a table 
    6468            $table = new Table(); 
     
    6771            // number of forums user is allowed to see 
    6872            $_forums = 0; 
    69             while ($row2 = $q2->fetchObject()) { 
     73            foreach ($rows2 as $row2) { 
    7074                /* check if user has permission on this forum; 
    7175                 * required: read; dependent on id */ 
    72                 $_permit = Member::checkRights('Forum', 'read', $row2->forumid); 
     76                $_permit = Member::checkRights('Forum', 'read', $row2['forumid']); 
    7377                if ($_permit) { 
    7478                    // increase number of permitted forums 
     
    7680                    // number of topics 
    7781                    $q3 = $C->prepare('SELECT COUNT(topicid) AS topics FROM ' . $SETTINGS['dbtableprefix'] . 'topics WHERE forum=:forum'); 
    78                     $q3->bindParam(':forum', $row2->forumid, PDO::PARAM_INT,12); 
     82                    $q3->bindParam(':forum', $row2['forumid'], PDO::PARAM_INT, 12); 
    7983                    $q3->execute(); 
    8084                    $row3 = $q3->fetchObject(); 
    81                     $q3->closeCursor()
     85                    $q3 = NULL
    8286                    // number of posts 
    8387                    $q4 = $C->prepare('SELECT COUNT(postid) AS posts FROM ' . $SETTINGS['dbtableprefix'] . 'posts WHERE topic IN (SELECT topicid FROM ' . $SETTINGS['dbtableprefix'] . 'topics WHERE forum=:forum)'); 
    84                     $q4->bindParam(':forum', $row2->forumid, PDO::PARAM_INT,12); 
     88                    $q4->bindParam(':forum', $row2['forumid'], PDO::PARAM_INT, 12); 
    8589                    $q4->execute(); 
    8690                    $row4 = $q4->fetchObject(); 
    87                     $q4->closeCursor()
     91                    $q4 = NULL
    8892                    // last activity 
    8993                    $q5 = $C->prepare('SELECT t.topicid AS topicid,t.topictitle AS topictitle, p.posttime AS posttime, p.poster AS poster, p.postedbymember AS postedbymember FROM ' . $SETTINGS['dbtableprefix'] . 'posts p, ' . $SETTINGS['dbtableprefix'] . 'topics t WHERE t.forum=:forum AND p.topic=t.topicid ORDER BY p.posttime DESC LIMIT 0,1'); 
    90                     $q5->bindParam(':forum', $row2->forumid, PDO::PARAM_INT,12); 
     94                    $q5->bindParam(':forum', $row2['forumid'], PDO::PARAM_INT,12); 
    9195                    $q5->execute(); 
    9296                    $row5 = $q5->fetchObject(); 
    93                     $q5->closeCursor()
     97                    $q5 = NULL
    9498                    // get poster information 
    9599                    $_poster = new Member($row5->poster, $row5->postedbymember); 
     
    103107                    } 
    104108                    // show forum overview 
    105                     $table->addRow(Array($_mark, '<td><h3><a href="' . $F->link('forum') . 'id=' . $row2->forumid . '">' . $row2->forumtitle . '</a></h3>' . $row2->forumdescription . '</td>', '<td align="center">' . $row3->topics . '</td>', '<td align="center">' . $row4->posts . '</td>', '<td><div>' . $LANG['by'] . ' ' . $_poster->getProfileLink() . '</div><div>' . $LANG['in'] . ' <a href="' . $F->link('topic') . 'id=' . $row5->topicid . '">' . $row5->topictitle . '</a></div><div>' . $F->datetime($row5->posttime) . '</div></td>')); 
     109                    $table->addRow(Array($_mark, '<td><h3><a href="' . $F->link('forum') . 'id=' . $row2['forumid'] . '">' . $row2['forumtitle'] . '</a></h3>' . $row2['forumdescription'] . '</td>', '<td align="center">' . $row3->topics . '</td>', '<td align="center">' . $row4->posts . '</td>', '<td><div>' . $LANG['by'] . ' ' . $_poster->getProfileLink() . '</div><div>' . $LANG['in'] . ' <a href="' . $F->link('topic') . 'id=' . $row5->topicid . '">' . $row5->topictitle . '</a></div><div>' . $F->datetime($row5->posttime) . '</div></td>')); 
    106110                } 
    107111            } 
     
    110114                // category header 
    111115                $h2 = $this->html->body->addChild('h2'); 
    112                 $a = $h2->addChild('a', $row->category_name); 
    113                 $a->addAttribute('href', $F->link('category') . 'id=' . $row->category_id); 
     116                $a = $h2->addChild('a', $row['category_name']); 
     117                $a->addAttribute('href', $F->link('category') . 'id=' . $row['category_id']); 
    114118                // add newly constructed forums table to parent node 
    115119                $_table = $table->get(); 
     
    144148            $s = $q->execute(); 
    145149            if ($s && $r = $q->fetchObject()) { 
    146                 $q->closeCursor()
     150                $q = NULL
    147151                return $r->category_name; 
    148152            } else { 
    149                 $q->closeCursor()
     153                $q = NULL
    150154                return ''; 
    151155            } 
  • trunk/classes/pages/Delete.php

    r17 r18  
    4040            $q3->execute(); 
    4141            $row3 = $q3->fetchObject(); 
    42             $q3->closeCursor()
     42            $q3 = NULL
    4343            $q = $C->prepare('SELECT topictitle, forum FROM ' . $SETTINGS['dbtableprefix'] . 'topics WHERE topicid=:id'); 
    4444            $q->bindParam(':id', $row3->topic, PDO::PARAM_INT, 12); 
    4545            $q->execute(); 
    4646            $row = $q->fetchObject(); 
    47             $q->closeCursor()
     47            $q = NULL
    4848            $q2 = $C->prepare('SELECT forumtitle, forum_category FROM ' . $SETTINGS['dbtableprefix'] . 'forums WHERE forumid=:forum'); 
    4949            $q2->bindParam(':forum', $row->forum, PDO::PARAM_INT, 12); 
    5050            $q2->execute(); 
    5151            $row2 = $q2->fetchObject(); 
    52             $q2->closeCursor()
     52            $q2 = NULL
    5353            $this->title = ' - ' . Category::getName($row2->forum_category) . ' - ' . $row2->forumtitle . ' - ' . $row->topictitle . ' - ' . $LANG['Delete_Post']; 
    5454            $this->location = ' - <a href="' . $F->link('category') . 'id=' . $row2->forum_category . '">' . Category::getName($row2->forum_category) . '</a> - <a href="' . $F->link('forum') . 'id=' . $row->forum . '">' . $row2->forumtitle . '</a> - <a href="' . $F->link('topic') . 'id=' . $row3->topic . '">' . $row->topictitle . '</a> - <a href="' . $F->link('delete') . 'id=' . $id . '">' . $LANG['Delete_Post'] . '</a>'; 
     
    6666                $q->execute(); 
    6767                $_posts = $q->fetchColumn(); 
    68                 $q->closeCursor()
     68                $q = NULL
    6969                if ($_posts >= 2) { 
    7070                    // purge post from database 
     
    7272                    $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    7373                    $q->execute(); 
     74                    $q = NULL; 
    7475                    // success message 
    7576                    $div = $this->html->body->addChild('div', $LANG['post_deleted']); 
  • trunk/classes/pages/Edit.php

    r17 r18  
    4040            $q3->execute(); 
    4141            $row3 = $q3->fetchObject(); 
    42             $q3->closeCursor()
     42            $q3 = NULL
    4343            $q = $C->prepare('SELECT topictitle, forum FROM ' . $SETTINGS['dbtableprefix'] . 'topics WHERE topicid=:id'); 
    4444            $q->bindParam(':id', $row3->topic, PDO::PARAM_INT, 12); 
    4545            $q->execute(); 
    4646            $row = $q->fetchObject(); 
    47             $q->closeCursor()
     47            $q = NULL
    4848            $q2 = $C->prepare('SELECT forumtitle, forum_category FROM ' . $SETTINGS['dbtableprefix'] . 'forums WHERE forumid=:forum'); 
    4949            $q2->bindParam(':forum', $row->forum, PDO::PARAM_INT, 12); 
    5050            $q2->execute(); 
    5151            $row2 = $q2->fetchObject(); 
    52             $q2->closeCursor()
     52            $q2 = NULL
    5353            $this->title = ' - ' . Category::getName($row2->forum_category) . ' - ' . $row2->forumtitle . ' - ' . $row->topictitle . ' - ' . $LANG['Edit_Post']; 
    5454            $this->location = ' - <a href="' . $F->link('category') . 'id=' . $row2->forum_category . '">' . Category::getName($row2->forum_category) . '</a> - <a href="' . $F->link('forum') . 'id=' . $row->forum . '">' . $row2->forumtitle . '</a> - <a href="' . $F->link('topic') . 'id=' . $row3->topic . '">' . $row->topictitle . '</a> - <a href="' . $F->link('delete') . 'id=' . $id . '">' . $LANG['Edit_Post'] . '</a>'; 
     
    6969                $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    7070                $q->execute(); 
     71                $q = NULL; 
    7172                // success message 
    7273                $div = $this->html->body->addChild('div', $LANG['post_edited']); 
     
    7980                $q->execute(); 
    8081                $_count = $q->fetchColumn(); 
    81                 $q->closeCursor()
     82                $q = NULL
    8283                $_page = ceil($_count / $SETTINGS['postsperpage']); 
    8384                // form 
  • trunk/classes/pages/Forum.php

    r17 r18  
    3838            $q->execute(); 
    3939            $row = $q->fetchObject(); 
    40             $q->closeCursor()
     40            $q = NULL
    4141            $this->title = ' - ' . Category::getName($row->forum_category) . ' - ' . $row->forumtitle; 
    4242            $this->location = ' - <a href="' . $F->link('category') . 'id=' . $row->forum_category . '">' . Category::getName($row->forum_category) . '</a> - <a href="' . $F->link('forum') . 'id=' . $id . '">' . $row->forumtitle . '</a>'; 
     
    5252            $q->execute(); 
    5353            $row = $q->fetchObject(); 
    54             $q->closeCursor()
     54            $q = NULL
    5555            // new topic and poll buttons 
    5656            $postbuttons = new Postbuttons(TRUE, $row->forumid); 
     
    6161            $q2->execute(); 
    6262            $row2 = $q2->fetchObject(); 
    63             $q2->closeCursor()
     63            $q2 = NULL
    6464            // calculate start for this page 
    6565            if (!isset($page) || $page == '') { $page = 1; } 
     
    7979            $q2->bindParam(':forumid', $row->forumid, PDO::PARAM_INT, 12); 
    8080            $q2->execute(); 
     81            $rows2 = $q2->fetchAll(); 
     82            $q2 = NULL; 
    8183            // initialize topics list (table) 
    8284            $table = new Table(); 
     
    8486            $table->addHeaderRow(Array('', $LANG['Topic'], $LANG['Posts'], $LANG['Views'], $LANG['Started'], $LANG['Last_Post']), Array('1%', '49%', '5%', '5%', '20%', '20%')); 
    8587            // for each topic... 
    86             while ($row2 = $q2->fetchObject()) { 
     88            foreach ($rows2 as $row2) { 
    8789                // topic prefix: pinned or poll? 
    8890                $_prefix = ''; 
    89                 if ($row2->pinned == 1) { 
     91                if ($row2['pinned'] == 1) { 
    9092                    $_prefix = $LANG['Pinned'] . ': '; 
    9193                } 
    92                 if ($row2->poll != '' && $row2->poll > 0) { 
     94                if ($row2['poll'] != '' && $row2['poll'] > 0) { 
    9395                    $_prefix .= $LANG['Poll'] . ': '; 
    9496                } 
    9597                // get first post 
    9698                $q3 = $C->prepare('SELECT poster, postedbymember, posttime FROM ' . $SETTINGS['dbtableprefix'] . 'posts WHERE topic=:topicid ORDER BY posttime ASC LIMIT 0,1'); 
    97                 $q3->bindParam(':topicid', $row2->topicid, PDO::PARAM_INT, 12); 
     99                $q3->bindParam(':topicid', $row2['topicid'], PDO::PARAM_INT, 12); 
    98100                $q3->execute(); 
    99101                $row3 = $q3->fetchObject(); 
    100                 $q3->closeCursor()
     102                $q3 = NULL
    101103                // get last post 
    102104                $q4 = $C->prepare('SELECT poster, postedbymember, posttime FROM ' . $SETTINGS['dbtableprefix'] . 'posts WHERE topic=:topicid ORDER BY posttime DESC LIMIT 0,1'); 
    103                 $q4->bindParam(':topicid', $row2->topicid, PDO::PARAM_INT, 12); 
     105                $q4->bindParam(':topicid', $row2['topicid'], PDO::PARAM_INT, 12); 
    104106                $q4->execute(); 
    105107                $row4 = $q4->fetchObject(); 
    106                 $q4->closeCursor()
     108                $q4 = NULL
    107109                // get first and last poster information 
    108110                $_poster1 = new Member($row3->poster, $row3->postedbymember); 
    109111                $_poster2 = new Member($row4->poster, $row4->postedbymember); 
    110112                // multiple pages for this topic? 
    111                 $topicpages = new Pagination($SETTINGS['postsperpage'], 1, $row2->posts); 
    112                 $_multipages = $topicpages->displayTopic($row2->topicid); 
     113                $topicpages = new Pagination($SETTINGS['postsperpage'], 1, $row2['posts']); 
     114                $_multipages = $topicpages->displayTopic($row2['topicid']); 
    113115                /* new posts since user's last visit; 
    114116                 * works only for registered members who are logged in */ 
     
    122124                if ($_SESSION['memberid'] > 0) { 
    123125                    $q = $C->prepare('SELECT COUNT(*) FROM ' . $SETTINGS['dbtableprefix'] . 'posts WHERE topic=:topic AND poster=:poster AND postedbymember=:one'); 
    124                     $q->bindParam(':topic', $row2->topicid, PDO::PARAM_INT, 12); 
     126                    $q->bindParam(':topic', $row2['topicid'], PDO::PARAM_INT, 12); 
    125127                    $q->bindParam(':poster', $_SESSION['membername'], PDO::PARAM_STR); 
    126128                    $q->bindValue(':one', 1, PDO::PARAM_INT); 
     
    130132                        $_mark .= ' &amp;omicron;'; 
    131133                    } 
    132                     $q->closeCursor()
     134                    $q = NULL
    133135                } 
    134136                // add all the previously compiled topic information to table 
    135                 $table->addRow(Array($_mark,'<td><h3>' . $_prefix . '<a href="' . $F->link('topic') . 'id=' . $row2->topicid . '">' . $row2->topictitle . '</a></h3>' . $_multipages . '</td>', '<td align="center">' . $row2->posts . '</td>', '<td align="center">' . $row2->views . '</td>', '<td><div>' . $LANG['by'] . ' ' . $_poster1->getProfileLink() . '</div><div>' . $LANG['at'] . ' ' . $F->datetime($row3->posttime, FALSE, TRUE) . '</div><div>' . $LANG['on'] . ' ' . $F->datetime($row3->posttime, TRUE, FALSE) . '</div></td>', '<td><div>' . $LANG['by'] . ' ' . $_poster2->getProfileLink() . '</div><div>' . $LANG['at'] . ' ' . $F->datetime($row4->posttime, FALSE, TRUE) . '</div><div>' . $LANG['on'] . ' ' . $F->datetime($row4->posttime, TRUE, FALSE) . '</div></td>')); 
     137                $table->addRow(Array($_mark,'<td><h3>' . $_prefix . '<a href="' . $F->link('topic') . 'id=' . $row2['topicid'] . '">' . $row2['topictitle'] . '</a></h3>' . $_multipages . '</td>', '<td align="center">' . $row2['posts'] . '</td>', '<td align="center">' . $row2['views'] . '</td>', '<td><div>' . $LANG['by'] . ' ' . $_poster1->getProfileLink() . '</div><div>' . $LANG['at'] . ' ' . $F->datetime($row3->posttime, FALSE, TRUE) . '</div><div>' . $LANG['on'] . ' ' . $F->datetime($row3->posttime, TRUE, FALSE) . '</div></td>', '<td><div>' . $LANG['by'] . ' ' . $_poster2->getProfileLink() . '</div><div>' . $LANG['at'] . ' ' . $F->datetime($row4->posttime, FALSE, TRUE) . '</div><div>' . $LANG['on'] . ' ' . $F->datetime($row4->posttime, TRUE, FALSE) . '</div></td>')); 
    136138            } 
    137139            // add finished table to parent HTML element 
  • trunk/classes/pages/Lostpassword.php

    r17 r18  
    5151                    if ($s && $row = $q->fetchObject()) { 
    5252                        // member found -> generate random password 
    53                         $q->closeCursor()
     53                        $q = NULL
    5454                        $p = new Password(); 
    5555                        $p->generate(12); 
     
    5959                        @mail($email, $SETTINGS['forumname'] . ' - ' . $LANG['Lost_Password'], str_replace(Array('%membername%', '%password%'), Array($row->membername, $p->get()), $LANG['lost_password_mail']), 'From: ' . $SETTINGS['forumadminemail']); 
    6060                    } else { 
    61                         $q->closeCursor()
     61                        $q = NULL
    6262                        $this->html->body->addChild('div', $LANG['error_unknown_mail_address']); 
    6363                    } 
  • trunk/classes/pages/Mail.php

    r17 r18  
    5151                $q->execute(); 
    5252                $row = $q->fetchObject(); 
    53                 $q->closeCursor()
     53                $q = NULL
    5454                // get receipient information 
    5555                $q = $C->prepare('SELECT memberemail, membername, memberemailhidden, lang FROM ' . $SETTINGS['dbtableprefix'] . 'members WHERE memberid=:id'); 
     
    5757                $q->execute(); 
    5858                $row2 = $q->fetchObject(); 
    59                 $q->closeCursor()
     59                $q = NULL
    6060                // mandatory fields 
    6161                if (isset($subject) && $subject != '' && isset($post) && $post != '') { 
  • trunk/classes/pages/Members.php

    r17 r18  
    7676            } 
    7777            $s = $q->execute(); 
     78            // put all the results into an array 
     79            $rows = $q->fetchAll(); 
     80            // legacy variable used in the following code 
     81            $rows_ordered = $rows; 
     82            $q = NULL; 
    7883            if ($s) { 
    7984                // get total number of members 
    80                 $q2 = $C->query('SELECT COUNT(memberid) FROM ' . $SETTINGS['dbtableprefix'] . 'members'); 
     85                $q2 = $C->prepare('SELECT COUNT(memberid) FROM ' . $SETTINGS['dbtableprefix'] . 'members'); 
     86                $q2->execute(); 
    8187                $membercount = $q2->fetchColumn(); 
    82                 $q2->closeCursor()
     88                $q2 = NULL
    8389                // build page navigation 
    8490                $pages = new Pagination($SETTINGS['topicsperpage'], $page, $membercount); 
     
    95101                // display members 
    96102                $i = $start + 1; 
    97                 // put all the results into an array 
    98                 $rows = $q->fetchAll(); 
    99                 // legacy variable used in the following code 
    100                 $rows_ordered = $rows; 
    101103                // add the zero posters when ordering by posts (if needed, because it's a page which contains some) 
    102104                if ($order == 'posts' && count($rows_ordered) < $SETTINGS['topicsperpage']) { 
     
    106108                    $q3->execute(); 
    107109                    $_postercount = $q3->fetchColumn(); 
    108                     $q3->closeCursor()
     110                    $q3 = NULL
    109111                    $_nonpostercount = $membercount - $_postercount; 
    110112                    // define start and length of database query 
     
    116118                    $q3->execute(); 
    117119                    $_rows_temp = $q3->fetchAll(); 
     120                    $q3 = NULL; 
    118121                    // append new results to array 
    119122                    $_j = count($rows_ordered); 
  • trunk/classes/pages/Messenger.php

    r17 r18  
    4747        $q->bindValue(':zero2', 0, PDO::PARAM_INT); 
    4848        $q->execute(); 
     49        $q = NULL; 
    4950        // container 
    5051        $div = $this->html->body->addChild('div'); 
     
    7879                            $q->execute(); 
    7980                            if ($_id = $q->fetchColumn()) { 
    80                                 $q->closeCursor()
     81                                $q = NULL
    8182                                // append new id 
    8283                                $q = $C->prepare('SELECT addressbook FROM ' . $SETTINGS['dbtableprefix'] . 'members WHERE memberid=:id'); 
     
    8485                                $q->execute(); 
    8586                                $addresses = $q->fetchColumn(); 
    86                                 $q->closeCursor()
     87                                $q = NULL
    8788                                $addresses .= "\n" . $_id; 
    8889                                // write back to database 
     
    9192                                $q->bindParam(':id', $_SESSION['memberid'], PDO::PARAM_INT, 12); 
    9293                                $q->execute(); 
     94                                $q = NULL; 
    9395                                $div->addChild('span', $LANG['address_added']); 
    9496                            } else { 
    95                                 $q->closeCursor()
     97                                $q = NULL
    9698                                $div->addChild('span', $LANG['error_unknown_username']); 
    9799                            } 
     
    105107                        $q->execute(); 
    106108                        $_addr = $q->fetchColumn(); 
    107                         $q->closeCursor()
     109                        $q = NULL
    108110                        $addresses = str_replace($id . "\n", '', $_addr); 
    109111                        // write back 
     
    112114                        $q->bindParam(':id', $_SESSION['memberid'], PDO::PARAM_INT, 12); 
    113115                        $q->execute(); 
     116                        $q = NULL; 
    114117                        $div->addChild('span', $LANG['address_deleted']); 
    115118                    } 
     
    128131                    $q->execute(); 
    129132                    $_addr = $q->fetchColumn(); 
    130                     $q->closeCursor()
     133                    $q = NULL
    131134                    if ($_addr != '') { 
    132135                        $addresses = split("\n", trim($_addr)); 
     
    174177                    $_done = 0; 
    175178                    if ($row = $q->fetchObject()) { 
    176                         $q->closeCursor()
     179                        $q = NULL
    177180                        // check if it's the sender or receipient 
    178181                        if ($row->messagesender === $_SESSION['memberid']) { 
     
    182185                            $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    183186                            $q->execute(); 
     187                            $q = NULL; 
    184188                            $_done = 1; 
    185189 
     
    191195                            $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    192196                            $q->execute(); 
     197                            $q = NULL; 
    193198                            $_done = 1; 
    194199                        } 
     
    199204                        } 
    200205                    } else { 
    201                         $q->closeCursor()
     206                        $q = NULL
    202207                        $div->addChild('span', $LANG['error_id']); 
    203208                    } 
     
    228233                        $q->execute(); 
    229234                        $_status = $q->fetchColumn(); 
    230                         $q->closeCursor()
     235                        $q = NULL
    231236                        if ($_status == 'Banned') { 
    232237                            $ok = -1; 
     
    241246                                $q->execute(); 
    242247                                if ($row = $q->fetchObject()) { 
    243                                     $q->closeCursor()
     248                                    $q = NULL
    244249                                    // format message 
    245250                                    $title = $F->htmlentities(trim($subject)); 
     
    259264                                    $q->bindValue(':three', 3, PDO::PARAM_INT); 
    260265                                    $q->execute(); 
     266                                    $q = NULL; 
    261267                                    // get new message's ID 
    262268                                    $q = $C->prepare('SELECT MAX(messageid) FROM ' . $SETTINGS['dbtableprefix'] . 'messages'); 
    263269                                    $q->execute(); 
    264270                                    $_new_id = $q->fetchColumn(); 
    265                                     $q->closeCursor()
     271                                    $q = NULL
    266272                                    // unlock table 
    267273                                    @$C->query('UNLOCK TABLE ' . $SETTINGS['dbtableprefix'] . 'messages'); 
     
    279285                                    $div->addChild('span', str_replace('%to%', $to, $LANG['message_sent'])); 
    280286                                } else { 
    281                                     $q->closeCursor()
     287                                    $q = NULL
    282288                                    $_error = $LANG['error_unknown_receipient']; 
    283289                                } 
     
    307313                        if ($q->execute()) { 
    308314                            $row = $q->fetchObject(); 
    309                             $q->closeCursor()
     315                            $q = NULL
    310316                            $_rec = $row->messagesender; 
    311317                            $title = $row->messagetitle; 
     
    316322                            $quotetext = '[quote]' . $row->message . "[/quote]\n"; 
    317323                        } else { 
    318                             $q->closeCursor()
     324                            $q = NULL
    319325                        } 
    320326                    } else { 
     
    339345                    if ($q->execute()) { 
    340346                        $_table = new Table('poll'); 
    341                         while ($row = $q->fetchObject()) { 
     347                        $rows = $q->fetchAll(); 
     348                        $q = NULL; 
     349                        foreach ($rows as $row) { 
    342350                            // receipient 
    343                             $_rec = new Member($row->messagereceipient); 
    344                             $_table->addRow(Array('<td>' . $LANG['Subject'] . ': <a href="' . $F->link('messenger') . 'action=message&amp;id=' . $row->messageid . '">' . $row->messagetitle . '</a></td>', '<td>' . $LANG['To'] . ': <a href="' . $F->link('profile') . 'id=' . $row->messagereceipient . '">' . $_rec->getName() . '</a></td>', '<td>' . $LANG['Sent'] . ': ' . $F->datetime($row->messagetime) . '</td>')); 
     351                            $_rec = new Member($row['messagereceipient']); 
     352                            $_table->addRow(Array('<td>' . $LANG['Subject'] . ': <a href="' . $F->link('messenger') . 'action=message&amp;id=' . $row['messageid'] . '">' . $row['messagetitle'] . '</a></td>', '<td>' . $LANG['To'] . ': <a href="' . $F->link('profile') . 'id=' . $row['messagereceipient'] . '">' . $_rec->getName() . '</a></td>', '<td>' . $LANG['Sent'] . ': ' . $F->datetime($row['messagetime']) . '</td>')); 
    345353                        } 
    346354                        $div->addElement($_table->get()); 
    347355                    } else { 
    348                         $q->closeCursor()
     356                        $q = NULL
    349357                        $div->addChild('div', $LANG['error_unknown']); 
    350358                    } 
     
    363371                    if ($q->execute()) { 
    364372                        $row = $q->fetchObject(); 
    365                         $q->closeCursor()
     373                        $q = NULL
    366374                        $_sender = new Member($row->messagesender); 
    367375                        $_table = new Table('messagetable'); 
     
    379387                            $q->bindParam(':id', $row->messageid, PDO::PARAM_INT, 12); 
    380388                            $q->execute(); 
    381                         } 
    382                     } else { 
    383                         $q->closeCursor(); 
     389                            $q = NULL; 
     390                        } 
     391                    } else { 
     392                        $q = NULL; 
    384393                        $div->addChild('div', $LANG['error_unknown']); 
    385394                    } 
     
    400409                        $table = new Table('poll'); 
    401410                        $n = 0; // counter for number of messages displayed 
    402                         while ($row = $q->fetchObject()) { 
     411                        $rows = $q->fetchAll(); 
     412                        $q = NULL; 
     413                        foreach ($rows as $row) { 
    403414                            $_col1 = '<td>'; 
    404                             if ($row->messagereceipientflag > 1) { 
     415                            if ($row['messagereceipientflag'] > 1) { 
    405416                                $_col1 .= '<b>'; 
    406417                            } 
    407                             $_col1 .= $LANG['Subject'] . ': <a href="' . $F->link('messenger') . 'action=message&amp;id=' . $row->messageid . '">' . $row->messagetitle . '</a>'; 
    408                             if ($row->messagereceipientflag > 1) { 
     418                            $_col1 .= $LANG['Subject'] . ': <a href="' . $F->link('messenger') . 'action=message&amp;id=' . $row['messageid'] . '">' . $row['messagetitle'] . '</a>'; 
     419                            if ($row['messagereceipientflag'] > 1) { 
    409420                                $_col1 .= '</b>'; 
    410421                            } 
    411422                            $_col1 .= '</td>'; 
    412423                            $_col2 = '<td>'; 
    413                             if ($row->messagereceipientflag > 1) { 
     424                            if ($row['messagereceipientflag'] > 1) { 
    414425                                $_col2 .= '<b>'; 
    415426                            } 
    416427                            // sender's username 
    417                             $_sender = new Member($row->messagesender); 
    418                             $_col2 .= $LANG['From'] . ': <a href="' . $F->link('profile') . 'id=' . $row->messagesender . '">' . $_sender->getName() . '</a>'; 
    419                             if ($row->messagereceipientflag > 1) { 
     428                            $_sender = new Member($row['messagesender']); 
     429                            $_col2 .= $LANG['From'] . ': <a href="' . $F->link('profile') . 'id=' . $row['messagesender'] . '">' . $_sender->getName() . '</a>'; 
     430                            if ($row['messagereceipientflag'] > 1) { 
    420431                                $_col2 .= '</b>'; 
    421432                            } 
    422433                            $_col2 .= '</td>'; 
    423434                            $_col3 = '<td>'; 
    424                             if ($row->messagereceipientflag > 1) { 
     435                            if ($row['messagereceipientflag'] > 1) { 
    425436                                $_col3 .= '<b>'; 
    426437                            } 
    427                             $_col3 .= $LANG['Sent'] . ': ' . $F->datetime($row->messagetime); 
    428                             if ($row->messagereceipientflag > 1) { 
     438                            $_col3 .= $LANG['Sent'] . ': ' . $F->datetime($row['messagetime']); 
     439                            if ($row['messagereceipientflag'] > 1) { 
    429440                                $_col3 .= '</b>'; 
    430441                            } 
  • trunk/classes/pages/Moderate.php

    r17 r18  
    4141            $q->execute(); 
    4242            $row = $q->fetchObject(); 
    43             $q->closeCursor()
     43            $q = NULL
    4444            $q2 = $C->prepare('SELECT forumtitle, forum_category FROM ' . $SETTINGS['dbtableprefix'] . 'forums WHERE forumid=:forum'); 
    4545            $q2->bindParam(':forum', $row->forum, PDO::PARAM_INT, 12); 
    4646            $q2->execute(); 
    4747            $row2 = $q2->fetchObject(); 
    48             $q2->closeCursor()
     48            $q2 = NULL
    4949            $this->title = ' - ' . Category::getName($row2->forum_category) . ' - ' . $row2->forumtitle . ' - ' . $row->topictitle . ' - ' . $LANG['Moderate']; 
    5050            $this->location = ' - <a href="' . $F->link('category') . 'id=' . $row2->forum_category . '">' . Category::getName($row2->forum_category) . '</a> - <a href="' . $F->link('forum') . 'id=' . $row->forum . '">' . $row2->forumtitle . '</a> - <a href="' . $F->link('topic') . 'id=' . $id . '">' . $row->topictitle . '</a> - <a href="' . $F->link('moderate') . '">' . $LANG['Moderate'] . '</a>'; 
     
    6666                        $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    6767                        $q->execute(); 
     68                        $q = NULL; 
    6869                        // success message 
    6970                        $div = $this->html->body->addChild('div', $LANG['title_edited']); 
     
    9899                    $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    99100                    $q->execute(); 
     101                    $q = NULL; 
    100102                    // success message 
    101103                    $div = $this->html->body->addChild('div', $LANG['topic_locked']); 
     
    117119                    $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    118120                    $q->execute(); 
     121                    $q = NULL; 
    119122                    // success message 
    120123                    $div = $this->html->body->addChild('div', $LANG['topic_unlocked']); 
     
    136139                    $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    137140                    $q->execute(); 
     141                    $q = NULL; 
    138142                    // success message 
    139143                    $div = $this->html->body->addChild('div', $LANG['topic_pinned']); 
     
    155159                    $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    156160                    $q->execute(); 
     161                    $q = NULL; 
    157162                    // success message 
    158163                    $div = $this->html->body->addChild('div', $LANG['topic_unpinned']); 
     
    174179                        $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    175180                        $q->execute(); 
     181                        $q = NULL; 
    176182                        // delete topic 
    177183                        $q = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'topics WHERE topicid=:id'); 
    178184                        $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    179185                        $q->execute(); 
     186                        $q = NULL; 
    180187                        // success message 
    181188                        $div = $this->html->body->addChild('div', $LANG['topic_deleted']); 
     
    209216                        $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    210217                        $q->execute(); 
     218                        $q = NULL; 
    211219                        // success message 
    212220                        $div = $this->html->body->addChild('div'); 
     
    226234                        $q = $C->prepare('SELECT * FROM ' . $SETTINGS['dbtableprefix'] . 'forums ORDER BY forum_category ASC, forum_order ASC'); 
    227235                        $q->execute(); 
     236                        $_rows_sel = $q->fetchAll(); 
     237                        $q = NULL; 
    228238                        $_prev = 0; 
    229                         while ($_row_sel = $q->fetchObject()) { 
    230                             if ($_row_sel->forum_category != $_prev) { 
    231                                 $_sel .= '<option value="0">&gt;' . Category::getName($_row_sel->forum_category) . '</option>'; 
     239                        foreach ($_rows_sel as $_row_sel) { 
     240                            if ($_row_sel['forum_category'] != $_prev) { 
     241                                $_sel .= '<option value="0">&gt;' . Category::getName($_row_sel['forum_category']) . '</option>'; 
    232242                            } 
    233                             $_sel .= '<option value="' . $_row_sel->forumid . '">' .  $_row_sel->forumtitle . '</option>'; 
    234                             $_prev = $_row_sel->forum_category
     243                            $_sel .= '<option value="' . $_row_sel['forumid'] . '">' .  $_row_sel['forumtitle'] . '</option>'; 
     244                            $_prev = $_row_sel['forum_category']
    235245                        } 
    236246                        $_sel .= '</select>'; 
     
    262272                            $polls[] = $row->poll; 
    263273                        } 
     274                        $q = NULL; 
    264275                        // check how many times the poll id '0' (i.e. no poll) has been found 
    265276                        $_polls = array_count_values($polls); 
     
    279290                            $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    280291                            $q->execute(); 
     292                            $q = NULL 
    281293                            // delete old topic (this is the one from which the 'merge' operation was called) 
    282294                            $q = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'topics WHERE topicid=:id'); 
    283295                            $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    284296                            $q->execute(); 
     297                            $q = NULL; 
    285298                            // set poll 
    286299                            $q = $C->prepare('UPDATE ' . $SETTINGS['dbtableprefix'] . 'topics SET poll=:poll WHERE topicid=:topic'); 
     
    288301                            $q->bindParam(':topic', $topic, PDO::PARAM_INT, 12); 
    289302                            $q->execute(); 
     303                            $q = NULL; 
    290304                            // success message 
    291305                            $div = $this->html->body->addChild('div'); 
     
    315329                            $_sel .= '<option value="' . $_row_sel->topicid . '">' . $F->htmlentities($_row_sel->topictitle, TRUE) . '</option>'; 
    316330                        } 
     331                        $q2 = NULL; 
    317332                        $_sel .= '</select>'; 
    318333                        $_form->addRawTableRow(Array($LANG['Topic'] . ':', '<td>' . $_sel . '</td>')); 
     
    338353                        $q->execute(); 
    339354                        $_postcount = $q->fetchColumn(); 
    340                         $q->closeCursor()
     355                        $q = NULL
    341356                        // clean array of posts so that just the ones which should be moved remain 
    342357                        $move = array_values($_POST['move']); 
     
    348363                                $q->execute(); 
    349364                                $_forum = $q->fetchColumn(); 
    350                                 $q->closeCursor()
     365                                $q = NULL
    351366                                // lock table 
    352367                                @$C->query('LOCK TABLES ' . $SETTINGS['dbtableprefix'] . 'topics WRITE'); 
     
    357372                                $q->bindValue(':none', '', PDO::PARAM_STR); 
    358373                                $q->execute(); 
     374                                $q = NULL; 
    359375                                // get new topic's id 
    360376                                $q = $C->prepare('SELECT MAX(topicid) FROM ' . $SETTINGS['dbtableprefix'] . 'topics'); 
    361377                                $q->execute(); 
    362378                                $_new_id = $q->fetchColumn(); 
    363                                 $q->closeCursor()
     379                                $q = NULL
    364380                                @$C->query('UNLOCK TABLES'); 
    365381                                // put chosen posts into new topic 
     
    370386                                    $q->bindParam(':post', $move[$i], PDO::PARAM_INT, 12); 
    371387                                    $q->execute(); 
     388                                    $q = NULL; 
    372389                                    $i++; 
    373390                                } 
     
    377394                                    $q2 = $C->prepare('SELECT poll FROM ' . $SETTINGS['dbtableprefix'] . 'topics WHERE topicid=:id'); 
    378395                                    $q2->bindParam(':id', $id, PDO::PARAM_INT, 12); 
     396                                    $q2->execute(); 
    379397                                    $_poll_id = $q->fetchColumn(); 
    380                                     $q2->closeCursor()
     398                                    $q2 = NULL;
    381399                                    // write to new topic 
    382400                                    $q2 = $C->prepare('UPDATE ' . $SETTINGS['dbtableprefix'] . 'topics SET poll=:poll WHERE topicid=:id'); 
     
    384402                                    $q2->bindParam(':id', $_new_id, PDO::PARAM_INT, 12); 
    385403                                    $q2->execute(); 
     404                                    $q2 = NULL; 
    386405                                    // remove from old topic 
    387406                                    $q2 = $C->prepare('UPDATE ' . $SETTINGS['dbtableprefix'] . 'topics SET poll=:zero WHERE topicid=:id'); 
     
    389408                                    $q2->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    390409                                    $q2->execute(); 
     410                                    $q2 = NULL; 
    391411                                } 
    392412                                // success message 
     
    418438                        $q->execute(); 
    419439                        $poll = $q->fetchColumn(); 
     440                        $q = NULL; 
    420441                        $q->closeCursor(); 
    421442                        if ($poll > 0) { 
     
    431452                        $q2->bindParam(':topic', $id, PDO::PARAM_INT, 12); 
    432453                        $q2->execute(); 
     454                        $rows2 = $q2->fetchAll(); 
     455                        $q2 = NULL; 
    433456                        // list posts in a table 
    434457                        $table = new Table(); 
    435458                        $j = 0; 
    436                         while ($row2 = $q2->fetchObject()) { 
    437                             $p = new Post($row2->postid); 
     459                        foreach ($rows2 as $row2) { 
     460                            $p = new Post($row2['postid']); 
    438461                            /* show the checkbox to mark post for moving, 
    439462                             * $j is used as index of the $move array */ 
  • trunk/classes/pages/Newpoll.php

    r17 r18  
    4040            $q2->execute(); 
    4141            $row2 = $q2->fetchObject(); 
    42             $q2->closeCursor()
     42            $q2 = NULL
    4343            $this->title = ' - ' . Category::getName($row2->forum_category) . ' - ' . $row2->forumtitle . ' - ' . $LANG['New_Topic']; 
    4444            $this->location = ' - <a href="' . $F->link('category') . 'id=' . $row2->forum_category . '">' . Category::getName($row2->forum_category) . '</a> - <a href="' . $F->link('forum') . 'id=' . $id . '">' . $row2->forumtitle . '</a> - <a href="' . $F->link('newpoll') . 'id=' . $id . '">' . $LANG['New_Poll'] . '</a>'; 
  • trunk/classes/pages/Newtopic.php

    r17 r18  
    4040            $q2->execute(); 
    4141            $row2 = $q2->fetchObject(); 
    42             $q2->closeCursor()
     42            $q2 = NULL
    4343            $this->title = ' - ' . Category::getName($row2->forum_category) . ' - ' . $row2->forumtitle . ' - ' . $LANG['New_Topic']; 
    4444            $this->location = ' - <a href="' . $F->link('category') . 'id=' . $row2->forum_category . '">' . Category::getName($row2->forum_category) . '</a> - <a href="' . $F->link('forum') . 'id=' . $id . '">' . $row2->forumtitle . '</a> - <a href="' . $F->link('newtopic') . 'id=' . $id . '">' . $LANG['New_Topic'] . '</a>'; 
  • trunk/classes/pages/Page.php

    r17 r18  
    7272        $h1 = $this->html->body->addChild('h1'); 
    7373        $a = $h1->addChild('a'); 
    74         $a->addAttribute('href', $_pref . $F->link('index')); 
     74        $a->addAttribute('href', $SETTINGS['webpath']); 
    7575        $img = $a->addChild('img'); 
    7676        $img->addAttribute('src', $_pref . 'images/' . $SETTINGS['forumlogo']); 
     
    233233            // 'Who is online' section 
    234234            $table->addHeaderRow(Array($LANG['Who_is_online'])); 
    235             $q = $C->query('SELECT COUNT(onlinememberid) FROM ' . $SETTINGS['dbtableprefix'] . 'online'); 
     235            $q = $C->prepare('SELECT COUNT(onlinememberid) FROM ' . $SETTINGS['dbtableprefix'] . 'online'); 
     236            $q->execute(); 
    236237            if ($q->fetchColumn() > 0) { 
    237                 $q->closeCursor(); 
    238                 $q = $C->query('SELECT onlinememberid FROM ' . $SETTINGS['dbtableprefix'] . 'online'); 
     238                $q = NULL; 
     239                $q = $C->prepare('SELECT onlinememberid FROM ' . $SETTINGS['dbtableprefix'] . 'online'); 
     240                $q->execute(); 
     241                $rows = $q->fetchAll(); 
     242                $q = NULL; 
    239243                // count number of members and guests 
    240244                $i = 0; $n = 0; $_str = ''; 
    241                 while ($row = $q->fetchObject()) { 
     245                foreach ($rows as $row) { 
    242246                    if ($row->onlinememberid > 0) { 
    243247                        // if it's a member 
     
    246250                            // previous member 
    247251                        } 
    248                         $m = new Member($row->onlinememberid); 
    249                         $_str .= '<a href="' . $F->link('profile') . 'id=' . $row->onlinememberid . '">' . $m->getName() . '</a>'; 
     252                        $m = new Member($row['onlinememberid']); 
     253                        $_str .= '<a href="' . $F->link('profile') . 'id=' . $row['onlinememberid'] . '">' . $m->getName() . '</a>'; 
    250254                        unset($m); 
    251255                        $i++; 
     
    260264            } else { 
    261265                // if the online table is empty 
    262                 $q->closeCursor()
     266                $q = NULL
    263267                $_str = '1 ' . $LANG['Guest']; 
    264268            } 
     
    291295                } 
    292296            } 
     297            $q = NULL; 
    293298            if ($n === 0) { 
    294299                // no birthdays at all 
     
    300305            $table->addHeaderRow(Array($LANG['Statistics'])); 
    301306            $_str = '<div>' . $SETTINGS['forumname'] . ' ' . $LANG['currently_has']; 
    302             $q = $C->query('SELECT COUNT(memberid) AS count FROM ' . $SETTINGS['dbtableprefix'] . 'members'); 
     307            $q = $C->prepare('SELECT COUNT(memberid) AS count FROM ' . $SETTINGS['dbtableprefix'] . 'members'); 
     308            $q->execute(); 
    303309            $row = $q->fetchObject(); 
    304             $q->closeCursor()
     310            $q = NULL
    305311            $_str .= ' ' . $row->count . ' ' . $LANG['members'] . '.</div><div>' . $LANG['The_newest_member_is'] . ' '; 
    306             $q = $C->query('SELECT memberid, membername FROM ' . $SETTINGS['dbtableprefix'] . 'members ORDER BY registered DESC LIMIT 1'); 
     312            $q = $C->prepare('SELECT memberid, membername FROM ' . $SETTINGS['dbtableprefix'] . 'members ORDER BY registered DESC LIMIT 1'); 
     313            $q->execute(); 
    307314            $row = $q->fetchObject(); 
    308             $q->closeCursor()
     315            $q = NULL
    309316            $_str .= '<a href="' . $F->link('profile') . 'id=' . $row->memberid . '">' . $row->membername . '</a>.</div><div>' . $LANG['There_are'] . ' '; 
    310             $q = $C->query('SELECT COUNT(postid) AS count FROM ' . $SETTINGS['dbtableprefix'] . 'posts'); 
     317            $q = $C->prepare('SELECT COUNT(postid) AS count FROM ' . $SETTINGS['dbtableprefix'] . 'posts'); 
     318            $q->execute(); 
    311319            $row = $q->fetchObject(); 
    312             $q->closeCursor()
     320            $q = NULL
    313321            $_str .= $row->count . ' ' . $LANG['posts'] . ' ' . $LANG['in'] . ' '; 
    314             $q = $C->query('SELECT COUNT(topicid) AS count FROM ' . $SETTINGS['dbtableprefix'] . 'topics'); 
     322            $q = $C->prepare('SELECT COUNT(topicid) AS count FROM ' . $SETTINGS['dbtableprefix'] . 'topics'); 
     323            $q->execute(); 
    315324            $row = $q->fetchObject(); 
    316             $q->closeCursor()
     325            $q = NULL
    317326            $_str .= $row->count . ' ' . $LANG['threads'] . '.</div>'; 
    318327            // put into table 
     
    332341            $q->execute(); 
    333342            $_admin = $q->fetchColumn(); 
    334             $q->closeCursor()
     343            $q = NULL
    335344        } 
    336345        // debugging output 
     
    356365        $q->execute(); 
    357366        if ($q->fetchColumn() >= 1) { 
    358             $q->closeCursor()
     367            $q = NULL
    359368            // get the oldest one 
    360369            $q = $C->prepare('SELECT * FROM ' . $SETTINGS['dbtableprefix'] . 'mails ORDER BY id ASC LIMIT 0,1'); 
    361370            $q->execute(); 
    362371            $row = $q->fetchObject(); 
    363             $q->closeCursor()
     372            $q = NULL
    364373            // send it 
    365374            @mail($row->receipient, $row->subject, $row->body, 'From: '.$SETTINGS['forumadminemail']); 
     
    368377            $q->bindParam(':id', $row->id, PDO::PARAM_INT, 12); 
    369378            $q->execute(); 
     379            $q = NULL; 
    370380        } else { 
    371             $q->closeCursor()
     381            $q = NULL
    372382        } 
    373383        // private message notification 
     
    378388            $q->execute(); 
    379389            $_flag = $q->fetchColumn(); 
    380             $q->closeCursor()
     390            $q = NULL
    381391            if ($_flag == 1) { 
    382392                // check if there are message which the user hasn't been notified of yet 
     
    385395                $q->bindValue(':three', 3, PDO::PARAM_INT); 
    386396                $q->execute(); 
    387                 if ($row = $q->fetchObject()) { 
    388                     $q->closeCursor(); 
     397                $rows = $q->fetchAll(); 
     398                $q = NULL; 
     399                if (is_array($rows) && count($rows) > 0) { 
     400                    $count = 0; 
    389401                    // set 'notified' flag so that user isn't nagged on every page load 
    390                     $q2 = $C->prepare('UPDATE '.$SETTINGS['dbtableprefix'].'messages SET messagereceipientflag=:two WHERE messageid=:id'); 
    391                     $q2->bindValue(':two', 2, PDO::PARAM_INT); 
    392                     $q2->bindParam(':id', $row->messageid, PDO::PARAM_INT, 12); 
    393                     $q2->execute(); 
    394                     $count = 1; 
    395                     // flag all other messages as well 
    396                     while ($row = $q->fetchObject()) { 
     402                    foreach ($rows as $row) { 
    397403                        $q2 = $C->prepare('UPDATE ' . $SETTINGS['dbtableprefix'] . 'messages SET messagereceipientflag=:two WHERE messageid=:id'); 
    398404                        $q2->bindValue(':two', 2, PDO::PARAM_INT); 
    399                         $q2->bindParam(':id', $row->messageid, PDO::PARAM_INT, 12); 
     405                        $q2->bindParam(':id', $row['messageid'], PDO::PARAM_INT, 12); 
    400406                        $q2->execute(); 
     407                        $q2 = NULL; 
    401408                        $count++; 
    402409                    } 
    403410                    // add notification script 
    404411                    $this->html->body->addChild('script', "if (confirm('" . str_replace("%count%", $count, $LANG['x_unread_messages']) . "')) { window.location.href = '" . $F->link("messenger") . "action=inbox' }"); 
    405                 } else { 
    406                     $q->closeCursor(); 
    407412                } 
    408413            } 
  • trunk/classes/pages/Register.php

    r17 r18  
    7979                            $ok = 0; 
    8080                        } 
    81                         $q->closeCursor()
     81                        $q = NULL
    8282                        // if this has been set to be prevented, check if e-mail address already belongs to an account 
    8383                        if ($SETTINGS['severalaccountspermail'] == 0) { 
     
    9090                                $ok = 0; 
    9191                            } 
    92                             $q->closeCursor()
     92                            $q = NULL
    9393                        } 
    9494                        // only proceed if all checks were successful 
     
    110110                            $q->bindParam(':member', $_member, PDO::PARAM_STR, 6); 
    111111                            $q->execute(); 
     112                            $q = NULL; 
    112113                            $q = $C->prepare('SELECT MAX(memberid) AS id FROM ' . $SETTINGS['dbtableprefix'] . 'members'); 
    113114                            $q->execute(); 
    114115                            $row = $q->fetchObject(); 
    115                             $q->closeCursor()
     116                            $q = NULL
    116117                            @$C->query('UNLOCK TABLE ' . $SETTINGS['dbtableprefix'] . 'members'); 
    117118                            // set actual password 
     
    122123                            $q->execute(); 
    123124                            $row2 = $q->fetchObject(); 
    124                             $q->closeCursor()
     125                            $q = NULL
    125126                            $q = $C->prepare('INSERT INTO ' . $SETTINGS['dbtableprefix'] . 'groupmemberships (member, usergroup) VALUES (:member, :group)'); 
    126127                            $q->bindParam(':member', $row->id, PDO::PARAM_INT, 12); 
    127128                            $q->bindParam(':group', $row2->id, PDO::PARAM_INT, 12); 
    128129                            $q->execute(); 
     130                            $q = NULL; 
    129131                            // send e-mail 
    130132                            @mail($email, $SETTINGS['forumname'] . ' - ' . $LANG['Registration'], str_replace('%password%', $p->get(), $LANG['welcome_mail']), 'From: ' . $SETTINGS['forumadminemail']); 
  • trunk/classes/pages/Reply.php

    r17 r18  
    4040            $q->execute(); 
    4141            $row = $q->fetchObject(); 
    42             $q->closeCursor()
     42            $q = NULL
    4343            $q2 = $C->prepare('SELECT forumtitle, forum_category FROM ' . $SETTINGS['dbtableprefix'] . 'forums WHERE forumid=:forum'); 
    4444            $q2->bindParam(':forum', $row->forum, PDO::PARAM_INT, 12); 
    4545            $q2->execute(); 
    4646            $row2 = $q2->fetchObject(); 
    47             $q2->closeCursor()
     47            $q2 = NULL
    4848            $this->title = ' - ' . Category::getName($row2->forum_category) . ' - ' . $row2->forumtitle . ' - ' . $row->topictitle . ' - ' . $LANG['Reply']; 
    4949            $this->location = ' - <a href="' . $F->link('category') . 'id=' . $row2->forum_category . '">' . Category::getName($row2->forum_category) . '</a> - <a href="' . $F->link('forum') . 'id=' . $row->forum . '">' . $row2->forumtitle . '</a> - <a href="' . $F->link('topic') . 'id=' . $id . '">' . $row->topictitle . '</a> - <a href="' . $F->link('reply') . 'id=' . $id . '">' . $LANG['Reply'] . '</a>'; 
     
    6868                    $q->execute(); 
    6969                    $row4 = $q->fetchObject(); 
    70                     $q->closeCursor()
     70                    $q = NULL
    7171                    $_quote_text = '[quote]' . $F->htmlentities($row4->post, TRUE) . '[/quote]'; 
    7272                } 
     
    8282                        $subscribed = TRUE; 
    8383                    } 
    84                     $q->closeCursor()
     84                    $q = NULL
    8585                } 
    8686                // form 
  • trunk/classes/pages/Search.php

    r17 r18  
    124124                            $q->execute(); 
    125125                            $_username = $q->fetchColumn(); 
    126                             $q->closeCursor()
     126                            $q = NULL
    127127                            $query = 'SELECT p.postid, p.topic, p.poster, p.posttime, p.post, t.topictitle FROM ' . $SETTINGS['dbtableprefix'] . 'posts p, ' . $SETTINGS['dbtableprefix'] . 'topics t WHERE t.topicid=p.topic AND p.poster=:username AND p.postedbymember=1 %cond% ORDER BY p.posttime DESC'; 
    128128                        break; 
     
    170170                        $q->execute(); 
    171171                        $_num_results = $q->fetchColumn(0); 
    172                         $q->closeCursor()
     172                        $q = NULL
    173173                        // build page navigation 
    174174                        $pages = new Pagination($SETTINGS['postsperpage'], $page, $_num_results); 
     
    201201                            $n++; 
    202202                        } 
     203                        $q2 = NULL; 
    203204                        if ($n === 0) { 
    204205                            // no results 
     
    243244                $s = $q->execute(); 
    244245                if ($s) { 
    245                     while ($row = $q->fetchObject()) { 
     246                    $rows = $q->fetchAll(); 
     247                    $q = NULL; 
     248                    foreach ($rows as $row) { 
    246249                        // offer only categories which the user may read 
    247                         if (Member::checkRights('Category', 'read', $row->category_id)) { 
     250                        if (Member::checkRights('Category', 'read', $row['category_id'])) { 
    248251                            // set number of forums in this category to zero 
    249252                            $n = 0; 
    250253                            // add this category's name 
    251                             $_cat = '<option value="category=' . $row->category_id . '">&gt; ' . $row->category_name . '</option>'; 
     254                            $_cat = '<option value="category=' . $row['category_id'] . '">&gt; ' . $row['category_name'] . '</option>'; 
    252255                            // list forums in this category 
    253256                            $q2 = $C->prepare('SELECT forumid, forumtitle FROM ' . $SETTINGS['dbtableprefix'] . 'forums WHERE forum_category=:category ORDER BY forum_order ASC'); 
    254                             $q2->bindParam(':category', $row->category_id, PDO::PARAM_INT, 12); 
     257                            $q2->bindParam(':category', $row['category_id'], PDO::PARAM_INT, 12); 
    255258                            $s = $q2->execute(); 
    256259                            if ($s) { 
    257                                 while ($row2 = $q2->fetchObject()) { 
     260                                $rows2 = $q2->fetchAll(); 
     261                                $q2 = NULL; 
     262                                foreach ($rows2 as $row2) { 
    258263                                    // offer only forums which the user may read 
    259                                     if (Member::checkRights('Forum', 'read', $row2->forumid)) { 
     264                                    if (Member::checkRights('Forum', 'read', $row2['forumid'])) { 
    260265                                        // increase number of forums 
    261266                                        $n++; 
    262267                                        // add this forum as an option 
    263                                         $_cat .= '<option value="forum=' . $row2->forumid . '">' . $row2->forumtitle . '</option>'; 
     268                                        $_cat .= '<option value="forum=' . $row2['forumid'] . '">' . $row2['forumtitle'] . '</option>'; 
    264269                                    } 
    265270                                } 
  • trunk/classes/pages/Topic.php

    r17 r18  
    3838            $q->execute(); 
    3939            $row = $q->fetchObject(); 
    40             $q->closeCursor()
     40            $q = NULL
    4141        } 
    4242        // define title and location 
     
    4646            $q2->execute(); 
    4747            $row2 = $q2->fetchObject(); 
    48             $q2->closeCursor()
     48            $q2 = NULL
    4949            $this->title = ' - ' . Category::getName($row2->forum_category) . ' - ' . $row2->forumtitle . ' - ' . $row->topictitle; 
    5050            $this->location = ' - <a href="' . $F->link('category') . 'id=' . $row2->forum_category . '">' . Category::getName($row2->forum_category) . '</a> - <a href="' . $F->link('forum') . 'id=' . $row->forum . '">' . $row2->forumtitle . '</a> - <a href="' . $F->link('topic') . 'id=' . $id . '">' . $row->topictitle . '</a>'; 
     
    6161            $q->execute(); 
    6262            $row = $q->fetchObject(); 
    63             $q->closeCursor()
     63            $q = NULL
    6464            // update views 
    6565            $_newviews = $row->topic_views + 1; 
     
    6868            $q3->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    6969            $q3->execute(); 
     70            $q3 = NULL; 
    7071            // new topic, new poll and reply buttons 
    7172            $postbuttons = new Postbuttons(TRUE, $row->forum, TRUE, $row->topicid, $row->closed); 
     
    7677            $q2->execute(); 
    7778            $row2 = $q2->fetchObject(); 
    78             $q2->closeCursor()
     79            $q2 = NULL
    7980            // calculate start for this page 
    8081            if (!isset($page) || $page == '') { $page = 1; } 
     
    9798                $q2->execute(); 
    9899                $row2 = $q2->fetchObject(); 
    99                 $q2->closeCursor()
     100                $q2 = NULL
    100101                // check if logged in member already voted 
    101102                $pollvoters = split("\n", $row2->pollvoters); 
     
    169170            $q2->bindParam(':topic', $id, PDO::PARAM_INT, 12); 
    170171            $q2->execute(); 
     172            $rows2 = $q2->fetchAll(); 
     173            $q2 = NULL; 
    171174            // list posts in a table 
    172175            $table = new Table(); 
    173             while ($row2 = $q2->fetchObject()) { 
    174                 $p = new Post($row2->postid); 
     176            foreach ($rows2 as $row2) { 
     177                $p = new Post($row2['postid']); 
    175178                $p->add($table); 
    176179            } 
     
    236239        if ($q->execute()) { 
    237240            $_title = $q->fetchColumn(); 
    238             $q->closeCursor()
     241            $q = NULL
    239242            return $_title; 
    240243        } else { 
  • trunk/classes/pages/Userpanel.php

    r17 r18  
    5757                            $s = $q->execute(); 
    5858                            if ($s && $row = $q->fetchObject()) { 
    59                                 $q->closeCursor()
     59                                $q = NULL
    6060                                // if member has been found 
    6161                                // check if old password is correct 
     
    7272                                            $q2->execute(); 
    7373                                            $row2 = $q2->fetchObject(); 
    74                                             $q2->closeCursor()
     74                                            $q2 = NULL
    7575                                            // encrypt user name and password 
    7676                                            $e = new Encryption(); 
     
    9696                            } else { 
    9797                                // member not found by id 
    98                                 $q->closeCursor()
     98                                $q = NULL
    9999                                $div = $this->html->body->addChild('div', $LANG['error_id']); 
    100100                                $div->addAttribute('class', 'message'); 
     
    117117                            if ($s && $row = $q->fetchObject()) { 
    118118                                // if member has been found 
    119                                 $q->closeCursor()
     119                                $q = NULL
    120120                                // check if old password is correct 
    121121                                if (Member::authenticate($row->membername, $password)) { 
     
    125125                                    $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    126126                                    $q->execute(); 
     127                                    $q = NULL; 
    127128                                    $div = $this->html->body->addChild('div', $LANG['email_changed']); 
    128129                                    $div->addAttribute('class', 'message'); 
     
    134135                            } else { 
    135136                                // member not found by id 
    136                                 $q->closeCursor()
     137                                $q = NULL
    137138                                $div = $this->html->body->addChild('div', $LANG['error_id']); 
    138139                                $div->addAttribute('class', 'message'); 
     
    187188                            $s = $q->execute(); 
    188189                            if ($s && $row = $q->fetchObject()) { 
    189                                 $q->closeCursor()
     190                                $q = NULL
    190191                                if ($user != $row->membername) { 
    191192                                    // update membername 
     
    194195                                    $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    195196                                    $q->execute(); 
     197                                    $q = NULL; 
    196198                                    // update name in the posts table, too, if necessary 
    197199                                    $q = $C->prepare('UPDATE ' . $SETTINGS['dbtableprefix'] . 'posts SET poster=:user WHERE poster=:member AND postedbymember=:one'); 
     
    200202                                    $q->bindValue(':one', 1, PDO::PARAM_INT); 
    201203                                    $q->execute(); 
     204                                    $q = NULL; 
    202205                                } 
    203206                                // if the crucial rest has been entered, update it one by one 
     
    207210                                    $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    208211                                    $q->execute(); 
     212                                    $q = NULL; 
    209213                                } 
    210214                                // update rest in bulk 
     
    225229                                $q->bindParam(':id', $id, PDO::PARAM_INT, 12); 
    226230                                $q->execute(); 
     231                                $q = NULL; 
    227232                                // put new board style and language into session 
    228233                                $_SESSION['boardstyle'] = trim($boardstyle); 
     
    231236                                $output = $LANG['profile_updated']; 
    232237                            } else { 
    233                                 $q->closeCursor()
     238                                $q = NULL
    234239                                $output = $LANG['error_id']; 
    235240                            } 
     
    246251                            $q->bindParam(':member', $id, PDO::PARAM_INT, 12); 
    247252                            $q->execute(); 
     253                            $q = NULL; 
    248254                            // insert new subscription if needed 
    249255                            if ($newsubscribed[0] > 0) { 
     
    252258                                $q->bindParam(':member', $id, PDO::PARAM_INT, 12); 
    253259                                $q->execute(); 
     260                                $q = NULL; 
    254261                            } 
    255262                            // re-insert the subscriptions the user wanted to retain 
     
    261268                                    $q->bindParam(':member', $id, PDO::PARAM_INT, 12); 
    262269                                    $q->execute(); 
     270                                    $q = NULL; 
    263271                                } 
    264272                            } 
     
    275283                            $q->bindValue(':one', 1, PDO::PARAM_INT); 
    276284                            $q->execute(); 
    277                             while ($row = $q->fetchObject()) { 
     285                            $rows = $q->fetchAll(); 
     286                            $q = NULL; 
     287                            foreach ($rows as $row) { 
    278288                                $q2 = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'groupmemberships WHERE member = :member AND usergroup = :group'); 
    279289                                $q2->bindParam(':member', $id, PDO::PARAM_INT, 12); 
    280                                 $q2->bindParam(':group', $row->id, PDO::PARAM_INT, 12); 
     290                                $q2->bindParam(':group', $row['id'], PDO::PARAM_INT, 12); 
    281291                                $q2->execute(); 
     292                                $q2 = NULL; 
    282293                            } 
    283294                            // insert memberships of the groups the user wants 
     
    289300                                    $q->bindParam(':id', $key, PDO::PARAM_INT, 12); 
    290301                                    if ($q->execute() && $q->fetchColumn() == 1) { 
    291                                         $q->closeCursor()
     302                                        $q = NULL
    292303                                        // it is a public group, so go ahead and insert 
    293304                                        $q2 = $C->prepare('INSERT INTO ' . $SETTINGS['dbtableprefix'] . 'groupmemberships (member, usergroup) VALUES (:member, :group)'); 
     
    295306                                        $q2->bindParam(':group', $key, PDO::PARAM_INT, 12); 
    296307                                        $q2->execute(); 
     308                                        $q2 = NULL; 
    297309                                    } else { 
    298                                         $q->closeCursor()
     310                                        $q = NULL
    299311                                    } 
    300312                                } 
     
    533545                        $q->bindParam(':id', $_SESSION['memberid'], PDO::PARAM_INT, 12); 
    534546                        $q->execute(); 
    535                         while ($row = $q->fetchObject()) { 
     547                        $rows = $q->fetchAll(); 
     548                        $q = NULL; 
     549                        foreach ($rows as $row) { 
    536550                            // get topic title (and the respective forum) 
    537551                            $q2 = $C->prepare('SELECT t.topictitle AS topictitle, f.forumtitle AS forumtitle FROM ' . $SETTINGS['dbtableprefix'] . 'topics AS t, ' . $SETTINGS['dbtableprefix'] . 'forums AS f WHERE t.topicid = :id AND f.forumid = t.forum'); 
    538                             $q2->bindParam(':id', $row->topic, PDO::PARAM_INT, 12); 
     552                            $q2->bindParam(':id', $row['topic'], PDO::PARAM_INT, 12); 
    539553                            $q2->execute(); 
    540554                            $row2 = $q2->fetchObject(); 
    541                             $q2->closeCursor()
    542                             $form->addRawTableRow(Array($row2->topictitle . ' (' . $row2->forumtitle . ')', '<td><input type="checkbox" name="newsubscribed[' . $row->topic . ']" value="1" checked="checked" /></td>')); 
     555                            $q2 = NULL
     556                            $form->addRawTableRow(Array($row2->topictitle . ' (' . $row2->forumtitle . ')', '<td><input type="checkbox" name="newsubscribed[' . $row['topic'] . ']" value="1" checked="checked" /></td>')); 
    543557                        } 
    544558                        // one select box for a new subscription showing only the 50 last active topics 
     
    554568                                $_col2 .= '<option value="' . $row['topicid'] . '">' . $row['topictitle'] . ' (' . $row['forumtitle'] . ')</option>'; 
    555569                            } 
    556                             $q2->closeCursor()
     570                            $q2 = NULL
    557571                        } 
    558572                        $_col2 .= '</select></td>'; 
     
    585599                                    $_col2 .= ' checked="checked"'; 
    586600                                } 
    587                                 $q3->closeCursor()
     601                                $q3 = NULL
    588602                                $_col2 .= ' /></td>'; 
    589603                                $form->addRawTableRow(Array('<td>' . $row['name'] . '</td>', $_col2)); 
  • trunk/db/spamboard.sql

    r14 r18  
    6565  pinned INTEGER NOT NULL DEFAULT 0, 
    6666  poll INTEGER NOT NULL DEFAULT 0, 
    67   topic_views INTEGER NOT NULL
     67  topic_views INTEGER NOT NULL DEFAULT 0
    6868  PRIMARY KEY  (topicid) 
    6969); 
  • trunk/includes/config/version.php

    r1 r18  
    2828 * Also good: Spam Board Viking Edition 1.0 (then, you can do your own version numbering from there) */ 
    2929 
    30 $VERSION = 'SVN ' . gmdate('Y-m-d', time())
     30$VERSION = 'SVN'
    3131 
    3232?> 
  • trunk/includes/login.php

    r17 r18  
    2828$q->execute(); 
    2929$row = $q->fetchObject(); 
    30 $q->closeCursor()
     30$q = NULL
    3131// delete old session entry in the online table 
    3232$q = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'online WHERE onlinesession=:session'); 
    3333$q->bindParam(':session', session_id(), PDO::PARAM_STR, 40); 
    3434$q->execute(); 
     35$q = NULL; 
    3536// regenerate ID in order to ensure privileged session hasn't been fixed in advance 
    3637session_regenerate_id(); 
     
    4849$q->bindParam(':session', session_id(), PDO::PARAM_STR, 40); 
    4950$q->execute(); 
     51$q = NULL; 
    5052// set cookie if user wants to stay logged in 
    5153if ($remember == 'y') { 
  • trunk/includes/session.php

    r17 r18  
    7171            $q->bindParam(':session', session_id(), PDO::PARAM_STR, 40); 
    7272            $q->execute(); 
     73            $q = NULL; 
    7374            // delete session (native value is NULL, not Array()) 
    7475            $_SESSION = NULL; 
     
    9293        $q->bindParam(':session', session_id(), PDO::PARAM_STR, 40); 
    9394        $q->execute(); 
     95        $q = NULL; 
    9496        // delete session (native value is NULL) 
    9597        $_SESSION = NULL; 
     
    121123$s = $q->execute(); 
    122124if ($s && $q->fetchColumn() >= 1) { 
    123     $q->closeCursor()
     125    $q = NULL
    124126    // update existing entry with new timestamp 
    125127    $q = $C->prepare('UPDATE ' . $SETTINGS['dbtableprefix'] . 'online SET onlinetime=:time WHERE onlinesession=:session'); 
     
    127129    $q->bindParam(':session', session_id(), PDO::PARAM_STR, 40); 
    128130    $q->execute(); 
     131    $q = NULL; 
    129132} else { 
    130     $q->closeCursor()
     133    $q = NULL
    131134    // check if returning user who has saved credentials in cookie 
    132135    if ($_COOKIE['sb_user'] != '') { 
     
    146149        if ($s && $row2 = $q2->fetchObject()) { 
    147150            // automatic login successful 
    148             $q2->closeCursor()
     151            $q2 = NULL
    149152            // regenerate ID in order to ensure privileged session hasn't been fixed in advance 
    150153            session_regenerate_id(); 
     
    160163        } else { 
    161164            // something wrong with contents of cookie - delete 
     165            $q2 = NULL; 
    162166            setcookie('sb_user', '', -1); 
    163167        } 
     
    171175        $q->bindParam(':session', session_id(), PDO::PARAM_STR, 40); 
    172176        $q->execute(); 
     177        $q = NULL; 
    173178    } 
    174179    // get last visit from database if member 
     
    179184        if ($s && $row = $q->fetchObject()) { 
    180185            // write back to session 
     186            $q = NULL; 
    181187            $_SESSION['lastvisit'] = $row->lastvisit; 
    182188        } else { 
    183189            // ID from a non-existent member? Something is very wrong... 
     190            $q = NULL; 
    184191            exit; 
    185192        } 
     
    192199$q = $C->prepare('SELECT onlinememberid, onlinesession, onlinetime FROM ' . $SETTINGS['dbtableprefix'] . 'online'); 
    193200$q->execute(); 
    194 while ($row = $q->fetchObject()) { 
    195     if ($row->onlinetime + 900 < time()) { 
     201$rows = $q->fetchAll(); 
     202$q = NULL; 
     203foreach ($rows as $row) { 
     204    if ($row['onlinetime'] + 900 < time()) { 
    196205        // delete entries older than 15 minutes 
    197206        $q = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'online WHERE onlinesession=:session AND onlinetime=:time'); 
    198         $q->bindParam(':session', $row->onlinesession, PDO::PARAM_STR, 40); 
    199         $q->bindParam(':time', $row->onlinetime, PDO::PARAM_STR, 12); 
     207        $q->bindParam(':session', $row['onlinesession'], PDO::PARAM_STR, 40); 
     208        $q->bindParam(':time', $row['onlinetime'], PDO::PARAM_STR, 12); 
    200209        $q->execute(); 
     210        $q = NULL; 
    201211    } 
    202212    // check for duplicate entries of members 
    203213    if ($row->onlinememberid > 0) { 
    204214        $q2 = $C->prepare('SELECT onlinetime FROM ' . $SETTINGS['dbtableprefix'] . 'online WHERE onlinememberid=:memberid ORDER BY onlinetime DESC'); 
    205         $q2->bindParam(':memberid', $row->onlinememberid, PDO::PARAM_INT, 12); 
     215        $q2->bindParam(':memberid', $row['onlinememberid'], PDO::PARAM_INT, 12); 
    206216        $s = $q2->execute(); 
    207217        if ($s && $row2 = $q2->fetchObject()) { 
    208             $q2->closeCursor()
     218            $q2 = NULL
    209219            // delete all but the newest one 
    210220            $q = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'online WHERE onlinememberid=:memberid AND onlinetime<:time'); 
    211             $q->bindParam(':memberid', $row->onlinememberid,PDO::PARAM_INT, 12); 
    212             $q->bindParam(':time', $row2->onlinetime, PDO::PARAM_INT, 12); 
     221            $q->bindParam(':memberid', $row['onlinememberid'], PDO::PARAM_INT, 12); 
     222            $q->bindParam(':time', $row2['onlinetime'], PDO::PARAM_INT, 12); 
    213223            $q->execute(); 
     224            $q = NULL; 
    214225        } else { 
    215             $q2->closeCursor()
     226            $q2 = NULL
    216227        } 
    217228    } 
     
    226237    $q->bindParam(':id', $_SESSION['memberid'], PDO::PARAM_INT, 12); 
    227238    $q->execute(); 
     239    $q = NULL; 
    228240} 
    229241 
  • trunk/redirectors/logout.php

    r3 r18  
    6767    $q->bindParam(':session', session_id(), PDO::PARAM_STR, 40); 
    6868    $q->execute(); 
     69    $q = NULL; 
    6970    // close database connection 
    7071    $C = NULL; 
  • trunk/redirectors/pollvote.php

    r17 r18  
    6363            $s = $q->execute(); 
    6464            $row_q = $q->fetchAll(); 
    65             $q->closeCursor()
     65            $q = NULL;
    6666            $q2 = $C->prepare('SELECT * FROM ' . $SETTINGS['dbtableprefix'] . 'polls WHERE pollid=:id'); 
    6767            $q2->bindParam(':id', $id, PDO::PARAM_INT, 12); 
     
    7070                $row_title = $row_q[0]['topictitle']; 
    7171                $row = $q2->fetchObject(); 
    72                 $q2->closeCursor()
     72                $q2 = NULL;
    7373                // heading 
    7474                $html->body->addChild('h2', $row_title); 
     
    124124            if ($q->execute()) { 
    125125                $row = $q->fetchObject(); 
    126                 $q->closeCursor()
     126                $q = NULL
    127127                // check if logged in member already voted 
    128128                $pollvoters = split("\n", $row->pollvoters); 
     
    146146                    $q->bindParam(':id', $poll, PDO::PARAM_INT, 12); 
    147147                    $q->execute(); 
     148                    $q = NULL; 
    148149                    // close database connection 
    149150                    $C = NULL; 
  • trunk/redirectors/preview.php

    r17 r18  
    7272            $row->postedbymember = 0; 
    7373        } 
    74         $q->closeCursor()
     74        $q = NULL
    7575    } else { 
    7676        // logged in 
  • trunk/redirectors/showip.php

    r17 r18  
    6060    $q->execute(); 
    6161    $_ip = $q->fetchColumn(); 
    62     $q->closeCursor()
     62    $q = NULL
    6363    // output 
    6464    $html->body->addChild('h2', $LANG['IP']);