<?php
/*  欢迎使用DM企业建站系统，本系统由www.demososo.com开发。
*/
require_once '../config_a/common.inc2010.php';
//
 if($act <> "pos") zb_insert($_POST);
 
if($pidname<>'') {ifhaspidname(TABLE_BLOCK,$pidname);}


if($tid<>'') {ifhasid(TABLE_BLOCK,$tid);}




/*
if (!in_array($type,$arr_group_type))
  {
  echo "error,type:".$type.' not exist...... in array:arr_group_type' ;
  exit;
  }
*/

 
//ifhaspidname(TABLE_NODE,$pid);
//ifhaspidname(TABLE_CATE,$catpid);
ifhave_lang(LANG);//TEST if have lang,if no ,then jump
 $menuactive_block = 'nav-active';

$jumpv='mod_block_copy.php?lang='.LANG;
$jumpvp=$jumpv.'&pidname='.$pidname;

$jumpvinsert=$jumpvp.'&act=add';  
 

 

 $title = '区块复制管理'.$ppid;

$title2= $title ;




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

require_once HERE_ROOT.'mod_common/tpl_header_iframe.php';
 
 if($act=='add'){

  $sourcelang = $abc1;

 $sqlsub = "SELECT * from ".TABLE_BLOCK."  where pidname='$pidname' $andlangbh order by id limit 1";
                //echo $sqlsub;exit;
              $v = getrow($sqlsub);
              if($v=='no')  { echo 'no block id by pidname'; exit; }
              else{
                  $arrkey = array_keys($v); 
               //   pre($arrkey);

                      $sqlkey = $sqlvalue= '';

                       foreach ($arrkey as $key => $value) {
                          // echo $value.'<br />';
                           //echo $v[$value].'<br />';

                          //echo htmlspecialchars($v[$value]).'<br />';

                           $sqlkey .= ','.$value;

                           //$vv = htmlspecialchars($v[$value]); //phpmyadmin need it
                           $vv =$v[$value];
                            $vv=str_replace("'","",$vv);
                            $vv=str_replace("\'","",$vv);

                             //echo $vv.'<br />';


                            if(!is_int($v[$value])) {
                               if($value=='name')  $vv  = '[复制区块]'.$vv; 
                               else if($value=='lang')  $vv  =  $sourcelang; 
                               else if($value=='pidname')  $vv  =  'vblock' . $bshou;; 
                                $vv = "'".$vv."'";
                            }

                           if($key<>0){                            
                               $sqlvalue .= ','.$vv;                 
                           } 
                          
                

                       }
                  $daokey = substr($sqlkey,4);
                  $daovalue = substr($sqlvalue,1); 

              }


$insert_sql= "insert into ".TABLE_BLOCK." ($daokey) values ($daovalue);";
//echo $insert_sql; exit;
iquery($insert_sql); 
 echo '<p style="padding:100px 0 5px 0;text-align:center;font-size:16px;">复制区块完成。</p>';
 echo '<p style="padding:10px 100px;text-align:center;font-size:16px;">复制语言为：'.$abc1.'</p>';

}
else{


 
?>

 <div class="page-title-box">
  <h4 class="page-title"><?php echo $title2;?>   </h4>
                   
   <div class="clearfix"></div>
 </div>
   <!--End Page Title-->          
           
           
                  <!--Start row-->
                  <div class="row">
                    <div class="col-md-12">
                       <div class="white-box" style="padding:50px">
 
 
<?php 
 
 //echo $pidname;

$arrlang = [];
 $sql = "SELECT * from ".TABLE_LANG." where pbh='".USERBH."' and  sta_visible='y' order by pos desc,id";
$arrlang = getall($sql);
//pre($arrlang);
   ?>
<form  action="<?php echo $jumpvinsert; ?>" method="post" enctype="multipart/form-data">
  
   复制到：

   <select name="copytolang">
    <?php 
      foreach($arrlang as $v){ 
    ?>
    <option name="lang" value="<?php echo $v['lang']?>"><?php echo $v['lang']?> ( <?php echo $v['name']?> )</option>
   <?php 
 }

 ?>
   

  </select>
  <p>
   <input  class="mysubmit mysubmitbig" type="submit" name="Submit" value="提交" />

 </p>
</form>

  
 </div> </div> </div>

 <?php 
}
?>
<?php
require_once HERE_ROOT.'mod_common/tpl_footer_iframe.php';
?>

 