Beispiel #1
0
function getRsUrl($fileName, $customAUrl, $defaultFileName)
{
    $url = '';
    //用默认文件名称
    if ($fileName == '') {
        $fileName = $defaultFileName;
    }
    //网址
    if ($fileName != '') {
        $fileName = lCase($fileName);
        //让文件名称小写20160315
        $url = $fileName;
        if (inStr(lCase($url), '.html') == false && right($url, 1) != '/') {
            $url = $url . '.html';
        }
    }
    if (aspTrim($customAUrl) != '') {
        $url = aspTrim($customAUrl);
    }
    if (inStr($GLOBALS['cfg_flags'], '|addwebsite|') > 0) {
        //url = replaceGlobleVariable(url)   '替换全局变量
        if (inStr($url, '$cfg_websiteurl$') == false && inStr($url, '{$GetColumnUrl ') == false && inStr($url, '{$GetArticleUrl ') == false && inStr($url, '{$GetOnePageUrl ') == false) {
            $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url);
        }
    }
    $getRsUrl = $url;
    return @$getRsUrl;
}
Beispiel #2
0
function batchHandleHttpUrlComplete($httpUrl, $content)
{
    $webSite = '';
    $splStr = '';
    $url = '';
    $lCaseUrl = '';
    $c = '';
    $webSite = getWebSite($httpUrl);
    $splStr = aspSplit($content, vbCrlf());
    foreach ($splStr as $key => $url) {
        $url = PHPTrim($url);
        $lCaseUrl = lCase($url);
        if ($lCaseUrl != '#' && left($lCaseUrl, 11) != 'javascript:') {
            if (inStr(vbCrlf() . lCase($c) . vbCrlf(), vbCrlf() . $lCaseUrl . vbCrlf()) == false) {
                if ($c != '') {
                    $c = $c . vbCrlf();
                }
                $c = $c . urlAddHttpUrl($webSite, $url);
            }
        }
    }
    $batchHandleHttpUrlComplete = $c;
    return @$batchHandleHttpUrlComplete;
}
Beispiel #3
0
function saveSiteMap()
{
    $isWebRunHtml = '';
    //是否为html方式显示网站
    $changefreg = '';
    //更新频率
    $priority = '';
    //优先级
    $s = '';
    $c = '';
    $url = '';
    handlePower('修改生成SiteMap');
    //管理权限处理
    $changefreg = @$_REQUEST['changefreg'];
    $priority = @$_REQUEST['priority'];
    loadWebConfig();
    //加载配置
    //call eerr("cfg_flags",cfg_flags)
    if (inStr($GLOBALS['cfg_flags'], '|htmlrun|') > 0) {
        $isWebRunHtml = true;
    } else {
        $isWebRunHtml = false;
    }
    $c = $c . '<?xml version="1.0" encoding="UTF-8"?>' . vbCrlf();
    $c = $c . vbTab() . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . vbCrlf();
    //栏目
    $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'webcolumn where isonhtml<>0 order by sortrank asc');
    while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) {
        if ($rsx['nofollow'] == false) {
            $c = $c . copyStr(vbTab(), 2) . '<url>' . vbCrlf();
            if ($isWebRunHtml == true) {
                $url = getRsUrl($rsx['filename'], $rsx['customaurl'], '/nav' . $rsx['id']);
                $url = handleAction($url);
            } else {
                $url = escape('?act=nav&columnName=' . $rsx['columnname']);
            }
            $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url);
            //call echo(cfg_webSiteUrl,url)
            $c = $c . copyStr(vbTab(), 3) . '<loc>' . $url . '</loc>' . vbCrlf();
            $c = $c . copyStr(vbTab(), 3) . '<lastmod>' . Format_Time($rsx['updatetime'], 2) . '</lastmod>' . vbCrlf();
            $c = $c . copyStr(vbTab(), 3) . '<changefreq>' . $changefreg . '</changefreq>' . vbCrlf();
            $c = $c . copyStr(vbTab(), 3) . '<priority>' . $priority . '</priority>' . vbCrlf();
            $c = $c . copyStr(vbTab(), 2) . '</url>' . vbCrlf();
            aspEcho('栏目', '<a href="' . $url . '" target=\'_blank\'>' . $url . '</a>');
        }
    }
    //文章
    $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail  where isonhtml<>0 order by sortrank asc');
    while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) {
        if ($rsx['nofollow'] == false) {
            $c = $c . copyStr(vbTab(), 2) . '<url>' . vbCrlf();
            if ($isWebRunHtml == true) {
                $url = getRsUrl($rsx['filename'], $rsx['customaurl'], '/detail/detail' . $rsx['id']);
                $url = handleAction($url);
            } else {
                $url = '?act=detail&id=' . $rsx['id'];
            }
            $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url);
            //call echo(cfg_webSiteUrl,url)
            $c = $c . copyStr(vbTab(), 3) . '<loc>' . $url . '</loc>' . vbCrlf();
            $c = $c . copyStr(vbTab(), 3) . '<lastmod>' . Format_Time($rsx['updatetime'], 2) . '</lastmod>' . vbCrlf();
            $c = $c . copyStr(vbTab(), 3) . '<changefreq>' . $changefreg . '</changefreq>' . vbCrlf();
            $c = $c . copyStr(vbTab(), 3) . '<priority>' . $priority . '</priority>' . vbCrlf();
            $c = $c . copyStr(vbTab(), 2) . '</url>' . vbCrlf();
            aspEcho('文章', '<a href="' . $url . '">' . $url . '</a>');
        }
    }
    //单页
    $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'onepage where isonhtml<>0 order by sortrank asc');
    while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) {
        if ($rsx['nofollow'] == false) {
            $c = $c . copyStr(vbTab(), 2) . '<url>' . vbCrlf();
            if ($isWebRunHtml == true) {
                $url = getRsUrl($rsx['filename'], $rsx['customaurl'], '/page/detail' . $rsx['id']);
                $url = handleAction($url);
            } else {
                $url = '?act=onepage&id=' . $rsx['id'];
            }
            $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url);
            //call echo(cfg_webSiteUrl,url)
            $c = $c . copyStr(vbTab(), 3) . '<loc>' . $url . '</loc>' . vbCrlf();
            $c = $c . copyStr(vbTab(), 3) . '<lastmod>' . Format_Time($rsx['updatetime'], 2) . '</lastmod>' . vbCrlf();
            $c = $c . copyStr(vbTab(), 3) . '<changefreq>' . $changefreg . '</changefreq>' . vbCrlf();
            $c = $c . copyStr(vbTab(), 3) . '<priority>' . $priority . '</priority>' . vbCrlf();
            $c = $c . copyStr(vbTab(), 2) . '</url>' . vbCrlf();
            aspEcho('单页', '<a href="' . $url . '">' . $url . '</a>');
        }
    }
    $c = $c . vbTab() . '</urlset>' . vbCrlf();
    loadWebConfig();
    createFile('sitemap.xml', $c);
    aspEcho('生成sitemap.xml文件成功', '<a href=\'/sitemap.xml\' target=\'_blank\'>点击预览sitemap.xml</a>');
    //判断是否生成sitemap.html
    if (@$_REQUEST['issitemaphtml'] == '1') {
        $c = '';
        //第二种
        //栏目
        $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'webcolumn order by sortrank asc');
        while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) {
            if ($rsx['nofollow'] == false) {
                if ($isWebRunHtml == true) {
                    $url = getRsUrl($rsx['filename'], $rsx['customaurl'], '/nav' . $rsx['id']);
                    $url = handleAction($url);
                } else {
                    $url = escape('?act=nav&columnName=' . $rsx['columnname']);
                }
                $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url);
                //判断是否生成html
                if ($rsx['isonhtml'] == true) {
                    $s = '<a href="' . $url . '">' . $rsx['columnname'] . '</a>';
                } else {
                    $s = '<span>' . $rsx['columnname'] . '</span>';
                }
                $c = $c . '<li style="width:20%;">' . $s . vbCrlf() . '<ul>' . vbCrlf();
                //文章
                $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail where parentId=' . $rsx['id'] . ' order by sortrank asc');
                while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) {
                    if ($rss['nofollow'] == false) {
                        if ($isWebRunHtml == true) {
                            $url = getRsUrl($rss['filename'], $rss['customaurl'], '/detail/detail' . $rss['id']);
                            $url = handleAction($url);
                        } else {
                            $url = '?act=detail&id=' . $rss['id'];
                        }
                        $url = urlAddHttpUrl($GLOBALS['cfg_webSiteUrl'], $url);
                        //判断是否生成html
                        if ($rss['isonhtml'] == true) {
                            $s = '<a href="' . $url . '">' . $rss['title'] . '</a>';
                        } else {
                            $s = '<span>' . $rss['title'] . '</span>';
                        }
                        $c = $c . '<li style="width:20%;">' . $s . '</li>' . vbCrlf();
                    }
                }
                $c = $c . '</ul>' . vbCrlf() . '</li>' . vbCrlf();
            }
        }
        //单面
        $c = $c . '<li style="width:20%;"><a href="javascript:;">单面列表</a>' . vbCrlf() . '<ul>' . vbCrlf();
        $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'onepage order by sortrank asc');
        while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) {
            if ($rsx['nofollow'] == false) {
                $c = $c . copyStr(vbTab(), 2) . '<url>' . vbCrlf();
                if ($isWebRunHtml == true) {
                    $url = getRsUrl($rsx['filename'], $rsx['customaurl'], '/page/detail' . $rsx['id']);
                    $url = handleAction($url);
                } else {
                    $url = '?act=onepage&id=' . $rsx['id'];
                }
                //判断是否生成html
                if ($rsx['isonhtml'] == true) {
                    $s = '<a href="' . $url . '">' . $rsx['title'] . '</a>';
                } else {
                    $s = '<span>' . $rsx['title'] . '</span>';
                }
                $c = $c . '<li style="width:20%;">' . $s . '</li>' . vbCrlf();
                // target=""_blank""  去掉
            }
        }
        $c = $c . '</ul>' . vbCrlf() . '</li>' . vbCrlf();
        $templateContent = '';
        $templateContent = getFText($GLOBALS['adminDir'] . '/template_SiteMap.html');
        $templateContent = replace($templateContent, '{$content$}', $c);
        $templateContent = replace($templateContent, '{$Web_Title$}', $GLOBALS['cfg_webTitle']);
        createFile('sitemap.html', $templateContent);
        aspEcho('生成sitemap.html文件成功', '<a href=\'/sitemap.html\' target=\'_blank\'>点击预览sitemap.html</a>');
    }
    writeSystemLog('', '保存sitemap.xml');
    //系统日志
}