本文整理汇总了PHP中Note::display_img方法的典型用法代码示例。如果您正苦于以下问题:PHP Note::display_img方法的具体用法?PHP Note::display_img怎么用?PHP Note::display_img使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note::display_img方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_search_result
function parse_search_result(&$result_data)
{
global $Cache, $CONFIG, $LANG, $DOWNLOAD_LANG, $CONFIG_DOWNLOAD;
$Cache->load('download');
load_module_lang('download');
$tpl = new Template('download/download_generic_results.tpl');
import('util/date');
$date = new Date(DATE_TIMESTAMP, TIMEZONE_USER, $result_data['timestamp']);
import('content/note');
$tpl->assign_vars(array('L_ADDED_ON' => sprintf($DOWNLOAD_LANG['add_on_date'], $date->format(DATE_FORMAT_TINY, TIMEZONE_USER)), 'U_LINK' => url(PATH_TO_ROOT . '/download/download.php?id=' . $result_data['id']), 'U_IMG' => $result_data['image'], 'E_TITLE' => strprotect($result_data['title']), 'TITLE' => $result_data['title'], 'SHORT_DESCRIPTION' => second_parse($result_data['short_contents']), 'L_NB_DOWNLOADS' => $DOWNLOAD_LANG['downloaded'] . ' ' . sprintf($DOWNLOAD_LANG['n_times'], $result_data['count']), 'L_NB_COMMENTS' => $result_data['nbr_com'] > 1 ? sprintf($DOWNLOAD_LANG['num_com'], $result_data['nbr_com']) : sprintf($DOWNLOAD_LANG['num_coms'], $result_data['nbr_com']), 'L_MARK' => $result_data['note'] > 0 ? Note::display_img($result_data['note'], $CONFIG_DOWNLOAD['note_max'], 5) : '<em>' . $LANG['no_note'] . '</em>'));
return $tpl->parse(TEMPLATE_STRING_MODE);
}
示例2: get_home_page
function get_home_page()
{
global $Sql, $idartcat, $User, $Cache, $Bread_crumb, $Errorh, $CAT_ARTICLES, $CONFIG_ARTICLES, $LANG;
require_once '../articles/articles_begin.php';
$tpl = new Template('articles/articles_cat.tpl');
if ($idartcat > 0) {
if (!isset($CAT_ARTICLES[$idartcat]) || $CAT_ARTICLES[$idartcat]['aprob'] == 0) {
$Errorh->handler('e_auth', E_USER_REDIRECT);
}
$cat_links = '';
foreach ($CAT_ARTICLES as $id => $array_info_cat) {
if ($CAT_ARTICLES[$idartcat]['id_left'] >= $array_info_cat['id_left'] && $CAT_ARTICLES[$idartcat]['id_right'] <= $array_info_cat['id_right'] && $array_info_cat['level'] <= $CAT_ARTICLES[$idartcat]['level']) {
$cat_links .= ' <a href="articles' . url('.php?cat=' . $id, '-' . $id . '.php') . '">' . $array_info_cat['name'] . '</a> »';
}
}
$clause_cat = " WHERE ac.id_left > '" . $CAT_ARTICLES[$idartcat]['id_left'] . "' AND ac.id_right < '" . $CAT_ARTICLES[$idartcat]['id_right'] . "' AND ac.level = '" . ($CAT_ARTICLES[$idartcat]['level'] + 1) . "' AND ac.aprob = 1";
} else {
$cat_links = '';
$clause_cat = " WHERE ac.level = '0' AND ac.aprob = 1";
}
if (!isset($CAT_ARTICLES[$idartcat]) || !$User->check_auth($CAT_ARTICLES[$idartcat]['auth'], READ_CAT_ARTICLES)) {
$Errorh->handler('e_auth', E_USER_REDIRECT);
}
$nbr_articles = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "articles WHERE visible = 1 AND idcat = '" . $idartcat . "'", __LINE__, __FILE__);
$total_cat = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "articles_cats ac " . $clause_cat, __LINE__, __FILE__);
$rewrite_title = url_encode_rewrite($CAT_ARTICLES[$idartcat]['name']);
$nbr_column_cats = $total_cat > $CONFIG_ARTICLES['nbr_column'] ? $CONFIG_ARTICLES['nbr_column'] : $total_cat;
$nbr_column_cats = !empty($nbr_column_cats) ? $nbr_column_cats : 1;
$column_width_cats = floor(100 / $nbr_column_cats);
$is_admin = $User->check_level(ADMIN_LEVEL) ? true : false;
$tpl->assign_vars(array('IDCAT' => $idartcat, 'C_IS_ADMIN' => $is_admin, 'COLUMN_WIDTH_CAT' => $column_width_cats, 'ADD_ARTICLES' => $is_admin ? (!empty($idartcat) ? '» ' : '') . '<a href="../articles/admin_articles_add.php"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/add.png" alt="" class="valign_middle" /></a>' : '', 'L_ARTICLES' => $LANG['articles'], 'L_DATE' => $LANG['date'], 'L_VIEW' => $LANG['views'], 'L_NOTE' => $LANG['note'], 'L_COM' => $LANG['com'], 'L_TOTAL_ARTICLE' => $nbr_articles > 0 ? sprintf($LANG['nbr_articles_info'], $nbr_articles) : '', 'L_NO_ARTICLES' => $nbr_articles == 0 ? $LANG['none_article'] : '', 'L_ARTICLES_INDEX' => $LANG['title_articles'], 'L_CATEGORIES' => $CAT_ARTICLES[$idartcat]['level'] >= 0 ? $LANG['sub_categories'] : $LANG['categories'], 'U_ARTICLES_CAT_LINKS' => trim($cat_links, ' »'), 'U_ARTICLES_ALPHA_TOP' => url('.php?sort=alpha&mode=desc&cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=alpha&mode=desc'), 'U_ARTICLES_ALPHA_BOTTOM' => url('.php?sort=alpha&mode=asc&cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=alpha&mode=asc'), 'U_ARTICLES_DATE_TOP' => url('.php?sort=date&mode=desc&cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=date&mode=desc'), 'U_ARTICLES_DATE_BOTTOM' => url('.php?sort=date&mode=asc&cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=date&mode=asc'), 'U_ARTICLES_VIEW_TOP' => url('.php?sort=view&mode=desc&cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=view&mode=desc'), 'U_ARTICLES_VIEW_BOTTOM' => url('.php?sort=view&mode=asc&cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=view&mode=asc'), 'U_ARTICLES_NOTE_TOP' => url('.php?sort=note&mode=desc&cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=note&mode=desc'), 'U_ARTICLES_NOTE_BOTTOM' => url('.php?sort=note&mode=asc&cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=note&mode=asc'), 'U_ARTICLES_COM_TOP' => url('.php?sort=com&mode=desc&cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=com&mode=desc'), 'U_ARTICLES_COM_BOTTOM' => url('.php?sort=com&mode=asc&cat=' . $idartcat, '-' . $idartcat . '+' . $rewrite_title . '.php?sort=com&mode=asc')));
$get_sort = retrieve(GET, 'sort', '');
switch ($get_sort) {
case 'alpha':
$sort = 'title';
break;
case 'date':
$sort = 'timestamp';
break;
case 'view':
$sort = 'views';
break;
case 'note':
$sort = 'note/' . $CONFIG_ARTICLES['note_max'];
break;
case 'com':
$sort = 'nbr_com';
break;
default:
$sort = 'timestamp';
}
$get_mode = retrieve(GET, 'mode', '');
$mode = $get_mode == 'asc' ? 'ASC' : 'DESC';
$unget = !empty($get_sort) && !empty($mode) ? '?sort=' . $get_sort . '&mode=' . $get_mode : '';
import('util/pagination');
$Pagination = new Pagination();
$unauth_cats_sql = array();
foreach ($CAT_ARTICLES as $id => $key) {
if (!$User->check_auth($CAT_ARTICLES[$id]['auth'], READ_CAT_ARTICLES)) {
$unauth_cats_sql[] = $id;
}
}
$nbr_unauth_cats = count($unauth_cats_sql);
$clause_unauth_cats = $nbr_unauth_cats > 0 ? " AND ac.id NOT IN (" . implode(', ', $unauth_cats_sql) . ")" : '';
##### Catégories disponibles #####
if ($total_cat > 0) {
$tpl->assign_vars(array('C_ARTICLES_CAT' => true, 'PAGINATION_CAT' => $Pagination->display('articles' . url('.php' . (!empty($unget) ? $unget . '&' : '?') . 'cat=' . $idartcat . '&pcat=%d', '-' . $idartcat . '-0+' . $rewrite_title . '.php?pcat=%d' . $unget), $total_cat, 'pcat', $CONFIG_ARTICLES['nbr_cat_max'], 3)));
$i = 0;
$result = $Sql->query_while("SELECT ac.id, ac.name, ac.contents, ac.icon, ac.nbr_articles_visible AS nbr_articles\n\t\t\tFROM " . PREFIX . "articles_cats ac\n\t\t\t" . $clause_cat . $clause_unauth_cats . "\n\t\t\tORDER BY ac.id_left\n\t\t\t" . $Sql->limit($Pagination->get_first_msg($CONFIG_ARTICLES['nbr_cat_max'], 'pcat'), $CONFIG_ARTICLES['nbr_cat_max']), __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
$tpl->assign_block_vars('cat_list', array('IDCAT' => $row['id'], 'CAT' => $row['name'], 'DESC' => $row['contents'], 'ICON_CAT' => !empty($row['icon']) ? '<a href="articles' . url('.php?cat=' . $row['id'], '-' . $row['id'] . '+' . url_encode_rewrite($row['name']) . '.php') . '"><img src="' . $row['icon'] . '" alt="" class="valign_middle" /></a><br />' : '', 'EDIT' => $is_admin ? '<a href="admin_articles_cat.php?id=' . $row['id'] . '"><img class="valign_middle" src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/edit.png" alt="" /></a>' : '', 'L_NBR_ARTICLES' => sprintf($LANG['nbr_articles_info'], $row['nbr_articles']), 'U_CAT' => url('.php?cat=' . $row['id'], '-' . $row['id'] . '+' . url_encode_rewrite($row['name']) . '.php')));
}
$Sql->query_close($result);
}
##### Affichage des articles #####
if ($nbr_articles > 0) {
$tpl->assign_vars(array('C_ARTICLES_LINK' => true, 'PAGINATION' => $Pagination->display('articles' . url('.php' . (!empty($unget) ? $unget . '&' : '?') . 'cat=' . $idartcat . '&p=%d', '-' . $idartcat . '-0-%d+' . $rewrite_title . '.php' . $unget), $nbr_articles, 'p', $CONFIG_ARTICLES['nbr_articles_max'], 3), 'CAT' => $CAT_ARTICLES[$idartcat]['name']));
import('content/note');
$result = $Sql->query_while("SELECT id, title, icon, timestamp, views, note, nbrnote, nbr_com\n\t\t\tFROM " . PREFIX . "articles\n\t\t\tWHERE visible = 1 AND idcat = '" . $idartcat . "'\n\t\t\tORDER BY " . $sort . " " . $mode . $Sql->limit($Pagination->get_first_msg($CONFIG_ARTICLES['nbr_articles_max'], 'p'), $CONFIG_ARTICLES['nbr_articles_max']), __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
$fichier = strlen($row['title']) > 45 ? substr(html_entity_decode($row['title'], ENT_COMPAT, 'ISO-8859-1'), 0, 45) . '...' : $row['title'];
$tpl->assign_block_vars('articles', array('NAME' => $row['title'], 'ICON' => !empty($row['icon']) ? '<a href="articles' . url('.php?id=' . $row['id'] . '&cat=' . $idartcat, '-' . $idartcat . '-' . $row['id'] . '+' . url_encode_rewrite($fichier) . '.php') . '"><img src="' . $row['icon'] . '" alt="" class="valign_middle" /></a>' : '', 'CAT' => $CAT_ARTICLES[$idartcat]['name'], 'DATE' => gmdate_format('date_format_short', $row['timestamp']), 'COMPT' => $row['views'], 'NOTE' => $row['nbrnote'] > 0 ? Note::display_img($row['note'], $CONFIG_ARTICLES['note_max'], 5) : '<em>' . $LANG['no_note'] . '</em>', 'COM' => $row['nbr_com'], 'U_ARTICLES_LINK' => url('.php?id=' . $row['id'] . '&cat=' . $idartcat, '-' . $idartcat . '-' . $row['id'] . '+' . url_encode_rewrite($fichier) . '.php')));
}
$Sql->query_close($result);
}
return $tpl->parse(TRUE);
}
示例3: retrieve
$sort = 'nbr_com';
break;
default:
$sort = 'timestamp';
}
$get_mode = retrieve(GET, 'mode', '');
$mode = $get_mode == 'asc' ? 'ASC' : 'DESC';
$unget = !empty($get_sort) && !empty($mode) ? '?sort=' . $get_sort . '&mode=' . $get_mode : '';
import('util/pagination');
$Pagination = new Pagination();
$Template->assign_vars(array('PAGINATION' => $Pagination->display('web' . url('.php' . (!empty($unget) ? $unget . '&' : '?') . 'cat=' . $idcat . '&p=%d', '-' . $idcat . '-0-%d.php' . (!empty($unget) ? '?' . $unget : '')), $nbr_web, 'p', $CONFIG_WEB['nbr_web_max'], 3)));
import('content/note');
$result = $Sql->query_while("SELECT id, title, timestamp, compt, note, nbrnote, nbr_com\n\tFROM " . PREFIX . "web\n\tWHERE aprob = 1 AND idcat = '" . $idcat . "'\n\tORDER BY " . $sort . " " . $mode . $Sql->limit($Pagination->get_first_msg($CONFIG_WEB['nbr_web_max'], 'p'), $CONFIG_WEB['nbr_web_max']), __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
$row['title'] = strlen($row['title']) > 45 ? substr(html_entity_decode($row['title'], ENT_COMPAT, 'ISO-8859-1'), 0, 45) . '...' : $row['title'];
$Template->assign_block_vars('web', array('NAME' => $row['title'], 'CAT' => $CAT_WEB[$idcat]['name'], 'DATE' => gmdate_format('date_format_short', $row['timestamp']), 'COMPT' => $row['compt'], 'NOTE' => $row['nbrnote'] > 0 ? Note::display_img($row['note'], $CONFIG_WEB['note_max']) : '<em>' . $LANG['no_note'] . '</em>', 'COM' => $row['nbr_com'], 'U_WEB_LINK' => url('.php?cat=' . $idcat . '&id=' . $row['id'], '-' . $idcat . '-' . $row['id'] . '.php')));
}
$Sql->query_close($result);
$Template->pparse('web');
} else {
$Template->set_filenames(array('web' => 'web/web.tpl'));
$total_link = $Sql->query("SELECT COUNT(*) FROM " . PREFIX . "web_cat wc\n\tLEFT JOIN " . PREFIX . "web w ON w.idcat = wc.id\n\tWHERE w.aprob = 1 AND wc.aprob = 1 AND wc.secure <= '" . $User->get_attribute('level') . "'", __LINE__, __FILE__);
$total_cat = $Sql->query("SELECT COUNT(*) as compt FROM " . PREFIX . "web_cat WHERE aprob = 1 AND secure <= '" . $User->get_attribute('level') . "'", __LINE__, __FILE__);
import('util/pagination');
$Pagination = new Pagination();
$CONFIG_WEB['nbr_column'] = $total_cat > $CONFIG_WEB['nbr_column'] ? $CONFIG_WEB['nbr_column'] : $total_cat;
$CONFIG_WEB['nbr_column'] = !empty($CONFIG_WEB['nbr_column']) ? $CONFIG_WEB['nbr_column'] : 1;
$Template->assign_vars(array('C_WEB_CAT' => true, 'C_IS_ADMIN' => $User->check_level(ADMIN_LEVEL), 'PAGINATION' => $Pagination->display('web' . url('.php?p=%d', '-0-0-%d.php'), $total_cat, 'p', $CONFIG_WEB['nbr_cat_max'], 3), 'TOTAL_FILE' => $total_link, 'L_CATEGORIES' => $LANG['categories'], 'L_PROPOSE_LINK' => $LANG['propose_link'], 'L_HOW_LINK' => $LANG['how_link'], 'U_WEB_ADD' => url('.php?web=true')));
$column_width = floor(100 / $CONFIG_WEB['nbr_column']);
$result = $Sql->query_while("SELECT aw.id, aw.name, aw.contents, aw.icon, COUNT(w.id) as count\n\tFROM " . PREFIX . "web_cat aw\n\tLEFT JOIN " . PREFIX . "web w ON w.idcat = aw.id AND w.aprob = 1\n\tWHERE aw.aprob = 1 AND aw.secure <= '" . $User->get_attribute('level') . "'\n\tGROUP BY aw.id\n\tORDER BY aw.class\n\t" . $Sql->limit($Pagination->get_first_msg($CONFIG_WEB['nbr_cat_max'], 'p'), $CONFIG_WEB['nbr_cat_max']), __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
示例4: str_replace
$sort = 'note';
$selected_fields['note'] = ' selected="selected"';
break;
default:
$sort = 'timestamp';
$selected_fields['date'] = ' selected="selected"';
}
$mode = $get_mode == 'asc' ? 'ASC' : 'DESC';
if ($mode == 'ASC') {
$selected_fields['asc'] = ' selected="selected"';
} else {
$selected_fields['desc'] = ' selected="selected"';
}
$unget = !empty($get_sort) && !empty($mode) ? '?sort=' . $get_sort . '&mode=' . $get_mode : '';
$Template->assign_vars(array('L_FILE' => $DOWNLOAD_LANG['file'], 'L_ALPHA' => $DOWNLOAD_LANG['sort_alpha'], 'L_SIZE' => $LANG['size'], 'L_DATE' => $LANG['date'], 'L_DOWNLOAD' => $DOWNLOAD_LANG['download'], 'L_POPULARITY' => $DOWNLOAD_LANG['popularity'], 'L_DESC' => $LANG['desc'], 'L_ASC' => $LANG['asc'], 'L_NOTE' => $LANG['note'], 'L_ORDER_BY' => $DOWNLOAD_LANG['order_by'], 'L_CONFIRM_DELETE_FILE' => str_replace('\'', '\\\'', $DOWNLOAD_LANG['confirm_delete_file']), 'SELECTED_ALPHA' => $selected_fields['alpha'], 'SELECTED_SIZE' => $selected_fields['size'], 'SELECTED_DATE' => $selected_fields['date'], 'SELECTED_HITS' => $selected_fields['hits'], 'SELECTED_NOTE' => $selected_fields['note'], 'SELECTED_ASC' => $selected_fields['asc'], 'SELECTED_DESC' => $selected_fields['desc']));
import('util/pagination');
$Pagination = new Pagination();
import('content/note');
import('content/comments');
$Template->assign_vars(array('PAGINATION' => $Pagination->display(url('download.php' . (!empty($unget) ? $unget . '&' : '?') . 'cat=' . $category_id . '&p=%d', 'category-' . $category_id . '-%d.php' . $unget), $nbr_files, 'p', $CONFIG_DOWNLOAD['nbr_file_max'], 3), 'C_FILES' => true, 'TARGET_ON_CHANGE_ORDER' => $CONFIG['rewrite'] ? 'category-' . $category_id . '.php?' : 'download.php?cat=' . $category_id . '&'));
$result = $Sql->query_while("SELECT id, title, timestamp, size, count, note, nbrnote, nbr_com, image, short_contents\n\t\tFROM " . PREFIX . "download\n\t\tWHERE visible = 1 AND approved = 1 AND idcat = '" . $category_id . "'\n\t\tORDER BY " . $sort . " " . $mode . $Sql->limit($Pagination->get_first_msg($CONFIG_DOWNLOAD['nbr_file_max'], 'p'), $CONFIG_DOWNLOAD['nbr_file_max']), __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
$Template->assign_block_vars('file', array('NAME' => $row['title'], 'IMG_NAME' => str_replace('"', '\\"', $row['title']), 'C_DESCRIPTION' => !empty($row['short_contents']), 'DESCRIPTION' => second_parse($row['short_contents']), 'DATE' => sprintf($DOWNLOAD_LANG['add_on_date'], gmdate_format('date_format_short', $row['timestamp'])), 'COUNT_DL' => sprintf($DOWNLOAD_LANG['downloaded_n_times'], $row['count']), 'NOTE' => $row['nbrnote'] > 0 ? Note::display_img($row['note'], $CONFIG_DOWNLOAD['note_max'], 5) : '<em>' . $LANG['no_note'] . '</em>', 'SIZE' => $row['size'] >= 1 ? number_round($row['size'], 1) . ' ' . $LANG['unit_megabytes'] : number_round($row['size'], 1) * 1024 . ' ' . $LANG['unit_kilobytes'], 'C_IMG' => !empty($row['image']), 'IMG' => $row['image'], 'U_DOWNLOAD_LINK' => url('download.php?id=' . $row['id'], 'download-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php'), 'U_ADMIN_EDIT_FILE' => url('management.php?edit=' . $row['id']), 'U_ADMIN_DELETE_FILE' => url('management.php?del=' . $row['id'] . '&token=' . $Session->get_token()), 'U_COM_LINK' => Comments::com_display_link($row['nbr_com'], '../download/download' . url('.php?id=' . $row['id'] . '&com=0', '-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php?com=0'), $row['id'], 'download')));
}
$Sql->query_close($result);
} else {
$Template->assign_vars(array('L_NO_FILE_THIS_CATEGORY' => $DOWNLOAD_LANG['none_download'], 'C_NO_FILE' => true));
}
$Template->pparse('download');
}
require_once '../kernel/footer.php';
示例5: str_replace
break;
}
if ($mode == 'ASC') {
$selected_fields['asc'] = ' selected="selected"';
} else {
$selected_fields['desc'] = ' selected="selected"';
}
$Template->assign_vars(array('L_ALPHA' => $MEDIA_LANG['sort_title'], 'L_DATE' => $LANG['date'], 'L_NBR' => $MEDIA_LANG['sort_popularity'], 'L_NOTE' => $LANG['note'], 'L_COM' => $LANG['com'], 'L_DESC' => $LANG['desc'], 'L_ASC' => $LANG['asc'], 'L_ORDER_BY' => $LANG['orderby'], 'L_CONFIRM_DELETE_FILE' => str_replace('\'', '\\\'', $MEDIA_LANG['confirm_delete_media']), 'SELECTED_ALPHA' => $selected_fields['alpha'], 'SELECTED_DATE' => $selected_fields['date'], 'SELECTED_NBR' => $selected_fields['nbr'], 'SELECTED_NOTE' => $selected_fields['note'], 'SELECTED_COM' => $selected_fields['com'], 'SELECTED_ASC' => $selected_fields['asc'], 'SELECTED_DESC' => $selected_fields['desc'], 'A_COM' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_COM) !== 0, 'A_NOTE' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_NOTE) !== 0, 'A_USER' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_USER) !== 0, 'A_COUNTER' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_COUNT) !== 0, 'A_DATE' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_DATE) !== 0, 'A_DESC' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_DESC) !== 0, 'A_BLOCK' => ($MEDIA_CATS[$id_cat]['active'] & MEDIA_DL_DATE + MEDIA_DL_COUNT + MEDIA_DL_COM + MEDIA_DL_NOTE + MEDIA_DL_USER) !== 0));
import('util/pagination');
$Pagination = new Pagination();
import('content/note');
import('content/comments');
$Template->assign_vars(array('PAGINATION' => $Pagination->display(url('media.php' . (!empty($unget) ? $unget . '&' : '?') . 'cat=' . $id_cat . '&p=%d', 'media-0-' . $id_cat . '-%d' . '+' . url_encode_rewrite($MEDIA_CATS[$id_cat]['name']) . '.php' . $unget), $MEDIA_CATS[$id_cat]['num_media'], 'p', $MEDIA_CONFIG['pagin'], 3), 'C_FILES' => true, 'TARGET_ON_CHANGE_ORDER' => $CONFIG['rewrite'] ? 'media-0-' . $id_cat . '.php?' : 'media.php?cat=' . $id_cat . '&'));
$result = $Sql->query_while("SELECT v.id, v.iduser, v.name, v.timestamp, v.counter, v.note, v.nbrnote, v.nbr_com, v.infos, v.contents, mb.login, mb.level\n\t\t\tFROM " . PREFIX . "media AS v\n\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " AS mb ON v.iduser = mb.user_id\n\t\t\tWHERE idcat = '" . $id_cat . "' AND infos = '" . MEDIA_STATUS_APROBED . "'\n\t\t\tORDER BY " . $sort . " " . $mode . $Sql->limit($Pagination->get_first_msg($MEDIA_CONFIG['pagin'], 'p'), $MEDIA_CONFIG['pagin']), __LINE__, __FILE__);
while ($row = $Sql->fetch_assoc($result)) {
$Template->assign_block_vars('file', array('NAME' => $row['name'], 'IMG_NAME' => str_replace('"', '\\"', $row['name']), 'C_DESCRIPTION' => !empty($row['contents']), 'DESCRIPTION' => second_parse($row['contents']), 'POSTER' => !empty($row['login']) ? sprintf($MEDIA_LANG['media_added_by'], $row['login'], '../member/member' . url('.php?id=' . $row['iduser'], '-' . $row['iduser'] . '.php'), $level[$row['level']]) : $LANG['guest'], 'DATE' => sprintf($MEDIA_LANG['add_on_date'], gmdate_format('date_format_short', $row['timestamp'])), 'COUNT' => sprintf($MEDIA_LANG['view_n_times'], $row['counter']), 'NOTE' => $row['nbrnote'] ? Note::display_img($row['note'], $MEDIA_CONFIG['note_max'], $MEDIA_CONFIG['note_max']) : '<em>' . $LANG['no_note'] . '</em>', 'U_MEDIA_LINK' => url('media.php?id=' . $row['id'], 'media-' . $row['id'] . '-' . $id_cat . '+' . url_encode_rewrite($row['name']) . '.php'), 'U_ADMIN_UNVISIBLE_MEDIA' => url('media_action.php?unvisible=' . $row['id'] . '&token=' . $Session->get_token()), 'U_ADMIN_EDIT_MEDIA' => url('media_action.php?edit=' . $row['id']), 'U_ADMIN_DELETE_MEDIA' => url('media_action.php?del=' . $row['id'] . '&token=' . $Session->get_token()), 'U_COM_LINK' => Comments::com_display_link($row['nbr_com'], '../media/media' . url('.php?id=' . $row['id'] . '&com=0', '-' . $row['id'] . '-' . $id_cat . '+' . url_encode_rewrite($row['name']) . '.php?com=0'), $row['id'], 'media')));
}
$Sql->query_close($result);
} else {
$Template->assign_vars(array('L_NO_FILE_THIS_CATEGORY' => $MEDIA_LANG['none_media'], 'C_NO_FILE' => true));
}
} elseif ($id_media > 0) {
$result = $Sql->query_while("SELECT v.*, mb.login, mb.level\tFROM " . PREFIX . "media AS v LEFT JOIN " . DB_TABLE_MEMBER . " AS mb ON v.iduser = mb.user_id\tWHERE id = '" . $id_media . "'", __LINE__, __FILE__);
$media = $Sql->fetch_assoc($result);
$Sql->query_close($result);
if (empty($media) || ($media['infos'] & MEDIA_STATUS_UNVISIBLE) !== 0) {
$Errorh->handler('e_unexist_media', E_USER_REDIRECT);
exit;
} elseif (!$User->check_auth($MEDIA_CATS[$media['idcat']]['auth'], MEDIA_AUTH_READ)) {
$Errorh->handler('e_auth', E_USER_REDIRECT);
exit;