Esempio n. 1
0
function link_page_action($p_page, $p_action, $p_url, $p_link_active = true, $p_caption = null)
{
    if (null === $p_caption) {
        $t_caption = lang_get('action_' . $p_action);
        $t_before = '[ ';
        $t_after = ' ]';
    } else {
        $t_caption = $p_caption;
        $t_before = $t_after = '';
    }
    $c_page_id = urlencode($p_page);
    $c_action = urlencode($p_action);
    $c_url = urlencode($p_url);
    $t_action = config_get('web_directory') . 'action.php';
    $t_link = "{$t_action}?f_action={$c_action}&f_page_id={$c_page_id}&f_url={$c_url}";
    return link_create($t_link, $t_caption, $p_link_active, $t_before, $t_after);
}
Esempio n. 2
0
 public function link_create($str = '')
 {
     if ($str) {
         return link_create($str);
     }
     return false;
 }
login_cookie_check();
access_ensure_check_action(ACTION_USERS_MANAGE);
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_users_array = user_get_all();
echo '<table class="box" summary="">';
echo '<thead><tr><th>Username</th><th>Email</th><th>Access Level</th><th>Enabled</th><th>Protected</th></tr></thead><tbody>';
$i = 0;
foreach ($t_users_array as $user) {
    extract($user, EXTR_PREFIX_ALL, 'v');
    $v_enabled = $v_enabled ? 'x' : '&nbsp;';
    $v_protected = $v_protected ? 'x' : '&nbsp;';
    $t_class = util_alternate_class($i++);
    $t_access_level = enum_get_element('access_levels', $v_access_level);
    echo "<tr class=\"{$t_class}\"><td><a href=\"{$g_admin_manage_users_edit}?f_user_id={$v_id}\">{$v_username}</a></td><td>{$v_email}</td><td>{$t_access_level}</td><td>{$v_enabled}</td><td>{$v_protected}</td></tr>";
}
echo '</tbody></table>';
echo '<div class="spacer"></div>';
echo link_create($g_admin_manage_users_add_page, 'Add User');
# @@@ LOCALIZE
print_footer(__FILE__);
print_bottom_page($g_bottom_page_inc);
print_body_bottom();
print_html_bottom();
function theme_body($p_page_data)
{
    if (false === $p_page_data) {
        # @@@ Handle not indexed (and auto index off)
        return;
    }
    global $g_note_add_page, $s_add_note_link, $s_manage, $s_admin, $g_web_directory, $g_theme;
    $t_notes = $p_page_data['notes'];
    $t_page = $p_page_data['page'];
    $t_page_id = $p_page_data['id'];
    $t_images_base = $g_web_directory . 'themes/' . $g_theme . '/images/';
    $add_picture = $t_images_base . 'notes_add.gif';
    $help_picture = $t_images_base . 'notes_about.gif';
    $prev_picture = $t_images_base . 'caret_left.gif';
    $next_picture = $t_images_base . 'caret_right.gif';
    if (false === $p_page_data['preview']) {
        $t_link_start = "<a href=\"{$g_note_add_page}?f_page_id={$t_page_id}\">";
        $t_link_end = '</a>';
    } else {
        $t_link_start = $t_link_end = '';
    }
    #
    # HEADER
    #
    echo <<<EOT
\t\t<div class="phpnet">
\t\t<table summary="" cellpadding="4" cellspacing="0">
\t\t\t<tr class="dark">
\t\t\t\t<td><small>User Contributed Notes</small><br /><strong>{$t_page}</strong></td>
\t\t\t\t<td align="right">
\t\t\t\t\t{$t_link_start}<img src="{$add_picture}" width="13" height="13" alt="Add Notes" />{$t_link_end}
\t\t\t\t\t<img src="{$help_picture}" width="13" height="13" alt="About Notes" />
\t\t\t\t</td>
\t\t\t</tr>
EOT;
    #
    # NOTES
    #
    if (0 === count($t_notes)) {
        echo <<<EOT
\t\t\t<tr class="light">
\t\t\t\t<td colspan="2">There are no user contributed notes for this page.</td>
\t\t\t</tr>
EOT;
    } else {
        for ($i = 0; $i < count($t_notes); $i++) {
            $t_moderation = '';
            $t_note_info = $t_notes[$i];
            if (false === $p_page_data['preview']) {
                if (access_check_action(ACTION_NOTES_MODERATE)) {
                    $t_url = $p_page_data['url'];
                    $t_moderation = '';
                    if ($t_note_info['visible'] != NOTE_VISIBLE_ACCEPTED) {
                        $t_moderation .= link_note_action($t_note_info['id'], 'accept', $t_url, access_check_action(ACTION_NOTES_MODERATE_ACCEPT)) . ' ';
                    }
                    if ($t_note_info['visible'] != NOTE_VISIBLE_PENDING) {
                        $t_moderation .= link_note_action($t_note_info['id'], 'queue', $t_url, access_check_action(ACTION_NOTES_MODERATE_QUEUE)) . ' ';
                    }
                    if ($t_note_info['visible'] != NOTE_VISIBLE_DECLINED) {
                        $t_moderation .= link_note_action($t_note_info['id'], 'decline', $t_url, access_check_action(ACTION_NOTES_MODERATE_DECLINE)) . ' ';
                    }
                    if ($t_note_info['visible'] != NOTE_VISIBLE_ARCHIVED) {
                        $t_moderation .= link_note_action($t_note_info['id'], 'archive', $t_url, access_check_action(ACTION_NOTES_MODERATE_ARCHIVE)) . ' ';
                    }
                    $t_moderation .= link_note_action($t_note_info['id'], 'edit', $t_url, access_check_action(ACTION_NOTES_EDIT));
                    if ($t_note_info['visible'] != NOTE_VISIBLE_DELETED) {
                        $t_moderation .= link_note_action($t_note_info['id'], 'delete', $t_url, access_check_action(ACTION_NOTES_MODERATE_DELETE));
                    }
                }
            }
            if (isset($t_note_info['id']) && $t_note_info['id'] != 0) {
                $t_id = (int) $t_note_info['id'];
                $t_visibility = '';
                if (NOTE_VISIBLE_ACCEPTED != $t_note_info['visible']) {
                    $t_visibility = '(' . note_get_visibility_str($t_note_info['visible']) . ') - ';
                }
                $t_id_view = "<tt>{$t_visibility}#{$t_id}<br />{$t_moderation}</tt>";
                $t_id_bookmark = "<a name=\"{$t_id}\"></a>";
            } else {
                $t_id_view = '&nbsp;';
                $t_id_bookmark = '';
            }
            if (isset($t_note_info['email'])) {
                $t_email = $t_note_info['email'];
            } else {
                $t_email = '';
            }
            if (isset($t_note_info['date'])) {
                # 06-Feb-2002 02:28
                $t_date = date('d-M-Y G:i', $t_note_info['date']);
            } else {
                $t_date = '';
            }
            if (isset($t_note_info['note'])) {
                $t_note = nl2br('<tt>' . $t_note_info['note'] . '</tt>');
            } else {
                $t_note = '&nbsp;';
            }
            echo <<<EOT
\t\t\t\t<tr class="light">
\t\t\t\t\t<td colspan="2">
\t\t\t\t\t\t{$t_id_bookmark}

\t\t\t\t\t\t<table summary="" cellpadding="2" cellspacing="0">
\t\t\t\t\t\t\t<tr class="light">
\t\t\t\t\t\t\t\t<td><strong>{$t_email}</strong><br />{$t_date}</td>
\t\t\t\t\t\t\t\t<td align="right">{$t_id_view}</td>
\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t\t<tr class="lighter">
\t\t\t\t\t\t\t\t<td colspan="2">{$t_note}</td>
\t\t\t\t\t\t\t</tr>
\t\t\t\t\t\t</table>
\t\t\t\t\t</td>
\t\t\t\t</tr>
EOT;
        }
    }
    #
    # FOOTER
    #
    if (empty($p_page_data['prev_page'])) {
        $t_prev_text = '';
    } else {
        $t_prev_text = "<img src=\"{$prev_picture}\" width=\"11\" height=\"7\" alt=\"" . $p_page_data['prev_page'] . "\" />" . link_create($p_page_data['prev_url'], $p_page_data['prev_page'], true, '', '');
    }
    if (empty($p_page_data['next_page'])) {
        $t_next_text = '';
    } else {
        $t_next_text = link_create($p_page_data['next_url'], $p_page_data['next_page'], true, '', '') . "<img src=\"{$next_picture}\" width=\"11\" height=\"7\" alt=\"" . $p_page_data['next_page'] . "\" />";
    }
    if (empty($t_prev_text) && empty($t_next_text)) {
        $t_navigation_row = '';
    } else {
        $t_navigation_row = "<tr><td>{$t_prev_text}</td><td align=\"right\">{$t_next_text}</td></tr>";
    }
    if (false === $p_page_data['preview']) {
        $t_link_start = "<a href=\"{$g_note_add_page}?f_page_id={$t_page_id}\">";
        $t_link_end = '</a>';
    } else {
        $t_link_start = $t_link_end = '';
    }
    if (0 !== count($t_notes)) {
        echo <<<EOT
\t\t\t<tr class="dark">
\t\t\t\t<td colspan="2" align="right">
\t\t\t\t{$t_link_start}<img src="{$add_picture}" width="13" height="13" alt="Add Notes" />{$t_link_end}
\t\t\t\t<img src="{$help_picture}" width="13" height="13" alt="About Notes" />
\t\t\t\t</td>
\t\t\t</tr>
EOT;
    }
    if (false === $p_page_data['preview']) {
        # Tue, 17 Sep 2002
        $t_last_updated = date('D, d M Y - G:i:s', $p_page_data['last_updated']);
        echo <<<EOT
\t\t\t<tr class="dark"><td colspan="2">
\t\t\t\t<table class="light" cellpadding="0" cellspacing="4">
\t\t\t\t\t{$t_navigation_row}
\t\t\t\t\t<tr><td align="right" colspan="2"><small>Last updated: {$t_last_updated}</small></td></tr>
\t\t\t\t</table>
\t\t\t</td></tr>
EOT;
    }
    echo '</table></div>';
    if (false === $p_page_data['preview'] && access_is_logged_in()) {
        echo '<div class="pwn">';
        print_admin_menu();
        echo '</div>';
    }
}