function handleFeeds($path, $client) { $feeds = json_decode(file_get_contents($path), true); $newFeed = \arc\hash::get('/newFeed/', $_POST); if (isset($newFeed)) { $feeds[] = $newFeed; } $removeFeed = \arc\hash::get('/removeFeed/', $_POST); if (isset($removeFeed)) { unset($feeds[$removeFeed]); } if (isset($removeFeed) || isset($newFeed)) { file_put_contents($path, json_encode($feeds)); } return $feeds; }
/** * Send a HTTP request and return the response * @param string $type The method to use, GET, POST, etc. * @param string $url The URL to request * @param array|string $request The query string * @param array $options Any of the HTTP stream context options, e.g. extra headers. * @return string */ public function request($type, $url, $request = null, $options = []) { $url = \arc\url::url((string) $url); if ($type == 'GET' && $request) { $url->query->import($request); $request = null; } $options = ['method' => $type, 'content' => $request] + $options; $options['headers'] = $this->mergeHeaders(\arc\hash::get('header', $this->options), \arc\hash::get('headers', $this->options), \arc\hash::get('header', $options), \arc\hash::get('headers', $options)); $options += (array) $this->options; $context = stream_context_create(['http' => $options]); $result = @file_get_contents((string) $url, false, $context); $this->responseHeaders = isset($http_response_header) ? $http_response_header : null; //magic php variable set by file_get_contents. $this->requestHeaders = isset($options['headers']) ? explode("\r\n", $options['headers']) : []; return $result; }
/** * Returns an array with the grants for all groups. * @return array */ public function grantsForAllGroups() { return \arc\hash::get('/groups/', $this->tree->nodeValue, array()); }
} break; case 'nlsdata': $first = \arc\path::head($tail); $tail = \arc\path::tail($tail); if ($tail == '/') { $arResult[$key] = $this->nlsdata; } else { $arResult[$key] = \arc\hash::get($this->nlsdata, $tail); } break; case 'custom': if ($tail == '/') { $arResult[$key] = $this->data->custom; } else { $arResult[$key] = \arc\hash::get($this->data->custom, $tail); } break; default: $arResult[$key] = null; break; } } } } } // Sort the languages alphabetic if (is_array($arResult['language'])) { asort($arResult['language']); } if ($AR->user && !$this->CheckSilent("read")) {