function count_dir($dir_handle, $path) { global $foldercount, $phpcount, $htmlcount, $csscount, $othercount; global $phplinecount, $htmllinecount, $csslinecount; //echo "<ol>"; while (false !== ($file = readdir($dir_handle))) { $dir = $path . '/' . $file; if (is_dir($dir) && $file != '.' && $file != '..') { $handle = @opendir($dir) or die("undable to open file {$file}"); //echo "<li>$file</li>"; $foldercount++; count_dir($handle, $dir); } elseif ($file != '.' && $file != '..') { $fileext = strstr_after($file, '.'); switch ($fileext) { case "html": $htmlcount++; $htmllinecount = $htmllinecount + count_lines($dir); //echo "<li>$file</li>"; break; case "htm": $htmlcount++; $htmllinecount = $htmllinecount + count_lines($dir); //echo "<li>$file</li>"; break; case "php": $phpcount++; $phplinecount = $phplinecount + count_lines($dir); //echo "<li>$file</li>"; break; case "css": $csscount++; $csslinecount = $csslinecount + count_lines($dir); //echo "<li>$file</li>"; break; default: $othercount++; break; } } } //echo "</ol>"; //closing the directory closedir($dir_handle); }
if ($target_path == '') { $new_selection_path = $folder_name; } else { $new_selection_path = $target_path . "/" . $folder_name; } $cut_query = $dbh->prepare("UPDATE cm_documents SET folder = :new_selection_path, containing_folder = :target_path WHERE id = :item_id"); $data = array('target_path' => $target_path, 'new_selection_path' => $new_selection_path, 'item_id' => $item_id); $cut_query->execute($data); //change the path of any subfolders and documents in the selected folder $update_paths = $dbh->prepare("SELECT * FROM cm_documents WHERE folder LIKE :old_path AND case_id = :case_id"); $old_path = $selection_path . "%"; $data = array('old_path' => $old_path, 'case_id' => $case_id); $update_paths->execute($data); $paths = $update_paths->fetchAll(PDO::FETCH_ASSOC); foreach ($paths as $path) { $subfolder_path_part = strstr_after($path['folder'], $selection_path); $new_subfolder_path = $new_selection_path . $subfolder_path_part; //this for folders only if ($path['name'] === '') { $pos = strrpos($new_subfolder_path, '/'); $new_container = substr($new_subfolder_path, 0, $pos); } else { $new_container = ''; } $update_items = $dbh->prepare("UPDATE cm_documents SET folder = :folder, containing_folder = :container WHERE id = '{$path['id']}'"); $data = array('folder' => $new_subfolder_path, 'container' => $new_container); $update_items->execute($data); } } else { $cut_query = $dbh->prepare("UPDATE cm_documents SET folder = :target WHERE id = :item_id"); $data = array('target' => $target_path, 'item_id' => $item_id);
continue; } // look for tags $message_tag = strstr_after($msg_content, '[tag ', true); if ($message_tag) { $PhaseH_MSG[$hline]['Message_Tag'][] = getTagID($message_tag); continue; } // look for severity $message_severity = strstr_after($msg_content, '[severity ', true); if ($message_severity) { $PhaseH_MSG[$hline]['Message_Severity'] = array_search($message_severity, $severity); continue; } // look for msg $message_Msg = strstr_after($msg_content, '[msg ', true); if ($message_Msg) { $PhaseH_MSG[$hline]['Message_Msg'] = $message_Msg; // Get Scores from msg if (preg_match('/Inbound Anomaly Score \\(Total\\sInbound\\sScore:\\s?(?P<In_Total>[\\d]{1,4})?,\\sSQLi=(?P<In_SQLi>[\\d]{1,4})?,\\s?XSS=(?P<In_XSS>[\\d]{1,4})?/i', $message_Msg, $score)) { if (isset($score['In_Total']) and $score['In_Total'] > $PhaseH['Score']['In_Total']) { $PhaseH['Score']['In_Total'] = $score['In_Total']; } if (isset($score['In_SQLi']) and $score['In_SQLi'] > $PhaseH['Score']['In_SQLi']) { $PhaseH['Score']['In_SQLi'] = $score['In_SQLi']; } if (isset($score['In_XSS']) and $score['In_XSS'] > $PhaseH['Score']['In_XSS']) { $PhaseH['Score']['In_XSS'] = $score['In_XSS']; } } elseif (preg_match('/Inbound Anomaly Score Exceeded \\(Total\\sScore:\\s?(?P<In_Total>[\\d]{1,4})?,\\sSQLi=(?P<In_SQLi>[\\d]{1,4})?,\\s?XSS=(?P<In_XSS>[\\d]{1,4})?/i', $message_Msg, $score)) { if (isset($score['In_Total']) and $score['In_Total'] > $PhaseH['Score']['In_Total']) {