email regex check update, remove warning surpress in pgsql wrapper, l10n
- l10n class has better mo file load check - fix email regex for last part is now only on minimum 2 char check - remove all @ warning surpress in the pgsql wrapper
This commit is contained in:
@@ -203,7 +203,7 @@
|
||||
if (isset($GLOBALS['PRINT']))
|
||||
$this->print_output = $GLOBALS['PRINT'];
|
||||
|
||||
// exclude these ones from output
|
||||
// exclude these ones from output
|
||||
if (isset($GLOBALS['DEBUG_NOT']))
|
||||
$this->debug_output_not = $GLOBALS['DEBUG_NOT'];
|
||||
if (isset($GLOBALS['ECHO_NOT']))
|
||||
@@ -232,12 +232,12 @@
|
||||
$this->log_per_run = $GLOBALS['LOG_PER_RUN'];
|
||||
|
||||
// set the regex for checking emails
|
||||
$this->email_regex = "^[A-Za-z0-9!#$%&'*+-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+-\/=?^_`{|}~\.]{0,63}@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,6}){1}$";
|
||||
$this->email_regex = "^[A-Za-z0-9!#$%&'*+-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+-\/=?^_`{|}~\.]{0,63}@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,}){1}$";
|
||||
// this is for error check parts in where the email regex failed
|
||||
$this->email_regex_check = array (
|
||||
1 => "@(.*)@(.*)", // double @
|
||||
2 => "^[A-Za-z0-9!#$%&'*+-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+-\/=?^_`{|}~\.]{0,63}@", // wrong part before @
|
||||
3 => "@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,6}){1}$", // wrong part after @
|
||||
3 => "@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,}){1}$", // wrong part after @
|
||||
4 => "@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.", // wrong domain name part
|
||||
5 => "\.([a-zA-Z]{2,6}){1}$", // wrong top level part
|
||||
6 => "@(.*)\.{2,}", // double .. in domain name part
|
||||
@@ -1698,7 +1698,7 @@
|
||||
// *** COLORS ***
|
||||
|
||||
// METHOD: hex2rgb
|
||||
// PARAMS: hexstring, flag to return as string (true/false), string seperator: default: ,
|
||||
// PARAMS: hexstring, flag to return as string (true/false), string seperator: default: ,
|
||||
// RETURN: array with RGB or a string with the seperator
|
||||
// DESC: converts a hex RGB color to the int numbers
|
||||
public static function hex2rgb($hexStr, $returnAsString = false, $seperator = ',')
|
||||
|
||||
@@ -763,7 +763,7 @@
|
||||
$this->insert_id[] = $_insert_id;
|
||||
}
|
||||
// if we have only one, revert from array to single
|
||||
if (count($this->insert_id) >= 1)
|
||||
if (count($this->insert_id) == 1)
|
||||
{
|
||||
// echo "* SINGLE DATA CONVERT: ".count($this->insert_id[0])." => ".array_key_exists($this->pk_name, $this->insert_id[0])."<br>";
|
||||
// echo "* PK DIRECT: ".$this->insert_id[0][$this->pk_name]."<Br>";
|
||||
@@ -780,6 +780,7 @@
|
||||
$this->insert_id = $this->insert_id[0][$this->pk_name];
|
||||
}
|
||||
}
|
||||
// if we have non -> error
|
||||
elseif (count($this->insert_id) == 0)
|
||||
{
|
||||
// failed to get insert id
|
||||
@@ -787,6 +788,7 @@
|
||||
$this->warning_id = 33;
|
||||
$this->_db_error($this->cursor, '[db_exec]');
|
||||
}
|
||||
// if we have multiple, do not set the insert_id different, keep as array
|
||||
}
|
||||
// this warning handling is only for pgsql
|
||||
// we returned an array of PKs instread of a single one
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
public function __construct($lang)
|
||||
{
|
||||
SmartyBC::__construct();
|
||||
_spl_autoload('Class.l10.inc');
|
||||
_spl_autoload('Class.l10n.inc');
|
||||
$this->l10n = new l10n($lang);
|
||||
// variable variable register
|
||||
$this->register_modifier('getvar', array(&$this, 'get_template_vars'));
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
private $input;
|
||||
private $l10n;
|
||||
|
||||
public function __construct($lang = '', $path = '')
|
||||
public function __construct($lang = '', $path = DEFAULT_TEMPLATE)
|
||||
{
|
||||
foreach (array('streams.php', 'gettext.php') as $include_file)
|
||||
_spl_autoload($include_file);
|
||||
@@ -45,12 +45,12 @@
|
||||
else
|
||||
$this->lang = $lang;
|
||||
|
||||
if (!$path)
|
||||
$path = DEFAULT_TEMPLATE;
|
||||
if (!is_dir(LAYOUT.$path.LANG))
|
||||
if (is_dir(LAYOUT.$path.LANG))
|
||||
$path = LAYOUT.$path.LANG;
|
||||
elseif (!is_dir($path))
|
||||
$path = '';
|
||||
|
||||
$this->mofile = LAYOUT.$path.LANG.$this->lang.".mo";
|
||||
$this->mofile = $path.$this->lang.".mo";
|
||||
|
||||
// check if get a readable mofile
|
||||
if (is_readable($this->mofile))
|
||||
@@ -69,10 +69,12 @@
|
||||
|
||||
$this->lang = $lang;
|
||||
|
||||
if (!is_dir(LAYOUT.$path.LANG))
|
||||
if (is_dir(LAYOUT.$path.LANG))
|
||||
$path = LAYOUT.$path.LANG;
|
||||
elseif (!is_dir($path))
|
||||
$path = '';
|
||||
|
||||
$this->mofile = LAYOUT.$path.LANG.$this->lang.".mo";
|
||||
$this->mofile = $path.$this->lang.".mo";
|
||||
|
||||
// check if get a readable mofile
|
||||
if (is_readable($this->mofile))
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
{
|
||||
$this->last_error_query = '';
|
||||
// read out the query status and save the query if needed
|
||||
$result = @pg_query($this->dbh, $query);
|
||||
$result = pg_query($this->dbh, $query);
|
||||
if (!$result)
|
||||
$this->last_error_query = $query;
|
||||
return $result;
|
||||
@@ -79,7 +79,7 @@
|
||||
// DESC : sends an async query to the server
|
||||
public function _db_send_query($query)
|
||||
{
|
||||
return @pg_send_query($this->dbh, $query);
|
||||
return pg_send_query($this->dbh, $query);
|
||||
}
|
||||
|
||||
// METHOD: _db_get_result
|
||||
@@ -102,8 +102,8 @@
|
||||
public function _db_close()
|
||||
{
|
||||
if (is_resource($this->dbh))
|
||||
if (@pg_connection_status($this->dbh) === PGSQL_CONNECTION_OK)
|
||||
@pg_close($this->dbh);
|
||||
if (pg_connection_status($this->dbh) === PGSQL_CONNECTION_OK)
|
||||
pg_close($this->dbh);
|
||||
}
|
||||
|
||||
// METHOD: _db_prepare
|
||||
@@ -112,7 +112,7 @@
|
||||
// DESC : wrapper for pg_prepare
|
||||
public function _db_prepare($name, $query)
|
||||
{
|
||||
$result = @pg_prepare($this->dbh, $name, $query);
|
||||
$result = pg_prepare($this->dbh, $name, $query);
|
||||
if (!$result)
|
||||
$this->last_error_query = $query;
|
||||
return $result;
|
||||
@@ -124,7 +124,7 @@
|
||||
// DESC : wrapper for pg_execute for running a prepared statement
|
||||
public function _db_execute($name, $data)
|
||||
{
|
||||
$result = @pg_execute($this->dbh, $name, $data);
|
||||
$result = pg_execute($this->dbh, $name, $data);
|
||||
if (!$result)
|
||||
$this->last_error_query = $query;
|
||||
return $result;
|
||||
@@ -295,7 +295,7 @@
|
||||
{
|
||||
$db_port = 5432;
|
||||
}
|
||||
$this->dbh = @pg_connect("host=".$db_host." port=".$db_port." user=".$db_user." password=".$db_pass." dbname=".$db_name." sslmode=".$db_ssl);
|
||||
$this->dbh = pg_connect("host=".$db_host." port=".$db_port." user=".$db_user." password=".$db_pass." dbname=".$db_name." sslmode=".$db_ssl);
|
||||
if (!$this->dbh)
|
||||
{
|
||||
die("<!-- Can't connect [host=".$db_host." port=".$db_port." user=".$db_user." password=XXXX dbname=".$db_name." sslmode=".$db_ssl."] //-->");
|
||||
@@ -326,7 +326,7 @@
|
||||
// DESC : wrapper for pg_emta_data
|
||||
public function _db_meta_data($table)
|
||||
{
|
||||
return @pg_meta_data($this->dbh, $table);
|
||||
return pg_meta_data($this->dbh, $table);
|
||||
}
|
||||
|
||||
// METHOD: _db_escape_string
|
||||
|
||||
Reference in New Issue
Block a user