Changeset 53


Ignore:
Timestamp:
Jan 26, 2006 8:19:32 PM (18 years ago)
Author:
scdev
Message:

${1}

Location:
trunk
Files:
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/App.inc.php

    r52 r53  
    162162    function setParam($param=null)
    163163    {
    164         if (!isset($this) || !is_a($this, 'App')) {
     164        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    165165            $this =& App::getInstance();
    166166        }
     
    181181    function &getParam($param=null)
    182182    {
    183         if (!isset($this) || !is_a($this, 'App')) {
     183        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    184184            $this =& App::getInstance();
    185185        }
     
    356356    function raiseMsg($message, $type=MSG_NOTICE, $file=null, $line=null)
    357357    {
    358         if (!isset($this) || !is_a($this, 'App')) {
     358        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    359359            $this =& App::getInstance();
    360360        }
     
    391391    function getRaisedMessages()
    392392    {
    393         if (!isset($this) || !is_a($this, 'App')) {
     393        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    394394            $this =& App::getInstance();
    395395        }
     
    415415    function clearRaisedMessages()
    416416    {
    417         if (!isset($this) || !is_a($this, 'App')) {
     417        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    418418            $this =& App::getInstance();
    419419        }
     
    435435    function printRaisedMessages()
    436436    {
    437         if (!isset($this) || !is_a($this, 'App')) {
     437        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    438438            $this =& App::getInstance();
    439439        }
     
    493493        static $previous_events = array();
    494494
    495         if (!isset($this) || !is_a($this, 'App')) {
     495        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    496496            $this =& App::getInstance();
    497497        }
     
    537537            'type'      => $this->logPriorityToString($priority),
    538538            'file:line' => "$file : $line",
     539            'url'       => (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : ''),
    539540            'message'   => $message
    540541        );
     
    611612    function carryQuery($query_key)
    612613    {
    613         if (!isset($this) || !is_a($this, 'App')) {
     614        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    614615            $this =& App::getInstance();
    615616        }
     
    643644    function url($url, $carry_args=null, $always_include_sid=false)
    644645    {
    645         if (!isset($this) || !is_a($this, 'App')) {
     646        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    646647            $this =& App::getInstance();
    647648        }
     
    738739    function oHREF($url, $carry_args=null, $always_include_sid=false)
    739740    {
    740         if (!isset($this) || !is_a($this, 'App')) {
     741        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    741742            $this =& App::getInstance();
    742743        }
     
    762763    function printHiddenSession($carry_args=null)
    763764    {
    764         if (!isset($this) || !is_a($this, 'App')) {
     765        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    765766            $this =& App::getInstance();
    766767        }
     
    824825    function dieURL($url, $carry_args=null, $always_include_sid=false)
    825826    {
    826         if (!isset($this) || !is_a($this, 'App')) {
     827        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    827828            $this =& App::getInstance();
    828829        }
     
    863864    function dieBoomerangURL($id=null, $carry_args=null)
    864865    {
    865         if (!isset($this) || !is_a($this, 'App')) {
     866        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    866867            $this =& App::getInstance();
    867868        }
     
    908909    function setBoomerangURL($url=null, $id=null)
    909910    {
    910         if (!isset($this) || !is_a($this, 'App')) {
     911        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    911912            $this =& App::getInstance();
    912913        }
     
    949950    function getBoomerangURL($id=null)
    950951    {
    951         if (!isset($this) || !is_a($this, 'App')) {
     952        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    952953            $this =& App::getInstance();
    953954        }
     
    977978    function deleteBoomerangURL($id=null)
    978979    {
    979         if (!isset($this) || !is_a($this, 'App')) {
     980        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    980981            $this =& App::getInstance();
    981982        }
     
    10021003    function validBoomerangURL($id=null, $use_nonspecificboomerang=false)
    10031004    {
    1004         if (!isset($this) || !is_a($this, 'App')) {
     1005        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    10051006            $this =& App::getInstance();
    10061007        }
     
    10301031
    10311032        if ('' == $url) {
    1032             $this->logMsg(sprintf('validBoomerangURL(%s) not valid, empty!', $id), LOG_NOTICE, __FILE__, __LINE__);
     1033            $this->logMsg(sprintf('validBoomerangURL(%s) not valid, empty!', $id), LOG_DEBUG, __FILE__, __LINE__);
    10331034            return false;
    10341035        }
    10351036        if ($url == absoluteMe()) {
    10361037            // The URL we are directing to is the current page.
    1037             $this->logMsg(sprintf('validBoomerangURL(%s) not valid, same as absoluteMe: %s', $id, $url), LOG_NOTICE, __FILE__, __LINE__);
     1038            $this->logMsg(sprintf('validBoomerangURL(%s) not valid, same as absoluteMe: %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__);
    10381039            return false;
    10391040        }
    10401041        if ($boomerang_time >= (time() - 2)) {
    10411042            // Last boomerang direction was more than 2 seconds ago.
    1042             $this->logMsg(sprintf('validBoomerangURL(%s) not valid, boomerang_time too short: %s', $id, time() - $boomerang_time), LOG_NOTICE, __FILE__, __LINE__);
     1043            $this->logMsg(sprintf('validBoomerangURL(%s) not valid, boomerang_time too short: %s', $id, time() - $boomerang_time), LOG_DEBUG, __FILE__, __LINE__);
    10431044            return false;
    10441045        }
     
    10541055    function sslOn()
    10551056    {
    1056         if (!isset($this) || !is_a($this, 'App')) {
     1057        if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
    10571058            $this =& App::getInstance();
    10581059        }
     
    10651066        }
    10661067
    1067         if ('on' != getenv('HTTPS') && $this->getParam('ssl_enabled') && in_array('mod_ssl', $modules)) {
     1068        if ('' == getenv('HTTPS') && $this->getParam('ssl_enabled') && in_array('mod_ssl', $modules)) {
    10681069            $this->raiseMsg(sprintf(_("Secure SSL connection made to %s"), $this->getParam('ssl_domain')), MSG_NOTICE, __FILE__, __LINE__);
    10691070            // Always append session because some browsers do not send cookie when crossing to SSL URL.
     
    10791080    function sslOff()
    10801081    {
    1081         if ('on' == getenv('HTTPS')) {
     1082        if ('' != getenv('HTTPS')) {
    10821083            $this->dieURL('http://' . getenv('HTTP_HOST') . getenv('REQUEST_URI'), null, true);
    10831084        }
  • trunk/lib/Captcha.inc.php

    r52 r53  
    88 * @author  Quinn Comendant <quinn@strangecode.com>
    99 * @version 1.0
     10-------------------------------------------------------------------------------------
     11// Example.
     12
     13// Instantiate new Captcha. This automatically generates a new 4-digit captcha number.
     14$captcha = new Captcha();
     15
     16<!-- HTML form for captcha -->
     17<label for="sc-captcha"><?php echo _("Reverse Turing Test") ?></label>
     18<p class="help"><?php echo _("Please type the following number to prove you are a human. This is a measure to prevent spam robots from submitting this form.") ?></p>
     19<pre style="font-size: 0.5em;"><?php $captcha->printAsciiNumber() ?></pre>
     20<?php $captcha->printForm() ?>
     21-------------------------------------------------------------------------------------
    1022 */
    1123class Captcha {
    1224
    1325    var $secret_key = 'some random seed text for the md5';
     26    var $random_number;
    1427    var $ascii_numbers = array(
    1528        array(
     
    95108        )
    96109    );
     110   
     111    /**
     112     * Constructor. Initialized new random number.
     113     *
     114     * @access  public
     115     * @author  Quinn Comendant <quinn@strangecode.com>
     116     * @since   20 Jan 2006 13:08:22
     117     */
     118    function Captcha()
     119    {
     120        $this->random_number = $this->_getRandomNumber();
     121    }
    97122
    98123    /**
     
    129154
    130155    /**
     156     * Prints the captcha ASCII numbers.
     157     *
     158     * @access  public
     159     * @author  Quinn Comendant <quinn@strangecode.com>
     160     * @since   07 Dec 2005 22:09:04
     161     */
     162    function printAsciiNumber()
     163    {
     164        $ascii = $this->getAsciiNumber($this->random_number);
     165        ?><pre name="sc-captcha" id="sc-captcha"><?php echo $ascii ?></pre><?php
     166    }
     167
     168    /**
    131169     * Prints a form to enter captcha, including the required hidden hash form.
    132170     *
     
    137175    function printForm()
    138176    {
    139         $number = $this->_getRandomNumber();
    140         $hash = $this->_getMD5key($number);
    141         $ascii = $this->getAsciiNumber($number);
     177        $hash = $this->_getMD5key($this->random_number);
    142178        ?>
    143         <label for="sc-captcha"><?php echo _("Reverse Turing Test") ?></label>
    144         <p class="help"><?php echo _("Please type the following number to prove you are a human. This is a measure to prevent spam robots from submitting this form.") ?></p>
    145         <pre style="font-size: 0.5em;"><?php echo $ascii ?></pre>
    146         <input name="sc-captcha" id="sc-captcha" type="text" />
    147         <input name="sc-captcha-hash" type="hidden" value="<?php echo $hash ?>" />
     179        <input name="sc-captcha-input" id="sc-captcha-input" type="text" />
     180        <input name="sc-captcha-hash" id="sc-captcha-hash" type="hidden" value="<?php echo $hash ?>" />
    148181        <?php
    149182    }
     
    160193    function valid()
    161194    {
    162         $number = getFormData('sc-captcha');
     195        $number = getFormData('sc-captcha-input');
    163196        $hash = getFormData('sc-captcha-hash');
    164197
  • trunk/lib/DB.inc.php

    r52 r53  
    8585    function setParam($params)
    8686    {
    87         if (!isset($this) || !is_a($this, 'DB')) {
     87        if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) {
    8888            $this =& DB::getInstance();
    8989        }
     
    108108    function getParam($param)
    109109    {
    110         if (!isset($this) || !is_a($this, 'DB')) {
     110        if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) {
    111111            $this =& DB::getInstance();
    112112        }
     
    129129    function connect()
    130130    {
    131         if (!isset($this) || !is_a($this, 'DB')) {
     131        if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) {
    132132            $this =& DB::getInstance();
    133133        }
     
    142142            // Select database
    143143            mysql_select_db($this->getParam('db_name'), $this->dbh);
     144        } else {
     145            App::logMsg(sprintf('mysql_connect failed.', null), LOG_ERR, __FILE__, __LINE__);
    144146        }
    145147
     
    183185    function close()
    184186    {
    185         if (!isset($this) || !is_a($this, 'DB')) {
     187        if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) {
    186188            $this =& DB::getInstance();
    187189        }
     
    204206    function getDBH()
    205207    {
    206         if (!isset($this) || !is_a($this, 'DB')) {
     208        if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) {
    207209            $this =& DB::getInstance();
    208210        }
     
    239241        static $_query_count = 0;
    240242
    241         if (!isset($this) || !is_a($this, 'DB')) {
     243        if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) {
    242244            $this =& DB::getInstance();
    243245        }
     
    285287    function tableExists($table, $use_cached_results=true)
    286288    {
    287         if (!isset($this) || !is_a($this, 'DB')) {
     289        if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) {
    288290            $this =& DB::getInstance();
    289291        }
     
    319321    function columnExists($table, $columns, $strict=true, $use_cached_results=true)
    320322    {
    321         if (!isset($this) || !is_a($this, 'DB')) {
     323        if (!isset($this) || !is_a($this, 'DB') && !is_subclass_of($this, 'DB')) {
    322324            $this =& DB::getInstance();
    323325        }
  • trunk/lib/Email.inc.php

    r52 r53  
    280280        // Ensure message was successfully accepted for delivery.
    281281        if (!mail($final_to, $this->_params['subject'], $final_body, $final_headers, $envelope_sender_header)) {
    282             App::logMsg(sprintf('Email failure with parameters: %s, %s, %s, %s', $this->_params['to'], $this->_params['subject'], str_replace("\r\n", '', $final_headers), $envelope_sender_header), LOG_NOTICE, __FILE__, __LINE__);
     282            App::logMsg(sprintf('Email failure with parameters: %s, %s, %s, %s', $this->_params['to'], $this->_params['subject'], str_replace("\r\n", ', ', $final_headers), $envelope_sender_header), LOG_NOTICE, __FILE__, __LINE__);
    283283            return false;
    284284        }
  • trunk/lib/PageNumbers.inc.php

    r52 r53  
    248248        $page_numbers = array();
    249249
    250         for ($i = 1; $i < $this->total_pages; $i++) {
     250        for ($i = 1; $i <= $this->total_pages; $i++) {
    251251            $page_numbers[] = array(
    252252                'number' => $i,
  • trunk/lib/SessionCache.inc.php

    r52 r53  
    4444    function setParam($params)
    4545    {
    46         if (!isset($this) || !is_a($this, 'SessionCache')) {
     46        if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) {
    4747            $this =& SessionCache::getInstance();
    4848        }
     
    6565    function getParam($param)
    6666    {
    67         if (!isset($this) || !is_a($this, 'SessionCache')) {
     67        if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) {
    6868            $this =& SessionCache::getInstance();
    6969        }
     
    9595    function putCache($var, $var_id, $force_it_in=false)
    9696    {
    97         if (!isset($this) || !is_a($this, 'SessionCache')) {
     97        if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) {
    9898            $this =& SessionCache::getInstance();
    9999        }
     
    149149    function getCache($var_id)
    150150    {
    151         if (!isset($this) || !is_a($this, 'SessionCache')) {
     151        if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) {
    152152            $this =& SessionCache::getInstance();
    153153        }
     
    179179    function isCached($var_id)
    180180    {
    181         if (!isset($this) || !is_a($this, 'SessionCache')) {
     181        if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) {
    182182            $this =& SessionCache::getInstance();
    183183        }
  • trunk/lib/TemplateGlue.inc.php

    r52 r53  
    235235    // in the array keys.
    236236    $ps_value_count = array_count_values($preselected);
    237     if ($ps_value_count['on'] == sizeof($preselected)) {
     237    if (isset($ps_value_count['on']) && $ps_value_count['on'] == sizeof($preselected)) {
    238238        $preselected = array_keys($preselected);
    239239    }
     
    270270        }
    271271        // Print a cell with basic named checkboxes.
    272         ?><td><input type="radio" name="<?php echo $db_col; ?>" id="<?php echo $db_col; ?>" value="<?php echo $v ?>"<?php echo $checked; ?> /><label for="<?php echo $db_col ?>"><?php echo oTxt($v); ?></label></td>
     272        ?><td><input type="radio" name="<?php echo $db_col; ?>" id="<?php echo $db_col . '-' . $v; ?>" value="<?php echo $v ?>"<?php echo $checked; ?> /><label class="sc-label-secondary" for="<?php echo $db_col . '-' . $v ?>"><?php echo oTxt($v); ?></label></td>
    273273        <?php
    274274    }
  • trunk/lib/Utilities.inc.php

    r52 r53  
    200200 * @return  string   Encoded email.
    201201 */
    202 function encodeEmail($email, $at='-at-', $dot='-dot-')
     202function encodeEmail($email, $at=' at ', $dot=' dot ')
    203203{
    204204    $search = array('/@/', '/\./');
  • trunk/services/lock.php

    r52 r53  
    1515    $boom_url = strpos(getFormData('boomerang'), '/') !== false ? getFormData('boomerang') : $_SERVER['HTTP_REFERER'];
    1616    App::setBoomerangURL($boom_url, 'lock');
    17     App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'cancel-lock');
     17    if (isset($_SERVER['HTTP_REFERER'])) {
     18        App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'cancel-lock');
     19    }
    1820}
    1921
  • trunk/tests/run_tests.sh

    r52 r53  
    77for foo in *Test.php;
    88do
    9     php $foo;
     9    /usr/local/bin/php $foo;
    1010done;
Note: See TracChangeset for help on using the changeset viewer.