/**
 * nv_rss_generate()
 * 
 * @param mixed $channel
 * @param mixed $imamge
 * @param mixed $items
 * @return void
 */
function nv_rss_generate($channel, $items)
{
    global $db, $global_config;
    if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/layout/rss.tpl")) {
        $path = NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/layout/";
    } else {
        $path = NV_ROOTDIR . "/themes/default/layout/";
    }
    $xtpl = new XTemplate("rss.tpl", $path);
    $channel['title'] = nv_unhtmlspecialchars($channel['title']);
    $channel['description'] = nv_unhtmlspecialchars($channel['description']);
    $channel['lang'] = $global_config['site_lang'];
    $channel['copyright'] = htmlspecialchars($global_config['site_name']);
    $channel['docs'] = NV_MY_DOMAIN . NV_BASE_SITEURL . '?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=rss';
    $channel['generator'] = htmlspecialchars('Nukeviet Version ' . $global_config['version']);
    $xtpl->assign('CHANNEL', $channel);
    if (file_exists(NV_ROOTDIR . '/images/' . $global_config['site_logo'])) {
        $image = NV_ROOTDIR . '/images/' . $global_config['site_logo'];
        $image = nv_ImageInfo($image, 144, true, NV_UPLOADS_REAL_DIR);
        if (!empty($image)) {
            $image['title'] = $channel['title'];
            $image['link'] = $channel['link'];
            $image['src'] = NV_MY_DOMAIN . $image['src'];
            $xtpl->assign('IMAGE', $image);
            $xtpl->parse('main.image');
        }
    }
    if (!empty($items)) {
        foreach ($items as $item) {
            if (!empty($item['title'])) {
                $item['title'] = nv_unhtmlspecialchars($item['title']);
            }
            if (!empty($item['description'])) {
                $item['description'] = htmlspecialchars($item['description'], ENT_QUOTES);
            }
            $item['pubdate'] = gmdate("D, j M Y H:m:s", $item['pubdate']) . ' GMT';
            $xtpl->assign('ITEM', $item);
            $xtpl->parse('main.item');
        }
    }
    $xtpl->parse('main');
    $content = $xtpl->text('main');
    $content = $db->unfixdb($content);
    $content = nv_url_rewrite($content);
    header("Content-Type: text/xml");
    header("Content-Type: application/rss+xml");
    header("Content-Encoding: none");
    echo $content;
    die;
}
예제 #2
0
/**
 * nv_rss_generate()
 *
 * @param mixed $channel
 * @param mixed $items
 * @return void
 */
function nv_rss_generate($channel, $items)
{
    global $db, $global_config, $client_info;
    $xtpl = new XTemplate('rss.tpl', NV_ROOTDIR . '/themes/default/layout/');
    $xtpl->assign('CSSPATH', NV_BASE_SITEURL . 'themes/default/css/rss.xsl');
    //Chi co tac dung voi IE6 va Chrome
    $channel['title'] = nv_htmlspecialchars($channel['title']);
    $channel['atomlink'] = str_replace('&', '&', $client_info['selfurl']);
    $channel['lang'] = $global_config['site_lang'];
    $channel['copyright'] = $global_config['site_name'];
    $channel['docs'] = NV_MY_DOMAIN . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=rss', true);
    $channel['generator'] = 'Nukeviet Version 4';
    if (preg_match('/^' . nv_preg_quote(NV_MY_DOMAIN . NV_BASE_SITEURL) . '(.+)$/', $channel['link'], $matches)) {
        $channel['link'] = $matches[1];
    } elseif (preg_match('/^' . nv_preg_quote(NV_BASE_SITEURL) . '(.+)$/', $channel['link'], $matches)) {
        $channel['link'] = $matches[1];
    }
    $channel['link'] = NV_MY_DOMAIN . nv_url_rewrite(NV_BASE_SITEURL . $channel['link'], true);
    if (preg_match('/^' . nv_preg_quote(NV_MY_DOMAIN . NV_BASE_SITEURL) . '(.+)$/', $channel['atomlink'], $matches)) {
        $channel['atomlink'] = $matches[1];
    } elseif (preg_match('/^' . nv_preg_quote(NV_BASE_SITEURL) . '(.+)$/', $channel['atomlink'], $matches)) {
        $channel['atomlink'] = $matches[1];
    }
    $channel['atomlink'] = NV_MY_DOMAIN . nv_url_rewrite(NV_BASE_SITEURL . $channel['atomlink'], true);
    $channel['pubDate'] = 0;
    if (!empty($items)) {
        foreach ($items as $item) {
            if (!empty($item['title']) and !empty($item['link'])) {
                $item['title'] = nv_htmlspecialchars($item['title']);
                if (isset($item['pubdate']) and !empty($item['pubdate'])) {
                    $item['pubdate'] = intval($item['pubdate']);
                    $channel['pubDate'] = max($channel['pubDate'], $item['pubdate']);
                    $item['pubdate'] = gmdate('D, j M Y H:m:s', $item['pubdate']) . ' GMT';
                }
                if (preg_match('/^' . nv_preg_quote(NV_MY_DOMAIN . NV_BASE_SITEURL) . '(.+)$/', $item['link'], $matches)) {
                    $item['link'] = $matches[1];
                } elseif (preg_match('/^' . nv_preg_quote(NV_BASE_SITEURL) . '(.+)$/', $item['link'], $matches)) {
                    $item['link'] = $matches[1];
                }
                $item['link'] = NV_MY_DOMAIN . nv_url_rewrite(NV_BASE_SITEURL . $item['link'], true);
                $xtpl->assign('ITEM', $item);
                if (isset($item['guid']) and !empty($item['guid'])) {
                    $xtpl->parse('main.item.guid');
                }
                if (isset($item['pubdate']) and !empty($item['pubdate'])) {
                    $xtpl->parse('main.item.pubdate');
                }
                $xtpl->parse('main.item');
            }
        }
    }
    $lastModified = NV_CURRENTTIME;
    if (!empty($channel['pubDate'])) {
        $lastModified = $channel['pubDate'];
        $channel['pubDate'] = gmdate('D, j M Y H:m:s', $channel['pubDate']) . ' GMT';
    }
    $xtpl->assign('CHANNEL', $channel);
    if (!empty($channel['description'])) {
        $xtpl->parse('main.description');
    }
    if (!empty($channel['pubDate'])) {
        $xtpl->parse('main.pubDate');
    }
    $image = file_exists(NV_ROOTDIR . '/' . $global_config['site_logo']) ? NV_ROOTDIR . '/' . $global_config['site_logo'] : NV_ROOTDIR . '/images/logo.png';
    $image = nv_ImageInfo($image, 144, true, NV_UPLOADS_REAL_DIR);
    if (!empty($image)) {
        $resSize = nv_imageResize($image['width'], $image['height'], 144, 400);
        $image['width'] = $resSize['width'];
        $image['height'] = $resSize['height'];
        $image['title'] = $channel['title'];
        $image['link'] = $channel['link'];
        $image['src'] = NV_MY_DOMAIN . nv_url_rewrite($image['src'], true);
        $xtpl->assign('IMAGE', $image);
        $xtpl->parse('main.image');
    }
    $xtpl->parse('main');
    $content = $xtpl->text('main');
    nv_xmlOutput($content, $lastModified);
}
예제 #3
0
 $result = $db->sql_query($sql);
 $query = $db->sql_query("SELECT FOUND_ROWS()");
 list($all_page) = $db->sql_fetchrow($query);
 if ($all_page) {
     $array_item = array();
     while ($row = $db->sql_fetchrow($result)) {
         $uploadtime = (int) $row['uploadtime'];
         if ($uploadtime >= $today) {
             $uploadtime = $lang_module['today'] . ", " . date("H:i", $row['uploadtime']);
         } elseif ($uploadtime >= $yesterday) {
             $uploadtime = $lang_module['yesterday'] . ", " . date("H:i", $row['uploadtime']);
         } else {
             $uploadtime = nv_date("d/m/Y H:i", $row['uploadtime']);
         }
         $img = substr($row['fileimage'], strlen(NV_BASE_SITEURL));
         $imageinfo = nv_ImageInfo(NV_ROOTDIR . '/' . $img, 400, true, NV_UPLOADS_REAL_DIR . '/' . $module_name . '/thumb');
         $array_item[$row['id']] = array('id' => (int) $row['id'], 'title' => $row['title'], 'introtext' => $row['introtext'], 'uploadtime' => $uploadtime, 'author_name' => !empty($row['author_name']) ? $row['author_name'] : $lang_module['unknown'], 'filesize' => !empty($row['filesize']) ? nv_convertfromBytes($row['filesize']) : "", 'fileimage' => $imageinfo, 'view_hits' => (int) $row['view_hits'], 'download_hits' => (int) $row['download_hits'], 'more_link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $list_cats[$row['catid']]['alias'] . "/" . $row['alias'], 'edit_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&edit=1&id=" . (int) $row['id'] : "", 'del_link' => defined('NV_IS_MODADMIN') ? NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name : "");
         //
         if ($row['comment_allow']) {
             $array_item[$row['id']]['comment_hits'] = (int) $row['comment_hits'];
         }
     }
     $array_cats[$catid_i] = array();
     $array_cats[$catid_i]['id'] = $value['id'];
     $array_cats[$catid_i]['title'] = $value['title'];
     $array_cats[$catid_i]['link'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $value['alias'];
     $array_cats[$catid_i]['description'] = $list_cats[$value['id']]['description'];
     $array_cats[$catid_i]['subcats'] = $list_cats[$value['id']]['subcats'];
     //$array_cats[$catid_i]['image'] = $list_cats[$value['id']]['image'];
     $array_cats[$catid_i]['items'] = $array_item;
 }
예제 #4
0
        }
    } else {
        $row['linkdirect'] = array();
    }
    $row['download_info'] = '';
} else {
    $row['fileupload'] = array();
    $row['linkdirect'] = array();
    $session_files = array();
    $row['download_info'] = sprintf($lang_module['download_not_allow_info1'], NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=users', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=users&' . NV_OP_VARIABLE . '=register');
}
$session_files = serialize($session_files);
$nv_Request->set_Session('session_files', $session_files);
$row['filesize'] = !empty($row['filesize']) ? nv_convertfromBytes($row['filesize']) : $lang_module['unknown'];
$img = NV_UPLOADS_DIR . $row['fileimage'];
$row['fileimage'] = nv_ImageInfo(NV_ROOTDIR . '/' . $img, 300, true, NV_ROOTDIR . '/' . NV_TEMP_DIR);
$dfile = $nv_Request->get_string('dfile', 'session', '');
$dfile = !empty($dfile) ? unserialize($dfile) : array();
if (!in_array($row['id'], $dfile)) {
    $dfile[] = $row['id'];
    $dfile = serialize($dfile);
    $nv_Request->set_Session('dfile', $dfile);
    $sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . ' SET view_hits=view_hits+1 WHERE id=' . $row['id'];
    $db->query($sql);
    ++$row['view_hits'];
}
// comment
if (isset($site_mods['comment']) and isset($module_config[$module_name]['activecomm'])) {
    define('NV_COMM_ID', $row['id']);
    define('NV_COMM_ALLOWED', nv_user_in_groups($row['groups_comment']));
    // Kiem tra quyen dang binh luan
예제 #5
0
<?php

/**
 * @Project NUKEVIET 3.x
 * @Author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2012 VINADES.,JSC. All rights reserved
 * @Createdate 3-6-2010 0:14
 */
if (!defined('NV_IS_MOD_WEBLINKS')) {
    die('Stop!!!');
}
$key_words = $module_info['keywords'];
$mod_title = isset($lang_module['main_title']) ? $lang_module['main_title'] : $module_info['custom_title'];
global $global_array_cat;
$sql = "SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id` = '" . $id . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$page_title = $row['title'] . " - " . $global_array_cat[$row['catid']]['title'];
$row['visit'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=visitlink-" . $row['alias'] . "-" . $row['id'];
$row['report'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=reportlink-" . $row['alias'] . "-" . $row['id'];
$urlimg = NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $row['urlimg'];
$imageinfo = nv_ImageInfo($urlimg, 300, true, NV_UPLOADS_REAL_DIR . '/' . $module_name . '/thumb');
$row['urlimg'] = $imageinfo['src'];
$contents = call_user_func("detail", $row);
include NV_ROOTDIR . "/includes/header.php";
echo nv_site_theme($contents);
include NV_ROOTDIR . "/includes/footer.php";
예제 #6
0
    $row['download_info'] = "";
} else {
    $row['fileupload'] = array();
    $row['linkdirect'] = array();
    $session_files = array();
    if ($list_cats[$row['catid']]['who_download'] == 2) {
        $row['download_info'] = $lang_module['download_not_allow_info2'];
    } else {
        $row['download_info'] = sprintf($lang_module['download_not_allow_info1'], NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=users", NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=users&amp;" . NV_OP_VARIABLE . "=register");
    }
}
$session_files = serialize($session_files);
$nv_Request->set_Session('session_files', $session_files);
$row['filesize'] = !empty($row['filesize']) ? nv_convertfromBytes($row['filesize']) : $lang_module['unknown'];
$img = NV_UPLOADS_DIR . $row['fileimage'];
$row['fileimage'] = nv_ImageInfo(NV_ROOTDIR . '/' . $img, 300, true, NV_UPLOADS_REAL_DIR . '/' . $module_name . '/thumb');
$dfile = $nv_Request->get_string('dfile', 'session', '');
$dfile = !empty($dfile) ? unserialize($dfile) : array();
if (!in_array($row['id'], $dfile)) {
    $dfile[] = $row['id'];
    $dfile = serialize($dfile);
    $nv_Request->set_Session('dfile', $dfile);
    $sql = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "` SET `view_hits`=view_hits+1 WHERE `id`=" . $row['id'];
    $db->sql_query($sql);
    ++$row['view_hits'];
}
$row['is_comment_allow'] = $row['comment_allow'] ? nv_set_allow($row['who_comment'], $row['groups_comment']) : false;
$row['rating_point'] = 0;
if (!empty($row['rating_detail'])) {
    $row['rating_detail'] = explode("|", $row['rating_detail']);
    if ($row['rating_detail'][1]) {