本文整理汇总了PHP中user_is_authenticated函数的典型用法代码示例。如果您正苦于以下问题:PHP user_is_authenticated函数的具体用法?PHP user_is_authenticated怎么用?PHP user_is_authenticated使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_is_authenticated函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: theme_menu_both
function theme_menu_both($menu)
{
$links = array();
foreach (menu_visible_items() as $url => $page) {
$title = $url ? $url : 'home';
$title = str_replace("-", " ", $title);
if (!$url) {
$url = BASE_URL;
}
// Shouldn't be required, due to <base> element but some browsers are stupid.
if ($menu == 'bottom' && isset($page['accesskey'])) {
$links[] = "<a href='{$url}' accesskey='{$page['accesskey']}'>{$title}</a> {$page['accesskey']}";
} else {
$links[] = "<a href='{$url}'>{$title}</a>";
}
}
if (user_is_authenticated()) {
$user = user_current_username();
array_unshift($links, "<b><a href='user/{$user}'>{$user}</a></b>");
}
if ($menu == 'bottom') {
$links[] = "<a href='{$_GET['q']}' accesskey='5'>refresh</a> 5";
}
return "<div class='menu menu-{$menu}'>" . implode(' | ', $links) . '</div>';
}
示例2: user_ensure_authenticated
function user_ensure_authenticated()
{
if (!user_is_authenticated()) {
$content = theme('login');
theme('page', __("Login"), $content);
}
}
示例3: touch_theme_menu_top
function touch_theme_menu_top()
{
$links = $main_menu_titles = array();
if (setting_fetch('tophome', 'yes') == 'yes') {
$main_menu_titles[] = __("Home");
}
if (setting_fetch('topreplies', 'yes') == 'yes') {
$main_menu_titles[] = __("Replies");
}
if (setting_fetch('topdirects', 'yes') == 'yes') {
$main_menu_titles[] = __("Directs");
}
if (setting_fetch('topsearch') == 'yes') {
$main_menu_titles[] = __("Search");
}
foreach (menu_visible_items() as $url => $page) {
$title = $url ? $page['title'] : __("Home");
$type = in_array($title, $main_menu_titles) ? 'main' : 'extras';
$links[$type][] = "<a href='" . BASE_URL . "{$url}'>{$title}</a>";
}
if (user_is_authenticated()) {
$user = user_current_username();
if (setting_fetch('topuser') == 'yes') {
array_unshift($links['main'], "<b><a href='" . BASE_URL . "user/{$user}'>{$user}</a></b>");
}
array_unshift($links['extras'], "<b><a href='" . BASE_URL . "user/{$user}'>{$user}</a></b>");
}
array_push($links['main'], '<a href="#" onclick="return toggleMenu()">' . __('More') . '</a>');
$html = '<div id="menu" class="menu">';
$html .= theme('list', $links['main'], array('id' => 'menu-main'));
$html .= theme('list', $links['extras'], array('id' => 'menu-extras'));
$html .= '</div>';
return $html;
}
示例4: user_ensure_authenticated
function user_ensure_authenticated()
{
if (!user_is_authenticated()) {
$content = theme('login');
$content .= theme('about');
theme('page', 'Login', $content);
}
}
示例5: desktop_theme_status_form
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL)
{
if (user_is_authenticated()) {
if ($_SERVER['HTTPS'] == "on") {
$icon = "https://si0.twimg.com/images/dev/cms/intents/bird/bird_blue/bird_16_blue.png";
} else {
$icon = "http://a1.twimg.com/images/dev/cms/intents/bird/bird_blue/bird_16_blue.png";
}
// adding ?status=foo will automaticall add "foo" to the text area.
if ($_GET['status']) {
$text = $_GET['status'];
}
$output = '
<form method="post" action="update">
<fieldset>
<legend><img src="' . $icon . '" width="16" height="16" /> What\'s Happening?</legend>
<textarea id="status" name="status" rows="4" style="width:95%; max-width: 400px;">' . $text . '</textarea>
<div>
<input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" />
<input type="submit" value="Tweet" />
<span id="remaining">140</span>
<span id="geo" style="display: none;">
<input onclick="goGeo()" type="checkbox" id="geoloc" name="location" />
<label for="geoloc" id="lblGeo"></label>
</span>
</div>
</fieldset>
<script type="text/javascript">
started = false;
chkbox = document.getElementById("geoloc");
if (navigator.geolocation) {
geoStatus("Tweet my location");
if ("' . $_COOKIE['geo'] . '"=="Y") {
chkbox.checked = true;
goGeo();
}
}
function goGeo(node) {
if (started) return;
started = true;
geoStatus("Locating...");
navigator.geolocation.getCurrentPosition(geoSuccess, geoStatus , { enableHighAccuracy: true });
}
function geoStatus(msg) {
document.getElementById("geo").style.display = "inline";
document.getElementById("lblGeo").innerHTML = msg;
}
function geoSuccess(position) {
geoStatus("Tweet my <a href=\'http://maps.google.co.uk/m?q=" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>");
chkbox.value = position.coords.latitude + "," + position.coords.longitude;
}
</script>
</form>';
$output .= js_counter('status');
return $output;
}
}
示例6: settings_page
function settings_page($args)
{
if ($args[1] == 'save') {
$settings['browser'] = $_POST['browser'];
$settings['gwt'] = $_POST['gwt'];
$settings['colours'] = $_POST['colours'];
$settings['reverse'] = $_POST['reverse'];
$settings['timestamp'] = $_POST['timestamp'];
$settings['hide_inline'] = $_POST['hide_inline'];
$settings['utc_offset'] = (double) $_POST['utc_offset'];
// Save a user's oauth details to a MySQL table
if (MYSQL_USERS == 'ON' && ($newpass = $_POST['newpassword'])) {
user_is_authenticated();
list($key, $secret) = explode('|', $GLOBALS['user']['password']);
$sql = sprintf("REPLACE INTO user (username, oauth_key, oauth_secret, password) VALUES ('%s', '%s', '%s', MD5('%s'))", mysql_escape_string(user_current_username()), mysql_escape_string($key), mysql_escape_string($secret), mysql_escape_string($newpass));
mysql_query($sql);
}
setcookie_year('settings', base64_encode(serialize($settings)));
twitter_refresh('');
}
$modes = array('mobile' => 'Normal phone', 'touch' => 'Touch phone', 'desktop' => 'PC/Laptop', 'text' => 'Text only', 'worksafe' => 'Work Safe', 'bigtouch' => 'Big Touch');
$gwt = array('off' => 'direct', 'on' => 'via GWT');
$colour_schemes = array();
foreach ($GLOBALS['colour_schemes'] as $id => $info) {
list($name, $colours) = explode('|', $info);
$colour_schemes[$id] = $name;
}
$utc_offset = setting_fetch('utc_offset', 0);
/* returning 401 as it calls http://api.twitter.com/1/users/show.json?screen_name= (no username???)
if (!$utc_offset) {
$user = twitter_user_info();
$utc_offset = $user->utc_offset;
}
*/
if ($utc_offset > 0) {
$utc_offset = '+' . $utc_offset;
}
$content .= '<form action="settings/save" method="post"><p>Colour scheme:<br /><select name="colours">';
$content .= theme('options', $colour_schemes, setting_fetch('colours', 1));
$content .= '</select></p><p>Mode:<br /><select name="browser">';
$content .= theme('options', $modes, $GLOBALS['current_theme']);
$content .= '</select></p><p>External links go:<br /><select name="gwt">';
$content .= theme('options', $gwt, setting_fetch('gwt', $GLOBALS['current_theme'] == 'text' ? 'on' : 'off'));
$content .= '</select><small><br />Google Web Transcoder (GWT) converts third-party sites into small, speedy pages suitable for older phones and people with less bandwidth.</small></p>';
$content .= '<p><label><input type="checkbox" name="reverse" value="yes" ' . (setting_fetch('reverse') == 'yes' ? ' checked="checked" ' : '') . ' /> Attempt to reverse the conversation thread view.</label></p>';
$content .= '<p><label><input type="checkbox" name="timestamp" value="yes" ' . (setting_fetch('timestamp') == 'yes' ? ' checked="checked" ' : '') . ' /> Show the timestamp ' . twitter_date('H:i') . ' instead of 25 sec ago</label></p>';
$content .= '<p><label><input type="checkbox" name="hide_inline" value="yes" ' . (setting_fetch('hide_inline') == 'yes' ? ' checked="checked" ' : '') . ' /> Hide inline media (eg TwitPic thumbnails)</label></p>';
$content .= '<p><label>The time in UTC is currently ' . gmdate('H:i') . ', by using an offset of <input type="text" name="utc_offset" value="' . $utc_offset . '" size="3" /> we display the time as ' . twitter_date('H:i') . '.<br />It is worth adjusting this value if the time appears to be wrong.</label></p>';
// Allow users to choose a Dabr password if accounts are enabled
if (MYSQL_USERS == 'ON' && user_is_authenticated()) {
$content .= '<fieldset><legend>Dabr account</legend><small>If you want to sign in to Dabr without going via Twitter.com in the future, create a password and we\'ll remember you.</small></p><p>Change Dabr password<br /><input type="password" name="newpassword" /><br /><small>Leave blank if you don\'t want to change it</small></fieldset>';
}
$content .= '<p><input type="submit" value="Save" /></p></form>';
$content .= '<hr /><p>Visit <a href="reset">Reset</a> if things go horribly wrong - it will log you out and clear all settings.</p>';
return theme('page', 'Settings', $content);
}
示例7: config_log_request
function config_log_request()
{
if (!user_is_authenticated()) {
return;
}
$allowed_users = file('invite.php');
if (!in_array(strtolower(user_current_username()) . "\n", $allowed_users)) {
user_logout();
die("对不起,您不是受邀用户,无法登录。");
}
}
示例8: desktop_theme_status_form
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL, $is_desktop = true)
{
if (user_is_authenticated()) {
$fixedtags = setting_fetch('fixedtago', 'no') == "yes" && $text == '' ? " #" . setting_fetch('fixedtagc') : null;
$output = '<form method="post" action="' . BASE_URL . 'update"><textarea id="status" name="status" rows="3" style="width:100%; max-width: 400px;">' . $text . $fixedtags . '</textarea><div><input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" /><input type="submit" value="' . __('Update') . '" /> <span id="remaining">140</span> ';
if (substr($_GET["q"], 0, 4) !== "user") {
$output .= ' <a href="' . BASE_URL . 'upload">' . __('Upload Picture') . '</a>';
}
$output .= '</div></form>';
return $output;
}
}
示例9: blackberry_theme_menu_bottom
function blackberry_theme_menu_bottom()
{
$links = array();
$links[] = "<a href='" . BASE_URL . "'>" . __("Home") . "</a>";
if (user_is_authenticated()) {
if (setting_fetch('replies') == 'yes') {
$links[] = "<a href='" . BASE_URL . "replies'>" . __("Replies") . "</a>";
}
if (setting_fetch('retweets') == 'yes') {
$links[] = "<a href='" . BASE_URL . "retweets'>" . __("Retweets") . "</a>";
}
if (setting_fetch('directs') == 'yes') {
$links[] = "<a href='" . BASE_URL . "directs'>" . __("Directs") . "</a>";
}
if (setting_fetch('search') == 'yes') {
$links[] = "<a href='" . BASE_URL . "search'>" . __("Search") . "</a>";
}
if (setting_fetch('favourites') == 'yes') {
$links[] = "<a href='" . BASE_URL . "favourites'>" . __("Favourites") . "</a>";
}
if (setting_fetch('lists') == 'yes') {
$links[] = "<a href='" . BASE_URL . "lists'>" . __("Lists") . "</a>";
}
if (setting_fetch('followers') == 'yes') {
$links[] = "<a href='" . BASE_URL . "followers'>" . __("Followers") . "</a>";
}
if (setting_fetch('friends') == 'yes') {
$links[] = "<a href='" . BASE_URL . "friends'>" . __("Friends") . "</a>";
}
if (setting_fetch('blockings') == 'yes') {
$links[] = "<a href='" . BASE_URL . "blockings'>" . __("Blockings") . "</a>";
}
}
if (user_is_authenticated()) {
$user = user_current_username();
array_unshift($links, "<b><a href='" . BASE_URL . "user/{$user}'>{$user}</a></b>");
if (setting_fetch('about') == 'yes') {
$links[] = "<a href='" . BASE_URL . "about'>" . __("About") . "</a>";
}
if (setting_fetch('ssettings', 'yes') == 'yes') {
$links[] = "<a href='" . BASE_URL . "settings'>" . __("Settings") . "</a>";
}
if (setting_fetch('slogout') == 'yes') {
$links[] = "<a href='" . BASE_URL . "logout'>" . __("Logout") . "</a>";
}
}
if (setting_fetch('srefresh', 'yes') == 'yes') {
$links[] = "<a href='" . BASE_URL . "{$_GET['q']}' accesskey='5'>" . __("Refresh") . "</a> 5";
}
return "<div class='menu menu-{$menu}'>" . implode(' | ', $links) . "</div>" . theme('pagination');
}
示例10: desktop_theme_status_form
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL, $is_desktop = true)
{
if (user_is_authenticated()) {
$fixedtags = setting_fetch('fixedtago', 'no') == "yes" && $text == '' ? " #" . setting_fetch('fixedtagc') : null;
$output = '<form method="post" action="' . BASE_URL . 'update"><textarea id="status" name="status" rows="3" style="width:100%; max-width: 400px;">' . $text . $fixedtags . '</textarea>';
if (setting_fetch('buttongeo') == 'yes') {
$output .= '
<br /><span id="geo" style="display: inline;"><input onclick="goGeo()" type="checkbox" id="geoloc" name="location" /> <label for="geoloc" id="lblGeo"></label></span>
<script type="text/javascript">
<!--
started = false;
chkbox = document.getElementById("geoloc");
if (navigator.geolocation) {
geoStatus("' . __("Tweet my location") . '");
if ("' . $_COOKIE['geo'] . '"=="Y") {
chkbox.checked = true;
goGeo();
}
}
function goGeo(node) {
if (started) return;
started = true;
geoStatus("' . __("Locating...") . '");
navigator.geolocation.getCurrentPosition(geoSuccess, geoStatus, {enableHighAccuracy: true});
}
function geoStatus(msg) {
document.getElementById("geo").style.display = "inline";
document.getElementById("lblGeo").innerHTML = msg;
}
function geoSuccess(position) {
if(typeof position.address !== "undefined")
geoStatus("' . __("Tweet my ") . '<a href=\'https://maps.google.com/maps?q=loc:" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>" + " (" + position.address.country + position.address.region + "省" + position.address.city + "市,' . __("accuracy: ") . '" + position.coords.accuracy + "m)");
else
geoStatus("' . __("Tweet my ") . '<a href=\'https://maps.google.com/maps?q=loc:" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>' . __("location") . '</a>" + " (' . __("accuracy: ") . '" + position.coords.accuracy + "m)");
chkbox.value = position.coords.latitude + "," + position.coords.longitude;
}
//-->
</script>
';
}
$output .= '<div><input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" /><input type="submit" value="' . __('Update') . '" /> <span id="remaining">140</span> ';
if (substr($_GET["q"], 0, 4) !== "user") {
$output .= ' <a href="' . BASE_URL . 'upload">' . __('Upload Picture') . '</a>';
}
$output .= '</div></form>';
return $output;
}
}
示例11: menu_visible_items
function menu_visible_items()
{
static $items;
if (!isset($items)) {
$items = array();
foreach ($GLOBALS['menu_registry'] as $url => $page) {
if ($page['security'] && !user_is_authenticated()) {
continue;
}
if ($page['hidden']) {
continue;
}
$items[$url] = $page;
}
}
return $items;
}
示例12: feedback_post
function feedback_post($query)
{
include_once 'login.inc.php';
if (user_is_authenticated()) {
$id1 = ', user_id';
$id2 = ', \'' . get_current_user_id() . '\'';
} else {
$id1 = $id2 = "";
}
$question = get_post('question');
$description = get_post('description');
$email = get_post('email');
include_once "uuid.inc.php";
$v4uuid = str_replace("-", "", UUID::v4());
connect_db();
$add = "INSERT INTO feedback (\r\n\t\t\t\t\t feedback_id, question, description, post_datetime, email{$id1})\r\n\t\t\t\t VALUES ('{$v4uuid}', '{$question}', '{$description}', '" . date('Y-m-d H:i:s') . "', '{$email}'{$id2})";
$added = mysql_query($add) or die("Could not add entry!");
echo "0";
}
示例13: touch_theme_menu_top
function touch_theme_menu_top()
{
$links = array();
$main_menu_titles = array('home', 'replies', 'directs', 'search');
foreach (menu_visible_items() as $url => $page) {
$title = $url ? $url : 'home';
$type = in_array($title, $main_menu_titles) ? 'main' : 'extras';
$links[$type][] = "<a href='{$url}'>{$title}</a>";
}
if (user_is_authenticated()) {
$user = user_current_username();
array_unshift($links['extras'], "<b><a href='user/{$user}'>{$user}</a></b>");
}
array_push($links['main'], '<a href="#" onclick="return toggleMenu()">more</a>');
$html = '<div id="menu" class="menu">';
$html .= theme('list', $links['main'], array('id' => 'menu-main'));
$html .= theme('list', $links['extras'], array('id' => 'menu-extras'));
$html .= '</div>';
return $html;
}
示例14: desktop_theme_status_form
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL)
{
if (user_is_authenticated()) {
$output = '<form method="post" action="update">
<textarea id="status" name="status" rows="3" style="width:95%; max-width: 400px;">' . $text . '</textarea>
<div><input name="in_reply_to_id" value="' . $in_reply_to_id . '" type="hidden" /><input type="submit" value="Update" /> <span id="remaining">140</span>
<span id="geo" style="display: none; float: right;"><input onclick="goGeo()" type="checkbox" id="geoloc" name="location" /> <label for="geoloc" id="lblGeo"></label></span></div>
<script type="text/javascript">
started = false;
chkbox = document.getElementById("geoloc");
if (navigator.geolocation) {
geoStatus("Tweet my location");
if ("' . $_COOKIE['geo'] . '"=="Y") {
chkbox.checked = true;
goGeo();
}
}
function goGeo(node) {
if (started) return;
started = true;
geoStatus("Locating...");
navigator.geolocation.getCurrentPosition(geoSuccess, geoStatus);
}
function geoStatus(msg) {
document.getElementById("geo").style.display = "inline";
document.getElementById("lblGeo").innerHTML = msg;
}
function geoSuccess(position) {
geoStatus("Tweet my <a href=\'http://maps.google.co.uk/m?q=" + position.coords.latitude + "," + position.coords.longitude + "\' target=\'blank\'>location</a>");
chkbox.value = position.coords.latitude + "," + position.coords.longitude;
}
</script>
</form>';
$output .= js_counter('status');
return $output;
}
}
示例15: twitter_is_reply
function twitter_is_reply($status)
{
if (!user_is_authenticated()) {
return false;
}
$user = user_current_username();
return preg_match("#@{$user}#i", $status->text);
}