本文整理汇总了PHP中URL::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::redirect方法的具体用法?PHP URL::redirect怎么用?PHP URL::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URL
的用法示例。
在下文中一共展示了URL::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: kickout_non_admin
public static function kickout_non_admin($url = 'index.php')
{
self::create_user();
if ($_SESSION[Config::$sitename]['user']['logged_in'] == false || $_SESSION[Config::$sitename]['user']['is_admin'] == false) {
URL::redirect($url);
}
}
示例2: internalAction
public function internalAction()
{
$this->_view->_title = 'Internal Group Management';
if (isset($_GET['team']) && trim($_GET['team']) != '') {
if (isset($_POST['group_form']) && !empty($_POST['group_form'])) {
$this->_view->colUser = $this->_model->listTeamUser($_GET['team'], $_POST['group_form']);
} else {
if (!isset($_GET['date_from']) && !isset($_GET['date_to'])) {
$arrayDefault = array('date_from' => date("d/m/Y"), 'date_to' => date("d/m/Y"));
$this->_view->colUser = $this->_model->listTeamUser($_GET['team'], $arrayDefault);
$this->_view->duration = $this->_model->getDuration('2', $arrayDefault, 'standard_duration');
$this->_view->chart = $this->_model->createChart($_GET['team'], $arrayDefault);
} else {
if (isset($_GET['date_from']) && isset($_GET['date_to'])) {
$arrayDate = array('date_from' => $_GET['date_from'], 'date_to' => $_GET['date_to']);
$this->_view->colUser = $this->_model->listTeamUser($_GET['team'], $arrayDate);
$this->_view->duration = $this->_model->getDuration('2', $arrayDate, 'standard_duration');
$this->_view->chart = $this->_model->createChart($_GET['team'], $arrayDate);
} else {
$this->_view->colUser = $this->_model->listTeamUser($_GET['team']);
}
}
}
} else {
URL::redirect(URL::createLink('default', 'index', 'index'));
}
// CREATE CHART
if (isset($_POST['group_form'])) {
$this->_view->duration = $this->_model->getDuration('2', $_POST['group_form'], 'standard_duration');
$this->_view->chart = $this->_model->createChart($_GET['team'], $_POST['group_form']);
}
$this->_view->render('group/internal');
}
示例3: loginAction
public function loginAction()
{
$userInfo = Session::get('user');
if ($userInfo['login'] == true && $userInfo['time'] + TIME_LOGIN >= time()) {
URL::redirect('default', 'user', 'index');
}
$this->_view->_title = 'Login';
if (@$this->_arrParam['form']['token'] > 0) {
$validate = new Validate($this->_arrParam['form']);
$email = $this->_arrParam['form']['email'];
$password = md5($this->_arrParam['form']['password']);
$query = "SELECT `id` FROM `user` WHERE `email` = '{$email}' AND `password` = '{$password}'";
$validate->addRule('email', 'existRecord', array('database' => $this->_model, 'query' => $query));
$validate->run();
if ($validate->isValid() == true) {
$infoUser = $this->_model->infoItem($this->_arrParam);
$arraySession = array('login' => true, 'info' => $infoUser, 'time' => time(), 'group_acp' => $infoUser['group_acp']);
Session::set('user', $arraySession);
URL::redirect('default', 'user', 'index');
} else {
$this->_view->errors = $validate->showErrorsPublic();
}
}
$this->_view->render('index/login');
}
示例4: short_url__redirect
public function short_url__redirect()
{
$shortcode = Request::get('shortcode');
$url = $this->core->expand($shortcode);
if ($url != NULL) {
URL::redirect($url);
}
}
示例5: checkRefreshPage
public static function checkRefreshPage($value, $module, $controller, $action, $params = null)
{
if (Session::get('token') == $value) {
Session::delete('token');
URL::redirect($module, $controller, $action);
} else {
Session::set('token', $value);
}
}
示例6: deleteAction
public function deleteAction()
{
$permission = isset($_SESSION['user']) && $_SESSION['user']['info']['admin_control'] == true ? true : false;
if ($permission == true) {
$this->_view->_title = 'Delete | User';
$this->_view->message = '';
if (isset($_GET['id'])) {
$this->_view->message = $this->_model->processDelete($_GET['id']);
}
$this->_view->render('user/delete', true);
} else {
URL::redirect(URL::createLink('default', 'error', 'index', array('type' => 'not-url')));
}
}
示例7: editAction
public function editAction()
{
$permission = isset($_SESSION['user']) && $_SESSION['user']['info']['admin_control'] == true ? true : false;
if ($permission == true) {
$this->_view->_title = 'Edit | Team';
if (isset($_GET['id'])) {
$this->_view->_arrayTeam = $this->_model->arrayEdit($_GET['id']);
}
if (isset($_POST['editTeam']) && isset($_GET['id'])) {
$this->_view->_result = $this->_model->processEdit($_POST['editTeam'], $_GET['id']);
URL::redirect(URL::createLink('default', 'team', 'edit', array('id' => $_GET['id'])));
}
$this->_view->render('team/edit', true);
} else {
URL::redirect(URL::createLink('default', 'error', 'index', array('type' => 'not-url')));
}
}
示例8: callMethod
private function callMethod()
{
$actionName = $this->_params['action'] . 'Action';
if (method_exists($this->_controllerObject, $actionName) == true) {
$module = $this->_params['module'];
$controller = $this->_params['controller'];
$action = $this->_params['action'];
$requestURL = $module . "-" . $controller . "-" . $action;
$userInfo = Session::get('user');
$logged = $userInfo['login'] == true && $userInfo['time'] + TIME_LOGIN >= time();
// MODULE ADMIN
if ($module == 'admin') {
if ($logged == true) {
if ($userInfo['group_acp'] == 1) {
//if(in_array($requestURL, $userInfo['info']['privilege'])==true){
$this->_controllerObject->{$actionName}();
//}else{
// URL::redirect('default', 'index', 'notice', array('type' => 'not-permission'));
//}
} else {
URL::redirect('default', 'index', 'notice', array('type' => 'not-permission'));
}
} else {
$this->callLoginAction($module);
}
// MODULE DEFAULT
} else {
if ($module == 'default') {
if ($controller == 'user') {
if ($logged == true) {
$this->_controllerObject->{$actionName}();
} else {
$this->callLoginAction($module);
}
} else {
$this->_controllerObject->{$actionName}();
}
}
}
//$this->_controllerObject->$actionName();
} else {
//$this->_error();
URL::redirect('default', 'index', 'notice', array('type' => 'not-url'));
}
}
示例9: require_password
public function require_password()
{
$password_list = trim($this->fetchParam('allowed', '', null, false, false));
$passwords = explode('|', $password_list);
$password_url = $this->fetch('password_url', null, null, false, false);
$no_access_url = $this->fetch('no_access_url', '/', null, false, false);
$return_variable = $this->fetch('return_variable', 'return', null, false, false);
// no passwords set? this is OK
if (!$password_list) {
return;
}
// determine form URL
$form_url = Helper::pick($password_url, $no_access_url);
if (!$this->tasks->hasPassword(URL::getCurrent(), $passwords)) {
URL::redirect(URL::appendGetVariable($form_url, $return_variable, URL::getCurrent()), 302);
exit;
}
}
示例10: orderAction
public function orderAction()
{
$cart = Session::get('cart');
$bookID = $this->_arrParam['book_id'];
$price = $this->_arrParam['price'];
if (empty($cart)) {
$cart['quantity'][$bookID] = 1;
$cart['price'][$bookID] = $price;
} else {
if (array_key_exists($bookID, $cart['quantity'])) {
$cart['quantity'][$bookID] += 1;
$cart['price'][$bookID] = $price * $cart['quantity'][$bookID];
} else {
$cart['quantity'][$bookID] = 1;
$cart['price'][$bookID] = $price;
}
}
Session::set('cart', $cart);
URL::redirect('default', 'book', 'detail', array('book_id' => $bookID));
}
示例11: protect__password
public function protect__password()
{
// grab values
$token = filter_input(INPUT_POST, 'token', FILTER_SANITIZE_STRING);
$return = filter_input(INPUT_POST, 'return', FILTER_SANITIZE_STRING);
$password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
$referrer = $_SERVER['HTTP_REFERER'];
// validate token
if (!$this->tokens->validate($token)) {
$this->flash->set('error', 'Invalid token passed, please try again.');
URL::redirect($referrer);
}
// check password matches a password from return text
if (!$this->tasks->isValidPassword($return, $password)) {
$this->flash->set('error', 'Incorrect password.');
URL::redirect($referrer);
}
// store this password in the session
$this->tasks->addPassword($return, $password);
// redirect to the URL
URL::redirect($return);
}
示例12: callMethod
private function callMethod()
{
$actionName = $this->_params['action'] . 'Action';
if (method_exists($this->_controllerObject, $actionName) == true) {
$module = $this->_params['module'];
$controller = $this->_params['controller'];
$action = $this->_params['action'];
$requestURL = $module . "-" . $controller . "-" . $action;
$userInfo = Session::get('user');
$logged = $userInfo['login'] == true && $userInfo['time'] + TIME_LOGIN >= time();
// MODULE ADMIN
if ($logged == true) {
$this->_controllerObject->{$actionName}();
} else {
$this->callLoginAction();
}
//$this->_controllerObject->$actionName();
} else {
//$this->_error();
URL::redirect(URL::createLink('default', 'error', 'index', array('type' => 'not-url')));
}
}
示例13: indexAction
public function indexAction()
{
$this->_view->_title = 'Personal Management';
$totalItems = $this->_model->countItem($this->_arrParam, null);
$configPagination = array('totalItemsPerPage' => 5, 'pageRange' => 2);
$this->setPagination($configPagination);
$this->_view->pagination = new Pagination($totalItems, $this->_pagination);
//$this->_view->Items = $this->_model->listItems($this->_arrParam, null);
// Process Maintenance Data
//$this->_view->arrayMaintenance = $this->_model->processMaintenance();
// Process Newton Data
//$this->_view->arrayNewtonDetail = $this->_model->processNewtonDetail();
//$this->_view->arrayNewton = $this->_model->processNewton();
// Process Newcoding Detail
//$this->_view->arrayNewCodingDetail = $this->_model->processNewCodingDetail();
//$this->_view->arrayNewCoding = $this->_model->processNewCoding();
// Process Domestic Data
//$this->_view->arrayDomestic = $this->_model->processDomestic();
// Process FC Data
//$this->_view->arrayFcDetail = $this->_model->processFcDetail();
//$this->_view->arrayFc = $this->_model->processFc();
// Process Other
//$this->_view->arrayOther = $this->_model->processOther();
// Process Research
//$this->_view->arrayResearch = $this->_model->processResearch();
// Process Worktime
//$this->_view->arrayWorktime = $this->_model->processWorkTime();
$this->_model->importMaintenance();
$this->_model->importNewton();
$this->_model->importDomestic();
$this->_model->importFC();
$this->_model->importOther();
$this->_model->importResearch();
$this->_model->importNewCoding();
$this->_model->importWorkTime();
URL::redirect(URL::createLink('default', 'index', 'index'));
$this->_view->render('import/index', true);
}
示例14: show
function show()
{
$cols = $this->cols();
$rows = $this->rows();
$table = $this->table();
$link = $this->link();
echo '<form action="#" method="get">';
echo '<span>';
foreach ($_GET as $key => $value) {
echo '<input type="hidden" name="' . $key . '" value="' . $value . '"/>';
}
echo '</span>';
echo '<table cellspacing="0" cellpadding="0" class="db">';
$order = isset($_GET['orderby']) ? $_GET['orderby'] : 'bug_id DESC';
echo '<tr class="header">';
foreach ($cols as $name => $column) {
if ($column['title'] == "") {
$title = humantitle($name);
} else {
$title = $column['title'];
}
echo '<th>';
$by = $order == $name ? $name . ' DESC' : $name;
echo '<a href="' . URL::redirect('#', array('orderby' => $by)) . '" class="header">';
echo '<div class="full">' . $title . '</div>';
echo '</a>';
echo '</th>';
}
echo '</tr>';
echo '<tr class="filter">';
foreach ($cols as $name => $cfg) {
echo '<td>';
switch ($cfg['filter']) {
case 'search':
echo '<input type="text" name="filter_' . $name . '" class="full" />';
echo '<span><input type="hidden" name="f_' . $name . '_type" value="search" /></span>';
break;
case 'submit':
echo '<input class="full" type="submit" value="Filter" />';
break;
default:
case 'select':
echo '<select name="filter_' . $name . '" class="full">';
echo '<option value="">No Filter</option>';
$query = "SELECT DISTINCT {$name} FROM {$table} ORDER BY {$name}";
$result = mysql_query($query) or die('MySQL Error: ' . mysql_error());
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row[$name] . '"' . ($_GET['filter_' . $name] == $row[$name] ? ' selected="selected"' : '') . '>' . $this->rename($name, $row[$name]) . '</option>';
}
echo '</select>';
break;
}
echo '</td>';
}
echo '</tr>';
for ($i = 0; $i < count($rows); $i++) {
echo '<tr class="row r_' . $x++ % 2 . '">';
foreach ($rows[$i] as $name => $value) {
$value = $this->rename($name, $value);
if ($_GET['f_' . $name . '_type'] == 'search') {
$value = str_replace($_GET['filter_' . $name], '<span class="found">' . $_GET['filter_' . $name] . '</span>', $value);
}
echo '<td class="row"';
if ($cols[$name]['css'] != "") {
echo ' style="' . $cols[$name]['css'] . '"';
}
echo '><a class="normal" href="?show=' . $link . '&id=' . $rows[$i][$this->idcol] . '"><div class="full">' . $value . '</div></a></td>';
}
echo '</tr>';
}
echo '<tr class="footer"><td colspan="' . count($cols) . '">';
$this->pager->display();
echo '</td></tr>';
echo '</table>';
echo '</form>';
}
示例15: member__reset_password
public function member__reset_password()
{
$site_root = Config::getSiteRoot();
$password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
$password_confirm = filter_input(INPUT_POST, 'password_confirmation', FILTER_SANITIZE_STRING);
$token = filter_input(INPUT_POST, 'token', FILTER_SANITIZE_STRING);
$hash = filter_input(INPUT_POST, 'hash', FILTER_SANITIZE_STRING);
$referrer = $_SERVER['HTTP_REFERER'];
// validate form token
if (!$this->tokens->validate($token)) {
$this->flash->set('reset_password_error', 'Invalid token.');
URL::redirect($referrer);
}
// bail if cache doesnt exist or if its too old.
// this should have been caught on the page itself,
// but if it got submitted somehow, just redirect and the error logic will be in the plugin.
if (!$this->cache->exists($hash) || $this->cache->getAge($hash) > $this->fetchConfig('reset_password_age_limit', 20, 'is_numeric') * 60) {
URL::redirect($referrer);
}
// password check
if (is_null($password) || $password == '') {
$this->flash->set('reset_password_error', 'Password cannot be blank.');
URL::redirect($referrer);
}
// password confirmation check
if (!is_null($password_confirm) && $password !== $password_confirm) {
$this->flash->set('reset_password_error', 'Passwords did not match.');
URL::redirect($referrer);
}
// get username
$cache = $this->cache->getYAML($hash);
$username = $cache['username'];
// change password
$member = Member::load($username);
$member->set('password', $password);
$member->save();
// delete used cache
$this->cache->delete($hash);
// redirect
URL::redirect(array_get($cache, 'return', $this->fetchConfig('member_home', $site_root, null, false, false)));
}