<?php
/*  欢迎使用DM企业建站系统，本系统由www.demososo.com开发。
*/
$mod_previ = 'normal';//default is admin,and set in common.inc
$mod_previ_except = 'y';
require_once '../config_a/common.inc2010.php';
//require_once HERE_ROOT.'config_a/func.previ.php';//when normal,require is here.

exit;
//no use bdfanyi 2022.3

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

if($act <> "pos") zb_insert($_POST);
//

if($pidname==''){
  echo 'pidname is not allow to be null';
}

//if($type=='node') { ifhaspidname(TABLE_NODE,$pid); }
 //else if($type=='block') {
   //     if($pid<>'0')  { echo 'type is block,then pid must be 0.';exit; }
  //} 
  //else { echo 'type is error...';exit;}

  //-----------
//---------------------- 
 
$jumpv='mod_fanyi.php?lang='.LANG.'&pidname='.$pidname;

$title=$title1='百度翻译';
$title2='';


//http://api.fanyi.baidu.com/manage/developer 
//https://api.fanyi.baidu.com/doc/21

$appid = '20211111000996445';
$seckey = 'CMHDPFCX2cdtCtGKEQml';

require_once HERE_ROOT.'mod_fanyi/baidu_transapi.php';
require_once HERE_ROOT.'mod_fanyi/baidu_lang.php';


function dmbaidutrans($query,$from,$to){  
global $baidulang;

 $from = $baidulang[$from]; //匹配百度语言
 $to = $baidulang[$to];  
 //echo $from.'-'.$to.


   
    // $query = str_replace("<p>","666666666",web_despdecode($query));
    //$query = str_replace("</p>","999999999",web_despdecode($query));

   $query = strip_tags(web_despdecode($query)); 
   $trans_res = translate($query, $from, $to);
  
   //isset($trans_res['trans_result']){
   if(array_key_exists('trans_result', $trans_res)){  
        $trans_result = $trans_res['trans_result'];  
        $rev = '';        
        if(count($trans_result)==1) $rev = $trans_result[0]['dst'];
        else{
             foreach($trans_result  as $v){
                 $vstr = $v['dst'];
               //  $vstr = str_replace("666666666","<p>",$vstr);
               //  $vstr = str_replace("999999999","</p>",$vstr);

                 if($rev=='') $rev = $vstr;
                 else $rev  = $rev.'<br />'.$vstr;
                    
               }
        }
        
        sleep(1.2);   

    return $rev;

   }else{
      echo '<br />错误提示：error_code:'.$trans_res['error_code'].' - error_msg:'.$trans_res['error_msg'];
      exit;
   } 
 

  // echo "<div>$from - $to - $query </div>";
  

}

  require_once HERE_ROOT.'mod_common/tpl_header.php';

?> 

 
 <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 class="plr0">百度翻译文档： https://api.fanyi.baidu.com/doc/21 </p>             

<?php

      $string4 = substr($pidname,0,4);
      if($string4 == 'node')  $file = 'node';
      else if($string4 == 'page')  $file = 'page';
      else if($string4 == 'cate' || $string4 == 'csub')  $file = 'cate';
      else{
        echo 'wrong pidname';
        exit;
      }
     

$jumpv_file='mod_fanyi.php?lang='.LANG.'&pidname='.$pidname.'&file='.$file;


 require_once HERE_ROOT.'mod_fanyi/tpl_fanyi_'.$file.'.php';

?>




          <div class="c"></div>

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

<?php


 require_once HERE_ROOT.'mod_common/tpl_footer.php';

?>



