本文整理汇总了PHP中CUser::isUser方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::isUser方法的具体用法?PHP CUser::isUser怎么用?PHP CUser::isUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::isUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTable
public function getTable($res, $rows)
{
// Get parameters
$hits = isset($_GET['hits']) ? $_GET['hits'] : 8;
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$id = isset($_GET['id']) ? $_GET['id'] : null;
// Check that incoming parameters are valid
is_numeric($hits) or die('Check: Hits must be numeric.');
is_numeric($page) or die('Check: Page must be numeric.');
if ($id !== null) {
return $this->getDetails($res[0]);
exit;
}
// Prepare the table, firt the header row
$admin = CUser::isUser() ? '<th>Admin</th>' : NULL;
$tr = "<tr>\n <th>Id</th>\n <th>Akronym " . CFunc::orderby('acronym') . "</th>\n <th>Namn " . CFunc::orderby('name') . "</th>\n <th>Roll</th>\n {$admin}\n </tr>";
// Prepare the data rows
foreach ($res as $key => $val) {
$admin = CUser::isCurrentUser($val->id) ? "<a href='user_regedit.php?id={$val->id}'>Edit</a> <a href='user_delete.php?id={$val->id}'>Delete</a>" : NULL;
$admin = CUser::isUser($val->id) ? "<td>{$admin}</td>" : NULL;
$admin = CUser::isAuthenticated() ? "<td><a href='user_edit.php?id={$val->id}'>Edit</a> <a href='user_delete.php?id={$val->id}'>Delete</a></td>" : $admin;
// $synopsys = CTextFilter::nl2br($val->synopsys);
$href = CFunc::getQueryString(array('id' => $val->id));
$tr .= "<tr>\n </a></td>\n <td>{$val->id}</td>\n <td><a href='{$href}'>{$val->acronym}</a></td>\n <td>{$val->name}</td>\n <td>{$val->role}</td>\n {$admin}\n </tr>";
}
// Prepare navigation bars and admin information
$max = ceil($rows / $hits);
$hitsPerPage = CFunc::getHitsPerPage(array(4, 8, 16), $hits);
$navigatePage = CFunc::getPageNavigation($hits, $page, $max);
$adminAnchors = CUser::isAuthenticated() ? "<p><a href='user_create.php'>Skapa ny användare</a> <a href='user_reset.php'>Återställ användardatabasen</a></p>" : null;
// Put rows in HTML-table with navigation bars
$htmlTable = <<<EOD
<div class='dbtable'>
<div class='rows'>{$rows} träffar. {$hitsPerPage}</div>
<table>
{$tr}
</table>
<div class='pages'>{$navigatePage}</div>
{$adminAnchors}
</div>
EOD;
return $htmlTable;
}
示例2: CUser
<?php
/**
* This is a Branax pagecontroller.
*
*/
// Include the essential config-file which also creates the $branax variable with its defaults.
include __DIR__ . '/config.php';
// Create the user object
$user = new CUser($branax['database']);
// Check if logged in user
$admin = $user->isAdmin() ? 'med administratörsrättigheter' : null;
$output = $user->isUser() ? "Du är inloggad som {$user->getAcronym()} ({$user->getName()}) {$admin}" : "Du är INTE inloggad.";
// Do it and store it all in variables in the Anax container.
$branax['title'] = "User status";
$branax['main'] = <<<EOD
<h1>{$branax['title']}</h1>
<form method=post>
<fieldset>
<legend>Login status</legend>
<output><b>{$output}</b></output>
<p><a href='user_login.php'>Login</a></p>
<p><a href='user_logout.php'>Logout</a></p>
</fieldset>
</form>
EOD;
// Finally, leave it all to the rendering phase of Branax.
include BRANAX_THEME_PATH;
示例3: array
$branax['database']['cmd'] = "/usr/bin/mysql -hblu-ray.student.bth.se -u{$branax['database']['username']} -p'{$branax['database']['password']}'";
}
$branax['database']['driver_options'] = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'");
/**
* The navbar
*
*/
//$anax['navbar'] = null; // To skip the navbar
// $content = new CContent($branax['database']);
// $blogItems = $content->getBlogItems();
// $pageItems = $content->getPageItems();
// $content = null;
$userId = CUser::isUser() ? '?id=' . CUser::isUser() : null;
$blogSubMenuItems = CUser::isAuthenticated() ? array('items' => array('view' => array('text' => 'Ändra', 'url' => 'content_view.php', 'title' => 'Ändra innehåll'), 'create' => array('text' => 'Lägg till', 'url' => 'content_create.php', 'title' => 'Nytt innehåll'), 'reset' => array('text' => 'Återställ', 'url' => 'content_reset.php', 'title' => 'Återställ innehåll'))) : null;
$movieSubMenuItems = CUser::isAuthenticated() ? array('items' => array('create' => array('text' => 'Lägg till', 'url' => 'movie_create.php', 'title' => 'Nytt innehåll'), 'reset' => array('text' => 'Återställ', 'url' => 'movie_reset.php', 'title' => 'Återställ innehåll'))) : null;
$userSubMenuItems = CUser::isUser() ? array('logout' => array('text' => 'Logout', 'url' => 'user_logout.php', 'title' => 'Utloggning')) : array();
$userSubMenuItems += array('login' => array('text' => 'Login', 'url' => 'user_login.php', 'title' => 'Inloggning'), 'status' => array('text' => 'Status', 'url' => 'user_status.php', 'title' => 'Inloggningsstatus'));
$userSubMenuItems += CUser::isAuthenticated() ? array('create' => array('text' => 'Lägg till', 'url' => 'user_create.php', 'title' => 'Nytt innehåll'), 'reset' => array('text' => 'Återställ', 'url' => 'user_reset.php', 'title' => 'Återställ')) : array();
$searchForm = CMovieSearch::getTitleForm('movies.php');
$branax['navbar'] = array('class' => 'navbar', 'items' => array('hem' => array('text' => 'Hem', 'url' => 'home.php', 'title' => 'RM Rental Movies'), 'filmer' => array('text' => 'Filmer', 'url' => 'movies.php', 'title' => 'Våra filmer', 'submenu' => $movieSubMenuItems), 'nyheter' => array('text' => 'Nyheter', 'url' => 'content_blog.php', 'title' => 'Blogg', 'submenu' => $blogSubMenuItems), 'dice' => array('text' => 'Tävling', 'url' => 'dice100.php', 'title' => 'Spela och vinn en film'), 'user' => array('text' => 'Användare', 'url' => "user_view.php{$userId}", 'title' => 'Användarprofiler', 'submenu' => array('items' => $userSubMenuItems)), 'about' => array('text' => 'Om RM', 'url' => 'about.php', 'title' => 'Om företaget')), 'callback' => function ($url) {
if (basename($_SERVER['SCRIPT_NAME']) == $url) {
return true;
}
if (in_array(basename($_SERVER['SCRIPT_NAME']), ['content_edit.php', 'content_delete.php', 'content_view.php']) && in_array($url, ['content_edit.php', 'content_delete.php', 'content_view.php'])) {
return true;
}
if (in_array(basename($_SERVER['SCRIPT_NAME']), ['movie_view.php', 'movie_edit.php', 'movie_delete.php']) && in_array($url, ['movies.php'])) {
return true;
}
if (in_array(basename($_SERVER['SCRIPT_NAME']), ['user_view.php', 'user_register.php', 'user_regedit.php', 'user_edit.php', 'user_delete.php']) && in_array(parse_url($url, PHP_URL_PATH), ['user_view.php'])) {
return true;