diff --git a/.gitignore b/.gitignore
index d5b3a7d4..170a32ae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,5 @@
#*
favicon.*
tests/coverage.html
-/vendor
\ No newline at end of file
+/vendor
+/nbproject/private/
\ No newline at end of file
diff --git a/README.md b/README.md
index 9effb1ea..ab88f300 100644
--- a/README.md
+++ b/README.md
@@ -75,8 +75,6 @@ You can check the backlog of this queue at the `/admin` page.
* `.vcard .region` as `region`
* `.vcard .postal-code` as `postal-code`
* `.vcard .country-name` as `country-name`
- * `.vcard .x-gender` as `gender`
- * `.marital-text` as `marital`
3. If the `dfrn-global-visibility` value is set to false. Any existing records will be deleted.
And the process exits here.
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644
index 00000000..9b4db068
--- /dev/null
+++ b/Vagrantfile
@@ -0,0 +1,43 @@
+
+server_ip = "192.168.33.10"
+server_memory = "384" # MB
+server_timezone = "UTC"
+
+public_folder = "/vagrant"
+
+Vagrant.configure(2) do |config|
+
+ # Set server to Ubuntu 14.04
+ config.vm.box = "ubuntu/trusty64"
+
+ # Disable automatic box update checking. If you disable this, then
+ # boxes will only be checked for updates when the user runs
+ # `vagrant box outdated`. This is not recommended.
+ # config.vm.box_check_update = false
+
+ # Create a hostname, don't forget to put it to the `hosts` file
+ # This will point to the server's default virtual host
+ # TO DO: Make this work with virtualhost along-side xip.io URL
+ config.vm.hostname = "friendica.dev"
+
+ # Create a static IP
+ config.vm.network :private_network, ip: server_ip
+
+ # Share a folder between host and guest
+ config.vm.synced_folder "./", "/vagrant/", owner: "www-data", group: "vagrant"
+
+ # Provider-specific configuration so you can fine-tune various
+ # backing providers for Vagrant. These expose provider-specific options.
+ config.vm.provider "virtualbox" do |vb|
+ # # Display the VirtualBox GUI when booting the machine
+ # vb.gui = true
+ #
+ # # Customize the amount of memory on the VM:
+ vb.memory = server_memory
+ end
+
+ # Enable provisioning with a shell script.
+ config.vm.provision "shell", path: "./util/vagrant_provision.sh"
+ # run: "always"
+ # run: "once"
+end
diff --git a/dfrndir.sql b/dfrndir.sql
index 2276f0ad..f019a274 100644
--- a/dfrndir.sql
+++ b/dfrndir.sql
@@ -61,8 +61,6 @@ CREATE TABLE IF NOT EXISTS `profile` (
`region` char(255) NOT NULL,
`postal-code` char(32) NOT NULL,
`country-name` char(255) NOT NULL,
- `gender` char(32) NOT NULL,
- `marital` char(255) NOT NULL,
`homepage` char(255) NOT NULL,
`photo` char(255) NOT NULL,
`tags` mediumtext NOT NULL,
@@ -169,6 +167,7 @@ CREATE TABLE IF NOT EXISTS `site-health` (
`admin_name` varchar(255) NULL DEFAULT NULL,
`admin_profile` varchar(255) NULL DEFAULT NULL,
`ssl_state` bit(1) NULL DEFAULT NULL,
+ `ssl_grade` varchar(3) NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `base_url` (`base_url`),
KEY `health_score` (`health_score`),
diff --git a/htconfig.php b/htconfig.php
index 2856dd80..d86fcff6 100644
--- a/htconfig.php
+++ b/htconfig.php
@@ -7,9 +7,9 @@
//MySQL host.
$db_host = 'localhost';
-$db_user = 'friendica-dir';
-$db_pass = 'thisisyourpasswordbuddy';
-$db_data = 'friendica-dir';
+$db_user = 'root';
+$db_pass = 'root';
+$db_data = 'friendica_dir';
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
diff --git a/include/Scrape.php b/include/Scrape.php
index a61d22d3..c57ee006 100755
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -103,7 +103,7 @@ function scrape_dfrn($url, $max_nodes=3500) {
$nodes_left = max(intval($max_nodes), $minNodes);
$items = $dom->getElementsByTagName('*');
- $targets = array('fn', 'pdesc', 'photo', 'key', 'locality', 'region', 'postal-code', 'country-name', 'gender', 'marital');
+ $targets = array('fn', 'pdesc', 'photo', 'key', 'locality', 'region', 'postal-code', 'country-name');
$targets_left = count($targets);
foreach($items as $item) {
if(attribute_contains($item->getAttribute('class'), 'vcard')) {
@@ -141,16 +141,8 @@ function scrape_dfrn($url, $max_nodes=3500) {
$ret['country-name'] = $x->textContent;
$targets_left = pop_scrape_target($targets, 'country-name');
}
- if(attribute_contains($x->getAttribute('class'),'x-gender')){
- $ret['gender'] = $x->textContent;
- $targets_left = pop_scrape_target($targets, 'gender');
- }
}
}
- if(attribute_contains($item->getAttribute('class'),'marital-text')){
- $ret['marital'] = $item->textContent;
- $targets_left = pop_scrape_target($targets, 'marital');
- }
$nodes_left--;
if($nodes_left <= 0 || $targets_left <= 0) break;
}
diff --git a/include/site-health.php b/include/site-health.php
index 7f9d03b5..bf94ad35 100644
--- a/include/site-health.php
+++ b/include/site-health.php
@@ -91,7 +91,13 @@ function parse_site_from_url($url)
//Performs a ping to the given site ID
//You may need to notice the site first before you know it's ID.
-if(! function_exists('run_site_ping')){
+//TODO: Probe server location using IP address or using the info the friendica server provides (preferred).
+// If IP needs to be used only provide country information.
+//TODO: Check SSLLabs Grade
+// Check needs to be asynchronous, meaning that the check at SSLLabs will be initiated in one run while
+// the results must be fetched later. It might be good to mark sites, where a check has been inititated
+// f.e. using the ssl_grade field. In the next run, results of these sites could be fetched.
+if(! function_exists('run_site_probe')){
function run_site_probe($id, &$entry_out)
{
diff --git a/include/submit.php b/include/submit.php
index 00d5b983..525986da 100644
--- a/include/submit.php
+++ b/include/submit.php
@@ -114,8 +114,6 @@ function run_submit($url) {
`region` = '%s',
`postal-code` = '%s',
`country-name` = '%s',
- `gender` = '%s',
- `marital` = '%s',
`homepage` = '%s',
`nurl` = '%s',
`comm` = %d,
@@ -129,8 +127,6 @@ function run_submit($url) {
$parms['region'],
$parms['postal-code'],
$parms['country-name'],
- $parms['gender'],
- $parms['marital'],
dbesc($url),
dbesc($nurl),
intval($parms['comm']),
@@ -142,7 +138,7 @@ function run_submit($url) {
}
else {
- $r = q("INSERT INTO `profile` ( `name`, `pdesc`, `locality`, `region`, `postal-code`, `country-name`, `gender`, `marital`, `homepage`, `nurl`, `comm`, `tags`, `created`, `updated` )
+ $r = q("INSERT INTO `profile` ( `name`, `pdesc`, `locality`, `region`, `postal-code`, `country-name`, `homepage`, `nurl`, `comm`, `tags`, `created`, `updated` )
VALUES ( '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s' )",
$parms['fn'],
$parms['pdesc'],
@@ -150,8 +146,6 @@ function run_submit($url) {
$parms['region'],
$parms['postal-code'],
$parms['country-name'],
- $parms['gender'],
- $parms['marital'],
dbesc($url),
dbesc($nurl),
intval($parms['comm']),
diff --git a/library/php-ssllabs-api/Readme.md b/library/php-ssllabs-api/Readme.md
new file mode 100644
index 00000000..7bceeec2
--- /dev/null
+++ b/library/php-ssllabs-api/Readme.md
@@ -0,0 +1,237 @@
+# PHP-SSLLabs-API
+This PHP library provides basic access to the SSL Labs API.
+
+It's build upon the official API documentation at https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md
+```PHP
+fetchApiInfo());
+
+?>
+```
+## Methods
+### fetchApiInfo()
+No parameters needed
+
+Returns an Info object (see https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md#info).
+
+### fetchStatusCodes()
+No parameters needed
+
+Returns a StatusCodes instance (see https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md#statuscodes).
+
+### fetchHostInformation()
+See https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md#invoke-assessment-and-check-progress for parameter description.
+
+| Parameter | Type | Default value | |
+|---------------------|---------|---------------|----------|
+| **host** | string | | Required |
+| **publish** | boolean | false | |
+| **startNew** | boolean | false | |
+| **fromCache** | boolean | false | |
+| **maxAge** | int | null | |
+| **all** | string | null | |
+| **ignoreMismatch** | boolean | false | |
+
+Returns a Host object (see https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md#host).
+
+Make sure to check the 'status' attribute inside Host object.
+
+### fetchHostInformationCached()
+You can also use fetchHostInformation() with the proper parameters, this is just a helper function.
+
+| Parameter | Type | Default value | |
+|---------------------|---------|---------------|----------|
+| **host** | string | | Required |
+| **maxAge** | int | null | |
+| **publish** | boolean | false | |
+| **ignoreMismatch** | boolean | false | |
+
+Returns a Host object (see https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md#host).
+
+Also make sure to check the 'status' attribute inside Host object.
+
+### fetchEndpointData()
+See https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md#retrieve-detailed-endpoint-information for parameter description.
+
+| Parameter | Type | Default value | |
+|----------------|---------|---------------|----------|
+| **host** | string | | Required |
+| **s** | string | | Required |
+| **fromCache** | boolean | false | |
+
+Returns an Endpoint object (see https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md#endpoint).
+
+### Custom API calls
+Use sendApiRequest() method to create custom API calls.
+
+| Parameter | Type | Default value | |
+|-----------------|--------|---------------|----------|
+| **apiCall** | string | | Required |
+| **parameters** | array | | |
+
+```PHP
+$api->sendApiRequest('apiCallName', array('p1' => 'p1_value', 'p2' => 'p2_value'));
+```
+
+### getReturnJsonObjects()
+Getter for returnJsonObjects
+
+### setReturnJsonObjects()
+Setter for returnJsonObjects
+
+| Parameter | Type | Default value | |
+|-----------------------|---------|---------------|----------|
+| **returnJsonObjects** | boolean | | Required |
+
+## Example output (as JSON strings)
+### Get API information
+```PHP
+$api->fetchApiInfo();
+```
+```JSON
+{
+ "engineVersion": "1.15.1",
+ "criteriaVersion": "2009i",
+ "clientMaxAssessments": 25,
+ "maxAssessments": 25,
+ "currentAssessments": 0,
+ "messages": [
+ "This assessment service is provided free of charge by Qualys SSL Labs, subject to our terms and conditions: https://www.ssllabs.com/about/terms.html"
+ ]
+}
+```
+
+### Get host information
+```PHP
+$api->fetchHostInformation('https://www.google.de');
+```
+```JSON
+{
+ "host": "https://www.google.de",
+ "port": 443,
+ "protocol": "HTTP",
+ "isPublic": false,
+ "status": "READY",
+ "startTime": 1427195976527,
+ "testTime": 1427196284525,
+ "engineVersion": "1.15.1",
+ "criteriaVersion": "2009i",
+ "endpoints": [
+ {
+ "ipAddress": "74.125.239.119",
+ "serverName": "nuq05s01-in-f23.1e100.net",
+ "statusMessage": "Ready",
+ "grade": "B",
+ "hasWarnings": false,
+ "isExceptional": false,
+ "progress": 100,
+ "duration": 77376,
+ "eta": 1610,
+ "delegation": 3
+ },
+ {
+ "ipAddress": "74.125.239.120",
+ "serverName": "nuq05s01-in-f24.1e100.net",
+ "statusMessage": "Ready",
+ "grade": "B",
+ "hasWarnings": false,
+ "isExceptional": false,
+ "progress": 100,
+ "duration": 76386,
+ "eta": 1609,
+ "delegation": 3
+ },
+ {
+ "ipAddress": "74.125.239.127",
+ "serverName": "nuq05s01-in-f31.1e100.net",
+ "statusMessage": "Ready",
+ "grade": "B",
+ "hasWarnings": false,
+ "isExceptional": false,
+ "progress": 100,
+ "duration": 76937,
+ "eta": 1608,
+ "delegation": 3
+ },
+ {
+ "ipAddress": "74.125.239.111",
+ "serverName": "nuq05s01-in-f15.1e100.net",
+ "statusMessage": "Ready",
+ "grade": "B",
+ "hasWarnings": false,
+ "isExceptional": false,
+ "progress": 100,
+ "duration": 77171,
+ "eta": 1606,
+ "delegation": 3
+ }
+ ]
+}
+```
+
+### Get endpoint information
+```PHP
+$api->fetchEndpointData('https://www.google.de', '74.125.239.111');
+```
+
+(just an except of the entire JSON output)
+```JSON
+{
+ "ipAddress": "74.125.239.111",
+ "serverName": "nuq05s01-in-f15.1e100.net",
+ "statusMessage": "Ready",
+ "grade": "B",
+ "hasWarnings": false,
+ "isExceptional": false,
+ "progress": 100,
+ "duration": 77171,
+ "eta": 1609,
+ "delegation": 3,
+ "details": {
+ "hostStartTime": 1427195976527,
+ "key": {},
+ "cert": {},
+ "chain": {},
+ "protocols": [],
+ "suites": {},
+ "serverSignature": "gws",
+ "prefixDelegation": true,
+ "nonPrefixDelegation": true,
+ "vulnBeast": false,
+ "renegSupport": 2,
+ "sessionResumption": 1,
+ "compressionMethods": 0,
+ "supportsNpn": true,
+ "npnProtocols": "h2-15 h2-14 spdy/3.1 spdy/3 http/1.1",
+ "sessionTickets": 1,
+ "ocspStapling": false,
+ "sniRequired": false,
+ "httpStatusCode": 200,
+ "supportsRc4": true,
+ "forwardSecrecy": 2,
+ "rc4WithModern": true,
+ "sims": {},
+ "heartbleed": false,
+ "heartbeat": false,
+ "openSslCcs": 1,
+ "poodleTls": 1,
+ "fallbackScsv": true
+ }
+}
+```
+
+# Terms and Conditions
+As this is just a PHP library for SSL Labs API please refer to SSL Labs terms and conditions at https://www.ssllabs.com/about/terms.html
diff --git a/library/php-ssllabs-api/ssllabsApi.php b/library/php-ssllabs-api/ssllabsApi.php
new file mode 100644
index 00000000..32f3d4e4
--- /dev/null
+++ b/library/php-ssllabs-api/ssllabsApi.php
@@ -0,0 +1,216 @@
+
+ * @license GNU GENERAL PUBLIC LICENSE v3
+ */
+
+class sslLabsApi
+{
+ CONST API_URL = "https://api.ssllabs.com/api/v2";
+
+ private $returnJsonObjects;
+
+ /**
+ * sslLabsApi::__construct()
+ */
+ public function __construct($returnJsonObjects = false)
+ {
+ $this->returnJsonObjects = (boolean) $returnJsonObjects;
+ }
+
+ /**
+ * sslLabsApi::fetchApiInfo()
+ *
+ * API Call: info
+ * @see https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md
+ */
+ public function fetchApiInfo()
+ {
+ return ($this->sendApiRequest('info'));
+ }
+
+ /**
+ * sslLabsApi::fetchHostInformation()
+ *
+ * API Call: analyze
+ * @see https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md
+ *
+ * @param string $host Hostname to analyze
+ * @param boolean $publish
+ * @param boolean $startNew
+ * @param boolean $fromCache
+ * @param int $maxAge
+ * @param string $all
+ * @param boolean $ignoreMismatch
+ */
+ public function fetchHostInformation($host, $publish = false, $startNew = false, $fromCache = false, $maxAge = NULL, $all = NULL, $ignoreMismatch = false)
+ {
+ $apiRequest = $this->sendApiRequest
+ (
+ 'analyze',
+ array
+ (
+ 'host' => $host,
+ 'publish' => $publish,
+ 'startNew' => $startNew,
+ 'fromCache' => $fromCache,
+ 'maxAge' => $maxAge,
+ 'all' => $all,
+ 'ignoreMismatch' => $ignoreMismatch
+ )
+ );
+
+ return ($apiRequest);
+ }
+
+ /**
+ * sslLabsApi::fetchHostInformationCached()
+ *
+ * API Call: analyze
+ * Same as fetchHostInformation() but prefer to receive cached information
+ *
+ * @param string $host
+ * @param int $maxAge
+ * @param string $publish
+ * @param string $ignoreMismatch
+ */
+ public function fetchHostInformationCached($host, $maxAge, $publish = false, $ignoreMismatch = false)
+ {
+ return($this->fetchHostInformation($host, $publish, false, true, $maxAge, 'done', $ignoreMismatch));
+ }
+
+ /**
+ * sslLabsApi::fetchEndpointData()
+ *
+ * API Call: getEndpointData
+ * @see https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md
+ *
+ * @param string $host
+ * @param string $s
+ * @param string $fromCache
+ * @return string
+ */
+ public function fetchEndpointData($host, $s, $fromCache = false)
+ {
+ $apiRequest = $this->sendApiRequest
+ (
+ 'getEndpointData',
+ array
+ (
+ 'host' => $host,
+ 's' => $s,
+ 'fromCache' => $fromCache
+ )
+ );
+
+ return ($apiRequest);
+ }
+
+ /**
+ * sslLabsApi::fetchStatusCodes()
+ *
+ * API Call: getStatusCodes
+ */
+ public function fetchStatusCodes()
+ {
+ return ($this->sendApiRequest('getStatusCodes'));
+ }
+
+ /**
+ * sslLabsApi::sendApiRequest()
+ *
+ * Send API request
+ *
+ * @param string $apiCall
+ * @param array $parameters
+ * @return string JSON from API
+ */
+ public function sendApiRequest($apiCall, $parameters = array())
+ {
+ //we also want content from failed api responses
+ $context = stream_context_create
+ (
+ array
+ (
+ 'http' => array
+ (
+ 'ignore_errors' => true
+ )
+ )
+ );
+
+ $apiResponse = file_get_contents(self::API_URL . '/' . $apiCall . $this->buildGetParameterString($parameters), false, $context);
+
+ if($this->returnJsonObjects)
+ {
+ return (json_decode($apiResponse));
+ }
+
+ return ($apiResponse);
+ }
+
+ /**
+ * sslLabsApi::setReturnJsonObjects()
+ *
+ * Setter for returnJsonObjects
+ * Set true to return all API responses as JSON object, false returns it as simple JSON strings (default)
+ *
+ * @param boolean $returnJsonObjects
+ */
+ public function setReturnJsonObjects($returnJsonObjects)
+ {
+ $this->returnJsonObjects = (boolean) $returnJsonObjects;
+ }
+
+ /**
+ * sslLabsApi::getReturnJsonObjects()
+ *
+ * Getter for returnJsonObjects
+ *
+ * @return boolean true returns all API responses as JSON object, false returns it as simple JSON string
+ */
+ public function getReturnJsonObjects()
+ {
+ return ($this->returnJsonObjects);
+ }
+
+ /**
+ * sslLabsApi::buildGetParameterString()
+ *
+ * Helper function to build get parameter string for URL
+ *
+ * @param array $parameters
+ * @return string
+ */
+ private function buildGetParameterString($parameters)
+ {
+ $string = '';
+
+ $counter = 0;
+ foreach($parameters as $name => $value)
+ {
+ if(!is_string($name) || (!is_string($value) && !is_bool($value) && !is_int($value)))
+ {
+ continue;
+ }
+
+ if(is_bool($value))
+ {
+ $value = ($value) ? 'on' : 'off';
+ }
+
+ $string .= ($counter == 0) ? '?' : '&';
+ $string .= urlencode($name) . '=' . urlencode($value);
+
+ $counter++;
+ }
+
+ return ($string);
+ }
+}
\ No newline at end of file
diff --git a/mod/directory.php b/mod/directory.php
index 3a434f03..08a1d713 100755
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -47,7 +47,7 @@ function directory_content(&$a) {
if($search)
$search = dbesc($search . '*');
- $sql_extra = ((strlen($search)) ? " AND MATCH (`name`, `pdesc`, `homepage`, `locality`, `region`, `country-name`, `gender`, `marital`, `tags` )
+ $sql_extra = ((strlen($search)) ? " AND MATCH (`name`, `pdesc`, `homepage`, `locality`, `region`, `country-name`, `tags` )
AGAINST ('$search' IN BOOLEAN MODE) " : "");
if($forums)
@@ -92,8 +92,6 @@ function directory_content(&$a) {
$details .= $rr['country-name'];
}
- if(strlen($rr['gender']))
- $details .= '
' . t('Gender: ') . $rr['gender'] ;
$o .= replace_macros($tpl,array(
'$id' => $rr['id'],
@@ -107,8 +105,7 @@ function directory_content(&$a) {
'$name' => $rr['name'],
'$pclass' => (($rr['comm']) ? ' group' : ''),
'$pgroup' => (($rr['comm']) ? '