This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | // $Id: index.php,v 1.13 2007/03/24 20:08:53 marcellobrandao Exp $ |
||
3 | // ------------------------------------------------------------------------ // |
||
4 | // XOOPS - PHP Content Management System // |
||
5 | // Copyright (c) 2000 XOOPS.org // |
||
6 | // <http://www.xoops.org/> // |
||
7 | // ------------------------------------------------------------------------ // |
||
8 | // This program is free software; you can redistribute it and/or modify // |
||
9 | // it under the terms of the GNU General Public License as published by // |
||
10 | // the Free Software Foundation; either version 2 of the License, or // |
||
11 | // (at your option) any later version. // |
||
12 | // // |
||
13 | // You may not change or alter any portion of this comment or credits // |
||
14 | // of supporting developers from this source code or any supporting // |
||
15 | // source code which is considered copyrighted (c) material of the // |
||
16 | // original comment or credit authors. // |
||
17 | // // |
||
18 | // This program is distributed in the hope that it will be useful, // |
||
19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
||
20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
||
21 | // GNU General Public License for more details. // |
||
22 | // // |
||
23 | // You should have received a copy of the GNU General Public License // |
||
24 | // along with this program; if not, write to the Free Software // |
||
25 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
||
26 | // ------------------------------------------------------------------------ // |
||
27 | /** |
||
28 | * index.php, Respons�vel por listar as provas do usu�rio |
||
29 | * |
||
30 | * Este arquivo lista as provas do usu�rio e exibe quais est�o dispon�veis |
||
31 | * para realiza��o, quais est�o sendo corrigidas e quais |
||
32 | *commad |
||
33 | * @author Marcello Brand�o <[email protected]> |
||
34 | * @version 1.0 |
||
35 | * @package assessment |
||
36 | */ |
||
37 | |||
38 | /** |
||
39 | * Arquivos de cabe�alho do Xoops para carregar ... |
||
40 | */ |
||
41 | include dirname(dirname(__DIR__)) . '/mainfile.php'; |
||
42 | |||
43 | $xoopsOption['template_main'] = 'assessment_index.tpl'; |
||
44 | include dirname(dirname(__DIR__)) . '/header.php'; |
||
45 | |||
46 | /** |
||
47 | * Inclus�es das classes do m�dulo |
||
48 | */ |
||
49 | include __DIR__ . '/class/assessment_perguntas.php'; |
||
50 | include __DIR__ . '/class/assessment_provas.php'; |
||
51 | include __DIR__ . '/class/assessment_respostas.php'; |
||
52 | include __DIR__ . '/class/assessment_resultados.php'; |
||
53 | include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
54 | |||
55 | /** |
||
56 | * Definindo arquivo de template da p�gina |
||
57 | */ |
||
58 | |||
59 | /** |
||
60 | * Cria��o das F�bricas de objetos que vamos precisar |
||
61 | */ |
||
62 | $fabrica_de_provas = new Xoopsassessment_provasHandler($xoopsDB); |
||
63 | $fabrica_de_perguntas = new Xoopsassessment_perguntasHandler($xoopsDB); |
||
64 | $fabrica_de_resultados = new Xoopsassessment_resultadosHandler($xoopsDB); |
||
65 | |||
66 | /** |
||
67 | * Buscar todas as provas, todos os resultados deste aluno e e todas as perguntas |
||
68 | */ |
||
69 | if (isset($_GET['start'])) { |
||
70 | $start = $_GET['start']; |
||
71 | } |
||
72 | //$criteria = new criteria ('cod_prova'); |
||
0 ignored issues
–
show
|
|||
73 | //$criteria->setLimit(10); |
||
74 | //$criteria->setStart($start); |
||
75 | //$total_items = $fabrica_de_provas->getCount(); |
||
76 | |||
77 | //$vetor_provas = $fabrica_de_provas->getObjects($criteria); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
64% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
78 | $vetor_provas = $fabrica_de_provas->getObjects(); |
||
79 | $qtd_provas = count($vetor_provas); |
||
80 | $uid = $xoopsUser->getVar('uid'); |
||
81 | $criteria_aluno = new criteria('uid_aluno', $uid); |
||
82 | $vetor_resultados = $fabrica_de_resultados->getObjects($criteria_aluno); |
||
83 | $vetor_perguntas = $fabrica_de_perguntas->getObjects(); |
||
84 | //echo "<pre>"; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
70% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
85 | //print_r($vetor_resultados); |
||
86 | $grupos = $xoopsUser->getGroups(); |
||
87 | /** |
||
88 | * loop passar prova por prova |
||
89 | */ |
||
90 | $x = array(); |
||
91 | $i = 0; |
||
92 | foreach ($vetor_provas as $prova) { |
||
93 | $cod_prova = $prova->getVar('cod_prova'); |
||
94 | |||
95 | if ($prova->isAutorizado2($grupos)) { |
||
96 | $fim = $prova->getVar('data_fim', 'n'); |
||
97 | $tempo = $prova->getVar('tempo', 'n'); |
||
98 | $fimmaistempo = $fabrica_de_provas->dataMysql2dataUnix($fim) + $tempo; |
||
99 | |||
100 | if ($fimmaistempo < time()) { |
||
101 | $x[$i]['naodisponivel'] = 1; |
||
102 | } else { |
||
103 | $x[$i]['naodisponivel'] = 0; |
||
104 | } |
||
105 | |||
106 | $vetor_resultados_terminou = array(); |
||
107 | foreach ($vetor_resultados as $resultado) { |
||
108 | if ($resultado->getVar('terminou') == 1 & $resultado->getVar('cod_prova') == $cod_prova) { |
||
0 ignored issues
–
show
Consider adding parentheses for clarity. Current Interpretation:
($resultado->getVar('ter...d_prova') == $cod_prova , Probably Intended Meaning: $resultado->getVar('term..._prova') == $cod_prova)
When comparing the result of a bit operation, we suggest to add explicit parenthesis and not to rely on PHP’s built-in operator precedence to ensure the code behaves as intended and to make it more readable. Let’s take a look at these examples: // Returns always int(0).
return 0 === $foo & 4;
return (0 === $foo) & 4;
// More likely intended return: true/false
return 0 === ($foo & 4);
![]() |
|||
109 | $vetor_resultados_terminou[] = $resultado; |
||
110 | } |
||
111 | } |
||
112 | if (count($vetor_resultados_terminou) > 0) { |
||
113 | $x[$i]['terminou'] = 1; |
||
114 | $x[$i]['fechada'] = 0; |
||
115 | |||
116 | $vetor_resultados_terminou_e_fechada = array(); |
||
117 | foreach ($vetor_resultados_terminou as $resultado) { |
||
118 | if ($resultado->getVar('fechada') == 1) { |
||
119 | $vetor_resultados_terminou_e_fechada[] = $resultado; |
||
120 | } |
||
121 | } |
||
122 | |||
123 | if (count($vetor_resultados_terminou_e_fechada) > 0) { |
||
124 | $resultado = $vetor_resultados_terminou_e_fechada[0]; |
||
125 | $x[$i]['fechada'] = 1; |
||
126 | $x[$i]['nota_final'] = $resultado->getVar('nota_final'); |
||
127 | $x[$i]['nivel'] = $resultado->getVar('nivel'); |
||
128 | } |
||
129 | } |
||
130 | $x[$i]['cod_prova'] = $prova->getVar('cod_prova', 's'); |
||
131 | $x[$i]['tit_prova'] = $prova->getVar('titulo', 's'); |
||
132 | $x[$i]['inicio'] = $prova->getVar('data_inicio', 's'); |
||
133 | $x[$i]['fim'] = $prova->getVar('data_fim', 's'); |
||
134 | |||
135 | $vetor_perguntas_por_prova = array(); |
||
136 | foreach ($vetor_perguntas as $pergunta) { |
||
137 | if ($pergunta->getVar('cod_prova') == $cod_prova) { |
||
138 | $vetor_perguntas_por_prova[] = $pergunta; |
||
139 | } |
||
140 | } |
||
141 | $x[$i]['qtd_perguntas'] = count($vetor_perguntas_por_prova); |
||
142 | } |
||
143 | ++$i; |
||
144 | } |
||
145 | |||
146 | //$barra_navegacao = new XoopsPageNav($total_items, $xoopsModuleConfig['qtdindex'], $start); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
64% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
147 | //$barrinha = $barra_navegacao->renderImageNav(2); |
||
148 | //$xoopsTpl->assign('navegacao', $barrinha ); |
||
149 | $provas = $x; |
||
150 | $xoopsTpl->assign('xoops_pagetitle', $xoopsModule->getVar('name') . ' - ' . _MA_ASSESSMENT_LISTAPROVAS); |
||
151 | $xoopsTpl->assign('nome_modulo', $xoopsModule->getVar('name')); |
||
152 | $xoopsTpl->assign('vetor_provas', $provas); |
||
153 | $xoopsTpl->assign('lang_notafinal', _MA_ASSESSMENT_NOTAFINAL); |
||
154 | $xoopsTpl->assign('lang_listaprovas', _MA_ASSESSMENT_LISTAPROVAS); |
||
155 | $xoopsTpl->assign('lang_perguntas', _MA_ASSESSMENT_PERGUNTAS); |
||
156 | $xoopsTpl->assign('lang_nivel', _MA_ASSESSMENT_NIVEL); |
||
157 | $xoopsTpl->assign('lang_emcorrecao', _MA_ASSESSMENT_EMCORRECAO); |
||
158 | $xoopsTpl->assign('lang_inicio', _MA_ASSESSMENT_INICIO); |
||
159 | $xoopsTpl->assign('lang_fim', _MA_ASSESSMENT_FIM); |
||
160 | $xoopsTpl->assign('lang_tempoencerrado', _MA_ASSESSMENT_TEMPOENCERRADO); |
||
161 | $xoopsTpl->assign('lang_disponibilidade', _MA_ASSESSMENT_DISPONIBILIDADE); |
||
162 | |||
163 | //Fecha a p�gina com seu rodap�. Inclus�o Obrigat�ria |
||
164 | include dirname(dirname(__DIR__)) . '/footer.php'; |
||
165 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.