voici le fichier // fetch categories and subcategories
if(!isset($show_nocategory))
{
$request = $smcFunc['db_query']('', '
SELECT DISTINCT var.id as id, var.value1 as name, var.value2 as parent
FROM {db_prefix}tp_variables AS var
WHERE var.type = {string:type}
{string:whereval}
ORDER BY parent, id DESC',
array('type' => 'category', 'whereval' => isset($where) ? 'AND var.value2 = ' . $where : '')
);
if($smcFunc['db_num_rows']($request) > 0)
{
$context['TPortal']['basecats'] = isset($where) ? array($where) : array('0', '9999');
$cats = array();
$context['TPortal']['cats'] = array();
$sorted = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$row['name'] = html_entity_decode($row['name'], ENT_QUOTES, $context['character_set']);
$sorted[$row['id']] = $row;
$cats[] = $row['id'];
}
$smcFunc['db_free_result']($request);
if(count($sorted) > 1)
$context['TPortal']['cats'] = chain('id', 'parent', 'name', $sorted);
else
$context['TPortal']['cats'] = $sorted;
}
}
if(isset($show_submission) && $context['TPortal']['total_submissions'] > 0)
{
// clean up notices
$request2 = $smcFunc['db_query']('', '
SELECT id, value5
FROM {db_prefix}tp_variables
WHERE type = {string:type}',
array('type' => 'art_not_approved')
);
if($smcFunc['db_num_rows']($request2) > 0)
{
$ids = array();
while($row = $smcFunc['db_fetch_assoc']($request2))
$ids[$row['id']] = $row['value5'];
$smcFunc['db_free_result']($request2);
}
$request = $smcFunc['db_query']('', '
SELECT id, approved
FROM {db_prefix}tp_articles
WHERE FIND_IN_SET(id, {array_int:ids})',
array('ids' => $ids)
);
if($smcFunc['db_num_rows']($request) > 0)
{
while($row = $smcFunc['db_fetch_assoc']($request))
{
}
$smcFunc['db_free_result']($request);
}