Beispiel #1
0
    } elseif (!$no_alert_on_error) {
        global $Errorh;
        $Errorh->handler('Le module <strong>' . $module_name . '</strong> n\'a pas de fonction get_home_page!', E_USER_ERROR, __LINE__, __FILE__);
        exit;
    }
} elseif (!empty($idnews)) {
    if (empty($news['id'])) {
        $Errorh->handler('e_unexist_news', E_USER_REDIRECT);
    }
    import('content/comments');
    import('content/syndication/feed');
    $tpl_news = new Template('news/news.tpl');
    $next_news = $Sql->query_array(PREFIX . "news", "title", "id", "WHERE visible = 1 AND id > '" . $idnews . "' " . $Sql->limit(0, 1), __LINE__, __FILE__);
    $previous_news = $Sql->query_array(PREFIX . "news", "title", "id", "WHERE visible = 1 AND id < '" . $idnews . "' ORDER BY id DESC " . $Sql->limit(0, 1), __LINE__, __FILE__);
    $tpl_news->assign_vars(array('C_IS_ADMIN' => $is_admin, 'C_NEWS_BLOCK' => true, 'C_NEWS_NAVIGATION_LINKS' => true, 'C_PREVIOUS_NEWS' => !empty($previous_news['id']), 'C_NEXT_NEWS' => !empty($next_news['id']), 'TOKEN' => $Session->get_token(), 'PREVIOUS_NEWS' => $previous_news['title'], 'NEXT_NEWS' => $next_news['title'], 'U_PREVIOUS_NEWS' => url('.php?id=' . $previous_news['id'], '-0-' . $previous_news['id'] . '+' . url_encode_rewrite($previous_news['title']) . '.php'), 'U_NEXT_NEWS' => url('.php?id=' . $next_news['id'], '-0-' . $next_news['id'] . '+' . url_encode_rewrite($next_news['title']) . '.php'), 'L_SYNDICATION' => $LANG['syndication'], 'L_ALERT_DELETE_NEWS' => $LANG['alert_delete_news'], 'L_ON' => $LANG['on'], 'L_DELETE' => $LANG['delete'], 'L_EDIT' => $LANG['edit']));
    $tpl_news->assign_block_vars('news', array('C_IMG' => !empty($news['img']), 'C_ICON' => !empty($news['icon']) && $CONFIG_NEWS['activ_icon'] == 1, 'ID' => $news['id'], 'IDCAT' => $news['idcat'], 'ICON' => second_parse_url($news['icon']), 'TITLE' => $news['title'], 'CONTENTS' => second_parse($news['contents']), 'EXTEND_CONTENTS' => second_parse($news['extend_contents']) . '<br /><br />', 'IMG' => second_parse_url($news['img']), 'IMG_DESC' => $news['alt'], 'PSEUDO' => $CONFIG_NEWS['display_author'] ? $news['login'] : '', 'DATE' => $CONFIG_NEWS['display_date'] ? $LANG['on'] . ': ' . gmdate_format('date_format_short', $news['timestamp']) : '', 'U_COM' => $CONFIG_NEWS['activ_com'] == 1 ? Comments::com_display_link($news['nbr_com'], '../news/news' . url('.php?cat=0&amp;id=' . $idnews . '&amp;com=0', '-0-' . $idnews . '+' . url_encode_rewrite($news['title']) . '.php?com=0'), $idnews, 'news') : '', 'U_USER_ID' => url('.php?id=' . $news['user_id'], '-' . $news['user_id'] . '.php'), 'U_NEWS_LINK' => url('.php?id=' . $news['id'], '-0-' . $news['id'] . '+' . url_encode_rewrite($news['title']) . '.php'), 'FEED_MENU' => Feed::get_feed_menu(FEED_URL)));
} elseif (!empty($idcat)) {
    $tpl_news = new Template('news/news_cat.tpl');
    $cat = $Sql->query_array(PREFIX . 'news_cat', 'id', 'name', 'icon', "WHERE id = '" . $idcat . "'", __LINE__, __FILE__);
    if (empty($cat['id'])) {
        $Errorh->handler('error_unexist_cat', E_USER_REDIRECT);
    }
    $tpl_news->assign_vars(array('C_IS_ADMIN' => $is_admin, 'C_NEWS_LINK' => true, 'CAT_NAME' => $cat['name'], 'IDCAT' => $cat['id'], 'L_EDIT' => $LANG['edit'], 'L_CATEGORY' => $LANG['category']));
    $result = $Sql->query_while("SELECT n.id, n.title, n.nbr_com, nc.id AS idcat, nc.icon\n\tFROM " . PREFIX . "news n\n\tLEFT JOIN " . PREFIX . "news_cat nc ON nc.id = n.idcat\n\tWHERE n.visible = 1 AND n.idcat = '" . $idcat . "'\n\tORDER BY n.timestamp DESC", __LINE__, __FILE__);
    while ($row = $Sql->fetch_assoc($result)) {
        $tpl_news->assign_block_vars('list', array('ICON' => !empty($row['icon']) && $CONFIG_NEWS['activ_icon'] == 1 ? '<a href="news' . url('.php?cat=' . $row['idcat'], '-' . $row['idcat'] . '.php') . '"><img class="valign_middle" src="' . $row['icon'] . '" alt="" /></a>' : '', 'TITLE' => $row['title'], 'COM' => $row['nbr_com'], 'U_NEWS' => 'news' . url('.php?id=' . $row['id'], '-0-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php')));
    }
}
if (isset($_GET['com']) && $idnews > 0) {
    $tpl_news->assign_vars(array('COMMENTS' => display_comments('news', $idnews, url('news.php?id=' . $idnews . '&amp;com=%s', 'news-0-' . $idnews . '.php?com=%s'))));
}
Beispiel #2
0
 $id_cat_for_download = (int) $info_file['idcat'];
 while ($id_cat_for_download > 0) {
     $Bread_crumb->add($DOWNLOAD_CATS[$id_cat_for_download]['name'], url('download.php?cat=' . $id_cat_for_download, 'category-' . $id_cat_for_download . '+' . url_encode_rewrite($DOWNLOAD_CATS[$id_cat_for_download]['name']) . '.php'));
     if (!empty($DOWNLOAD_CATS[$id_cat_for_download]['auth'])) {
         $auth_read = $auth_read && $User->check_auth($DOWNLOAD_CATS[$id_cat_for_download]['auth'], DOWNLOAD_READ_CAT_AUTH_BIT);
     }
     $id_cat_for_download = (int) $DOWNLOAD_CATS[$id_cat_for_download]['id_parent'];
 }
 if (!$auth_read) {
     $Errorh->handler('e_auth', E_USER_REDIRECT);
 }
 if (empty($info_file['url'])) {
     $Errorh->handler('e_unexist_file_download', E_USER_REDIRECT);
 }
 if ($info_file['force_download'] == DOWNLOAD_FORCE_DL && strpos($info_file['url'], '://') === false) {
     $info_file['url'] = second_parse_url($info_file['url']);
     $filesize = @filesize($info_file['url']);
     $filesize = $filesize !== false ? $filesize : (!empty($info_file) ? number_round($info_file['size'] * 1048576, 0) : false);
     if ($filesize !== false) {
         header('Content-Length: ' . $filesize);
     }
     header('content-type:application/force-download');
     header('Content-Disposition:attachment;filename="' . substr(strrchr($info_file['url'], '/'), 1) . '"');
     header('Expires:0');
     header('Cache-Control:must-revalidate');
     header('Pragma:public');
     if (@readfile($info_file['url']) === false) {
         redirect($info_file['url']);
     }
 } else {
     redirect($info_file['url']);
 function get_home_page()
 {
     global $User, $Sql, $Cache, $Bread_crumb, $CONFIG_NEWS, $LANG, $Session;
     require_once PATH_TO_ROOT . '/news/news_begin.php';
     $show_archive = retrieve(GET, 'arch', false);
     $is_admin = $User->check_level(ADMIN_LEVEL);
     $tpl_news = new Template('news/news.tpl');
     if ($CONFIG_NEWS['activ_edito'] == 1) {
         $tpl_news->assign_vars(array('C_NEWS_EDITO' => true, 'CONTENTS' => second_parse($CONFIG_NEWS['edito']), 'TITLE' => $CONFIG_NEWS['edito_title']));
     }
     import('content/comments');
     import('content/syndication/feed');
     import('util/pagination');
     $Pagination = new Pagination();
     if ($CONFIG_NEWS['activ_pagin'] == '1') {
         $show_pagin = $Pagination->display(PATH_TO_ROOT . '/news/news' . url('.php?p=%d', '-0-0-%d.php'), $CONFIG_NEWS['nbr_news'], 'p', $CONFIG_NEWS['pagination_news'], 3);
         $first_msg = $Pagination->get_first_msg($CONFIG_NEWS['pagination_news'], 'p');
     } elseif ($show_archive) {
         $show_pagin = $Pagination->display(PATH_TO_ROOT . '/news/news' . url('.php?arch=1&amp;p=%d', '-0-0-%d.php?arch=1'), $CONFIG_NEWS['nbr_news'] - $CONFIG_NEWS['pagination_news'], 'p', $CONFIG_NEWS['pagination_arch'], 3);
         $first_msg = $CONFIG_NEWS['pagination_news'] + $Pagination->get_first_msg($CONFIG_NEWS['pagination_arch'], 'p');
         $CONFIG_NEWS['pagination_news'] = $CONFIG_NEWS['pagination_arch'];
     } else {
         $show_pagin = $CONFIG_NEWS['nbr_news'] > $CONFIG_NEWS['pagination_news'] && $CONFIG_NEWS['nbr_news'] != 0 ? '<a href="' . PATH_TO_ROOT . '/news/news.php?arch=1" title="' . $LANG['display_archive'] . '">' . $LANG['display_archive'] . '</a>' : '';
         $first_msg = 0;
     }
     $tpl_news->assign_vars(array('C_IS_ADMIN' => $is_admin, 'C_NEWS_NAVIGATION_LINKS' => false, 'L_SYNDICATION' => $LANG['syndication'], 'PAGINATION' => $show_pagin, 'L_ALERT_DELETE_NEWS' => $LANG['alert_delete_news'], 'L_LAST_NEWS' => !$show_archive ? $LANG['last_news'] : $LANG['archive'], 'PATH_TO_ROOT' => TPL_PATH_TO_ROOT, 'THEME' => get_utheme(), 'FEED_MENU' => Feed::get_feed_menu(FEED_URL)));
     if ($CONFIG_NEWS['type'] == 1 && !$show_archive) {
         $tpl_news->assign_vars(array('C_NEWS_BLOCK' => true));
         $column = $CONFIG_NEWS['nbr_column'] > 1 ? true : false;
         if ($column) {
             $i = 0;
             $CONFIG_NEWS['nbr_column'] = !empty($CONFIG_NEWS['nbr_column']) ? $CONFIG_NEWS['nbr_column'] : 1;
             $column_width = floor(100 / $CONFIG_NEWS['nbr_column']);
             $tpl_news->assign_vars(array('C_NEWS_BLOCK_COLUMN' => true, 'COLUMN_WIDTH' => $column_width));
         }
         $z = 0;
         list($admin, $del) = array('', '');
         $result = $Sql->query_while("SELECT n.contents, n.extend_contents, n.title, n.id, n.timestamp, n.user_id, n.img, n.alt, n.nbr_com, nc.id AS idcat, nc.icon, m.login\n\t\t\tFROM " . PREFIX . "news n\n\t\t\tLEFT JOIN " . PREFIX . "news_cat nc ON nc.id = n.idcat\n\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = n.user_id\n\t\t\tWHERE '" . time() . "' >= n.start AND ('" . time() . "' <= n.end OR n.end = 0) AND n.visible = 1\n\t\t\tORDER BY n.timestamp DESC\n\t\t\t" . $Sql->limit($first_msg, $CONFIG_NEWS['pagination_news']), __LINE__, __FILE__);
         while ($row = $Sql->fetch_assoc($result)) {
             $new_row = false;
             if ($column) {
                 $new_row = $i % $CONFIG_NEWS['nbr_column'] == 0 && $i > 0;
                 $i++;
             }
             $tpl_news->assign_block_vars('news', array('C_IMG' => !empty($row['img']), 'C_ICON' => !empty($row['icon']) && $CONFIG_NEWS['activ_icon'] == 1, 'C_NEWS_ROW' => $new_row, 'ID' => $row['id'], 'IDCAT' => $row['idcat'], 'ICON' => second_parse_url($row['icon']), 'TITLE' => $row['title'], 'CONTENTS' => second_parse($row['contents']), 'EXTEND_CONTENTS' => !empty($row['extend_contents']) ? '<a style="font-size:10px" href="' . PATH_TO_ROOT . '/news/news' . url('.php?id=' . $row['id'], '-0-' . $row['id'] . '.php') . '">[' . $LANG['extend_contents'] . ']</a><br /><br />' : '', 'IMG' => second_parse_url($row['img']), 'IMG_DESC' => $row['alt'], 'PSEUDO' => $CONFIG_NEWS['display_author'] ? $row['login'] : '', 'DATE' => $CONFIG_NEWS['display_date'] ? $LANG['on'] . ': ' . gmdate_format('date_format_short', $row['timestamp']) : '', 'TOKEN' => $Session->get_token(), 'U_COM' => $CONFIG_NEWS['activ_com'] == 1 ? Comments::com_display_link($row['nbr_com'], PATH_TO_ROOT . '/news/news' . url('.php?cat=0&amp;id=' . $row['id'] . '&amp;com=0', '-0-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php?com=0'), $row['id'], 'news') : '', 'NEW_ROW' => $new_row, 'U_USER_ID' => url('.php?id=' . $row['user_id'], '-' . $row['user_id'] . '.php'), 'U_NEWS_LINK' => url('.php?id=' . $row['id'], '-0-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php'), 'FEED_MENU' => Feed::get_feed_menu(FEED_URL)));
             $z++;
         }
         $Sql->query_close($result);
         if ($z == 0) {
             $tpl_news->assign_vars(array('C_NEWS_NO_AVAILABLE' => true, 'L_NO_NEWS_AVAILABLE' => $LANG['no_news_available']));
         }
     } else {
         $tpl_news->assign_vars(array('C_NEWS_LINK' => true));
         $column = $CONFIG_NEWS['nbr_column'] > 1 ? true : false;
         if ($column) {
             $i = 0;
             $CONFIG_NEWS['nbr_column'] = !empty($CONFIG_NEWS['nbr_column']) ? $CONFIG_NEWS['nbr_column'] : 1;
             $column_width = floor(100 / $CONFIG_NEWS['nbr_column']);
             $tpl_news->assign_vars(array('C_NEWS_LINK_COLUMN' => true, 'COLUMN_WIDTH' => $column_width));
         }
         $result = $Sql->query_while("SELECT n.id, n.title, n.timestamp, nc.id AS idcat, nc.icon\n\t\t\tFROM " . PREFIX . "news n\n\t\t\tLEFT JOIN " . PREFIX . "news_cat nc ON nc.id = n.idcat\n\t\t\tWHERE n.visible = 1\n\t\t\tORDER BY n.timestamp DESC\n\t\t\t" . $Sql->limit($first_msg, $CONFIG_NEWS['pagination_news']), __LINE__, __FILE__);
         while ($row = $Sql->fetch_assoc($result)) {
             $new_row = false;
             if ($column) {
                 $new_row = $i % $CONFIG_NEWS['nbr_column'] == 0 && $i > 0;
                 $i++;
             }
             $tpl_news->assign_block_vars('list', array('C_NEWS_ROW' => $new_row, 'ICON' => !empty($row['icon']) && $CONFIG_NEWS['activ_icon'] == 1 ? '<a href="' . PATH_TO_ROOT . '/news/news' . url('.php?cat=' . $row['idcat'], '-' . $row['idcat'] . '.php') . '"><img class="valign_middle" src="' . $row['icon'] . '" alt="" /></a>' : '', 'DATE' => gmdate_format('date_format_tiny', $row['timestamp']), 'TITLE' => $row['title'], 'NEW_ROW' => $new_row, 'U_NEWS' => PATH_TO_ROOT . '/news/news' . url('.php?id=' . $row['id'], '-0-' . $row['id'] . '+' . url_encode_rewrite($row['title']) . '.php')));
         }
         $Sql->query_close($result);
     }
     return $tpl_news->parse(TRUE);
 }