| version 1.58, 2011/01/03 07:34:06 |
version 1.59, 2011/01/24 16:44:48 |
|
|
| * http://platon.sk/projects/Metafox/ |
* http://platon.sk/projects/Metafox/ |
| */ |
*/ |
| |
|
| /* $Platon: Metafox/db.inc.php,v 1.57 2010-11-19 15:29:39 igor Exp $ */ |
/* $Platon: Metafox/db.inc.php,v 1.58 2011-01-03 07:34:06 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 104 function ezin_validate_IDs($ar) /* {{{ * |
|
| Line 104 function ezin_validate_IDs($ar) /* {{{ * |
|
| $conditions = array_merge($conditions, array( |
$conditions = array_merge($conditions, array( |
| $ezin_sections.'.id = '.$ezin_articles.'.section_id', |
$ezin_sections.'.id = '.$ezin_articles.'.section_id', |
| //$ezin_articles.'.datetime <= SYSDATE() ', |
//$ezin_articles.'.datetime <= SYSDATE() ', |
| $ezin_articles.'.status NOT IN ("", "disabled")', |
'(FIND_IN_SET("enabled", '.$ezin_articles.'.display) > 0)', |
| $ezin_sections.'.type NOT IN ("", "disabled")' |
'(FIND_IN_SET("articles_enabled", '.$ezin_sections.'.display) > 0)', |
| )); |
)); |
| } |
} |
| |
|
| Line 128 function ezin_validate_IDs($ar) /* {{{ * |
|
| Line 128 function ezin_validate_IDs($ar) /* {{{ * |
|
| } |
} |
| |
|
| if (! $id_included && $c_section) { |
if (! $id_included && $c_section) { |
| $conditions[] = $ezin_sections.'.type IN ("normal", "global", "hidden", "hidden2")'; // ) |
$conditions[] = '(FIND_IN_SET("articles_enabled", '.$ezin_sections.'.display) > 0)'; |
| if (intval($ar['section_id']) > 0) { |
if (intval($ar['section_id']) > 0) { |
| $conditions[] = $ezin_sections.'.id = '.intval($ar['section_id']); |
$conditions[] = $ezin_sections.'.id = '.intval($ar['section_id']); |
| } else { |
} else { |
| Line 254 function ezin_get_section_list($lang = ' |
|
| Line 254 function ezin_get_section_list($lang = ' |
|
| .' template_key section_template_key,' |
.' template_key section_template_key,' |
| .' link section_link' |
.' link section_link' |
| .' FROM '.$ezin_sys['db']['tables']['sections'] |
.' FROM '.$ezin_sys['db']['tables']['sections'] |
| .' WHERE type IN ("normal", "global")'; |
.' WHERE (FIND_IN_SET("in_list", display) > 0)'; |
| if ($lang != '') { |
if ($lang != '') { |
| $query .= ' AND (lang IS NULL OR lang = ""' |
$query .= ' AND (lang IS NULL OR lang = ""' |
| .' OR lang LIKE "'.ezin_db_escape($lang).'")'; |
.' OR lang LIKE "'.ezin_db_escape($lang).'")'; |
| Line 317 function ezin_get_section($section_id, $ |
|
| Line 317 function ezin_get_section($section_id, $ |
|
| $query = 'SELECT' |
$query = 'SELECT' |
| .' sections.id section_id,' |
.' sections.id section_id,' |
| .' sections.type section_type,' |
.' sections.type section_type,' |
| |
.' sections.type2 section_type2,' |
| |
.' sections.display section_display,' |
| |
.' sections.select section_select,' |
| .' sections.ord section_ord,' |
.' sections.ord section_ord,' |
| .' sections.a_limit section_limit,' |
.' sections.a_limit section_limit,' |
| .' sections.accesses_count as section_accesses_count,' |
.' sections.accesses_count as section_accesses_count,' |
| Line 331 function ezin_get_section($section_id, $ |
|
| Line 334 function ezin_get_section($section_id, $ |
|
| /* XXX let this here, although global sections now use direct ID retrieving */ |
/* XXX let this here, although global sections now use direct ID retrieving */ |
| .' WHERE '.($section_id > 0 |
.' WHERE '.($section_id > 0 |
| ? 'sections.id = '.$section_id |
? 'sections.id = '.$section_id |
| : 'sections.type = "global"') |
: '(FIND_IN_SET("global", sections.type2) > 0)') |
| .' ORDER BY sections.id ASC LIMIT 1'; |
.' ORDER BY sections.id ASC LIMIT 1'; |
| |
|
| $result = @mysql_query($query, $ezin_db_handle) |
$result = @mysql_query($query, $ezin_db_handle) |
| Line 381 function ezin_get_editorial($section_id |
|
| Line 384 function ezin_get_editorial($section_id |
|
| .' editorials.text_flags editorial_text_flags,' |
.' editorials.text_flags editorial_text_flags,' |
| .' editorials.text editorial_text,' |
.' editorials.text editorial_text,' |
| .' editorials.title editorial_title' |
.' editorials.title editorial_title' |
| .' FROM '.$ezin_sys['db']['tables']['editorials'].' AS editorials' |
.' FROM '.$ezin_sys['db']['tables']['editorials'].' AS editorials,' |
| .' WHERE section_id = '.$section_id |
.' '.$ezin_sys['db']['tables']['sections'].' AS sections' |
| |
.' WHERE editorials.section_id = '.$section_id |
| .' AND (editorials.datetime IS NULL OR editorials.datetime <= SYSDATE())' |
.' AND (editorials.datetime IS NULL OR editorials.datetime <= SYSDATE())' |
| |
.' AND (editorials.section_id = sections.id)' |
| |
.' AND (FIND_IN_SET("editorials", sections.select) > 0)' |
| .' ORDER BY editorials.datetime DESC LIMIT 1'; |
.' ORDER BY editorials.datetime DESC LIMIT 1'; |
| } |
} |
| if ($step == 3) { |
if ($step == 3) { |
| Line 396 function ezin_get_editorial($section_id |
|
| Line 402 function ezin_get_editorial($section_id |
|
| .' 1 editorial_inherited' |
.' 1 editorial_inherited' |
| .' FROM '.$ezin_sys['db']['tables']['editorials'].' AS editorials,' |
.' FROM '.$ezin_sys['db']['tables']['editorials'].' AS editorials,' |
| .' '.$ezin_sys['db']['tables']['sections'].' AS sections' |
.' '.$ezin_sys['db']['tables']['sections'].' AS sections' |
| .' WHERE sections.id = editorials.section_id AND sections.type = "global"' |
.' WHERE sections.id = editorials.section_id AND (FIND_IN_SET("global", sections.type2) > 0)' |
| .' AND (editorials.datetime IS NULL OR editorials.datetime <= SYSDATE())' |
.' AND (editorials.datetime IS NULL OR editorials.datetime <= SYSDATE())' |
| .' ORDER BY editorials.datetime DESC LIMIT 1'; |
.' ORDER BY editorials.datetime DESC LIMIT 1'; |
| } |
} |
| Line 487 function ezin_get_article_list($section_ |
|
| Line 493 function ezin_get_article_list($section_ |
|
| $query .= |
$query .= |
| ' WHERE articles.section_id = sections.id' |
' WHERE articles.section_id = sections.id' |
| .' AND articles.datetime <= SYSDATE()' |
.' AND articles.datetime <= SYSDATE()' |
| .' AND UNIX_TIMESTAMP(articles.datetime) > 0' |
// .' AND UNIX_TIMESTAMP(articles.datetime) > 0' |
| .' AND articles.status NOT IN ("", "disabled")' |
.' AND ( (FIND_IN_SET("articles_enabled", sections.display) > 0)' |
| .' AND sections.type NOT IN ("", "full_hidden", "disabled")'; |
.' OR (FIND_IN_SET("articles_in_normal", sections.display) > 0)' |
| |
.' OR (FIND_IN_SET("articles_in_global", sections.display) > 0)' |
| |
.' )'; |
| if ($lang != '') { |
if ($lang != '') { |
| $query .= ' AND (lang IS NULL OR lang = ""' |
$query .= ' AND (lang IS NULL OR lang = ""' |
| .' OR lang LIKE "'.ezin_db_escape($lang).'")'; |
.' OR lang LIKE "'.ezin_db_escape($lang).'")'; |
| Line 545 function ezin_get_article_list($section_ |
|
| Line 553 function ezin_get_article_list($section_ |
|
| |
|
| |
|
| } else { |
} else { |
| $query .= ' AND articles.status NOT IN ("hidden")'; |
$query .= ' AND ((FIND_IN_SET("in_normal", articles.display) > 0)' |
| |
.' OR (FIND_IN_SET("in_global", articles.display) > 0)' |
| |
.' )'; |
| if ($section_id > 0) { |
if ($section_id > 0) { |
| $query .= ' AND sections.id = '.$section_id; |
$query .= ' AND sections.id = '.$section_id; |
| $query .= ' AND (sections.type != "global" OR articles.status != "partly_showed")'; |
$query .= ' AND (FIND_IN_SET("articles_in_normal", sections.display) > 0)'; |
| |
$query .= ' AND (' |
| |
.' ((FIND_IN_SET("articles", sections.select) > 0)' |
| |
.' AND (UNIX_TIMESTAMP(articles.datetime) > 0))' |
| |
.' OR ((FIND_IN_SET("pages", sections.select) > 0)' |
| |
.' AND (UNIX_TIMESTAMP(articles.datetime) = 0))' |
| |
.' )'; |
| } else { |
} else { |
| $query .= ' AND sections.type != "hidden2" AND articles.status != "partly_showed"'; |
$query .= ' AND (FIND_IN_SET("articles_in_global", sections.display) > 0)' |
| |
.' AND (FIND_IN_SET("in_global", articles.display) > 0)'; |
| } |
} |
| } |
} |
| $query .= ' ORDER BY articles.datetime ' |
$query .= ' ORDER BY articles.datetime ' |
| Line 559 function ezin_get_article_list($section_ |
|
| Line 576 function ezin_get_article_list($section_ |
|
| if ($limit > 0) { |
if ($limit > 0) { |
| $query .= ' LIMIT '.$limit; |
$query .= ' LIMIT '.$limit; |
| } |
} |
| $result = @mysql_query($query, $ezin_db_handle) |
$result = @mysql_query($query, $ezin_db_handle) |
| or ezin_db_error('ezin_get_article_list()'); |
or ezin_db_error('ezin_get_article_list()'); |
| $array = array(); |
$array = array(); |
| for ($k = 0; ($array[$k] = @mysql_fetch_array($result, MYSQL_ASSOC)); $k++) |
for ($k = 0; ($array[$k] = @mysql_fetch_array($result, MYSQL_ASSOC)); $k++) |
| Line 1773 function ezin_cache_clear($cache_id = 'X |
|
| Line 1790 function ezin_cache_clear($cache_id = 'X |
|
| if ($delete_all) { |
if ($delete_all) { |
| $query = 'DELETE FROM '.$ezin_sys['db']['tables']['cache']; |
$query = 'DELETE FROM '.$ezin_sys['db']['tables']['cache']; |
| } else if ($delete_gs) { |
} else if ($delete_gs) { |
| $query2 = sprintf('SELECT id FROM %s WHERE type = "global"', $ezin_sys['db']['tables']['sections']); |
$query2 = sprintf('SELECT id FROM %s WHERE (FIND_IN_SET("global", type2) > 0)', $ezin_sys['db']['tables']['sections']); |
| $result = @mysql_query($query2, $ezin_db_handle) |
$result = @mysql_query($query2, $ezin_db_handle) |
| or ezin_db_error('ezin_cache_clear() [1]'); |
or ezin_db_error('ezin_cache_clear() [1]'); |
| $global_sections = array(); |
$global_sections = array(); |