Example #1
0
function error($errorMessage, $line, $file)
{
    if (defined('DEBUG')) {
        $errorMessage .= '(Line: ' . $line . ')<br />';
        $errorMessage .= '(File: ' . $file . ')';
    }
    displayTemplate('An Error Occured', 'error', array('message' => $errorMessage));
    skLog($errorMessage);
    exit;
}
function smarty_function_includeCustomFile($params, &$smarty)
{
    global $g_vars, $G_SESSION;
    $i_file = isset($params['file']) ? $params['file'] : '';
    $i_value = isset($params['value']) ? $params['value'] : $G_SESSION['testid'];
    $i_postfix = '-' . $i_value;
    if (file_exists($smarty->template_dir . $i_file . $i_postfix . '.tpl.html')) {
        displayTemplate($i_file . $i_postfix);
    } else {
        displayTemplate($i_file);
    }
}
Example #3
0
function init($args)
{
    global $_SESS, $user;
    die(print httpGetVar('foobar', "Wow you're so cool!"));
    displayTemplate('Hello, World', 'user_login_form', array('foo' => 'bar'));
    $_SESS['sess_uid'] = 1;
    updateSession();
    print_r($_SESS);
    print_r($user);
    /*
        while($i < 50)
        {
            print $i.'...<br />';
            $i++;
        }
        print_r($args);*/
}
Example #4
0
        case $_GET['update']:
            $form->success("Updated successfully");
            break;
        case $_GET['add']:
            $form->success("Added new data successfully");
            break;
        case $_GET['delete']:
            $form->success("Deleted successfully");
            break;
    }
}
// Templates
if ($_GET['action'] == "list_templates") {
    displayAllTemplates();
} elseif ($_GET['action'] == "showTemplate") {
    displayTemplate();
} elseif ($_GET['action'] == "editTemplate") {
    if (isset($_POST['updateTemplate'])) {
        updateTemplate();
    } else {
        editTemplate();
    }
} elseif ($_GET['action'] == "addTemplate") {
    if (isset($_POST['insertTemplate'])) {
        insertTemplate();
    } else {
        addTemplate();
    }
} elseif ($_GET['action'] == "deleteTemplate") {
    deleteTemplate();
} elseif ($_GET['action'] == "list_checks") {
<?php

$g_vars['page']['location'] = array('test_manager', 'test_manager', 'test_questions', 'import_questions');
$f_testid = (int) readGetVar('testid');
$g_vars['page']['testid'] = $f_testid;
$g_vars['page']['header'] = $lngstr['page_header_import_questions'];
$g_vars['page']['selected_section'] = 'testmanager';
$g_vars['page']['selected_tab'] = 'testmanager-10';
$g_vars['page']['menu_2_items'] = getMenu2Items($g_vars['page']['selected_section']);
$i_cookie_prefix = 'test_import_';
$g_vars['page']['question_delimiter'] = readPostCookieVar('question_delimiter', $i_cookie_prefix . 'question_delimiter', 'Question: ');
$g_vars['page']['answer_delimiter'] = readPostCookieVar('answer_delimiter', $i_cookie_prefix . 'answer_delimiter', 'Choice: ');
$g_vars['page']['answer2_delimiter'] = readPostCookieVar('answer2_delimiter', $i_cookie_prefix . 'answer2_delimiter', 'Choice 2: ');
$g_vars['page']['preq_delimiter'] = readPostCookieVar('preq_delimiter', $i_cookie_prefix . 'preq_delimiter', 'Intro: ');
$g_vars['page']['postq_delimiter'] = readPostCookieVar('postq_delimiter', $i_cookie_prefix . 'postq_delimiter', 'Explanation: ');
$g_vars['page']['correct_delimiter'] = readPostCookieVar('correct_delimiter', $i_cookie_prefix . 'correct_delimiter', 'Correct: ');
$g_vars['page']['points_delimiter'] = readPostCookieVar('points_delimiter', $i_cookie_prefix . 'points_delimiter', 'Points: ');
$g_vars['page']['type_delimiter'] = readPostCookieVar('type_delimiter', $i_cookie_prefix . 'type_delimiter', 'Type: ');
$g_vars['page']['subject_delimiter'] = readPostCookieVar('subject_delimiter', $i_cookie_prefix . 'subject_delimiter', 'Subject: ');
$g_smarty->assign('g_vars', $g_vars);
displayTemplate('testmanager-questions-import');
<?php

$_GET['limitto'] = 2000000000;
$f_rtemplateid = (int) readGetVar('rtemplateid');
if ($f_rtemplateid > 0) {
    $i_columns_text = trim(getRecordItem($srv_settings['table_prefix'] . 'rtemplates', 'rtemplate_body', 'rtemplateid=' . $f_rtemplateid));
} else {
    $i_columns_text = 'resultid,result_datestart,result_datestart_formatted,id,username,user_firstname,user_lastname,testid,test_name,result_timeexceeded,result_points,result_pointsmax,result_score,grade_name';
}
$i_columns = explode(',', $i_columns_text);
foreach ($i_columns as $key => $val) {
    $g_vars['page']['tables'][1]['columns_to_show'][$val] = true;
}
if (readGetVar('action') == 'print') {
    $g_vars['page']['meta'] .= '<script language=javascript type="text/javascript">window.print();</script>';
}
$i_donotshow = true;
include_once $DOCUMENT_PAGES . 'reports-manager-1.inc.php';
displayTemplate('reports-manager-report-1');
    } 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('groups.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>';
//9917
$i_rSet1 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "groups" . $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' . ($i_rSet1->fields["groupid"] > SYSTEM_GROUP_MAX_INDEX ? '' : ' class=system') . '><input id=cb_' . $i_pagewide_id . ' type=checkbox name=box_groups[] value="' . $i_rSet1->fields["groupid"] . '" onclick="toggleCB(this);"></td><td align=right>' . $i_rSet1->fields["groupid"] . '</td><td>' . getTruncatedHTML($i_rSet1->fields["group_name"]) . '</td><td>' . $i_rSet1->fields["group_description"] . '</td>';
        echo '<td align=center width=22><a href="groups.php?groupid=' . $i_rSet1->fields["groupid"] . $i_order_addon . $i_url_limit_addon . '&action=edit"><img width=20 height=20 border=0 src="images/button-edit.gif" title="' . $lngstr['label_action_group_edit'] . '"></a></td><td align=center width=22>' . ($i_rSet1->fields["groupid"] > SYSTEM_GROUP_MAX_INDEX ? '<a href="groups.php?groupid=' . $i_rSet1->fields["groupid"] . $i_order_addon . $i_url_limit_addon . '&action=delete" onclick="return confirmMessage(this, \'' . $lngstr['qst_delete_group'] . '\')"><img width=20 height=20 border=0 src="images/button-cross.gif" title="' . $lngstr['label_action_group_delete'] . '"></a>' : '<img width=20 height=20 border=0 src="images/button-cross-inactive.gif">') . '</td></tr>';
        $i_counter++;
        $i_pagewide_id++;
        $i_rSet1->MoveNext();
    }
    $i_rSet1->Close();
}
echo '</table>';
echo '</td></tr></table></form>';
displayTemplate('_footer');
$g_vars['page']['userfield6_type_label'] = sprintf($lngstr['label_userfield_type'], 6);
$g_vars['page']['userfield6_type_content'] = getSelectElement('type_userfield6', getConfigItem(CONFIG_reg_type_userfield6), $lngstr['label_userfield_type_items'], ' onchange="showDIV(\'div_config_values_userfield6\', this.selectedIndex==' . CONFIG_CONST_type_dropdownlist . ', false);"') . '<br><div id=div_config_values_userfield6 style="display:' . (getConfigItem(CONFIG_reg_type_userfield6) == CONFIG_CONST_type_dropdownlist ? 'block' : 'none') . '">' . getInputElement('values_userfield6', getConfigItem(CONFIG_reg_values_userfield6)) . ' ' . $lngstr['label_userfield_values_hint'] . '</div>';
$g_vars['page']['userfield6_caption_label'] = sprintf($lngstr['label_userfield_caption'], 6);
$g_vars['page']['userfield6_caption_content'] = getInputElement('caption_userfield6', getConfigItem(CONFIG_reg_caption_userfield6));
$g_vars['page']['userfield7_label'] = sprintf($lngstr['label_userfield'], 7);
$g_vars['page']['userfield7_content'] = getSelectElement('userfield7', getConfigItem(CONFIG_reg_userfield7), array(CONFIG_CONST_donotshow => $lngstr['page_config']['donotshow'], CONFIG_CONST_show_donotrequire => $lngstr['page_config']['show_donotrequire'], CONFIG_CONST_show_require => $lngstr['page_config']['show_require']));
$g_vars['page']['userfield7_type_label'] = sprintf($lngstr['label_userfield_type'], 7);
$g_vars['page']['userfield7_type_content'] = getSelectElement('type_userfield7', getConfigItem(CONFIG_reg_type_userfield7), $lngstr['label_userfield_type_items'], ' onchange="showDIV(\'div_config_values_userfield7\', this.selectedIndex==' . CONFIG_CONST_type_dropdownlist . ', false);"') . '<br><div id=div_config_values_userfield7 style="display:' . (getConfigItem(CONFIG_reg_type_userfield7) == CONFIG_CONST_type_dropdownlist ? 'block' : 'none') . '">' . getInputElement('values_userfield7', getConfigItem(CONFIG_reg_values_userfield7)) . ' ' . $lngstr['label_userfield_values_hint'] . '</div>';
$g_vars['page']['userfield7_caption_label'] = sprintf($lngstr['label_userfield_caption'], 7);
$g_vars['page']['userfield7_caption_content'] = getInputElement('caption_userfield7', getConfigItem(CONFIG_reg_caption_userfield7));
$g_vars['page']['userfield8_label'] = sprintf($lngstr['label_userfield'], 8);
$g_vars['page']['userfield8_content'] = getSelectElement('userfield8', getConfigItem(CONFIG_reg_userfield8), array(CONFIG_CONST_donotshow => $lngstr['page_config']['donotshow'], CONFIG_CONST_show_donotrequire => $lngstr['page_config']['show_donotrequire'], CONFIG_CONST_show_require => $lngstr['page_config']['show_require']));
$g_vars['page']['userfield8_type_label'] = sprintf($lngstr['label_userfield_type'], 8);
$g_vars['page']['userfield8_type_content'] = getSelectElement('type_userfield8', getConfigItem(CONFIG_reg_type_userfield8), $lngstr['label_userfield_type_items'], ' onchange="showDIV(\'div_config_values_userfield8\', this.selectedIndex==' . CONFIG_CONST_type_dropdownlist . ', false);"') . '<br><div id=div_config_values_userfield8 style="display:' . (getConfigItem(CONFIG_reg_type_userfield8) == CONFIG_CONST_type_dropdownlist ? 'block' : 'none') . '">' . getInputElement('values_userfield8', getConfigItem(CONFIG_reg_values_userfield8)) . ' ' . $lngstr['label_userfield_values_hint'] . '</div>';
$g_vars['page']['userfield8_caption_label'] = sprintf($lngstr['label_userfield_caption'], 8);
$g_vars['page']['userfield8_caption_content'] = getInputElement('caption_userfield8', getConfigItem(CONFIG_reg_caption_userfield8));
$g_vars['page']['userfield9_label'] = sprintf($lngstr['label_userfield'], 9);
$g_vars['page']['userfield9_content'] = getSelectElement('userfield9', getConfigItem(CONFIG_reg_userfield9), array(CONFIG_CONST_donotshow => $lngstr['page_config']['donotshow'], CONFIG_CONST_show_donotrequire => $lngstr['page_config']['show_donotrequire'], CONFIG_CONST_show_require => $lngstr['page_config']['show_require']));
$g_vars['page']['userfield9_type_label'] = sprintf($lngstr['label_userfield_type'], 9);
$g_vars['page']['userfield9_type_content'] = getSelectElement('type_userfield9', getConfigItem(CONFIG_reg_type_userfield9), $lngstr['label_userfield_type_items'], ' onchange="showDIV(\'div_config_values_userfield9\', this.selectedIndex==' . CONFIG_CONST_type_dropdownlist . ', false);"') . '<br><div id=div_config_values_userfield9 style="display:' . (getConfigItem(CONFIG_reg_type_userfield9) == CONFIG_CONST_type_dropdownlist ? 'block' : 'none') . '">' . getInputElement('values_userfield9', getConfigItem(CONFIG_reg_values_userfield9)) . ' ' . $lngstr['label_userfield_values_hint'] . '</div>';
$g_vars['page']['userfield9_caption_label'] = sprintf($lngstr['label_userfield_caption'], 9);
$g_vars['page']['userfield9_caption_content'] = getInputElement('caption_userfield9', getConfigItem(CONFIG_reg_caption_userfield9));
$g_vars['page']['userfield10_label'] = sprintf($lngstr['label_userfield'], 10);
$g_vars['page']['userfield10_content'] = getSelectElement('userfield10', getConfigItem(CONFIG_reg_userfield10), array(CONFIG_CONST_donotshow => $lngstr['page_config']['donotshow'], CONFIG_CONST_show_donotrequire => $lngstr['page_config']['show_donotrequire'], CONFIG_CONST_show_require => $lngstr['page_config']['show_require']));
$g_vars['page']['userfield10_type_label'] = sprintf($lngstr['label_userfield_type'], 10);
$g_vars['page']['userfield10_type_content'] = getSelectElement('type_userfield10', getConfigItem(CONFIG_reg_type_userfield10), $lngstr['label_userfield_type_items'], ' onchange="showDIV(\'div_config_values_userfield10\', this.selectedIndex==' . CONFIG_CONST_type_dropdownlist . ', false);"') . '<br><div id=div_config_values_userfield10 style="display:' . (getConfigItem(CONFIG_reg_type_userfield10) == CONFIG_CONST_type_dropdownlist ? 'block' : 'none') . '">' . getInputElement('values_userfield10', getConfigItem(CONFIG_reg_values_userfield10)) . ' ' . $lngstr['label_userfield_values_hint'] . '</div>';
$g_vars['page']['userfield10_caption_label'] = sprintf($lngstr['label_userfield_caption'], 10);
$g_vars['page']['userfield10_caption_content'] = getInputElement('caption_userfield10', getConfigItem(CONFIG_reg_caption_userfield10));
$g_smarty->assign('g_vars', $g_vars);
displayTemplate('config-main');
$g_vars['page']['questionindicator'] = sprintf($lngstr['page_test']['questionindicator'], $G_SESSION['yt_questionno_current'], $G_SESSION['yt_questioncount']);
$g_vars['page']['testid'] = $G_SESSION['testid'];
$g_vars['page']['test_name'] = convertTextValue($G_SESSION['yt_name']);
$g_vars['page']['content_protection'] = $G_SESSION['yt_contentprotection'];
if (!isset($G_SESSION['questionid'])) {
    $nQuestionNoReal = $G_SESSION['yt_questions'][$G_SESSION['yt_questionno_current'] - 1];
    $G_SESSION['questionid'] = $G_SESSION['yt_questionids'][$nQuestionNoReal];
    $G_SESSION['yt_questionstart'] = time();
}
$g_vars['page']['has_feedback'] = $G_SESSION['yt_state'] == TEST_STATE_QFEEDBACK;
readTestQuestion($G_SESSION['yt_questionno_current'], $G_SESSION['questionid']);
$G_SESSION['yt_page_hasfeedback'] = $g_vars['page']['has_feedback'];
if ($g_vars['page']['errors_fatal'] && $G_SESSION['yt_state'] != TEST_STATE_QFEEDBACK) {
    unregisterTestData();
}
$g_vars['page']['variables']['yt_questionno'] = $G_SESSION['yt_questionno'];
$g_vars['page']['variables']['yt_questionno_current'] = $G_SESSION['yt_questionno_current'];
$g_vars['page']['variables']['yt_questioncount'] = $G_SESSION['yt_questioncount'];
$g_vars['page']['variables']['yt_state'] = $G_SESSION['yt_state'];
$g_vars['page']['review']['mode'] = $G_SESSION['yt_canreview'];
if ($G_SESSION['yt_canreview'] == IGT_TEST_REVIEW_ALLOWED) {
    for ($nQuestionNo = 1; $nQuestionNo <= min($G_SESSION['yt_questionno'], $G_SESSION['yt_questioncount']); $nQuestionNo++) {
        $nQuestionNoReal = $G_SESSION['yt_questions'][$nQuestionNo - 1];
        $nQuestionID = $G_SESSION['yt_questionids'][$nQuestionNoReal];
        $g_vars['page']['review']['question'][$nQuestionNo]['text_truncated'] = getTruncatedHTML(getRecordItem($srv_settings['table_prefix'] . 'questions', 'question_text', 'questionid=' . $nQuestionID));
    }
}
$g_smarty->assign('g_questionno', $G_SESSION['yt_questionno_current']);
$g_smarty->assign('g_vars', $g_vars);
displayTemplate('test-question');
                        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 {
                            $g_vars['page']['test'][$i_test_count]['status_label'] = sprintf($lngstr['page-takeatest']['attempts_left'], $g_vars['page']['test'][$i_test_count]['attempts_total'] - $g_vars['page']['test'][$i_test_count]['attempts']);
                            $g_vars['page']['test'][$i_test_count]['status'] = IGT_TEST_STATUS_AVAILABLE;
                        }
                    } else {
                        $g_vars['page']['test'][$i_test_count]['status_label'] = $lngstr['page_panel_status_available'];
                        $g_vars['page']['test'][$i_test_count]['status'] = IGT_TEST_STATUS_AVAILABLE;
                    }
                }
                if ($g_vars['page']['test'][$i_test_count]['testid'] == readCookieVar('pending_test_ids') && $g_vars['page']['test'][$i_test_count]['status'] == IGT_TEST_STATUS_AVAILABLE) {
                    $g_vars['page']['test'][$i_test_count]['status'] = IGT_TEST_STATUS_INPROGRESS;
                }
                $g_vars['page']['test'][$i_test_count]['status'] = eventOnQueryTestStatus(array('testno' => $i_test_count, 'testid' => $g_vars['page']['test'][$i_test_count]['testid'], 'status' => $g_vars['page']['test'][$i_test_count]['status']));
            }
            $i_rSet1->MoveNext();
        }
        $i_rSet1->Close();
    }
}
if ($g_vars['page']['user_points_max'] != 0) {
    $g_vars['page']['user_score'] = $g_vars['page']['user_points'] * 100 / $g_vars['page']['user_points_max'];
} else {
    $g_vars['page']['user_score'] = 0;
}
$g_vars['page']['test_count'] = $i_test_count;
eventOnBeforePageGeneration(array('page_name' => 'test-select'));
$g_smarty->assign('g_vars', $g_vars);
displayTemplate('test-select');
<?php

$g_vars['page']['title'] = $lngstr['page_getfile_template_html']['title'];
$f_resultid = (int) readGetVar('resultid');
if ($f_resultid > 0) {
    $g_vars['page']['content'] = getAdvancedReport($f_resultid);
    if ($g_vars['page']['content']) {
        $g_smarty->assign('g_vars', $g_vars);
        displayTemplate('getfile-template-html');
    }
}
function getTestResultSubjectsData($resultid)
{
    global $g_db, $G_SESSION, $srv_settings;
    $arrResult = array();
    $i_rSet1 = $g_db->Execute("SELECT questionid, result_answer_points, result_answer_iscorrect FROM " . $srv_settings['table_prefix'] . "results_answers WHERE resultid=" . $resultid);
    if (!$i_rSet1) {
        showDBError('getTestResultSubjectsData', 1);
    } else {
        while (!$i_rSet1->EOF) {
            $arrQuestion = getRecordItems($srv_settings['table_prefix'] . 'questions', array('subjectid', 'question_points'), 'questionid=' . $i_rSet1->fields['questionid']);
            if (!isset($arrResult[$arrQuestion['subjectid']])) {
                $arrResult[$arrQuestion['subjectid']]['got_answers'] = 0;
                $arrResult[$arrQuestion['subjectid']]['total_answers'] = 0;
                $arrResult[$arrQuestion['subjectid']]['got_points'] = 0;
                $arrResult[$arrQuestion['subjectid']]['total_points'] = 0;
            }
            $arrResult[$arrQuestion['subjectid']]['got_answers'] += $i_rSet1->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_CORRECT ? 1 : 0;
            $arrResult[$arrQuestion['subjectid']]['total_answers'] += 1;
            $arrResult[$arrQuestion['subjectid']]['got_points'] += $i_rSet1->fields['result_answer_points'];
            $arrResult[$arrQuestion['subjectid']]['total_points'] += $arrQuestion['question_points'];
        if ($i_rSet1->fields['test_attempts'] > 0) {
            $i_rSet4 = $g_db->Execute("SELECT test_attempt_count FROM " . $srv_settings['table_prefix'] . "tests_attempts WHERE testid=" . $i_rSet1->fields['testid'] . " AND id=" . $i_rSet1->fields['id']);
            if (!$i_rSet4) {
                showDBError(__FILE__, 3);
            } else {
                if (!$i_rSet4->EOF) {
                    $i_attempt_count = $i_rSet4->fields['test_attempt_count'];
                }
                $i_rSet4->Close();
            }
        }
        $g_vars['page']['tables'][1]['rows'][$i_counter] = $i_rSet1->fields;
        $g_vars['page']['tables'][1]['rows'][$i_counter]['result_datestart_formatted'] = getDateLocal($lngstr['language']['date_format'], $i_rSet1->fields['result_datestart']);
        $g_vars['page']['tables'][1]['rows'][$i_counter]['test_attempt_count'] = $i_attempt_count;
        if ($i_rSet1->fields['rtemplateid'] > 0 && ($i_rSet1->fields['test_reportgradecondition'] == 0 || $i_rSet1->fields['test_reportgradecondition'] >= $i_rSet1->fields['gscale_gradeid'])) {
            $g_vars['page']['tables'][1]['rows'][$i_counter]['show_html'] = $i_rSet1->fields['test_result_showhtml'];
            $g_vars['page']['tables'][1]['rows'][$i_counter]['show_pdf'] = $i_rSet1->fields['test_result_showpdf'];
        } else {
            $g_vars['page']['tables'][1]['rows'][$i_counter]['show_html'] = false;
            $g_vars['page']['tables'][1]['rows'][$i_counter]['show_pdf'] = false;
        }
        $i_counter++;
        $i_rSet1->MoveNext();
    }
    $i_rSet1->Close();
}
eventOnBeforePageGeneration(array('page_name' => 'reports-manager'));
$g_smarty->assign('g_vars', $g_vars);
if (empty($i_donotshow)) {
    displayTemplate('reports-manager');
}
if (!$i_rSet1) {
    showDBError(__FILE__, 1);
} else {
    if (!$i_rSet1->EOF) {
        $g_vars['page']['test_instructions'] = $i_rSet1->fields['test_instructions'];
    }
    $i_rSet1->Close();
}
for ($i = 2; $i <= $f_pageno; $i++) {
    if (($i_pos = strpos($g_vars['page']['test_instructions'], IGT_TAG_PAGE_BREAK)) !== false) {
        $g_vars['page']['test_instructions'] = substr($g_vars['page']['test_instructions'], $i_pos + strlen(IGT_TAG_PAGE_BREAK));
    } else {
        $g_vars['page']['test_instructions'] = '';
    }
}
if (strlen($g_vars['page']['test_instructions']) > 0) {
    if (($i_pos = strpos($g_vars['page']['test_instructions'], IGT_TAG_PAGE_BREAK)) !== false) {
        $g_vars['page']['test_instructions'] = substr($g_vars['page']['test_instructions'], 0, $i_pos);
        $g_vars['page']['next_page_exists'] = true;
    } else {
        $g_vars['page']['next_page_exists'] = false;
    }
    $g_vars['page']['form_action_url'] = 'test.php?action=instructions&testid=' . $G_SESSION['testid'] . '&pageno=' . ($f_pageno + 1);
    $g_smarty->assign('g_vars', $g_vars);
    displayTemplate('test-instructions');
} else {
    if ($G_SESSION['yt_state'] == TEST_STATE_TESTINTRO) {
        $G_SESSION['yt_state'] = TEST_STATE_QSHOW;
    }
    gotoLocation('test.php?action=&testid=' . $G_SESSION['testid']);
}
<?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');
        if (!$i_rSet5) {
            showDBError(__FILE__, 5);
        } else {
            if (!$i_rSet5->EOF) {
                $i_subjectid = $i_rSet5->fields['subjectid'];
                $g_vars['page']['subjects'][$i_subjectid]['question_count'] = getRecordCount($srv_settings['table_prefix'] . 'questions', 'subjectid=' . $i_subjectid);
                if (!isset($g_vars['page']['subjects'][$i_subjectid]['question_got'])) {
                    $g_vars['page']['subjects'][$i_subjectid]['name'] = $i_rSet5->fields['subject_name'];
                    $g_vars['page']['subjects'][$i_subjectid]['question_got'] = 0;
                    $g_vars['page']['subjects'][$i_subjectid]['question_correct'] = 0;
                }
                $g_vars['page']['subjects'][$i_subjectid]['question_got']++;
                if ($i_question['iscorrect'] == IGT_ANSWER_IS_CORRECT) {
                    $g_vars['page']['subjects'][$i_subjectid]['question_correct']++;
                }
            }
            $i_rSet5->Close();
        }
    }
    foreach ($g_vars['page']['subjects'] as $i_subjectid => $i_grade) {
        $g_vars['page']['subjects'][$i_subjectid]['question_correct_percents'] = $g_vars['page']['subjects'][$i_subjectid]['question_correct'] * 100 / $g_vars['page']['subjects'][$i_subjectid]['question_got'];
    }
}
$i_resultid = (int) readGetVar('resultid');
writeResultStats((int) $i_resultid);
$g_smarty->assign('g_vars', $g_vars);
if (!empty($_GET['print'])) {
    displayTemplate('statistics-resultid-print');
} else {
    displayTemplate('statistics-resultid');
}
Example #16
0
 function viewProfile($id)
 {
     // view profile.
     global $db;
     $query = $db->query('SELECT * FROM users WHERE id = \'' . (int) $id . '\'');
     $res = $query->fetchRow(DB_FETCHMODE_ASSOC);
     $res['password'] = '';
     // uhm, because I don't trust templates.
     displayTemplate('Profile For ' . $res['username'], 'user_viewprofile', array('data' => $res));
 }
<?php

$g_vars['page']['confirm_request'] = $i_confirm_request;
$g_vars['page']['confirm_url'] = $i_confirm_url;
$g_smarty->assign('g_vars', $g_vars);
displayTemplate('confirm');
<?php

if (!empty($g_vars['system']['payment_engine'])) {
    include_once $DOCUMENT_ADDONS . 'payment/' . $g_vars['system']['payment_engine'] . '/checkout.inc.php';
    exit;
} else {
    $g_vars['page']['header'] = $lngstr['page_buycheckout']['title'];
    $g_vars['page']['errors'] = $lngstr['page_buycheckout']['err_no_handler'];
    $f_testid = (int) readGetVar('testid');
    $g_smarty->assign('g_vars', $g_vars);
    displayTemplate('buy-checkout');
}
if ($i_showresultspage && $G_SESSION['yt_attempts'] > 0) {
    $i_attempt_count = 0;
    $i_rSet4 = $g_db->Execute("SELECT test_attempt_count FROM " . $srv_settings['table_prefix'] . "tests_attempts WHERE testid=" . $G_SESSION['testid'] . " AND id=" . $G_SESSION['id']);
    if ($i_rSet4) {
        if (!$i_rSet4->EOF) {
            $i_attempt_count = $i_rSet4->fields['test_attempt_count'];
        }
        $i_rSet4->Close();
    }
    $i_showresultspage = $i_attempt_count >= $i_attempts_allowed;
}
$g_vars['page']['show_takeatest'] = true;
$g_vars['page']['show_nexttest'] = $G_SESSION['yt_nexttestid'] > 0;
$g_vars['page']['show_reportsmanager'] = $i_showresultspage;
$g_vars['page']['show_advancedreport_pdf'] = $G_SESSION['yt_result_showpdf'] && ($G_SESSION['yt_reportgradecondition'] == 0 or $G_SESSION['yt_reportgradecondition'] >= $g_vars['page']['grade']['gradeid']);
$g_vars['page']['show_advancedreport_html'] = $G_SESSION['yt_result_showhtml'] && ($G_SESSION['yt_reportgradecondition'] == 0 or $G_SESSION['yt_reportgradecondition'] >= $g_vars['page']['grade']['gradeid']);
if ($G_SESSION['yt_result_rtemplateid'] > 0) {
    $i_isok = true;
    $i_isok = $i_isok && ($i_rSet2 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "users WHERE id=" . $G_SESSION['id'], 1));
    if ($i_isok) {
        $i_isok = $i_isok && !$i_rSet2->EOF;
    }
    if ($i_isok) {
        $i_arrTestAnswerDetails = getTestAnswerDetails($G_SESSION['resultid'], 'html');
        $g_vars['page']['custom_report'] = getReportTemplate(array('rtemplateid' => $G_SESSION['yt_result_rtemplateid'], 'username' => $i_rSet2->fields['username'], 'email' => $i_rSet2->fields['email'], 'title' => $i_rSet2->fields['user_title'], 'firstname' => $i_rSet2->fields['user_firstname'], 'lastname' => $i_rSet2->fields['user_lastname'], 'middlename' => $i_rSet2->fields['user_middlename'], 'address' => $i_rSet2->fields['user_address'], 'city' => $i_rSet2->fields['user_city'], 'state' => $i_rSet2->fields['user_state'], 'zip' => $i_rSet2->fields['user_zip'], 'country' => $i_rSet2->fields['user_country'], 'phone' => $i_rSet2->fields['user_phone'], 'fax' => $i_rSet2->fields['user_fax'], 'mobile' => $i_rSet2->fields['user_mobile'], 'pager' => $i_rSet2->fields['user_pager'], 'ipphone' => $i_rSet2->fields['user_ipphone'], 'webpage' => $i_rSet2->fields['user_webpage'], 'icq' => $i_rSet2->fields['user_icq'], 'msn' => $i_rSet2->fields['user_msn'], 'aol' => $i_rSet2->fields['user_aol'], 'gender' => $i_rSet2->fields['user_gender'], 'birthday' => $i_rSet2->fields['user_birthday'], 'husbandwife' => $i_rSet2->fields['user_husbandwife'], 'children' => $i_rSet2->fields['user_children'], 'trainer' => $i_rSet2->fields['user_trainer'], 'photo' => $i_rSet2->fields['user_photo'], 'company' => $i_rSet2->fields['user_company'], 'cposition' => $i_rSet2->fields['user_cposition'], 'department' => $i_rSet2->fields['user_department'], 'coffice' => $i_rSet2->fields['user_coffice'], 'caddress' => $i_rSet2->fields['user_caddress'], 'ccity' => $i_rSet2->fields['user_ccity'], 'cstate' => $i_rSet2->fields['user_cstate'], 'czip' => $i_rSet2->fields['user_czip'], 'ccountry' => $i_rSet2->fields['user_ccountry'], 'cphone' => $i_rSet2->fields['user_cphone'], 'cfax' => $i_rSet2->fields['user_cfax'], 'cmobile' => $i_rSet2->fields['user_cmobile'], 'cpager' => $i_rSet2->fields['user_cpager'], 'cipphone' => $i_rSet2->fields['user_cipphone'], 'cwebpage' => $i_rSet2->fields['user_cwebpage'], 'cphoto' => $i_rSet2->fields['user_cphoto'], 'ufield1' => $i_rSet2->fields['user_ufield1'], 'ufield2' => $i_rSet2->fields['user_ufield2'], 'ufield3' => $i_rSet2->fields['user_ufield3'], 'ufield4' => $i_rSet2->fields['user_ufield4'], 'ufield5' => $i_rSet2->fields['user_ufield5'], 'ufield6' => $i_rSet2->fields['user_ufield6'], 'ufield7' => $i_rSet2->fields['user_ufield7'], 'ufield8' => $i_rSet2->fields['user_ufield8'], 'ufield9' => $i_rSet2->fields['user_ufield9'], 'ufield10' => $i_rSet2->fields['user_ufield10'], 'test_name' => $G_SESSION['yt_name'], 'result_id' => $G_SESSION['resultid'], 'result_date' => getDateLocal($lngstr['language']['date_format_full'], $G_SESSION['yt_teststart']), 'result_time_spent' => getTimeFormatted($i_timespent_total), 'result_time_exceeded' => $i_timeexceeded ? $lngstr['label_yes'] : $lngstr['label_no'], 'result_points_scored' => $G_SESSION['yt_got_points'], 'result_points_possible' => $G_SESSION['yt_pointsmax'], 'result_percents' => $g_vars['page']['score'], 'result_grade' => $g_vars['page']['grade']['name'], 'result_grade_feedback' => $g_vars['page']['grade']['feedback'], 'result_subjects' => $G_SESSION['yt_subjects'], 'result_detailed_1' => $i_arrTestAnswerDetails['result_detailed_1'], 'result_detailed_2' => $i_arrTestAnswerDetails['result_detailed_2'], 'result_detailed_3' => $i_arrTestAnswerDetails['result_detailed_3'], 'result_detailed_4' => $i_arrTestAnswerDetails['result_detailed_4'], 'result_detailed_5' => $i_arrTestAnswerDetails['result_detailed_5'], 'result_detailed_6' => $i_arrTestAnswerDetails['result_detailed_6']));
    }
}
eventOnBeforePageGeneration(array('page_name' => 'test-showresults'));
$g_smarty->assign('g_vars', $g_vars);
displayTemplate('test-results');
    $productid = $_GET["productid"];
} else {
    if (isset($_POST["productid"]) and $_POST["productid"] != "") {
        $productid = $_POST["productid"];
    }
}
$sess_back = $_SERVER["PHP_SELF"] . "?begin=" . $begin . "&num=" . $num . "&numBegin=" . $numBegin . "&cmbSearchType=" . $cmbSearchType . "&txtSearch=" . $txtSearch . "&catid=" . $catid;
//$_SESSION["gbackurl"] = $sess_back;
$rs = mysql_query($sql);
if (mysql_num_rows($rs) != 0) {
    $prow = mysql_fetch_array($rs);
    $artistid = $prow["product_artist_id"];
}
include "includes/htmltop.php";
/*display the active template*/
$active_template = displayTemplate();
?>
<script language="JavaScript" type="text/JavaScript">
function clickSearch()
{
	document.frmCatalog.submit();
}
function openWindow(id)
{
	var url = "viewimage.php?id="+id;
	window.open(url,"Image","height=500,width=500,scrollbars=yes");
}
</script>

<body topmargin="0">
<table width="804" border="0" align="center" cellpadding="0" cellspacing="0">
    $i_userfield9_items = $lngstr['custom']['user_userfield9_items'];
} else {
    $i_userfield9_items = array();
    $i_items = explode(',', getConfigItem(CONFIG_reg_values_userfield9));
    foreach ($i_items as $val) {
        $i_userfield9_items[$val] = $val;
    }
}
$g_vars['page']['items']['userfield9'] = @getInputField(getConfigItem(CONFIG_reg_userfield9), getConfigItem(CONFIG_reg_caption_userfield9) . ':', getConfigItem(CONFIG_reg_type_userfield9) == CONFIG_CONST_type_singlelinetext ? getInputElement('userfield9', $f_userfield9) : (getConfigItem(CONFIG_reg_type_userfield9) == CONFIG_CONST_type_multilinetext ? getTextArea('userfield9', $f_userfield9) : getSelectElement('userfield9', $f_userfield9, $i_userfield9_items)));
if (isset($lngstr['custom']['user_userfield10_items'])) {
    $i_userfield10_items = $lngstr['custom']['user_userfield10_items'];
} else {
    $i_userfield10_items = array();
    $i_items = explode(',', getConfigItem(CONFIG_reg_values_userfield10));
    foreach ($i_items as $val) {
        $i_userfield10_items[$val] = $val;
    }
}
$g_vars['page']['items']['userfield10'] = @getInputField(getConfigItem(CONFIG_reg_userfield10), getConfigItem(CONFIG_reg_caption_userfield10) . ':', getConfigItem(CONFIG_reg_type_userfield10) == CONFIG_CONST_type_singlelinetext ? getInputElement('userfield10', $f_userfield10) : (getConfigItem(CONFIG_reg_type_userfield10) == CONFIG_CONST_type_multilinetext ? getTextArea('userfield10', $f_userfield10) : getSelectElement('userfield10', $f_userfield10, $i_userfield10_items)));
function getInputField($i_showsettings, $i_caption, $i_value)
{
    if ($i_showsettings >= CONFIG_CONST_show_donotrequire) {
        return getTR(array($i_caption . ' ' . ($i_showsettings >= CONFIG_CONST_show_autogenerate ? REQUIRED_FIELD_MARK : ''), $i_value));
    }
    return '';
}
$g_vars['page']['items']['groupid_input'] = getInputElement('groupid', $f_groupid, 0, 0, '', $i_type = 'hidden');
$g_vars['page']['items']['testid_input'] = getInputElement('testid', $f_testid, 0, 0, '', $i_type = 'hidden');
$g_smarty->assign('g_vars', $g_vars);
displayTemplate('register');