Changeset 407

Show
Ignore:
Timestamp:
2011-01-01 15:54:56 (1 year ago)
Author:
hannes
Message:

fixes for PHP strict mode

Files:

Legend:

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

    r405 r407  
    282282                        } 
    283283                        $_col2 .= '</select><select name="birthday1"><option value="00"'; 
    284                         if ($birthday[1] == '00') { $_col2 .= ' selected="selected"'; } 
     284                        if (!isset($birthday[1]) || $birthday[1] == '00') { $_col2 .= ' selected="selected"'; } 
    285285                        $_col2 .= '>' . $LANG['n/a'] . '</option>'; 
    286286                        $i = 1; 
     
    290290                            else { $j = $i; } 
    291291                            $_col2 .= '<option value="' . $j . '"'; 
    292                             if ($birthday[1] == $j) { $_col2 .=' selected="selected"'; } 
     292                            if (isset($birthday[1]) && $birthday[1] == $j) { $_col2 .=' selected="selected"'; } 
    293293                            $_col2 .= '>' . $j . '</option>'; 
    294294                            $i++; 
    295295                        } 
    296296                        $_col2 .= '</select><select name="birthday2"><option value="00"'; 
    297                         if ($birthday[2] == '00') { 
     297                        if (!isset($birthday[2]) || $birthday[2] == '00') { 
    298298                            $_col2 .= ' selected="selected"'; 
    299299                        } 
     
    305305                            else { $j = $i; } 
    306306                            $_col2 .= '<option value="' . $j . '"'; 
    307                             if ($birthday[2] == $j) { $_col2 .=' selected="selected"'; } 
     307                            if (isset($birthday[2]) && $birthday[2] == $j) { $_col2 .=' selected="selected"'; } 
    308308                            $_col2 .= '>' . $j . '</option>'; 
    309309                            $i++; 
  • trunk/admin/classes/pages/Permissions.php

    r316 r407  
    233233                            } 
    234234                            $q2 = NULL; 
     235                            if (!is_object($_row)) { 
     236                                $_row = new stdClass(); 
     237                            } 
    235238                            if (!isset($_row->r)) { 
    236239                                // nothing set yet, so 'default deny' 
  • trunk/admin/index.php

    r307 r407  
    66 * Description: wrapper file calling all administrative functions 
    77 * 
    8  * Copyright (C) 2007, 2008, 2009 Hannes Schueller 
     8 * Copyright (C) 2007, 2008, 2009, 2011 Hannes Schueller 
    99 * 
    1010 * This program is free software: you can redistribute it and/or modify 
     
    2525// disable output of error messages and warnings 
    2626ini_set('display_errors', 'Off'); 
     27error_reporting(E_ALL | E_STRICT); 
     28 
     29// explicitely set default timezone 
     30date_default_timezone_set('UTC'); 
    2731 
    2832// if install script is present, redirect there 
  • trunk/classes/misc/Format.php

    r387 r407  
    66 * Description: various output formatting functions 
    77 * 
    8  * Copyright (C) 2007, 2008, 2009 Hannes Schueller 
     8 * Copyright (C) 2007, 2008, 2009, 2011 Hannes Schueller 
    99 * 
    1010 * This program is free software: you can redistribute it and/or modify 
     
    176176                        $_cont = substr($str, ($_pos_open + $_len_open), ($_pos_close - $_pos_open - $_len_open)); 
    177177                        // handle a few special cases 
     178                        $_attr_close = ''; 
    178179                        switch ($tags_open[$i]) { 
    179180                        // permutation handling isn't necessary, because we compare with the 'official' tag definition 
  • trunk/classes/misc/Member.php

    r399 r407  
    66 * Description: Member object 
    77 * 
    8  * Copyright (C) 2007, 2009 Hannes Schueller 
     8 * Copyright (C) 2007, 2009, 2011 Hannes Schueller 
    99 * 
    1010 * This program is free software: you can redistribute it and/or modify 
     
    510510     *              matched with database 
    511511     **/ 
    512     public function authenticate($user, $password) { 
     512    public static function authenticate($user, $password) { 
    513513        // language, formatting, settings 
    514514        global $LANG, $F, $C, $SETTINGS; 
     
    638638     * Returns:     TRUE (access granted) or FALSE (access denied) 
    639639     **/ 
    640     public function checkRights($page, $action, $id = FALSE) { 
     640    public static function checkRights($page, $action, $id = FALSE) { 
    641641        global $C, $SETTINGS; 
    642642        if ($SETTINGS['maintainancemode'] == 1) { 
     
    957957     * Returns:     - 
    958958     **/ 
    959     public function login($username, $remember = 'n', $admin = 0) { 
     959    public static function login($username, $remember = 'n', $admin = 0) { 
    960960        global $SETTINGS, $C; 
    961961        // get personal settings 
     
    967967        // delete old session entry in the online table 
    968968        $q = $C->prepare('DELETE FROM ' . $SETTINGS['dbtableprefix'] . 'online WHERE onlinesession = :session'); 
    969         $q->bindParam(':session', session_id(), PDO::PARAM_STR, 40); 
     969        $q->bindValue(':session', session_id(), PDO::PARAM_STR); 
    970970        $q->execute(); 
    971971        $q = NULL; 
     
    10011001        $q = $C->prepare('UPDATE ' . $SETTINGS['dbtableprefix'] . 'online SET onlinememberid = :id WHERE onlinesession = :session'); 
    10021002        $q->bindParam(':id', $row->memberid, PDO::PARAM_INT, 12); 
    1003         $q->bindParam(':session', session_id(), PDO::PARAM_STR, 40); 
     1003        $q->bindValue(':session', session_id(), PDO::PARAM_STR); 
    10041004        $q->execute(); 
    10051005        $q = NULL; 
     
    10391039     * Returns:     - 
    10401040     **/ 
    1041     public function session($listonline = 1, $updatelastvisit = TRUE) { 
     1041    public static function session($listonline = 1, $updatelastvisit = TRUE) { 
    10421042        global $SETTINGS, $C, $BOTS; 
    10431043 
     
    12171217                // enter user into online table 
    12181218                $q = $C->prepare('SELECT COUNT(*) FROM ' . $SETTINGS['dbtableprefix'] . 'online WHERE onlinesession = :session'); 
    1219                 $q->bindParam(':session', session_id(), PDO::PARAM_STR, 40); 
     1219                $q->bindValue(':session', session_id(), PDO::PARAM_STR); 
    12201220                $s = $q->execute(); 
    12211221                if ($s && $q->fetchColumn() >= 1) { 
     
    12231223                    // update existing entry with new timestamp 
    12241224                    $q = $C->prepare('UPDATE ' . $SETTINGS['dbtableprefix'] . 'online SET onlinetime = :time WHERE onlinesession = :session'); 
    1225                     $q->bindParam(':time', time(), PDO::PARAM_INT, 12); 
    1226                     $q->bindParam(':session', session_id(), PDO::PARAM_STR, 40); 
     1225                    $q->bindValue(':time', time(), PDO::PARAM_INT); 
     1226                    $q->bindValue(':session', session_id(), PDO::PARAM_STR); 
    12271227                    $q->execute(); 
    12281228                    $q = NULL; 
     
    12381238                            $q->bindValue(':memberid', 0, PDO::PARAM_INT); 
    12391239                        } 
    1240                         $q->bindParam(':time', time(), PDO::PARAM_INT, 12); 
    1241                         $q->bindParam(':session', session_id(), PDO::PARAM_STR, 40); 
     1240                        $q->bindValue(':time', time(), PDO::PARAM_INT); 
     1241                        $q->bindValue(':session', session_id(), PDO::PARAM_STR); 
    12421242                        $q->execute(); 
    12431243                        $q = NULL; 
     
    12931293                    // put into database in ISO format 
    12941294                    $q = $C->prepare('UPDATE ' . $SETTINGS['dbtableprefix'] . 'members SET lastvisit = :t WHERE memberid = :id'); 
    1295                     $q->bindParam(':t', $_ts->format('Y-m-d H:i:s'), PDO::PARAM_STR, 19); 
     1295                    $q->bindValue(':t', $_ts->format('Y-m-d H:i:s'), PDO::PARAM_STR); 
    12961296                    $q->bindParam(':id', $_SESSION['memberid'], PDO::PARAM_INT, 12); 
    12971297                    $q->execute(); 
  • trunk/classes/pages/Category.php

    r213 r407  
    77 *              (default) or just a specific one 
    88 * 
    9  * Copyright (C) 2007 Hannes Schueller 
     9 * Copyright (C) 2007, 2011 Hannes Schueller 
    1010 * 
    1111 * This program is free software: you can redistribute it and/or modify 
     
    179179     * Returns:     name of the category or an empty string 
    180180     **/ 
    181     public function getName($id = FALSE) { 
     181    public static function getName($id = FALSE) { 
    182182        global $C, $SETTINGS; 
    183183        if ($id) { 
  • trunk/classes/pages/Page.php

    r372 r407  
    77 *              shared by all pages 
    88 * 
    9  * Copyright (C) 2007, 2008, 2009 Hannes Schueller 
     9 * Copyright (C) 2007, 2008, 2009, 2011 Hannes Schueller 
    1010 * 
    1111 * This program is free software: you can redistribute it and/or modify 
     
    111111            $_now = new DateTime('now', new DateTimeZone('UTC')); 
    112112            $q->bindValue(':ts', $_now->format('Y-m-d H:i:s'), PDO::PARAM_STR); 
    113             $q->bindParam(':input', preg_replace('/(password[2]?\] =>) .*\n/',  "$1 ***\n", print_r($INPUT, TRUE), PDO::PARAM_STR)); 
     113            $q->bindParam(':input', preg_replace('/(password[2]?\] =>) .*\n/',  "$1 ***\n", print_r($INPUT, TRUE)), PDO::PARAM_STR); 
    114114            $q->execute(); 
    115115            // admin's top bar 
     
    395395            // get members with this month-day combination 
    396396            $q = $C->prepare('SELECT memberid, membername, SUBSTR(birthday,1,4) AS year FROM ' . $SETTINGS['dbtableprefix'] . 'members WHERE SUBSTR(birthday,6,5) = :today'); 
    397             $q->bindParam(':today', $_today->format('m-d'), PDO::PARAM_STR, 5); 
     397            $q->bindValue(':today', $_today->format('m-d'), PDO::PARAM_STR); 
    398398            $s = $q->execute(); 
    399399            if ($s) { 
     
    473473        } 
    474474        // debugging output 
    475         if ($SETTINGS['debug'] == 1 || ($SETTINGS['debug'] == 2 && $_admin == 1)) { 
     475        if ($SETTINGS['debug'] == 1 || ($SETTINGS['debug'] == 2 && isset($_admin) && $_admin == 1)) { 
    476476            $_now_utc = new DateTime('now', new DateTimeZone('UTC')); 
    477477            $_now_board = new DateTime('now', new DateTimeZone('UTC')); 
     
    627627     * Returns:     TRUE / FALSE 
    628628     **/ 
    629     public function checkLogins() { 
     629    public static function checkLogins() { 
    630630        global $SETTINGS, $C; 
    631631        if ($SETTINGS['loginattempts'] > 0) { 
  • trunk/classes/pages/Search.php

    r254 r407  
    66 * Description: Search page 
    77 * 
    8  * Copyright (C) 2007, 2008, 2009 Hannes Schueller 
     8 * Copyright (C) 2007, 2008, 2009, 2011 Hannes Schueller 
    99 * 
    1010 * This program is free software: you can redistribute it and/or modify 
     
    5252                    $INPUT['all'] = trim($INPUT['all']); 
    5353                    // evaluate search scope 
     54                    if (!isset($INPUT['search_scope'])) { 
     55                        $INPUT['search_scope'] = 'all'; 
     56                    } 
    5457                    $scope = explode('=', $INPUT['search_scope']); 
    5558                    switch ($scope[0]) { 
     
    197200                        } 
    198201                        // evaluate if there has been at least one search term long enough to be considered 
    199                         if ($_n === 0) { 
     202                        if (isset($_n) && $_n === 0) { 
    200203                            $_error = $LANG['error_keywords_too_short']; 
    201204                        } 
  • trunk/index.php

    r307 r407  
    66 * Description: wrapper file calling all the others directly or indirectly 
    77 * 
    8  * Copyright (C) 2007, 2008, 2009 Hannes Schueller 
     8 * Copyright (C) 2007, 2008, 2009, 2011 Hannes Schueller 
    99 * 
    1010 * This program is free software: you can redistribute it and/or modify 
     
    2525// disable output of error messages and warnings 
    2626ini_set('display_errors', 'Off'); 
     27error_reporting(E_ALL | E_STRICT); 
     28 
     29// explicitely set default timezone 
     30date_default_timezone_set('UTC'); 
    2731 
    2832// if install script is present, redirect there