Beispiel #1
0
function bwoupUserEditForms($adm_login, $adm_pass)
{
    global $adm_random_pass;
    global $conf_skin;
    global $addrlink;
    global $rub;
    $ret["err"] = 0;
    $ret["mesg"] = "No error";
    if (isset($adm_login) && $adm_login != "" && isset($adm_pass) && $adm_pass != "") {
        // Fetch all the selected user informations, Print a nice error message if failure.
        $admin = fetchAdmin($adm_login, $adm_pass);
        if (isset($adm_random_pass)) {
            $pass = $adm_random_pass;
        } else {
            $pass = $adm_pass;
        }
        if (($error = $admin["err"]) != 0) {
            echo _("Error fetching admin") . " : {$error}";
            $ret["err"] = $admin["err"];
            $ret["mesg"] = $admin["mesg"];
            return $ret;
        }
        $out = '<ul class="box_wnb_content_nb">';
        if ($rub != "user" && $rub != "") {
            $out .= "<li class=\"box_wnb_content_nb_item\"><a href=\"?adm_login={$adm_login}&adm_pass={$pass}&rub=user\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_clientinterface.gif\"  align=\"absmiddle\" border=\"0\"> " . _("Client interface") . "</a></li>";
        } else {
            $out .= "<li class=\"box_wnb_content_nb_item_select\"><a href=\"?adm_login={$adm_login}&adm_pass={$pass}&rub=user\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_clientinterface.gif\" align=\"absmiddle\" border=\"0\"> " . _("Client interface") . "</a></li>";
        }
        $out .= '<li class="box_wnb_content_nb_item_vsep"></li>';
        if ($rub != "domain_config") {
            $out .= "<li class=\"box_wnb_content_nb_item\"><a href=\"?adm_login={$adm_login}&adm_pass={$pass}&rub=domain_config\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_domainconfig.gif\" align=\"absmiddle\" border=\"0\">" . _("Domain config") . "</a></li>";
        } else {
            $out .= "<li class=\"box_wnb_content_nb_item_select\"><a href=\"?adm_login={$adm_login}&adm_pass={$pass}&rub=domain_config\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_domainconfig.gif\" align=\"absmiddle\" border=\"0\">" . _("Domain config") . "</a></li>";
        }
        $out .= '<li class="box_wnb_content_nb_item_vsep"></li>';
        if ($rub != "adminedit") {
            $out .= "<li class=\"box_wnb_content_nb_item\"><a href=\"?adm_login={$adm_login}&adm_pass={$pass}&rub=adminedit\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_admineditor.gif\" align=\"absmiddle\" border=\"0\">" . _("Admin editor") . "</a></li>";
        } else {
            $out .= "<li class=\"box_wnb_content_nb_item_select\"><a href=\"?adm_login={$adm_login}&adm_pass={$pass}&rub=adminedit\"><img width=\"16\" height=\"16\" src=\"gfx/skin/bwoup/gfx/tabs/p_admineditor.gif\" align=\"absmiddle\" border=\"0\">" . _("Admin editor") . "</a></li>";
        }
        $out .= "</ul>";
        //fix up the $adm_login in case it changed because of session vars:
        //in case users play silly bugger with the "GET" variables
        $adm_login = $admin["info"]["adm_login"];
        // Draw the html forms
        if (isset($rub) && $rub == "adminedit") {
            $out .= drawEditAdmin($admin);
        } else {
            if (isset($rub) && $rub == "domain_config") {
                $out .= drawDomainConfig($admin);
            } else {
                $out .= '<table class="box_wnb_content_clientimport"><tr><td>' . drawAdminTools($admin) . '</td></tr></table>';
            }
        }
        return $out;
    } else {
        // If no user is in edition, draw a tool for adding an admin
        return drawNewAdminForm();
    }
}
Beispiel #2
0
function userEditForms($adm_login, $adm_pass)
{
    global $adm_random_pass;
    global $conf_skin;
    global $addrlink;
    global $rub;
    $ret["err"] = 0;
    $ret["mesg"] = "No error";
    if (isset($adm_login) && $adm_login != "" && isset($adm_pass) && $adm_pass != "") {
        // Fetch all the selected user informations, Print a nice error message if failure.
        $admin = fetchAdmin($adm_login, $adm_pass);
        if (isset($adm_random_pass)) {
            $pass = $adm_random_pass;
        } else {
            $pass = $adm_pass;
        }
        if (($error = $admin["err"]) != 0) {
            // now print out all the stuff from our HTTP headers
            //$input = array_merge($_GET,    $_POST,
            //     $_COOKIE, $_SERVER,
            //     $_ENV,    $_FILES,
            //     isset($_SESSION) ? $_SESSION : array());
            //foreach ($input as $k => $v) {
            //	echo "$k - $input[$k]\n";
            //}
            echo "Error fetching admin : {$error} line " . __LINE__ . " file " . __FILE__;
            $ret["err"] = $admin["err"];
            $ret["mesg"] = $admin["mesg"];
            return $ret;
        }
        $iface_select = "<table height=\"1\" border=\"0\" width=\"100%\">";
        $iface_select .= "<tr><td width=\"33%\" valign=\"top\"><center>";
        if ($rub != "user" && $rub != "") {
            $iface_select .= "<a href=\"?rub=user&adm_login={$adm_login}&adm_pass={$pass}\">";
        }
        $iface_select .= "<img src=\"gfx/menu/client-interface.png\" width=\"48\" height=\"48\" border=\"0\"><br>\n" . _("Client interface");
        if ($rub != "user" && $rub != "") {
            $iface_select .= "</a>";
        }
        $iface_select .= "</center></td><td width=\"33%\" valign=\"top\"><center>";
        if ($rub != "domain_config") {
            $iface_select .= "<a href=\"?rub=domain_config&adm_login={$adm_login}&adm_pass={$pass}\">";
        }
        $iface_select .= "<img src=\"gfx/menu/domain-config.png\" width=\"48\" height=\"48\" border=\"0\"><br>\n" . _("Domain config");
        if ($rub != "domain_config") {
            $iface_select .= "</a>";
        }
        $iface_select .= "</center></td><td width=\"33%\" valign=\"top\"><center>";
        if ($rub != "adminedit") {
            $iface_select .= "<a href=\"?rub=adminedit&adm_login={$adm_login}&adm_pass={$pass}\">";
        }
        $iface_select .= "<img src=\"gfx/menu/user-editor.png\" width=\"48\" height=\"48\" border=\"0\"><br>\n" . _("Admin editor");
        if ($rub != "adminedit") {
            $iface_select .= "</a>";
        }
        $iface_select .= "</center></td></tr></table>";
        $iface_skined = skin($conf_skin, $iface_select, _("User administration") . " {$adm_login}");
        //fix up the $adm_login in case it changed because of session vars:
        //in case users play silly bugger with the "GET" variables
        $adm_login = $admin["info"]["adm_login"];
        // Draw the html forms
        if (isset($rub) && $rub == "adminedit") {
            $HTML_admin_edit_info = drawEditAdmin($admin);
            $user_config = skin($conf_skin, $HTML_admin_edit_info, _("Configuration of the virtual administrator") . "<i>\"{$adm_login}\"</i>");
            //			return $user_config;
        } else {
            if (isset($rub) && $rub == "domain_config") {
                $HTML_admin_domain_config = drawDomainConfig($admin);
                $user_config = skin($conf_skin, $HTML_admin_domain_config, _("Configuration of domains for") . " <i>\"{$adm_login}\"</i>");
            } else {
                $HTML_admin_edit_data = drawAdminTools($admin);
                $user_config = skin($conf_skin, $HTML_admin_edit_data, _("Domains for") . " " . $adm_login);
                //			return $user_tools;
            }
        }
        // All thoses tools in a simple table
        return "<table width=\"100%\" height=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n\t<tr>\n\t\t<tr><td width=\"100%\">{$iface_skined}</td></tr>\n\t\t<tr><td width=\"100%\">{$user_config}</td></tr>\n\t\t<tr><td height=\"100%\">&nbsp;</td></tr>\n\t</tr>\n</table>\n";
    } else {
        // If no user is in edition, draw a tool for adding an admin
        $add_a_user = drawNewAdminForm();
        return skin($conf_skin, $add_a_user, _("Add a virtual administrator"));
    }
}