function check_status() { global $page, $webimroot, $settings, $dbversion; $page['done'][] = getlocal2("install.0.php", array(phpversion())); if (!check_webimroot()) { return; } if (!check_files()) { return; } $link = check_connection(); if (!$link) { return; } if (!check_database($link)) { mysql_close($link); return; } if (!check_tables($link)) { mysql_close($link); return; } if (!check_columns($link)) { mysql_close($link); return; } check_sound(); $page['done'][] = getlocal("installed.message"); if (!check_admin($link)) { $page['nextstep'] = getlocal("installed.login_link"); $page['nextnotice'] = getlocal2("installed.notice", array("{$webimroot}/install/")); $page['nextstepurl'] = "{$webimroot}/operator/login.php?login=admin"; } $page['show_small_login'] = true; mysql_close($link); loadsettings(); $settings['dbversion'] = $dbversion; update_settings(); }
if ($config_values['Settings']['Sanitize Hidelist'] != 1) { include 'update_hidelist.php'; $config_values['Settings']['Sanitize Hidelist'] = 1; _debug("Updated Hidelist\n"); write_config_file(); } //authenticate(); $config_values['Global']['HTMLOutput'] = 1; $html_out = ""; $debug_output = "Torrentwatch Debug:"; $verbosity = 0; parse_options(); if (check_requirements()) { return; } check_files(); echo $html_out; $html_out = ""; flush(); // Feeds load_feeds($config_values['Feeds']); feeds_perform_matching($config_values['Feeds']); get_client(); close_html(); $footer = "<div id=\"footer\">TorrentWatch-X version {$tw_version['0']}"; if (isset($tw_version[1])) { $footer .= " - {$tw_version['1']}"; } echo "{$footer}</div>"; if (!isset($config_values['Settings']['Hide Donate Button'])) { echo '<div id="donate">
<?php function check_files() { foreach ($_POST as $key => $value) { if (strncmp($key, "md5_", 4) == 0) { $field_name = substr($key, 4); if (!isset($_FILES[$field_name])) { return false; } if (!isset($_FILES[$field_name]["tmp_name"])) { return false; } if ($_FILES[$field_name]["tmp_name"] == "") { return false; } $md5_real = md5(file_get_contents($_FILES[$field_name]["tmp_name"])); $md5_ref = $value; if ($md5_real != $md5_ref) { return false; } } } return true; } if (check_files()) { echo '<p>PASS</p>'; } else { echo '<p>FAIL</p>'; }
function find_files($seed) { if (!is_dir($seed)) { return false; } $files = array(); $dirs = array($seed); while (NULL !== ($dir = array_pop($dirs))) { if ($dh = opendir($dir)) { while (false !== ($file = readdir($dh))) { if ($file == '.' || $file == '..') { continue; } $path = $dir . '/' . $file; if (is_dir($path)) { $dirs[] = $path; } else { if (preg_match('/^.*\\.(php[\\d]?|txt)$/i', $path)) { check_files($path); } } } closedir($dh); } } }