示例#1
0
 public function update()
 {
     $filename = trim($_POST['filename']);
     $content = stripslashes(htmlspecialchars_decode($_POST['content']));
     if (!testwrite(substr($filename, 0, strrpos($filename, '/')))) {
         $this->error('在线编辑模板需要给' . __ROOT__ . "/Web/Tpl" . '添加写入权限!');
     }
     if (empty($filename)) {
         $this->error('模板文件名不能为空!');
     }
     if (empty($content)) {
         $this->error('模板内容不能为空!');
     }
     write_file($filename, $content);
     if (!empty($_SESSION['tpl_jumpurl'])) {
         $this->assign("jumpUrl", $_SESSION['tpl_jumpurl']);
     } else {
         $this->assign("jumpUrl", '?s=Tpl/index');
     }
     $this->success('恭喜您,模板更新成功!');
 }
示例#2
0
 public function update()
 {
     $filename = trim($_POST['filename']);
     $content = stripslashes($_POST['content']);
     if (!testwrite(substr($filename, 0, strrpos($filename, '/')))) {
         $this->error('在线编辑模板需要给' . TEMPLATE_PATH . '添加写入权限!');
     }
     if (empty($filename)) {
         $this->error('模板文件名不能为空!');
     }
     if (empty($content)) {
         $this->error('模板内容不能为空!');
     }
     $tpl = $filename;
     write_file($tpl, $content);
     if (!empty($_SESSION['tpl_reurl'])) {
         $this->assign("jumpUrl", $_SESSION['tpl_reurl']);
     } else {
         $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Tpl/Show');
     }
     $this->success('恭喜您,模板更新成功!');
 }
     <td><strong>写入权限</strong></td><?php 
$dirs = array('/', '/temp/*', '/uploads');
?>
   
</tr>
<?php 
foreach ($dirs as $d) {
    ?>
  <tr><td><?php 
    echo $d;
    ?>
</td>
  <?php 
    $fulld = './' . str_replace('/*', '', $d);
    $rsta = is_readable($fulld) ? '<font color=green>[√]读</font>' : '<font color=red>[×]读</font>';
    $wsta = testwrite($fulld) ? '<font color=green>[√]写</font>' : '<font color=red>[×]写</font>';
    echo "<td>{$rsta}</td><td>{$wsta}</td>";
    ?>
 </tr>
<?php 
}
?>
<tr bgcolor="#FFFFFF" class="tb_head">
    <td height="70" colspan="3" align="center">
    <input style="width:120px; height:30px;" type="button" class="btn"  value="<< 上一步"  onClick="history.back();"/>
    <input style="width:120px; height:30px;" type="submit" name="submit" value="下一步 >>" class="btn">
    </td>
</tr>             
</table>
<div id='msgbottom'>Powered By <?php 
echo C("cms_name");