コード例 #1
0
<?php

# phpWebNotes - a php based note addition system
# Copyright (C) 2000-2002 Webnotes Team - webnotes-devel@sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the files README and LICENSE for details
# --------------------------------------------------------
# $Id: user_home_page.php,v 1.1 2002/09/18 12:33:31 vboctor Exp $
# --------------------------------------------------------
require_once 'core' . DIRECTORY_SEPARATOR . 'api.php';
login_cookie_check();
access_ensure_check_action(ACTION_USERS_EDIT_OWN);
$row = user_get_info(user_where_current());
extract($row, EXTR_PREFIX_ALL, "v");
print_html_top();
print_head_top();
print_title($g_window_title);
print_css($g_css_inc_file);
print_head_bottom();
print_body_top();
print_header($g_page_title);
print_top_page($g_top_page_inc);
print_admin_menu();
$t_access_level = enum_get_element('access_levels', $v_access_level);
echo "<p>Logged in as {$v_username} ({$t_access_level})</p>";
print_bottom_page($g_bottom_page_inc);
print_footer(__FILE__);
print_body_bottom();
print_html_bottom();
コード例 #2
0
function print_admin_menu($p_add_space = true)
{
    global $g_logout, $g_admin_index_files, $g_admin_change_password, $g_admin_manage_notes, $g_admin_manage_users, $s_logout_link, $s_index_files, $s_change_password, $s_manage_notes, $s_manage_users, $g_user_home_page;
    $queue_count = note_queue_count();
    echo '<div class="menu">.: ';
    echo "<a title=\"Go to your home page\" href=\"{$g_user_home_page}\">Home</a> :: ";
    #if ( access_check_action( ACTION_PAGES_MANAGE ) ) {
    #	echo "<a title=\"Add or remove pages\" href=\"$g_admin_index_files\">$s_index_files</a> :: ";
    #}
    if (access_check_action(ACTION_NOTES_MODERATE)) {
        echo "<a title=\"Moderate notes\" href=\"{$g_admin_manage_notes}\">{$s_manage_notes}</a> [{$queue_count}] :: ";
    }
    if (access_check_action(ACTION_USERS_MANAGE)) {
        echo "<a title=\"View/edit user information\" href=\"{$g_admin_manage_users}\">{$s_manage_users}</a> :: ";
    }
    $row = user_get_info(user_where_current());
    extract($row, EXTR_PREFIX_ALL, 'v');
    if (1 == $v_protected) {
        $t_action = ACTION_USERS_EDIT_OWN_PROTECTED;
    } else {
        $t_action = ACTION_USERS_EDIT_OWN;
    }
    if (access_check_action($t_action)) {
        echo "<a title=\"Change your own password\" href=\"{$g_admin_change_password}\">{$s_change_password}</a> :: ";
    }
    echo <<<EOT
\t\t<a title="Logout from phpWebNotes" href="{$g_logout}">{$s_logout_link}</a> :.
\t\t</div>
EOT;
}
コード例 #3
0
require_once 'core' . DIRECTORY_SEPARATOR . 'api.php';
access_ensure_check_action(ACTION_NOTES_SUBMIT);
print_html_top();
print_head_top();
print_title($g_window_title);
print_css($g_css_inc_file);
print_head_bottom();
print_body_top();
print_header($g_page_title);
print_top_page($g_top_page_inc);
$f_note_id = gpc_get_int('f_note_id', 0);
if (0 == $f_note_id) {
    $f_page_id = gpc_get_int('f_page_id');
    $t_default_email = '';
    if (ON == config_get('auto_set_email') && access_is_logged_in()) {
        $t_user_info = user_get_info(user_where_current());
        if (false !== $t_user_info) {
            $t_default_email = $t_user_info['email'];
        }
    }
    $t_default_body = '';
    $t_note_id = 0;
} else {
    $t_note_info = note_get_info(note_where_id_equals($f_note_id));
    if (false === $t_note_info) {
        # @@@@ proper error
        echo "no note with the specified id";
        exit;
    }
    $t_default_email = $t_note_info['email'];
    $t_default_body = $t_note_info['note'];
コード例 #4
0
function access_check_action($p_action)
{
    global $g_string_cookie_val, $g_access_levels, $g_access_sets;
    if (!isset($g_access_levels[$p_action])) {
        return false;
    }
    if (empty($g_string_cookie_val)) {
        $t_access_level = ANONYMOUS;
    } else {
        $t_user = user_get_info(user_where_current());
        if (false === $t_user) {
            return false;
        }
        $t_access_level = $t_user['access_level'];
    }
    if (NOBODY !== $g_access_levels[$p_action]) {
        return $t_access_level >= $g_access_levels[$p_action];
    }
    if (!isset($g_access_sets[$p_action])) {
        return false;
    }
    return in_array($t_access_level, $g_access_sets[$p_action]);
}
コード例 #5
0
# --------------------------------------------------------
require_once 'core' . DIRECTORY_SEPARATOR . 'api.php';
login_cookie_check();
$row = user_get_info(user_where_current());
extract($row, EXTR_PREFIX_ALL, 'v');
if (1 == $v_protected) {
    $t_action = ACTION_USERS_EDIT_OWN_PROTECTED;
} else {
    $t_action = ACTION_USERS_EDIT_OWN;
}
access_ensure_check_action($t_action);
if (isset($f_action) && $f_action == 'change') {
    $f_current_password = gpc_get_string('f_current_password');
    $f_password = gpc_get_string('f_password');
    $f_password2 = gpc_get_string('f_password');
    if (false !== user_change_password(user_where_current(), $f_current_password, $f_password, $f_password2)) {
        echo <<<EOT
\t\t\t<div align="center">
\t\t\t\t<p>Password changed successfully</p>
\t\t\t</div>
EOT;
    }
}
print_html_top();
print_head_top();
print_title($g_window_title);
print_css($g_css_inc_file);
print_head_bottom();
print_body_top();
print_header($g_page_title);
print_top_page($g_top_page_inc);