Example #1
0
function shell()
{
    $cells = array();
    for ($row = 0; $row < 5; $row++) {
        for ($col = 0; $col < 5; $col++) {
            $cells[] = cell($row, $col);
        }
    }
    return "<div class='invader'>" . implode("\n", $cells) . "<div class='clear'></div></div>";
}
Example #2
0
function row($label, $input = array(), $settings = false)
{
    if ($input['id']) {
        $id = $input['id'];
    } else {
        $id = $settings['id'];
    }
    if ($settings['content']) {
        $in = $settings['content'];
    } else {
        $in = "";
        if ($settings['prepend']) {
            $in .= $settings['prepend'];
        }
        $in .= '<input type="' . $input['type'] . '" name="' . $input['name'] . '"';
        if (!$input['id']) {
            $in .= ' id="' . $input['name'] . '"';
        } else {
            $in .= ' id="' . $id . '"';
        }
        if ($input['class']) {
            $in .= ' class="' . $input['class'] . '"';
        }
        if ($input['value']) {
            $in .= ' value="' . htmlspecialchars($input['value']) . '"';
        }
        if ($input['ext']) {
            $in .= " " . $input['ext'];
        }
        $in .= ' />';
        if ($settings['append']) {
            $in .= $settings['append'];
        }
    }
    Write('
			<tr class="cell{0}">
				<td>
					<label for="{1}">
						{2}
					</label>
				</td>
				<td>
					{3}
				</td>
			</tr>', cell(), $id, $label, $in);
}
Example #3
0
function do_summary(&$count, &$hours, &$room_hash, &$name_hash)
{
    global $enable_periods;
    # Make a sorted array of area/rooms, and of names, to use for column
    # and row indexes. Use the rooms and names hashes built by accumulate().
    # At PHP4 we could use array_keys().
    reset($room_hash);
    while (list($room_key) = each($room_hash)) {
        $rooms[] = $room_key;
    }
    ksort($rooms);
    reset($name_hash);
    while (list($name_key) = each($name_hash)) {
        $names[] = $name_key;
    }
    ksort($names);
    $n_rooms = sizeof($rooms);
    $n_names = sizeof($names);
    echo "<hr><h1>" . (empty($enable_periods) ? get_vocab("summary_header") : get_vocab("summary_header_per")) . "</h1><table border=2 cellspacing=4>\n";
    echo "<tr><td>&nbsp;</td>\n";
    for ($c = 0; $c < $n_rooms; $c++) {
        echo "<td class=\"BL\" align=left><b>{$rooms[$c]}</b></td>\n";
        $col_count_total[$c] = 0;
        $col_hours_total[$c] = 0.0;
    }
    echo "<td class=\"BR\" align=right><br><b>" . get_vocab("total") . "</b></td></tr>\n";
    $grand_count_total = 0;
    $grand_hours_total = 0;
    for ($r = 0; $r < $n_names; $r++) {
        $row_count_total = 0;
        $row_hours_total = 0.0;
        $name = $names[$r];
        echo "<tr><td class=\"BR\" align=right><b>{$name}</b></td>\n";
        for ($c = 0; $c < $n_rooms; $c++) {
            $room = $rooms[$c];
            if (isset($count[$room][$name])) {
                $count_val = $count[$room][$name];
                $hours_val = $hours[$room][$name];
                cell($count_val, $hours_val);
                $row_count_total += $count_val;
                $row_hours_total += $hours_val;
                $col_count_total[$c] += $count_val;
                $col_hours_total[$c] += $hours_val;
            } else {
                echo "<td>&nbsp;</td>\n";
            }
        }
        cell($row_count_total, $row_hours_total);
        echo "</tr>\n";
        $grand_count_total += $row_count_total;
        $grand_hours_total += $row_hours_total;
    }
    echo "<tr><td class=\"BR\" align=right><b>" . get_vocab("total") . "</b></td>\n";
    for ($c = 0; $c < $n_rooms; $c++) {
        cell($col_count_total[$c], $col_hours_total[$c]);
    }
    cell($grand_count_total, $grand_hours_total);
    echo "</tr></table>\n";
}
Example #4
0
 insert($t, $c = cell());
 insert($c, text($row["minimum"]));
 $export->addCell($row["minimum"]);
 insert($t, $c = cell());
 insert($c, block("<small>"));
 insert($c, block($result->UserTimeStamp($row["lastmod"], "M d Y H:i:s")));
 $export->addCell($row["lastmod"]);
 insert($c, block("<br>"));
 insert($c, block($result->UserTimeStamp($row["lastexp"], "M d Y H:i:s")));
 insert($c, block("</small>"));
 $export->addCell($row["lastexp"]);
 insert($t, $c = cell());
 insert($c, text($row["userid"]));
 $export->addCell($row["userid"]);
 $export->saveRow();
 insert($t, $c = cell());
 insert($c, block("<small>"));
 insert($c, anchor($_SERVER["PHP_SELF"] . "?cust={$cust}&dataid=" . $row["data_id"] . "&action=delete&domain=" . urlencode($row["domain"]), my_("Delete DNS Zone"), $ipplanParanoid ? array("onclick" => "return confirm('" . my_("Are you sure?") . "')") : FALSE));
 insert($c, block(" | "));
 insert($c, anchor("modifydnsform.php?cust={$cust}&dataid=" . $row["data_id"] . "&action=edit" . "&domain=" . urlencode($row["domain"]) . "&responsiblemail=" . urlencode($row["responsiblemail"]) . "&serialdate=" . $row["serialdate"] . "&serialnum=" . $row["serialnum"] . "&ttl=" . $row["ttl"] . "&retry=" . $row["retry"] . "&refresh=" . $row["refresh"] . "&expire=" . $row["expire"] . "&minimum=" . $row["minimum"] . "&slaveonly=" . $row["slaveonly"] . "&zonepath=" . urlencode($row["zonefilepath1"]) . "&seczonepath=" . urlencode($row["zonefilepath2"]), my_("Edit DNS Zone")));
 insert($c, block(" | "));
 insert($c, anchor($_SERVER["PHP_SELF"] . "?cust={$cust}&dataid=" . $row["data_id"] . "&action=export" . "&domain=" . urlencode($row["domain"]) . "&responsiblemail=" . urlencode($row["responsiblemail"]) . "&serialdate=" . $row["serialdate"] . "&serialnum=" . $row["serialnum"] . "&ttl=" . $row["ttl"] . "&retry=" . $row["retry"] . "&refresh=" . $row["refresh"] . "&expire=" . $row["expire"] . "&minimum=" . $row["minimum"] . "&slaveonly=" . $row["slaveonly"] . "&zonepath=" . urlencode($row["zonefilepath1"]) . "&seczonepath=" . urlencode($row["zonefilepath2"]), my_("Export DNS Zone"), $ipplanParanoid ? array("onclick" => "return confirm('" . my_("Are you sure to Export?") . "')") : FALSE));
 // have zone records been modified
 if ($row["error_message"] == "E") {
 }
 insert($c, block(" | "));
 insert($c, anchor("whois.php?lookup=" . urlencode($row["domain"]), my_("Whois")));
 insert($c, block("</small>"));
 if ($totcnt % MAXTABLESIZE == MAXTABLESIZE - 1) {
     break;
 }
Example #5
0
function row() {
	echo '<tr>';
	foreach (func_get_args() as $arg) {
		cell($arg);
	}
	echo '</tr>';
}
Example #6
0
function searchOverlap($ds, &$w, $cust1, $cust2)
{
    global $block;
    // dont trust variables
    $cust1 = floor($cust1);
    $cust2 = floor($cust2);
    $custdescrip1 = $ds->GetCustomerDescrip($cust1);
    $custdescrip2 = $ds->GetCustomerDescrip($cust2);
    // this query is not quick as indexes cannot be used!!!
    // must have first baseaddr called baseaddr else block pager
    // will not work - may break databases other than mysql
    $result =& $ds->ds->Execute("SELECT t1.baseaddr AS baseaddr,\n                           t1.baseindex AS baseindex1,\n                           t1.subnetsize AS subnetsize1,\n                           t1.descrip AS descrip1,\n                           t2.baseaddr AS baseaddr2,\n                           t2.baseindex AS baseindex2,\n                           t2.subnetsize AS subnetsize2,\n                           t2.descrip AS descrip2\n                        FROM base t1, base t2\n                        WHERE ((t1.baseaddr BETWEEN t2.baseaddr AND\n                                t2.baseaddr+t2.subnetsize-1) OR\n                               (t1.baseaddr+t1.subnetsize-1\n                                BETWEEN t2.baseaddr AND\n                                        t2.baseaddr+t2.subnetsize-1) OR\n                               (t1.baseaddr < t2.baseaddr AND\n                                t1.baseaddr+t1.subnetsize >\n                                t2.baseaddr+t2.subnetsize)) AND\n                               t1.customer={$cust1} AND\n                                t2.customer={$cust2}\n                        ORDER BY t1.baseaddr");
    $totcnt = 0;
    $vars = "";
    // fastforward till first record if not first block of data
    while ($block and $totcnt < $block * MAXTABLESIZE and $row = $result->FetchRow()) {
        $vars = DisplayBlock($w, $row, $totcnt, "&cust1[]=" . $cust1 . "&cust2[]=" . $cust2);
        $totcnt++;
    }
    insert($w, block("<p>"));
    $cnt = 0;
    while ($row = $result->FetchRow()) {
        // draw heading only if there are records to display
        if ($cnt == 0) {
            // create a table
            insert($w, $t = table(array("cols" => "8", "class" => "outputtable")));
            // draw heading
            setdefault("cell", array("class" => "heading"));
            insert($t, $c = cell(array("colspan" => "4")));
            insert($c, block("<center>"));
            insert($c, text($custdescrip1));
            insert($c, block("</center>"));
            insert($t, $c = cell(array("colspan" => "4")));
            insert($c, block("<center>"));
            insert($c, text($custdescrip2));
            insert($c, block("</center>"));
            insert($t, $c = cell());
            if (!empty($vars)) {
                insert($c, anchor($vars, "<<"));
            }
            insert($c, text(my_("Base address")));
            insert($t, $c = cell());
            insert($c, text(my_("Subnet size")));
            insert($t, $c = cell());
            insert($c, text(my_("Subnet mask")));
            insert($t, $c = cell());
            insert($c, text(my_("Description")));
            insert($t, $c = cell());
            insert($c, text(my_("Base address")));
            insert($t, $c = cell());
            insert($c, text(my_("Subnet size")));
            insert($t, $c = cell());
            insert($c, text(my_("Subnet mask")));
            insert($t, $ck = cell());
            insert($ck, text(my_("Description")));
            setdefault("cell", array("class" => color_flip_flop()));
        }
        // customer 1
        if ($row["subnetsize1"] == 1) {
            insert($t, $c = cell());
            insert($c, text(inet_ntoa($row["baseaddr"])));
        } else {
            insert($t, $c = cell());
            insert($c, anchor("displaysubnet.php?baseindex=" . $row["baseindex1"], inet_ntoa($row["baseaddr"])));
        }
        if ($row["subnetsize1"] == 1) {
            insert($t, $c = cell());
            insert($c, text("Host"));
        } else {
            insert($t, $c = cell());
            insert($c, text($row["subnetsize1"]));
        }
        insert($t, $c = cell());
        insert($c, text(inet_ntoa(inet_aton(ALLNETS) + 1 - $row["subnetsize1"]) . "/" . inet_bits($row["subnetsize1"])));
        insert($t, $c = cell());
        insert($c, text($row["descrip1"]));
        // customer 2
        if ($row["subnetsize2"] == 1) {
            insert($t, $c = cell());
            insert($c, text(inet_ntoa($row["baseaddr2"])));
        } else {
            insert($t, $c = cell());
            insert($c, anchor("displaysubnet.php?baseindex=" . $row["baseindex2"], inet_ntoa($row["baseaddr2"])));
        }
        if ($row["subnetsize2"] == 1) {
            insert($t, $c = cell());
            insert($c, text(my_("Host")));
        } else {
            insert($t, $c = cell());
            insert($c, text($row["subnetsize2"]));
        }
        insert($t, $c = cell());
        insert($c, text(inet_ntoa(inet_aton(ALLNETS) + 1 - $row["subnetsize2"]) . "/" . inet_bits($row["subnetsize2"])));
        insert($t, $c = cell());
        insert($c, text($row["descrip2"]));
        if ($totcnt % MAXTABLESIZE == MAXTABLESIZE - 1) {
            break;
        }
        $cnt++;
        $totcnt++;
    }
    insert($w, block("<p>"));
    if ($cnt) {
        $vars = "";
        $printed = 0;
        while ($row = $result->FetchRow()) {
            $totcnt++;
            $vars = DisplayBlock($w, $row, $totcnt, "&cust1[]=" . $cust1 . "&cust2[]=" . $cust2);
            if (!empty($vars) and !$printed) {
                insert($ck, anchor($vars, ">>"));
                $printed = 1;
            }
        }
    }
}
Example #7
0
$grps = $auth->authenticate();
// set language
isset($_COOKIE["ipplanLanguage"]) && myLanguage($_COOKIE['ipplanLanguage']);
$title = my_("Display subnet information");
newhtml($p);
$myWwwPath = '../menus/';
$w = myheading($p, $title);
insert($w, generic("link", array("rel" => "stylesheet", "href" => "{$myWwwPath}" . "layerstreemenu.css")));
insert($w, generic("link", array("rel" => "stylesheet", "href" => "{$myWwwPath}" . "layerstreemenu-hidden.css")));
insert($w, script("", array("language" => "JavaScript", "type" => "text/javascript", "src" => $myWwwPath . 'libjs/layerstreemenu-cookies.js')));
// display opening text
insert($w, heading(3, my_("Display subnets.")));
insert($w, text(my_("Click on customer/AS to display all associated subnets, click on the area to display all subnets in area and contained ranges, click on a range to display only subnets associated with that range. Subnets not within an area or range can be viewed by selecting the customer/AS.")));
insert($w, block("<p><hr>"));
insert($w, $t = table(array("cols" => "1", "width" => "100%", "border" => "1", "cellspacing" => "2", "frame" => "void", "rules" => "ALL", "cellpadding" => "5")));
insert($t, $leftmenu = cell(array("align" => "left", "width" => "100%", "valign" => "top")));
//read the database and create the strings containing the menus
$ds = new IPplanDbf() or myError($w, $p, my_("Could not connect to database"));
@set_time_limit(90);
// default is collapsed, change to "1" for expanded tree
// value is stored in a cookie so clear cookies to see effect
$expanded = "";
$displayall = FALSE;
$menustring = "";
if ($custresult = $ds->GetCustomerGrp(0)) {
    $adminuser = $ds->TestGrpsAdmin($grps);
    //customer
    while ($custrow = $custresult->Fetchrow()) {
        // remove all from list if global searching is not available
        if (!$displayall and strtolower($custrow["custdescrip"]) == "all") {
            continue;
Example #8
0
 public static function help($params = array())
 {
     $cli = new BedrockYAML(self::$script_dir . "/code/lib/_cli.yml");
     $allowed_actions = $cli->getAllowedActions();
     say(cell("Command", 20, true, "grey", "on_white") . cell("Description", 50, true, "grey", "on_white") . cell("Options", 50, true, "grey", "on_white"));
     foreach ($allowed_actions as $a) {
         $options = array();
         foreach ($a->getOptions() as $o) {
             $options[] = "[" . $o->get('arg') . "] ";
             foreach ($o->get('description') as $line) {
                 $options[] = $line;
             }
             $options[] = "";
         }
         array_pop($options);
         $descriptions = $a->getDescription()->toArray();
         $source = sizeof($options) > sizeof($descriptions) ? $options : $descriptions;
         for ($i = 0; $i < sizeof($source); $i++) {
             $cmd = $i == 0 ? $a->getKey() : "";
             state(cell($cmd, 20, false));
             $desc = isset($descriptions[$i]) ? $descriptions[$i] : "";
             $opt = isset($options[$i]) ? $options[$i] : "";
             state(cell($desc, 50, false));
             state(cell($opt, 50, false));
             state("\n");
         }
         say(cell("", 20) . cell("", 50) . cell("", 50));
     }
 }
function qs_process_agents($agent = null)
{
    if (!$agent) {
        return;
    }
    echo '<table border cellspacing="0">';
    echo rawurlencode(cell($agent, 'caption') . "\n");
    echo qs_header(array('ip', 'month', 'access', 'page', 'country', 'agent', 'search', 'ns', 'name', 'val'));
    $date = rawurldecode($_POST['date']);
    $agents = qs_agent_search_i($agent, $date);
    qs_output_agents($agents, $date);
    $keys = array_keys($_POST);
    foreach ($keys as $key) {
        if (strpos($key, 'date_') !== false) {
            $date = rawurldecode($_POST[$key]);
            $agents = qs_agent_search_i($agent, $date);
            qs_output_agents($agents, $date);
        }
    }
    echo '</table>';
}
Example #10
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;
}
Example #11
0
function insertEditGroupForm($w, $ds)
{
    list($ipaddr, $size, $grp) = myRegister("S:ipaddr S:size S:grp");
    $result =& $ds->ds->Execute("SELECT * FROM grp WHERE grp=" . $ds->ds->qstr($grp));
    $row = $result->FetchRow();
    $grpdescrip = $row["grpdescrip"];
    $createcust = $row["createcust"];
    $grpopt = $row["grpopt"];
    $resaddr = $row["resaddr"];
    insert($w, $t = table(array("width" => "100%", "cols" => "2", "border" => "0", "cellspacing" => "0", "valign" => "middle")));
    insert($t, $c = cell());
    insert($c, block("<b>"));
    insert($c, text(my_("Editing Group:") . " {$grp}"));
    insert($c, block("</b><br>"));
    insert($c, block("<i>" . my_(" Description: ") . "</i>"));
    insert($c, text($grpdescrip));
    insert($w, generic("br"));
    insert($t, $c = cell(array("align" => "right")));
    insert($c, $f = form(array("method" => "post", "action" => $_SERVER["PHP_SELF"])));
    insert($f, hidden(array("name" => "action", "value" => "deletegroup")));
    insert($f, hidden(array("name" => "grp", "value" => "{$grp}")));
    insert($f, submit(array("value" => my_("Delete Group"))));
    // MODIFY GROUP FORM
    insert($w, $f1 = form(array("method" => "post", "action" => $_SERVER["PHP_SELF"])));
    insert($f1, $con = container("fieldset", array("class" => "fieldset")));
    insert($con, $legend = container("legend", array("class" => "legend")));
    insert($legend, text(my_("Modify group")));
    insert($con, hidden(array("name" => "grp", "value" => "{$grp}")));
    insert($con, hidden(array("name" => "action", "value" => "modifygroup")));
    insert($con, textbr(my_("Group description:")));
    insert($con, input_text(array("name" => "grpdescrip", "value" => "{$grpdescrip}", "size" => "80", "maxlength" => "80")));
    insert($con, textbrbr(my_("Group can create/modify/delete customers?")));
    insert($con, selectbox(array("N" => my_("No"), "Y" => my_("Yes")), array("name" => "createcust"), $createcust));
    insert($con, textbrbr(my_("Group can view any customers data?")));
    // first bit defines view capability
    insert($con, selectbox(array("N" => my_("No"), "Y" => my_("Yes")), array("name" => "grpview"), $grpopt & 1 ? "Y" : "N"));
    insert($con, textbrbr(my_("Number of reserved addresses at start of subnets:")));
    insert($con, span(my_("NOTE: if the user belongs to multiple groups and one of the groups does not contain a reserved limit, then the user is allowed all actions"), array("class" => "textSmall")));
    insert($con, input_text(array("name" => "resaddr", "value" => "{$resaddr}", "size" => "4", "maxlength" => "4")));
    insert($con, generic("br"));
    insert($con, generic("br"));
    insert($con, submit(array("value" => my_("Update"))));
    insert($con, generic("br"));
    // START Add User Form
    $result1 =& $ds->ds->Execute("SELECT userid\n            FROM users\n            ORDER BY userid");
    $c = 0;
    $lst = array();
    while ($row = $result1->FetchRow()) {
        $col = $row["userid"];
        $lst["{$col}"] = $row["userid"];
        $c++;
        // here
    }
    if ($c > 0) {
        insert($w, $con = container("fieldset", array("class" => "fieldset")));
        insert($con, $legend = container("legend", array("class" => "legend")));
        insert($legend, text(my_("User Membership")));
        insert($con, $f2 = form(array("name" => "ENTRY", "method" => "post", "action" => $_SERVER["PHP_SELF"])));
        insert($f2, selectbox($lst, array("name" => "userid")));
        insert($f2, hidden(array("name" => "action", "value" => "addusertogroup")));
        insert($f2, hidden(array("name" => "refpage", "value" => "grp")));
        insert($f2, hidden(array("name" => "grp", "value" => "{$grp}")));
        insert($f2, submit(array("value" => my_("Add User"))));
        // Edit users assigned to the group.
        $result =& $ds->ds->Execute("SELECT * FROM usergrp WHERE grp=" . $ds->ds->qstr($grp));
        $lst = array();
        while ($row = $result->FetchRow()) {
            $col = $row["userid"];
            $lst["{$col}"] = $row["userid"];
        }
        if (!empty($lst)) {
            insert($con, $t = table(array("cols" => "2")));
            //insert($con,$t = table(array("cols"=>"2", "class"=>"outputtable")));
            //setdefault("cell",array("class"=>"heading"));
            insert($t, $c = cell());
            insert($c, text(my_("Current Members")));
            insert($t, $c = cell());
            $icecream = 0;
            foreach ($lst as $u) {
                //setdefault("cell",array("class"=>color_flip_flop()));
                $icecream++;
                insert($t, $c = cell());
                insert($c, block("{$u}"));
                insert($t, $c = cell());
                insert($c, $f = form(array("name" => "userkill{$icecream}", "method" => "post", "action" => $_SERVER["PHP_SELF"])));
                insert($f, hidden(array("name" => "action", "value" => "deleteuserfromgroup")));
                insert($f, hidden(array("name" => "userid", "value" => "{$u}")));
                insert($f, hidden(array("name" => "grp", "value" => "{$grp}")));
                insert($f, hidden(array("name" => "refpage", "value" => "grp")));
                insert($c, block("<a href='#' onclick='userkill{$icecream}.submit();'>" . my_("Remove From Group") . "</a>"));
            }
        }
    }
    insert($w, generic("br"));
    // Ok.  How bout adding bounds to the group???
    insert($w, $con = container("fieldset", array("class" => "fieldset")));
    insert($con, $legend = container("legend", array("class" => "legend")));
    insert($con, textbr(my_("NOTE: if the user belongs to multiple groups and one of the groups does not contain authority boundaries, then the user is allowed all actions")));
    insert($legend, text(my_("Authority Boundaries")));
    insert($con, $f2 = form(array("name" => "ENTRY", "method" => "post", "action" => $_SERVER["PHP_SELF"])));
    insert($f2, hidden(array("name" => "grp", "value" => "{$grp}")));
    insert($f2, hidden(array("name" => "action", "value" => "addgroupboundary")));
    insert($f2, text(my_("Authority boundary start address")));
    // from previous post?
    if ($ipaddr == "0.0.0.0") {
        $ipaddr = "";
    }
    insert($f2, input_text(array("name" => "ipaddr", "value" => "{$ipaddr}", "size" => "15", "maxlength" => "15")));
    insert($f2, generic("br"));
    insert($f2, text(my_("Authority size/mask")));
    insert($f2, selectbox(array("4" => "255.255.255.252/30 - 4 hosts", "8" => "255.255.255.248/29 - 8 hosts", "16" => "255.255.255.240/28 - 16 hosts", "32" => "255.255.255.224/27 - 32 hosts", "64" => "255.255.255.192/26 - 64 hosts", "128" => "255.255.255.128/25 - 128 hosts", "256" => "255.255.255.0/24 - 256 hosts (class C)", "512" => "255.255.254.0/23 - 512 hosts", "1024" => "255.255.252.0/22 - 1k hosts", "2048" => "255.255.248.0/21 - 2k hosts", "4096" => "255.255.240.0/20 - 4k hosts", "8192" => "255.255.224.0/19 - 8k hosts", "16384" => "255.255.192.0/18 - 16k hosts", "32768" => "255.255.128.0/17 - 32k hosts", "65536" => "255.255.0.0/16 - 64k hosts (class B)", "16777216" => "255.0.0.0/8 - 16m hosts (class A)"), array("name" => "size"), $size));
    insert($f2, submit(array("value" => my_("Add Boundary"))));
    // add readonly button
    insert($con, $f2 = form(array("name" => "READONLY", "method" => "post", "action" => $_SERVER["PHP_SELF"])));
    insert($f2, hidden(array("name" => "ipaddr", "value" => "0.0.0.0")));
    insert($f2, hidden(array("name" => "size", "value" => "0")));
    insert($f2, hidden(array("name" => "grp", "value" => "{$grp}")));
    insert($f2, hidden(array("name" => "action", "value" => "addgroupboundary")));
    insert($f2, submit(array("value" => my_("Read only group"))));
    insert($f2, generic("br"));
    $result =& $ds->ds->Execute("SELECT boundsaddr, boundssize, grp\n            FROM bounds\n            WHERE grp=" . $ds->ds->qstr($grp) . "\n            ORDER BY boundsaddr");
    // logic here is:
    // boundsaddr=0 and boundssize=0 -> then this is a read only group
    // boundsaddr=0 and boundssize>0 -> number of addresses this group is not allowed to edit
    //                                        at start of subnets
    // boundsaddr>1 and boundssize>0 -> normal bounds within which this group can edit subnets
    //                                      and ip addresses
    $tricky = 0;
    while ($row = $result->FetchRow()) {
        // create a table
        if ($tricky == 0) {
            ++$tricky;
            insert($con, $t = table(array("cols" => "3")));
            // draw heading
            insert($t, $c = cell());
            insert($c, text(my_("Current Boundaries")));
            insert($t, $c = cell());
            insert($t, $c = cell());
        }
        insert($t, $c = cell());
        if ($row["boundsaddr"] == 0) {
            insert($c, text(my_("Read only group")));
            insert($t, $c = cell());
        } else {
            insert($c, text(inet_ntoa($row["boundsaddr"])));
            insert($t, $c = cell());
            insert($c, text(inet_ntoa(inet_aton(ALLNETS) + 1 - $row["boundssize"]) . "/" . inet_bits($row["boundssize"])));
        }
        insert($t, $c = cell());
        list($ipplanParanoid) = myRegister("I:ipplanParanoid");
        insert($c, anchor("usermanager.php?action=deletegroupboundary&grp=" . urlencode($row["grp"]) . "&boundsaddr=" . $row["boundsaddr"], my_("Delete boundary"), $ipplanParanoid ? array("onclick" => "return confirm('" . my_("Are you sure?") . "')") : FALSE));
        if ($row["boundsaddr"] == 0) {
            break;
        }
    }
    insert($w, generic("br"));
}
Example #12
0
function WriteForumTableContents()
{
    $cats = array();
    $rCats = Query("SELECT * FROM {categories} ORDER BY corder, id");
    $forums = array();
    if (NumRows($rCats)) {
        while ($cat = Fetch($rCats)) {
            $cats[$cat['id']] = $cat;
        }
        $rForums = Query("SELECT * FROM {forums} ORDER BY forder, id");
        $forums = array();
        if (NumRows($rForums)) {
            while ($forum = Fetch($rForums)) {
                $forums[$forum['id']] = $forum;
            }
        }
    }
    $hint = '';
    //$cats ? __("Hint: Click a forum or category to select it.") : '';
    $newforum = $cats ? '<button onclick="newForum();">' . __("Add Forum") . '</button>' : '';
    $buttons = '
	<tr class="cell2">
		<td>
			<span style="float: right;">' . $newforum . '<button onclick="newCategory();">' . __("Add Category") . '</button>
			</span>' . $hint . '
		</td>
	</tr>';
    print '
	<table class="outline margin" style="width: 45%;">
	<tr class="header1">
		<th>
			' . __("Edit forum list") . '
		</th>
	</tr>';
    print $buttons;
    foreach ($forums as $forum) {
        $cats[$forum['catid']]['forums'][$forum['id']] = $forum;
    }
    echo '<tr class="header0"><th>Main forums</th></tr>';
    foreach ($cats as $cid => $cat) {
        if ($cid < 0) {
            continue;
        }
        $cname = $cat['name'];
        print '
	<tbody id="cat' . $cat['id'] . '" class="c">
		<tr class="cell' . cell() . '">
			<td class="c" style="cursor: pointer;" onmousedown="pickCategory(' . $cat['id'] . ');">
				<strong>' . htmlspecialchars($cname) . '</strong>
			</td>
		</tr>';
        writeForums($cats, $cid, 1);
        print "</tbody>";
    }
    if ($forums) {
        print $buttons;
    }
    print '</table>';
}
Example #13
0
$title = __("Administration");
$key = hash('sha256', "{$loguserid},{$loguser['pss']},{$salt}");
$cell = 1;
function cell($content)
{
    global $cell;
    $cell = $cell == 1 ? 0 : 1;
    Write("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t</tr>\n\t", $cell, $content);
}
Write("\n\t<table class=\"outline margin width50\" style=\"float: right;\">\n\t\t<tr class=\"header1\">\n\t\t\t<th colspan=\"2\">\n\t\t\t\t" . __("Information") . "\n\t\t\t</th>\n\t\t</tr>\n");
cell(Format("\n\t\t\t\n\t\t\t\t" . __("Last viewcount milestone") . "\n\t\t\t</td>\n\t\t\t<td style=\"width: 60%;\">\n\t\t\t\t{0}\n\t\t\t", $misc['milestone']));
$bucket = "adminright";
include "./lib/pluginloader.php";
write("\n\t</table>\n");
$cell = 1;
Write("\n\t<table class=\"outline margin width25\">\n\t\t<tr class=\"header1\">\n\t\t\t<th>\n\t\t\t\t" . __("Admin tools") . "\n\t\t\t</th>\n\t\t</tr>\n");
cell("<a href=\"recalc.php\">" . __("Recalculate statistics") . "</a>");
cell("<a href=\"lastknownbrowsers.php\">" . __("Last Known Browsers") . "</a> " . __("(not admin-only)"));
cell("<a href=\"editpora.php\">" . __("Edit Points of Required Attention") . "</a>");
cell("<a href=\"ipbans.php\">" . __("Manage IP bans") . "</a>");
cell("<a href=\"managemods.php\">" . __("Manage local moderator assignments") . "</a>");
cell("<a href=\"editfora.php?key=" . $key . "\">" . __("Edit forum list") . "</a>");
cell("<a href=\"editcats.php\">" . __("Edit category list") . "</a>");
cell("<a href=\"editsettings.php\">" . __("Edit settings") . "</a>");
cell("<a href=\"optimize.php\">" . __("Optimize tables") . "</a>");
cell("<a href=\"log.php\">" . __("View log") . "</a>");
//if($loguser['powerlevel'] == 4)
//	cell("<a href=\"sql.php\">".__("SQL Console")."</a>");
$bucket = "adminleft";
include "./lib/pluginloader.php";
write("\n\t</table>\n");
Example #14
0
<table summary="<?php 
echo _('List of table cells with differing background colours representing examplary dictionary states');
?>
">
 <caption><?php 
include_once 'data.php';
echo _("Color Legend") . "</caption>\n";
function cell($status, $description)
{
    echo ' <tr><td bgcolor="' . status2color($status) . '">';
    echo "{$description}</td></tr>\n";
}
cell("stable", _("Dictionary Status was marked as 'stable'"));
cell("big enough to be useful", _("Dictionary Status was marked as 'big enough to be useful' (from 10000 entries on)"));
cell("too small", _("Dictionary Status was marked as 'too small' (less than 1000 entries)"));
cell("low quality", _("Dictionary Status was marked as 'low quality'"));
cell("unknown", _("Dictionary Status was not given or is 'unknown'"));
?>
</table>
<p><?php 
echo _("The numbers for the platform downloads represent the download\n  sizes in Megabytes.") . ' ' . _("A small 'u' instead of a download link means\n  that the respective dictionary is not supported on that platform.") . ' ' . _("This is currently always due to characters of the dictionary not being\n  encodable or displayable for/on the platform.");
?>
</p>

Example #15
0
function do_summary(&$count, &$hours, &$room_hash, &$name_hash)
{
    global $enable_periods;
    // Make a sorted array of area/rooms, and of names, to use for column
    // and row indexes. Use the rooms and names hashes built by accumulate().
    // At PHP4 we could use array_keys().
    reset($room_hash);
    while (list($room_key) = each($room_hash)) {
        $rooms[] = $room_key;
    }
    ksort($rooms);
    reset($name_hash);
    while (list($name_key) = each($name_hash)) {
        $names[] = $name_key;
    }
    ksort($names);
    $n_rooms = sizeof($rooms);
    $n_names = sizeof($names);
    echo "<div id=\"div_summary\">\n";
    echo "<h1>" . (empty($enable_periods) ? get_vocab("summary_header") : get_vocab("summary_header_per")) . "</h1>\n";
    echo "<table>\n";
    echo "<thead>\n";
    echo "<tr><th>&nbsp;</th>\n";
    for ($c = 0; $c < $n_rooms; $c++) {
        echo "<th colspan=\"2\">{$rooms[$c]}</th>\n";
        $col_count_total[$c] = 0;
        $col_hours_total[$c] = 0.0;
    }
    echo "<th colspan=\"2\"><br>" . get_vocab("total") . "</th></tr>\n";
    $grand_count_total = 0;
    $grand_hours_total = 0;
    echo "</thead>\n";
    echo "<tbody>\n";
    for ($r = 0; $r < $n_names; $r++) {
        $row_count_total = 0;
        $row_hours_total = 0.0;
        $name = $names[$r];
        echo "<tr><td>{$name}</td>\n";
        for ($c = 0; $c < $n_rooms; $c++) {
            $room = $rooms[$c];
            if (isset($count[$room][$name])) {
                $count_val = $count[$room][$name];
                $hours_val = $hours[$room][$name];
                cell($count_val, $hours_val);
                $row_count_total += $count_val;
                $row_hours_total += $hours_val;
                $col_count_total[$c] += $count_val;
                $col_hours_total[$c] += $hours_val;
            } else {
                echo "<td class=\"count\">&nbsp;</td><td>&nbsp;</td>\n";
            }
        }
        cell($row_count_total, $row_hours_total);
        echo "</tr>\n";
        $grand_count_total += $row_count_total;
        $grand_hours_total += $row_hours_total;
    }
    echo "<tr><td>" . get_vocab("total") . "</td>\n";
    for ($c = 0; $c < $n_rooms; $c++) {
        cell($col_count_total[$c], $col_hours_total[$c]);
    }
    cell($grand_count_total, $grand_hours_total);
    echo "</tr></tbody></table>\n";
    echo "</div>\n";
}
Example #16
0
function do_summary(&$count, &$hours, &$room_hash, &$breve_description_hash,$enable_periods,$decompte,$csv="n")
{
    global $vocab;
    if ($csv != "n") echo" ;";
    # Make a sorted array of area/rooms, and of names, to use for column
    # and row indexes. Use the rooms and names hashes built by accumulate().
    # At PHP4 we could use array_keys().
    reset($room_hash);
    while (list($room_key) = each($room_hash)) $rooms[] = $room_key;
    ksort($rooms);
    reset($breve_description_hash);
    while (list($breve_description_key) = each($breve_description_hash)) $breve_descriptions[] = $breve_description_key;
    ksort($breve_descriptions);
    $n_rooms = sizeof($rooms);
    $n_names = sizeof($breve_descriptions);

    // On affiche uniquement pour une sortie HTML
    if ($csv == "n") {
        if ($_GET["sumby"]=="6")
            $premiere_cellule = get_vocab("sum_by_creator");
        else if ($_GET["sumby"]=="3")
            $premiere_cellule = get_vocab("sum_by_descrip");
        else if ($_GET["sumby"]=="5")
            $premiere_cellule = get_vocab("type");
        else
            $premiere_cellule = grr_sql_query1("select fieldname from ".TABLE_PREFIX."_overload where id='".$_GET["sumby"]."'");

      if ($enable_periods == 'y')
        echo "<hr /><h1>".get_vocab("summary_header_per")."</h1><table border=\"2\" cellspacing=\"4\">\n";
      else
        echo "<hr /><h1>".get_vocab("summary_header")."</h1><table border=\"2\" cellspacing=\"4\">\n";
      echo "<tr><td class=\"BL\" align=\"left\"><b>".$premiere_cellule." \ ".get_vocab("room")."</b></td>\n";
    }

    for ($c = 0; $c < $n_rooms; $c++)
    {
        if ($csv == "n")
            echo "<td class=\"BL\" align=\"left\"><b>$rooms[$c]</b></td>\n";
        else
            echo "$rooms[$c];";

        $col_count_total[$c] = 0;
        $col_hours_total[$c] = 0.0;
    }
    if ($csv == "n")
         echo "<td class=\"BR\" align=\"right\"><br /><b>".get_vocab("total")."</b></td></tr>\n";
    else
        echo html_entity_decode_all_version($vocab['total']).";\r\n";

    $grand_count_total = 0;
    $grand_hours_total = 0;

    for ($r = 0; $r < $n_names; $r++)
    {
        $row_count_total = 0;
        $row_hours_total = 0.0;
        $breve_description = $breve_descriptions[$r];
        if ($csv == "n")
            echo "<tr><td class=\"BR\" align=\"right\"><b>$breve_description</b></td>\n";
        else
            echo "$breve_description;";
        for ($c = 0; $c < $n_rooms; $c++)
        {
            $room = $rooms[$c];
            if (isset($count[$room][$breve_description]))
            {
                $count_val = $count[$room][$breve_description];
                $hours_val = $hours[$room][$breve_description];
                cell($count_val, $hours_val, $csv,$decompte);
                $row_count_total += $count_val;
                $row_hours_total += $hours_val;
                $col_count_total[$c] += $count_val;
                $col_hours_total[$c] += $hours_val;
            } else {
                if ($csv == "n")
                    echo "<td>&nbsp;</td>\n";
                else
                    echo ";";
            }
        }
        cell($row_count_total, $row_hours_total, $csv,$decompte);
        if ($csv == "n")
            echo "</tr>\n";
        else
            echo "\r\n";
        $grand_count_total += $row_count_total;
        $grand_hours_total += $row_hours_total;
    }
    if ($csv == "n")
        echo "<tr><td class=\"BR\" align=\"right\"><b>".get_vocab("total")."</b></td>\n";
    else
        echo html_entity_decode_all_version($vocab['total']).";";
    for ($c = 0; $c < $n_rooms; $c++)
        cell($col_count_total[$c], $col_hours_total[$c], $csv,$decompte);
    cell($grand_count_total, $grand_hours_total, $csv,$decompte);
    if ($csv == "n") echo "</tr></table>\n";
}
Example #17
0
function do_summary(&$count, &$hours, &$room_hash, &$breve_description_hash, $enable_periods, $decompte, $csv = "n")
{
    global $vocab;
    if ($csv != "n") {
        echo " ;";
    }
    // Make a sorted array of area/rooms, and of names, to use for column
    // and row indexes. Use the rooms and names hashes built by accumulate().
    // At PHP4 we could use array_keys().
    reset($room_hash);
    $rooms = array();
    while (list($room_key) = each($room_hash)) {
        $rooms[] = $room_key;
    }
    ksort($rooms);
    reset($breve_description_hash);
    $breve_descriptions = array();
    while (list($breve_description_key) = each($breve_description_hash)) {
        $breve_descriptions[] = $breve_description_key;
    }
    ksort($breve_descriptions);
    $n_rooms = sizeof($rooms);
    $n_names = sizeof($breve_descriptions);
    // On affiche uniquement pour une sortie HTML
    if ($csv == "n") {
        if ($_GET["sumby"] == "6") {
            $premiere_cellule = get_vocab("sum_by_creator");
        } else {
            if ($_GET["sumby"] == "3") {
                $premiere_cellule = get_vocab("sum_by_descrip");
            } else {
                if ($_GET["sumby"] == "5") {
                    $premiere_cellule = get_vocab("type");
                } else {
                    $premiere_cellule = grr_sql_query1("SELECT fieldname FROM " . TABLE_PREFIX . "_overload WHERE id='" . $_GET["sumby"] . "'");
                }
            }
        }
        if ($enable_periods == 'y') {
            echo "<hr /><h1>" . get_vocab("summary_header_per") . "</h1><table class=\"table table-bordered table-striped\">\n";
        } else {
            echo "<hr /><h1>" . get_vocab("summary_header") . "</h1><table class=\"table table-bordered table-striped\">\n";
        }
        echo "<tr><td class=\"BL\" align=\"left\"><b>" . $premiere_cellule . " \\ " . get_vocab("room") . "</b></td>\n";
    }
    $col_count_total = array();
    $col_hours_total = array();
    for ($c = 0; $c < $n_rooms; $c++) {
        if ($csv == "n") {
            echo "<td class=\"BL\" align=\"left\"><b>{$rooms[$c]}</b></td>\n";
        } else {
            echo "{$rooms[$c]};";
        }
        $col_count_total[$c] = 0;
        $col_hours_total[$c] = 0.0;
    }
    if ($csv == "n") {
        echo "<td class=\"BR\" align=\"right\"><br /><b>" . get_vocab("total") . "</b></td></tr>\n";
    } else {
        echo html_entity_decode($vocab['total']) . ";\r\n";
    }
    $grand_count_total = 0;
    $grand_hours_total = 0;
    for ($r = 0; $r < $n_names; $r++) {
        $row_count_total = 0;
        $row_hours_total = 0.0;
        $breve_description = $breve_descriptions[$r];
        if ($csv == "n") {
            echo "<tr><td class=\"BR\" align=\"right\"><b>{$breve_description}</b></td>\n";
        } else {
            echo "{$breve_description};";
        }
        for ($c = 0; $c < $n_rooms; $c++) {
            $room = $rooms[$c];
            if (isset($count[$room][$breve_description])) {
                $count_val = $count[$room][$breve_description];
                $hours_val = $hours[$room][$breve_description];
                cell($count_val, $hours_val, $csv, $decompte);
                $row_count_total += $count_val;
                $row_hours_total += $hours_val;
                $col_count_total[$c] += $count_val;
                $col_hours_total[$c] += $hours_val;
            } else {
                if ($csv == "n") {
                    echo "<td> </td>\n";
                } else {
                    echo ";";
                }
            }
        }
        cell($row_count_total, $row_hours_total, $csv, $decompte);
        if ($csv == "n") {
            echo "</tr>\n";
        } else {
            echo "\r\n";
        }
        $grand_count_total += $row_count_total;
        $grand_hours_total += $row_hours_total;
    }
    if ($csv == "n") {
        echo "<tr><td class=\"BR\" align=\"right\"><b>" . get_vocab("total") . "</b></td>\n";
    } else {
        echo html_entity_decode($vocab['total']) . ";";
    }
    for ($c = 0; $c < $n_rooms; $c++) {
        cell($col_count_total[$c], $col_hours_total[$c], $csv, $decompte);
    }
    cell($grand_count_total, $grand_hours_total, $csv, $decompte);
    if ($csv == "n") {
        echo "</tr></table>\n";
    }
}
Example #18
0
    ?>
<tr><td><?php 
    echo $name;
    ?>
</td>
	<?php 
    cell($uid, 'L1');
    ?>
	<?php 
    cell($uid, 'L2');
    ?>
	<?php 
    cell($uid, 'R1');
    ?>
	<?php 
    cell($uid, 'R2');
    ?>
</tr>
<?php 
}
?>
</tbody>
</table>

<?php 
function cell($uid, $q)
{
    global $data;
    print '<td class="';
    if ($q == 'L1' and $data[$uid . '_L1']['total'] > $data[$uid . '_L2']['total'] and $data[$uid . '_L1']['total'] > $data[$uid . '_R1']['total'] and $data[$uid . '_L1']['total'] > $data[$uid . '_R2']['total']) {
        print 'top';