本文整理汇总了PHP中REST::require_method方法的典型用法代码示例。如果您正苦于以下问题:PHP REST::require_method方法的具体用法?PHP REST::require_method怎么用?PHP REST::require_method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类REST
的用法示例。
在下文中一共展示了REST::require_method方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
//TODO
require_once 'include/global.php';
$escLockUUID = Topos::escape_string($TOPOS_TOKEN);
if ($_SERVER['REQUEST_METHOD'] === 'DELETE') {
Topos::real_query(<<<EOS
UPDATE `Tokens`
SET `tokenLockTimeout` = 0, `tokenLockUUID` = null
WHERE `tokenLockUUID` = {$escLockUUID};
EOS
);
if (Topos::mysqli()->affected_rows) {
REST::fatal(REST::HTTP_OK, 'Lock destroyed successfully');
}
REST::fatal(REST::HTTP_NOT_FOUND);
}
REST::require_method('HEAD', 'GET');
if (isset($_GET['timeout'])) {
$timeout = (int) $_GET['timeout'];
if ($timeout < 1) {
REST::fatal(REST::HTTP_BAD_REQUEST, 'Bad value for parameter "timeout"');
}
$description = isset($_GET['description']) ? ', `tokenLockDescription` = ' . Topos::escape_string((string) $_GET['description']) : '';
Topos::real_query(<<<EOS
UPDATE `Tokens`
SET `tokenLockTimeout` = UNIX_TIMESTAMP() + {$timeout},
`tokenLockCounter` = `tokenLockCounter` + 1
{$description}
WHERE `tokenLockUUID` = {$escLockUUID}
AND `tokenLockTimeout` > UNIX_TIMESTAMP();
EOS
);
示例2: while
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $Id: jobstate.php 2471 2009-08-17 20:09:55Z pieterb $
**************************************************************************/
/**
* File documentation.
* @package Portal
*/
require_once 'include/global.php';
require_once 'topos.php';
REST::require_method('GET', 'HEAD', 'PUT', 'DELETE');
$user_id = Portal_User::current()->user_id();
$path_info = Portal::path_info();
$jobid = $path_info[0];
$escjobid = Portal_MySQL::escape_string($jobid);
$escuserid = Portal_MySQL::escape_string($user_id);
if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
if (strpos(@$_SERVER['CONTENT_TYPE'], 'text/plain') !== 0) {
REST::fatal(REST::HTTP_UNSUPPORTED_MEDIA_TYPE);
}
// The job finished with an error and tries to inform us about it
$errorstring = '';
while (($line = fread(REST::inputhandle(), 8192)) !== '') {
$errorstring .= $line;
}
if (!strlen($errorstring)) {
示例3: array
<?php
/*·*************************************************************************
* Copyright ©2009 SARA Computing and Networking Services
* Amsterdam, the Netherlands
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $Id: applications_versions.php 2459 2009-08-10 21:20:41Z pieterb $
**************************************************************************/
/**
* File documentation.
* @package Portal
*/
require_once 'include/global.php';
require_once 'portal_app.php';
REST::require_method('GET', 'HEAD');
$directory = RESTDir::factory();
list($appname, $dummy) = Portal::path_info();
foreach (Portal_App::versions($appname) as $version) {
$directory->line($version, array('Description' => "{$appname} version {$version}"));
}
$directory->end();
示例4: escapeshellarg
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $Id: myproxy_renew.php 2378 2009-07-14 14:00:34Z pieterb $
**************************************************************************/
/**
* File documentation.
* @package Portal
*/
require_once 'include/global.php';
if (Portal::user_dn() != @$_SERVER['SSL_SERVER_S_DN']) {
REST::fatal(REST::HTTP_UNAUTHORIZED);
}
REST::require_method('GET');
foreach (glob(Portal::PROXY_DIR . '*.pem') as $fullfilename) {
$escfullfilename = escapeshellarg($fullfilename);
exec("grid-proxy-info -f {$escfullfilename} -exists -valid 1:00", $output, $returnval);
if (!$returnval) {
continue;
}
// The proxy is valid for at least another hour
$user_dn_md5 = Portal_MySQL::escape_string(basename($fullfilename, '.pem'));
$result = Portal_MySQL::query(<<<EOS
SELECT `proxy_server`, `proxy_username`, `proxy_password` FROM `User`
WHERE `user_dn_md5` = {$user_dn_md5};
EOS
);
if ($row = $result->fetch_row()) {
$escusername = escapeshellarg($row[1]);