Changeset 9


Ignore:
Timestamp:
Sep 11, 2005 9:58:14 PM (19 years ago)
Author:
scdev
Message:

updated DB.inc.php so SET NAMES query is only used on MySQL versions > 4.1

Location:
trunk/lib
Files:
2 edited

Legend:

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

    r8 r9  
    160160        $this->_connected = true;
    161161
    162         // Set the character set used for communicating with MySQL.
    163         $this->query("SET NAMES '" . $this->mysql_character_sets[strtolower(App::getParam('character_set'))] . "'");
     162        // Tell MySQL what character set we're useing.
     163        if (preg_match('/^4\.[1-9].*$|^5.*$/', mysql_get_server_info())) {
     164            $this->query("SET NAMES '" . $this->mysql_character_sets[strtolower(App::getParam('character_set'))] . "'");
     165        }
    164166       
    165167        return true;
  • trunk/lib/Utilities.inc.php

    r8 r9  
    187187    }
    188188    return $output;
     189}
     190
     191/**
     192 * Encodes an email into a user (at) domain (dot) com format.
     193 *
     194 * @access  public
     195 * @param   string   $email   An email to encode.
     196 * @param   string   $at      Replaces the @.
     197 * @param   string   $dot     Replaces the ..
     198 * @return  string   Encoded email.
     199 */
     200function encodeEmail($email, $at='-at-', $dot='-dot-')
     201{
     202    $search = array('/@/', '/\./');
     203    $replace = array($at, $dot);
     204    return preg_replace($search, $replace, $email);
    189205}
    190206
Note: See TracChangeset for help on using the changeset viewer.