if (isset($_SERVER['argv']) && (array_key_exists(2, $_SERVER['argv']) || array_key_exists('spacedpaths', $_SERVER['argv']))) { $to_use_multi = array(); foreach ($_SERVER['argv'] as $key => $val) { if (is_integer($key) && $key != 0) { $to_use_multi[] = $val; } } } else { $to_use_multi = explode(':', $_to_use); } } foreach ($to_use_multi as $to_use) { // $to_use=str_replace('\\','/',$to_use); $full_path = ($OCPORTAL_PATH == '' ? '' : $OCPORTAL_PATH . (substr($OCPORTAL_PATH, -1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR)) . $to_use; if (strpos(file_get_contents($full_path), '/*CQC: No check*/') !== false) { echo 'SKIP: ' . $to_use . cnl(); continue; } check(parse_file($full_path)); } } echo 'FINAL Done!'; // Do the actual code quality check function check($structure) { global $GLOBAL_VARIABLES, $CURRENT_CLASS, $OK_EXTRA_FUNCTIONS; $GLOBAL_VARIABLES = array(); $OK_EXTRA_FUNCTIONS = $structure['ok_extra_functions']; $CURRENT_CLASS = '__global'; global $LOCAL_VARIABLES; $LOCAL_VARIABLES = reinitialise_local_variables();
function fatal_exit($message) { global $TO_USE, $LINE; echo 'ISSUE "' . $TO_USE . '" ' . strval($LINE) . ' 0 ' . $message . cnl(); }
function log_warning($warning, $i = -1, $absolute = false) { global $TEXT, $FILENAME, $START_TIME, $myfile_WARNINGS; if ($i == -1 && isset($GLOBALS['i'])) { $i = $GLOBALS['i']; } list($pos, $line, $full_line) = pos_to_line_details($i, $absolute); echo 'WARNING "' . $FILENAME . '" ' . $line . ' ' . $pos . ' ' . 'PHP: ' . $warning . cnl(); // if (!isset($myfile_WARNINGS)) $myfile_WARNINGS=fopen('warnings_'.$START_TIME.'.log','at'); // fwrite($myfile_WARNINGS,$FILENAME.': '.$warning.' (at line '.$line.', position '.$pos.') ['.$full_line.']'."\n"); //fclose($myfile_WARNINGS); }