本文整理汇总了PHP中user_is_administrator函数的典型用法代码示例。如果您正苦于以下问题:PHP user_is_administrator函数的具体用法?PHP user_is_administrator怎么用?PHP user_is_administrator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_is_administrator函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare_user_name
/**
* prepares the name of the user given the id. also makes it an email link.
* @param int $p_user_id
* @return string
*/
function prepare_user_name($p_user_id)
{
# Catch a user_id of NO_USER (like when a handler hasn't been assigned)
if (NO_USER == $p_user_id) {
return '';
}
$t_username = user_get_name($p_user_id);
if (user_exists($p_user_id) && user_get_field($p_user_id, 'enabled')) {
$t_username = string_display_line($t_username);
// WK/BFE: Original-Zeile auskommentiert: , LB/BFE 2015
// return '<a href="' . string_sanitize_url( 'view_user_page.php?id=' . $p_user_id, true ) . '">' . $t_username . '</a>';
// ersetzt durch: (Link auf view_user_page nur wenn globale Rolle mindestens $g_manage_user_threshold
if (user_is_administrator(auth_get_current_user_id())) {
return '<a href="' . string_sanitize_url('view_user_page.php?id=' . $p_user_id, true) . '">' . $t_username . '</a>';
} else {
return $t_username;
}
// WK/BFE: Ende der Modifikation
} else {
$t_result = '<font STYLE="text-decoration: line-through">';
$t_result .= string_display_line($t_username);
$t_result .= '</font>';
return $t_result;
}
}
示例2: user_delete
function user_delete($username_to_delete)
{
if (!$username_to_delete) {
redirect('/');
}
if (($username_to_delete == $_SERVER['USER'] || user_is_administrator()) && user_is_valid($_SERVER['USERINFO_ARRAY']['username'], $_SERVER['USERINFO_ARRAY']['userpass'])) {
$userdir = "{$_SERVER['PWUSERS_DIR']}/{$username_to_delete}";
exec("rm -fR {$userdir}", $delresults);
exec("grep -rli {$username_to_delete} {$_SERVER['PWUSERS_DIR']}/*/watchedlist.txt", $watchedlists);
foreach ($watchedlists as $watched) {
$data = file_get_contents($watched);
if (strstr($data, "!{$planowner}")) {
preg_match("|(!{$planowner}.*!)|", $data, $matches);
$remove = $matches[0];
} else {
$remove = "\n{$planowner}\n";
}
// remove whatever we found
$data = str_replace($remove, '', $data);
// break down multiple linebreaks so the list doesn't look weird in the edit view
$data = str_replace("\n\n", "\n", $data);
file_put_contents($watched, $data);
}
} else {
output("Error deleting {$username_to_delete}", "\n\t<div class='alert'>\n\tYou can't delete {$username_to_delete}. Talk to an\n\t<a href='mailto:help@planwatch.org'>admin</a>.\n\tClick <a href='{$_SERVER['WEB_ROOT']}/'>here</a> to go back to the main page.\n\t</div>\n\t");
}
if ($username_to_delete == $user) {
logout("{$username_to_delete} has been deleted.");
} else {
redirect('/');
}
}
示例3: print_document_selection
/**
* @param $types
*/
function print_document_selection($types)
{
$project_id = gpc_get_int('project_id', helper_get_current_project());
$specmanagement_database_api = new specmanagement_database_api();
echo '<select name="version_id">';
foreach ($types as $type) {
$type_string = string_html_specialchars($type);
$type_id = $specmanagement_database_api->get_type_id($type);
$version_id_array = get_version_ids($type_id, $project_id);
foreach ($version_id_array as $version_id) {
$version_spec_project_id = version_get_field($version_id, 'project_id');
if (project_includes_user($version_spec_project_id, auth_get_current_user_id()) || user_is_administrator(auth_get_current_user_id())) {
$version_string = version_full_name($version_id);
echo '<option value="' . $version_id . '">';
echo $type_string . " - " . $version_string;
echo '</option>';
}
}
}
echo '</select>';
}
示例4: menu
function menu()
{
if (plugin_config_get('show_menu')) {
require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'wmApi.php';
$projectId = helper_get_current_project();
$userId = auth_get_current_user_id();
$userAccessLevel = user_get_access_level($userId, $projectId);
$whiteboardPlugins = wmApi::getWhiteboardPlugins();
$showMenu = false;
foreach ($whiteboardPlugins as $whiteboardPlugin) {
$pluginAccessLevel = $whiteboardPlugin[2];
if (user_is_administrator($userId) || $userAccessLevel >= $pluginAccessLevel) {
$showMenu = true;
break;
}
}
if ($showMenu) {
return '<a href="' . plugin_page('whiteboard_menu') . '">' . plugin_lang_get('menu_title') . '</a>';
}
}
return null;
}
示例5: users_get_list
function users_get_list()
{
$list = array();
if (user_is_administrator()) {
$list_fn = "{$_SERVER['FILE_ROOT']}/stats/userlist_all.txt";
} else {
$list_fn = "{$_SERVER['FILE_ROOT']}/stats/userlist_public.txt";
}
if (file_exists($list_fn) && @filemtime($list_fn) > time() - 3600 * 12) {
$list = @file($list_fn);
} else {
exec("ls -d {$_SERVER['PWUSERS_DIR']}/" . "*" . "/", $ulist);
foreach ($ulist as $listuser) {
parse_str(user_read_info(basename($listuser)), $tempuser);
if ($tempuser['rlpref'] == 1) {
$list[] = basename($listuser);
}
if (is_dir("{$_SERVER['PWUSERS_DIR']}/" . basename($listuser))) {
$list_all[] = basename($listuser);
}
}
file_put_contents("{$_SERVER['FILE_ROOT']}/stats/userlist.txt", implode("\n", $list));
file_put_contents("{$_SERVER['FILE_ROOT']}/stats/userlist_all.txt", implode("\n", $list_all));
if (user_is_administrator()) {
$list = $list_all;
}
}
return $list;
}
示例6: form_security_validate
form_security_validate('manage_user_delete');
auth_reauthenticate();
access_ensure_global_level( config_get( 'manage_user_threshold' ) );
$f_user_id = gpc_get_int( 'user_id' );
$t_user = user_get_row( $f_user_id );
# Ensure that the account to be deleted is of equal or lower access to the
# current user.
access_ensure_global_level( $t_user['access_level'] );
# check that we are not deleting the last administrator account
$t_admin_threshold = config_get_global( 'admin_site_threshold' );
if ( user_is_administrator( $f_user_id ) &&
user_count_level( $t_admin_threshold ) <= 1 ) {
trigger_error( ERROR_USER_CHANGE_LAST_ADMIN, ERROR );
}
# If an administrator is trying to delete their own account, use
# account_delete.php instead as it is handles logging out and redirection
# of users who have just deleted their own accounts.
if ( auth_get_current_user_id() == $f_user_id ) {
form_security_purge( 'manage_user_delete' );
print_header_redirect( 'account_delete.php?account_delete_token=' . form_security_token( 'account_delete' ), true, false );
}
helper_ensure_confirmed( lang_get( 'delete_account_sure_msg' ) .
'<br/>' . lang_get( 'username_label' ) . lang_get( 'word_separator' ) . $t_user['username'],
lang_get( 'delete_account_button' ) );
示例7: filter_db_can_delete_filter
/**
* Check if the current user has permissions to delete the stored query
* @param $p_filter_id
* @return bool
*/
function filter_db_can_delete_filter($p_filter_id)
{
$t_filters_table = db_get_table('filters');
$c_filter_id = db_prepare_int($p_filter_id);
$t_user_id = auth_get_current_user_id();
# Administrators can delete any filter
if (user_is_administrator($t_user_id)) {
return true;
}
$query = "SELECT id\n\t\t\t\t FROM {$t_filters_table}\n\t\t\t\t WHERE id=" . db_param() . "\n\t\t\t\t AND user_id=" . db_param() . "\n\t\t\t\t AND project_id!=" . db_param();
$result = db_query_bound($query, array($c_filter_id, $t_user_id, -1));
if (db_num_rows($result) > 0) {
return true;
}
return false;
}
示例8: plan_write_journaling
function plan_write_journaling($edit, $plandata, $private, $nolinebreaks = FALSE, $writer = FALSE)
{
include_once 'plan_read.php';
include_once 'snoop.php';
include_once 'spiel.php';
include_once 'send.php';
$planowner = $writer;
// make sure all the timecodes are the same
$time = time();
// find the character encoding of the plan entry, convert it to something
// more universal
mb_detect_order("UTF-8, UTF-8, Windows-1252");
if (mb_detect_encoding($plandata) == "Windows-1252") {
$plandata = mb_convert_encoding($plandata, UTF - 8, Windows - 1252);
}
// make sure no one can post an update to someone else's plan
// this will need to be smarter if we ever implement group plans
// but probably we won't, so no biggie.
if ($planowner != $_SERVER['USER'] && !user_is_administrator()) {
$planowner = $_SERVER['USER'];
}
$plan_dir = "{$_SERVER['PWUSERS_DIR']}/{$planowner}/plan";
// Find the old snoops. We have to masquerade briefly as 'cacheuser' to do
// this without leaving a spurious snitch or getting private entries.
// We remain 'cacheuser' until after snoop_add() below.
$_SERVER['USER'] = 'cacheuser';
// find old snoops, for later clearing
$old_snoop_array = snoop_find(plan_read_local($planowner, $_SERVER['USERINFO_ARRAY']['defaultdays'] + 3 . 'd'), $planowner);
// delete the (now-invalid) cache files
cache_clear($planowner);
// leave a reminder to plan_read_local to ignore linebreaks.
if ($nolinebreaks) {
$plandata .= "<!--nolinebreaks-->";
}
if ($_POST['title']) {
$plandata .= "<!--title {$_POST['title']} -->";
}
if ($_POST['tags']) {
$plandata .= "<!--tags {$_POST['tags']} -->";
}
// if we weren't editing an existing (already-posted) entry, set the filename for the current time.
if (!$_POST['edit'] || $_POST['edit'] == $_POST['draft_edit']) {
$_POST['edit'] = ".{$time}";
}
$plan_fn = "{$plan_dir}/plan{$_POST['edit']}.txt{$_POST['private']}";
if (!file_exists($plan_fn)) {
file_put_contents("{$_SERVER['PWUSERS_DIR']}/{$planowner}/stats/lastupdate", $time);
}
if ($_FILES['attached_file']['tmp_name']) {
rename("{$_FILES['attached_file']['tmp_name']}", "{$_SERVER['USER_ROOT']}/files/{$_FILES['attached_file']['name']}");
if (strstr($_FILES['attached_file']['name'], 'jpg') || strstr($_FILES['attached_file']['name'], 'gif') || strstr($_FILES['attached_file']['name'], 'png')) {
$plandata .= "<img src='/userfiles/view/{$writer}/{$_FILES['attached_file']['name']}' />";
} else {
$plandata .= "\n<a href='/userfiles/view/{$writer}/{$_FILES['attached_file']['name']}'>{$_FILES['attached_file']['name']}</a>";
}
}
// else trigger_error("No Files Uploaded");
$plandata .= $_POST['markdown'];
$plandata .= $_POST['nofeed'];
// save old headers and footers.
if (strstr($plan_fn, 'header') || strstr($plan_fn, 'footer')) {
exec("mv {$plan_fn} {$plan_fn}.{$time}");
}
// write the update to disk.
file_put_contents($plan_fn, $plandata);
// new feature: SPIEL
// here's the part where spiels are found
// TODO(v4.5): replace spiel syntax with hashtags
if (!$private && !$edit) {
spiel_find($plandata, $planowner, $time);
}
// here's the part where sends are found
if (!$private && !$edit) {
send_find($plandata, $planowner, $time);
}
if (file_exists($plan_fn)) {
if ($private && file_exists("{$plan_dir}/plan{$edit}.txt")) {
exec("mv {$plan_dir}/plan{$edit}.txt {$plan_dir}/rem.plan{$edit}.txt");
}
if (!$private && file_exists("{$plan_dir}/plan{$edit}.txt.p")) {
exec("mv {$plan_dir}/plan{$edit}.txt.p {$plan_dir}/rem.plan{$edit}.txt.p");
}
if ($_POST['draft_edit'] && file_exists("{$plan_dir}/draft{$_POST['draft_edit']}.txt")) {
unlink("{$plan_dir}/draft{$_POST['draft_edit']}.txt");
}
// clean up old drafts
if ($drafts = files_list("{$plan_dir}/", "draft*.txt")) {
foreach ($drafts as $draft) {
if (filemtime("{$plan_dir}/{$draft}") < time() - 7 * 24 * 3600) {
unlink("{$plan_dir}/{$draft}");
}
}
}
}
@chmod($plan_fn, 0755);
// clean old snoops and add new ones
$new_snoop_array = snoop_find(plan_read_local($planowner), $planowner);
$snoops_to_remove = array_unique(array_diff($old_snoop_array, $new_snoop_array));
$snoops_to_set = array_unique(array_diff($new_snoop_array, $old_snoop_array));
$remove_status = snoop_clean($snoops_to_remove, $planowner);
//.........这里部分代码省略.........
示例9: printWhiteboardMenu
/**
* print menu entrys for each plugin
*/
public static function printWhiteboardMenu()
{
$projectId = helper_get_current_project();
$userId = auth_get_current_user_id();
$userAccessLevel = user_get_access_level($userId, $projectId);
$whiteboardPlugins = self::getWhiteboardPlugins();
$whiteboardPluginCount = count($whiteboardPlugins);
echo '<div class="table">';
for ($index = 0; $index < $whiteboardPluginCount; $index++) {
$whiteboardPlugin = $whiteboardPlugins[$index];
$plugin = $whiteboardPlugin[1];
$pluginAccessLevel = $whiteboardPlugin[2];
$pluginShowMenu = $whiteboardPlugin[3];
if ((user_is_administrator($userId) || $userAccessLevel >= $pluginAccessLevel) && $pluginShowMenu == 1) {
if ($index > 0) {
echo '<div class="item"> | </div>';
}
$pluginLink = $whiteboardPlugin[4];
echo '<div class="item"><a href="' . $pluginLink . '">' . plugin_lang_get('menu_title', $plugin) . '</a></div>';
}
}
echo '</div>';
}
示例10: print_test_warn_row
if (print_test_row('check mssql textsize in php.ini...', ini_get('mssql.textlimit') != 4096, ini_get('mssql.textlimit'))) {
print_test_warn_row('check mssql textsize in php.ini...', ini_get('mssql.textsize') == 2147483647, ini_get('mssql.textsize'));
}
}
print_test_row('check variables_order includes GPCS', stristr(ini_get('variables_order'), 'G') && stristr(ini_get('variables_order'), 'P') && stristr(ini_get('variables_order'), 'C') && stristr(ini_get('variables_order'), 'S'), ini_get('variables_order'));
test_bug_download_threshold();
test_bug_attachments_allow_flags();
print_test_row('check mail configuration: send_reset_password = ON requires allow_blank_email = OFF', OFF == config_get_global('send_reset_password') || OFF == config_get_global('allow_blank_email'));
print_test_row('check mail configuration: send_reset_password = ON requires enable_email_notification = ON', OFF == config_get_global('send_reset_password') || ON == config_get_global('enable_email_notification'));
print_test_row('check mail configuration: allow_signup = ON requires enable_email_notification = ON', OFF == config_get_global('allow_signup') || ON == config_get_global('enable_email_notification'));
print_test_row('check mail configuration: allow_signup = ON requires send_reset_password = ON', OFF == config_get_global('allow_signup') || ON == config_get_global('send_reset_password'));
print_test_row('check language configuration: fallback_language is not \'auto\'', 'auto' != config_get_global('fallback_language'));
print_test_row('check configuration: allow_anonymous_login = ON requires anonymous_account to be set', OFF == config_get_global('allow_anonymous_login') || strlen(config_get_global('anonymous_account')) > 0);
$t_anon_user = false;
print_test_row('check configuration: anonymous_account is a valid username if set', strlen(config_get_global('anonymous_account')) > 0 ? ($t_anon_user = user_get_id_by_name(config_get_global('anonymous_account'))) !== false : TRUE);
print_test_row('check configuration: anonymous_account should not be an administrator', $t_anon_user ? !user_is_administrator($t_anon_user) : TRUE);
print_test_row('$g_bug_link_tag is not empty ("' . config_get_global('bug_link_tag') . '")', '' != config_get_global('bug_link_tag'));
print_test_row('$g_bugnote_link_tag is not empty ("' . config_get_global('bugnote_link_tag') . '")', '' != config_get_global('bugnote_link_tag'));
print_test_row('filters: dhtml_filters = ON requires use_javascript = ON', OFF == config_get_global('dhtml_filters') || ON == config_get_global('use_javascript'));
print_test_row('Phpmailer sendmail configuration requires escapeshellcmd. Please use a different phpmailer method if this is blocked.', PHPMAILER_METHOD_SENDMAIL != config_get('phpMailer_method') || PHPMAILER_METHOD_SENDMAIL == config_get('phpMailer_method') && function_exists('escapeshellcmd'));
print_test_row('Phpmailer sendmail configuration requires escapeshellarg. Please use a different phpmailer method if this is blocked.', PHPMAILER_METHOD_SENDMAIL != config_get('phpMailer_method') || PHPMAILER_METHOD_SENDMAIL == config_get('phpMailer_method') && function_exists('escapeshellarg'));
check_zend_optimiser_version();
if (plugin_is_installed('MantisGraph')) {
plugin_push_current('MantisGraph');
print_test_row('checking gd is enabled, and version 2...', get_gd_version() == 2);
if (plugin_config_get('eczlibrary', ON) == OFF) {
$t_jpgraph_path = config_get('absolute_path') . 'library' . DIRECTORY_SEPARATOR . 'jpgraph' . DIRECTORY_SEPARATOR;
if (!file_exists($t_jpgraph_path . 'jpgraph.php')) {
print_test_row('checking we can find jpgraph class files...', false);
} else {
require_once $t_jpgraph_path . 'jpgraph.php';
示例11: filter_db_can_delete_filter
/**
* Check if the current user has permissions to delete the stored query
* @param integer $p_filter_id Filter id.
* @return boolean
*/
function filter_db_can_delete_filter($p_filter_id)
{
$c_filter_id = (int) $p_filter_id;
$t_user_id = auth_get_current_user_id();
# Administrators can delete any filter
if (user_is_administrator($t_user_id)) {
return true;
}
$t_query = 'SELECT id
FROM {filters}
WHERE id=' . db_param() . '
AND user_id=' . db_param() . '
AND project_id!=' . db_param();
$t_result = db_query($t_query, array($c_filter_id, $t_user_id, -1));
if (db_result($t_result) > 0) {
return true;
}
return false;
}
示例12: db_prepare_string
$c_username = db_prepare_string($f_username);
$c_realname = db_prepare_string($f_realname);
$c_protected = db_prepare_bool($f_protected);
$c_enabled = db_prepare_bool($f_enabled);
$c_user_id = db_prepare_int($f_user_id);
$c_access_level = db_prepare_int($f_access_level);
$t_user_table = config_get('mantis_user_table');
$t_old_protected = user_get_field($f_user_id, 'protected');
# check that we are not downgrading the last administrator
$t_old_access = user_get_field($f_user_id, 'access_level');
if (ADMINISTRATOR == $t_old_access && $t_old_access != $f_access_level && 1 >= user_count_level(ADMINISTRATOR)) {
trigger_error(ERROR_USER_CHANGE_LAST_ADMIN, ERROR);
}
# Project specific access rights override global levels, hence, for users who are changed
# to be administrators, we have to remove project specific rights.
if ($c_access_level >= ADMINISTRATOR && !user_is_administrator($c_user_id)) {
user_delete_project_specific_access_levels($c_user_id);
}
# if the user is already protected and the admin is not removing the
# protected flag then don't update the access level and enabled flag.
# If the user was unprotected or the protected flag is being turned off
# then proceed with a full update.
if ($f_protected && $t_old_protected) {
$query = "UPDATE {$t_user_table}\n\t \t\tSET username='{$c_username}', email='{$c_email}',\n\t \t\t\tprotected='{$c_protected}', realname='{$c_realname}'\n\t \t\tWHERE id='{$c_user_id}'";
} else {
$query = "UPDATE {$t_user_table}\n\t \t\tSET username='{$c_username}', email='{$c_email}',\n\t \t\t\taccess_level='{$c_access_level}', enabled='{$c_enabled}',\n\t \t\t\tprotected='{$c_protected}', realname='{$c_realname}'\n\t \t\tWHERE id='{$c_user_id}'";
}
$result = db_query($query);
$t_redirect_url = 'manage_user_page.php';
html_page_top1();
if ($result) {
示例13: current_user_is_administrator
/**
* Returns true if the currently logged in user is has a role of administrator
* or higher, false otherwise
*
* @return true: administrator; false: otherwise.
* @access public
*/
function current_user_is_administrator()
{
return user_is_administrator(auth_get_current_user_id());
}
示例14: is_admin_user
function is_admin_user($p_user_id)
{
return user_is_administrator($p_user_id);
}
示例15: output_build_reader_toolbar_mobile
function output_build_reader_toolbar_mobile($content)
{
if ($_SERVER['URL_ARRAY'][3] == 'bio') {
$is_bio = TRUE;
} elseif ($_SERVER['URL_ARRAY'][1] == 'send') {
$is_send = TRUE;
} elseif (in_array('archives', $_SERVER['URL_ARRAY'])) {
$is_archives = TRUE;
} else {
$is_plan = TRUE;
}
$planwatchlist = file_get_contents("{$_SERVER['USER_ROOT']}/watchedlist.txt");
if ($is_send) {
$_SERVER['PLANOWNER'] = $_SERVER['URL_ARRAY'][2];
plan_get_owner_info($_SERVER['PLANOWNER']);
}
if (user_is_valid($_SERVER['USERINFO_ARRAY']['username'], $_SERVER['USERINFO_ARRAY']['userpass']) && $_SERVER['PLANOWNER'] && !strstr($content, '<h1>Plan Read Failed</h1>')) {
profile('reader_toolbar', 'begin');
if ($is_plan || $is_bio || $is_archives || $is_send && $_SERVER['URL_ARRAY'][2]) {
// bio
if ((file_exists("{$_SERVER['PWUSERS_DIR']}/{$_SERVER['PLANOWNER']}/bio.txt") || (strpos($_SERVER['PLANOWNER_REAL_LOCATION'], 'diaryland') || strpos($_SERVER['PLANOWNER_REAL_LOCATION'], 'livejournal'))) && !$is_bio) {
$readertoolbar[] = "<a href='{$_SERVER['WEB_ROOT']}/read/{$_SERVER['PLANOWNER_REAL_LOCATION']}/bio'>bio</a>";
}
// send
if ((strpos($_SERVER['PLANOWNER_REAL_LOCATION'], 'planworld.net') || strpos($_SERVER['PLANOWNER_REAL_LOCATION'], 'amherst.edu') || plan_is_local($_SERVER['PLANOWNER'])) && $_SERVER['PLANOWNER'] != $_SERVER['USER'] && !$is_send) {
$send_files = files_list("{$_SERVER['USER_ROOT']}/sends", files_encode_safe_name("{$_SERVER['PLANOWNER']}") . "*");
if (is_array($send_files)) {
$lastsend = formattime(filemtime("{$_SERVER['USER_ROOT']}/sends/" . end($send_files)));
if (strstr(end($send_files), '.new')) {
$lastsend .= " <b>NEW</b>";
}
$lastsend = "({$lastsend})";
}
$readertoolbar[] = "<a href='{$_SERVER['WEB_ROOT']}/send/{$_SERVER['PLANOWNER_REAL_LOCATION']}/'>send</a>";
}
// planread
if ($is_send || $is_bio) {
$readertoolbar[] = "<a href='{$_SERVER['WEB_ROOT']}/read/{$_SERVER['PLANOWNER_REAL_LOCATION']}/'>plan</a>";
}
// archives
if (plan_has_archives($_SERVER['PLANOWNER_REAL_LOCATION'])) {
if (!$is_archives) {
$readertoolbar[] = "<a href='{$_SERVER['WEB_ROOT']}/read/{$_SERVER['PLANOWNER']}/archives' >archives</a>";
} else {
$readertoolbar[] = "<a href='{$_SERVER['WEB_ROOT']}/read/{$_SERVER['PLANOWNER']}' >plan</a>";
}
}
// If the reader isn't watching the writer, offer the option
if (!stristr($planwatchlist, $_SERVER['PLANOWNER']) && $is_plan) {
$readertoolbar[] = "<span id='watch_link'><a href=\"javascript:loadXMLDoc('{$_SERVER['WEB_ROOT']}/lists/add_ajax/watched/!{$_SERVER['PLANOWNER_REAL_LOCATION']}:{$_SERVER['PLANOWNER_DISPLAY_NAME']}!',null,'planwatch');void(null);\" title='add {$_SERVER['PLANOWNER_DISPLAY_NAME']} to your watched list' >watch</a></span>";
}
// if writer isn't a blog or the same as reader, offer the option of
// blocking, unblocking, allowing, or disallowing access to reader's plan
if ($_SERVER['PLANOWNER'] != $_SERVER['USER'] && !strpos($_SERVER['PLANOWNER'], '://')) {
// offer administrators a link to masquerade as writer
// this is so it's easy to follow up on plan-reported bugs
if (user_is_administrator() && file_exists("{$_SERVER['PWUSERS_DIR']}/{$_SERVER['PLANOWNER']}/userinfo.dat")) {
$readertoolbar[] = "<a href='{$_SERVER['WEB_ROOT']}/masq/on/{$_SERVER['PLANOWNER']}'>masq</a>";
}
if ($is_plan) {
$readertoolbar[] = "<a href='/lists/unread/{$_SERVER['PLANOWNER']}'>unread</a>";
}
if ($is_send) {
$readertoolbar[] = "<a href='/send/{$_SERVER['PLANOWNER']}/unread'>unread</a>";
}
}
// make the links into a string for output.
$readertoolbar = "<li class='toolbutton'>" . implode("</li><li class='toolbutton'>", $readertoolbar) . "</li>\n";
$readertoolbar = str_replace("<li class='toolbutton'></li>", "", $readertoolbar);
if (($lasttime = plan_get_last_update($_SERVER['PLANOWNER'])) && $is_plan) {
$readertoolbar = "<li class='plan_data_block'>Last Update: " . formattime($lasttime) . "</li>" . $readertoolbar;
}
if ($lastlogin = plan_get_last_login($_SERVER['PLANOWNER'])) {
if ($lastlogin > 1) {
$readertoolbar = "<li class='plan_data_block' id='lastaction'>Last Action: " . formattime($lastlogin) . "</li>" . $readertoolbar;
}
}
}
profile('reader_toolbar', 'end');
}
return $readertoolbar;
}