summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhhhc2013-04-21 08:59:53 (GMT)
committer hhhc2013-04-21 08:59:53 (GMT)
commitd726d2acea9640754d6d4d56bad0ccdd1cb3872d (patch)
tree12906b1c03a4e64f6b93e9d5c04c900a367d1172
parentef8a5ec885ae009b51828805ac03fcf79da96066 (diff)
Fixed issue #1973308 with ITEM types not showing up in admin section7.x-1.67.x-1.5
-rw-r--r--recommenderghost.admin.inc2
-rw-r--r--recommenderghost.module11
2 files changed, 9 insertions, 4 deletions
diff --git a/recommenderghost.admin.inc b/recommenderghost.admin.inc
index 807c7c6..7c7c4ec 100644
--- a/recommenderghost.admin.inc
+++ b/recommenderghost.admin.inc
@@ -98,7 +98,7 @@ function recommenderghost_admin_settings_form($form_state) {
if (variable_get('recommenderghost_apikey', '')) {
$item_obj = recommenderghost_call_api("itemtypes", array());
- if (!isset($item_obj->error) && $item_obj->itemTypes->itemType != "ITEM") {
+ if ($item_obj != FALSE && $item_obj->itemTypes->itemType != "ITEM") {
$items = $item_obj->itemTypes->itemType;
$item_array = array();
foreach ($items as $item) {
diff --git a/recommenderghost.module b/recommenderghost.module
index fee1cff..bd6c090 100644
--- a/recommenderghost.module
+++ b/recommenderghost.module
@@ -347,13 +347,18 @@ function _recommenderghost_visibility_user($account) {
function recommenderghost_call_api($function, $parameters) {
$apikey = variable_get('recommenderghost_apikey', '');
$websiteid = variable_get('recommenderghost_websiteid', '');
- $url = RECOMMENDERGHOST_API_URL . "/api/1.0/json/" . $function;
+ $url = "http://" . RECOMMENDERGHOST_API_URL . "/api/1.0/json/" . $function;
$url .= "?apikey=$apikey&tenantid=$websiteid&";
$url .= http_build_query($parameters);
$response = drupal_http_request(($url), array(
"timeout" => 1,
));
- return json_decode($response->data);
+ if (!isset($response->error)) {
+ return json_decode($response->data);
+ }
+ else {
+ return FALSE;
+ }
}
/**
@@ -482,7 +487,7 @@ function recommenderghost_block_view($delta = '') {
} else {
document.getElementById('block-recommenderghost-$delta_block').style.display='none';
}
- }
+ }
";
$js .= "
easyrec_getRecommendations('$recommendationtype', {