| version 1.66, 2012/09/19 08:48:42 |
version 1.67, 2012/09/28 16:23:20 |
|
|
| * http://platon.sk/projects/Metafox/ |
* http://platon.sk/projects/Metafox/ |
| */ |
*/ |
| |
|
| /* $Platon: Metafox/db.inc.php,v 1.65 2012-06-06 10:19:41 igor Exp $ */ |
/* $Platon: Metafox/db.inc.php,v 1.66 2012-09-19 08:48:42 igor Exp $ */ |
| |
|
| /* |
/* |
| * updates: 23/5/2001, 29/7/2001, 11/10/2001, 2/11/2001, 11/1/2002, 23/7/2002 |
* updates: 23/5/2001, 29/7/2001, 11/10/2001, 2/11/2001, 11/1/2002, 23/7/2002 |
| Line 173 function ezin_validate_IDs($ar) /* {{{ * |
|
| Line 173 function ezin_validate_IDs($ar) /* {{{ * |
|
| $ar['article_bind_lang'] = intval(@$ret_row['article_bind_lang']); |
$ar['article_bind_lang'] = intval(@$ret_row['article_bind_lang']); |
| $ar['section_access_key'] = @$ret_row['section_access_key']; |
$ar['section_access_key'] = @$ret_row['section_access_key']; |
| $ar['article_access_key'] = @$ret_row['article_access_key']; |
$ar['article_access_key'] = @$ret_row['article_access_key']; |
| |
$ar['author_access_key'] = @$ret_row['author_access_key']; |
| } else { |
} else { |
| $ar['lang'] = ''; |
$ar['lang'] = ''; |
| $ar['author_id'] = 0; |
$ar['author_id'] = 0; |
| Line 2157 function ezin_cache_clear($cache_id = 'X |
|
| Line 2158 function ezin_cache_clear($cache_id = 'X |
|
| return true; |
return true; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
|
| |
/* |
| |
* ACCESS KEY REDIRECTS |
| |
*/ |
| |
|
| |
function ezin_exist_access_key_redirect($name, $type) { |
| |
global $ezin_sys; |
| |
global $ezin_db_handle; |
| |
$query = sprintf('SELECT COUNT(*) AS count' |
| |
.' FROM %s' |
| |
.' WHERE old_key = "%s"' |
| |
.' AND `type` = "%s"', |
| |
$ezin_sys['db']['tables']['redirects'], |
| |
ezin_db_escape($name), |
| |
ezin_db_escape($type)); |
| |
$result = @mysql_query($query, $ezin_db_handle) |
| |
or ezin_db_error('ezin_exist_access_key_redirect()'); |
| |
$row = @mysql_fetch_array($result, MYSQL_ASSOC); |
| |
@mysql_free_result($result); |
| |
return ($row['count'] == 1); |
| |
} |
| |
|
| |
function ezin_get_access_key_redirect($name, $type) { |
| |
global $ezin_sys; |
| |
global $ezin_db_handle; |
| |
$query = sprintf('SELECT *' |
| |
.' FROM %s' |
| |
.' WHERE `old_key` = "%s"' |
| |
.' AND `type` = "%s" LIMIT 1', |
| |
$ezin_sys['db']['tables']['redirects'], |
| |
ezin_db_escape($name), |
| |
ezin_db_escape($type)); |
| |
$result = @mysql_query($query, $ezin_db_handle) |
| |
or ezin_db_error('ezin_get_access_key_redirect()'); |
| |
$row = @mysql_fetch_array($result, MYSQL_ASSOC); |
| |
@mysql_free_result($result); |
| |
return $row; |
| |
} |
| |
|
| |
function ezin_add_access_key_redirect($name, $type, $id) { |
| |
global $ezin_sys; |
| |
global $ezin_db_handle; |
| |
if (ezin_exist_access_key_redirect($name, $type)) { |
| |
$query = sprintf('UPDATE %s' |
| |
.' SET id = %d' |
| |
.' WHERE `old_key` = "%s"' |
| |
.' AND `type` = "%s"', |
| |
$ezin_sys['db']['tables']['redirects'], |
| |
ezin_db_escape($type), |
| |
intval($id), |
| |
ezin_db_escape($name), |
| |
ezin_db_escape($type)); |
| |
} else { |
| |
$query = sprintf('INSERT INTO %s' |
| |
.' (old_key, type, id)' |
| |
.' VALUES' |
| |
.' ("%s", "%s", %d)', |
| |
$ezin_sys['db']['tables']['redirects'], |
| |
ezin_db_escape($name), |
| |
ezin_db_escape($type), |
| |
intval($id)); |
| |
} |
| |
$result = @mysql_query($query, $ezin_db_handle) |
| |
or ezin_db_error('ezin_add_access_key_redirect()'); |
| |
$affected = mysql_affected_rows(); |
| |
@mysql_free_result($result); |
| |
return ($affected == 1); |
| |
} |
| |
|
| |
function ezin_delete_access_key_redirect($name, $type) { |
| |
global $ezin_sys; |
| |
global $ezin_db_handle; |
| |
$query = sprintf('DELETE FROM %s' |
| |
.' WHERE `old_key` = "%s"' |
| |
.' AND `type` = "%s"', |
| |
$ezin_sys['db']['tables']['redirects'], |
| |
ezin_db_escape($name), |
| |
ezin_db_escape($type)); |
| |
$result = @mysql_query($query, $ezin_db_handle) |
| |
or ezin_db_error('ezin_delete_access_key_redirect()'); |
| |
$affected = mysql_affected_rows(); |
| |
@mysql_free_result($result); |
| |
return ($affected == 1); |
| |
} |
| |
|
| |
function ezin_clear_access_key_redirect($type, $id) { |
| |
global $ezin_sys; |
| |
global $ezin_db_handle; |
| |
$query = sprintf('DELETE FROM %s' |
| |
.' WHERE `type` = "%s"' |
| |
.' AND `id` = %d', |
| |
$ezin_sys['db']['tables']['redirects'], |
| |
ezin_db_escape($type), |
| |
intval($id)); |
| |
$result = @mysql_query($query, $ezin_db_handle) |
| |
or ezin_db_error('ezin_clear_access_key_redirect()'); |
| |
$affected = mysql_affected_rows(); |
| |
@mysql_free_result($result); |
| |
} |
| |
|
| /* Modeline for ViM {{{ |
/* Modeline for ViM {{{ |
| * vim: set ts=4: |
* vim: set ts=4: |
| * vim600: fdm=marker fdl=0 fdc=0: |
* vim600: fdm=marker fdl=0 fdc=0: |