Fix to issue #303, by using variables for !empty if statement
This commit is contained in:
tivyhosting 2015-09-22 17:29:29 -07:00
parent 6026180fa9
commit 2e64ba0dd7

View File

@ -243,16 +243,17 @@ class Pastes extends CI_Model
switch ($RAND_API) switch ($RAND_API)
{ {
case "yourls": case "yourls":
$var1 = $this->config->item('yourls_url');
if (!empty($this->config->item('yourls_url')) && !empty($this->config->item('yourls_signature'))) $var2 = $this->config->item('yourls_signature');
if (!empty($var1) && !empty($var2))
{ {
$url_shortening_api = "yourls"; $url_shortening_api = "yourls";
} }
break; break;
case "gwgd": case "gwgd":
case "gw.gd": case "gw.gd":
$var3 = $this->config->item('gwgd_url');
if (!empty($this->config->item('gwgd_url'))) if (!empty($var3))
{ {
$url_shortening_api = "gwgd"; $url_shortening_api = "gwgd";
} }
@ -260,16 +261,16 @@ class Pastes extends CI_Model
case "googl": case "googl":
case "google": case "google":
case "goo.gl": case "goo.gl":
$var4 = $this->config->item('googl_url_api');
if (!empty($this->config->item('googl_url_api'))) if (!empty($var4))
{ {
$url_shortening_api = "googl"; $url_shortening_api = "googl";
} }
break; break;
case "bitly": case "bitly":
case "bit.ly": case "bit.ly":
$var5 = $this->config->item('bitly_url_api');
if (!empty($this->config->item('bitly_url_api'))) if (!empty($var5))
{ {
$url_shortening_api = "bitly"; $url_shortening_api = "bitly";
} }
@ -412,7 +413,6 @@ class Pastes extends CI_Model
} }
return $shorturl; return $shorturl;
} }
function checkPaste($seg = 2) function checkPaste($seg = 2)
{ {