<?php
/*  欢迎使用DM企业建站系统，本系统由www.demososo.com开发。
*/

//这个功能本来是合并effect css的，没必要了。
echo 'no use';
exit;




require_once '../config_a/common.inc2010.php';
//
if($act <> "pos") zb_insert($_POST);


//ifhaspidname(TABLE_NODE,$pid);
//ifhaspidname(TABLE_CATE,$catpid);
ifhave_lang(LANG);//TEST if have lang,if no ,then jump

$menuactive_module = 'nav-active';

$jumpv='mod_effectcss.php?lang='.LANG;


//----
$submenu='module';
$title = 'effect样式设置 ';


//-----------

require_once HERE_ROOT.'mod_common/tpl_header.php';



if($act=='update'){

  if(@$_POST['inputmust']=='') {  echo $inputmusterror.$backlist;exit; }


  $arrcanexcerpt =  array("effectcss_hb");

  $bscnt22 = '';
  if(count($_POST)>1){
    foreach ($_POST as  $k=>$v) {
     if(strtolower($k)=='submit') break;if(strtolower($k)=='inputmust') break;
     if(in_array($k,$arrcanexcerpt))   continue;

     $bscnt22 .= $k.':##'.htmlentitdm(trim($v)).'==#==';

   }
 }
 $bscnt22 = substr($bscnt22,0,-5);

//---------------
 $effectcss_hb =  htmlentitdm(@$_POST['effectcss_hb']);
 $effectcss_hb=str_replace("\\","/",$effectcss_hb);
 $effectcss_hb=str_replace(chr(13),"|",$effectcss_hb);
 $effectcss_hb=str_replace(chr(32),"",$effectcss_hb);





 $ss = "update ".TABLE_LANG." set  arr_effectcss='$bscnt22',effectcss_hb='$effectcss_hb' where lang='".LANG."' limit 1";
  // echo $ss;exit;
 iquery($ss);
 //alert("修改成功");

 jump($jumpv);



}
else{


 $sql = "SELECT  arr_effectcss,effectcss_hb from ".TABLE_LANG."  where  lang='".LANG."' and pbh='".USERBH."'    order by id limit 1";
 //echo $sql;exit;
 $row = getrow($sql);

 $arr_can = $row['arr_effectcss'];
 $effectcss_hb1=$row['effectcss_hb'];
 $effectcss_hb=str_replace("|",chr(13),$effectcss_hb1);
 
 $effectcss_bt = $effectcss_import  =  'n';
 

 $bscntarr = explode('==#==',$arr_can);
 if(count($bscntarr)>1){
  foreach ($bscntarr as   $bsvalue) {
   if(strpos($bsvalue, ':##')){
     $bsvaluearr = explode(':##',$bsvalue);
     $bsccc = $bsvaluearr[0];
     $$bsccc=$bsvaluearr[1];
   }
 }
}


effectcss_gene($effectcss_import,$effectcss_hb1);




$jump_update=$jumpv.'&act=update';


?>

<div class="page-title-box">
  <h4 class="page-title"><?php echo $title?></h4>

  <div class="clearfix"></div>
</div>
<!--End Page Title-->          


<!--Start row-->
<div class="row">
  <div class="col-md-12">
   <div class="white-box">

    <p>
      如果使用DM-block\jthome\jthome_effect里的效果，则需要在这里进行相关配置。
    </p>

    <?php 
    $rooteffect = JTHOMEROOT.'jthome_effect';
    if(!is_dir($rooteffect)) {
     echo '<p class="cred">jthome_effect目录不存在。请看： https://www.demososo.com/jthome_effect.html</p>';
   }
   else {
    ?>

    <form  onsubmit="javascript:return checkhere(this)" action="<?php echo $jump_update;?>" method="post">
      <table class="formtab">




        <tr>
          <td class="tr"> 开启effect样式：</td>
          <td> 

            <select name="effectcss_bt">
              <?php
              select_from_arr($arr_yn,$effectcss_bt,'');?>
            </select>


            <p class="cgray">如果开启，会调用bootstrap.css和swiper插件的cssjs</p>
          </td>
        </tr>



        <tr>
          <td   class="tr"> 合并css：
          </td>
          <td >
           使用import css形式： 
           <select name="effectcss_import">
            <?php
            select_from_arr($arr_yn,$effectcss_import,'');?>
          </select>


          <p class="cgray">如果要修改effect里的css，必须选择 "是"。 

          </p>

          <div style="margin:5px 0;border-bottom: 1px solid #ccc;"> </div>


          输入要合并的css: <br />
          <textarea class="form-control" rows="10" name="effectcss_hb"><?php echo $effectcss_hb; ?></textarea> <?php echo $xz_maybe; ?>

<?php 
 if($effectcss_hb1<>''){

 ?>
          <p><a href="<?php echo STAPATH?>assets/cssjs/jthome_effect.css" target="_blank">查看 jthome_effect.css ></a></p>
          <?php
          }
          ?>
        </td>
      </tr>



      <tr>
        <td></td>
        <td>
          <br /> <br />
          <input  class="mysubmit" type="submit" name="Submit" value="提交">
          <br />

          <br />
        </td>
      </tr>
      <tr>
        <td></td>
        <td>
          <?php
          if($effectcss_hb1<>'') {
            $arr = explode('|',$effectcss_hb1);
            // pre($arr);
            foreach($arr as $v){
             $v = trim($v);
             $cssroot = JTHOMEROOT.'jthome_effect/'.$v;
             $csspath = JTHOMEPATH.'jthome_effect/'.$v;

             $v2 = '<a href="'.$csspath.'" target="_blank">'.$v.'</a>';
             if(is_file($cssroot)){ 
               echo $v2.'<br />';
             }
             else {
                  // echo $cssroot.'<br />';
               echo $v2.'<span class="cgray">(不存在)</span><br />';
             }
           }
         }

         ?>
       </td>
     </tr>

   </table>

   <?php echo $inputmust;?>

 </form>
</div>

<?php 
}
?>

</div></div>



<?php
}


function effectcss_gene($effectcss_import,$effectcss_hb1){

 $jthome_effect = STAROOT.'assets/cssjs/jthome_effect.css';

 if($effectcss_hb1=='') {
     $csscnt ='';
    }
   else{
             $arr = explode('|',$effectcss_hb1);

             if($effectcss_import=='y') { //调试中，生成import css

              $csscnt = '';

              foreach($arr as $v){
                   $v = trim($v);
                   $cssroot = JTHOMEROOT.'jthome_effect/'.$v;
                   $csspath = JTHOMEPATH.'jthome_effect/'.$v; 
                   if(is_file($cssroot)){ 
                    $csscnt .=  "@import url('$csspath');\n";
                  }

               } 


      }else{
             $csscnt =  '@charset "UTF-8"; '."\n /* 合并的css ,不要直接修改本文件。本文件由后台设置而成。\n";
                 foreach($arr as $v){
                       $v = trim($v); 
                       $cssroot = JTHOMEROOT.'jthome_effect/'.$v; 

                       if(is_file($cssroot)){  
                         $csscnt .=  "*   $v\n";
                       }

                 } 
                 $csscnt .= " */\n";
                  //------------------
                 foreach($arr as $v){
                       $v = trim($v);
                       $cssroot = JTHOMEROOT.'jthome_effect/'.$v; 
                       if(is_file($cssroot)){ 
                            $csscnt .= " /* $v */ \n";

                            $csswill = file_get_contents($cssroot);
                            $arr_ya = array("\r\n", "\r", "\n", "\t") ;
                            $csswill = str_replace($arr_ya, "", $csswill) ; 
                            $csscnt .=  $csswill."\n\n";
                      }

          }

     //----------------


          }
      }

file_put_contents($jthome_effect,$csscnt);

}


require_once HERE_ROOT.'mod_common/tpl_footer.php';

?>
