function getID($vID, $bWithEmail = 1) { $oPDb = new BxDolProfileQuery(); if ($bWithEmail) { if (eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}\$", $vID)) { $aMail = $oPDb->getIdByEmail($vID); if ((int) $aMail['ID']) { return (int) $aMail['ID']; } } } $iID = (int) $vID; if (strcmp("{$vID}", "{$iID}") == 0) { return $iID; } else { $aNick = $oPDb->getIdByNickname($vID); if ((int) $aNick['ID']) { return (int) $aNick['ID']; } } return false; }
function getID($vID = false, $bWithEmail = 1) { if (false === $vID) { return $this->_iProfileID; } $oPDb = new BxDolProfileQuery(); if ($bWithEmail) { if (filter_var($vID, FILTER_VALIDATE_EMAIL)) { //eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$", $vID) ) { $aMail = $oPDb->getIdByEmail($vID); if ((int) $aMail['ID']) { return (int) $aMail['ID']; } } } $iID = (int) $vID; if (strcmp("{$vID}", "{$iID}") == 0) { return $iID; } else { $aNick = $oPDb->getIdByNickname($vID); if ((int) $aNick['ID']) { return (int) $aNick['ID']; } } return false; }