本文整理汇总了PHP中system::genlink方法的典型用法代码示例。如果您正苦于以下问题:PHP system::genlink方法的具体用法?PHP system::genlink怎么用?PHP system::genlink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类system
的用法示例。
在下文中一共展示了system::genlink方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkparams
<?php
//-----------------------------------------------------------------------------
namespace mycms;
require_once 'DB.php';
require_once 'admin.class.php';
//-----------------------------------------------------------------------------
global $g;
if (!$g['user']['is_authenticated']) {
$g['auth']->authenticate();
}
// This page is only loaded for authorized users
if (!$g['user']['is_admin']) {
$g['error']->push('This account has no administration privilage', 'error', true);
system::redirect(system::genlink(''));
}
if (!isset($_GET['content'])) {
$_GET['content'] = 'people';
}
$ct = strtolower($_GET['content']);
$g['template'] = $ct . '_admin_create';
$err = false;
// Set main menu options
$menu = array(array('name' => 'people', 'url' => 'admin/people'), array('name' => 'research', 'url' => 'admin/research'), array('name' => 'publication', 'url' => 'admin/publication'));
$g['smarty']->assign('menu', $menu);
// Set secondary menu options
$menu = array(array('name' => 'trac', 'url' => 'https://papyrus.usask.ca/trac/hci/'), array('name' => 'logout', 'url' => 'logout', 'user_id' => $g['user']['id']));
$g['smarty']->assign('menu_2', $menu);
//-----------------------------------------------------------------------------
function checkparams($params)
示例2:
//you wanna to stay logged in?
$_POST['remember'] = false;
$res = $g['user']->login($_POST['username'], $_POST['password'], $_POST['remember']);
// if login is not successful
if ($res['count'] == 0) {
$g['error']->push(L_LOGIN_ERROR, 'error', true);
system::redirect(system::genlink('users/login'), true);
}
if ($g['user']->role != 'guest') {
//if($_SESSION['request']){
//system::redirect(system::genlink($_SESSION['request']), true);
//} else {
system::redirect(system::genlink('pages/home'), true);
//}
} else {
system::redirect(system::genlink('users/login'), true);
}
}
$g['template'] = 'login';
break;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
case 'logout':
$g['user']->logout();
system::redirect($g['weburl']);
break;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
case 'edit_profile':
if (isset($_POST['submit'])) {
if ($_POST['password'] != $_POST['confirm_password']) {
示例3: array
// Set main menu options
$menu = array(array('name' => 'Home', 'url' => ''), array('name' => 'People', 'url' => 'people'), array('name' => 'Research', 'url' => 'research'), array('name' => 'Publications', 'url' => 'publications'), array('name' => 'Courses', 'url' => 'courses'), array('name' => 'Download', 'url' => 'download'), array('name' => 'Contact', 'url' => 'contact'));
$g['smarty']->assign('menu', $menu);
$auth_menu_state = $g['user']['is_authenticated'] ? 'logout' : 'login';
// Set secondary menu options
$menu = array(array('name' => 'trac', 'url' => $g['trac_url']), array('name' => $auth_menu_state, 'url' => $auth_menu_state, 'user_id' => $g['user']['id']));
$g['smarty']->assign('menu_2', $menu);
//-----------------------------------------------------------------------------
switch ($_GET['action']) {
//-----------------------------------------------------------------------------
//TODO: after login it should continue on the current page not the homepage
case 'login':
$g['auth']->authenticate();
goto HOME;
case 'logout':
$g['auth']->logout(system::genlink(''));
goto HOME;
//-----------------------------------------------------------------------------
HOME:
case 'home':
$imglist = pages::get_imagelist(true);
if (!$imglist['error'] && $imglist['count'] > 0) {
$g['smarty']->assign('imglist', $imglist);
}
$faculty = $g['content']['people']->view('teaser', 'people.people_group = "faculty"');
if (!$faculty['error'] && $faculty['count'] > 0) {
$g['smarty']->assign('faculty', $faculty);
}
$research = $g['content']['research']->view('teaser', 'research.research_status = "active"', 'research.research_priority DESC', '0,3');
if (!$research['error'] && $research['count'] > 0) {
$g['smarty']->assign('research', $research);