本文整理汇总了PHP中Util::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::redirect方法的具体用法?PHP Util::redirect怎么用?PHP Util::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util
的用法示例。
在下文中一共展示了Util::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submit
public function submit($problem_id)
{
try {
$problem = new Problem($problem_id);
$language = fRequest::get('language', 'integer');
if (!array_key_exists($language, static::$languages)) {
throw new fValidationException('Invalid language.');
}
fSession::set('last_language', $language);
$code = trim(fRequest::get('code', 'string'));
if (strlen($code) == 0) {
throw new fValidationException('Code cannot be empty.');
}
if ($problem->isSecretNow()) {
if (!User::can('view-any-problem')) {
throw new fAuthorizationException('Problem is secret now. You are not allowed to submit this problem.');
}
}
$record = new Record();
$record->setOwner(fAuthorization::getUserToken());
$record->setProblemId($problem->getId());
$record->setSubmitCode($code);
$record->setCodeLanguage($language);
$record->setSubmitDatetime(Util::currentTime());
$record->setJudgeStatus(JudgeStatus::PENDING);
$record->setJudgeMessage('Judging... PROB=' . $problem->getId() . ' LANG=' . static::$languages[$language]);
$record->setVerdict(Verdict::UNKNOWN);
$record->store();
Util::redirect('/status');
} catch (fException $e) {
fMessaging::create('error', $e->getMessage());
fMessaging::create('code', '/submit', fRequest::get('code', 'string'));
Util::redirect("/submit?problem={$problem_id}");
}
}
示例2: update
public function update()
{
$id = (int) $this->registry->params['id'];
//var_dump($id); die();
if (!empty($_POST)) {
$result = $this->offices_model->update_office($id);
if ($result) {
Util::redirect('offices');
}
/*
else {
Util::redirect('offices/update/' . $id);
}
*/
}
// adatok bevitele a view objektumba
$this->view->title = 'Admin irodák oldal';
$this->view->description = 'Admin irodák oldal description';
//form validator
$this->view->js_link[] = $this->make_link('js', ADMIN_ASSETS, 'plugins/jquery-validation-new/jquery.validate.min.js');
$this->view->js_link[] = $this->make_link('js', ADMIN_ASSETS, 'plugins/jquery-validation-new/additional-methods.min.js');
$this->view->js_link[] = $this->make_link('js', ADMIN_ASSETS, 'plugins/jquery-validation-new/localization/messages_hu.js');
$this->view->js_link[] = $this->make_link('js', ADMIN_JS, 'pages/offices_insert_update.js');
// egy iroda adatainak lekérdezése
$this->view->office = $this->offices_model->offices_data_query($id);
$this->view->render('offices/tpl_update_office');
}
示例3: ajax_register
/**
* (AJAX) Felhasználó regisztráció
*/
public function ajax_register()
{
if (Util::is_ajax()) {
$respond = $this->regisztracio_model->register_user();
echo $respond;
exit;
} else {
Util::redirect('error');
}
}
示例4: form_handler
public function form_handler()
{
$validator = new Validator($_POST);
$validator->setRules('name', 'Name', 'minLength[4]|maxLength[8]');
$validator->setRules('date', 'Date', 'dateRange[ 12/27/10, 12/28/10 ]');
if ($validator->validate()) {
$validator->storeSuccessMessage('Success!');
}
Util::redirect('admin', true);
}
示例5: __construct
function __construct()
{
// find active entity
parent::__construct();
// submit?
$uploaded = handle_uploaded_submission($this->entity);
if ($uploaded) {
$self_url = 'index.php' . $this->entity->path() . '?made_submission=' . $uploaded->submissionid;
Util::redirect($self_url);
}
}
示例6: ajax_get_items
/**
* A site_users tábla listáját adja vissza és kezeli a csoportos művelteket is
*/
public function ajax_get_items()
{
if (Util::is_ajax()) {
$request_data = $_REQUEST;
$json_data = $this->register_subscribe_model->get_items($request_data);
// adatok visszaküldése a javascriptnek
echo json_encode($json_data);
} else {
Util::redirect('error');
}
}
示例7: requireEmailVerified
public static function requireEmailVerified()
{
if (!fAuthorization::checkLoggedIn()) {
return;
}
if (User::hasEmailVerified()) {
return;
}
fMessaging::create('warning', 'You are required to verify your email address before doing this action.');
Util::redirect('/email/verify');
}
示例8: find_page
static function find_page($url = '')
{
// clean up path
$url = trim($url);
if ($url[0] == '/') {
$url = substr($url, 1);
}
if (preg_match('@//|[.][.]|/[.][^/]*@', $url)) {
return Page::error_page_file_not_found($url);
}
// trim trailing slash
if (preg_match('@([/]+)$@', $url)) {
$url = preg_replace('@([/]+)$@', '', $url);
// don't redirect, because apache adds these, and we would loop
}
// trim extension
if (preg_match('@([/]*[.].*|[/]+)$@', $url)) {
$url = preg_replace('@([/]*[.].*|[/]+)$@', '', $url);
//die($url);
Util::redirect($url);
}
$url = trim($url);
if ($url == '') {
$url = 'index';
}
// options:
/*
1. a .php file -> include it
2. a .txt file -> autoformat it
3. a .lhs file -> autoformat it
*/
if (file_exists("{$url}.txt")) {
return new TextFilePage($url, "./{$url}.txt");
} else {
if (file_exists("{$url}.lhs")) {
return new TextFilePage($url, "./{$url}.lhs");
} else {
if (file_exists("{$url}/index.txt")) {
return new TextFilePage($url, "./{$url}/index.txt");
} else {
if (file_exists("{$url}/index.php")) {
include "{$url}/index.php";
return $page;
// } else if (file_exists("$url.php")) {
// return "x";
} else {
return Page::error_page_file_not_found($url);
}
}
}
}
}
示例9: index
public function index()
{
if (isset($this->registry->params['user_id']) && isset($this->registry->params['newsletter_unsubscribe_code'])) {
$this->leiratkozas_model->leiratkozas($this->registry->params['user_id'], $this->registry->params['newsletter_unsubscribe_code']);
// adatok bevitele a view objektumba
$this->view->title = 'Leiratkozás hírlevélről';
$this->view->description = 'Leiratkozás hírlevélről';
$this->view->keywords = 'Leiratkozás hírlevélről';
$this->view->render('leiratkozas/tpl_leiratkozas');
} else {
Util::redirect('error');
}
}
示例10: postUserCategories
public function postUserCategories()
{
if (!User::can('manage-site')) {
fMessaging::create('error', 'You are not allowed to manage user categories.');
fURL::redirect(Util::getReferer());
}
$class_name = fRequest::get('class_name');
$username = fRequest::get('username');
$profile = new Profile($username);
$profile->setClassName($class_name);
$profile->store();
Util::redirect('/admin/user/categories#' . $username);
}
示例11: index
public function index()
{
Auth::handleLogin();
// lekérdezzük, hogy kitöltötte-e már az előregisztrációt a bejelentkezett user (return bool)
$result_prereg = $this->eloregisztracio_model->check_preregister();
if ($result_prereg === false && isset($_POST['pre_register_submit'])) {
$result = $this->eloregisztracio_model->pre_register('insert');
if ($result) {
Util::redirect('munkak');
} else {
Util::redirect('eloregisztracio');
}
}
if ($result_prereg === true && isset($_POST['pre_register_update'])) {
$result = $this->eloregisztracio_model->pre_register('update');
if ($result) {
Util::redirect('munkak');
} else {
Util::redirect('eloregisztracio');
}
}
//validátor
/*
$this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'plugins/jquery-validation/jquery.validate.min.js');
$this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'plugins/jquery-validation/additional-methods.min.js');
$this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'plugins/jquery-validation/localization/messages_hu.js');
$this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'plugins/jquery-validation/localization/methods_hu.js');
$this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'plugins/jquery.blockui.min.js');
$this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'pages/modal_handler.js');
*/
//$this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'pages/sidebar_search.js');
$this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'pages/eloregisztracio.js');
// alapbeállítások lekérdezése
$this->view->settings = $this->eloregisztracio_model->get_settings();
// 3 legfrissebb munka
$this->view->latest_jobs = $this->eloregisztracio_model->jobs_query(3);
// oldal tartalmának lekérdezése (paraméter a pages tábla page_id)
$this->view->content = $this->eloregisztracio_model->get_page_data(15);
$this->view->title = $this->view->content['page_metatitle'];
$this->view->description = $this->view->content['page_metadescription'];
$this->view->keywords = $this->view->content['page_metakeywords'];
if ($result_prereg) {
$this->view->prereg_data = $this->eloregisztracio_model->get_prereg_data();
//$this->view->debug(true);
$this->view->render('eloregisztracio/tpl_eloregisztracio_update');
} else {
//$this->view->debug(true);
$this->view->render('eloregisztracio/tpl_eloregisztracio');
}
}
示例12: __construct
function __construct()
{
// find active entity
$user = Authentication::require_user();
$this->entity = Entity::get(@$_SERVER['PATH_INFO'], !$user->is_admin);
// Redjudge all
if (isset($_REQUEST['rejudge_all']) and Authentication::is_admin()) {
Log::info("Requested redjudgement for all submissions in this entity", $this->entity->path());
foreach ($this->entity->all_submissions() as $subm) {
$subm->rejudge();
}
Util::redirect(str_replace('rejudge_all=1', '', $_SERVER['REQUEST_URI']));
}
}
示例13: __construct
public function __construct()
{
$id = Util::getRequest('id');
if ($id == null || intval($id) != $id) {
Util::redirect('?missing_id');
}
// Hash auslesen
$results = RoItem::getObjects(array('i.id' => $id), array('to' => 1), "i.online ASC, i.item_id ASC, i.price_one ASC");
if ($results == null || is_array($results) == false || count($results) == 0) {
Util::redirect('?hash_not_found');
}
$this->item = current($results);
$this->item->loadHits();
parent::__construct();
}
示例14: edit
/**
* Tartalmi elemk módosítása
*
*/
public function edit()
{
$id = $this->registry->params;
if (isset($_POST['submit_update_content'])) {
$result = $this->content_model->update_content($id);
Util::redirect('content');
}
// adatok bevitele a view objektumba
$this->view->title = 'Tartalom szerkesztése';
$this->view->description = 'Tartalom szerkesztése description';
$this->view->js_link[] = $this->make_link('js', ADMIN_ASSETS, 'plugins/bootbox/bootbox.min.js');
$this->view->js_link[] = $this->make_link('js', ADMIN_ASSETS, 'plugins/ckeditor/ckeditor.js');
$this->view->js_link[] = $this->make_link('js', ADMIN_JS, 'pages/edit_content.js');
// visszadja a szerkesztendő oldal adatait egy tömbben (page_id, page_title ... stb.)
$this->view->data_arr = $this->content_model->content_data_query($id);
$this->view->render('content/tpl_edit_content');
}
示例15: Report
protected static function Report($errorMessage, $backTrace, $file, $line)
{
$htmlError = self::BuildBackTrace($errorMessage, $backTrace, $file, $line, true);
$textError = self::BuildBackTrace($errorMessage, $backTrace, $file, $line, false);
header('Status: 503 Service Temporarily Unavailable');
if (HTTPContext::Enabled()) {
echo $htmlError;
die;
} else {
echo $textError;
}
$userReported = true;
if (!$userReported) {
/**
* Redirect frontend user to generic error
*/
Util::redirect('/error/500/');
}
}