本文整理汇总了PHP中Lib::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Lib::redirect方法的具体用法?PHP Lib::redirect怎么用?PHP Lib::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lib
的用法示例。
在下文中一共展示了Lib::redirect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$api = Lib::api('admin', array('response' => 'return', 'format' => 'php'));
$type = Req::get('type');
if (!is_callable(array($api, $type))) {
return Lib::redirect('error');
}
$result = $api->{$type}();
$options = array('view' => 'admin');
$ref = Req::post('ref');
if (!$result['state']) {
if (!empty($ref)) {
$options['ref'] = $ref;
}
} else {
$segments = explode('/', base64_decode(urldecode($ref)));
$base = array_shift($segments);
$type = array_shift($segments);
$subtype = array_shift($segments);
if (!empty($type)) {
$options['type'] = $type;
}
if (!empty($subtype)) {
$options['subtype'] = $subtype;
}
}
Lib::redirect('admin', $options);
}
示例2: main
public function main()
{
$this->meta[] = array('name' => 'google-signin-client_id', 'content' => Config::$googleClientId . '.apps.googleusercontent.com');
$cookie = Lib::cookie();
$identifier = $cookie->get(Lib::hash(Config::$userkey));
$user = Lib::table('user');
$isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
$this->set('user', $user);
$this->set('isLoggedIn', $isLoggedIn);
$this->js[] = $isLoggedIn ? 'inbox' : 'login';
if ($isLoggedIn) {
array_shift($this->js);
$id = Req::get('id');
if (empty($id)) {
Lib::redirect('index');
}
$report = Lib::table('report');
if (!$report->load($id)) {
$this->template = 'no-report';
return;
}
$report->init();
$assignees = Lib::model('user')->getProjectAssignees($report->project_id);
$projectTable = Lib::table('project');
$projectTable->load($report->project_id);
$this->set('report', $report);
$this->set('assignees', $assignees);
$this->set('project', $projectTable);
}
}
示例3: main
public function main()
{
$key = Lib::hash(Config::$adminkey);
$cookie = Lib::cookie();
$identifier = $cookie->get($key);
$admin = Lib::table('admin');
$logged = !empty($identifier) && $admin->load(array('identifier' => $identifier));
$type = Req::get('type');
$ref = Req::get('ref');
if (!empty($ref)) {
if ($logged) {
$segments = explode('/', base64_decode($ref));
$base = array_shift($segments);
$type = array_shift($segments);
$subtype = array_shift($segments);
$options = array();
if (!empty($type)) {
$options['type'] = $type;
}
if (!empty($subtype)) {
$options['subtype'] = $subtype;
}
Lib::redirect($base, $options);
return;
}
return $this->form();
}
if (!$logged) {
if (empty($type)) {
return $this->form();
}
$options = array('view' => 'admin');
if (!empty($type)) {
$options['type'] = $type;
}
$subtype = Req::get('subtype');
if (!empty($subtype)) {
$options['subtype'] = $subtype;
}
$ref = Lib::url('admin', $options);
return Lib::redirect('admin', array('view' => 'admin', 'ref' => base64_encode($ref)));
}
if (empty($type)) {
$type = 'index';
}
if (!is_callable(array($this, $type))) {
return Lib::redirect('error');
}
return $this->{$type}();
}
示例4: saveProjectTitle
public function saveProjectTitle()
{
$keys = array('project-title', 'project-name');
$post = Req::post($keys);
if (empty($post['project-name'])) {
Lib::redirect('page', array('view' => 'embed'));
}
if (empty($post['project-title'])) {
Lib::redirect('page', array('view' => 'embed', 'project' => $post['project-name']));
}
$projectTable = Lib::table('project');
$projectTable->load(array('name' => $post['project-name']));
$projectTable->title = $post['project-title'];
$projectTable->store();
Lib::redirect('page', array('view' => 'embed', 'project' => $post['project-name']));
}
示例5: structureTreeConvert
/**
* Convert legacy relationships to select field values.
*
* 1. Add to all contenttypes in `contenttypes.yml` the following field:
* structure_parent:
* type: select
* values: structures/id,title
* autocomplete: true
* label: "Select structure tree parent"
*
* 2. Run this query at /bolt/structure-tree/convert
*
* 3. remove all elements from `bolt_relations` WHERE `from_contenttype` = 'structures' AND `to_contenttype` = 'structures'
* -> can't just delete `to_contenttype` = 'structures', because this messes with other relationships.
*
*/
public function structureTreeConvert()
{
$this->requireUserPermission('structure-tree');
if (!$this->app['users']->isAllowed('structure-tree')) {
return Lib::redirect('dashboard');
}
$bolt_relations = $this->app['config']->get('general/database/prefix') . 'relations';
$results = $this->app['db']->fetchAll("SELECT * FROM `{$bolt_relations}` WHERE `to_contenttype` = 'structures' ORDER BY `from_contenttype` ASC LIMIT 0, 10000");
foreach ($results as $result) {
$tablename = $this->app['config']->get('general/database/prefix') . $result['from_contenttype'];
$id = $result['from_id'];
$parent = $result['to_id'];
$this->app['db']->executeUpdate("UPDATE {$tablename} SET structure_parent = ? WHERE id = ?", array($parent, $id));
}
return 'ok';
}
示例6: execute
public function execute()
{
// Controllers are static links that is not used for API purposes, hence it should always redirect to something after performing internal actions
Lib::redirect('index');
}