示例#1
0
function configsave()
{
    $tempcacheid = time();
    if (be("post", "app_vodviewtype") == "2") {
        SpecialChar(be("post", "app_vodlistpath"));
        SpecialChar(be("post", "app_vodpath"));
        SpecialChar(be("post", "app_vodplaypath"));
        SpecialChar(be("post", "app_vodtopicpath"));
    }
    if (be("post", "app_artviewtype", "post") == "2") {
        SpecialChar(be("post", "app_artlistpath"));
        SpecialChar(be("post", "app_artpath"));
        SpecialChar(be("post", "app_arttopicpath"));
    }
    $timming = trim(be("post", "app_timming"));
    if (strpos(strtolower(PHP_OS), 'linux') !== false) {
        $command = "*/5 * * * * wget http://" . $_SERVER['HTTP_HOST'] . '/inc/timming.php >> /dev/null 2>&1';
        if ($timming === '0') {
            Crontab::deleteCommand($command, 'http://' . $_SERVER['HTTP_HOST'] . '/inc/timming.php');
        } else {
            Crontab::replaceCommand($command, 'http://' . $_SERVER['HTTP_HOST'] . '/inc/timming.php');
        }
    }
    $str = "<" . "?php" . "\n";
    $str .= "define(\"app_sitename\"," . chr(34) . trim(be("post", "app_sitename")) . chr(34) . ");      //网站名称" . "\n";
    $str .= "define(\"app_installdir\"," . chr(34) . trim(be("post", "app_installdir")) . chr(34) . ");        //网站路径" . "\n";
    $str .= "define(\"app_siteurl\"," . chr(34) . trim(be("post", "app_siteurl")) . chr(34) . ");        //网站域名地址" . "\n";
    $str .= "define(\"app_keywords\"," . chr(34) . trim(be("post", "app_keywords")) . chr(34) . ");        //网站关键字" . "\n";
    $str .= "define(\"app_description\"," . chr(34) . trim(be("post", "app_description")) . chr(34) . ");        //网站描述信息" . "\n";
    $str .= "define(\"app_templatedir\"," . chr(34) . trim(be("post", "app_templatedir")) . chr(34) . ");    //模板目录" . "\n";
    $str .= "define(\"app_htmldir\"," . chr(34) . trim(be("post", "app_htmldir")) . chr(34) . ");      //模板html目录" . "\n";
    $str .= "define(\"app_cache\"," . trim(be("post", "app_cache")) . ");       //是否开启缓存" . "\n";
    $str .= "define(\"app_cachetime\"," . trim(be("post", "app_cachetime")) . ");       //缓存时间" . "\n";
    $str .= "define(\"app_cacheid\"," . chr(34) . trim($tempcacheid) . chr(34) . ");      //缓存标示" . "\n";
    $str .= "define(\"app_picpath\"," . trim(be("post", "app_picpath")) . ");      //图片保存路径方式,0=默认,1=按月份,2=按日期,3=每目录500图片,超过自动创建新目录" . "\n";
    $str .= "define(\"app_dbtype\"," . chr(34) . trim(be("post", "app_dbtype")) . chr(34) . ");      //数据库类型: 值分别为 access ; mssql" . "\n";
    $str .= "define(\"app_dbpath\"," . chr(34) . trim(be("post", "app_dbpath")) . chr(34) . ");      //access数据库路径" . "\n";
    $str .= "define(\"app_dbserver\"," . chr(34) . trim(be("post", "app_dbserver")) . chr(34) . ");      //SQL数据库服务器地址" . "\n";
    $str .= "define(\"app_dbname\"," . chr(34) . trim(be("post", "app_dbname")) . chr(34) . ");      \t\t\t\t\t  //SQL数据库名称" . "\n";
    $str .= "define(\"app_dbuser\"," . chr(34) . trim(be("post", "app_dbuser")) . chr(34) . ");      //SQL数据库用户名" . "\n";
    $str .= "define(\"app_dbpass\"," . chr(34) . trim(be("post", "app_dbpass")) . chr(34) . ");      \t\t\t\t\t  //SQL数据库密码" . "\n";
    $str .= "define(\"app_tablepre\"," . chr(34) . trim(be("post", "app_tablepre")) . chr(34) . ");      \t\t\t\t\t  //表结构前缀" . "\n";
    $str .= "define(\"app_icp\"," . chr(34) . trim(be("post", "app_icp")) . chr(34) . ");      //网站备案号" . "\n";
    $str .= "define(\"app_email\"," . chr(34) . trim(be("post", "app_email")) . chr(34) . ");      //站长邮箱" . "\n";
    $str .= "define(\"app_qq\"," . chr(34) . trim(be("post", "app_qq")) . chr(34) . ");      //站长qq" . "\n";
    $str .= "define(\"app_user\"," . trim(be("post", "app_user")) . ");          //是否开启会员验证0关闭,1开启" . "\n";
    $str .= "define(\"app_dynamiccache\"," . trim(be("post", "app_dynamiccache")) . ");          //是否开启动态文件缓存0关闭,1开启" . "\n";
    $str .= "define(\"app_timming\"," . trim(be("post", "app_timming")) . ");          //是否开启定时任务0关闭,1开启" . "\n";
    $str .= "define(\"app_install\",1);          //是否已经安装本程序0未安装,1已安装" . "\n";
    $str .= "define(\"app_safecode\"," . chr(34) . trim(be("post", "app_safecode")) . chr(34) . ");      //后台登录安全码" . "\n\n";
    $str .= "define(\"app_vodviewtype\"," . trim(be("post", "app_vodviewtype")) . ");        //视频首页、地图 浏览模式, 0=仿伪静态模式,1=asp动态模式,2=静态模式,3=rewrite伪静态" . "\n";
    $str .= "define(\"app_vodlistviewtype\"," . trim(be("post", "app_vodlistviewtype")) . ");        //视频列表页 浏览模式, 同上" . "\n";
    $str .= "define(\"app_vodtopicviewtype\"," . trim(be("post", "app_vodtopicviewtype")) . ");        //视频专题首页、列表 浏览模式, 同上" . "\n";
    $str .= "define(\"app_vodcontentviewtype\"," . trim(be("post", "app_vodcontentviewtype")) . ");        //视频内容页 浏览模式, 同上" . "\n";
    $str .= "define(\"app_vodplayviewtype\"," . trim(be("post", "app_vodplayviewtype")) . ");        //视频播放页 浏览模式, 0=仿伪静态模式,1=asp动态模式,2=rewrite伪静态,3=静态每数据一页,4=静态每集一页,5=静态每组一页,6=静态全站一页" . "\n";
    $str .= "define(\"app_vodsuffix\"," . chr(34) . trim(be("post", "app_vodsuffix")) . chr(34) . ");      //生成视频静态文件后缀名" . "\n";
    $str .= "define(\"app_vodmakeinterval\"," . trim(be("post", "app_vodmakeinterval")) . ");        //生成视频静态页面间隔" . "\n";
    $str .= "define(\"app_playtype\"," . trim(be("post", "app_playtype")) . ");        //0=有内容页播放,1=无内容页播放" . "\n";
    $str .= "define(\"app_encrypt\"," . trim(be("post", "app_encrypt")) . ");        //是否加密播放地址 0不加密,1 escape加密,2 base64加密" . "\n";
    $str .= "define(\"app_playisopen\"," . trim(be("post", "app_playisopen")) . ");        //否弹窗播放 0普通播放,1弹窗播放" . "\n";
    $str .= "define(\"app_vodlistpath\"," . chr(34) . trim(be("post", "app_vodlistpath")) . chr(34) . ");        //视频分类页面目录" . "\n";
    $str .= "define(\"app_vodpath\"," . chr(34) . trim(be("post", "app_vodpath")) . chr(34) . ");         //视频内容页面目录" . "\n";
    $str .= "define(\"app_vodplaypath\"," . chr(34) . trim(be("post", "app_vodplaypath")) . chr(34) . ");          //视频播放页面目录" . "\n";
    $str .= "define(\"app_vodtopicpath\"," . chr(34) . trim(be("post", "app_vodtopicpath")) . chr(34) . ");          //视频专题页目录" . "\n\n";
    $str .= "define(\"app_artviewtype\"," . trim(be("post", "app_artviewtype")) . ");        //文章首页、地图 浏览模式, 0=仿伪静态模式,1=asp动态模式,2=静态模式,3=rewrite伪静态" . "\n";
    $str .= "define(\"app_artlistviewtype\"," . trim(be("post", "app_artlistviewtype")) . ");        //文章列表页 浏览模式, 同上" . "\n";
    $str .= "define(\"app_arttopicviewtype\"," . trim(be("post", "app_arttopicviewtype")) . ");        //文章专题首页、列表 浏览模式, 同上" . "\n";
    $str .= "define(\"app_artcontentviewtype\"," . trim(be("post", "app_artcontentviewtype")) . ");        //文章内容页 浏览模式, 同上" . "\n";
    $str .= "define(\"app_artsuffix\"," . chr(34) . trim(be("post", "app_artsuffix")) . chr(34) . ");        //生成文章静态文件后缀名" . "\n";
    $str .= "define(\"app_artmakeinterval\"," . trim(be("post", "app_artmakeinterval")) . ");        //生成文章静态页面间隔" . "\n";
    $str .= "define(\"app_artlistpath\"," . chr(34) . trim(be("post", "app_artlistpath")) . chr(34) . ");        //文章列表目录" . "\n";
    $str .= "define(\"app_artpath\"," . chr(34) . trim(be("post", "app_artpath")) . chr(34) . ");        //文章页面目录" . "\n";
    $str .= "define(\"app_arttopicpath\"," . chr(34) . trim(be("post", "app_arttopicpath")) . chr(34) . ");          //文章专题页目录" . "\n\n";
    $str .= "define(\"app_watermark\"," . trim(be("post", "app_watermark")) . ");          //上传的图片是否添加水印 0关闭,1开启" . "\n";
    $str .= "define(\"app_waterlocation\"," . trim(be("post", "app_waterlocation")) . ");          //水印在图片的位置" . "\n";
    $str .= "define(\"app_waterfont\"," . chr(34) . trim(be("post", "app_waterfont")) . chr(34) . ");          //水印文字" . "\n";
    $str .= "define(\"app_gbook\"," . trim(be("post", "app_gbook")) . ");        //是否开启留言本 0关闭,1开启" . "\n";
    $str .= "define(\"app_gbooknum\"," . trim(be("post", "app_gbooknum")) . ");        //留言本每页显示数量" . "\n";
    $str .= "define(\"app_gbooktime\"," . trim(be("post", "app_gbooktime")) . ");        //留言时间间隔" . "\n";
    $str .= "define(\"app_gbookverify\"," . trim(be("post", "app_gbookverify")) . ");        //留言时是否开启验证码0关闭,1开启" . "\n";
    $str .= "define(\"app_gbookaudit\"," . trim(be("post", "app_gbookaudit")) . ");        //留言时是否需要审核0关闭,1开启" . "\n";
    $str .= "define(\"app_comment\"," . trim(be("post", "app_comment")) . ");        //是否开启评论 0关闭,1开启" . "\n";
    $str .= "define(\"app_commentnum\"," . trim(be("post", "app_commentnum")) . ");        //评论每页显示数量" . "\n";
    $str .= "define(\"app_commenttime\"," . trim(be("post", "app_commenttime")) . ");        //评论时间间隔" . "\n";
    $str .= "define(\"app_commentverify\"," . trim(be("post", "app_commentverify")) . ");        //评论时是否开启验证码0关闭,1开启" . "\n";
    $str .= "define(\"app_commentaudit\"," . trim(be("post", "app_commentaudit")) . ");        //评论时是否需要审核0关闭,1开启" . "\n";
    $str .= "define(\"app_mood\"," . trim(be("post", "app_mood")) . ");        //是否开启心情 0关闭,1开启" . "\n";
    $str .= "define(\"app_pagenum\"," . trim(be("post", "app_pagenum")) . ");          //后台列表每页显示个数" . "\n";
    $str .= "define(\"app_filter\"," . chr(34) . trim(be("post", "app_filter")) . chr(34) . ");          //评论和留言本过滤内容" . "\n";
    $str .= "define(\"app_reg\"," . trim(be("post", "app_reg")) . ");        //是否开启会员注册 1开启,0关闭" . "\n";
    $str .= "define(\"app_regpoint\"," . trim(be("post", "app_regpoint")) . ");        //用户注册赠送点数" . "\n";
    $str .= "define(\"app_regstate\"," . trim(be("post", "app_regstate")) . ");        //注册用户默认状态,1激活,0锁定" . "\n";
    $str .= "define(\"app_popularize\"," . trim(be("post", "app_popularize")) . ");        //推广1个人获取积分数" . "\n";
    $str .= "define(\"app_popularizestate\"," . trim(be("post", "app_popularizestate")) . ");        //是否开启推广赚积分1,开启 0关闭" . "\n";
    $str .= "define(\"app_reggroup\"," . trim(be("post", "app_reggroup")) . ");        //用户注册默认会员组" . "\n\n";
    $str .= "define(\"app_api\"," . trim(be("post", "app_api")) . ");        //接口API开关1开启,0关闭" . "\n";
    $str .= "define(\"app_apicjflag\"," . chr(34) . trim(be("post", "app_apicjflag")) . chr(34) . ");        //联盟图片域名,以http:开头,/结尾,不包含upload目录" . "\n";
    $str .= "define(\"app_apitypefilter\"," . chr(34) . trim(be("post", "app_apitypefilter")) . chr(34) . ");        //过滤分类参数,SQL查询条件例如 and t_hide=0" . "\n";
    $str .= "define(\"app_apivodfilter\"," . chr(34) . trim(be("post", "app_apivodfilter")) . chr(34) . ");        //过滤数据参数,SQL查询条件例如 and d_hide=0" . "\n";
    $str .= "define(\"app_apipagenum\"," . trim(be("post", "app_apipagenum")) . ");        //数据每页显示量" . "\n";
    $str .= "?" . ">";
    fwrite(fopen("../inc/config.php", "wb"), $str);
    //写入ftp配置
    $str = "<" . "?php" . "\n";
    $str .= "define(\"app_ftp\"," . trim(be("post", "app_ftp")) . ");        //ftp开关" . "\n";
    $str .= "define(\"app_ftphost\"," . chr(34) . trim(be("post", "app_ftphost")) . chr(34) . ");        //ftp主机ip" . "\n";
    $str .= "define(\"app_ftpuser\"," . chr(34) . trim(be("post", "app_ftpuser")) . chr(34) . ");        //ftp帐号" . "\n";
    $str .= "define(\"app_ftppass\"," . chr(34) . trim(be("post", "app_ftppass")) . chr(34) . ");        //ftp密码" . "\n";
    $str .= "define(\"app_ftpdir\"," . chr(34) . trim(be("post", "app_ftpdir")) . chr(34) . ");        //ftp目录" . "\n";
    $str .= "define(\"app_ftpport\"," . chr(34) . trim(be("post", "app_ftpport")) . chr(34) . ");        //ftp端口" . "\n";
    $str .= "define(\"app_ftpurl\"," . chr(34) . trim(be("post", "app_ftpurl")) . chr(34) . ");        //ftp远程附件访问地址" . "\n";
    $str .= "define(\"app_ftpdel\"," . trim(be("post", "app_ftpdel")) . ");        //上传成功后是否删除本地文件" . "\n";
    $str .= "?" . ">";
    fwrite(fopen("../inc/ftp.php", "wb"), $str);
    echo "配置修改成功";
}