<?php
/*	欢迎使用DM企业建站系统，本系统由www.demososo.com开发。
*/
$mod_previ = 'normal';//default is admin,and set in common.inc
require_once '../config_a/common.inc2010.php';
$switchlanglink = 'mod_node/mod_node.php?';
$menu_content = 'y';
//
$editnodetid = $tid; //use for edit cate.not del --tpl_node_tab.php
ifhave_lang(LANG);//TEST if have lang,if no ,then jump
if($act <> "pos") zb_insert($_POST);

$menuactive_cate = 'nav-active';
$leftsidecollapsed='y';
//-----------------------------
$jumpv='mod_node_edit.php?lang='.LANG.'&tid='.$tid;
$jumpv_file=$jumpv.'&file='.$file;

  
//-----------
 $sql="select * from ".TABLE_NODE." where id='$tid' $andlangbh order by id limit 1";
$row=getrow($sql);
if($row=='no'){
  echo '出错，没有此内容！';
  echo '<a href="../mod_common/mod_index.php?lang='.LANG.'">返回后台首页></a>';
  exit;
}
else{ 
 // pre($row);

$title=$row['title'];$titlestyle=$row['titlestyle'];
$pid=$row['pid'];   $albumid=$row['albumid'];   
 $langrelid = addslashes($row['langrelid']); //避免输入引号，则会引起mysql报错。

$pidmulti=$row['pidmulti'];  
$catpid_langrel = $catpid=$row['ppid']; //catpid_langrel for langrel.not del
$curnodepidname = $pidname  =$row['pidname'];$alias_jump=$row['alias_jump'];  
$kv=$row['kv'];$kvsm=$row['kvsm'];$kvsm2=$row['kvsm2'];

 
 
// if(strlen($pidarr)>30){
//      $pidarr2 = explode("-",$pidarr);
//       $pid = $pidarr2[0];
// }
// else  $pid = $pidarr;

 
//ifhaspidname(TABLE_CATE,$pid); //not use it.if cate wrong,then change node cate
 
 
$date=$row['dateedit'];
if($date=='') $date= date("Y-m-d");
//---
 $sqlcatmain="select * from ".TABLE_CATE." where pidname='$catpid' $andlangbh order by id limit 1";
$rowcatmain=getrow($sqlcatmain);
 
$mainarr_can=$rowcatmain['arr_can'];
//$mainarr_can = get_field(TABLE_CATE,'arr_can',$catpid,'pidname');
//get sta_field from cate arr_can
$bscntarr = explode('==#==',$mainarr_can); 
     if(count($bscntarr)>1){
          foreach ($bscntarr as   $bsvalue) {
             if(strpos($bsvalue, ':##')){
               $bsvaluearr = explode(':##',$bsvalue);
               $bsccc = $bsvaluearr[0];
               $$bsccc=$bsvaluearr[1];
             }
          }
      }



//------
}
//---
require_once HERE_ROOT.'config_a/func.previ.php';//when normal,require is here.bec need catpid

/********************************************************/


$maincate = get_field(TABLE_CATE,'name',$catpid,'pidname');
$subcate = get_field(TABLE_CATE,'name',$pid,'pidname');


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

$title= '内容修改 - '.$title;
 
/****************************/
//
//$fo_bef='upp/';$fo_now=$imgfo_abm;--put to imgprotect.php
/**
*
*****************************************/


if($act == "sta_node")
{
   
}

if($act == "pos")
{
    
}

/**/
if($act == "delnode") 
{ 
  //no here
 
}



if($act == "delvideo")
{ 
  
   //update videoid in page table
   $ss = "update " . TABLE_NODE . " set videoid=''  where id='$tid'  $andlangbh limit 1"; 
    iquery($ss); 

    //del video
    //$pidname use value from above ,in selec from page...,so use pid=page pidname
    $sqlsub = "SELECT * from ".TABLE_VIDEO."  where pid='$pidname' and type='node' $andlangbh order by id limit 1";
     //echo $sqlsub;exit;
    $rowsub = getrow($sqlsub);
    $imgsqlname = $rowsub['kv'];
    $pidname = $rowsub['pidname'];
 
       
      if($imgsqlname<>'')  p2030_delimg($imgsqlname,'y','n');
        ifsuredel_field(TABLE_VIDEO,'pidname',$pidname,'eq',$jumpv_file);
     

 }



/*****
****
***
*********************/
 
require_once HERE_ROOT.'mod_common/tpl_header.php'; //tpl_header_img
 
?>

 <div class="page-title-box">
    <h4 class="page-title"><?php echo $title?></h4>
   
      <ol class="breadcrumb">
        <li><?php echo $breadfaicon?>         
        内容修改 </li>
        <li class="active">
        <a href="../mod_node/mod_node.php?lang=<?php echo LANG;?>&catpid=<?php echo $catpid?>&page=0"><?php echo $maincate;?></a>
        </li>

        <?php 
          if($pid<>$catpid) {
        ?>
         <li class="active">
        <a href="../mod_node/mod_node.php?lang=<?php echo LANG;?>&catpid=<?php echo $catpid?>&catid=<?php echo $pid?>&page=0"><?php echo $subcate;?></a>
        </li>
       <?php 
        }
       ?>

      </ol>
   
<div class="clearfix"></div>
  </div>

  
 
<div class="row">
                    <div class="col-md-12">
                       <div class="white-box">
      
        <?php   
        require_once HERE_ROOT.'mod_node/tpl_node_tab.php';      
       
 if(  $file=='nodeprocan' || $file=='nodetab1' || $file=='nodetab2' || $file=='nodetab3'){
      
      $framesrc='mod_node_pop.php?pid='.$pidname.'&lang='.LANG.'&type=node&type2='.$file.'&file=nodetext'; 
      iframenormal($framesrc,1000);
   }
 
 elseif($file=='editfield--'){
     //$framesrc='../mod_field/mod_fieldvalue.php?pid='.$pidname.'&catpid='.$catpid.'&lang='.LANG.'&type=cate';
    // iframepage($framesrc);
  }

   elseif($file=='edittag'){
    // $framesrc='../mod_tag/mod_tagnode.php?file=addnode&pid='.$pidname.'&catpid='.$catpid.'&lang='.LANG.'&type=cate';
    // iframepage($framesrc);
  }

  elseif($file=='editalbum'){
     //$framesrc='mod_pop_album_other.php?type=album&pid='.$pidname.'&lang='.LANG;
     //iframepage($framesrc);
     //  $num = num_subnode(TABLE_ALBUM,'pid',$pidname);
      //  $link = '../mod_album/mod_album.php?lang='.LANG.'&pid='.$pidname.'&type=node';
     // echo  "<p style='padding:50px;text-align:left'><a class='needpopup'  href='$link'>管理图片</a> ($num)<p>";
   
  
  }
  elseif($file=='editvideo'){
    //$framesrc='mod_pop_album_other.php?type=album&pid='.$pidname.'&lang='.LANG;
    //iframepage($framesrc);
     // $num = num_subnode(TABLE_VIDEO,'pid',$pidname);
    //   $link = '../mod_album/mod_album.php?lang='.LANG.'&pid='.$pidname.'&type=node';
    // echo  "<p style='padding:50px;text-align:left'><a class='needpopup'  href='$link'>管理图片</a> ($num)<p>";
  
 
 }
  else{
        $file = HERE_ROOT.'mod_node/tpl_node_'.$file.'.php';
          if(checkfile($file)) require $file; 
   }
   

        ?>
 </div></div></div>
<?php


require HERE_ROOT.'mod_common/tpl_footer.php';
 
?>
