<?php
/*
	power by JASON.ZHANG  DM建站  www.demososo.com
*/
if(!defined('IN_DEMOSOSO')) {
	exit('this is wrong page,please back to homepage');
}

 $jumpvback=$jumpv.'&pid='.$pid.'&type='.$type.'&type2='.$type2;
$jumpvback_update=$jumpvback.'&act=update';
$jumpvback_insert=$jumpvback.'&act=insert';
 
if($act=='insert'){ 
  
      $pidname = 'ndtext'.$bshou; 
       

      $sql="select * from ".TABLE_NODETEXT." where pid='$pid' and type='$type' and type2='$type2' $andlangbh order by id";
      if(getnum($sql)){
        echo '不能创建，已经存在。';exit;
      }


       $ss = "insert into ".TABLE_NODETEXT." (pid,pidname,pbh,type,type2,lang) values ('$pid','$pidname','$user2510','$type','$type2','".LANG."')";
       
       iquery($ss);

       $jumpv_file='../mod_node/mod_node_pop.php?pid='.$pid.'&lang='.LANG.'&type='.$type.'&type2='.$type2.'&act=edit'; 
       jump($jumpvback);
   
}


else if($act == "del")
{
     
      ifsuredel_field(TABLE_NODETEXT,'id',$tid,'equal',$jumpvback);
      jump($jumpvback);

}



 else if($act=='update'){
  //pre($_POST);


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

       
      //  $despjj = zbdesp_onlyinsert($_POST['despjj']); 
         $desp = zbdesp_onlyinsert($_POST['despcontent']); //note: desp and addr not use variable abc1.
          $desptext = zbdesp_onlyinsert($_POST['editor1text']);
       
      $ss = "update ".TABLE_NODETEXT." set  desptext='$desptext',desp='$desp'  where id='$tid' $andlangbh limit 1";
      	 //  echo $ss;exit;
        iquery($ss);

        jump($jumpvback);
       
 
 }

else {
 

//---
$sql="select * from ".TABLE_NODETEXT." where pid='$pid' and type='$type' and type2 = '$type2'  $andlangbh order by id limit 1";
//echo $sql;
$row=getrow($sql);
 if($row=='no') {
    echo '没有记录 ';
    echo '<a href="'.$jumpvback_insert.'">点击创建</a>';
 }
 
else{

  $tid=$row['id'];   
  $desp=zbdesp_imgpath($row['desp']);
   $desptext=zbdesp_imgpath($row['desptext']);
  
 
  $jsname = '';

  $del_text= " <a href=javascript:delid('del','$tid','$jumpvback','$jsname')  class=but2><i class='fa fa-trash-o'></i> 删除</a>";
  

  echo  $del_text;
  

  $jumpvback_update = $jumpvback_update.'&tid='.$tid;
 ?>
   
 
  <form  action="<?php echo $jumpvback_update; ?>" method="post" enctype="multipart/form-data">


 
  <table class="formtab" >
 
 
   <tr>
  
      <td>
 
      <?php 
      $pidname= $pid;//for ck img
      
      require ('../plugin/editor_textarea.php');//textarea is in this file
      ?>

        </td>
    </tr>
 



  </table>
 

 

<div class="c tc"> 
 
 <input class="mysubmit mysubmitbig"     type="submit" name="Submit" value="提交" /> 
     
 <?php echo $inputmust;?>

 </div>

 </form>

   <?php 
   //require_once('../plugin/editor_imgintroduce.php'); 
   ?>


<?php
  }
}
  ?>
 
 
 