summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-03-17 19:16:44 +0300
committerAndrew Dolgov <[email protected]>2011-03-17 19:16:44 +0300
commit014d3ad823d653eed424ac95cac454b5ca6d06f3 (patch)
tree2b563bea8d06872710ccecc8376e32f2cb745cd1
parent8d505d78e3989c6c72dd7fdab82111e4d7ecdcbc (diff)
use CURL when it is available, remove option USE_CURL
-rw-r--r--config.php-dist3
-rw-r--r--functions.php61
-rw-r--r--sanity_check.php18
-rw-r--r--sanity_config.php4
4 files changed, 9 insertions, 77 deletions
diff --git a/config.php-dist b/config.php-dist
index bd61c9bf0..b4d09f434 100644
--- a/config.php-dist
+++ b/config.php-dist
@@ -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.
diff --git a/functions.php b/functions.php
index 9090d8cff..c9a8c8686 100644
--- a/functions.php
+++ b/functions.php
@@ -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']) {
diff --git a/sanity_check.php b/sanity_check.php
index e6e58b2ab..c9d0fe922 100644
--- a/sanity_check.php
+++ b/sanity_check.php
@@ -5,7 +5,7 @@
define('SCHEMA_VERSION', 81);
if (!file_exists("config.php")) {
- print "<b>Fatal Error</b>: You forgot to copy
+ print "<b>Fatal Error</b>: You forgot to copy
<b>config.php-dist</b> to <b>config.php</b> and edit it.\n";
exit;
}
@@ -41,7 +41,7 @@
if (file_exists("xml-export.php") || file_exists("xml-import.php")) {
print "<b>Fatal Error</b>: XML Import/Export tools (<b>xml-export.php</b>
- and <b>xml-import.php</b>) could be used maliciously. Please remove them
+ and <b>xml-import.php</b>) could be used maliciously. Please remove them
from your TT-RSS instance.\n";
exit;
}
@@ -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";
}
@@ -89,7 +83,7 @@
if ($link) {
$result = db_query($link, "SELECT id FROM ttrss_users WHERE id = 1");
- if (db_num_rows($result) != 1) {
+ if (db_num_rows($result) != 1) {
$err_msg = "config: SINGLE_USER_MODE is enabled but default admin account (UID=1) is not found.";
}
}
@@ -114,7 +108,7 @@
if (!defined('DEFAULT_UPDATE_METHOD') || (DEFAULT_UPDATE_METHOD != 0 &&
DEFAULT_UPDATE_METHOD != 1)) {
- $err_msg = "config: DEFAULT_UPDATE_METHOD should be either 0 or 1.";
+ $err_msg = "config: DEFAULT_UPDATE_METHOD should be either 0 or 1.";
}
if (!is_writable(ICONS_DIR)) {
@@ -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;
diff --git a/sanity_config.php b/sanity_config.php
index 67e373a64..a6bdb64c5 100644
--- a/sanity_config.php
+++ b/sanity_config.php
@@ -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'); ?>