コード例 #1
0
function delTemplate()
{
    $templateDir = '';
    $toTemplateDir = '';
    $url = '';
    $templateDir = replace(@$_REQUEST['templateDir'], '\\', '/');
    handlePower('删除模板');
    //管理权限处理
    $toTemplateDir = mid($templateDir, 1, inStrRev($templateDir, '/')) . '#' . mid($templateDir, inStrRev($templateDir, '/') + 1, -1) . '_' . Format_Time(now(), 11);
    //call die(toTemplateDir)
    moveFolder($templateDir, $toTemplateDir);
    $url = '?act=displayLayout&templateFile=layout_manageTemplates.html&lableTitle=模板';
    Rw(getMsg1('删除模板完成,正在进入模板界面...', $url));
}
コード例 #2
0
function resetAccessData_temp()
{
    handlePower('恢复模板数据');
    //管理权限处理
    $GLOBALS['conn='] = OpenConn();
    $splStr = '';
    $i = '';
    $s = '';
    $columnname = '';
    $title = '';
    $nCount = '';
    $webdataDir = '';
    $webdataDir = @$_REQUEST['webdataDir'];
    if ($webdataDir != '') {
        if (checkFolder($webdataDir) == false) {
            eerr('网站数据目录不存在,恢复默认数据未成功', $webdataDir);
        }
    } else {
        $webdataDir = '/Data/WebData/';
    }
    aspEcho('提示', '恢复数据完成');
    rw('<hr><a href=\'../index.php\' target=\'_blank\'>进入首页</a> | <a href="?" target=\'_blank\'>进入后台</a>');
    $content = '';
    $filePath = '';
    $parentid = '';
    $author = '';
    $adddatetime = '';
    $fileName = '';
    $bodycontent = '';
    $webtitle = '';
    $webkeywords = '';
    $webdescription = '';
    $sortrank = '';
    $labletitle = '';
    $target = '';
    $websitebottom = '';
    $webTemplate = '';
    $webimages = '';
    $webcss = '';
    $webjs = '';
    $flags = '';
    $websiteurl = '';
    $splxx = '';
    $columntype = '';
    $relatedtags = '';
    $npagesize = '';
    $customaurl = '';
    $nofollow = '';
    $templatepath = '';
    $isthrough = '';
    $titlecolor = '';
    $showreason = '';
    $ncomputersearch = '';
    $nmobliesearch = '';
    $ncountsearch = '';
    $ndegree = '';
    //竞价表
    $displaytitle = '';
    $aboutcontent = '';
    $isonhtml = '';
    //单页表
    $columnenname = '';
    //导航表
    $smallimage = '';
    $bigImage = '';
    $bannerimage = '';
    //文章表
    $httpurl = '';
    $price = '';
    $morepageurl = '';
    $charset = '';
    $thispage = '';
    $countpage = '';
    $bigClassName = '';
    $startStr = '';
    $endStr = '';
    $startaddstr = '';
    $endaddstr = '';
    $sType = '';
    $saction = '';
    $fieldName = '';
    $fieldcheck = '';
    //网站配置
    $content = GetFText($webdataDir . '/website.txt');
    //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10)  20160409
    if (inStr($content, vbCrlf()) == false) {
        $content = replace($content, chr(10), vbCrlf());
    }
    if ($content != '') {
        $webtitle = newGetStrCut($content, 'webtitle');
        $webkeywords = newGetStrCut($content, 'webkeywords');
        $webdescription = newGetStrCut($content, 'webdescription');
        $websitebottom = newGetStrCut($content, 'websitebottom');
        $webTemplate = newGetStrCut($content, 'webtemplate');
        $webimages = newGetStrCut($content, 'webimages');
        $webcss = newGetStrCut($content, 'webcss');
        $webjs = newGetStrCut($content, 'webjs');
        $flags = newGetStrCut($content, 'flags');
        $websiteurl = newGetStrCut($content, 'websiteurl');
        if (getRecordCount($GLOBALS['db_PREFIX'] . 'website', '') == 0) {
            connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'website(webtitle) values(\'测试\')');
        }
        connexecute('update ' . $GLOBALS['db_PREFIX'] . 'website  set webtitle=\'' . $webtitle . '\',webkeywords=\'' . $webkeywords . '\',webdescription=\'' . $webdescription . '\',websitebottom=\'' . $websitebottom . '\',webtemplate=\'' . $webTemplate . '\',webimages=\'' . $webimages . '\',webcss=\'' . $webcss . '\',webjs=\'' . $webjs . '\',flags=\'' . $flags . '\',websiteurl=\'' . $websiteurl . '\'');
    }
    //导航
    connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'webcolumn');
    $content = getDirTxtList($webdataDir . '/webcolumn/');
    $content = contentNameSort($content, '');
    $splStr = aspSplit($content, vbCrlf());
    HR();
    foreach ($splStr as $key => $filePath) {
        $fileName = getFileName($filePath);
        if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) {
            aspEcho('导航', $filePath);
            $content = GetFText($filePath);
            //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10)  20160409
            if (inStr($content, vbCrlf()) == false) {
                $content = replace($content, chr(10), vbCrlf());
            }
            $splxx = aspSplit($content, vbCrlf() . '-------------------------------');
            foreach ($splxx as $key => $s) {
                if (inStr($s, '【webtitle】') > 0) {
                    $s = $s . vbCrlf();
                    $webtitle = newGetStrCut($s, 'webtitle');
                    $webkeywords = newGetStrCut($s, 'webkeywords');
                    $webdescription = newGetStrCut($s, 'webdescription');
                    $customaurl = newGetStrCut($s, 'customaurl');
                    $sortrank = newGetStrCut($s, 'sortrank');
                    if ($sortrank == '') {
                        $sortrank = 0;
                    }
                    $fileName = newGetStrCut($s, 'filename');
                    $columnname = newGetStrCut($s, 'columnname');
                    $columnenname = newGetStrCut($s, 'columnenname');
                    $columntype = newGetStrCut($s, 'columntype');
                    $flags = newGetStrCut($s, 'flags');
                    $parentid = newGetStrCut($s, 'parentid');
                    $parentid = phpTrim(getColumnId($parentid));
                    //可根据栏目名称找到对应ID   不存在为-1
                    //call echo("parentid",parentid)
                    $labletitle = newGetStrCut($s, 'labletitle');
                    //每页显示条数
                    $npagesize = newGetStrCut($s, 'npagesize');
                    if ($npagesize == '') {
                        $npagesize = 10;
                    }
                    //默认分页数为10条
                    $target = newGetStrCut($s, 'target');
                    $smallimage = newGetStrCut($s, 'smallimage');
                    $bigImage = newGetStrCut($s, 'bigImage');
                    $bannerimage = newGetStrCut($s, 'bannerimage');
                    $templatepath = newGetStrCut($s, 'templatepath');
                    $bodycontent = newGetStrCut($s, 'bodycontent');
                    $bodycontent = contentTranscoding($bodycontent);
                    //是否启用生成html
                    $isonhtml = newGetStrCut($s, 'isonhtml');
                    if ($isonhtml == '0' || lCase($isonhtml) == 'false') {
                        $isonhtml = 0;
                    } else {
                        $isonhtml = 1;
                    }
                    //是否为nofollow
                    $nofollow = newGetStrCut($s, 'nofollow');
                    if ($nofollow == '1' || lCase($nofollow) == 'true') {
                        $nofollow = 1;
                    } else {
                        $nofollow = 0;
                    }
                    //call echo(columnname,nofollow)
                    $aboutcontent = newGetStrCut($s, 'aboutcontent');
                    $aboutcontent = contentTranscoding($aboutcontent);
                    $bodycontent = newGetStrCut($s, 'bodycontent');
                    $bodycontent = contentTranscoding($bodycontent);
                    connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'webcolumn (webtitle,webkeywords,webdescription,columnname,columnenname,columntype,sortrank,filename,customaurl,flags,parentid,labletitle,aboutcontent,bodycontent,npagesize,isonhtml,nofollow,target,smallimage,bigImage,bannerimage,templatepath) values(\'' . $webtitle . '\',\'' . $webkeywords . '\',\'' . $webdescription . '\',\'' . $columnname . '\',\'' . $columnenname . '\',\'' . $columntype . '\',' . $sortrank . ',\'' . $fileName . '\',\'' . $customaurl . '\',\'' . $flags . '\',' . $parentid . ',\'' . $labletitle . '\',\'' . $aboutcontent . '\',\'' . $bodycontent . '\',' . $npagesize . ',' . $isonhtml . ',' . $nofollow . ',\'' . $target . '\',\'' . $smallimage . '\',\'' . $bigImage . '\',\'' . $bannerimage . '\',\'' . $templatepath . '\')');
                }
            }
        }
    }
    //文章
    connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'articledetail');
    $content = getDirAllFileList($webdataDir . '/articledetail/', 'txt');
    $content = contentNameSort($content, '');
    $splStr = aspSplit($content, vbCrlf());
    HR();
    foreach ($splStr as $key => $filePath) {
        $fileName = getFileName($filePath);
        if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) {
            aspEcho('文章', $filePath);
            $content = GetFText($filePath);
            //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10)  20160409
            if (inStr($content, vbCrlf()) == false) {
                $content = replace($content, chr(10), vbCrlf());
            }
            $splxx = aspSplit($content, vbCrlf() . '-------------------------------');
            foreach ($splxx as $key => $s) {
                if (inStr($s, '【title】') > 0) {
                    $s = $s . vbCrlf();
                    $parentid = newGetStrCut($s, 'parentid');
                    $parentid = getColumnId($parentid);
                    $title = newGetStrCut($s, 'title');
                    $titlecolor = newGetStrCut($s, 'titlecolor');
                    $webtitle = newGetStrCut($s, 'webtitle');
                    $webkeywords = newGetStrCut($s, 'webkeywords');
                    $webdescription = newGetStrCut($s, 'webdescription');
                    $author = newGetStrCut($s, 'author');
                    $sortrank = newGetStrCut($s, 'sortrank');
                    if ($sortrank == '') {
                        $sortrank = 0;
                    }
                    $adddatetime = newGetStrCut($s, 'adddatetime');
                    $fileName = newGetStrCut($s, 'filename');
                    $templatepath = newGetStrCut($s, 'templatepath');
                    $flags = newGetStrCut($s, 'flags');
                    $relatedtags = newGetStrCut($s, 'relatedtags');
                    $customaurl = newGetStrCut($s, 'customaurl');
                    $target = newGetStrCut($s, 'target');
                    $smallimage = newGetStrCut($s, 'smallimage');
                    $bigImage = newGetStrCut($s, 'bigImage');
                    $bannerimage = newGetStrCut($s, 'bannerimage');
                    $labletitle = newGetStrCut($s, 'labletitle');
                    $aboutcontent = newGetStrCut($s, 'aboutcontent');
                    $aboutcontent = contentTranscoding($aboutcontent);
                    $bodycontent = newGetStrCut($s, 'bodycontent');
                    $bodycontent = contentTranscoding($bodycontent);
                    //是否启用生成html
                    $isonhtml = newGetStrCut($s, 'isonhtml');
                    if ($isonhtml == '0' || lCase($isonhtml) == 'false') {
                        $isonhtml = 0;
                    } else {
                        $isonhtml = 1;
                    }
                    //是否为nofollow
                    $nofollow = newGetStrCut($s, 'nofollow');
                    if ($nofollow == '1' || lCase($nofollow) == 'true') {
                        $nofollow = 1;
                    } else {
                        $nofollow = 0;
                    }
                    //价格
                    $price = getDianNumb(newGetStrCut($s, 'price'));
                    if ($price == '') {
                        $price = 0;
                    }
                    connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'articledetail (parentid,title,titlecolor,webtitle,webkeywords,webdescription,author,sortrank,adddatetime,filename,flags,relatedtags,aboutcontent,bodycontent,updatetime,isonhtml,customaurl,nofollow,target,smallimage,bigImage,bannerimage,templatepath,labletitle,price) values(' . $parentid . ',\'' . $title . '\',\'' . $titlecolor . '\',\'' . $webtitle . '\',\'' . $webkeywords . '\',\'' . $webdescription . '\',\'' . $author . '\',' . $sortrank . ',\'' . $adddatetime . '\',\'' . $fileName . '\',\'' . $flags . '\',\'' . $relatedtags . '\',\'' . $aboutcontent . '\',\'' . $bodycontent . '\',\'' . now() . '\',' . $isonhtml . ',\'' . $customaurl . '\',' . $nofollow . ',\'' . $target . '\',\'' . $smallimage . '\',\'' . $bigImage . '\',\'' . $bannerimage . '\',\'' . $templatepath . '\',\'' . $labletitle . '\',' . $price . ')');
                }
            }
        }
    }
    //单页
    connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'OnePage');
    $content = getDirTxtList($webdataDir . '/OnePage/');
    $content = contentNameSort($content, '');
    $splStr = aspSplit($content, vbCrlf());
    HR();
    foreach ($splStr as $key => $filePath) {
        $fileName = getFileName($filePath);
        if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) {
            aspEcho('单页', $filePath);
            $content = GetFText($filePath);
            //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10)  20160409
            if (inStr($content, vbCrlf()) == false) {
                $content = replace($content, chr(10), vbCrlf());
            }
            $splxx = aspSplit($content, vbCrlf() . '-------------------------------');
            foreach ($splxx as $key => $s) {
                if (inStr($s, '【webkeywords】') > 0) {
                    $s = $s . vbCrlf();
                    $title = newGetStrCut($s, 'title');
                    $displaytitle = newGetStrCut($s, 'displaytitle');
                    $webtitle = newGetStrCut($s, 'webtitle');
                    $webkeywords = newGetStrCut($s, 'webkeywords');
                    $webdescription = newGetStrCut($s, 'webdescription');
                    $adddatetime = newGetStrCut($s, 'adddatetime');
                    $fileName = newGetStrCut($s, 'filename');
                    $aboutcontent = newGetStrCut($s, 'aboutcontent');
                    $aboutcontent = contentTranscoding($aboutcontent);
                    $target = newGetStrCut($s, 'target');
                    $templatepath = newGetStrCut($s, 'templatepath');
                    $bodycontent = newGetStrCut($s, 'bodycontent');
                    $bodycontent = contentTranscoding($bodycontent);
                    //是否启用生成html
                    $isonhtml = newGetStrCut($s, 'isonhtml');
                    if ($isonhtml == '0' || lCase($isonhtml) == 'false') {
                        $isonhtml = 0;
                    } else {
                        $isonhtml = 1;
                    }
                    //是否为nofollow
                    $nofollow = newGetStrCut($s, 'nofollow');
                    if ($nofollow == '1' || lCase($nofollow) == 'true') {
                        $nofollow = 1;
                    } else {
                        $nofollow = 0;
                    }
                    connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'onepage (title,displaytitle,webtitle,webkeywords,webdescription,adddatetime,filename,isonhtml,aboutcontent,bodycontent,nofollow,target,templatepath) values(\'' . $title . '\',\'' . $displaytitle . '\',\'' . $webtitle . '\',\'' . $webkeywords . '\',\'' . $webdescription . '\',\'' . $adddatetime . '\',\'' . $fileName . '\',' . $isonhtml . ',\'' . $aboutcontent . '\',\'' . $bodycontent . '\',' . $nofollow . ',\'' . $target . '\',\'' . $templatepath . '\')');
                }
            }
        }
    }
    //竞价
    connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'Bidding');
    $content = getDirTxtList($webdataDir . '/Bidding/');
    $content = contentNameSort($content, '');
    $splStr = aspSplit($content, vbCrlf());
    HR();
    foreach ($splStr as $key => $filePath) {
        $fileName = getFileName($filePath);
        if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) {
            aspEcho('竞价', $filePath);
            $content = GetFText($filePath);
            //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10)  20160409
            if (inStr($content, vbCrlf()) == false) {
                $content = replace($content, chr(10), vbCrlf());
            }
            $splxx = aspSplit($content, vbCrlf() . '-------------------------------');
            foreach ($splxx as $key => $s) {
                if (inStr($s, '【webkeywords】') > 0) {
                    $s = $s . vbCrlf();
                    $webkeywords = newGetStrCut($s, 'webkeywords');
                    $showreason = newGetStrCut($s, 'showreason');
                    $ncomputersearch = newGetStrCut($s, 'ncomputersearch');
                    $nmobliesearch = newGetStrCut($s, 'nmobliesearch');
                    $ncountsearch = newGetStrCut($s, 'ncountsearch');
                    $ndegree = newGetStrCut($s, 'ndegree');
                    $ndegree = getNumber($ndegree);
                    if ($ndegree == '') {
                        $ndegree = 0;
                    }
                    connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'Bidding (webkeywords,showreason,ncomputersearch,nmobliesearch,ndegree) values(\'' . $webkeywords . '\',\'' . $showreason . '\',' . $ncomputersearch . ',' . $nmobliesearch . ',' . $ndegree . ')');
                }
            }
        }
    }
    //搜索统计
    connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'SearchStat');
    $content = getDirTxtList($webdataDir . '/SearchStat/');
    $content = contentNameSort($content, '');
    $splStr = aspSplit($content, vbCrlf());
    HR();
    foreach ($splStr as $key => $filePath) {
        $fileName = getFileName($filePath);
        if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) {
            aspEcho('搜索统计', $filePath);
            $content = GetFText($filePath);
            //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10)  20160409
            if (inStr($content, vbCrlf()) == false) {
                $content = replace($content, chr(10), vbCrlf());
            }
            $splxx = aspSplit($content, vbCrlf() . '-------------------------------');
            foreach ($splxx as $key => $s) {
                if (inStr($s, '【title】') > 0) {
                    $s = $s . vbCrlf();
                    $title = newGetStrCut($s, 'title');
                    $webtitle = newGetStrCut($s, 'webtitle');
                    $webkeywords = newGetStrCut($s, 'webkeywords');
                    $webdescription = newGetStrCut($s, 'webdescription');
                    $customaurl = newGetStrCut($s, 'customaurl');
                    $target = newGetStrCut($s, 'target');
                    $isthrough = newGetStrCut($s, 'isthrough');
                    if ($isthrough == '0' || lCase($isthrough) == 'false') {
                        $isthrough = 0;
                    } else {
                        $isthrough = 1;
                    }
                    $sortrank = newGetStrCut($s, 'sortrank');
                    if ($sortrank == '') {
                        $sortrank = 0;
                    }
                    //是否启用生成html
                    $isonhtml = newGetStrCut($s, 'isonhtml');
                    if ($isonhtml == '0' || lCase($isonhtml) == 'false') {
                        $isonhtml = 0;
                    } else {
                        $isonhtml = 1;
                    }
                    //是否为nofollow
                    $nofollow = newGetStrCut($s, 'nofollow');
                    if ($nofollow == '1' || lCase($nofollow) == 'true') {
                        $nofollow = 1;
                    } else {
                        $nofollow = 0;
                    }
                    //call echo("title",title)
                    connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'SearchStat (title,webtitle,webkeywords,webdescription,customaurl,target,isthrough,sortrank,isonhtml,nofollow) values(\'' . $title . '\',\'' . $webtitle . '\',\'' . $webkeywords . '\',\'' . $webdescription . '\',\'' . $customaurl . '\',\'' . $target . '\',' . $isthrough . ',' . $sortrank . ',' . $isonhtml . ',' . $nofollow . ')');
                }
            }
        }
    }
    $itemid = '';
    $userName = '';
    $ip = '';
    $reply = '';
    $tableName = '';
    //评论
    //评论
    connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'TableComment');
    $content = getDirTxtList($webdataDir . '/TableComment/');
    $content = contentNameSort($content, '');
    $splStr = aspSplit($content, vbCrlf());
    HR();
    foreach ($splStr as $key => $filePath) {
        $fileName = getFileName($filePath);
        if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) {
            aspEcho('评论', $filePath);
            $content = GetFText($filePath);
            //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10)  20160409
            if (inStr($content, vbCrlf()) == false) {
                $content = replace($content, chr(10), vbCrlf());
            }
            $splxx = aspSplit($content, vbCrlf() . '-------------------------------');
            foreach ($splxx as $key => $s) {
                if (inStr($s, '【title】') > 0) {
                    $s = $s . vbCrlf();
                    $tableName = newGetStrCut($s, 'tablename');
                    $title = newGetStrCut($s, 'title');
                    $itemid = getArticleId(newGetStrCut($s, 'itemid'));
                    if ($itemid == '') {
                        $itemid = 0;
                    }
                    //call echo("itemID",itemID)
                    $adddatetime = newGetStrCut($s, 'adddatetime');
                    $userName = newGetStrCut($s, 'username');
                    $ip = newGetStrCut($s, 'ip');
                    $bodycontent = newGetStrCut($s, 'bodycontent');
                    $reply = newGetStrCut($s, 'reply');
                    $isthrough = newGetStrCut($s, 'isthrough');
                    if ($isthrough == '0' || lCase($isthrough) == 'false') {
                        $isthrough = 0;
                    } else {
                        $isthrough = 1;
                    }
                    //call echo("title",title)
                    connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'TableComment (tablename,title,itemid,adddatetime,username,ip,bodycontent,reply,isthrough) values(\'' . $tableName . '\',\'' . $title . '\',' . $itemid . ',\'' . $adddatetime . '\',\'' . $userName . '\',\'' . $ip . '\',\'' . $bodycontent . '\',\'' . $reply . '\',' . $isthrough . ')');
                }
            }
        }
    }
    //友情链接
    connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'FriendLink');
    $content = getDirTxtList($webdataDir . '/FriendLink/');
    $content = contentNameSort($content, '');
    $splStr = aspSplit($content, vbCrlf());
    HR();
    foreach ($splStr as $key => $filePath) {
        $fileName = getFileName($filePath);
        if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) {
            aspEcho('评论', $filePath);
            $content = GetFText($filePath);
            //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10)  20160409
            if (inStr($content, vbCrlf()) == false) {
                $content = replace($content, chr(10), vbCrlf());
            }
            $splxx = aspSplit($content, vbCrlf() . '-------------------------------');
            foreach ($splxx as $key => $s) {
                if (inStr($s, '【title】') > 0) {
                    $s = $s . vbCrlf();
                    $title = newGetStrCut($s, 'title');
                    $httpurl = newGetStrCut($s, 'httpurl');
                    $smallimage = newGetStrCut($s, 'smallimage');
                    $flags = newGetStrCut($s, 'flags');
                    $target = newGetStrCut($s, 'target');
                    $sortrank = newGetStrCut($s, 'sortrank');
                    if ($sortrank == '0' || lCase($sortrank) == 'false') {
                        $sortrank = 0;
                    } else {
                        $sortrank = 1;
                    }
                    $isthrough = newGetStrCut($s, 'isthrough');
                    if ($isthrough == '0' || lCase($isthrough) == 'false') {
                        $isthrough = 0;
                    } else {
                        $isthrough = 1;
                    }
                    //call echo("title",title)
                    connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'FriendLink (title,httpurl,smallimage,flags,sortrank,isthrough,target) values(\'' . $title . '\',\'' . $httpurl . '\',\'' . $smallimage . '\',\'' . $flags . '\',' . $sortrank . ',' . $isthrough . ',\'' . $target . '\')');
                }
            }
        }
    }
    //留言
    connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'GuestBook');
    $content = getDirTxtList($webdataDir . '/GuestBook/');
    $content = contentNameSort($content, '');
    $splStr = aspSplit($content, vbCrlf());
    HR();
    foreach ($splStr as $key => $filePath) {
        $fileName = getFileName($filePath);
        if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) {
            aspEcho('留言', $filePath);
            $content = GetFText($filePath);
            //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10)  20160409
            if (inStr($content, vbCrlf()) == false) {
                $content = replace($content, chr(10), vbCrlf());
            }
            $splxx = aspSplit($content, vbCrlf() . '-------------------------------');
            foreach ($splxx as $key => $s) {
                if (inStr($s, '【adddatetime】') > 0) {
                    $s = $s . vbCrlf();
                    $adddatetime = newGetStrCut($s, 'adddatetime');
                    $bodycontent = newGetStrCut($s, 'bodycontent');
                    $reply = newGetStrCut($s, 'reply');
                    $isthrough = newGetStrCut($s, 'isthrough');
                    if ($isthrough == '0' || lCase($isthrough) == 'false') {
                        $isthrough = 0;
                    } else {
                        $isthrough = 1;
                    }
                    connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'GuestBook (adddatetime,bodycontent,reply,isthrough) values(\'' . $adddatetime . '\',\'' . $bodycontent . '\',\'' . $reply . '\',' . $isthrough . ')');
                }
            }
        }
    }
    //采集网站
    connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'CaiWeb');
    $content = getDirTxtList($webdataDir . '/CaiWeb/');
    $content = contentNameSort($content, '');
    $splStr = aspSplit($content, vbCrlf());
    HR();
    foreach ($splStr as $key => $filePath) {
        $fileName = getFileName($filePath);
        if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) {
            aspEcho('采集网站', $filePath);
            $content = GetFText($filePath);
            //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10)  20160409
            if (inStr($content, vbCrlf()) == false) {
                $content = replace($content, chr(10), vbCrlf());
            }
            $splxx = aspSplit($content, vbCrlf() . '-------------------------------');
            foreach ($splxx as $key => $s) {
                if (inStr($s, '【bigclassname】') > 0) {
                    $s = $s . vbCrlf();
                    $bigClassName = newGetStrCut($s, 'bigclassname');
                    $httpurl = newGetStrCut($s, 'httpurl');
                    $morepageurl = newGetStrCut($s, 'morepageurl');
                    $charset = newGetStrCut($s, 'charset');
                    $adddatetime = newGetStrCut($s, 'adddatetime');
                    $bodycontent = newGetStrCut($s, 'bodycontent');
                    $sortrank = newGetStrCut($s, 'sortrank');
                    if ($sortrank == '') {
                        $sortrank = 0;
                    }
                    $thispage = newGetStrCut($s, 'thispage');
                    if ($thispage == '') {
                        $thispage = 0;
                    }
                    $countpage = newGetStrCut($s, 'countpage');
                    if ($countpage == '') {
                        $thispage = 0;
                    }
                    $columnname = newGetStrCut($s, 'columnname');
                    connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'CaiWeb (adddatetime,bodycontent,httpurl,morepageurl,charset,sortrank,thispage,countpage,bigclassname,columnname) values(\'' . $adddatetime . '\',\'' . $bodycontent . '\',\'' . $httpurl . '\',\'' . $morepageurl . '\',\'' . $charset . '\',' . $sortrank . ',' . $thispage . ',' . $countpage . ',\'' . $bigClassName . '\',\'' . $columnname . '\')');
                }
            }
        }
    }
    //采集配置
    connexecute('delete from ' . $GLOBALS['db_PREFIX'] . 'CaiConfig');
    $content = getDirTxtList($webdataDir . '/CaiConfig/');
    $content = contentNameSort($content, '');
    $splStr = aspSplit($content, vbCrlf());
    HR();
    foreach ($splStr as $key => $filePath) {
        $fileName = getFileName($filePath);
        if ($filePath != '' && inStr('_#', left($fileName, 1)) == false) {
            aspEcho('采集配置', $filePath);
            $content = GetFText($filePath);
            //这样做是为了从GitHub下载时它把vbcrlf转成 chr(10)  20160409
            if (inStr($content, vbCrlf()) == false) {
                $content = replace($content, chr(10), vbCrlf());
            }
            $splxx = aspSplit($content, vbCrlf() . '-------------------------------');
            foreach ($splxx as $key => $s) {
                if (inStr($s, '【bigclassname】') > 0) {
                    $s = $s . vbCrlf();
                    $bigClassName = newGetStrCut($s, 'bigclassname');
                    $sType = newGetStrCut($s, 'stype');
                    $startStr = newGetStrCut($s, 'startstr');
                    $endStr = newGetStrCut($s, 'endstr');
                    $startaddstr = newGetStrCut($s, 'startaddstr');
                    $endaddstr = newGetStrCut($s, 'endaddstr');
                    $adddatetime = newGetStrCut($s, 'adddatetime');
                    $sortrank = newGetStrCut($s, 'sortrank');
                    if ($sortrank == '') {
                        $sortrank = 0;
                    }
                    $saction = newGetStrCut($s, 'saction');
                    $isthrough = newGetStrCut($s, 'isthrough');
                    $isthrough = IIF($isthrough == '0' || lCase($isthrough) == 'false', 0, 1);
                    $fieldName = newGetStrCut($s, 'fieldname');
                    $fieldcheck = newGetStrCut($s, 'fieldcheck');
                    if ($fieldcheck == '') {
                        $fieldcheck = 0;
                    }
                    connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'CaiConfig (adddatetime,sortrank,bigclassname,stype,startstr,endstr,startaddstr,endaddstr,saction,isthrough,fieldname,fieldcheck) values(\'' . $adddatetime . '\',' . $sortrank . ',\'' . $bigClassName . '\',\'' . $sType . '\',\'' . $startStr . '\',\'' . $endStr . '\',\'' . $startaddstr . '\',\'' . $endaddstr . '\',\'' . $saction . '\',' . $isthrough . ',\'' . $fieldName . '\',' . $fieldcheck . ')');
                }
            }
        }
    }
    writeSystemLog('', '恢复默认数据' . $GLOBALS['db_PREFIX']);
    //系统日志
}
コード例 #3
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');
    //系统日志
}
コード例 #4
0
function addEditFile($dir, $fileName)
{
    $filePath = '';
    $promptMsg = '';
    if (right(lCase($fileName), 5) != '.html' && @$_SESSION['adminusername'] != 'ASPPHPCMS') {
        $fileName = $fileName . '.html';
    }
    $filePath = $dir . '/' . $fileName;
    if (CheckFile($filePath) == false) {
        handlePower('添加模板文件');
        //管理权限处理
    } else {
        handlePower('修改模板文件');
        //管理权限处理
    }
    //保存内容
    if (@$_REQUEST['issave'] == 'true') {
        createFile($filePath, @$_REQUEST['content']);
        $promptMsg = '保存成功';
    }
    ?>
    <form name="form1" method="post" action="?act=addEditFile&issave=true">
    <table width="99%" border="0" cellspacing="0" cellpadding="0" class="tableline">
    <tr>
    <td height="30">目录<?php 
    echo $dir;
    ?>
<br>
    <input name="dir" type="hidden" id="dir" value="<?php 
    echo $dir;
    ?>
" /></td>
    </tr>
    <tr>
    <td>文件名称
    <input name="fileName" type="text" id="fileName" value="<?php 
    echo $fileName;
    ?>
" size="40">&nbsp;<input type="submit" name="button" id="button" value=" 保存 " /><?php 
    echo $promptMsg;
    ?>
    <br>
    <textarea name="content" style="width:99%;height:480px;"id="content"><?php 
    Rw(getFText($filePath));
    ?>
</textarea></td>
    </tr>
    </table>
    </form>
    <?php 
}