| version 1.70, 2012/10/07 15:45:58 |
version 1.71, 2012/10/10 18:28:51 |
|
|
| * http://platon.sk/projects/Metafox/ |
* http://platon.sk/projects/Metafox/ |
| */ |
*/ |
| |
|
| /* $Platon: Metafox/db.inc.php,v 1.69 2012-09-30 14:39:23 igor Exp $ */ |
/* $Platon: Metafox/db.inc.php,v 1.70 2012-10-07 15:45:58 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 179 function ezin_validate_IDs($ar) /* {{{ * |
|
| Line 179 function ezin_validate_IDs($ar) /* {{{ * |
|
| $ar_redirect = null; |
$ar_redirect = null; |
| if (strlen($ar['author_id']) > 0) { |
if (strlen($ar['author_id']) > 0) { |
| $ret = ezin_get_access_key_redirect($ar['author_id'], 'author'); |
$ret = ezin_get_access_key_redirect($ar['author_id'], 'author'); |
| if (count($ret) > 0) { |
if (is_array($ret) |
| |
&& count($ret) > 0) |
| |
{ |
| $ar_redirect = ezin_validate_IDs(array('author_id' => $ret['id'])); |
$ar_redirect = ezin_validate_IDs(array('author_id' => $ret['id'])); |
| $ar_redirect['redirect'] = true; |
$ar_redirect['redirect'] = true; |
| } |
} |
| } else if (strlen($ar['article_id']) > 0) { |
} else if (strlen($ar['article_id']) > 0) { |
| $ret = ezin_get_access_key_redirect($ar['article_id'], 'article'); |
$ret = ezin_get_access_key_redirect($ar['article_id'], 'article'); |
| if (count($ret) > 0) { |
if (is_array($ret) |
| |
&& count($ret) > 0) |
| |
{ |
| $ar_redirect = ezin_validate_IDs(array('article_id' => $ret['id'])); |
$ar_redirect = ezin_validate_IDs(array('article_id' => $ret['id'])); |
| $ar_redirect['redirect'] = true; |
$ar_redirect['redirect'] = true; |
| } |
} |
| } else if (strlen($ar['section_id']) > 0) { |
} else if (strlen($ar['section_id']) > 0) { |
| $ret = ezin_get_access_key_redirect($ar['section_id'], 'section'); |
$ret = ezin_get_access_key_redirect($ar['section_id'], 'section'); |
| if (count($ret) > 0) { |
if (is_array($ret) |
| |
&& count($ret) > 0) |
| |
{ |
| $ar_redirect = ezin_validate_IDs(array('section_id' => $ret['id'])); |
$ar_redirect = ezin_validate_IDs(array('section_id' => $ret['id'])); |
| $ar_redirect['redirect'] = true; |
$ar_redirect['redirect'] = true; |
| |
} else { |
| |
// lookup for articles with actual access-key |
| |
if (ezin_exists_article($ar['section_id'])) { |
| |
$ar_redirect = ezin_validate_IDs(array('article_id' => $ar['section_id'])); |
| |
$ar_redirect['redirect'] = true; |
| |
} |
| } |
} |
| } |
} |
| |
|
| Line 386 function ezin_get_section($section_id, $ |
|
| Line 398 function ezin_get_section($section_id, $ |
|
| return $row; |
return $row; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
/* |
| |
* ezin_exists_section() |
| |
*/ |
| |
function ezin_exists_section($section_id) /* {{{ */ |
| |
{ |
| |
global $ezin_sys; |
| |
global $ezin_db_handle; |
| |
|
| |
if (is_numeric($section_id)) { |
| |
$where = sprintf('id = %d', intval($section_id)); |
| |
} else { |
| |
$where = sprintf('access_key = "%s"', ezin_db_escape(trim($section_id))); |
| |
} |
| |
|
| |
$query = sprintf('SELECT COUNT(*)' |
| |
.' FROM %s' |
| |
.' WHERE %s', |
| |
$ezin_sys['db']['tables']['sections'], |
| |
$where); |
| |
|
| |
$result = @mysql_query($query, $ezin_db_handle) |
| |
or ezin_db_error('ezin_exists_section()'); |
| |
|
| |
if (($row = @mysql_fetch_array($result, MYSQL_NUM)) == false) |
| |
$row = array(); |
| |
@mysql_free_result($result); |
| |
|
| |
return (intval($row[0]) > 0) ? TRUE : FALSE; |
| |
} /* }}} */ |
| |
|
| function ezin_get_editorial($section_id = null, $article_id = null) /* {{{ */ |
function ezin_get_editorial($section_id = null, $article_id = null) /* {{{ */ |
| { |
{ |
| global $ezin_sys; |
global $ezin_sys; |
| Line 851 function ezin_get_article($article_id) / |
|
| Line 893 function ezin_get_article($article_id) / |
|
| } /* }}} */ |
} /* }}} */ |
| |
|
| /* |
/* |
| |
* ezin_exists_article() |
| |
*/ |
| |
function ezin_exists_article($article_id) /* {{{ */ |
| |
{ |
| |
global $ezin_sys; |
| |
global $ezin_db_handle; |
| |
|
| |
if (is_numeric($article_id)) { |
| |
$where = sprintf('id = %d', intval($article_id)); |
| |
} else { |
| |
$where = sprintf('access_key = "%s"', ezin_db_escape(trim($article_id))); |
| |
} |
| |
|
| |
$query = sprintf('SELECT COUNT(*)' |
| |
.' FROM %s' |
| |
.' WHERE %s', |
| |
$ezin_sys['db']['tables']['articles'], |
| |
$where); |
| |
|
| |
$result = @mysql_query($query, $ezin_db_handle) |
| |
or ezin_db_error('ezin_exists_article()'); |
| |
|
| |
if (($row = @mysql_fetch_array($result, MYSQL_NUM)) == false) |
| |
$row = array(); |
| |
@mysql_free_result($result); |
| |
|
| |
return (intval($row[0]) > 0) ? TRUE : FALSE; |
| |
} /* }}} */ |
| |
|
| |
/* |
| * ezin_get_author() |
* ezin_get_author() |
| */ |
*/ |
| function ezin_get_author($author_id) /* {{{ */ |
function ezin_get_author($author_id) /* {{{ */ |