| version 1.90, 2019/12/19 00:55:50 |
version 1.91, 2024/11/20 15:48:03 |
|
|
| * http://platon.sk/projects/Metafox/ |
* http://platon.sk/projects/Metafox/ |
| */ |
*/ |
| |
|
| /* $Platon: Metafox/db.inc.php,v 1.89 2019/11/02 12:26:51 nepto Exp $ */ |
/* $Platon: Metafox/db.inc.php,v 1.90 2019/12/19 00:55: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 168 function ezin_validate_IDs($ar) /* {{{ * |
|
| Line 168 function ezin_validate_IDs($ar) /* {{{ * |
|
| $ar['article_id'] = isset($ret_row['article_id']) ? $ret_row['article_id'] : 0; |
$ar['article_id'] = isset($ret_row['article_id']) ? $ret_row['article_id'] : 0; |
| $ar['message_id'] = isset($ret_row['message_id']) |
$ar['message_id'] = isset($ret_row['message_id']) |
| ? $ret_row['message_id'] |
? $ret_row['message_id'] |
| : is_array($ar['message_id']) ? $ar['message_id'] : 0; |
: (is_array($ar['message_id']) ? $ar['message_id'] : 0); |
| $ar['section_bind_lang'] = intval(@$ret_row['section_bind_lang']); |
$ar['section_bind_lang'] = intval(@$ret_row['section_bind_lang']); |
| $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']; |
| Line 290 function ezin_get_bind_lang_table($bind_ |
|
| Line 290 function ezin_get_bind_lang_table($bind_ |
|
| |
|
| /* |
/* |
| * ezin_get_section_list() |
* ezin_get_section_list() |
| */ |
*/ |
| function ezin_get_section_list($lang = '', $current_section_id = null) /* {{{ */ |
function ezin_get_section_list($lang = '', $current_section_id = null) /* {{{ */ |
| { |
{ |
| global $ezin_sys; |
global $ezin_sys; |
| Line 406 function ezin_get_section($section_id, $ |
|
| Line 406 function ezin_get_section($section_id, $ |
|
| .' sections.lang section_lang' |
.' sections.lang section_lang' |
| .' FROM '.$ezin_sys['db']['tables']['sections'].' AS sections' |
.' FROM '.$ezin_sys['db']['tables']['sections'].' AS sections' |
| /* 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 |
| : '(FIND_IN_SET("global", sections.type2) > 0)') |
: '(FIND_IN_SET("global", sections.type2) > 0)') |
| .' ORDER BY sections.id ASC LIMIT 1'; |
.' ORDER BY sections.id ASC LIMIT 1'; |
| Line 637 function ezin_get_article_list($section_ |
|
| Line 637 function ezin_get_article_list($section_ |
|
| .' )' |
.' )' |
| .' AND bind != 0'; |
.' AND bind != 0'; |
| } |
} |
| |
|
| $result2 = mysqli_query($ezin_db_handle, $query2) |
$result2 = mysqli_query($ezin_db_handle, $query2) |
| or ezin_db_error('ezin_get_article_list()'); |
or ezin_db_error('ezin_get_article_list()'); |
| $array2 = array(); |
$array2 = array(); |
| Line 694 function ezin_get_article_list($section_ |
|
| Line 694 function ezin_get_article_list($section_ |
|
| ; |
; |
| unset($array[$k]); |
unset($array[$k]); |
| mysqli_free_result($result); |
mysqli_free_result($result); |
| |
|
| // add articles from sources |
// add articles from sources |
| $sources_articles = ezin_get_article_list_sources($section_id); |
$sources_articles = ezin_get_article_list_sources($section_id); |
| |
|
| Line 1005 function ezin_get_article($article_id) / |
|
| Line 1005 function ezin_get_article($article_id) / |
|
| .' FROM '.$ezin_sys['db']['tables']['articles'].' AS articles' |
.' FROM '.$ezin_sys['db']['tables']['articles'].' AS articles' |
| .' LEFT JOIN '.$ezin_sys['db']['tables']['authors'].' AS authors' |
.' LEFT JOIN '.$ezin_sys['db']['tables']['authors'].' AS authors' |
| .' ON articles.author_id = authors.id,' |
.' ON articles.author_id = authors.id,' |
| .' '.$ezin_sys['db']['tables']['sections'].' AS sections' |
.' '.$ezin_sys['db']['tables']['sections'].' AS sections' |
| .' WHERE articles.section_id = sections.id ' |
.' WHERE articles.section_id = sections.id ' |
| .' AND articles.id = '.$article_id |
.' AND articles.id = '.$article_id |
| .' ORDER BY articles.datetime ' |
.' ORDER BY articles.datetime ' |
| Line 1059 function ezin_exists_article($article_id |
|
| Line 1059 function ezin_exists_article($article_id |
|
| function ezin_get_oldest_dt() { |
function ezin_get_oldest_dt() { |
| global $ezin_sys; |
global $ezin_sys; |
| global $ezin_db_handle; |
global $ezin_db_handle; |
| |
|
| $query = sprintf('SELECT created_dt' |
$query = sprintf('SELECT created_dt' |
| .' FROM %s' |
.' FROM %s' |
| .' WHERE created_dt > 0' |
.' WHERE created_dt > 0' |
| Line 1319 function ezin_get_roles($count = 0) { |
|
| Line 1319 function ezin_get_roles($count = 0) { |
|
| |
|
| /* |
/* |
| * ezin_set_author_counts() |
* ezin_set_author_counts() |
| */ |
*/ |
| function ezin_set_author_counts($author_id, $count_ar) /* {{{ */ |
function ezin_set_author_counts($author_id, $count_ar) /* {{{ */ |
| { |
{ |
| global $ezin_sys; |
global $ezin_sys; |
| Line 1357 function ezin_set_author_counts($author_ |
|
| Line 1357 function ezin_set_author_counts($author_ |
|
| |
|
| /* |
/* |
| * ezin_set_section_counts() |
* ezin_set_section_counts() |
| */ |
*/ |
| function ezin_set_section_counts($section_id, $count_ar) /* {{{ */ |
function ezin_set_section_counts($section_id, $count_ar) /* {{{ */ |
| { |
{ |
| global $ezin_sys; |
global $ezin_sys; |
| Line 1396 function ezin_set_section_counts($sectio |
|
| Line 1396 function ezin_set_section_counts($sectio |
|
| |
|
| /* |
/* |
| * ezin_set_article_counts() |
* ezin_set_article_counts() |
| */ |
*/ |
| function ezin_set_article_counts($article_id, $count_ar) /* {{{ */ |
function ezin_set_article_counts($article_id, $count_ar) /* {{{ */ |
| { |
{ |
| global $ezin_sys; |
global $ezin_sys; |
| Line 1434 function ezin_set_article_counts($articl |
|
| Line 1434 function ezin_set_article_counts($articl |
|
| |
|
| /* |
/* |
| * ezin_update_message_count() |
* ezin_update_message_count() |
| */ |
*/ |
| |
|
| function ezin_update_message_count($article_id, $direction = 0, $count = -1) /* {{{ */ |
function ezin_update_message_count($article_id, $direction = 0, $count = -1) /* {{{ */ |
| { |
{ |
| Line 1739 function ezin_get_sources($section_id = |
|
| Line 1739 function ezin_get_sources($section_id = |
|
| global $ezin_cfg; |
global $ezin_cfg; |
| global $ezin_db_handle; |
global $ezin_db_handle; |
| $section_id = intval($section_id); |
$section_id = intval($section_id); |
| |
|
| $query = sprintf('SELECT sources.*, sections.display' |
$query = sprintf('SELECT sources.*, sections.display' |
| .' FROM %s AS sources' |
.' FROM %s AS sources' |
| .' LEFT JOIN %s AS sections' |
.' LEFT JOIN %s AS sections' |
| Line 1749 function ezin_get_sources($section_id = |
|
| Line 1749 function ezin_get_sources($section_id = |
|
| $ezin_sys['db']['tables']['sources'], |
$ezin_sys['db']['tables']['sources'], |
| $ezin_sys['db']['tables']['sections'], |
$ezin_sys['db']['tables']['sections'], |
| $section_id); |
$section_id); |
| |
|
| if ($section_id == 0) { |
if ($section_id == 0) { |
| // globalna sekcia |
// globalna sekcia |
| $query = sprintf('SELECT sources.*, sections.display' |
$query = sprintf('SELECT sources.*, sections.display' |
| Line 1856 function ezin_insert_boxes() { |
|
| Line 1856 function ezin_insert_boxes() { |
|
| global $ezin_cfg; |
global $ezin_cfg; |
| global $ezin_user; |
global $ezin_user; |
| global $ezin_db_handle; |
global $ezin_db_handle; |
| |
|
| $box_prefix = 'box_'; |
$box_prefix = 'box_'; |
| $files = ezin_get_template_files(); |
$files = ezin_get_template_files(); |
| $boxes = array(); |
$boxes = array(); |
| Line 1889 function ezin_insert_boxes() { |
|
| Line 1889 function ezin_insert_boxes() { |
|
| $result = mysqli_query($ezin_db_handle, $query) |
$result = mysqli_query($ezin_db_handle, $query) |
| or ezin_db_error('ezin_insert_boxes()'); |
or ezin_db_error('ezin_insert_boxes()'); |
| } |
} |
| mysqli_free_result($result); |
if (!is_null($result)) { |
| |
mysqli_free_result($result); |
| |
} |
| return true; |
return true; |
| } |
} |
| |
|
| Line 1984 function ezin_get_message($message_id) / |
|
| Line 1986 function ezin_get_message($message_id) / |
|
| // XXX: article/section access/template keys are missing |
// XXX: article/section access/template keys are missing |
| .' FROM '.$ezin_sys['db']['tables']['articles'].' AS articles, ' |
.' FROM '.$ezin_sys['db']['tables']['articles'].' AS articles, ' |
| .$ezin_sys['db']['tables']['authors'].' AS authors, ' |
.$ezin_sys['db']['tables']['authors'].' AS authors, ' |
| .$ezin_sys['db']['tables']['sections'].' AS sections, ' |
.$ezin_sys['db']['tables']['sections'].' AS sections, ' |
| .$ezin_sys['db']['tables']['messages'].' AS messages' |
.$ezin_sys['db']['tables']['messages'].' AS messages' |
| .' WHERE articles.author_id = authors.id ' |
.' WHERE articles.author_id = authors.id ' |
| .' AND articles.section_id = sections.id ' |
.' AND articles.section_id = sections.id ' |
| .' AND articles.id = messages.article_id ' |
.' AND articles.id = messages.article_id ' |
| Line 2026 function ezin_save_message($data) /* {{{ |
|
| Line 2028 function ezin_save_message($data) /* {{{ |
|
| $data['article_id'] = $article_id; |
$data['article_id'] = $article_id; |
| $data['parent'] = 0; |
$data['parent'] = 0; |
| } |
} |
| |
|
| $data['ip'] = ezin_get_remote_addr(true); |
$data['ip'] = ezin_get_remote_addr(true); |
| $data = ezin_db_escape($data); |
$data = ezin_db_escape($data); |
| |
|
| Line 2153 function ezin_get_poll_answer_list($poll |
|
| Line 2155 function ezin_get_poll_answer_list($poll |
|
| { |
{ |
| global $ezin_sys; |
global $ezin_sys; |
| global $ezin_db_handle; |
global $ezin_db_handle; |
| |
|
| $poll_id = intval($poll_id); |
$poll_id = intval($poll_id); |
| |
|
| $query = 'SELECT' |
$query = 'SELECT' |
| Line 2233 function ezin_poll_answer_vote($poll_ans |
|
| Line 2235 function ezin_poll_answer_vote($poll_ans |
|
| * ezin_save_feedback() |
* ezin_save_feedback() |
| */ |
*/ |
| |
|
| |
function ezin_feedback_required_items() /* {{{ */ |
| |
{ |
| |
$config = ezin_get_config(); |
| |
$items = preg_split('/\s+/', $config['feedback_required_items'] ?? ''); |
| |
$ret = array(); |
| |
foreach ($items as $item) { |
| |
$item = trim($item); |
| |
if (strlen($item) > 0) { |
| |
$ret[] = $item; |
| |
} |
| |
} |
| |
return $ret; |
| |
} /* }}} */ |
| |
|
| function ezin_save_feedback($section_id, $data) /* {{{ */ |
function ezin_save_feedback($section_id, $data) /* {{{ */ |
| { |
{ |
| global $ezin_sys; |
global $ezin_sys; |
| Line 2254 function ezin_save_feedback($section_id, |
|
| Line 2270 function ezin_save_feedback($section_id, |
|
| if ($result != false) { |
if ($result != false) { |
| $feed_id = mysqli_fetch_array($result, MYSQLI_NUM); |
$feed_id = mysqli_fetch_array($result, MYSQLI_NUM); |
| $feed_id = intval(@$feed_id[0]); |
$feed_id = intval(@$feed_id[0]); |
| mysqli_free_result(); |
mysqli_free_result($result); |
| } |
} |
| if ($feed_id <= 0) { |
if ($feed_id <= 0) { |
| ezin_db_error('ezin_save_feedback() [2]'); |
ezin_db_error('ezin_save_feedback() [2]'); |