Exemplo n.º 1
0
function author_list()
{
    global $txp_user;
    echo n . n . hed(gTxt('authors'), 3, ' style="text-align: center;"') . n . n . startTable('list') . n . tr(n . hCell(gTxt('real_name')) . n . hCell(gTxt('login_name')) . n . hCell(gTxt('email')) . n . hCell(gTxt('privileges')) . n . hCell() . n . hCell());
    $rs = safe_rows_start('*', 'txp_users', '1 = 1 order by name asc');
    if ($rs) {
        if (has_privs('admin.edit')) {
            while ($a = nextRow($rs)) {
                extract($a);
                echo n . n . '<tr>' . n . '<form method="post" action="index.php">' . n . td(fInput('text', 'RealName', $RealName, 'edit')) . td(htmlspecialchars($name)) . td(fInput('text', 'email', $email, 'edit'));
                if ($name != $txp_user) {
                    echo td(privs($privs) . sp . popHelp('about_privileges'));
                } else {
                    echo td(get_priv_level($privs) . sp . popHelp('about_privileges') . hInput('privs', $privs));
                }
                echo td(fInput('submit', 'save', gTxt('save'), 'smallerbox')) . n . hInput('user_id', $user_id) . n . eInput('admin') . n . sInput('author_save') . n . '</form>';
                if ($name != $txp_user) {
                    echo td(dLink('admin', 'author_delete', 'user_id', $user_id));
                } else {
                    echo td();
                }
                echo n . '</tr>';
            }
        } else {
            while ($a = nextRow($rs)) {
                extract(doSpecial($a));
                echo tr(td($RealName) . td($name) . td('<a href="mailto:' . $email . '">' . $email . '</a>') . td(get_priv_level($privs) . sp . popHelp('about_privileges') . hInput('privs', $privs)) . td() . td());
            }
        }
        echo n . endTable();
    }
}
Exemplo n.º 2
0
/**
 * User editor panel.
 *
 * Accessing requires 'admin.edit' privileges.
 */
function author_edit()
{
    global $step, $txp_user;
    require_privs('admin.edit');
    pagetop(gTxt('tab_site_admin'), '');
    $vars = array('user_id', 'name', 'RealName', 'email', 'privs');
    $rs = array();
    $out = array();
    extract(gpsa($vars));
    $is_edit = $user_id && $step == 'author_edit';
    if ($is_edit) {
        $user_id = assert_int($user_id);
        $rs = safe_row('*', 'txp_users', "user_id = {$user_id}");
        extract($rs);
    }
    if ($is_edit) {
        $out[] = hed(gTxt('edit_author'), 2);
    } else {
        $out[] = hed(gTxt('add_new_author'), 2);
    }
    if ($is_edit) {
        $out[] = inputLabel('login_name', strong(txpspecialchars($name)));
    } else {
        $out[] = inputLabel('login_name', fInput('text', 'name', $name, '', '', '', INPUT_REGULAR, '', 'login_name'), 'login_name', 'add_new_author');
    }
    $out[] = inputLabel('real_name', fInput('text', 'RealName', $RealName, '', '', '', INPUT_REGULAR, '', 'real_name'), 'real_name') . inputLabel('login_email', fInput('email', 'email', $email, '', '', '', INPUT_REGULAR, '', 'login_email'), 'email');
    if ($txp_user != $name) {
        $out[] = inputLabel('privileges', privs($privs), 'privileges', 'about_privileges');
    } else {
        $out[] = inputLabel('privileges', strong(get_priv_level($privs))) . hInput('privs', $privs);
    }
    $out[] = pluggable_ui('author_ui', 'extend_detail_form', '', $rs) . graf(fInput('submit', '', gTxt('save'), 'publish')) . eInput('admin');
    if ($user_id) {
        $out[] = hInput('user_id', $user_id) . hInput('name', $name) . sInput('author_save');
    } else {
        $out[] = sInput('author_save_new');
    }
    echo form(n . tag(join('', $out) . n, 'section', array('class' => 'txp-edit')), '', '', 'post', 'edit-form', '', 'user_edit');
}
Exemplo n.º 3
0
function author_list()
{
    global $myprivs, $txp_user;
    $out[] = hed(gTxt('authors'), 3, ' align="center"');
    $out[] = startTable('list');
    $out[] = tr(hCell(gTxt('real_name')) . hCell(gTxt('login_name')) . hCell(ucfirst(gTxt('email'))) . hCell(gTxt('privileges')) . td() . td());
    $rs = safe_rows_start("*", "txp_users", "1");
    if ($rs) {
        while ($a = nextRow($rs)) {
            extract($a);
            if ($name == $txp_user) {
                $deletelink = '';
            } else {
                $deletelink = dLink('admin', 'author_delete', 'user_id', $user_id);
            }
            $savelink = fInput("submit", 'save', gTxt('save'), 'smallerbox');
            $emailhref = '<a href="mailto:' . $email . '">' . $email . '</a>';
            $RealNameInput = fInput('text', 'RealName', $RealName, 'edit');
            $emailInput = fInput('text', 'email', $email, 'edit');
            $row[] = '<form action="index.php" method="post">';
            $row[] = $myprivs == 1 ? td($RealNameInput) : td($RealName);
            $row[] = td($name);
            $row[] = $myprivs == 1 ? td($emailInput) : td($emailhref);
            $row[] = $myprivs == 1 ? td(privs($privs) . popHelp("about_privileges")) : td(get_priv_level($privs) . popHelp("about_privileges"));
            $row[] = $myprivs == 1 ? td($savelink) : '';
            $row[] = $myprivs == 1 ? hInput("user_id", $user_id) . eInput("admin") . sInput('author_save') : td();
            $row[] = '</form>';
            $row[] = $myprivs == 1 ? td($deletelink, 10) : td();
            $out[] = tr(join('', $row));
            unset($row);
        }
        $out[] = endTable();
        return join('', $out);
    }
}
Exemplo n.º 4
0
function author_form()
{
    global $step, $txp_user;
    $vars = array('user_id', 'name', 'RealName', 'email', 'privs');
    extract(gpsa($vars));
    if ($user_id && $step == 'author_edit') {
        $user_id = assert_int($user_id);
        extract(safe_row('*', 'txp_users', "user_id = {$user_id}"));
    }
    if ($step == 'author_save' or $step == 'author_save_new') {
        foreach ($vars as $var) {
            ${$var} = '';
        }
    }
    $caption = gTxt($step == 'author_edit' ? 'edit_author' : 'add_new_author');
    return form(hed($caption, 3, ' style="text-align: center;"') . startTable('edit') . tr(fLabelCell('login_name') . ($user_id && $step == 'author_edit' ? td(strong($name)) : fInputCell('name', $name))) . tr(fLabelCell('real_name') . fInputCell('RealName', $RealName)) . tr(fLabelCell('email') . fInputCell('email', $email)) . tr(fLabelCell('privileges') . td(($txp_user != $name ? privs($privs) : hInput('privs', $privs) . strong(get_priv_level($privs))) . sp . popHelp('about_privileges'))) . tr(td() . td(fInput('submit', '', gTxt('save'), 'publish') . ($user_id ? '' : sp . popHelp('add_new_author')))) . endTable() . eInput('admin') . ($user_id ? hInput('user_id', $user_id) . sInput('author_save') : sInput('author_save_new')));
}
Exemplo n.º 5
0
function author_edit()
{
    global $step, $txp_user;
    require_privs('admin.edit');
    pagetop(gTxt('tab_site_admin'), '');
    $vars = array('user_id', 'name', 'RealName', 'email', 'privs');
    $rs = array();
    extract(gpsa($vars));
    $is_edit = $user_id && $step == 'author_edit';
    if ($is_edit) {
        $user_id = assert_int($user_id);
        $rs = safe_row('*', 'txp_users', "user_id = {$user_id}");
        extract($rs);
    }
    $caption = gTxt($is_edit ? 'edit_author' : 'add_new_author');
    echo form('<div class="txp-edit">' . n . hed($caption, 2) . n . inputLabel('login_name', $is_edit ? strong($name) : fInput('text', 'name', $name, '', '', '', INPUT_REGULAR, '', 'login_name'), $is_edit ? '' : 'login_name', $is_edit ? '' : 'add_new_author') . n . inputLabel('real_name', fInput('text', 'RealName', $RealName, '', '', '', INPUT_REGULAR, '', 'real_name'), 'real_name') . n . inputLabel('login_email', fInput('text', 'email', $email, '', '', '', INPUT_REGULAR, '', 'login_email'), 'email') . n . inputLabel('privileges', $txp_user != $name ? privs($privs) : hInput('privs', $privs) . strong(get_priv_level($privs)), $is_edit ? '' : 'privileges', 'about_privileges') . n . pluggable_ui('author_ui', 'extend_detail_form', '', $rs) . n . graf(fInput('submit', '', gTxt('save'), 'publish')) . eInput('admin') . ($user_id ? hInput('user_id', $user_id) . sInput('author_save') : sInput('author_save_new')) . '</div>', '', '', 'post', 'edit-form', '', 'user_edit');
}