function smarty_function_getInputElement($params, &$smarty)
{
    $i_type = isset($params['type']) ? $params['type'] : 'text';
    $i_size = isset($params['size']) ? (int) $params['size'] : 0;
    $i_maxlength = isset($params['maxlength']) ? (int) $params['maxlength'] : 0;
    $i_additional = isset($params['additional']) ? (int) $params['additional'] : '';
    return '<input name="' . $params['name'] . '" value="' . convertTextValue($params['value']) . '" class=inp type=' . $i_type . ' size=' . $i_size . ($i_maxlength > 0 ? ' maxlength=' . $maxlength : '') . $i_additional . '>';
}
    }
}
echo '<td width=2><img src="images/toolbar-right.gif" width=2 height=32></td></tr></table>';
echo '</td></tr><tr><td>';
echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
echo '<tr vAlign=top><td class=rowhdr1 title="' . $lngstr['label_hdr_select_hint'] . '" width=22><input type=checkbox name=toggleAll onclick="toggleCBs(this);"></td>';
writeQryTableHeaders('test-manager.php?action=' . $i_testid_addon . $i_subjectid_addon . $i_url_limit_addon, $i_tablefields, $i_order_no, $i_direction);
echo '<td class=rowhdr1 colspan=5>' . $lngstr['label_hdr_action'] . '</td></tr>';
$i_rSet1 = $g_db->SelectLimit("SELECT " . $srv_settings['table_prefix'] . "tests.testid, " . $srv_settings['table_prefix'] . "tests.test_name, " . $srv_settings['table_prefix'] . "tests.subjectid, " . $srv_settings['table_prefix'] . "tests.test_datestart, " . $srv_settings['table_prefix'] . "tests.test_dateend, " . $srv_settings['table_prefix'] . "tests.test_notes, " . $srv_settings['table_prefix'] . "tests.test_enabled, " . $srv_settings['table_prefix'] . "subjects.subject_name FROM " . $srv_settings['table_prefix'] . "tests, " . $srv_settings['table_prefix'] . "subjects WHERE " . $i_sql_where_addon . "" . $srv_settings['table_prefix'] . "tests.subjectid=" . $srv_settings['table_prefix'] . "subjects.subjectid" . $i_sql_order_addon, $i_limitcount, $i_limitfrom);
if (!$i_rSet1) {
    showDBError(__FILE__, 1);
} else {
    $i_counter = 0;
    while (!$i_rSet1->EOF) {
        $rowname = $i_counter % 2 ? "rowone" : "rowtwo";
        echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=center width=22><input id=cb_' . $i_pagewide_id . ' type=checkbox name=box_tests[] value="' . $i_rSet1->fields["testid"] . '" onclick="toggleCB(this);"></td><td align=right>' . $i_rSet1->fields["testid"] . '</td><td align=center width=16 style="padding: 1px;"><a href="javascript:void(0)" onClick="showDialog(\'test-manager.php?testid=' . $i_rSet1->fields["testid"] . '&action=notes\', 300, 200)"><img src="images/button-notes.gif" width=16 height=20 title="' . convertTextValue($i_rSet1->fields["test_notes"]) . '" border=0></a></td><td>' . convertTextValue($i_rSet1->fields["test_name"]) . '</td><td><a href="test-manager.php?subjectid=' . (isset($_GET["subjectid"]) && $_GET["subjectid"] != "" ? "" : $i_rSet1->fields["subjectid"]) . $i_order_addon . $i_url_limitto_addon . '">' . convertTextValue($i_rSet1->fields["subject_name"]) . '</a></td><td>' . getDateLocal($lngstr['language']['date_format'], $i_rSet1->fields["test_datestart"]) . '</td><td>' . getDateLocal($lngstr['language']['date_format'], $i_rSet1->fields["test_dateend"]) . '</td><td align=center><a href="test-manager.php?testid=' . $i_rSet1->fields["testid"] . $i_order_addon . $i_url_limit_addon . '&action=enable&set=' . ($i_rSet1->fields["test_enabled"] ? '0"><img src="images/button-checkbox-2.gif" width=13 height=13 border=0 title="' . $lngstr['label_yes'] . '">' : '1"><img src="images/button-checkbox-0.gif" width=13 height=13 border=0 title="' . $lngstr['label_no'] . '">') . '</a></td>';
        echo '<td align=center width=22><a href="test-manager.php?testid=' . $i_rSet1->fields["testid"] . '&action=settings"><img width=20 height=20 border=0 src="images/button-gear.gif" title="' . $lngstr['label_action_test_settings'] . '"></a></td>';
        if (IGT_TESTMANAGER_SHOWSTATS) {
            echo '<td align=center width=22><a href="test-manager.php?testids=' . $i_rSet1->fields["testid"] . '&action=statst"><img width=20 height=20 border=0 src="images/button-stats.gif" title="' . $lngstr['page_testmanager']['view_test_stats'] . '"></a></td>';
        }
        echo '<td align=center width=22><a href="test-manager.php?testids=' . $i_rSet1->fields["testid"] . '&action=groups"><img width=20 height=20 border=0 src="images/button-groups.gif" title="' . $lngstr['label_action_test_groups_select'] . '"></a></td>';
        echo '<td align=center width=22><a href="test-manager.php?testid=' . $i_rSet1->fields["testid"] . '&action=editt"><img width=20 height=20 border=0 src="images/button-edit.gif" title="' . $lngstr['label_action_questions_edit'] . '"></a></td>';
        echo '<td align=center width=22><a href="test-manager.php?testid=' . $i_rSet1->fields["testid"] . '&action=delete" onclick="return confirmMessage(this, \'' . $lngstr['qst_delete_test'] . '\')"><img width=20 height=20 border=0 src="images/button-cross.gif" title="' . $lngstr['label_action_test_delete'] . '"></a></td>';
        echo '</tr>';
        $i_counter++;
        $i_pagewide_id++;
        $i_rSet1->MoveNext();
    }
    $i_rSet1->Close();
}
echo '</table>';
            if (IGT_NUMBERING_STYLE_ANSWERS == IGT_NUMBERING_STYLES_LETTERS) {
                $nQuestionType = getRecordItem($srv_settings['table_prefix'] . 'questions', 'question_type', 'questionid=' . $i_rSet2->fields['questionid']);
                switch ($nQuestionType) {
                    case QUESTION_TYPE_MULTIPLECHOICE:
                    case QUESTION_TYPE_TRUEFALSE:
                    case QUESTION_TYPE_MULTIPLEANSWER:
                        $strAnswerText = $i_rSet2->fields['result_answer_text'];
                        $arrAnswerText = explode(QUESTION_TYPE_MULTIPLEANSWER_BREAK, $strAnswerText);
                        foreach ($arrAnswerText as $key => $val) {
                            $arrAnswerText[$key] = convertNumberToLetter($val);
                        }
                        $strAnswerText = implode(QUESTION_TYPE_MULTIPLEANSWER_BREAK, $arrAnswerText);
                        $i_rSet2->fields['result_answer_text'] = $strAnswerText;
                        break;
                }
            }
            echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=right>' . $i_rSet2->fields['result_answerid'] . '</td><td align=right>' . $i_rSet2->fields['test_questionid'] . '</td><td>' . makeTime($i_rSet2->fields['result_answer_timespent']) . '</td><td>' . convertTextValue($i_rSet2->fields['result_answer_text']) . '</td><td align=right>' . $i_rSet2->fields['result_answer_points'] . '</td><td align=center>' . ($i_rSet2->fields['result_answer_timeexceeded'] ? '<img src="images/button-checkbox-2.gif" width=13 height=13 border=0 title="' . $lngstr['label_yes'] . '">' : '<img src="images/button-checkbox-0.gif" width=13 height=13 border=0 title="' . $lngstr['label_no'] . '">') . '</td><td align=center>' . ($i_rSet2->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_UNDEFINED ? '<a href="reports-manager.php?answerid=' . $i_rSet2->fields['result_answerid'] . $i_resultid_addon . '&action=viewa"><img width=13 height=13 border=0 src="images/button-checkbox-3.gif" title="' . $lngstr['label_undefined'] . '"></a>' : ($i_rSet2->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_CORRECT ? '<img width=13 height=13 border=0 src="images/button-checkbox-2.gif" title="' . $lngstr['label_yes'] . '">' : ($i_rSet2->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_PARTIALLYCORRECT ? '<img width=13 height=13 border=0 src="images/button-checkbox-1.gif" title="' . $lngstr['label_partially'] . '">' : '<img width=13 height=13 border=0 src="images/button-checkbox-0.gif" title="' . $lngstr['label_no'] . '">'))) . '</td>';
            echo '<td align=center width=22><a href="reports-manager.php?action=viewa&answerid=' . $i_rSet2->fields['result_answerid'] . $i_resultid_addon . '"><img width=20 height=20 border=0 src="images/button-view.gif" title="' . $lngstr['label_action_view_question_result'] . '"></a></td>';
            if ($G_SESSION['access_questionbank'] > 1) {
                echo '<td align=center width=22><a href="question-bank.php?action=editq&questionid=' . $i_rSet2->fields['questionid'] . $i_resultid_addon . $i_order_addon . '"><img width=20 height=20 border=0 src="images/button-edit.gif" title="' . $lngstr['label_action_question_edit'] . '"></a></td>';
            }
            echo '</tr>';
            $i_counter++;
            $i_pagewide_id++;
            $i_rSet2->MoveNext();
        }
        $i_rSet2->Close();
    }
    echo '</table>';
}
displayTemplate('_footer');
function smarty_function_getInTagValue($params, &$smarty)
{
    return convertTextValue($params['text']);
}
<?php

$g_vars['page']['header'] = $lngstr['page_test_results'];
$g_vars['page']['hide_cpanel'] = true;
$i_now = $G_SESSION['yt_teststoppedat'];
$i_timespent_total = $i_now - $G_SESSION['yt_teststart'];
$i_timeexceeded = $G_SESSION['yt_teststop'] > 0 && $G_SESSION['yt_teststop'] < $i_now ? 1 : 0;
$g_vars['page']['grade'] = getGradeData($G_SESSION['yt_gscaleid'], $G_SESSION['yt_gradeid']);
$g_vars['page']['test_name'] = convertTextValue($G_SESSION['yt_name']);
$g_vars['page']['test_name_label'] = sprintf($lngstr['label_result_testname'], $g_vars['page']['test_name']);
$g_vars['page']['test_date'] = getDateLocal($lngstr['language']['date_format_full'], $G_SESSION['yt_teststart']);
$g_vars['page']['test_date_label'] = sprintf($lngstr['label_result_testdate'], $g_vars['page']['test_date']);
$g_vars['page']['time_spent'] = getTimeFormatted($i_timespent_total);
$g_vars['page']['time_spent_label'] = sprintf($lngstr['label_result_timespent'], $g_vars['page']['time_spent']);
$g_vars['page']['grade_label'] = sprintf($lngstr['label_result_got_grade'], $g_vars['page']['grade']['name']);
$g_vars['page']['gradefeedback_label'] = sprintf($lngstr['label_result_got_gradefeedback'], $g_vars['page']['grade']['feedback']);
$g_vars['page']['correct_answers_label'] = sprintf($lngstr['label_result_got_answers'], $G_SESSION['yt_got_answers'], $G_SESSION['yt_questioncount']);
$g_vars['page']['score'] = $G_SESSION['yt_pointsmax'] != 0 ? round($G_SESSION['yt_got_points'] * 100 / $G_SESSION['yt_pointsmax']) : 0;
$g_vars['page']['points_label'] = sprintf($lngstr['label_result_got_points'], $G_SESSION['yt_got_points'], $G_SESSION['yt_pointsmax'], $g_vars['page']['score']);
$g_vars['page']['points_pending_label'] = sprintf($lngstr['label_result_points_pending'], $G_SESSION['yt_points_pending']);
$i_showresultspage = $G_SESSION['access_reportsmanager'] > 0;
$i_attempts_allowed = 0;
$i_rSet3 = $g_db->Execute("SELECT test_attempts, test_contentprotection FROM " . $srv_settings['table_prefix'] . "tests WHERE testid=" . $G_SESSION['testid']);
if ($i_rSet3) {
    if (!$i_rSet3->EOF) {
        $i_attempts_allowed = $i_rSet3->fields['test_attempts'];
        $g_vars['page']['content_protection'] = $i_rSet3->fields['test_contentprotection'];
    }
    $i_rSet3->Close();
}
if ($i_showresultspage && $G_SESSION['yt_attempts'] > 0) {
        echo '<td width=32><a href="visitors.php?pageno=' . $i_pageno_count . $i_url_pages_addon . '"><img src="images/button-last-big.gif" border=0 title="' . $lngstr['button_last_page'] . '"></a></td>';
    } else {
        echo '<td width=32><img src="images/button-next-big-inactive.gif" border=0 title="' . $lngstr['button_next_page'] . '"></td>';
        echo '<td width=32><img src="images/button-last-big-inactive.gif" border=0 title="' . $lngstr['button_last_page'] . '"></td>';
    }
}
echo '<td width=2><img src="images/toolbar-right.gif" width=2 height=32></td></tr></table>';
echo '</td></tr><tr><td>';
echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
echo '<tr vAlign=top><td class=rowhdr1 title="' . $lngstr['label_hdr_select_hint'] . '" width=22><input type=checkbox name=toggleAll onclick="toggleCBs(this);"></td>';
writeQryTableHeaders('visitors.php?action=' . $i_url_limit_addon, $i_tablefields, $i_order_no, $i_direction);
echo '<td class=rowhdr1 colspan=2>' . $lngstr['label_hdr_action'] . '</td></tr>';
$i_rSet1 = $g_db->SelectLimit("SELECT *, ip1, ip2, ip3, ip4, " . $srv_settings['table_prefix'] . "users.username FROM " . $srv_settings['table_prefix'] . "visitors, " . $srv_settings['table_prefix'] . "users WHERE ((" . $srv_settings['table_prefix'] . "visitors.id=0 AND " . $srv_settings['table_prefix'] . "users.id=2) OR " . $srv_settings['table_prefix'] . "visitors.id=" . $srv_settings['table_prefix'] . "users.id)" . $i_sql_order_addon, $i_limitcount, $i_limitfrom);
if (!$i_rSet1) {
    showDBError(__FILE__, 1);
} else {
    $i_counter = 0;
    while (!$i_rSet1->EOF) {
        $rowname = $i_counter % 2 ? "rowone" : "rowtwo";
        $i_ip = $i_rSet1->fields['ip1'] . '.' . $i_rSet1->fields['ip2'] . '.' . $i_rSet1->fields['ip3'] . '.' . $i_rSet1->fields['ip4'];
        echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=center width=22><input id=cb_' . $i_pagewide_id . ' type=checkbox name=box_visitors[] value="' . $i_rSet1->fields['visitorid'] . '" onclick="toggleCB(this);"></td><td align=right>' . $i_rSet1->fields['visitorid'] . '</td><td>' . getDateLocal($lngstr['language']['date_format'], $i_rSet1->fields['startdate']) . '</td><td><nobr>' . convertTextValue($i_rSet1->fields['username']) . ' [<a href="users.php?id=' . $i_rSet1->fields['id'] . '&action=edit" title="' . $lngstr['label']['view_edit_user'] . '">' . $i_rSet1->fields['id'] . '</a>]</nobr></td><td>' . $i_rSet1->fields['hits'] . '</td><td><a href="http://www.whois.sc/' . $i_ip . '" title="' . $lngstr['page_visitors']['ipwhois'] . '" target=_blank>' . $i_ip . '</a></td><td>' . truncateString(convertTextValue($i_rSet1->fields['host'])) . '</td><td>' . truncateString(convertTextValue($i_rSet1->fields['referer'])) . '</td>';
        echo '<td align=center width=22><a href="visitors.php?action=view&visitorid=' . $i_rSet1->fields['visitorid'] . $i_order_addon . $i_url_limit_addon . '"><img width=20 height=20 border=0 src="images/button-view.gif" title="' . $lngstr['label_action_visitors_view'] . '"></a></td><td align=center width=22><a href="visitors.php?action=delete&visitorid=' . $i_rSet1->fields['visitorid'] . $i_order_addon . $i_url_limit_addon . '" onclick="return confirmMessage(this, \'' . $lngstr['qst_delete_visitor'] . '\')"><img width=20 height=20 border=0 src="images/button-cross.gif" title="' . $lngstr['label_action_visitor_delete'] . '"></a></td></tr>';
        $i_counter++;
        $i_pagewide_id++;
        $i_rSet1->MoveNext();
    }
    $i_rSet1->Close();
}
echo '</table>';
echo '</td></tr></table></form>';
displayTemplate('_footer');
}
echo '<p><form name=usersForm class=iactive method=post><table cellpadding=0 cellspacing=0 border=0 width="100%"><tr><td>';
echo '<table cellpadding=0 cellspacing=0 border=0 width="100%" style="background: url(images/toolbar-background.gif) repeat-x"><tr vAlign=center><td width=2><img src="images/toolbar-left.gif" width=2 height=32></td><td width=32><a href="users.php?action=create"><img src="images/button-new-big.gif" border=0 title="' . $lngstr['label_action_create_user'] . '"></a></td><td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td><td width=32><img src="images/button-groups-big.gif" border=0 title="' . $lngstr['label_action_groups'] . '" style="cursor: hand;" onclick="f=document.usersForm;f.action=\'users.php?action=groups\';f.submit();"></td><td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td><td width=32><img src="images/button-cross-big.gif" border=0 title="' . $lngstr['label_action_users_delete'] . '" style="cursor: hand;" onclick="f=document.usersForm;if (confirm(\'' . $lngstr['qst_delete_users'] . '\')) { f.action=\'users.php?action=delete&confirmed=1\';f.submit();}"></td><td width="100%">&nbsp;</td><td width=2><img src="images/toolbar-right.gif" width=2 height=32></td></tr></table>';
echo '</td></tr><tr><td>';
echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
echo '<tr vAlign=top><td class=rowhdr1 title="' . $lngstr['label_hdr_select_hint'] . '" width=22><input type=checkbox name=toggleAll onclick="toggleCBs(this);"></td>';
writeQryTableHeaders('users.php?action=groups' . $i_ids_addon . $i_2_order_addon . $i_2_url_limit_addon, $i_tablefields, $i_order_no, $i_direction);
echo '<td class=rowhdr1 colspan=3>' . $lngstr['label_hdr_action'] . '</td></tr>';
$i_rSet1 = $g_db->Execute("SELECT id, username, email, user_firstname, user_lastname, user_notes, user_enabled FROM " . $srv_settings['table_prefix'] . "users" . ($f_ids ? " WHERE id IN (" . implode(',', $f_ids) . ")" : "") . $i_sql_order_addon);
if (!$i_rSet1) {
    showDBError(__FILE__, 1);
} else {
    $i_counter = 0;
    while (!$i_rSet1->EOF) {
        $rowname = $i_counter % 2 ? "rowone" : "rowtwo";
        echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=center width=22><input id=cb_' . $i_pagewide_id . ' type=checkbox name=box_users[] value="' . $i_rSet1->fields["id"] . '" onclick="toggleCB(this);"></td><td align=right>' . $i_rSet1->fields["id"] . '</td><td align=center width=16 style="padding: 1px;"><a href="javascript:void(0)" onClick="showDialog(\'users.php?id=' . $i_rSet1->fields["id"] . '&action=notes\', 300, 200)"><img src="images/button-notes.gif" width=16 height=20 title="' . convertTextValue($i_rSet1->fields["user_notes"]) . '" border=0></a></td><td>' . $i_rSet1->fields["username"] . '</td><td>' . $i_rSet1->fields["email"] . '</td><td>' . $i_rSet1->fields["user_firstname"] . '</td><td>' . $i_rSet1->fields["user_lastname"] . '</td><td align=center><a href="users.php?id=' . $i_rSet1->fields["id"] . $i_order_addon . $i_2_order_addon . '&action=enable&set=' . ($i_rSet1->fields["user_enabled"] ? '0"><img src="images/button-checkbox-2.gif" width=13 height=13 border=0 title="' . $lngstr['label_yes'] . '">' : '1"><img src="images/button-checkbox-0.gif" width=13 height=13 border=0 title="' . $lngstr['label_no'] . '">') . '</a></td>';
        echo '<td align=center width=22><a href="users.php?id=' . $i_rSet1->fields["id"] . '&action=groups"><img width=20 height=20 border=0 src="images/button-groups.gif" title="' . $lngstr['label_action_manageusers_groups'] . '"></a></td><td align=center width=22><a href="users.php?id=' . $i_rSet1->fields["id"] . '&action=edit"><img width=20 height=20 border=0 src="images/button-edit.gif" title="' . $lngstr['label_action_manageusers_edit'] . '"></a></td><td align=center width=22><a href="users.php?id=' . $i_rSet1->fields["id"] . '&action=delete" onclick="return confirmMessage(this, \'' . $lngstr['qst_delete_user'] . '\')"><img width=20 height=20 border=0 src="images/button-cross.gif" title="' . $lngstr['label_action_manageusers_delete'] . '"></a></td></tr>';
        $i_counter++;
        $i_pagewide_id++;
        $i_rSet1->MoveNext();
    }
    $i_rSet1->Close();
}
echo '</table>';
echo '</td></tr></table></form>';
echo '<h2>' . $lngstr['page_title_users_memberof_groups'] . '</h2>';
echo '<p><form name=groupsForm class=iactive method=post><table cellpadding=0 cellspacing=0 border=0 width="100%"><tr><td>';
echo '<table cellpadding=0 cellspacing=0 border=0 width="100%" style="background: url(images/toolbar-background.gif) repeat-x"><tr vAlign=center><td width=2><img src="images/toolbar-left.gif" width=2 height=32></td><td width=32><a href="groups.php?action=create"><img src="images/button-new-big.gif" border=0 title="' . $lngstr['label_action_create_group'] . '"></a></td><td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td><td width=32><img src="images/button-cross-big.gif" border=0 title="' . $lngstr['label_action_groups_delete'] . '" style="cursor: hand;" onclick="f=document.groupsForm;if (confirm(\'' . $lngstr['qst_delete_groups'] . '\')) { f.action=\'groups.php?action=delete&confirmed=1\';f.submit();}"></td><td width="100%">&nbsp;</td>';
if ($i_2_limitcount > 0) {
    $i_2_url_pages_addon = $i_ids_addon . $i_order_addon . $i_2_order_addon . $i_2_url_limitto_addon;
    echo '<td vAlign=middle width=32><nobr>&nbsp;' . sprintf($lngstr['label']['KtoLofN'], $n2RecordFrom, $n2RecordTo, $i_2_recordcount) . '&nbsp;</nobr></td>';
 $i_rSet1 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "tests WHERE test_enabled=1 AND test_dateend>" . $now . $i_sql_order_addon);
 if (!$i_rSet1) {
     showDBError(__FILE__, 1);
 } else {
     while (!$i_rSet1->EOF) {
         $i_isallowed = $i_rSet1->fields['test_forall'];
         if (!$i_isallowed) {
             //9917//9917
             $i_isallowed = getRecordCount($srv_settings['table_prefix'] . 'groups_users, ' . $srv_settings['table_prefix'] . 'groups_tests', "(" . $srv_settings['table_prefix'] . "groups_tests.testid=" . $i_rSet1->fields['testid'] . " AND " . $srv_settings['table_prefix'] . "groups_tests.groupid=" . $srv_settings['table_prefix'] . "groups_users.groupid AND " . $srv_settings['table_prefix'] . "groups_users.id=" . $G_SESSION['id'] . ")") > 0;
         }
         if ($i_isallowed) {
             $i_test_count++;
             $g_vars['page']['test'][$i_test_count]['testid'] = $i_rSet1->fields['testid'];
             $g_vars['page']['test'][$i_test_count]['name'] = $i_rSet1->fields['test_name'] ? convertTextValue($i_rSet1->fields['test_name']) : $lngstr['label_noname'];
             $g_vars['page']['test'][$i_test_count]['code'] = $i_rSet1->fields['test_code'];
             $g_vars['page']['test'][$i_test_count]['description'] = convertTextValue($i_rSet1->fields['test_description']);
             $g_vars['page']['test'][$i_test_count]['startdate'] = $i_rSet1->fields['test_datestart'];
             $g_vars['page']['test'][$i_test_count]['attempts'] = getTestAttemptsUsed($i_rSet1->fields['testid'], $G_SESSION['id']);
             $g_vars['page']['test'][$i_test_count]['attempts_total'] = $i_rSet1->fields['test_attempts'];
             $g_vars['page']['test'][$i_test_count]['test_price'] = $i_rSet1->fields['test_price'] / 100;
             $g_vars['page']['test'][$i_test_count]['test_purchased'] = $i_rSet1->fields['test_price'] <= 0 || getRecordCount($srv_settings['table_prefix'] . 'tests_own', 'testid=' . $i_rSet1->fields['testid'] . ' AND id=' . $G_SESSION['id']) > 0;
             $g_vars['page']['test'][$i_test_count]['content_protection'] = $i_rSet1->fields['test_contentprotection'];
             $g_vars['page']['test'][$i_test_count]['status'] = IGT_TEST_STATUS_UNAVAILABLE;
             $g_vars['page']['test'][$i_test_count]['visible'] = true;
             if ($i_rSet1->fields['test_datestart'] > $now) {
                 $g_vars['page']['test'][$i_test_count]['status_label'] = sprintf($lngstr['page_panel_status_will_be_available_on'], getDateLocal($lngstr['language']['date_format'], $i_rSet1->fields['test_datestart']));
             } else {
                 if ($g_vars['page']['test'][$i_test_count]['attempts_total'] > 0) {
                     if ($g_vars['page']['test'][$i_test_count]['attempts'] >= $g_vars['page']['test'][$i_test_count]['attempts_total']) {
                         $g_vars['page']['test'][$i_test_count]['status_label'] = $lngstr['page-takeatest']['attempts_limit_reached'];
                     } else {
<?php

$g_vars['page']['hide_cpanel'] = true;
$g_smarty->assign('g_vars', $g_vars);
displayTemplate('_header');
$f_username = readPostVar('username');
echo '<p><table cellpadding=0 cellspacing=5 border=0 width="100%">';
echo '<tr vAlign=top><td width="35%" height="100%" class=signin1>';
echo '<form action="lostpassword.php" method=post name=lostpasswordform>';
echo $lngstr['page_lostpassword_enter_username'] . '<br>';
echo '<br>' . $lngstr['page_signin_box_signin'];
echo '<br><input name=username class=inp type=text value="' . convertTextValue($f_username) . '" size=20><br>';
echo '<br><input class=btn type=submit name=bsubmit value=" ' . $lngstr['button_send_new_password'] . ' "></form>';
echo '<td height="100%" class=signin2>';
writeErrorsWarningsBar();
echo '<p>' . $lngstr['page_signin_box_register_intro'];
echo '<p>' . $lngstr['page_signin_box_lostpassword_intro'];
echo '</td></tr></table>';
displayTemplate('_footer');
<?php

defined('IGT_VALID_ENVIRONMENT') or exit('Restricted access');
$g_vars['page']['hide_cpanel'] = true;
$f_username = readPostVar('username');
$g_vars['page']['username'] = convertTextValue($f_username);
$g_vars['page']['gotourl'] = @htmlspecialchars($_SERVER['REQUEST_URI']);
$g_vars['page']['cansigninasguest'] = getRecordCount($srv_settings['table_prefix'] . 'users', 'id=' . SYSTEM_GROUP_GUEST_id . ' AND user_enabled=1') > 0;
$g_vars['page']['test_code'] = isset($G_SESSION['test_code']) ? $G_SESSION['test_code'] : '';
$g_vars['page']['can_register'] = getConfigItem(CONFIG_can_register);
eventOnBeforePageGeneration(array('page_name' => 'signin'));
$g_smarty->assign('g_vars', $g_vars);
displayTemplate('signin');
echo '<td width=2><img src="images/toolbar-right.gif" width=2 height=32></td></tr></table>';
echo '</td></tr><tr><td>';
echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
echo '<tr vAlign=top><td class=rowhdr1 title="' . $lngstr['label_hdr_select_hint'] . '" width=22><input type=checkbox name=toggleAll onclick="toggleCBs(this);"></td>';
writeQryTableHeaders('test-manager.php?action=editt&testid=' . $f_testid . $i_subjectid_addon . $i_order_addon . $i_url_limit_addon . $i_2_subjectid_addon . $i_2_url_limit_addon, $i_2_tablefields, $i_2_order_no, $i_2_direction, '2');
echo '<td class=rowhdr1 colspan=3>' . $lngstr['label_hdr_action'] . '</td></tr>';
$i_rSet2 = $g_db->SelectLimit("SELECT " . $srv_settings['table_prefix'] . "questions.questionid, " . $srv_settings['table_prefix'] . "questions.subjectid, " . $srv_settings['table_prefix'] . "questions.question_text, " . $srv_settings['table_prefix'] . "questions.question_time, " . $srv_settings['table_prefix'] . "questions.question_type, " . $srv_settings['table_prefix'] . "questions.question_points, " . $srv_settings['table_prefix'] . "subjects.subject_name FROM " . $srv_settings['table_prefix'] . "questions, " . $srv_settings['table_prefix'] . "subjects WHERE " . $i_2_sql_where_addon . "" . $srv_settings['table_prefix'] . "questions.subjectid=" . $srv_settings['table_prefix'] . "subjects.subjectid" . $i_2_sql_order_addon, $i_2_limitcount, $i_2_limitfrom);
if (!$i_rSet2) {
    showDBError(__FILE__, 2);
} else {
    $i_counter = 0;
    while (!$i_rSet2->EOF) {
        $rowname = $i_counter % 2 ? 'rowone' : 'rowtwo';
        $i_rowtitle = '';
        if (!in_array($i_rSet2->fields['questionid'], $i_questionids_in_the_test) || $i_rSet2->fields['question_type'] == QUESTION_TYPE_RANDOM) {
            echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' title="' . $i_rowtitle . '" onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=center width=22><input id=cb_' . $i_pagewide_id . ' type=checkbox name=box_questions[] value="' . $i_rSet2->fields['questionid'] . '" onclick="toggleCB(this);"></td><td align=right>' . $i_rSet2->fields['questionid'] . '</td><td><a href="test-manager.php?testid=' . $f_testid . (isset($_GET['subjectid2']) && $_GET['subjectid2'] != '' ? '' : '&subjectid2=' . $i_rSet2->fields['subjectid']) . $i_subjectid_addon . $i_order_addon . $i_url_limit_addon . $i_2_order_addon . $i_2_url_limit_addon . '&action=editt">' . convertTextValue($i_rSet2->fields['subject_name']) . '</a></td><td>' . getTruncatedHTML($i_rSet2->fields['question_text']) . '</td><td>';
            switch ($i_rSet2->fields['question_type']) {
                case QUESTION_TYPE_MULTIPLECHOICE:
                    echo $lngstr['label_atype_multiple_choice'];
                    break;
                case QUESTION_TYPE_TRUEFALSE:
                    echo $lngstr['label_atype_truefalse'];
                    break;
                case QUESTION_TYPE_MULTIPLEANSWER:
                    echo $lngstr['label_atype_multiple_answer'];
                    break;
                case QUESTION_TYPE_FILLINTHEBLANK:
                    echo $lngstr['label_atype_fillintheblank'];
                    break;
                case QUESTION_TYPE_ESSAY:
                    echo $lngstr['label_atype_essay'];
function getInputElement($i_name, $i_value, $size = 50, $maxlength = 0, $i_additional = '', $i_type = 'text')
{
    return '<input name="' . $i_name . '" value="' . convertTextValue(@$i_value) . '" class=inp type=' . $i_type . ' size=' . $size . ($maxlength > 0 ? " maxlength={$maxlength}" : "") . $i_additional . '>';
}
    }
}
echo '<td width=2><img src="images/toolbar-right.gif" width=2 height=32></td></tr></table>';
echo '</td></tr><tr><td>';
echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
echo '<tr vAlign=top><td class=rowhdr1 title="' . $lngstr['label_hdr_select_hint'] . '" width=22><input type=checkbox name=toggleAll onclick="toggleCBs(this);"></td>';
writeQryTableHeaders('question-bank.php?action=' . $i_subjectid_addon . $i_url_limit_addon, $i_tablefields, $i_order_no, $i_direction);
echo '<td class=rowhdr1 colspan=3>' . $lngstr['label_hdr_action'] . '</td></tr>';
$i_rSet1 = $g_db->SelectLimit("SELECT " . $srv_settings['table_prefix'] . "questions.questionid, " . $srv_settings['table_prefix'] . "questions.subjectid, " . $srv_settings['table_prefix'] . "questions.question_text, " . $srv_settings['table_prefix'] . "questions.question_time, " . $srv_settings['table_prefix'] . "questions.question_type, " . $srv_settings['table_prefix'] . "questions.question_points, " . $srv_settings['table_prefix'] . "subjects.subject_name FROM " . $srv_settings['table_prefix'] . "questions, " . $srv_settings['table_prefix'] . "subjects WHERE " . $i_sql_where_addon . "" . $srv_settings['table_prefix'] . "questions.subjectid=" . $srv_settings['table_prefix'] . "subjects.subjectid" . $i_sql_order_addon, $i_limitcount, $i_limitfrom);
if (!$i_rSet1) {
    showDBError(__FILE__, 1);
} else {
    $i_counter = 0;
    while (!$i_rSet1->EOF) {
        $rowname = $i_counter % 2 ? "rowone" : "rowtwo";
        echo '<tr id=tr_' . $i_pagewide_id . ' class=' . $rowname . ' onmouseover="rollTR(' . $i_pagewide_id . ',1);" onmouseout="rollTR(' . $i_pagewide_id . ',0);"><td align=center width=22><input id=cb_' . $i_pagewide_id . ' type=checkbox name=box_questions[] value="' . $i_rSet1->fields["questionid"] . '" onclick="toggleCB(this);"></td><td align=right>' . $i_rSet1->fields["questionid"] . '</td><td><a href="question-bank.php?action=editt' . (isset($_GET["subjectid"]) && $_GET["subjectid"] != "" ? "" : '&subjectid=' . $i_rSet1->fields["subjectid"]) . $i_order_addon . $i_url_limit_addon . '">' . convertTextValue($i_rSet1->fields["subject_name"]) . '</a></td><td>' . getTruncatedHTML($i_rSet1->fields["question_text"]) . '</td><td>';
        switch ($i_rSet1->fields["question_type"]) {
            case QUESTION_TYPE_MULTIPLECHOICE:
                echo $lngstr['label_atype_multiple_choice'];
                break;
            case QUESTION_TYPE_TRUEFALSE:
                echo $lngstr['label_atype_truefalse'];
                break;
            case QUESTION_TYPE_MULTIPLEANSWER:
                echo $lngstr['label_atype_multiple_answer'];
                break;
            case QUESTION_TYPE_FILLINTHEBLANK:
                echo $lngstr['label_atype_fillintheblank'];
                break;
            case QUESTION_TYPE_ESSAY:
                echo $lngstr['label_atype_essay'];