<?php
empty($bpv[4]) && yun_error(mlang('权限不足'));
$uannex = uannex();
$row=$db->fetch_first('select * from '.PF.'page where id="'.MID.'"');

if(IS_POST){
    
  require_once (ABSPATH.'includes/class_content.php');
     
foreach($conf['sys_elangs'] as $k=>$v){
        mb_strlen($_POST['title'][$k],'utf-8')>(65535/count($conf['sys_elangs'])) && yun_error(mlang('标题太长'));
        mb_strlen($_POST['content'][$k],'utf-8')>(4294967295/count($conf['sys_elangs'])) && yun_error(mlang('内容太长'));
        mb_strlen($_POST['doc'][$k],'utf-8')>65535 && yun_error(mlang('概述太长'));
}

mb_strlen($_POST['keys'][$k],'utf-8')>255 && yun_error(mlang('关键字太长'));
mb_strlen($_POST['thumb'][$k],'utf-8')>255 && yun_error(mlang('缩略图地址太长'));


$_title=postlangdatas('title');
$_doc=postlangdatas('doc');
$_content=postlangdatas('content');


$arr = array();
    
    $arr['title'] = $_title;
    foreach($conf['sys_elangs'] as $k=>$v){
    $arr['content'][$k] = content::annex('m'.MID,date('y_',$row['post_time']).ceil(date('z',$row['post_time']) / 5),$_content[$k]); //处理上传附件
    }
    $arr['doc'] = $_doc;
    $arr['keyword'] = trim($_POST['keyword']);
    $arr['thumb'] = trim($_POST['thumb']);
  
    $db->query("update ".PF."page set val='".addslashes(serialize($arr))."' where id='".MID."'");

yun_succeed('编辑成功',url(RPG.PAGE.'/'));
}

$post=$row['val']<>''?unserialize($row['val']):array();

apply('tpl_title',xlang($post['title']));
apply('tpl_keywords',$post['keyword']);
apply('tpl_description',$post['thumb']);


ini_editor('xheditor');
arg($post,$uannex);
?>