{
    if (!is_numeric($check_str)) {
        return SYMBOL_ERROR;
    }
    if ($check_str < 0) {
        return SYMBOL_ERROR;
    }
    return $check_str;
}
//get data from client
$cmd;
$TrainingId;
//query
$link;
//1.get information from client
if (($cmd = check_command($_GET["cmd"])) == SYMBOL_ERROR) {
    sleep(DELAY_SEC);
    echo SYMBOL_ERROR_CMD;
    return;
}
if (($TrainingId = check_number($_GET["TrainingId"])) == SYMBOL_ERROR) {
    sleep(DELAY_SEC);
    echo SYMBOL_ERROR;
    return;
}
if (($UserId = check_number($_GET["UserId"])) == SYMBOL_ERROR) {
    sleep(DELAY_SEC);
    echo SYMBOL_ERROR;
    return;
}
if (($Status = check_number($_GET["Status"])) == SYMBOL_ERROR) {
Beispiel #2
0
can checkout the ICU data directory via SVN:

    \$ svn co http://source.icu-project.org/repos/icu/icu/trunk/source/data icu-data

MESSAGE
);
}
// Verify that all required directories exist
$source = $GLOBALS['argv'][1];
check_dir($source);
$source = realpath($source);
check_dir($source . DIRECTORY_SEPARATOR . 'curr');
check_dir($source . DIRECTORY_SEPARATOR . 'lang');
check_dir($source . DIRECTORY_SEPARATOR . 'locales');
check_dir($source . DIRECTORY_SEPARATOR . 'region');
check_command('genrb');
// Convert the *.txt resource bundles to *.res files
$target = __DIR__;
$currDir = $target . DIRECTORY_SEPARATOR . 'curr';
$langDir = $target . DIRECTORY_SEPARATOR . 'lang';
$localesDir = $target . DIRECTORY_SEPARATOR . 'locales';
$namesDir = $target . DIRECTORY_SEPARATOR . 'names';
$namesGeneratedDir = $namesDir . DIRECTORY_SEPARATOR . 'generated';
$regionDir = $target . DIRECTORY_SEPARATOR . 'region';
make_directory($currDir);
clear_directory($currDir);
genrb_file($currDir, $source . DIRECTORY_SEPARATOR . 'curr', 'en');
genrb_file($currDir, $source . DIRECTORY_SEPARATOR . 'curr', 'supplementalData');
// It seems \ResourceBundle does not like locale names with uppercase chars then we rename the binary file
// See: http://bugs.php.net/bug.php?id=54025
$filename_from = $currDir . DIRECTORY_SEPARATOR . 'supplementalData.res';
version to build the data files.

Read the UPDATE.txt file for more info.

MESSAGE
);
}
check_command('svn');
// Script options
$version = isset($GLOBALS['argv'][1]) ? $GLOBALS['argv'][1] : icu_version();
$icuBinPath = isset($GLOBALS['argv'][2]) ? $GLOBALS['argv'][2] : '';
// Slash the path
if ('' != $icuBinPath && strrpos($icuBinPath, DIRECTORY_SEPARATOR) + 1 != strlen($icuBinPath)) {
    $icuBinPath .= DIRECTORY_SEPARATOR;
}
check_command($icuBinPath . 'genrb');
$version = normalize_icu_version($version);
$source = download_icu_data($version);
// Verify that all required directories exist
check_dir($source);
check_dir($source . DIRECTORY_SEPARATOR . '.svn');
$source = realpath($source);
// Currency, language and region data are bundled in the locales directory in ICU <= 4.2
if (!is_icu_version_42_or_earlier($version)) {
    check_dir($source . DIRECTORY_SEPARATOR . 'curr');
    check_dir($source . DIRECTORY_SEPARATOR . 'lang');
    check_dir($source . DIRECTORY_SEPARATOR . 'region');
}
check_dir($source . DIRECTORY_SEPARATOR . 'locales');
// Convert the *.txt resource bundles to *.res files
$target = $version;
Beispiel #4
0
function check_command($command, $depth, $function_guard = '', $nogo_parameters = NULL)
{
    if (is_null($nogo_parameters)) {
        $nogo_parameters = array();
    }
    global $LOCAL_VARIABLES, $CURRENT_CLASS, $FUNCTION_SIGNATURES;
    foreach ($command as $i => $c) {
        if ($c == array()) {
            continue;
        }
        if (is_integer($c[count($c) - 1])) {
            $c_pos = $c[count($c) - 1];
            $or = false;
        } else {
            $c_pos = $c[count($c) - 2];
            $or = true;
        }
        switch ($c[0]) {
            case 'CALL_METHOD':
                check_method($c, $c_pos, $function_guard);
                break;
            case 'CALL_INDIRECT':
                add_variable_reference($c[1][1], $c_pos);
                break;
            case 'VARIABLE':
                check_variable($c);
                break;
            case 'CALL_DIRECT':
                if (isset($GLOBALS['PEDANTIC'])) {
                    if (isset($GLOBALS['NULL_ERROR_FUNCS'][$c[1]]) || isset($GLOBALS['FALSE_ERROR_FUNCS'][$c[1]])) {
                        log_warning('Crucial return value was not handled', $c_pos);
                    }
                }
                check_call($c, $c_pos, NULL, $function_guard);
                break;
            case 'GLOBAL':
                foreach ($c[1] as $v) {
                    if (isset($LOCAL_VARIABLES[$v[1]]) && !$LOCAL_VARIABLES[$v[1]]['is_global']) {
                        log_warning($v[1] . ' was referenced before this globalisation.', $c_pos);
                    }
                    add_variable_reference($v[1], $c_pos, false);
                    $LOCAL_VARIABLES[$v[1]]['is_global'] = true;
                    $LOCAL_VARIABLES[$v[1]]['unused_value'] = true;
                }
                break;
            case 'RETURN':
                $ret_type = check_expression($c[1], false, false, $function_guard);
                add_variable_reference('__return', $c_pos);
                set_ocportal_type('__return', $ret_type);
                if (!isset($LOCAL_VARIABLES['__return']['mentions'])) {
                    $LOCAL_VARIABLES['__return']['mentions'] = array();
                }
                $LOCAL_VARIABLES['__return']['mentions'][] = $c_pos;
                if (count($command) - 1 > $i) {
                    log_warning('There is unreachable code', $c_pos);
                }
                break;
            case 'SWITCH':
                $switch_type = check_expression($c[1], false, false, $function_guard);
                foreach ($c[2] as $case) {
                    if (!is_null($case[0])) {
                        $passes = ensure_type(array($switch_type), check_expression($case[0], false, false, $function_guard), $c_pos, 'Switch type inconsistency');
                        if ($passes) {
                            infer_expression_type_to_variable_type($switch_type, $case[0]);
                        }
                    }
                    check_command($case[1], $depth + 1, $function_guard, $nogo_parameters);
                }
                break;
            case 'ASSIGNMENT':
                check_assignment($c, $c_pos, $function_guard);
                break;
            case 'IF':
                $t = check_expression($c[1], false, false, $function_guard);
                $passes = ensure_type(array('boolean'), $t, $c_pos, 'Conditionals must be boolean (if) [is ' . $t . ']', true);
                if ($passes) {
                    infer_expression_type_to_variable_type('boolean', $c[1]);
                }
                if ($c[1][0] == 'BOOLEAN_NOT' && $c[1][1][0] == 'CALL_DIRECT' && strpos($c[1][1][1], '_exists') !== false && $c[1][1][2][0][0] == 'LITERAL' && $c[1][1][2][0][1][0] == 'STRING' && ($c[2][0][0] == 'BREAK' || $c[2][0][0] == 'CONTINUE' || $c[2][0][0] == 'RETURN' || $c[2][0][0] == 'CALL_DIRECT' && $c[2][0][1] == 'critical_error')) {
                    $function_guard .= ',' . $c[1][1][2][0][1][1] . ',';
                }
                $temp_function_guard = $function_guard;
                if ($c[1][0] == 'CALL_DIRECT' && strpos($c[1][1], '_exists') !== false && $c[1][2][0][0] == 'LITERAL' && $c[1][2][0][1][0] == 'STRING') {
                    $temp_function_guard .= ',' . $c[1][2][0][1][1] . ',';
                }
                if ($c[1][0] == 'BOOLEAN_AND' && $c[1][1][0] == 'BRACKETED' && $c[1][1][1][0] == 'CALL_DIRECT' && strpos($c[1][1][1][1], '_exists') !== false && $c[1][1][1][2][0][0] == 'LITERAL' && $c[1][1][1][2][0][1][0] == 'STRING') {
                    $temp_function_guard .= ',' . $c[1][1][1][2][0][1][1] . ',';
                }
                if ($c[1][0] == 'BOOLEAN_AND' && $c[1][2][0] == 'BOOLEAN_AND' && $c[1][2][1][0] == 'BRACKETED' && $c[1][2][1][1][0] == 'CALL_DIRECT' && strpos($c[1][2][1][1][1], '_exists') !== false && $c[1][2][1][1][2][0][0] == 'LITERAL' && $c[1][2][1][1][2][0][1][0] == 'STRING') {
                    $temp_function_guard .= ',' . $c[1][2][1][1][2][0][1][1] . ',';
                }
                check_command($c[2], $depth, $temp_function_guard, $nogo_parameters);
                break;
            case 'IF_ELSE':
                $passes = ensure_type(array('boolean'), check_expression($c[1], false, false, $function_guard), $c_pos, 'Conditionals must be boolean (if-else)', true);
                if ($passes) {
                    infer_expression_type_to_variable_type('boolean', $c[1]);
                }
                $temp_function_guard = $function_guard;
                if ($c[1][0] == 'CALL_DIRECT' && strpos($c[1][1], '_exists') !== false && $c[1][2][0][0] == 'LITERAL' && $c[1][2][0][1][0] == 'STRING') {
                    $temp_function_guard .= ',' . $c[1][2][0][1][1] . ',';
                }
                if ($c[1][0] == 'BOOLEAN_AND' && $c[1][1][0] == 'BRACKETED' && $c[1][1][1][0] == 'CALL_DIRECT' && strpos($c[1][1][1][1], '_exists') !== false && $c[1][1][1][2][0][0] == 'LITERAL' && $c[1][1][1][2][0][1][0] == 'STRING') {
                    $temp_function_guard .= ',' . $c[1][1][1][2][0][1][1] . ',';
                }
                if ($c[1][0] == 'BOOLEAN_AND' && $c[1][2][0] == 'BOOLEAN_AND' && $c[1][2][1][0] == 'BRACKETED' && $c[1][2][1][1][0] == 'CALL_DIRECT' && strpos($c[1][2][1][1][1], '_exists') !== false && $c[1][2][1][1][2][0][0] == 'LITERAL' && $c[1][2][1][1][2][0][1][0] == 'STRING') {
                    $temp_function_guard .= ',' . $c[1][2][1][1][2][0][1][1] . ',';
                }
                check_command($c[2], $depth, $temp_function_guard, $nogo_parameters);
                check_command($c[3], $depth, $function_guard, $nogo_parameters);
                break;
            case 'INNER_FUNCTION':
                $temp = $LOCAL_VARIABLES;
                check_function($c[1]);
                $LOCAL_VARIABLES = $temp;
                break;
            case 'INNER_CLASS':
                $class = $c[1];
                foreach ($class['functions'] as $function) {
                    $temp = $LOCAL_VARIABLES;
                    $LOCAL_VARIABLES['this'] = array('is_global' => false, 'conditioner' => array(), 'conditioned_zero' => false, 'conditioned_false' => false, 'conditioned_null' => false, 'types' => array('object'), 'references' => 0, 'object_type' => $CURRENT_CLASS, 'unused_value' => false, 'first_mention' => 0, 'mixed_tag' => false);
                    check_function($function);
                    $LOCAL_VARIABLES = $temp;
                }
                break;
            case 'TRY':
                check_command($c[1], $depth + 1, $function_guard, $nogo_parameters);
                // Goes first so that we get local variables defined inside loop for use in our loop conditional
                add_variable_reference($c[2][1][0][1], $c_pos, false);
                check_command($c[2][2], $depth + 1, $function_guard);
                // Goes first so that we get local variables defined inside loop for use in our loop conditional
                break;
            case 'FOREACH_map':
                $passes = ensure_type(array('array'), check_expression($c[1], false, false, $function_guard), $c_pos, 'Foreach must take array');
                if ($passes) {
                    infer_expression_type_to_variable_type('array', $c[1]);
                }
                add_variable_reference($c[2][1], $c_pos, false);
                add_variable_reference($c[3][1], $c_pos, false);
                if (in_array($c[2][1], $nogo_parameters)) {
                    log_warning('Re-using a loop variable, ' . $c[2][1], $c_pos);
                }
                if (in_array($c[3][1], $nogo_parameters)) {
                    log_warning('Re-using a loop variable, ' . $c[3][1], $c_pos);
                }
                check_command($c[4], $depth + 1, $function_guard, array_merge($nogo_parameters, array($c[2][1], $c[3][1])));
                break;
            case 'FOREACH_list':
                $passes = ensure_type(array('array'), check_expression($c[1], false, false, $function_guard), $c_pos, 'Foreach must take array');
                if ($passes) {
                    infer_expression_type_to_variable_type('array', $c[1]);
                }
                add_variable_reference($c[2][1], $c_pos, false);
                if (in_array($c[2][1], $nogo_parameters)) {
                    log_warning('Re-using a loop variable, ' . $c[2][1], $c_pos);
                }
                check_command($c[3], $depth + 1, $function_guard, array_merge($nogo_parameters, array($c[2][1])));
                break;
            case 'FOR':
                if (!is_null($c[1])) {
                    check_command(array($c[1]), $depth + 1, $function_guard);
                }
                check_command(array($c[3]), $depth + 1, $function_guard);
                $passes = ensure_type(array('boolean'), check_expression($c[2], false, false, $function_guard), $c_pos, 'Conditionals must be boolean (for)', true);
                if ($passes) {
                    infer_expression_type_to_variable_type('boolean', $c[2]);
                }
                check_command($c[4], $depth + 1, $function_guard, $nogo_parameters);
                break;
            case 'DO':
                check_command($c[2], $depth + 1, $function_guard, $nogo_parameters);
                // Goes first so that we get local variables defined inside loop for use in our loop conditional
                $passes = ensure_type(array('boolean'), check_expression($c[1], false, false, $function_guard), $c_pos, 'Conditionals must be boolean (do)', true);
                if ($passes) {
                    infer_expression_type_to_variable_type('boolean', $c[1]);
                }
                break;
            case 'WHILE':
                $passes = ensure_type(array('boolean'), check_expression($c[1], false, false, $function_guard), $c_pos, 'Conditionals must be boolean (while)', true);
                if ($passes) {
                    infer_expression_type_to_variable_type('boolean', $c[1]);
                }
                check_command($c[2], $depth + 1, $function_guard, $nogo_parameters);
                break;
            case 'CONTINUE':
                if ($c[1][0] == 'SOLO' && $c[1][1][0] == 'LITERAL' && $c[1][1][1][0] == 'INTEGER') {
                    if ($c[1][1][1][1] > $depth) {
                        log_warning('Continue level greater than loop/switch depth', $c_pos);
                    }
                }
                $passes = ensure_type(array('integer'), check_expression($c[1], false, false, $function_guard), $c_pos, 'Loop/switch control must use integers (continue)');
                if ($passes) {
                    infer_expression_type_to_variable_type('integer', $c[1]);
                }
                break;
            case 'BREAK':
                $passes = ensure_type(array('integer'), check_expression($c[1], false, false, $function_guard), $c_pos, 'Loop/switch control must use integers (break)');
                if ($passes) {
                    infer_expression_type_to_variable_type('integer', $c[1]);
                }
                break;
            case 'PRE_DEC':
                ensure_type(array('integer', 'float'), check_variable($c[1]), $c_pos, 'Can only decrement numbers');
                break;
            case 'PRE_INC':
                ensure_type(array('integer', 'float'), check_variable($c[1]), $c_pos, 'Can only increment numbers');
                break;
            case 'DEC':
                ensure_type(array('integer', 'float'), check_variable($c[1]), $c_pos, 'Can only decrement numbers');
                break;
            case 'INC':
                ensure_type(array('integer', 'float'), check_variable($c[1]), $c_pos, 'Can only increment numbers');
                break;
            case 'ECHO':
                foreach ($c[1] as $e) {
                    $passes = ensure_type(array('string'), check_expression($e, false, false, $function_guard), $c_pos, 'Can only echo strings');
                    if ($passes) {
                        infer_expression_type_to_variable_type('string', $e);
                    }
                }
                break;
        }
        if ($or) {
            check_command(array($c[count($c) - 1]), $depth, $function_guard, $nogo_parameters);
        }
    }
}