Subversion Repositories travelsized

Rev

Rev 244 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?PHP
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * This file is part of Travelsized CMS
 *              A content management system with modules, based on wiki syntax
 *
 * Author: Dan Jensen <admin@leinir.dk>
 * Copyright 2003/2004
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * The GNU General Public License is available at: http://www.gnu.org/copyleft/
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */


        $page_author = $creator_name;
        $page_author_email = $creator_email;
        $page_menu = 1;
        $page_date = formatTime( time() );

if( !auth($_REQUEST["username"], $_REQUEST["password"]) )
        $page_content = loginform($language, globalIDtoURL("setup/users"), $auth_messages);
else if( !isAllowed("global_user_edit") )
        $page_content = "<p>" . i18n("You do not have the correct permissions to change other user's information") . "</p>";
else
{

        $setupPage = new setupPage;
        $setupPage->addBreadcrumb( i18n("Users"), globalIDtoURL("setup/users") );
        if( $_REQUEST["action"] != "" )
                $setupPage->addBreadcrumb( i18n($_REQUEST["action"]), globalIDtoURL("setup/users/" . $_REQUEST["action"]) );
        if($_REQUEST["subaction"] != "")
                $setupPage->addBreadcrumb( i18n($_REQUEST["subaction"]), thisPageURL( false, true, array("subaction" => $_REQUEST["subaction"]) ) );
        $setupPage->addCommand( i18n("Profile options"), i18n("Options pertaining to all profiles, and to viewing profiles"), globalIDtoURL("setup/users/profile_options") );
        $setupPage->addCommand( i18n("Set permission defaults"), i18n("Manage what permissions are used for an anonymous user, and for all users who have not had permissions set specifically"), globalIDtoURL("setup/users/default_permissions") );
        $setupPage->addCommand( i18n("New") , i18n("Create a new user"), globalIDtoURL("user/" . i18n("username") . "/new") );
       
        if( $_REQUEST["action"] == "profile_options" )
        {
                global $setup_folder, $language;
               
                if ($_REQUEST["profiles_view"] != "") $profile_options["profiles_view"] = $_REQUEST["profiles_view"];
                if ($_REQUEST["profiles_contact"] != "") $profile_options["profiles_contact"] = $_REQUEST["profiles_contact"];
                if ($_REQUEST["profiles_mypage"] != "") $profile_options["profiles_mypage"] = $_REQUEST["profiles_mypage"];
                if ($_REQUEST["profiles_menu"] != "") $profile_options["profiles_menu"] = $_REQUEST["profiles_menu"];
                if ($_REQUEST["avatar_maxwidth"] != "") $profile_options["avatar_maxwidth"] = (int)$_REQUEST["avatar_maxwidth"];
                if ($_REQUEST["avatar_maxheight"] != "") $profile_options["avatar_maxheight"] =(int) $_REQUEST["avatar_maxheight"];
                if ($_REQUEST["tiny_width"] != "") $profile_options["tiny_width"] =(int) $_REQUEST["tiny_width"];
                if ($_REQUEST["tiny_height"] != "") $profile_options["tiny_width"] =(int) $_REQUEST["tiny_height"];
                if ($_REQUEST["thumbnail_width"] != "") $profile_options["thumbnail_width"] = (int)$_REQUEST["thumbnail_width"];
                if ($_REQUEST["thumbnail_height"] != "") $profile_options["thumbnail_height"] = (int)$_REQUEST["thumbnail_height"];
                if( $_REQUEST["save_profileoptions"] )
                {
                        if ($_REQUEST["thumbnail_disable"])
                                $profile_options["thumbnail_disable"] = "checked";
                        else
                                $profile_options["thumbnail_disable"] = "";
                }
                if( $_REQUEST["subaction"] == "contact" )
                {
                        if( $_REQUEST["subsubaction"] == "add" )
                        {
                                $profile_options["contact_fields"][count($profile_options["contact_fields"])] = array(
                                                                                                                "name" => i18n("Name"),
                                                                                                                "description" => i18n("Description of the contact field"),
                                                                                                                "image" => "image.gif",
                                                                                                                "url" => "http://www.url.com/",
                                                                                                                "regexp" => ".*");
                        }
                        else if( $_REQUEST["save_profileoptions"] )
                        {
                                foreach( $_REQUEST["name"] as $key => $value )
                                {
                                        $profile_options["contact_fields"][$key]["name"] = stripslashes($value);
                                        $profile_options["contact_fields"][$key]["description"] = stripslashes($_REQUEST["description"][$key]);
                                        $profile_options["contact_fields"][$key]["image"] = stripslashes($_REQUEST["image"][$key]);
                                        $profile_options["contact_fields"][$key]["url"] = stripslashes($_REQUEST["url"][$key]);
                                        $profile_options["contact_fields"][$key]["regexp"] = stripslashes($_REQUEST["regexp"][$key]);
                                }
                                // Cannot delete the fields selected for deletion above, because that would mess up the order of keys
                                foreach($_REQUEST["name"] as $key => $value)
                                        if ($_REQUEST["remove"][$key])
                                                unset($profile_options["contact_fields"][$key]);
                        }
                        // Rotate through all contact fields and update the key values
                        if( is_array( $profile_options["contact_fields"] ) )
                                foreach ($profile_options["contact_fields"] as $key => $value)
                                        $temp_contactfields[$value["name"]] = $value;
                       
                        $profile_options["contact_fields"] = $temp_contactfields;
                       
                        if( count($profile_options["contact_fields"]) < 1 )
                        {
                                $profile_options["contact_fields"] = array(
                                        "MSN" => array(
                                                "name" => i18n("MSN"),
                                                "description" => i18n("MSN Messenger"),
                                                "image" => "msn.gif",
                                                "url" => "http://www.msn.com/",
                                                "regexp" => ".+@.+\..+."),
                                        "ICQ" => array(
                                                "name" => i18n("ICQ"),
                                                "description" => i18n("I Seek U"),
                                                "image" => "icq.gif",
                                                "url" => "http://wwp.icq.com/scripts/search.dll?to=$$",
                                                "regexp" => ".*"),
                                        "Y!" => array(
                                                "name" => i18n("Y!"),
                                                "description" => i18n("Yahoo! Messenger"),
                                                "image" => "yahoo.gif",
                                                "url" => "http://edit.yahoo.com/config/send_webmesg?.target=$$&amp;.src=pg",
                                                "regexp" => ".*"),
                                        "AIM" => array(
                                                "name" => i18n("AIM"),
                                                "description" => i18n("AOL Instant Messenger"),
                                                "image" => "aim.gif",
                                                "url" => "aim:goim%3Fscreenname=$$&message=Hello+Are+you+there%3F",
                                                "regexp" => ".*"),
                                        "Jabber" => array(
                                                "name" => i18n("Jabber"),
                                                "description" => i18n("Jabber XMPP Based Instant Messenger"),
                                                "image" => "jabber.gif",
                                                "url" => "http://www.jabber.org/",
                                                "regexp" => ".+@.+\..+."),
                                        "Google Talk" => array(
                                                "name" => i18n("Google Talk"),
                                                "description" => i18n("Google's voice-chat enabled Jabber-based Instant Messenger"),
                                                "image" => "gtalk.gif",
                                                "url" => "http://www.google.com/talk/",
                                                "regexp" => ".+@gmail\.com"),
                                        "Skype" => array(
                                                "name" => i18n("Skype"),
                                                "description" => i18n("Skype Internet Telephony"),
                                                "image" => "skype.gif",
                                                "url" => "skype:$$?call",
                                                "regexp" => ".*"),
                                        "WWW" => array(
                                                "name" => i18n("WWW"),
                                                "description" => i18n("Homepage address (remember http://)"),
                                                "image" => "www.gif",
                                                "url" => "$$",
                                                "regexp" => ".*")
                                );
                        }
                }
                saveProfileOptions();
               
                $tabwidget = new TabWidget;
                $tabwidget->tabbar->addTab(i18n("Default profile options"), thisPageURL( false, true, array( "subaction" => "default")), true);
                $tabwidget->tabbar->addTab(i18n("Avatar options"),thisPageURL( false, true, array( "subaction" => "avatar")), false);
                $tabwidget->tabbar->addTab(i18n("Contact fields"), thisPageURL( false, true, array( "subaction" => "contact")), false);
               
                switch( $_REQUEST["subaction"] )
                {
                case "contact":
                        $page_title = i18n("Contact fields");
                        $tabwidget->tabbar->setCurrent("Contact fields");
                        $tabwidget->addCommand(i18n("Add field"), i18n("Add a new contact field"), thisPageURL( false, true, array( "subaction" => "contact", "subsubaction" => "add" ) ) );
                       
                        if( is_array($profile_options["contact_fields"]) )
                        {
                                $temp_content = "
                                        <table class=\"options\">
                                        <tr class=\"option\">
                                                <th class=\"options\" width=\"50%\">"
. i18n("Name and Description") . "</th>
                                                <th class=\"options\" width=\"50%\">"
. i18n("Image, URL and Validation regexp") . "</th>
                                        </tr>
                                        <tr>
                                                <td colspan=\"2\">"
;
                               
                                foreach( $profile_options["contact_fields"] as $key => $value )
                                {
                                        if ($value["enabled"] == "true")
                                                $checkedvalue = "checked ";
                                        else
                                                $checkedvalue = "";
                                       
                                        $temp_content .= "
                                        <table class=\"options\">
                                        <tr class=\"option\">
                                                <td class=\"option\" width=\"35%\"><input style=\"width: 100%;\" type=\"text\" name=\"name[$key]\" value=\"{$value['name']}\" />
                                                <td class=\"option\" width=\"15%\"><label><input type=\"checkbox\" name=\"remove[$key]\" />"
. i18n("Delete") . "</label></td>
                                                <td class=\"option\" width=\"25%\"><input style=\"width: 100%;\" type=\"text\" name=\"image[$key]\" value=\"{$value['image']}\" /></td>
                                                <td class=\"option\" width=\"25%\"><input style=\"width: 100%;\" type=\"text\" name=\"regexp[$key]\" value=\"{$value['regexp']}\" /></td>
                                        </tr><tr class=\"option\">
                                                <td class=\"option\" colspan=\"2\"><input type=\"text\" style=\"width: 100%;\" name=\"description[$key]\" value=\"{$value['description']}\" /></td>
                                                <td class=\"option\" colspan=\"2\"><input style=\"width: 100%;\" type=\"text\" name=\"url[$key]\" value=\"{$value['url']}\" /></td>
                                        </tr>
                                        </table>"
;
                                }
                                $temp_content .= "
                                                </td>
                                        </tr>
                                        <tr>
                                                <td class=\"options-bottomleft\"><input type=\"submit\" name=\"save_profileoptions\" value=\""
. i18n("Save options") . "\" /></td>
                                                <td class=\"options-bottomright\"><input type=\"reset\" value=\""
. i18n("Reset to saved") . "\" /></td>
                                        </tr>
                                        </table>"
;
                        }
                       
                        $tabwidget->contents = $temp_content;
                        break;
                case "avatar":
                        $page_title = i18n("Avatar options");
                        $tabwidget->tabbar->setCurrent("Avatar options");
                        $tabwidget->contents = "
                        <table class=\"options\">
                        <tr class=\"option\"><th class=\"options\" colspan=\"2\">"
. i18n("Maximum sizes") . "</th></tr>
                        <tr class=\"option\">
                                <td class=\"option\" width=\"50%\">"
. i18n("Width") . "</td>
                                <td class=\"option\" width=\"50%\"><input style=\"width: 100%\" type=\"text\" name=\"avatar_maxwidth\" value=\"{$profile_options['avatar_maxwidth']}\" /></td>
                        </tr>
                        <tr class=\"option\">
                                <td class=\"option\">"
. i18n("Height") . "</td>
                                <td class=\"option\"><input style=\"width: 100%\" type=\"text\" name=\"avatar_maxheight\" value=\"{$profile_options['avatar_maxheight']}\" /></td>
                        </tr>
                        <tr class=\"option\"><th class=\"options\" colspan=\"2\">"
. i18n("Thumbnail sizes") . "</th></tr>
                        <tr class=\"option\">
                                <td class=\"option\" colspan=\"2\"><label><input type=\"checkbox\" name=\"thumbnail_disable\" {$profile_options['thumbnail_disable']} />
                                "
. i18n("Disable thumbnails. If you select this, you will probably want to greatly limit the size options for the avatar above") . "</label>
                                </td>
                        </tr>
                        <tr class=\"option\">
                                <td class=\"option\" width=\"50%\">"
. i18n("Width") . "</td>
                                <td class=\"option\" width=\"50%\"><input style=\"width: 100%\" type=\"text\" name=\"thumbnail_width\" value=\"{$profile_options['thumbnail_width']}\" /></td>
                        </tr>
                        <tr class=\"option\">
                                <td class=\"option\">"
. i18n("Height") . "</td>
                                <td class=\"option\"><input style=\"width: 100%\" type=\"text\" name=\"thumbnail_height\" value=\"{$profile_options['thumbnail_height']}\" /></td>
                        </tr>
                        <tr class=\"option\"><th class=\"options\" colspan=\"2\">"
. i18n("Tiny sizes") . "</th></tr>
                        <tr class=\"option\">
                                <td class=\"option\" width=\"50%\">"
. i18n("Width") . "</td>
                                <td class=\"option\" width=\"50%\"><input style=\"width: 100%\" type=\"text\" name=\"tiny_width\" value=\"{$profile_options['tiny_width']}\" /></td>
                        </tr>
                        <tr class=\"option\">
                                <td class=\"option\">"
. i18n("Height") . "</td>
                                <td class=\"option\"><input style=\"width: 100%\" type=\"text\" name=\"tiny_height\" value=\"{$profile_options['tiny_height']}\" /></td>
                        </tr>
                        <tr>
                                <td class=\"options-bottomleft\"><input type=\"submit\" name=\"save_profileoptions\" value=\""
. i18n("Save options") . "\" /></td>
                                <td class=\"options-bottomright\"><input type=\"reset\" value=\""
. i18n("Reset to saved") . "\" /></td>
                        </tr>
                        </table>"
;
                        break;
                case "default":
                default:
                        $page_title = i18n("Default profile options");
                        $tabwidget->tabbar->setCurrent("Default profile options");
                       
                        $permissionlevels_array = array(
                                                0 => i18n("All"),
                                                1 => i18n("Registered users"),
                                                2 => i18n("Registered users, except blacklisted"),
                                                3 => i18n("Friends"),
                                                4 => i18n("Noone"));
                        foreach( $permissionlevels_array as $key => $value )
                        {
                                if ($profile_options["profiles_view"] == $key) { $default = " selected"; } else { $default = ""; }
                                $permissionlevels_view .= "<option value=\"$key\"$default>$value</option>";
                                if ($profile_options["profiles_contact"] == $key) { $default = " selected"; } else { $default = ""; }
                                $permissionlevels_contact .= "<option value=\"$key\"$default>$value</option>";
                                if ($profile_options["profiles_mypage"] == $key) { $default = " selected"; } else { $default = ""; }
                                $permissionlevels_mypage .= "<option value=\"$key\"$default>$value</option>";
                        }
                       
                       
                       
                        $tabwidget->contents = "
                        <table class=\"options\">
                        <tr class=\"option\">
                                <td class=\"option\" width=\"50%\">"
. i18n("Profiles are by default viewable by") . "</td>
                                <td class=\"option\" width=\"50%\"><select style=\"width: 100%;\" name=\"profiles_view\">$permissionlevels_view</select></td>
                        </tr>
                        <tr class=\"option\">
                                <td class=\"option\">"
. i18n("Users can by default be contacted by") . "</td>
                                <td class=\"option\"><select style=\"width: 100%;\" name=\"profiles_contact\">$permissionlevels_contact</select></td>
                        </tr>
                        <tr class=\"option\">
                                <td class=\"option\">"
. i18n("User's personal pages can by default be viewed by") . "</td>
                                <td class=\"option\"><select style=\"width: 100%;\" name=\"profiles_mypage\">$permissionlevels_mypage</select></td>
                        </tr>
                        <tr class=\"option\">
                                <td class=\"option\">"
. i18n("The menu used by the profiles section") . "</td>
                                <td class=\"option\"><select style=\"width: 100%;\" name=\"profiles_menu\">"
;
                       
                        $menu_menus = $pagectl->fetchMenuMenuList($menu_folder);
                        foreach( $menu_menus as $key => $value )
                        {
                                if( is_array($value["language"]) )
                                {
                                        if ($value["id"] == $profile_options["profiles_menu"])
                                                $tabwidget->contents .= "\n                                     <option value=\"{$value["id"]}\" selected>ID {$value["id"]} (";
                                        else
                                                $tabwidget->contents .= "\n                                     <option value=\"{$value["id"]}\">ID {$value["id"]} (";
                                       
                                        foreach ($value["language"] as $key2 => $value2)
                                                $tabwidget->contents .= "$value2: {$value["title"][$key2]} ";
                                       
                                        $tabwidget->contents .= ")</option>";
                                }
                                else
                                {
                                        if ($value["id"] == $profile_options["profiles_menu"])
                                                $tabwidget->contents .= "\n                                     <option value=\"{$value["id"]}\" selected>ID {$value["id"]} ({$value["language"]}: {$value["title"]})</option>";
                                        else
                                                $tabwidget->contents .= "\n                                     <option value=\"{$value["id"]}\">ID {$value["id"]} ({$value["language"]}: {$value["title"]})</option>";
                                }
                        }
                       
                        $tabwidget->contents .= "</select></td>
                        </tr>
                        <tr>
                                <td class=\"options-bottomleft\"><input type=\"submit\" name=\"save_profileoptions\" value=\""
. i18n("Save options") . "\" /></td>
                                <td class=\"options-bottomright\"><input type=\"reset\" value=\""
. i18n("Reset to saved") . "\" /></td>
                        </tr>
                        </table>
                        "
;
                }
               
                $setupPage->contents = "
                <form action=\""
. thisPageURL() . "\" method=\"post\">
                "
. $tabwidget->renderTabWidget() . "
                <div class=\"wikicenteralign\">
                </div>
                </form>"
;
        }
        else if( $_REQUEST["action"] == "default_permissions" )
        {
                $page_title = i18n("Default permissions");
                if( $_REQUEST["thepermission"] != "" && ($_REQUEST["thevalue"] == "true" || $_REQUEST["thevalue"] == "false") )
                {
                        if( setAllowed($_REQUEST["thepermission"], $_REQUEST["thevalue"]) )
                                $setupPage->contents = "<p>" . i18n("The permissions were set successfully") . "</p>";
                        else
                                $setupPage->contents = "<p>" . i18n("An error occured during the setting of the permission!") . "</p>";
                }
                $setupPage->contents .= "
                        <table class=\"setup\">
                        <tr class=\"setup\">
                                <th class=\"setup\">"
. i18n("Name of the permission") . "</th>
                                <th class=\"setup\">"
. i18n("Current (click to allow/ disallow)") . "</th>
                        </tr>
                        "
;
                ksort($usergroups_default);
                foreach( $usergroups_default as $key => $value )
                {
                        if( $value == true )
                        {
                                $temptext = "Allowed";
                                $thenewvalue = "false";
                        }
                        else
                        {
                                $temptext = "Not allowed";
                                $thenewvalue = "true";
                        }
                        $setupPage->contents .= "
                        <tr class=\"setup\">
                                <td class=\"setup\">"
. i18n($key) . "</td>
                                <td class=\"setup wikirightalign\">
                                        "
. drawCommand( i18n($temptext), i18n($temptext), thisPageURL( false, true, array( "thepermission" => $key, "thevalue" => $thenewvalue ) ) ) . "
                                </td>
                        </tr>
                        "
;
                }
                $setupPage->contents .= "</table>
                "
;
        }
        else if( $_REQUEST["action"] == "permissions" )
        {
                $page_title = i18n("Permissions for ##0##", array( $_REQUEST["username"] ) );
                if( $_REQUEST["thepermission"] != "" && ($_REQUEST["thevalue"] == "true" || $_REQUEST["thevalue"] == "false") )
                {
                        if( setAllowed($_REQUEST["thepermission"], $_REQUEST["thevalue"], $_REQUEST["username"])  )
                                $setupPage->contents = "<p>" . i18n("The permissions were set successfully") . "</p>";
                        else
                                $setupPage->contents = "<p>" . i18n("An error occured during the setting of the permission!") . "</p>";
                }
                $setupPage->contents .= "
                        <table class=\"setup\">
                        <tr class=\"setup\">
                                <th class=\"setup\">"
. i18n("Name of the permission") . "</th>
                                <th class=\"setup\">"
. i18n("Current (click to allow/ disallow)") . "</th>
                        </tr>
                        "
;
                $temp_usergroups = getPermissions($_REQUEST["username"]);
                ksort($usergroups_default);
                foreach($usergroups_default as $key => $value)
                {
                        if( is_array($temp_usergroups) )
                        {
                                if( array_key_exists($key, $temp_usergroups) )
                                {
                                        if( $temp_usergroups[$key] == true )
                                        {
                                                $temptext = "Allowed";
                                                $thenewvalue = "false";
                                        }
                                        else
                                        {
                                                $temptext = "Not allowed";
                                                $thenewvalue = "true";
                                        }
                                }
                                else
                                {
                                        if( $value == true )
                                        {
                                                $temptext = "(default) Allowed";
                                                $thenewvalue = "false";
                                        }
                                        else
                                        {
                                                $temptext = "(default) Not allowed";
                                                $thenewvalue = "true";
                                        }
                                }
                        }
                        else
                        {
                                if( $value == true )
                                {
                                        $temptext = "(default) Allowed";
                                        $thenewvalue = "false";
                                }
                                else
                                {
                                        $temptext = "(default) Not allowed";
                                        $thenewvalue = "true";
                                }
                        }
                        $setupPage->contents .= "
                        <tr class=\"setup\">
                                <td class=\"setup\">"
. i18n($key) . "</td>
                                <td class=\"setup wikirightalign\">
                                        "
. drawCommand( i18n($temptext), i18n($temptext), thisPageURL( false, true, array( "thepermission" => $key, "thevalue" => $thenewvalue ) ) ) . "
                                </td>
                        </tr>
                        "
;
                }
                $setupPage->contents .= "</table>
                "
;
               
        }
        else if( $_REQUEST["action"] == "remove" )
        {
                $page_title = i18n("Remove user");
                if ($_REQUEST["remove_confirm"] != "true") {
                        $setupPage->contents = "
                        <p>"
. i18n("Please confirm that you wish to remove the user ##0##", array($_REQUEST['username'])) . "</p>
                        <div align=\"center\">
                        <a href=\""
. thisPageURL( false, true, array( "username" => $_REQUEST['username'], "remove_confirm" => "true" ) ) . "\">[". i18n("Remove user") . "]</a>
                        <a href=\""
. globalIDtoURL( "setup/users" ) . "\">[" . i18n("Abort") . "]</a>
                        </div>
                        "
;
                }
                else
                {
                        if( $_REQUEST["username"] == currentUser() )
                        {
                                $usermanager->remove($_REQUEST["username"], "setup/password.txt");
                                $setupPage->contents = "<p>" . i18n("User removed!") . "</p>";
                                header("Location: " . globalIDtoURL("logout") );
                        }
                        else if( isAllowed("global_admin") )
                        {
                                $usermanager->remove($_REQUEST["username"], "setup/password.txt");
                                $setupPage->contents = "<p>" . i18n("User removed!") . "</p>";
                                header("Location: " . globalIDtoURL("setup/users") );
                        }
                        else
                                $setupPage->contents = "<p>You are not authorised to remove this user! Also, you should <i>not</i> be seeing this.</p>";
                }
        }
        else if( $_REQUEST["action"] == "rename" && $_REQUEST["username"] != "" )
        {
                $page_title = i18n("Rename user");
                if( $_REQUEST["renameto"] == "" || $_REQUEST["renameto"] == $_REQUEST["username"] )
                {
                        $setupPage->contents = "
                        <form action=\""
. globalIDtoURL("setup/users/rename") . "\" method=\"post\">
                        <input type=\"hidden\" name=\"username\" value=\"{$_REQUEST['username']}\" />
                        <table class=\"setup\">
                        <tr class=\"setup\"><td class=\"setup\" colspan=\"2\">
                        "
. i18n("Write the new username for the user ##0## in the text box below.", array($_REQUEST["username"])) . "
                        <tr><td class=\"setup\">"
. i18n("Username:") . "</td><td class=\"setup\" align=\"right\"><input type=\"text\" name=\"renameto\" value=\"{$_REQUEST['username']}\"></td></tr>
                        <tr class=\"setup\"><td class=\"setup\" colspan=\"2\" align=\"center\"><input type=\"submit\" value=\""
. i18n("Rename") . "\"></td></tr>
                        </table></form>
                        "
;
                }
                else
                {
                        $usermanager->rename($_REQUEST["username"], $_REQUEST["renameto"]);
                        $setupPage->contents = "<p>" . i18n("User renamed") . "</p>";
                        header("Location: " . globalIDtoURL("setup/users") );
                }
        }
        else
        { //No action, just show default user management stuff
                $page_title = i18n("Manage users");
                $bgarray[1] = "transparent";
                $bgarray[2] = "#e0e0e0";
                //Make the Users sub-section
                $fp = fopen("setup/password.txt", "r");
                while (!feof($fp)) {
                        $line = trim(fgets($fp, 1000));
                        list($l, $p) = explode(",", $line);
                        $bgarray = array_reverse($bgarray);
                        if (!isAllowed("group_admin") && $let_user_delete_self == true) { //This is shown if the user is not admin
                                if ($l == "admin" || !($l == currentUser())) { //You aren't allowed to remove the admin user, or for users, any user that is not themselves
                                        $temp_content = "$temp_content
                                        <tr class=\"setup\">
                                        <td class=\"setup\" style=\"background-color: {$bgarray[1]};\"><div align=\"left\">$l</div></td>
                                        <td class=\"setup\" style=\"background-color: {$bgarray[1]};\" align=\"right\"><div class=\"command\">
                                        "
. i18n("(admin only)") . "
                                        </div></td></tr>"
;
                                } else {
                                        $temp_content = "$temp_content
                                        <tr class=\"setup\">
                                        <td class=\"setup\" style=\"background-color: {$bgarray[1]};\"><div align=\"left\">$l</div></td>
                                        <td class=\"setup\" style=\"background-color: {$bgarray[1]};\" align=\"right\"><div class=\"command\">
                                                "
. drawCommand( i18n("Remove"), i18n("Remove the user"), globalIDtoURL( "setup/users/remove/$l" ) ) . "
                                                "
. drawCommand( i18n("Edit user"), i18n("Edit the user", array($l) ), globalIDtoURL("user/$l/edit") ) . "
                                        </div></td></tr>"
;
                                }
                        } else {
                                if ($l == "admin") { //You aren't allowed to remove the admin user
                                        $temp_content = "$temp_content
                                        <tr class=\"setup\">
                                        <td class=\"setup\" style=\"background-color: {$bgarray[1]};\"><div align=\"left\">$l</div></td>
                                        <td class=\"setup\" style=\"background-color: {$bgarray[1]};\" align=\"right\"><div class=\"command\">
                                                "
. drawCommand( i18n("Edit user"), i18n("Edit the user", array($l) ), globalIDtoURL("user/$l/edit") ) . "
                                        </div></td></tr>"
;
                                } else {
                                        $temp_content = "$temp_content
                                        <tr class=\"setup\">
                                        <td class=\"setup\" style=\"background-color: {$bgarray[1]};\"><div align=\"left\">$l</div></td>
                                        <td class=\"setup\" style=\"background-color: {$bgarray[1]};\" align=\"right\"><div class=\"command\">
                                                "
. drawCommand( i18n("Permissions"), i18n("Permissions"), globalIDtoURL( "setup/users/permissions/$l") )  . "
                                                "
. drawCommand( i18n("Remove"), i18n("Remove the user"), globalIDtoURL( "setup/users/remove/$l" ) ) . "
                                                "
. drawCommand( i18n("Rename"), i18n("Rename the user"), globalIDtoURL( "setup/users/rename/$l" ) ) . "
                                                "
. drawCommand( i18n("Edit user"), i18n("Edit the user", array($l) ), globalIDtoURL("user/$l/edit") ) . "
                                        </div></td></tr>"
;
                                }
                        }
                }
                fclose($fp);

                $setupPage->contents .= "
                                <table class=\"setup\">
                                <tr class=\"setup\">
                                <th class=\"setup\">"
. i18n("Username") . "</th>
                                <th class=\"setup\">"
. i18n("Functions") . "</th>
                                </tr>
               
                $temp_content</table>"
;
        }
       
        $page_content = $setupPage->render();
}
?>