本文整理汇总了PHP中Functions::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions::redirect方法的具体用法?PHP Functions::redirect怎么用?PHP Functions::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions
的用法示例。
在下文中一共展示了Functions::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
$this->_helper->Init->init();
if (!$this->user->isLogged()) {
Functions::redirect('//' . Settings::get('root_domain') . '/login/');
}
}
示例2: viewAction
function viewAction()
{
$code = strtolower($this->_getParam('type'));
if (!in_array($code, array('ro', 'spec'))) {
Functions::redirect('/');
}
$code2 = ucfirst($code);
$class_name = "Type_Billing_Bill_{$code2}_Account";
$account_id = $this->_getParam('id');
$account = new $class_name($account_id);
$bill_field = "billing_bill_{$code}_id";
$bill_id = $account->{$bill_field};
$form_code = $account->is_legal_person ? 'org' : 'personal';
$url = "/{$code}account/{$bill_id}/{$form_code}account/edit/{$account_id}";
Functions::redirect($url);
}
示例3: dirname
<?php
/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_GET['id'], $_GET['version']));
if (!CSRF::is_valid(1, METHOD_GET)) {
Error::halt(400, 'bad request', 'Missing required security token.');
}
MySQLQueries::edit_recipe_head($_GET['id'], $_GET['version']);
Functions::redirect(Links::render("view-recipe", array($_GET['id'])));
示例4: dirname
<?php
/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_POST['name']));
MySQLQueries::add_group($_POST['name']);
Functions::redirect(Links::render("groups"));
示例5: dirname
<?php
/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_GET['id']));
if (!CSRF::is_valid(METHOD_GET)) {
Error::halt(400, 'bad request', 'Missing required security token.');
}
MySQLQueries::delete_recipes(array($_GET['id']));
Functions::redirect(Links::render("recipes"));
示例6:
require_once __DIR__ . "/classes/Requires.php";
////
// Parse uri and return the request array
////
$request = Functions::parse_uri_to_request();
////
// No request passed, require index page
////
if (empty($request) || !isset($request[0])) {
require_once __DIR__ . "/index.php";
} else {
////
// Check to make sure not calling controller.php or /controller directly
////
if ($request[0] === "controller.php" || $request[0] === "controller") {
Functions::redirect("/");
die;
}
////
// Build page
////
$page = $request[0] . ".php";
////
// Set the rest of the request elements as query string parameters
////
for ($i = 1; $i < count($request); $i++) {
$_GET['param' . $i] = $request[$i];
}
////
// Include the page
////
示例7: dirname
<?php
/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_POST['id'], $_POST['name']));
MySQLQueries::edit_group($_POST['id'], $_POST['name']);
Functions::redirect("/groups");
示例8: dirname
<?php
/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
$data = array("default_ssh_username" => $_POST['default_ssh_username'], "default_ssh_port" => $_POST['default_ssh_port'], "default_interpreter" => $_POST['default_interpreter'], "timezone_offset" => $_POST['timezone_offset'], "timezone_daylight_savings" => $_POST['timezone_daylight_savings']);
$result = MySQLQueries::edit_settings(json_encode((object) $data));
Functions::redirect("/settings/saved");
示例9: dirname
<?php
/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_POST['label'], $_POST['address'], $_POST['ssh_username'], $_POST['ssh_port']));
MySQLQueries::add_server($_POST['label'], $_POST['group'], $_POST['tags'], $_POST['address'], $_POST['ssh_username'], $_POST['ssh_port']);
Functions::redirect(Links::render("servers"));
示例10: dirname
<?php
/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_POST['id'], $_POST['name'], $_POST['interpreter'], $_POST['content']));
MySQLQueries::edit_recipe($_POST['id'], $_POST['name'], $_POST['interpreter'], $_POST['notes'], $_POST['content']);
Functions::redirect("/view-recipe/" . $_POST['id']);
示例11: dirname
<?php
/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_POST['label'], $_POST['address'], $_POST['ssh_username'], $_POST['ssh_port']));
MySQLQueries::add_server($_POST['label'], $_POST['group'], $_POST['tags'], $_POST['address'], $_POST['ssh_username'], $_POST['ssh_port']);
Functions::redirect("/servers");
示例12: lookUpInCache
private function lookUpInCache($uri)
{
$cachedparams = null;
if (!empty(self::$conf->cache) && !empty(self::$conf->cache->usecache) && (string) self::$conf->cache->usecache == 1) {
$tp = Functions::getTablesPrefix(self::$conf);
$db = DB::getInstance();
// let's have a look into the cache, we'll look for all possibiltes (meaning trainling slash)
$tempuri = explode('?', $uri);
$tempuri[0] = Functions::prepareLinkForCache($tempuri[0], self::$conf);
$xuri = $tempuri[0];
$tempuri[0] = preg_match('~/$~', $tempuri[0]) ? substr($tempuri[0], 0, strlen($tempuri[0]) - 1) : $tempuri[0] . '/';
// add or remove trailing slash
if (!empty(self::$conf->cache->cacheparams) && self::$conf->cache->cacheparams == 1) {
$tempurix = implode('?', $tempuri);
$xuri = $uri;
} else {
$tempurix = $tempuri[0];
}
$q = $db->query('SELECT * FROM ' . $tp . 'cache WHERE url=' . $db->escape($xuri) . ' OR url=' . $db->escape($tempurix));
$row = $db->fetch($q);
if ($row) {
if (strcmp($row['url'], $xuri) !== 0) {
// we've got our $tempuri, not $url -> let's redirect
Functions::redirect(Functions::prepareforRedirect($row['url'] . (empty($tempuri[1]) ? '' : '?' . $tempuri[1]), self::$conf));
} else {
$cachedparams = Functions::cache2params($row['params']);
}
} else {
$vf = '';
if (isset(self::$conf->cache->cool2params->oldlinksvalidfor)) {
$vf = ' AND DATEDIFF(NOW(),' . $tp . 'oldlinks.tstamp)<' . (string) self::$conf->cache->cool2params->oldlinksvalidfor;
}
$q = $db->query('SELECT ' . $tp . 'cache.url AS oldlink FROM ' . $tp . 'oldlinks LEFT JOIN ' . $tp . 'cache ON ' . $tp . 'oldlinks.link_id=' . $tp . 'cache.id WHERE (' . $tp . 'oldlinks.url=' . $db->escape($xuri) . ' OR ' . $tp . 'oldlinks.url=' . $db->escape($tempurix) . ')' . $vf);
$row = $db->fetch($q);
if ($row) {
Functions::redirect(Functions::prepareforRedirect($row['oldlink'] . (empty($tempuri[1]) ? '' : '?' . $tempuri[1]), self::$conf), 301);
} elseif (empty(self::$conf->cache->cool2params->translateifnotfound) || self::$conf->cache->cool2params->translateifnotfound != 1) {
Functions::pageNotFound(self::$conf);
}
}
}
// end cache
return $cachedparams;
}
示例13: dirname
<?php
/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_GET['id']));
MySQLQueries::delete_recipes(array($_GET['id']));
Functions::redirect("/recipes");
示例14: dirname
<?php
/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_GET['id']));
if (!CSRF::is_valid(1, METHOD_GET)) {
Error::halt(400, 'bad request', 'Missing required security token.');
}
MongoConnection::connect();
MongoConnection::grid_fs();
MongoConnection::grid_fs_delete(array($_GET['id']));
MongoConnection::close();
Functions::redirect(Links::render("files"));
示例15: dirname
<?php
/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
$data = array("instance_key" => $_POST['instance_key'], "default_ssh_username" => $_POST['default_ssh_username'], "default_ssh_port" => $_POST['default_ssh_port'], "default_interpreter" => $_POST['default_interpreter'], "timezone_offset" => $_POST['timezone_offset'], "timezone_daylight_savings" => $_POST['timezone_daylight_savings']);
MySQLQueries::edit_settings(json_encode((object) $data));
Functions::redirect(Links::render("settings", array("saved")));