From 1fa079bec577e57b676596ec07f897401984c981 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Tue, 29 Oct 2013 05:16:32 +0000 Subject: [PATCH] * fix a bug for create webapp with https. --- module/webapp/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/webapp/model.php b/module/webapp/model.php index d6328e7c65..b162a21129 100644 --- a/module/webapp/model.php +++ b/module/webapp/model.php @@ -260,7 +260,7 @@ class webappModel extends model if(isset($data->url)) { $data->url = trim($data->url); - if(strpos($data->url, 'http://') !== 0) $data->url = 'http://' . $data->url; + if(!preg_match('/^https?:\/\//', $data->url)) $data->url = 'http://' . $data->url; } if($data->size == 'custom') $data->size = (float)$this->post->customWidth . 'x' . (float)$this->post->customHeight; @@ -301,7 +301,7 @@ class webappModel extends model ->remove('files,customWidth,customHeight')->get(); $data->url = trim($data->url); - if(strpos($data->url, 'http://') !== 0) $data->url = 'http://' . $data->url; + if(!preg_match('/^https?:\/\//', $data->url)) $data->url = 'http://' . $data->url; if($data->size == 'custom') $data->size = (float)$this->post->customWidth . 'x' . (float)$this->post->customHeight; $this->dao->insert(TABLE_WEBAPP)->data($data)