发布站点到远程FTP根目录

第一步:修改 phpcms/modules/admin/templates/site_add.tpl.php 找到

<legend><?php echo L('release_point_configuration')?></legend>

大约在64行的位置
将他下面的整个table 替换成如下代码

<table width="100%" class="table_form">
<tr>
<th width="80" valign="top"><?php echo L('release_point')?>:</th>
<td> <select name="release_point[]" size="3" id="release_point" multiple title="<?php echo L('ctrl_more_selected')?>" οnchange="if($(this).val() > 0){$('#ftp_top').show();}else{$('#ftp_top').hide();}">
<option value='' selected><?php echo L('not_use_the_publishers_some')?></option>
<?php if(is_array($release_point_list) && !empty($release_point_list)): foreach($release_point_list as $v):?>
<option value="<?php echo $v['id']?>"><?php echo $v['name']?></option>
<?php endforeach;endif;?>
</select> </td>

</tr>
<tr id="ftp_top" style="display:none" >
<th width="120" valign="top">发布到FTP根目录:</th>
<td><input type="radio" name="setting[ftp_top]" value="1" /> 是 <input type="radio" name="setting[ftp_top]" value="0" checked /> 否 <br />注:如果选择是 那么远程FTP将不会包含站点目录,适用于不能子目录绑定的FTP!!</td>
</tr>

</table>

二步 :修改 phpcms/modules/admin/templates/site_edit.tpl.php 找到

<legend><?php echo L('release_point_configuration')?></legend>
<table width="100%" class="table_form">
<tr>
<th width="80" valign="top"><?php echo L('release_point')?>:</th>
<td> <select name="release_point[]" size="3" id="release_point" multiple title="<?php echo L('ctrl_more_selected')?>" οnchange="if($(this).val() > 0){$('#ftp_top').show();}else{$('#ftp_top').hide();}">
<option value='' <?php if(!$data['release_point']) echo 'selected';?>><?php echo L('not_use_the_publishers_some')?></option>
<?php if(is_array($release_point_list) && !empty($release_point_list)): foreach($release_point_list as $v):?>
<option value="<?php echo $v['id']?>"<?php if(in_array($v['id'], explode(',',$data['release_point']))){echo ' selected';}?>><?php echo $v['name']?></option>
<?php endforeach;endif;?>
</select></td>
</tr>
<tr id="ftp_top" <?php echo $data['release_point'] ? '' : 'style="display:none"'?> >
<th width="120" valign="top">发布到FTP根目录:</th>
<td><input type="radio" name="setting[ftp_top]" value="1" <?php echo $setting['ftp_top'] ? 'checked' : '';?> /> 是 <input type="radio" name="setting[ftp_top]" value="0" <?php echo $setting['ftp_top'] ? '' : 'checked';?> /> 否 <br />注:如果选择是 那么远程FTP将不会包含站点目录,适用于不能子目录绑定的FTP!!</td>
</tr>

</table>

第三步: 修改  phpcms/modules/release/index.php

foreach ($data as $v) {

 

将整个foreach循环改成如下

 
if(strpos($this->site['setting'], "'ftp_top' => '1'"))$ftp_top = pc_base::load_config('system','html_root');
   foreach ($data as $v) {
    $status = -1;
    $n_path = isset($ftp_top) ? preg_replace(array('|^'.$ftp_top.'/'.$this->site['dirname'].'/|iUs', '|^/'.$this->site['dirname'].'/|iUs'), '', $v['path']) : $v['path'];
    switch ($v['type']) {
     case 'del':
      if ($ftps->f_delete($release_point['path'].$n_path)) {
       $status = 1;
      }
      break;
     case 'add':
     case 'edit':
      if ($ftps->put($release_point['path'].$n_path, PHPCMS_PATH.$v['path'])) {
       $status = 1;
      }
      break;
    }
    $queue->update(array('status'.($id+1)=>$status, 'times'=>SYS_TIME), array('id'=>$v['id']));
   }

 

转载于:https://www.cnblogs.com/wangchuang/p/3201554.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值