Example #1
0
require_once "../ipplanlib.php";
require_once "../adodb/adodb.inc.php";
require_once "../class.dbflib.php";
require_once "../layout/class.layout";
require_once "../auth.php";
$auth = new SQLAuthenticator(REALM, REALMERROR);
// And now perform the authentication
$grps = $auth->authenticate();
// set language
isset($_COOKIE["ipplanLanguage"]) && myLanguage($_COOKIE['ipplanLanguage']);
//setdefault("window",array("bgcolor"=>"white"));
//setdefault("table",array("cellpadding"=>"0"));
//setdefault("text",array("size"=>"2"));
$title = my_("Modify/Copy/Move/Delete/Split/Join subnets");
newhtml($p);
insert($p, $h = wheader("IPPlan - {$title}"));
insert($h, script("", array("type" => "text/javascript", "src" => "../cookies.js")));
insert($h, script("", array("type" => "text/javascript", "src" => "../phpserializer.js")));
insert($h, script("", array("type" => "text/javascript", "src" => "../ipplanlib.js")));
$w = myheading($p, $title, true);
// explicitly cast variables as security measure against SQL injection
list($cust, $areaindex) = myRegister("I:cust I:areaindex");
// display opening text
insert($w, heading(3, "{$title}."));
$ds = new IPplanDbf() or myError($w, $p, my_("Could not connect to database"));
// start form
insert($w, $f1 = form(array("name" => "THISFORM", "method" => "post", "action" => $_SERVER["PHP_SELF"])));
$cust = myCustomerDropDown($ds, $f1, $cust, $grps) or myError($w, $p, my_("No customers"));
$areaindex = myAreaDropDown($ds, $f1, $cust, $areaindex);
insert($w, $f2 = form(array("name" => "ENTRY", "method" => "get", "action" => "modifybase.php")));
// save customer name for actual post of data
Example #2
0
function myheading($q, $title, $displaymenu = true)
{
    // Generate the correct prefix for URLs in menu.
    $BASE_URL = base_url();
    $BASE_DIR = base_dir();
    $myDirPath = $BASE_DIR . '/menus/';
    $myWwwPath = $BASE_URL . '/menus/';
    // these files should probably not be here
    require_once $myDirPath . 'lib/PHPLIB.php';
    require_once $myDirPath . 'lib/layersmenu-common.inc.php';
    require_once $myDirPath . 'lib/layersmenu.inc.php';
    require_once $BASE_DIR . '/menudefs.php';
    eval("\$ADMIN_MENU = \"{$ADMIN_MENU}\";");
    // create the html page HEAD section
    insert($q, $header = wheader("IPPlan - {$title}"));
    insert($q, $w = container("div", array("class" => "matte")));
    insert($header, generic("meta", array("http-equiv" => "Content-Type", "content" => "text/html; charset=UTF-8")));
    if ($displaymenu) {
        insert($header, generic("link", array("rel" => "stylesheet", "href" => "{$myWwwPath}" . "layersmenu-gtk2.css")));
        //    insert($header, generic("link",array("rel"=>"stylesheet","href"=>"$myWwwPath"."layersmenu-demo.css")));
    }
    // Konqueror and Safari browsers do not support overflow: auto css tag so use custom stylesheet
    if (stristr($_SERVER["HTTP_USER_AGENT"], "konqueror") or stristr($_SERVER["HTTP_USER_AGENT"], "safari")) {
        insert($header, generic("link", array("rel" => "stylesheet", "href" => "{$BASE_URL}" . "/themes/default-safari.css")));
    } else {
        // Added theme support.
        $themecookie = isset($_COOKIE["ipplanTheme"]) ? $_COOKIE["ipplanTheme"] : "";
        global $config_themes;
        // obtained from config.php file which is global
        if (!empty($themecookie) and $config_themes[$themecookie] != "") {
            insert($header, generic("link", array("rel" => "stylesheet", "href" => "{$BASE_URL}" . "/themes/{$config_themes[$themecookie]}")));
        } else {
            insert($header, generic("link", array("rel" => "stylesheet", "href" => "{$BASE_URL}" . "/themes/default.css")));
        }
    }
    if ($displaymenu) {
        insert($w, script("", array("language" => "JavaScript", "type" => "text/javascript", "src" => $myWwwPath . "libjs/layersmenu-browser_detection.js")));
        insert($w, script("", array("language" => "JavaScript", "type" => "text/javascript", "src" => $myWwwPath . 'libjs/layersmenu-library.js')));
        insert($w, script("", array("language" => "JavaScript", "type" => "text/javascript", "src" => $myWwwPath . 'libjs/layersmenu.js')));
        $mid = new LayersMenu(6, 7, 2, 1);
        $mid->setDirroot($BASE_DIR . '/menus/');
        $mid->setLibjsdir($BASE_DIR . '/menus/libjs/');
        $mid->setImgdir($BASE_DIR . '/menus/menuimages/');
        $mid->setImgwww($BASE_URL . '/menus/menuimages/');
        $mid->setIcondir($BASE_DIR . '/menus/menuicons/');
        $mid->setIconwww($BASE_URL . '/menus/menuicons/');
        $mid->setTpldir($BASE_DIR . '/menus/templates/');
        $mid->SetMenuStructureString($ADMIN_MENU);
        $mid->setIconsize(16, 16);
        $mid->parseStructureForMenu('hormenu1');
        $mid->newHorizontalMenu('hormenu1');
    }
    // draw header box
    insert($w, $con = container("div", array("class" => "headerbox", "align" => "center")));
    insert($con, heading(1, my_("IPPlan - IP Address Management and Tracking")));
    insert($con, block("<br>"));
    insert($con, heading(3, $title));
    if ($displaymenu) {
        // draw menu box here
        insert($w, $con = container("div", array("class" => "menubox")));
        insert($con, $t = table(array("cols" => "2", "width" => "100%")));
        insert($t, $c1 = cell());
        insert($t, $c2 = cell(array("align" => "right")));
        insert($c1, block($mid->getHeader()));
        insert($c1, block($mid->getMenu('hormenu1')));
        insert($c1, block($mid->getFooter()));
        // find a place to display logged in user
        insert($c2, $uc = container("div", array("class" => "userbox")));
        if (getAuthUsername() != "") {
            insert($uc, block(sprintf(my_("Logged in as %s"), getAuthUsername())));
        }
    }
    insert($w, $con = container("div", array("class" => "normalbox")));
    insert($w, $con1 = container("div", array("class" => "footerbox")));
    insert($con1, block("IPPlan v4.92b"));
    return $con;
}