コード例 #1
0
ファイル: index.php プロジェクト: poef/arc-examples
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;
}
コード例 #2
0
ファイル: ClientStream.php プロジェクト: poef/ariadne
 /**
  * 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;
 }
コード例 #3
0
ファイル: GrantsTree.php プロジェクト: poef/ariadne
 /**
  * Returns an array with the grants for all groups.
  * @return array
  */
 public function grantsForAllGroups()
 {
     return \arc\hash::get('/groups/', $this->tree->nodeValue, array());
 }
コード例 #4
0
ファイル: system.list.entry.php プロジェクト: poef/ariadne
                        }
                        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")) {