Exemple #1
0
        echo "<tr><td class='detail1'>No keys or keyrings associated</td></tr>\n";
    }
    //if(empty($nr_keys) and empty($nr_keyrings))
    // if keyring found
    if (!empty($nr_keyrings)) {
        while ($keyringrow = mysql_fetch_array($keyrings)) {
            display_keyring($keyringrow["id_host"], $keyringrow["id_account"], $keyringrow["id_keyring"], $groupname, "detail2", $keyringrow["expand"]);
        }
        //while ( $keyringrow = mysql_fetch_array($keyrings))
        mysql_free_result($keyrings);
    }
    //if(!empty($nr_keyrings))
    // if key found
    if (!empty($nr_keys)) {
        while ($keyrow = mysql_fetch_array($keys)) {
            display_key($keyrow["id_host"], $keyrow["id_account"], $keyrow["id_key"], $groupname, "detail1");
        }
        //while ( $keyrow = mysql_fetch_array($keys))
        mysql_free_result($keys);
    }
    //if(!empty($nr_keys))
    print "</tr></table></fieldset>";
    end_right_pane();
    end_main_frame();
    print "</body></html>";
} else {
    if (isset($_GET["id"])) {
        $id = $_GET["id"];
    }
    if (isset($_GET["id_account"])) {
        $id_account = $_GET["id_account"];
echo $user->firstname . ' ' . $user->lastname;
?>
</p>
<p class="printonly"><?php 
echo date('jS F Y', $now);
?>
</p>
<?php 
if (!array_key_exists('home', $_GET)) {
    echo '<p class="noprint"><a href="javascript:history.go(-1)">' . get_string('back', 'block_progress') . '</a></p>';
}
?>
<p class="noprint"><?php 
echo generate_group_links($course->id, 'summary_course.php');
?>
</p>
<?php 
if (array_key_exists('group', $_GET)) {
    $students = get_students($course->id, $_GET['prefix'], $_GET['group']);
} else {
    $students = get_students($course->id, $_GET['prefix']);
}
echo display_grid($CFG->prefix, $course->id, $students, $criteria);
echo display_key($CFG->prefix, $course->id, $criteria);
?>
<p class="noprint footer"><a href="#" onClick="window.print();return false"><?php 
print_string('print', 'block_progress');
?>
</a></p>
</body>
</html>
Exemple #3
0
if ($is_demo) {
    $redis->select(0);
} else {
    $redis->select($_SESSION['db_num']);
}
/***************************************************************************
 * 
 * handle actions
 *  
 */
switch ($action) {
    case "s":
        // show
        if (isset($_REQUEST["k"])) {
            $k = base64_decode($_REQUEST["k"]);
            display_key($k);
            die;
        }
        break;
    case "as":
        // add string
        if (isset($_REQUEST['key']) && isset($_REQUEST['val'])) {
            $redis->set($_REQUEST['key'], $_REQUEST['val']);
        }
        break;
    case "ah":
        // add hash
        if (isset($_REQUEST['key']) && isset($_REQUEST['val']) && isset($_REQUEST['hash'])) {
            $redis->hset($_REQUEST['hash'], $_REQUEST['key'], $_REQUEST['val']);
        }
        break;
Exemple #4
0
function display_keyring($id_host, $id_account, $id_keyring, $hostgroup, $ident_level, $display)
{
    // ident_level : level of identation to display element
    // display (Y/N) : display keys in current keyring
    $name_keyring = get_keyring_name($id_keyring);
    // Displaying rows
    if ($display == "N") {
        echo "<tr>\n";
        echo "  <td class='detail1'><a href=\"account-view.php?id={$id_host}&hostgroup={$hostgroup}&action=expandkeyring&id_account={$id_account}&id_keyring={$id_keyring}\"><img src='images/expand.gif' border='0'></a><img src='images/keyring_little.gif' border='0'>{$name_keyring} ";
        echo "<a href='account-view.php?id={$id_host}&id_account={$id_account}&id_keyring={$id_keyring}&action=deleteKeyring&hostgroup={$hostgroup}'>[ Delete ]</a></td>\n";
        echo "</tr>\n";
    } else {
        echo "<tr>\n";
        echo "  <td class='detail1'><a href=\"account-view.php?id={$id_host}&id_account={$id_account}&id_keyring={$id_keyring}&action=collapsekeyring&hostgroup={$hostgroup}\"><img src='images/collapse.gif' border='0'></a><img src='images/keyring_little.gif' border='0'>{$name_keyring} ";
        echo "<a href='account-view.php?id={$id_host}&id_account={$id_account}&id_keyring={$id_keyring}&action=deleteKeyring&hostgroup={$hostgroup}'>[ Delete ]</a></td>\n";
        echo "</tr>\n";
        // looking for keys
        $keys = mysql_query("SELECT * FROM `keyrings-keys` WHERE `id_keyring` = '{$id_keyring}'") or die(mysql_error() . "<br>Couldn't execute query: {$query}");
        $nr_keys = mysql_num_rows($keys);
        if (empty($nr_keys)) {
            //echo ("<tr><td class='$ident_level'>No keys associated</td><td class='$ident_level'></td></tr>\n");
            echo "<tr><td class='{$ident_level}'>No keys associated</td></tr>\n";
        } else {
            while ($keyrow = mysql_fetch_array($keys)) {
                // Afecting values
                //$name = $keyrow["name"];
                $id_key = $keyrow["id_key"];
                display_key($id_host, $id_account, $id_key, $hostgroup, $ident_level);
            }
            // end while
            mysql_free_result($keys);
        }
        //end if
    }
    //end if
}