use CURL when it is available, remove option USE_CURL
This commit is contained in:
parent
8d505d78e3
commit
014d3ad823
4 changed files with 9 additions and 77 deletions
|
@ -71,9 +71,6 @@
|
|||
define('CHECK_FOR_NEW_VERSION', true);
|
||||
// Check for new versions of tt-rss automatically.
|
||||
|
||||
define('USE_CURL', false);
|
||||
// Use CURL to fetch remote data instead of PHP built-in fopen()
|
||||
|
||||
define('DIGEST_ENABLE', true);
|
||||
// Global option to enable daily digests. Also toggles the ability of users
|
||||
// to forward articles by email.
|
||||
|
|
|
@ -374,7 +374,7 @@
|
|||
$login = urlencode($login);
|
||||
$pass = urlencode($pass);
|
||||
|
||||
if (USE_CURL) {
|
||||
if (function_exists('curl_init')) {
|
||||
$ch = curl_init($url);
|
||||
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
|
||||
|
@ -453,62 +453,9 @@
|
|||
if (!$favicon_url)
|
||||
$favicon_url = rewrite_relative_url($url, "/favicon.ico");
|
||||
|
||||
// Run a test to see if what we have attempted to get actually exists.
|
||||
if(USE_CURL || url_validate($favicon_url)) {
|
||||
return $favicon_url;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return $favicon_url;
|
||||
} // function get_favicon_url
|
||||
|
||||
/**
|
||||
* Check if a link is a valid and working URL.
|
||||
*
|
||||
* @param mixed $link A URL to check
|
||||
* @access public
|
||||
* @return boolean True if the URL is valid, false otherwise.
|
||||
*/
|
||||
function url_validate($link) {
|
||||
|
||||
$url_parts = @parse_url($link);
|
||||
|
||||
if ( empty( $url_parts["host"] ) )
|
||||
return false;
|
||||
|
||||
if ( !empty( $url_parts["path"] ) ) {
|
||||
$documentpath = $url_parts["path"];
|
||||
} else {
|
||||
$documentpath = "/";
|
||||
}
|
||||
|
||||
if ( !empty( $url_parts["query"] ) )
|
||||
$documentpath .= "?" . $url_parts["query"];
|
||||
|
||||
$host = $url_parts["host"];
|
||||
$port = $url_parts["port"];
|
||||
|
||||
if ( empty($port) )
|
||||
$port = "80";
|
||||
|
||||
$socket = @fsockopen( $host, $port, $errno, $errstr, 30 );
|
||||
|
||||
if ( !$socket )
|
||||
return false;
|
||||
|
||||
fwrite ($socket, "HEAD ".$documentpath." HTTP/1.0\r\nHost: $host\r\n\r\n");
|
||||
|
||||
$http_response = fgets( $socket, 22 );
|
||||
|
||||
$responses = "/(200 OK)|(30[123])/";
|
||||
if ( preg_match($responses, $http_response) ) {
|
||||
fclose($socket);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // function url_validate
|
||||
|
||||
function check_feed_favicon($site_url, $feed, $link) {
|
||||
$favicon_url = get_favicon_url($site_url);
|
||||
|
||||
|
@ -775,9 +722,7 @@
|
|||
$icon_url = substr($icon_url, 0, 250);
|
||||
|
||||
if ($icon_url && $orig_icon_url != $icon_url) {
|
||||
if (USE_CURL || url_validate($icon_url)) {
|
||||
db_query($link, "UPDATE ttrss_feeds SET icon_url = '$icon_url' WHERE id = '$feed'");
|
||||
}
|
||||
db_query($link, "UPDATE ttrss_feeds SET icon_url = '$icon_url' WHERE id = '$feed'");
|
||||
}
|
||||
|
||||
if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) {
|
||||
|
|
|
@ -52,12 +52,6 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
if (USE_CURL && ! function_exists("curl_init")) {
|
||||
print "<b>Fatal Error</b>: You have enabled USE_CURL, but your PHP
|
||||
doesn't seem to support CURL functions.";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!defined('SESSION_EXPIRE_TIME')) {
|
||||
$err_msg = "config: SESSION_EXPIRE_TIME is undefined";
|
||||
}
|
||||
|
@ -149,10 +143,6 @@
|
|||
$err_msg = "php.ini: Safe mode is not supported. If you wish to continue, remove this test from sanity_check.php and proceeed at your own risk. Please note that your bug reports will not be accepted or reviewed.";
|
||||
}
|
||||
|
||||
if (defined('USE_CURL_FOR_ICONS')) {
|
||||
$err_msg = "config: USE_CURL_FOR_ICONS has been renamed to USE_CURL.";
|
||||
}
|
||||
|
||||
if ($err_msg) {
|
||||
print "<b>Fatal Error</b>: $err_msg\n";
|
||||
exit;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<?php # This file has been generated at: Sun Jan 30 19:01:07 MSK 2011
|
||||
<?php # This file has been generated at: Thu Mar 17 19:11:07 MSK 2011
|
||||
define('GENERATED_CONFIG_CHECK', 21);
|
||||
$requred_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MAGPIE_FETCH_TIME_OUT', 'MAGPIE_CACHE_DIR', 'MAGPIE_CACHE_AGE', 'ICONS_DIR', 'ICONS_URL', 'SINGLE_USER_MODE', 'TMP_DIRECTORY', 'ENABLE_UPDATE_DAEMON', 'DAEMON_SLEEP_INTERVAL', 'DATABASE_BACKED_SESSIONS', 'SESSION_CHECK_ADDRESS', 'SESSION_COOKIE_LIFETIME', 'SESSION_EXPIRE_TIME', 'DAEMON_UPDATE_LOGIN_LIMIT', 'CHECK_FOR_NEW_VERSION', 'USE_CURL', 'DIGEST_ENABLE', 'DIGEST_EMAIL_LIMIT', 'DAEMON_SENDS_DIGESTS', 'ENABLE_TRANSLATIONS', 'MYSQL_CHARSET', 'DEFAULT_UPDATE_METHOD', 'SIMPLEPIE_CACHE_DIR', 'SIMPLEPIE_CACHE_IMAGES', 'COUNTERS_MAX_AGE', 'DIGEST_FROM_NAME', 'DIGEST_FROM_ADDRESS', 'DIGEST_SUBJECT', 'DIGEST_SMTP_HOST', 'DIGEST_SMTP_LOGIN', 'DIGEST_SMTP_PASSWORD', 'DAEMON_FEED_LIMIT', 'ALLOW_REMOTE_USER_AUTH', 'AUTO_LOGIN', 'LOCK_DIRECTORY', 'ENABLE_GZIP_OUTPUT', 'PHP_EXECUTABLE', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'FEEDBACK_URL', 'FORCE_ARTICLE_PURGE', 'SPHINX_ENABLED', 'SPHINX_INDEX', 'ENABLE_TWEET_BUTTON', 'CONSUMER_KEY', 'CONSUMER_SECRET', 'CONFIG_VERSION'); ?>
|
||||
$requred_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MAGPIE_FETCH_TIME_OUT', 'MAGPIE_CACHE_DIR', 'MAGPIE_CACHE_AGE', 'ICONS_DIR', 'ICONS_URL', 'SINGLE_USER_MODE', 'TMP_DIRECTORY', 'ENABLE_UPDATE_DAEMON', 'DAEMON_SLEEP_INTERVAL', 'DATABASE_BACKED_SESSIONS', 'SESSION_CHECK_ADDRESS', 'SESSION_COOKIE_LIFETIME', 'SESSION_EXPIRE_TIME', 'DAEMON_UPDATE_LOGIN_LIMIT', 'CHECK_FOR_NEW_VERSION', 'DIGEST_ENABLE', 'DIGEST_EMAIL_LIMIT', 'DAEMON_SENDS_DIGESTS', 'ENABLE_TRANSLATIONS', 'MYSQL_CHARSET', 'DEFAULT_UPDATE_METHOD', 'SIMPLEPIE_CACHE_DIR', 'SIMPLEPIE_CACHE_IMAGES', 'COUNTERS_MAX_AGE', 'DIGEST_FROM_NAME', 'DIGEST_FROM_ADDRESS', 'DIGEST_SUBJECT', 'DIGEST_SMTP_HOST', 'DIGEST_SMTP_LOGIN', 'DIGEST_SMTP_PASSWORD', 'DAEMON_FEED_LIMIT', 'ALLOW_REMOTE_USER_AUTH', 'AUTO_LOGIN', 'LOCK_DIRECTORY', 'ENABLE_GZIP_OUTPUT', 'PHP_EXECUTABLE', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'FEEDBACK_URL', 'FORCE_ARTICLE_PURGE', 'SPHINX_ENABLED', 'SPHINX_INDEX', 'ENABLE_TWEET_BUTTON', 'CONSUMER_KEY', 'CONSUMER_SECRET', 'CONFIG_VERSION'); ?>
|
||||
|
|
Loading…
Reference in a new issue