예제 #1
0
function Register()
{
    if (!isset($_GET["new_login"]) or !isset($_GET["new_pass"]) or !isset($_GET["invite"])) {
        exit("Fields not set");
    }
    $new_login = CleanString($_GET["new_login"]);
    $new_pass = CleanString($_GET["new_pass"]);
    $invite = CleanString($_GET["invite"]);
    $good_code = ExecQueryAndReturnResult("SELECT `Valid` FROM `invites` WHERE `InviteCode` = '{$invite}'");
    if (count($good_code) == 1 and $good_code[0][0] == 1) {
        //проверим, есть ли уже пользователь с указанным именем
        $usersCount = ExecQueryAndReturnResult("Select Count(*) From `users` where `Login` = '{$new_login}'");
        if (count($usersCount) == 1 and $usersCount[0][0] == 0) {
            ExecQuery("INSERT INTO `users`(`Login`, `Password`) VALUES ('{$new_login}', '{$new_pass}')");
            ExecQuery("UPDATE `invites` SET `Valid`=0 WHERE `InviteCode` = '{$invite}'");
            $result = ExecQueryAndReturnResult("SELECT `Id` FROM `users` WHERE `Login` = '{$new_login}' and `Password` = '{$new_pass}' and `Banned` = 0");
            if (count($result) == 1) {
                session_start();
                $_SESSION['login_user'] = $result[0][0];
                echo "OK";
            }
        } else {
            echo "User with the same name already exist";
        }
    } else {
        echo "Wrong invite code";
    }
}
예제 #2
0
function SPITFORM($formfields, $errors)
{
    global $instance, $runidx, $TBDB_ARCHIVE_TAGLEN, $referrer;
    $iid = $instance->id();
    $runid = $instance->GetRunID($runidx);
    echo $instance->RunPageHeader($runidx);
    echo "<br><br><center>\n          Revise Record {$runid} in Instance {$iid} </center><br>\n";
    if ($errors) {
        echo "<table class=nogrid\n                     align=center border=0 cellpadding=6 cellspacing=0>\n              <tr>\n                 <th align=center colspan=2>\n                   <font size=+1 color=red>\n                      &nbsp;Oops, please fix the following errors!&nbsp;\n                   </font>\n                 </td>\n              </tr>\n";
        while (list($name, $message) = each($errors)) {
            # XSS prevention.
            $message = CleanString($message);
            echo "<tr>\n                     <td align=right>\n                       <font color=red>{$name}:&nbsp;</font></td>\n                     <td align=left>\n                       <font color=red>{$message}</font></td>\n                  </tr>\n";
        }
        echo "</table><br>\n";
    }
    # XSS prevention.
    while (list($key, $val) = each($formfields)) {
        $formfields[$key] = CleanString($val);
    }
    $url = CreateURL("record_revise", $instance, "runidx", $runidx);
    echo "<table align=center border=1> \n          <form action='{$url}' method=post>\n";
    if (isset($referrer)) {
        $url = urlencode($referrer);
        echo "<input type=hidden name=referrer value='{$url}'>\n";
    }
    echo "<tr>\n              <td align=center>\n               <b>Please enter a message to be logged\n                       with the revision</b>\n              </td>\n          </tr>\n          <tr>\n              <td align=center class=left>\n                  <textarea name=\"formfields[message]\"\n                    rows=10 cols=70>" . str_replace("\r", "", $formfields["message"]) . "</textarea>\n              </td>\n          </tr>\n";
    echo "<tr>\n              <td align=center>\n                 <b><input type=submit name=submit value='Revise Record'></b>\n              </td>\n          </tr>\n";
    echo "</form>\n          </table>\n";
    echo "<blockquote><blockquote>\n          <ul>\n            <li> This operation will update the end of run archive that was\n                 saved when the run originally completed. The original record\n                 will not be lost, and you can update as many times as you\n                 like.</li>\n          </ul>\n          </blockquote></blockquote>\n";
}
예제 #3
0
function SPITFORM($target_user, $new_uid, $error)
{
    global $TBDB_UIDLEN;
    $target_uid = $target_user->uid();
    $target_webid = $target_user->webid();
    $new_uid = CleanString($new_uid);
    #
    # Standard Testbed Header.
    #
    PAGEHEADER("Change login UID for user");
    if ($error) {
        # XSS prevention.
        $error = CleanString($error);
        echo "<center>\n              <font size=+1 color=red>{$error}</font>\n              </center><br>\n";
    } else {
        echo "<center>\n              <font size=+1>\n              Please enter the new UID for user '{$target_uid}'<br><br>\n              </font>\n              </center>\n";
    }
    echo "<table align=center border=1>\n          <form action=changeuid.php method=post>\n          <tr>\n              <td>New UID:</td>\n              <td><input type=text\n                         name=\"new_uid\"\n                         value=\"{$new_uid}\"\n\t                 size={$TBDB_UIDLEN}\n\t                 maxlength={$TBDB_UIDLEN}></td>\n          </tr>\n          <tr>\n             <td align=center colspan=2>\n                 <b><input type=submit value=\"Change UID\"\n                           name=submit></b>\n             </td>\n          </tr>\n\t  <input type=hidden name=user value={$target_webid}>\n          </form>\n          </table>\n";
    echo "<br><br>\n";
    echo "<center>\n";
    $target_user->Show();
    echo "</center>\n";
    PAGEFOOTER();
    return;
}
예제 #4
0
function SPITFORM($project, $message, $errors)
{
    global $this_user;
    $message = CleanString($message);
    if ($errors) {
        echo "<table class=nogrid\n                     align=center border=0 cellpadding=6 cellspacing=0>\n              <tr>\n                 <th align=center colspan=2>\n                   <font size=+1 color=red>\n                      &nbsp;Oops, please fix the following errors!&nbsp;\n                   </font>\n                 </td>\n              </tr>\n";
        while (list($name, $message) = each($errors)) {
            # XSS prevention.
            $message = CleanString($message);
            echo "<tr>\n                     <td align=right>\n                       <font color=red>{$name}:&nbsp;</font></td>\n                     <td align=left>\n                       <font color=red>{$message}</font></td>\n                  </tr>\n";
        }
        echo "</table><br>\n";
    }
    #
    # Show stuff
    #
    $project->Show();
    $url = CreateURL("resendapproval", $project);
    echo "<br>";
    echo "<table align=center border=1>\n";
    echo "<form action='{$url}' method='post'>\n";
    echo "<tr>\n              <td>Use the text box (70 columns wide) to add a message to the\n                  email notification. </td>\n          </tr>\n";
    echo "<tr>\n             <td align=center class=left>\n                 <textarea name=message rows=15 cols=70></textarea>\n             </td>\n          </tr>\n";
    echo "<tr>\n              <td align=center>\n                  <b><input type='submit' value='Submit' name='submit'></td>\n          </tr>\n          </form>\n          </table>\n";
}
예제 #5
0
파일: admin.php 프로젝트: omusico/Xion
             Client::SetAllInactive();
             $database->beginTransaction();
             // get the usernames of all the current clients
             $usernames = Client::GetUsernames();
             // for faster lookup
             $usernames_fast = array();
             foreach (array_values($usernames) as $v) {
                 $usernames_fast[$v] = 1;
             }
             while (($line = fgets($handle)) !== false) {
                 if (strpos($line, "#") === 0) {
                     continue;
                 }
                 $data = explode(",", $line);
                 $done = false;
                 $username = CleanString($data[1]);
                 if (isset($usernames_fast[$username])) {
                     // update current client
                     Client::EditByUsername($username, $data[0], $data[2], $data[3], $data[4]);
                 } else {
                     // add new client
                     Client::Add($data[0], $username, $data[2], $data[3], $data[4]);
                 }
             }
             fclose($handle);
             $database->commit();
             ShowInfo("Done");
             RedirectTimer("admin&amp;clients", 3);
         }
     }
 }
예제 #6
0
         $nb_pages = ceil($data[0] / $nb_elements);
         for ($i = 1; $i <= $nb_pages; $i++) {
             $pages .= '<td onclick=\'displayLogs(\\"copy_logs\\",' . $i . ', \'\')\'><span style=\'cursor:pointer;' . ($_POST['page'] == $i ? 'font-weight:bold;font-size:18px;\'>' . $i : '\'>' . $i) . '</span></td>';
         }
     }
     $pages .= '</tr></table>';
     //define query limits
     if (isset($_POST['page']) && $_POST['page'] > 1) {
         $start = $nb_elements * ($_POST['page'] - 1) + 1;
     } else {
         $start = 0;
     }
     //launch query
     $rows = $db->fetch_all_array("\r\n    \t    SELECT l.date AS date, u.login AS login, i.label AS label\r\n            FROM " . $pre . "log_items AS l\r\n            INNER JOIN " . $pre . "items AS i ON (l.id_item=i.id)\r\n            INNER JOIN " . $pre . "users AS u ON (l.id_user=u.id)\r\n            WHERE l.action = 'at_copy'" . $sql_filter . "\r\n            ORDER BY date DESC\r\n            LIMIT {$start}, {$nb_elements}");
     foreach ($rows as $reccord) {
         $label = explode('@', addslashes(CleanString($reccord['label'])));
         $logs .= '<tr><td>' . date($_SESSION['settings']['date_format'] . " " . $_SESSION['settings']['time_format'], $reccord['date']) . '</td><td align=\\"left\\">' . $label[0] . '</td><td align=\\"center\\">' . $reccord['login'] . '</td></tr>';
     }
     echo '[{"tbody_logs": "' . $logs . '" , "log_pages" : "' . $pages . '"}]';
     break;
     #----------------------------------
     #CASE display a full listing with items EXPRIED
 #----------------------------------
 #CASE display a full listing with items EXPRIED
 case "generate_renewal_listing":
     if ($_POST['period'] == "0") {
         $date = mktime(date('h'), date('i'), date('s'), date('m'), date('d'), date('y'));
     } else {
         if ($_POST['period'] == "1month") {
             $date = mktime(date('h'), date('i'), date('s'), date('m') + 1, date('d'), date('y'));
         } else {
function GetPublicationsResultSetByKeyWordsAdvanced($key_words, $oder_by)
{
    $result_set = array();
    $key_words_array = array();
    //$initial_keywords_array_items = explode(" ", strtoupper($key_words));
    foreach ($key_words as $initial_keywords_array_item) {
        if ($initial_keywords_array_item != "") {
            $key_words_array[] = $initial_keywords_array_item;
        }
    }
    if (count($key_words_array) > 0) {
        $db = new PDO('mysql:host=' . $_SESSION['DB_HOST'] . ';dbname=' . $_SESSION['DB_NAME'], $_SESSION['DB_USER'], $_SESSION['DB_PASSWORD'], array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
        switch ($oder_by) {
            case 'Date':
                $sql = "SELECT * FROM `bh_posts` where post_status = 'publish' and post_type = 'publication' ORDER BY `bh_posts`.`post_date` DESC ";
                break;
            case 'Popularity':
                $sql = "SELECT * FROM `bh_posts` LEFT OUTER JOIN `im_doc_popularity` ON `bh_posts`.`ID` = `im_doc_popularity`.`PostId` \n\t\t\t\t\t\twhere post_status = 'publish' and post_type = 'publication' ORDER BY Downloads DESC";
                break;
            default:
                $sql = "SELECT * FROM `bh_posts` where post_status='publish' and post_type='publication' ORDER BY  `bh_posts`.`post_date` DESC ";
                break;
        }
        $st = $db->query($sql);
        foreach ($st as $rec) {
            if (GetPostLanguage($rec['ID'], 'publication') == $_SESSION['Lang']) {
                $pblication_title = CleanString($rec['post_title']);
                $title_keywords = explode(" ", strtoupper($pblication_title));
                if (AndOperation($title_keywords, $key_words_array) == 1) {
                    $result_set[] = $rec['ID'];
                }
            }
        }
        $db = null;
    }
    return $result_set;
}
예제 #8
0
 // Prepare full line
 $html .= '<li class="';
 if ($can_move == 1) {
     $html .= 'item_draggable';
 } else {
     $html .= 'item';
 }
 $html .= '" id="' . $reccord['id'] . '">';
 if ($can_move == 1) {
     $html .= '<img src="includes/images/grippy.png" style="margin-right:5px;cursor:hand;" alt="" class="grippy"  />';
 } else {
     $html .= '<span style="margin-left:11px;"></span>';
 }
 $html .= $expiration_flag . '' . $perso . '&nbsp;<a id="fileclass' . $reccord['id'] . '" class="file" onclick="' . $action . '">' . stripslashes($reccord['label']);
 if (!empty($reccord['description'])) {
     $html .= '&nbsp;<font size=2px>[' . strip_tags(stripslashes(substr(CleanString($reccord['description']), 0, 30))) . ']</font>';
 }
 $html .= '</a>';
 // display quick icon shortcuts ?
 if (isset($_SESSION['settings']['copy_to_clipboard_small_icons']) && $_SESSION['settings']['copy_to_clipboard_small_icons'] == 1) {
     $item_login = '******' . $reccord['id'] . '" />';
     $item_pw = '<img src="includes/images/mini_lock_disable.png" id="icon_pw_' . $reccord['id'] . '" class="copy_clipboard" />';
     if ($display_item == true) {
         if (!empty($reccord['login'])) {
             $item_login = '******' . $reccord['id'] . '" class="copy_clipboard" title="' . $txt['item_menu_copy_login'] . '" />';
         }
         if (!empty($reccord['pw'])) {
             $item_pw = '<img src="includes/images/mini_lock_enable.png" id="icon_pw_' . $reccord['id'] . '" class="copy_clipboard" title="' . $txt['item_menu_copy_pw'] . '" />';
         }
     }
 }
예제 #9
0
파일: new_ticket.php 프로젝트: omusico/Xion
<?php

if (isset($_POST["ticket"])) {
    $clientid = CleanString($_POST["clientid"]);
    $description = $_POST["description"];
    if (!isset($_POST["tags"])) {
        ShowError("You must specify at least one tag!");
    } else {
        $tags = $_POST["tags"];
        $client = Client::GetByUsername($clientid);
        if (empty($clientid) || empty($description) || empty($tags)) {
            ShowError("One or more fields were empty!");
        } elseif (!$client->IsValid()) {
            ShowError("Invalid Client ID.");
        } else {
            $ticket = Ticket::Add($client->GetID(), $me->GetID(), $description, STATUS_OPENED, $tags, $client->GetBuilding(), Building::GetCommunity($client->GetBuilding()));
            $me->IncrementPoints(5);
            ShowInfo("Created Ticket Successfully");
            RedirectTimer("ticket&amp;id=" . $ticket->GetID(), 0);
        }
    }
} else {
    ?>

<form class="form-horizontal" role="form" method="post">
	<div class="row">
		<div class="col-lg-12">
			<div class="panel panel-default">
				<div class="panel-heading">
					Client Information
				</div>
예제 #10
0
파일: typeahead.php 프로젝트: omusico/Xion
<?php

// Called when TypeAhead autocomplete are updated
$data = array();
if (isset($_GET["un"])) {
    $un = CleanString($_GET["un"]);
    $client = Client::GetByUsername($un);
    if ($client->IsValid() && $client->IsActive()) {
        $data["name"] = $client->GetName();
        $data["building"] = $client->GetBuilding();
        $data["location"] = $client->GetLocation();
        $data["phone_number"] = $client->GetPhoneNumber();
        $data["community"] = Building::GetCommunity($client->GetBuilding());
    }
} else {
    if (isset($_GET["sq"])) {
        $query = CleanString($_GET["sq"]);
        $staffs = Staff::GetAll();
        foreach ($staffs as $staff) {
            if ($staff->IsActive() && strpos($staff->GetUsername(), $query) === 0) {
                array_push($data, $staff->GetUsername());
            }
        }
    } else {
        $query = CleanString($_GET["q"]);
        $data = Client::GetUsernameBeginsWith($query);
    }
}
echo json_encode($data);
예제 #11
0
             }
             array_push($items_id_list, array($reccord['id'], $pw, $reccord['login'], $display_item));
             $i++;
         }
         $id_managed = $reccord['id'];
     }
     $html .= '</ul>';
     echo 'document.getElementById(\'liste_des_items\').style.display = "";';
     echo 'document.getElementById(\'liste_des_items\').innerHTML = "' . addslashes($html) . '";';
     echo 'document.getElementById(\'arborescence\').innerHTML = "' . addslashes(substr($arbo_html, 0, strlen($arbo_html) - 3)) . '";';
     echo 'document.getElementById(\'selected_items\').value = "";';
     echo 'document.getElementById(\'hid_cat\').value = "' . $_POST['id'] . '";';
     // Build clipboard for pw
     foreach ($items_id_list as $cb_item) {
         if (!empty($cb_item[1]) && $cb_item[3] == 1 && !empty($cb_item[3])) {
             echo 'var clip = new ZeroClipboard.Client(); clip.setText( "' . CleanString(addslashes($cb_item[1])) . '" ); clip.addEventListener( "onMouseDown", function(client) {$("#message_box").html("' . $txt['pw_copied_clipboard'] . '").show().fadeOut(1000);});clip.glue(\'icon_pw_' . $cb_item[0] . '\');';
         } else {
             echo 'var clip = new ZeroClipboard.Client(); clip.setText(""); clip.glue(\'icon_pw_' . $cb_item[0] . '\');';
         }
         if (!empty($cb_item[2]) && $cb_item[3] == 1 && !empty($cb_item[3])) {
             echo 'var clip = new ZeroClipboard.Client(); clip.setText( "' . addslashes($cb_item[2]) . '" ); clip.addEventListener( "onMouseDown", function(client) {$("#message_box").html("' . $txt['login_copied_clipboard'] . '").show().fadeOut(1000);});clip.glue(\'icon_login_' . $cb_item[0] . '\');';
         } else {
             echo 'var clip = new ZeroClipboard.Client(); clip.setText(""); clip.glue(\'icon_login_' . $cb_item[0] . '\');';
         }
     }
     RecupDroitCreationSansComplexite($_POST['id']);
 } else {
     echo '$("#liste_des_items").css("display", "");';
     echo '$("#liste_des_items").html("");';
     echo '$("#arborescence").html("' . addslashes(substr($arbo_html, 0, strlen($arbo_html) - 3)) . '");';
     echo '$("#selected_items").val("");';
예제 #12
0
function GetAlbunsPrefix($albumID)
{
    $data = new Pastas();
    $ret = $data->GetAlbumByID($albumID);
    $marcaID = $ret['marca'];
    $catID = $ret['categoria'];
    $nome = $ret['nome'];
    // Pega informações de marcas
    $m = new Marcas();
    $x = $m->GetMarcaByID($marcaID);
    $_marcaNome = $x['nome'];
    $marcaNome = CleanString($_marcaNome);
    // Pega informações de categoria
    $c = new Categorias();
    $y = $c->GetCategoriaByID($catID);
    $catNome = $y['nome'];
    $prefix = "../Arquivos/" . $marcaNome . "-" . $marcaID . "/" . $catNome . "-" . $catID . "/" . $nome . "/";
    return $prefix;
}
예제 #13
0
파일: index.php 프로젝트: omusico/Xion
<?php

require_once "requires.php";
if (Pages::GetCurrentPage() == "SMS") {
    include "pages/sms.php";
    exit;
}
if (is_null($me)) {
    Pages::SetPage("Login");
    if (isset($_POST["login"])) {
        $username = CleanString($_POST["username"]);
        $password = $_POST["password"];
        if (empty($username) || empty($password)) {
            $error = "Invalid username or password";
        } else {
            $staff = Staff::GetByUsername($username);
            if ($staff->IsValid() && $staff->IsActive()) {
                if ($staff->GetPassword() == EncryptPassword($password)) {
                    Session::Set("sid", $staff->GetID());
                    Session::Set("secret", $staff->GetPassword());
                    Pages::SetPage("Dashboard");
                    UpdateLoggedIn();
                } else {
                    $error = "Invalid username or password";
                }
            } else {
                $error = "Invalid username or password";
            }
        }
    }
} elseif (Pages::GetCurrentPage() == "Typeahead") {
function SPITFORM($template, $formfields, $errors)
{
    PAGEHEADER("Edit Template Events");
    if ($template->EventList($eventlist) != 0) {
        TBERROR("Could not get eventlist for template!", 1);
    }
    $guid = $template->guid();
    $vers = $template->vers();
    echo $template->PageHeader();
    echo "<br>\n";
    echo "<center>\n";
    $template->Show();
    echo "</center>\n";
    echo "<br>\n";
    if (!count($eventlist)) {
        echo "<center>";
        echo "<font size=+1 color=red>This template has no events!</font>\n";
        echo "</center>\n";
        return;
    }
    if ($errors) {
        echo "<table class=nogrid\n                     align=center border=0 cellpadding=6 cellspacing=0>\n              <tr>\n                 <th align=center colspan=2>\n                   <font size=+1 color=red>\n                      &nbsp;Oops, please fix the following errors!&nbsp;\n                   </font>\n                 </td>\n              </tr>\n";
        while (list($name, $message) = each($errors)) {
            # XSS prevention.
            $message = CleanString($message);
            echo "<tr>\n                     <td align=right>\n                       <font color=red>{$name}:&nbsp;</font></td>\n                     <td align=left>\n                       <font color=red>{$message}</font></td>\n                  </tr>\n";
        }
        echo "</table><br>\n";
    }
    # XSS prevention.
    while (list($key, $val) = each($formfields)) {
        $formfields[$key] = CleanString($val);
    }
    $url = CreateURL("template_editevents", $template);
    echo "<form action='{$url}'  method=post>\n";
    echo "<table align=center border=1>\n";
    echo "<tr>";
    echo "<th align=center>Delete</th>\n";
    echo "<th align=center>Time</th>\n";
    #    echo "<th align=center>Name</th>\n";
    echo "<th align=center>Node</th>\n";
    echo "<th align=center>Args</th>\n";
    echo "</tr><tr></tr>\n";
    #
    # Show a table of events with a delete button named by the event.
    #
    while (list($index, $dbrow) = each($eventlist)) {
        $vname = $dbrow["vname"];
        $vnode = $dbrow["vnode"];
        $delete_name = "delete_{$vname}";
        $time_name = "time_{$vname}";
        $args_name = "args_{$vname}";
        echo "<tr>";
        echo "<td align=center><input type=checkbox value=checked\n                         name=\"formfields[{$delete_name}]\"\n                         " . $formfields["{$delete_name}"] . ">\n              </td>\n";
        echo "<td class='pad4'>\n                  <input type=text\n                         name=\"formfields[{$time_name}]\"\n                         value=\"" . $formfields["{$time_name}"] . "\"\n\t                 size=10\n                         maxlength=10>\n              </td>\n";
        #	echo "<td class='pad4'>$vname</td>\n";
        echo "<td class='pad4'>{$vnode}</td>\n";
        echo "<td class='pad4'>\n                  <input type=text\n                         name=\"formfields[{$args_name}]\"\n                         value=\"" . $formfields["{$args_name}"] . "\"\n\t                 size=64\n                         maxlength=1024>\n              </td>\n";
        echo "</tr>\n";
    }
    echo "<tr>\n              <td class='pad4' align=center colspan=4>\n                <b><input type=submit name=save value='Save Changes'></b>\n              </td>\n         </tr>\n        </form>\n        </table>\n";
}
예제 #15
0
파일: settings.php 프로젝트: omusico/Xion
<?php

if (isset($_POST["save"])) {
    $password = $_POST["password"];
    $password_confirm = $_POST["password_confirm"];
    $name = $_POST["name"];
    $email = CleanString($_POST["email"]);
    $phone_number = CleanString($_POST["phone_number"]);
    if (empty($name) || empty($email) || empty($phone_number)) {
        ShowError("One or more fields were empty!");
    } elseif ($password != $password_confirm) {
        ShowError("Passwords did not match! Go back and try again.");
    } else {
        if (strlen($password) > 0) {
            $me->SetPassword(EncryptPassword($password));
        }
        $me->Edit($name, $me->GetType(), $me->GetBuilding(), $email, $phone_number);
        ShowInfo("Saved Settings");
    }
}
?>

<div class="container">
	<div class="row">
		<div class="col-sm-4">
			<form class="form-horizontal" role="form" method="post">
				<div class="form-group">
					<label for="password">Password</label>
					<input type="password" class="form-control" id="password" name="password" placeholder="Password">
					<p class="help-block">Leave blank to keep the current password.</p>
				</div>
예제 #16
0
function SPITFORM($formfields, $errors)
{
    global $TBDB_PIDLEN, $TBDB_GIDLEN, $TBDB_EIDLEN, $TBDOCBASE;
    global $projlist;
    global $TBVALIDDIRS_HTML;
    global $WIKIDOCURL;
    PAGEHEADER("Create an Experiment Template");
    if ($errors) {
        echo "<table class=nogrid\n                     align=center border=0 cellpadding=6 cellspacing=0>\n              <tr>\n                 <th align=center colspan=2>\n                   <font size=+1 color=red>\n                      &nbsp;Oops, please fix the following errors!&nbsp;\n                   </font>\n                 </td>\n              </tr>\n";
        while (list($name, $message) = each($errors)) {
            # XSS prevention.
            $message = CleanString($message);
            echo "<tr>\n                     <td align=right>\n                       <font color=red>{$name}:&nbsp;</font></td>\n                     <td align=left>\n                       <font color=red>{$message}</font></td>\n                  </tr>\n";
        }
        echo "</table><br>\n";
    }
    # XSS prevention.
    while (list($key, $val) = each($formfields)) {
        $formfields[$key] = CleanString($val);
    }
    echo "<form enctype=multipart/form-data\n                action=template_create.php method=post>\n";
    echo "<table align=center border=1>\n";
    #
    # Select Project
    #
    echo "<tr>\n\t  <td class='pad4'>Select Project:</td>\n\t  <td class='pad4'><select name=\"formfields[pid]\">\n";
    # If just one project, make sure just the one option.
    if (count($projlist) != 1) {
        echo "<option value=''>Please Select &nbsp</option>\n";
    }
    while (list($project) = each($projlist)) {
        $selected = "";
        if (strcmp($formfields["pid"], $project) == 0) {
            $selected = "selected";
        }
        echo "        <option {$selected} value=\"{$project}\">\n\t\t\t     {$project} </option>\n";
    }
    echo "       </select>";
    echo "    </td>\n\t  </tr>\n";
    #
    # Select a group
    #
    echo "<tr>\n\t      <td class='pad4'>Group:</td>\n\t      <td class='pad4'><select name=\"formfields[gid]\">\n\t          <option value=''>Default Group </option>\n";
    reset($projlist);
    while (list($project, $grouplist) = each($projlist)) {
        for ($i = 0; $i < count($grouplist); $i++) {
            $group = $grouplist[$i];
            if (strcmp($project, $group)) {
                $selected = "";
                if (isset($formfields["gid"]) && isset($formfields["pid"]) && strcmp($formfields["pid"], $project) == 0 && strcmp($formfields["gid"], $group) == 0) {
                    $selected = "selected";
                }
                echo "<option {$selected} value=\"{$group}\">\n\t\t\t   {$project}/{$group}</option>\n";
            }
        }
    }
    echo "     </select>\n\t   <font size=-1>(Must be default or correspond to selected project)\n\t   </font>\n\t  </td>\n\t </tr>\n";
    #
    # TID:
    #
    echo "<tr>\n              <td class='pad4'>Template ID:\n              <br><font size='-1'>(alphanumeric, no blanks)</font></td>\n              <td class='pad4' class=left>\n                  <input type=text\n                         name=\"formfields[tid]\"\n                         value=\"" . $formfields["tid"] . "\"\n\t                 size={$TBDB_EIDLEN}\n                         maxlength={$TBDB_EIDLEN}>\n              </td>\n          </tr>\n";
    #
    # NS file
    #
    if (isset($formfields["nsref"])) {
        $nsref = $formfields["nsref"];
        if (isset($formfields["guid"])) {
            $guid = $formfields["guid"];
            echo "<tr>\n                  <td class='pad4'>Your auto-generated NS file: &nbsp</td>\n                      <input type=hidden name=\"formfields[nsref]\"\n                             value={$nsref}>\n                      <input type=hidden name=\"formfields[guid]\"\n                             value={$guid}>\n                  <td class='pad4'>\n                      <a target=_blank\n                             href=\"spitnsdata.php3?nsref={$nsref}&guid={$guid}\">\n                      View NS File</a></td>\n                  </tr>\n";
        } else {
            echo "<tr>\n                   <td class='pad4'>Your auto-generated NS file: &nbsp</td>\n                       <input type=hidden name=\"formfields[nsref]\"\n                              value={$nsref}>\n                   <td class='pad4'>\n                       <a target=_blank href=spitnsdata.php3?nsref={$nsref}>\n                       View NS File</a></td>\n                 </tr>\n";
        }
    } else {
        echo "<tr>\n                  <td class='pad4'>Your NS file: </td>\n                  <td><table cellspacing=0 cellpadding=0 border=0>\n                    <tr>\n                      <td class='pad4'>Upload<br>\n\t\t\t<font size='-1'>(500k&nbsp;max)</font></td>\n                      <td class='pad4'>\n                        <input type=hidden name=MAX_FILE_SIZE value=512000>\n\t                <input type=file\n                               name=nsfile\n                               value=\"" . $formfields["nsfile"] . "\"\n\t                       size=30>\n                      </td>\n                    </tr><tr>\n                    <td>&nbsp;&nbsp;<b>or</b></td><td></td>\n                    </tr><tr>\n                      <td class='pad4'>On Server<br>\n                              <font size='-1'>({$TBVALIDDIRS_HTML})</font></td>\n                      <td class='pad4'>\n\t                <input type=text\n                               name=\"formfields[localnsfile]\"\n                               value=\"" . $formfields["localnsfile"] . "\"\n\t                       size=40>\n                      </td>\n                     </tr>\n                     </table>\n                   </td>\n               </tr>\n";
    }
    echo "<tr>\n              <td colspan=2>\n               Use this text area to describe your template:\n              </td>\n          </tr>\n          <tr>\n              <td colspan=2 align=center class=left>\n                  <textarea name=\"formfields[description]\"\n                    rows=10 cols=80>" . str_replace("\r", "", $formfields["description"]) . "</textarea>\n              </td>\n          </tr>\n";
    echo "<tr>\n              <td class='pad4' align=center colspan=2>\n                <b><input type=submit name=create value='Create Template'></b>\n              </td>\n         </tr>\n        </form>\n        </table>\n";
    echo "<blockquote><blockquote>\n          <ol>\n            <li> Please read this\n                <a href='{$WIKIDOCURL}/kb112'>KB entry</a>\n                to see what NS extensions are available for templates.\n          </ol>\n          </blockquote></blockquote>\n";
}
예제 #17
0
 function Show($flags = 0)
 {
     $node_id = $this->node_id();
     $short = $flags & SHOWNODE_SHORT ? 1 : 0;
     $noperm = $flags & SHOWNODE_NOPERM ? 1 : 0;
     $query_result = DBQueryFatal("select n.*,na.*,r.vname,r.pid,r.eid,i.IP, " . "greatest(last_tty_act,last_net_act,last_cpu_act," . "last_ext_act) as last_act, " . "  t.isvirtnode,t.isremotenode,t.isplabdslice, " . "  r.erole as rsrvrole, pi.IP as phys_IP, loc.*, " . "  util.*,n.uuid as node_uuid, " . "  mi.IP as mngmnt_IP " . " from nodes as n " . "left join reserved as r on n.node_id=r.node_id " . "left join node_activity as na on " . "     n.node_id=na.node_id " . "left join node_types as t on t.type=n.type " . "left join interfaces as i on " . "     i.node_id=n.node_id and " . "     i.role='" . TBDB_IFACEROLE_CONTROL . "' " . "left join interfaces as pi on " . "     pi.node_id=n.phys_nodeid and " . "     pi.role='" . TBDB_IFACEROLE_CONTROL . "' " . "left join interfaces as mi on " . "     mi.node_id=n.node_id and " . "     mi.role='" . TBDB_IFACEROLE_MANAGEMENT . "' " . "left join location_info as loc on " . "     loc.node_id=n.node_id " . "left join node_utilization as util on " . "     util.node_id=n.node_id " . "where n.node_id='{$node_id}'");
     if (mysql_num_rows($query_result) == 0) {
         TBERROR("The node {$node_id} is not a valid nodeid!", 1);
     }
     $row = mysql_fetch_array($query_result);
     $phys_nodeid = $row["phys_nodeid"];
     $type = $row["type"];
     $vname = $row["vname"];
     $pid = $row["pid"];
     $eid = $row["eid"];
     $def_boot_osid = $row["def_boot_osid"];
     $def_boot_cmd_line = $row["def_boot_cmd_line"];
     $next_boot_osid = $row["next_boot_osid"];
     $temp_boot_osid = $row["temp_boot_osid"];
     $next_boot_cmd_line = $row["next_boot_cmd_line"];
     $rpms = $row["rpms"];
     $tarballs = $row["tarballs"];
     $startupcmd = $row["startupcmd"];
     $routertype = $row["routertype"];
     $eventstate = $row["eventstate"];
     $state_timestamp = $row["state_timestamp"];
     $allocstate = $row["allocstate"];
     $allocstate_timestamp = $row["allocstate_timestamp"];
     $op_mode = $row["op_mode"];
     $op_mode_timestamp = $row["op_mode_timestamp"];
     $IP = $row["IP"];
     $isvirtnode = $row["isvirtnode"];
     $isremotenode = $row["isremotenode"];
     $isplabdslice = $row["isplabdslice"];
     $ipport_low = $row["ipport_low"];
     $ipport_next = $row["ipport_next"];
     $ipport_high = $row["ipport_high"];
     $sshdport = $row["sshdport"];
     $last_act = $row["last_act"];
     $last_tty_act = $row["last_tty_act"];
     $last_net_act = $row["last_net_act"];
     $last_cpu_act = $row["last_cpu_act"];
     $last_ext_act = $row["last_ext_act"];
     $last_report = $row["last_report"];
     $rsrvrole = $row["rsrvrole"];
     $phys_IP = $row["phys_IP"];
     $mngmnt_IP = $row["mngmnt_IP"];
     $battery_voltage = $row["battery_voltage"];
     $battery_percentage = $row["battery_percentage"];
     $battery_timestamp = $row["battery_timestamp"];
     $boot_errno = $row["boot_errno"];
     $reserved_pid = $row["reserved_pid"];
     $inception = $row["inception"];
     $alloctime = $row["allocated"];
     $downtime = $row["down"];
     $uuid = $row["node_uuid"];
     if (!$def_boot_cmd_line) {
         $def_boot_cmd_line = "&nbsp;";
     }
     if (!$next_boot_cmd_line) {
         $next_boot_cmd_line = "&nbsp;";
     }
     if (!$rpms) {
         $rpms = "&nbsp;";
     }
     if (!$tarballs) {
         $tarballs = "&nbsp;";
     }
     if (!$startupcmd) {
         $startupcmd = "&nbsp;";
     } else {
         $startupcmd = CleanString($startupcmd);
     }
     if ($node_id != $phys_nodeid) {
         if (!($phys_this = Node::Lookup($phys_nodeid))) {
             TBERROR("Cannot map physical node {$phys_nodeid} to object", 1);
         }
     }
     if (!$short) {
         #
         # Location info.
         #
         if (isset($row["loc_x"]) && isset($row["loc_y"]) && isset($row["floor"]) && isset($row["building"])) {
             $floor = $row["floor"];
             $building = $row["building"];
             $room = $row["room"];
             $loc_x = $row["loc_x"];
             $loc_y = $row["loc_y"];
             $orient = $row["orientation"];
             $contact = $row["contact"];
             $email = $row["email"];
             $phone = $row["phone"];
             $query_result = DBQueryFatal("select * from floorimages " . "where scale=1 and " . "      floor='{$floor}' and " . "      building='{$building}'");
             if (mysql_num_rows($query_result)) {
                 $row = mysql_fetch_array($query_result);
                 if (isset($row["pixels_per_meter"]) && ($pixels_per_meter = $row["pixels_per_meter"]) != 0.0) {
                     $meters_x = sprintf("%.3f", $loc_x / $pixels_per_meter);
                     $meters_y = sprintf("%.3f", $loc_y / $pixels_per_meter);
                     if (isset($orient)) {
                         $orientation = sprintf("%.3f", $orient);
                     }
                 }
             }
         }
     }
     echo "<table border=2 cellpadding=0 cellspacing=2\n                 align=center>\n";
     echo "<tr>\n              <td>Node ID:</td>\n              <td class=left>{$node_id}</td>\n          </tr>\n";
     if ($isvirtnode) {
         if (strcmp($node_id, $phys_nodeid)) {
             echo "<tr>\n                      <td>Phys ID:</td>\n                      <td class=left>\n\t   \t          <a href='shownode.php3?node_id={$phys_nodeid}'>\n                             {$phys_nodeid}</a></td>\n                  </tr>\n";
         }
     }
     if (!$short && !$noperm) {
         if ($vname) {
             echo "<tr>\n                      <td>Virtual Name:</td>\n                      <td class=left>{$vname}</td>\n                  </tr>\n";
         }
         if ($pid) {
             echo "<tr>\n                      <td>Project: </td>\n                      <td class=\"left\">\n                          <a href='showproject.php3?pid={$pid}'>{$pid}</a></td>\n                  </tr>\n";
             echo "<tr>\n                      <td>Experiment:</td>\n                      <td><a href='showexp.php3?pid={$pid}&eid={$eid}'>\n                             {$eid}</a></td>\n                  </tr>\n";
         }
     }
     echo "<tr>\n              <td>Node Type:</td>\n              <td class=left>\n  \t          <a href='shownodetype.php3?node_type={$type}'>{$type}</td>\n          </tr>\n";
     $feat_result = DBQueryFatal("select * from node_features " . "where node_id='{$node_id}'");
     if (mysql_num_rows($feat_result) > 0) {
         $features = "";
         $count = 0;
         while ($row = mysql_fetch_array($feat_result)) {
             if ($count > 0 && $count % 2 == 0) {
                 $features .= "<br>";
             }
             $features .= " " . $row["feature"];
             $count += 1;
         }
         echo "<tr><td>Features:</td><td class=left>{$features}</td></tr>";
     }
     if (!$short && !$noperm) {
         echo "<tr>\n                  <td>Def Boot OS:</td>\n                  <td class=left>";
         SpitOSIDLink($def_boot_osid);
         echo "    </td>\n              </tr>\n";
         if ($eventstate) {
             $when = strftime("20%y-%m-%d %H:%M:%S", $state_timestamp);
             echo "<tr>\n                     <td>EventState:</td>\n                     <td class=left>{$eventstate} ({$when})</td>\n                  </tr>\n";
         }
         if ($op_mode) {
             $when = strftime("20%y-%m-%d %H:%M:%S", $op_mode_timestamp);
             echo "<tr>\n                     <td>Operating Mode:</td>\n                     <td class=left>{$op_mode} ({$when})</td>\n                  </tr>\n";
         }
         if ($allocstate) {
             $when = strftime("20%y-%m-%d %H:%M:%S", $allocstate_timestamp);
             echo "<tr>\n                     <td>AllocState:</td>\n                     <td class=left>{$allocstate} ({$when})</td>\n                  </tr>\n";
         }
     }
     if (!$short) {
         #
         # Location info.
         #
         if (isset($building)) {
             echo "<tr>\n                      <td>Location (bldg/floor/room):</td>\n                      <td class=left>{$building}";
             if (isset($floor)) {
                 echo "/{$floor}";
             }
             if (isset($room)) {
                 echo "/{$room}";
             }
             echo "</td>\n                      </tr>\n";
         }
         if (isset($meters_x) && isset($meters_y)) {
             echo "<tr>\n                      <td>Location Coordinates:</td>\n                      <td class=left>x={$meters_x}, y={$meters_y} meters";
             if (isset($orientation)) {
                 echo " (o={$orientation} degrees)";
             }
             echo "</td>\n                  </tr>\n";
         }
         if (OPSGUY() && (isset($contact) || isset($email))) {
             $lcstr = "";
             if (isset($contact)) {
                 $lcstr .= "{$contact}:";
             }
             if (isset($email)) {
                 $lcstr .= " <a href='mailto:{$email}'>{$email}</a>";
             }
             if (isset($phone)) {
                 $lcstr .= " {$phone}";
             }
             echo "<tr>\n                      <td>Location Contact:</td>\n                      <td class=left>{$lcstr}\n                      </td>\n                  </tr>\n";
         }
     }
     if (!$short && !$noperm) {
         #
         # We want the last login for this node, but only if its *after*
         # the experiment was created (or swapped in).
         #
         if ($lastnodeuidlogin = TBNodeUidLastLogin($node_id)) {
             $foo = $lastnodeuidlogin["date"] . " " . $lastnodeuidlogin["time"] . " " . "(" . $lastnodeuidlogin["uid"] . ")";
             echo "<tr>\n                      <td>Last Login:</td>\n                      <td class=left>{$foo}</td>\n                 </tr>\n";
         }
         if ($last_act) {
             echo "<tr>\n                      <td>Last Activity:</td>\n                      <td class=left>{$last_act}</td>\n                  </tr>\n";
             $idletime = $this->IdleTime();
             echo "<tr>\n                      <td>Idle Time:</td>\n                      <td class=left>{$idletime} hours</td>\n                  </tr>\n";
             echo "<tr>\n                      <td>Last Act. Report:</td>\n                      <td class=left>{$last_report}</td>\n                  </tr>\n";
             echo "<tr>\n                      <td>Last TTY Act.:</td>\n                      <td class=left>{$last_tty_act}</td>\n                  </tr>\n";
             echo "<tr>\n                      <td>Last Net. Act.:</td>\n                      <td class=left>{$last_net_act}</td>\n                  </tr>\n";
             echo "<tr>\n                      <td>Last CPU Act.:</td>\n                      <td class=left>{$last_cpu_act}</td>\n                  </tr>\n";
             echo "<tr>\n                      <td>Last Ext. Act.:</td>\n                      <td class=left>{$last_ext_act}</td>\n                  </tr>\n";
         }
     }
     if (!$short && !$noperm) {
         if (!$isvirtnode && !$isremotenode) {
             echo "<tr>\n                      <td>Def Boot Command&nbsp;Line:</td>\n                      <td class=left>{$def_boot_cmd_line}</td>\n                  </tr>\n";
             echo "<tr>\n                      <td>Next Boot OS:</td>\n                      <td class=left>";
             if ($next_boot_osid) {
                 SpitOSIDLink($next_boot_osid);
             } else {
                 echo "&nbsp;";
             }
             echo "    </td>\n                  </tr>\n";
             echo "<tr>\n                      <td>Next Boot Command Line:</td>\n                      <td class=left>{$next_boot_cmd_line}</td>\n                  </tr>\n";
             echo "<tr>\n                      <td>Temp Boot OS:</td>\n                      <td class=left>";
             if ($temp_boot_osid) {
                 SpitOSIDLink($temp_boot_osid);
             } else {
                 echo "&nbsp;";
             }
             echo "    </td>\n                  </tr>\n";
         } elseif ($isvirtnode) {
             if (!$isplabdslice) {
                 echo "<tr>\n                          <td>IP Port Low:</td>\n                          <td class=left>{$ipport_low}</td>\n                      </tr>\n";
                 echo "<tr>\n                          <td>IP Port Next:</td>\n                          <td class=left>{$ipport_next}</td>\n                      </tr>\n";
                 echo "<tr>\n                          <td>IP Port High:</td>\n                          <td class=left>{$ipport_high}</td>\n                      </tr>\n";
             }
             echo "<tr>\n                      <td>SSHD Port:</td>\n                     <td class=left>{$sshdport}</td>\n                  </tr>\n";
         }
         echo "<tr>\n                  <td>Startup Command:</td>\n                  <td class=left>{$startupcmd}</td>\n              </tr>\n";
         echo "<tr>\n                  <td>Tarballs:</td>\n                  <td class=left>{$tarballs}</td>\n              </tr>\n";
         echo "<tr>\n                  <td>RPMs:</td>\n                  <td class=left>{$rpms}</td>\n              </tr>\n";
         echo "<tr>\n                  <td>Boot Errno:</td>\n                  <td class=left>{$boot_errno}</td>\n              </tr>\n";
         if (!$isvirtnode && !$isremotenode) {
             echo "<tr>\n                      <td>Router Type:</td>\n                      <td class=left>{$routertype}</td>\n                  </tr>\n";
         }
         if ($IP) {
             echo "<tr>\n                      <td>Control Net IP:</td>\n                      <td class=left>{$IP}</td>\n                  </tr>\n";
             if ($mngmnt_IP) {
                 echo "<tr>\n                          <td>Management IP:</td>\n                          <td class=left>{$mngmnt_IP}</td>\n                       </tr>\n";
             }
         } elseif ($phys_IP) {
             echo "<tr>\n                      <td>Physical IP:</td>\n                      <td class=left>{$phys_IP}</td>\n                  </tr>\n";
         }
         if ($rsrvrole) {
             echo "<tr>\n                      <td>Role:</td>\n                      <td class=left>{$rsrvrole}</td>\n                  </tr>\n";
         }
         if ($reserved_pid) {
             echo "<tr>\n                      <td>Reserved Pid:</td>\n                      <td class=left>\n                          <a href='showproject.php3?pid={$reserved_pid}'>\n                               {$reserved_pid}</a></td>\n                  </tr>\n";
         }
         if ($uuid) {
             echo "<tr>\n                      <td>UUID:</td>\n                      <td class=left>{$uuid}</td>\n                  </tr>\n";
         }
         #
         # Show battery stuff
         #
         if (isset($battery_voltage) && isset($battery_percentage)) {
             echo "<tr>\n    \t              <td>Battery Volts/Percent</td>\n\t\t      <td class=left>";
             printf("%.2f/%.2f ", $battery_voltage, $battery_percentage);
             if (isset($battery_timestamp)) {
                 echo "(" . date("m/d/y H:i:s", $battery_timestamp) . ")";
             }
             echo "    </td>\n\t\t  </tr>\n";
         }
         if ($isplabdslice) {
             $query_result = DBQueryFatal("select leaseend from plab_slice_nodes " . "where node_id='{$node_id}'");
             if (mysql_num_rows($query_result) != 0) {
                 $row = mysql_fetch_array($query_result);
                 $leaseend = $row["leaseend"];
                 echo "<tr>\n                     <td>Lease Expiration:</td>\n                     <td class=left>{$leaseend}</td>\n                 </tr>\n";
             }
         }
         if ($isremotenode) {
             if ($isvirtnode) {
                 $phys_this->ShowWideAreaNode(1);
             } else {
                 $this->ShowWideAreaNode(1);
             }
         }
         #
         # Show any auxtypes the node has
         #
         $query_result = DBQueryFatal("select type, count from node_auxtypes " . "where node_id='{$node_id}'");
         if (mysql_num_rows($query_result) != 0) {
             echo "<tr>\n                      <td align=center colspan=2>\n                      Auxiliary Types\n                      </td>\n                  </tr>\n";
             echo "<tr><th>Type</th><th>Count</th>\n";
             while ($row = mysql_fetch_array($query_result)) {
                 $type = $row["type"];
                 $count = $row["count"];
                 echo "<tr>\n    \t    \t          <td>{$type}</td>\n\t\t          <td class=left>{$count}</td>\n\t\t      </td>\n";
             }
         }
     }
     if (!$short) {
         #
         # Get interface info.
         #
         echo "<tr>\n                  <td align=center colspan=2>Interface Info</td>\n              </tr>\n";
         echo "<tr><th>Interface</th><th>Model; protocols</th>\n";
         $query_result = DBQueryFatal("select i.*,it.*,c.*,s.capval as channel " . "  from interfaces as i " . "left join interface_types as it on " . "     i.interface_type=it.type " . "left join interface_capabilities as c on " . "     i.interface_type=c.type and " . "     c.capkey='protocols' " . "left join interface_settings as s on " . "     s.node_id=i.node_id and s.iface=i.iface and " . "     s.capkey='channel' " . "where i.node_id='{$node_id}' and " . "      i.role='" . TBDB_IFACEROLE_EXPERIMENT . "'" . "order by iface");
         while ($row = mysql_fetch_array($query_result)) {
             $iface = $row["iface"];
             $type = $row["type"];
             $man = $row["manufacturer"];
             $model = $row["model"];
             $protocols = $row["capval"];
             $channel = $row["channel"];
             if (isset($channel)) {
                 $channel = " (channel {$channel})";
             } else {
                 $channel = "";
             }
             echo "<tr>\n                      <td>{$iface}:&nbsp; {$channel}</td>\n                      <td class=left>{$type} ({$man} {$model}; {$protocols})</td>\n                  </tr>\n";
         }
         #
         # Get subboss info.
         #
         echo "<tr>\n              <td align=center colspan=2>Subboss Info</td>\n            </tr>\n";
         echo "<tr><th>Service</th><th>Subboss Node ID</th>\n";
         $query_result = DBQueryFatal("select service,subboss_id from subbosses " . "where node_id ='{$node_id}' and disabled=0");
         while ($row = mysql_fetch_array($query_result)) {
             $service = $row["service"];
             $subboss = $row["subboss_id"];
             echo "<tr>\n                  <td>{$service}</td>\n                  <td class=left>{$subboss}</td>\n                 </tr>\n";
         }
         #
         # Switch info. Very useful for debugging.
         #
         if (!$noperm) {
             $query_result = DBQueryFatal("select i.*,w.* from interfaces as i " . "left join wires as w on i.node_id=w.node_id1 " . "   and i.card=w.card1 and i.port=w.port1 " . "where i.node_id='{$node_id}' and " . "      w.node_id1 is not null " . "order by iface");
             echo "<tr></tr><tr>\n                    <td align=center colspan=2>Switch Info</td>\n                  </tr>\n";
             echo "<tr><th>Iface:role &nbsp; card,port</th>\n                      <th>Switch &nbsp; card,port</th>\n";
             while ($row = mysql_fetch_array($query_result)) {
                 $iface = $row["iface"];
                 $role = $row["role"];
                 $card = $row["card1"];
                 $port = $row["port1"];
                 $switch = $row["node_id2"];
                 $switch_card = $row["card2"];
                 $switch_port = $row["port2"];
                 echo "<tr>\n                      <td>{$iface}:{$role} &nbsp; {$card},{$port}</td>\n                      <td class=left>" . "{$switch}: &nbsp; {$switch_card},{$switch_port}</td>\n                  </tr>\n";
             }
         }
     }
     #
     # Spit out node attributes
     #
     $query_result = DBQueryFatal("select attrkey,attrvalue from node_attributes " . "where node_id='{$node_id}' " . ($noperm ? "and attrkey!='root_password'" : ""));
     if (!$short && mysql_num_rows($query_result)) {
         echo "<tr>\n                    <td align=center colspan=2>Node Attributes</td>\n                  </tr>\n";
         echo "<tr><th>Attribute</th><th>Value</th>\n";
         while ($row = mysql_fetch_array($query_result)) {
             $attrkey = $row["attrkey"];
             $attrvalue = $row["attrvalue"];
             echo "<tr>\n                        <td>{$attrkey}</td>\n                        <td>{$attrvalue}</td>\n                      </td>\n";
         }
     }
     if (!($short || $noperm || $isvirtnode)) {
         $query_result = DBQueryFatal("select n.node_id,pid,eid,exptidx " . " from nodes as n " . "left join reserved as r on r.node_id=n.node_id " . "where n.phys_nodeid='{$node_id}' and " . "      n.node_id!=n.phys_nodeid");
         if (mysql_num_rows($query_result)) {
             echo "<tr>\n                       <td align=center colspan=2>Virtual/Sub Nodes</td>\n                      </tr>\n";
             echo "<tr><th>Node ID</th><th>Experiment</th>\n";
             while ($row = mysql_fetch_array($query_result)) {
                 $vnodeid = $row["node_id"];
                 $vpid = $row["pid"];
                 $veid = $row["eid"];
                 $vidx = $row["exptidx"];
                 $url1 = CreateURL("shownode", URLARG_NODEID, $vnodeid);
                 echo "<tr>\n                            <td><a href='{$url1}'>{$vnodeid}</a></td>\n";
                 if (isset($veid)) {
                     $url2 = CreateURL("showexp", URLARG_EID, $vidx);
                     echo "<td><a href='{$url2}'>{$vpid}/{$veid}</a></td>\n";
                 } else {
                     echo "<td>No Experiment</a></td>\n";
                 }
                 echo "</td>\n";
             }
         }
     }
     echo "</table>\n";
 }
예제 #18
0
		</textarea> 
		<p>
			Add 1 or more photoalbums to this article
		</p>
		<?php 
    $database = new database($arr);
    $photoalbums = $database->executeQuery("SELECT id, name FROM photoalbums", 1);
    if ($photoalbums) {
        for ($i = 0; $i < count($photoalbums); ++$i) {
            $selected = $database->executeQuery("SELECT COUNT(*) AS count FROM photoalbumsforarticle WHERE photoalbumid = " . $photoalbums[$i]['id'] . " AND articleid = " . $_GET['s'], 1);
            ?>
				<input type="checkbox" name="<?php 
            echo CleanString($photoalbums[$i]['name']);
            ?>
" id="<?php 
            echo CleanString($photoalbums[$i]['name']);
            ?>
" <?php 
            if ($selected[0]['count'] == 1) {
                echo "checked=\"checked\"";
            }
            ?>
 /><label for="<?php 
            echo $photoalbums[$i]['name'];
            ?>
"><?php 
            echo $photoalbums[$i]['name'];
            ?>
</label><br />
				<?php 
        }
예제 #19
0
 function ShowRunAnnotation($runidx)
 {
     $annotation = $this->GetRunAnnotation($runidx);
     if (!$annotation) {
         $annotation = "";
     } else {
         $annotation = CleanString();
     }
     echo "<center>";
     echo "<b>Annotation</b><br>\n";
     echo "<form action='fee' method=post>\n";
     echo "<textarea id='annotation' rows=5 cols=80>{$annotation}" . "</textarea></form>";
     echo "<button name=submit type=button value=submit " . "onclick=\"ModifyAnno();\">Submit Annotation</button>\n";
     echo "<center>";
     echo "<script type='text/javascript' language='javascript'>\n              function ModifyAnno() {\n                  textarea = getObjbyName('annotation');\n                  x_ModifyAnno(textarea.value, ModifyAnno_cb);\n              }\n              function ModifyAnno_cb(val) {\n              }\n              </script>\n";
 }