when submit, favicon, mobicon delete also

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12539 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2013-01-11 10:01:48 +00:00
parent 1d08b7b71a
commit 7b0c09b083
2 changed files with 12 additions and 5 deletions

View file

@ -92,7 +92,7 @@
<img src="{$favicon_url}" alt="favicon" width="16" height="16" class="fn1"> <img src="{$favicon_url}" alt="favicon" width="16" height="16" class="fn1">
<img src="{$favicon_url}" alt="favicon Image" width="16" height="16" class="fn2"> <img src="{$favicon_url}" alt="favicon Image" width="16" height="16" class="fn2">
</p> </p>
<button type="button" onclick="javascript:deleteIcon('favicon\.ico')" class="x_btn x_btn-link">{$lang->cmd_delete}</button> <input type="checkbox" name="is_delete_favicon" value="1" /> {$lang->cmd_delete}
<input type="file" name="favicon" id="favicon" title="favicon" /> <input type="file" name="favicon" id="favicon" title="favicon" />
<span class="x_help-block">{$lang->about_use_favicon}</span> <span class="x_help-block">{$lang->about_use_favicon}</span>
</div> </div>
@ -104,7 +104,7 @@
<img src="{$mobicon_url}" alt="Mobile Home Icon" width="32" height="32" /> <img src="{$mobicon_url}" alt="Mobile Home Icon" width="32" height="32" />
<span>www</span> <span>www</span>
</p> </p>
<button type="button" onclick="javascript:deleteIcon('mobicon\.png')" class="x_btn x_btn-link">{$lang->cmd_delete}</button> <input type="checkbox" name="is_delete_mobicon" value="1" /> {$lang->cmd_delete}
<input type="file" name="mobicon" id="mobicon" title="Mobile Home Icon"/> <input type="file" name="mobicon" id="mobicon" title="Mobile Home Icon"/>
<span class="x_help-block">{$lang->detail_use_mobile_icon}</span> <span class="x_help-block">{$lang->detail_use_mobile_icon}</span>
</div> </div>

View file

@ -237,12 +237,14 @@ class installAdminController extends install
$this->setModulesConfig($config); $this->setModulesConfig($config);
//파비콘 //파비콘
$isDeleteFavicon = Context::get('is_delete_favicon');
$favicon = Context::get('favicon'); $favicon = Context::get('favicon');
$this->saveIcon($favicon,'favicon.ico'); $this->saveIcon($favicon,'favicon.ico', $isDeleteFavicon);
//모바일아이콘 //모바일아이콘
$isDeleteMobicon = Context::get('is_delete_mobicon');
$mobicon = Context::get('mobicon'); $mobicon = Context::get('mobicon');
$this->saveIcon($mobicon,'mobicon.png'); $this->saveIcon($mobicon,'mobicon.png', $isDeleteMobicon);
$this->setRedirectUrl(Context::get('error_return_url')); $this->setRedirectUrl(Context::get('error_return_url'));
} }
@ -285,13 +287,18 @@ class installAdminController extends install
return $output; return $output;
} }
function saveIcon($icon,$iconname) function saveIcon($icon, $iconname, $isDelete = false)
{ {
$mobicon_size = array('57','114'); $mobicon_size = array('57','114');
$target_file = $icon['tmp_name']; $target_file = $icon['tmp_name'];
$type = $icon['type']; $type = $icon['type'];
$target_filename = _XE_PATH_.'files/attach/xeicon/'.$iconname; $target_filename = _XE_PATH_.'files/attach/xeicon/'.$iconname;
if($isDelete && is_readable($target_filename))
{
@FileHandler::removeFile($target_filename);
}
list($width, $height, $type_no, $attrs) = @getimagesize($target_file); list($width, $height, $type_no, $attrs) = @getimagesize($target_file);
if($iconname == 'favicon.ico' && preg_match('/^.*(icon).*$/',$type)) if($iconname == 'favicon.ico' && preg_match('/^.*(icon).*$/',$type))
{ {