function check_htaccess(&$checks) { $a = get_app(); $status = true; $help = ""; if (function_exists('curl_init')) { $test = fetch_url($a->get_baseurl() . "/install/testrewrite"); if ($test != "ok") { $status = false; $help = t('Url rewrite in .htaccess is not working. Check your server configuration.'); } check_add($checks, t('Url rewrite is working'), $status, true, $help); } else { // cannot check modrewrite if libcurl is not installed } }
/** * @brief Check URL rewrite und SSL certificate. * * @param[out] array &$checks */ function check_htaccess(&$checks) { $a = get_app(); $status = true; $help = ''; $ssl_error = false; $url = $a->get_baseurl() . '/setup/testrewrite'; if (function_exists('curl_init')) { $test = z_fetch_url($url); if (!$test['success']) { if (strstr($url, 'https://')) { $test = z_fetch_url($url, false, 0, array('novalidate' => true)); if ($test['success']) { $ssl_error = true; } } else { $test = z_fetch_url(str_replace('http://', 'https://', $url), false, 0, array('novalidate' => true)); if ($test['success']) { $ssl_error = true; } } if ($ssl_error) { $help = t('SSL certificate cannot be validated. Fix certificate or disable https access to this site.') . EOL; $help .= t('If you have https access to your website or allow connections to TCP port 443 (the https: port), you MUST use a browser-valid certificate. You MUST NOT use self-signed certificates!') . EOL; $help .= t('This restriction is incorporated because public posts from you may for example contain references to images on your own hub.') . EOL; $help .= t('If your certificate is not recognized, members of other sites (who may themselves have valid certificates) will get a warning message on their own site complaining about security issues.') . EOL; $help .= t('This can cause usability issues elsewhere (not just on your own site) so we must insist on this requirement.') . EOL; $help .= t('Providers are available that issue free certificates which are browser-valid.') . EOL; check_add($checks, t('SSL certificate validation'), false, true, $help); } } if (!$test['success'] || $test['body'] != "ok") { $status = false; $help = t('Url rewrite in .htaccess is not working. Check your server configuration.' . 'Test: ' . var_export($test, true)); } check_add($checks, t('Url rewrite is working'), $status, true, $help); } else { // cannot check modrewrite if libcurl is not installed } }
function check_imagik(&$checks) { $imagick = false; $gif = false; if (class_exists('Imagick')) { $imagick = true; $supported = Photo::supportedTypes(); if (array_key_exists('image/gif', $supported)) { $gif = true; } } check_add($checks, t('ImageMagick PHP extension is installed'), $imagick, false, ""); if ($imagick) { check_add($checks, t('ImageMagick supports GIF'), $gif, false, ""); } }
function check_htconfig(&$checks) { $status = true; $help = ""; if (file_exists('.htconfig.php') && !is_writable('.htconfig.php') || !file_exists('.htconfig.php') && !is_writable('.')) { $status = false; $help = t('The web installer needs to be able to create a file called ".htconfig.php" in the top folder of your web server and it is unable to do so.') . EOL; $help .= t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.') . EOL; $help .= t('Please check with your site documentation or support people to see if this situation can be corrected.') . EOL; $help .= t('If not, you may be required to perform a manual installation. Please see the file "INSTALL.txt" for instructions.') . EOL; } check_add($checks, t('.htconfig.php is writable'), $status, true, $help); }
reorder_case($_GET['rank'], $_GET['move'], $data, $probid); // Redirect to the original page to prevent accidental redo's header('Location: testcase.php?probid=' . urlencode($probid)); return; } $title = 'Testcases for problem p' . specialchars(@$probid) . ' - ' . specialchars($prob['name']); $result = ''; if (isset($_POST['probid']) && IS_ADMIN) { $maxrank = 0; foreach ($data as $rank => $row) { $result .= check_update($probid, $rank, $FILES); if ($rank > $maxrank) { $maxrank = $rank; } } $result .= check_add($probid, $maxrank + 1, $FILES); } if (!empty($result)) { // Reload testcase data after updates $data = read_testdata($probid); } // Check if ranks must be renumbered (if test cases have been deleted). // There is no need to run this within one MySQL transaction since // nothing depends on the ranks being sequential, and we do preserve // their order while renumbering. end($data); if (count($data) < (int) key($data)) { $newrank = 1; foreach ($data as $rank => $row) { $DB->q('UPDATE testcase SET rank = %i WHERE probid = %i AND rank = %i', $newrank++, $probid, $rank);