Commit e334b908 authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-4789 (Challengr addon not working)

parent 4cd22030
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -30,5 +30,18 @@ function init__site__pages__modules_custom__quiz($in = null)
        $in
    );

    $in = override_str_replace_exactly(
        "// Give them their result if it is a test.",
        "
        <ditto>
        if ((addon_installed('points')) && (\$quiz['q_points_for_passing'] != 0)) {
            require_code('points2');
            \$cost = \$quiz['q_points_for_passing'] / 2;
            \$points_difference -= \$cost;
        }
        ",
        $in
    );

    return $in;
}
+0 −1
Original line number Diff line number Diff line
@@ -137,7 +137,6 @@ class Hook_addon_registry_challengr
            'lang_custom/EN/quiz.ini',
            'themes/default/templates_custom/QUIZ_DONE_SCREEN.tpl',
            'site/pages/modules_custom/quiz.php',
            'sources_custom/quiz.php',
            'themes/default/templates_custom/QUIZ_BOX.tpl',
        );
    }

sources_custom/quiz.php

deleted100644 → 0
+0 −34
Original line number Diff line number Diff line
<?php /*

 Composr
 Copyright (c) ocProducts, 2004-2016

 See text/EN/licence.txt for full licencing information.

*/

/**
 * @license    http://opensource.org/licenses/cpal_1.0 Common Public Attribution License
 * @copyright  ocProducts Ltd
 * @package    challengr
 */

function init__quiz($in = null)
{
    i_solemnly_declare(I_UNDERSTAND_SQL_INJECTION | I_UNDERSTAND_XSS | I_UNDERSTAND_PATH_INJECTION);

    $in = override_str_replace_exactly(
        "if (\$minimum_percentage >= \$quiz['q_percentage'])",
        "
        if ((addon_installed('points')) && (\$quiz['q_points_for_passing'] != 0)) {
            require_code('points2');
            \$cost = \$quiz['q_points_for_passing'] / 2;
            \$points_difference -= \$cost;
        }
        <ditto>
        ",
        $in
    );

    return $in;
}