| version 1.38, 2007/03/06 21:26:50 |
version 1.39, 2007/04/09 23:14:43 |
|
|
| * http://platon.sk/projects/Metafox/ |
* http://platon.sk/projects/Metafox/ |
| */ |
*/ |
| |
|
| /* $Platon: Metafox/db.inc.php,v 1.37 2007-02-24 23:48:52 nepto Exp $ */ |
/* $Platon: Metafox/db.inc.php,v 1.38 2007-03-06 21:26:50 nepto 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 320 function ezin_get_section($section_id) / |
|
| Line 320 function ezin_get_section($section_id) / |
|
| .' FROM '.$ezin_sys['db']['tables']['sections'].' AS sections' |
.' FROM '.$ezin_sys['db']['tables']['sections'].' AS sections' |
| .' LEFT JOIN '.$ezin_sys['db']['tables']['editorials'].' AS editorials' |
.' LEFT JOIN '.$ezin_sys['db']['tables']['editorials'].' AS editorials' |
| .' ON sections.id = editorials.section_id' |
.' ON sections.id = editorials.section_id' |
| .' AND (editorials.datetime <= SYSDATE()' |
.' AND (editorials.datetime IS NULL OR editorials.datetime <= SYSDATE())' |
| .' OR editorials.datetime IS NULL)' |
|
| /* 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"') |
: 'sections.type = "global"') |
| .' ORDER BY editorials.datetime DESC LIMIT 1'; |
.' ORDER BY editorials.datetime DESC LIMIT 1'; |
| |
|
| // TODO: rebuild for 2 queries, LIMIT above use for getting for global section |
|
| //print "$query<hr>\n"; |
|
| |
|
| $result = @mysql_query($query, $ezin_db_handle) |
$result = @mysql_query($query, $ezin_db_handle) |
| or ezin_db_error('ezin_get_section()'); |
or ezin_db_error('ezin_get_section() [1]'); |
| |
|
| if (($row = mysql_fetch_array($result, MYSQL_ASSOC)) == false) |
if (($row = mysql_fetch_array($result, MYSQL_ASSOC)) == false) |
| $row = array(); |
$row = array(); |
| @mysql_free_result($result); |
@mysql_free_result($result); |
| |
|
| |
if (is_null($row['section_editorial_timestamp']) |
| |
&& is_null($row['section_editorial_title']) |
| |
&& is_null($row['section_editorial_text'])) |
| |
{ |
| |
$query = 'SELECT' |
| |
.' UNIX_TIMESTAMP(editorials.datetime) section_editorial_timestamp,' |
| |
.' editorials.text_wordcount section_editorial_text_wordcount,' |
| |
.' editorials.text_flags section_editorial_text_flags,' |
| |
.' editorials.text section_editorial_text,' |
| |
.' editorials.title section_editorial_title' |
| |
.' FROM '.$ezin_sys['db']['tables']['editorials'].' AS editorials' |
| |
.' LEFT JOIN '.$ezin_sys['db']['tables']['sections'].' AS sections' |
| |
.' ON sections.id = editorials.section_id AND sections.type = "global"' |
| |
.' AND (editorials.datetime IS NULL OR editorials.datetime <= SYSDATE())' |
| |
.' ORDER BY editorials.datetime DESC LIMIT 1'; |
| |
|
| |
$result = @mysql_query($query, $ezin_db_handle) |
| |
or ezin_db_error('ezin_get_section() [2]'); |
| |
if (($subrow = mysql_fetch_array($result, MYSQL_ASSOC)) != false) |
| |
$row = array_merge($row, $subrow); |
| |
@mysql_free_result($result); |
| |
} |
| |
|
| return $row; |
return $row; |
| } /* }}} */ |
} /* }}} */ |
| |
|