コード例 #1
0
function getColumnUrl($columnNameOrId, $sType)
{
    $url = '';
    $addSql = '';
    $columnNameOrId = replaceGlobleVariable($columnNameOrId);
    //处理动作 <a href="{$GetColumnUrl columnname='[$glb_columnName$]' $}" >更多图片</a>
    if ($sType == 'name') {
        $addSql = ' where columnname=\'' . replace($columnNameOrId, '\'', '\'\'') . '\'';
        //对'号处理,要不然sql查询出错20160716
    } else {
        $addSql = ' where id=' . $columnNameOrId . '';
    }
    $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'webcolumn' . $addSql);
    if (@mysql_num_rows($rsxObj) != 0) {
        $rsx = mysql_fetch_array($rsxObj);
        if ($GLOBALS['isMakeHtml'] == true) {
            $url = getRsUrl($rsx['filename'], $rsx['customaurl'], '/nav' . $rsx['id']);
        } else {
            $url = handleWebUrl('?act=nav&columnName=' . $rsx['columnname']);
            if ($rsx['customaurl'] != '') {
                $url = $rsx['customaurl'];
            }
        }
    }
    $getColumnUrl = $url;
    return @$getColumnUrl;
}
コード例 #2
0
function deleteAllMakeHtml()
{
    $filePath = '';
    //栏目
    $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) {
            $filePath = getRsUrl($rsx['filename'], $rsx['customaurl'], '/nav' . $rsx['id']);
            if (right($filePath, 1) == '/') {
                $filePath = $filePath . 'index.html';
            }
            aspEcho('栏目filePath', '<a href=\'' . $filePath . '\' target=\'_blank\'>' . $filePath . '</a>');
            DeleteFile($filePath);
        }
    }
    //文章
    $rsxObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail order by sortrank asc');
    while ($rsx = $GLOBALS['conn']->fetch_array($rsxObj)) {
        if ($rsx['nofollow'] == false) {
            $filePath = getRsUrl($rsx['filename'], $rsx['customaurl'], '/detail/detail' . $rsx['id']);
            if (right($filePath, 1) == '/') {
                $filePath = $filePath . 'index.html';
            }
            aspEcho('文章filePath', '<a href=\'' . $filePath . '\' target=\'_blank\'>' . $filePath . '</a>');
            DeleteFile($filePath);
        }
    }
    //单页
    $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) {
            $filePath = getRsUrl($rsx['filename'], $rsx['customaurl'], '/page/detail' . $rsx['id']);
            if (right($filePath, 1) == '/') {
                $filePath = $filePath . 'index.html';
            }
            aspEcho('单页filePath', '<a href=\'' . $filePath . '\' target=\'_blank\'>' . $filePath . '</a>');
            DeleteFile($filePath);
        }
    }
}
コード例 #3
0
ファイル: 2015_ToMyPHP.php プロジェクト: 313801120/AspPhpCms
function XY_AP_GeneralList($action, $tableName, $addSql)
{
    $title = '';
    $topNumb = '';
    $nTop = '';
    $isB = '';
    $sql = '';
    $columnName = '';
    $columnEnName = '';
    $aboutcontent = '';
    $bodyContent = '';
    $showTitle = '';
    $bannerImage = '';
    $smallImage = '';
    $bigImage = '';
    $id = '';
    $defaultStr = '';
    $i = '';
    $j = '';
    $s = '';
    $c = '';
    $startStr = '';
    $endStr = '';
    $url = '';
    $noFollow = '';
    //不追踪 20141222
    $defaultStr = getDefaultValue($action);
    //获得默认内容
    $modI = '';
    //余循环20150112
    $noFollow = aspTrim(lCase(RParam($action, 'noFollow')));
    //不追踪
    $lableTitle = '';
    //标题标题
    $target = '';
    //a链接打开目标方式
    $adddatetime = '';
    //添加时间
    $isFocus = '';
    $fieldNameList = '';
    //字段列表
    $abcolorStr = '';
    //A加粗和颜色
    $atargetStr = '';
    //A链接打开方式
    $atitleStr = '';
    //A链接的title20160407
    $anofollowStr = '';
    //A链接的nofollow
    $splFieldName = '';
    $fieldName = '';
    $replaceStr = '';
    $k = '';
    $idPage = '';
    $tableName = lCase($tableName);
    //转小写
    $fieldNameList = getHandleFieldList($GLOBALS['db_PREFIX'] . $tableName, '字段列表');
    $splFieldName = aspSplit($fieldNameList, ',');
    $topNumb = RParam($action, 'topNumb');
    $nTop = $topNumb;
    if ($nTop != '') {
        $nTop = CInt($nTop);
    } else {
        $nTop = 999;
    }
    if ($sql == '') {
        if ($topNumb != '') {
            $topNumb = ' top ' . $topNumb . ' ';
        }
        $sql = 'Select ' . $topNumb . '* From ' . $GLOBALS['db_PREFIX'] . $tableName;
    }
    //追加sql
    if ($addSql != '') {
        $sql = getWhereAnd($sql, $addSql);
    }
    $sql = replaceGlobleVariable($sql);
    //替换全局变量
    //检测SQL
    if (checkSql($sql) == false) {
        errorLog('出错提示:<br>action=' . $action . '<hr>sql=' . $sql . '<br>');
        return '';
    }
    $rsObj = $GLOBALS['conn']->query($sql);
    for ($i = 1; $i <= @mysql_num_rows($rsObj); $i++) {
        $rs = mysql_fetch_array($rsObj);
        $startStr = '';
        $endStr = '';
        //call echo(sql,i & "," & nTop)
        if ($i > $nTop) {
            break;
        }
        //#【PHP】$rs=mysql_fetch_array($rsObj);                                            //给PHP用,因为在 asptophp转换不完善
        $isFocus = false;
        //交点为假
        $id = $rs['id'];
        //【导航】
        if ($tableName == 'webcolumn') {
            if ($GLOBALS['isMakeHtml'] == true) {
                $url = getRsUrl($rs['filename'], $rs['customaurl'], '/nav' . $rs['id']);
            } else {
                $url = handleWebUrl('?act=nav&columnName=' . $rs['columnname']);
                //会追加gl等参数
                if ($rs['customaurl'] != '') {
                    $url = $rs['customaurl'];
                    $url = replaceGlobleVariable($url);
                }
            }
            //全局栏目名称为空则为自动定位首页 追加(20160128)
            if ($GLOBALS['glb_columnName'] == '' && $rs['columntype'] == '首页') {
                $GLOBALS['glb_columnName'] = $rs['columnname'];
            }
            if ($rs['columnname'] == $GLOBALS['glb_columnName']) {
                $isFocus = true;
            }
            //【文章】
        } else {
            if ($tableName == 'articledetail') {
                if ($GLOBALS['isMakeHtml'] == true) {
                    $url = getRsUrl($rs['filename'], $rs['customaurl'], 'detail/detail' . $rs['id']);
                } else {
                    $url = handleWebUrl('?act=detail&id=' . $rs['id']);
                    //会追加gl等参数
                    if ($rs['customaurl'] != '') {
                        $url = $rs['customaurl'];
                    }
                }
                //评论
            } else {
                if ($tableName == 'tablecomment') {
                }
            }
        }
        //A链接添加颜色
        $abcolorStr = '';
        if (inStr($fieldNameList, ',titlecolor,') > 0) {
            //A链接颜色
            if ($rs['titlecolor'] != '') {
                $abcolorStr = 'color:' . $rs['titlecolor'] . ';';
            }
        }
        if (inStr($fieldNameList, ',flags,') > 0) {
            //A链接加粗
            if (inStr($rs['flags'], '|b|') > 0) {
                $abcolorStr = $abcolorStr . 'font-weight:bold;';
            }
        }
        if ($abcolorStr != '') {
            $abcolorStr = ' style="' . $abcolorStr . '"';
        }
        //打开方式2016
        if (inStr($fieldNameList, ',target,') > 0) {
            $atargetStr = IIF($rs['target'] != '', ' target="' . $rs['target'] . '"', '');
        }
        //A的title
        if (inStr($fieldNameList, ',title,') > 0) {
            $atitleStr = IIF($rs['title'] != '', ' title="' . $rs['title'] . '"', '');
        }
        //A的nofollow
        if (inStr($fieldNameList, ',nofollow,') > 0) {
            $anofollowStr = IIF($rs['nofollow'] != 0, ' rel="nofollow"', '');
        }
        //交点判断(给栏目导航用的)
        if ($isFocus == true) {
            $startStr = '[list-focus]';
            $endStr = '[/list-focus]';
        } else {
            $startStr = '[list-' . $i . ']';
            $endStr = '[/list-' . $i . ']';
        }
        //在最后时排序当前交点20160202
        if ($i == $topNumb && $isFocus == false) {
            $startStr = '[list-end]';
            $endStr = '[/list-end]';
        }
        //例[list-mod2]  [/list-mod2]    20150112
        for ($modI = 6; $modI >= 2; $modI--) {
            if (inStr($defaultStr, $startStr) == false && $i % $modI == 0) {
                $startStr = '[list-mod' . $modI . ']';
                $endStr = '[/list-mod' . $modI . ']';
                if (inStr($defaultStr, $startStr) > 0) {
                    break;
                }
            }
        }
        //没有则用默认
        if (inStr($defaultStr, $startStr) == false) {
            $startStr = '[list]';
            $endStr = '[/list]';
        }
        if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) {
            $s = StrCut($defaultStr, $startStr, $endStr, 2);
            $s = replaceValueParam($s, 'i', $i);
            //循环编号
            $s = replaceValueParam($s, '编号', $i);
            //循环编号
            $s = replaceValueParam($s, 'id', $rs['id']);
            //id编号 因为获得字段他不获得id
            $s = replaceValueParam($s, 'url', $url);
            //网址
            $s = replaceValueParam($s, 'aurl', 'href="' . $url . '"');
            //网址
            $s = replaceValueParam($s, 'abcolor', $abcolorStr);
            //A链接加颜色与加粗
            $s = replaceValueParam($s, 'atitle', $atitleStr);
            //A链接title
            $s = replaceValueParam($s, 'anofollow', $anofollowStr);
            //A链接nofollow
            $s = replaceValueParam($s, 'atarget', $atargetStr);
            //A链接打开方式
            for ($k = 0; $k <= uBound($splFieldName); $k++) {
                if ($splFieldName[$k] != '') {
                    $fieldName = $splFieldName[$k];
                    $replaceStr = $rs[$fieldName] . '';
                    $s = replaceValueParam($s, $fieldName, $replaceStr);
                }
            }
            //开始位置加Dialog内容
            $startStr = '[list-' . $i . ' startdialog]';
            $endStr = '[/list-' . $i . ' startdialog]';
            if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) {
                $s = StrCut($defaultStr, $startStr, $endStr, 2) . $s;
            }
            //结束位置加Dialog内容
            $startStr = '[list-' . $i . ' enddialog]';
            $endStr = '[/list-' . $i . ' enddialog]';
            if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) {
                $s = $s . StrCut($defaultStr, $startStr, $endStr, 2);
            }
            //加控制
            //【导航】
            if ($tableName == 'webcolumn') {
                $url = WEB_ADMINURL . '?act=addEditHandle&actionType=WebColumn&lableTitle=网站栏目&nPageSize=10&page=&id=' . $rs['id'] . '&n=' . getRnd(11);
                //【评论】
            } else {
                if ($tableName == 'tablecomment') {
                    $idPage = getThisIdPage($GLOBALS['db_PREFIX'] . $tableName, $rs['id'], 10);
                    $url = WEB_ADMINURL . '?act=addEditHandle&actionType=TableComment&lableTitle=评论&nPageSize=10&parentid=&searchfield=bodycontent&keyword=&addsql=&page=' . $idPage . '&id=' . $rs['id'] . '&n=' . getRnd(11);
                    //【文章】
                } else {
                    if ($tableName == 'articledetail') {
                        $idPage = getThisIdPage($GLOBALS['db_PREFIX'] . $tableName, $rs['id'], 10);
                        $url = WEB_ADMINURL . '?act=addEditHandle&actionType=ArticleDetail&lableTitle=分类信息&nPageSize=10&page=' . $idPage . '&parentid=' . $rs['parentid'] . '&id=' . $rs['id'] . '&n=' . getRnd(11);
                        $s = replaceValueParam($s, 'columnurl', getColumnUrl($rs['parentid'], ''));
                        //文章对应栏目URL 20160304
                        $s = replaceValueParam($s, 'columnname', getColumnName($rs['parentid']));
                        //文章对应栏目名称 20160304
                    }
                }
            }
            $s = handleDisplayOnlineEditDialog($url, $s, '', 'div|li|span');
            //处理是否添加在线修改管理器
            $c = $c . $s;
        }
    }
    //开始内容加Dialog内容
    $startStr = '[dialog start]';
    $endStr = '[/dialog start]';
    if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) {
        $c = StrCut($defaultStr, $startStr, $endStr, 2) . $c;
    }
    //结束内容加Dialog内容
    $startStr = '[dialog end]';
    $endStr = '[/dialog end]';
    if (inStr($defaultStr, $startStr) > 0 && inStr($defaultStr, $endStr) > 0) {
        $c = $c . StrCut($defaultStr, $startStr, $endStr, 2);
    }
    $XY_AP_GeneralList = $c;
    return @$XY_AP_GeneralList;
}
コード例 #4
0
ファイル: index.php プロジェクト: 313801120/AspPhpCms
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');
    //系统日志
}