Merge branch 'feature/redesign-prototype' of https://github.com/tugelbend/dir into feature/redesign-prototype
This commit is contained in:
commit
31d3cb4889
33 changed files with 914 additions and 133 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -3,4 +3,5 @@
|
|||
#*
|
||||
favicon.*
|
||||
tests/coverage.html
|
||||
/vendor
|
||||
/vendor
|
||||
/nbproject/private/
|
|
@ -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.
|
||||
|
|
43
Vagrantfile
vendored
Normal file
43
Vagrantfile
vendored
Normal file
|
@ -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
|
|
@ -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`),
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
||||
|
|
|
@ -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']),
|
||||
|
|
237
library/php-ssllabs-api/Readme.md
Normal file
237
library/php-ssllabs-api/Readme.md
Normal file
|
@ -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
|
||||
<?php
|
||||
|
||||
require_once 'sslLabsApi.php';
|
||||
|
||||
//Return API response as JSON string
|
||||
$api = new sslLabsApi();
|
||||
|
||||
//Return API response as JSON object
|
||||
//$api = new sslLabsApi(true);
|
||||
|
||||
//Set content-type header for JSON output
|
||||
header('Content-Type: application/json');
|
||||
|
||||
//get API information
|
||||
var_dump($api->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
|
216
library/php-ssllabs-api/ssllabsApi.php
Normal file
216
library/php-ssllabs-api/ssllabsApi.php
Normal file
|
@ -0,0 +1,216 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP-SSLLabs-API
|
||||
*
|
||||
* This PHP library provides basic access to the SSL Labs API
|
||||
* and is build upon the official API documentation at
|
||||
* https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs.md
|
||||
*
|
||||
* @author Björn Roland <https://github.com/bjoernr-de>
|
||||
* @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);
|
||||
}
|
||||
}
|
|
@ -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 .= '<br />' . 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']) ? '<div class="directory-group">' . t('[Public Group]') . '</div>' : ''),
|
||||
'$details' => $pdesc . $details,
|
||||
'$marital' => ((strlen($rr['marital'])) ? '<div class="marital"><span class="marital-label"><span class="heart">♥</span> ' . t('Status:') . ' </span><span class="marital-text">' . $rr['marital'] . '</span></div>' : '')
|
||||
'$details' => $pdesc . $details
|
||||
|
||||
|
||||
|
||||
|
|
10
mod/help.php
Normal file
10
mod/help.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
use Friendica\Directory\Rendering\View;
|
||||
|
||||
if(! function_exists('help_content')) {
|
||||
function help_content(&$a) {
|
||||
$view = new View('help');
|
||||
$view->output();
|
||||
}
|
||||
}
|
||||
|
|
@ -107,9 +107,6 @@ function moderate_content(&$a) {
|
|||
$details .= $rr['country-name'];
|
||||
}
|
||||
|
||||
if(strlen($rr['gender']))
|
||||
$details .= '<br />' . t('Gender: ') . t($rr['gender']) ;
|
||||
|
||||
$o .= replace_macros($tpl,array(
|
||||
'$id' => $rr['id'],
|
||||
'$mod' => '',
|
||||
|
@ -120,8 +117,7 @@ function moderate_content(&$a) {
|
|||
'$star' => '',
|
||||
'$pclass' => (($rr['comm']) ? ' group' : ''),
|
||||
'$pgroup' => (($rr['comm']) ? '<div class="directory-group">' . t('[Public Group]') . '</div>' : ''),
|
||||
'$details' => $pdesc . $details,
|
||||
'$marital' => ((strlen($rr['marital'])) ? '<div class="marital"><span class="marital-label"><span class="heart">♥</span> Status: </span><span class="marital-text">' . $rr['marital'] . '</span></div>' : '')
|
||||
'$details' => $pdesc . $details
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ function search_content(&$a) {
|
|||
//Run our query.
|
||||
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(!is_null($community))
|
||||
|
|
|
@ -41,6 +41,7 @@ function servers_content(&$a) {
|
|||
|
||||
//Stop at unhealthy sites.
|
||||
$site = $site_healths[$k];
|
||||
|
||||
if($site['health_score'] <= 20) break;
|
||||
|
||||
//Skip small sites.
|
||||
|
@ -61,7 +62,6 @@ function servers_content(&$a) {
|
|||
$site['supports'] = array(
|
||||
'HTTPS' => $site['ssl_state'] == 1,
|
||||
'Twitter' => $hasPlugin(array('buffer', 'twitter')),
|
||||
'Facebook' => $hasPlugin(array('buffer', 'facebook', 'fbpost', 'fbsync')),
|
||||
'Google+' => $hasPlugin(array('buffer', 'gpluspost')),
|
||||
'RSS/Atom' => true, //Built-in.
|
||||
'App.net' => $hasPlugin(array('appnet', 'appnetpost')),
|
||||
|
@ -81,7 +81,6 @@ function servers_content(&$a) {
|
|||
$site['popular_supports'] = array(
|
||||
'HTTPS' => $site['supports']['HTTPS'],
|
||||
'Twitter' => $site['supports']['Twitter'],
|
||||
'Facebook' => $site['supports']['Facebook'],
|
||||
'Google+' => $site['supports']['Google+'],
|
||||
'Wordpress' => $site['supports']['Wordpress']
|
||||
);
|
||||
|
@ -96,7 +95,7 @@ function servers_content(&$a) {
|
|||
$site['supports_more']++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Push to results.
|
||||
$public_sites[] = $site;
|
||||
|
||||
|
|
10
mod/stats.php
Normal file
10
mod/stats.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
use Friendica\Directory\Rendering\View;
|
||||
|
||||
if(! function_exists('stats_content')) {
|
||||
function stats_content(&$a) {
|
||||
$view = new View('stats');
|
||||
$view->output();
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<nav id="links">
|
||||
<div class="viewport">
|
||||
<a href="/home" class="mobile">Home</a>
|
||||
<a href="/servers">Servers</a>
|
||||
<a href="/servers">Public Servers</a>
|
||||
<a href="/stats">Stats</a>
|
||||
<a href="/help">Help</a>
|
||||
</div>
|
||||
|
|
|
@ -20,7 +20,10 @@
|
|||
<div class="site-supports">
|
||||
<em>Features</em>
|
||||
<?php foreach ($site['popular_supports'] as $key => $value): if(!$value) continue; ?>
|
||||
<div class="supports <?php echo strtolower($key); ?>"><?php echo $key; ?> √</div>
|
||||
|
||||
<div class="supports <?php echo strtolower($key); ?>">
|
||||
<?php echo $key; ?><?php if($key == 'HTTPS' && $site['ssl_grade'] != null): ?>, Grade: <?php echo $site['ssl_grade']; ?><?php endif ?> √
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
<?php if ($site['supports_more'] > 0): ?>
|
||||
|
||||
|
|
9
src/templates/view/help.php
Normal file
9
src/templates/view/help.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<div class="sites">
|
||||
<div>
|
||||
<h1>Help</h1>
|
||||
<h2>Registering a Friendica account (with an existing server)</h2>
|
||||
<h2>Setting up a Friendica server</h2>
|
||||
<h2>Finding people - Getting new friends</h2>
|
||||
<h2>More help</h2>
|
||||
</div>
|
||||
</div>
|
|
@ -11,9 +11,8 @@
|
|||
<p class="about">
|
||||
Friendica is a decentralized social network.
|
||||
And this is a directory to find people on this network.
|
||||
Vivamus condimentum tempor pellentesque. Phasellus turpis nulla, lacinia vitae quam in,
|
||||
cursus semper est. Ut lobortis ex quis sodales porta. Nam rhoncus tortor lobortis auctor
|
||||
efficitur. Ut ac ullamcorper lorem.
|
||||
If you want to create your own account on a public server, have a look
|
||||
on our <a href="servers">Public servers listing</a>.
|
||||
</p>
|
||||
|
||||
<div class="profiles">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
We recommend these based on their <abbr title="Decent speed, proper security, recent version, etc.">health</abbr>.
|
||||
</p>
|
||||
<p class="intro">
|
||||
Keep in mind that different servers may support different networks besides Friendica.
|
||||
Keep in mind that different servers may support different features like communicating with additional networks besides Friendica.
|
||||
It's best to pick the one that best suits your needs.
|
||||
</p>
|
||||
|
||||
|
|
5
src/templates/view/stats.php
Normal file
5
src/templates/view/stats.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<div class="sites">
|
||||
<div>
|
||||
<h1>Stats</h1>
|
||||
</div>
|
||||
</div>
|
86
util/htconfig.vagrant.php
Normal file
86
util/htconfig.vagrant.php
Normal file
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
//MySQL host.
|
||||
$db_host = 'localhost';
|
||||
$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.
|
||||
$default_timezone = 'Europe/Amsterdam';
|
||||
|
||||
// What is your site name?
|
||||
$a->config['sitename'] = "EXPERIMENTAL Friendica public directory";
|
||||
|
||||
//Statistic display settings.
|
||||
$a->config['stats'] = array(
|
||||
|
||||
//For site health, the max age for which to display data.
|
||||
'maxDataAge' => 3600*24*30*4 //120 days = ~4 months
|
||||
|
||||
);
|
||||
|
||||
//Settings related to the syncing feature.
|
||||
$a->config['syncing'] = array(
|
||||
|
||||
//Pulling may be quite intensive at first when it has to do a full sync and your directory is empty.
|
||||
//This timeout should be shorter than your cronjob interval. Preferably with a little breathing room.
|
||||
'timeout' => 3*60, //3 minutes
|
||||
|
||||
//Push new submits to the `sync-target` entries?
|
||||
'enable_pushing' => true,
|
||||
|
||||
//Maximum amount of items per batch per target to push to other sync-targets.
|
||||
//For example: 3 targets x20 items = 60 requests.
|
||||
'max_push_items' => 10,
|
||||
|
||||
//Pull updates from the `sync-target` entries?
|
||||
'enable_pulling' => true,
|
||||
|
||||
//This is your normal amount of threads for pulling.
|
||||
//With regular intervals, there's no need to give this a high value.
|
||||
//But when your server is brand new, you may want to keep this high for the first day or two.
|
||||
'pulling_threads' => 25,
|
||||
|
||||
//How many items should we crawl per sync?
|
||||
'max_pull_items' => 250
|
||||
|
||||
);
|
||||
|
||||
//Things related to site-health monitoring.
|
||||
$a->config['site-health'] = array(
|
||||
|
||||
//Wait for at least ... before probing a site again.
|
||||
//The longer this value, the more "stable" site-healths will be over time.
|
||||
//Note: If a bad (negative) health site submits something, a probe will be performed regardless.
|
||||
'min_probe_delay' => 24*3600, // 1 day
|
||||
|
||||
//Probes get a simple /friendica/json file from the server.
|
||||
//Feel free to set this timeout to a very tight value.
|
||||
'probe_timeout' => 5, // seconds
|
||||
|
||||
//Imports should be fast. Feel free to prioritize healthy sites.
|
||||
'skip_import_threshold' => -20
|
||||
|
||||
);
|
||||
|
||||
//Things related to the maintenance cronjob.
|
||||
$a->config['maintenance'] = array(
|
||||
|
||||
//This is to prevent I/O blocking. Will cost you some RAM overhead though.
|
||||
//A good server should handle much more than this default, so you can tweak this.
|
||||
'threads' => 10,
|
||||
|
||||
//Limit the amount of scrapes per execution of the maintainer.
|
||||
//This will depend a lot on the frequency with which you call the maintainer.
|
||||
//If you have 10 threads and 80 max_scrapes, that means each thread will handle 8 scrapes.
|
||||
'max_scrapes' => 80,
|
||||
|
||||
//Wait for at least ... before scraping a profile again.
|
||||
'min_scrape_delay' => 3*24*3600, // 3 days
|
||||
|
||||
//At which health value should we start removing profiles?
|
||||
'remove_profile_health_threshold' => -60
|
||||
|
||||
);
|
|
@ -178,10 +178,6 @@ msgstr ""
|
|||
msgid "Search for: "
|
||||
msgstr ""
|
||||
|
||||
#: ../../mod/directory.php:96 ../../mod/moderate.php:109
|
||||
msgid "Gender: "
|
||||
msgstr ""
|
||||
|
||||
#: ../../mod/directory.php:100
|
||||
msgid "Flag this entry"
|
||||
msgstr ""
|
||||
|
|
5
util/vagrant_default_sync_servers.sql
Normal file
5
util/vagrant_default_sync_servers.sql
Normal file
|
@ -0,0 +1,5 @@
|
|||
--
|
||||
-- Sync targets to poulate the development directory
|
||||
--
|
||||
INSERT INTO `friendica_dir`.`sync-targets` (`base_url`, `pull`, `push`, `dt_last_pull`) VALUES ('dir.friendica.com', 1, 0, '');
|
||||
INSERT INTO `friendica_dir`.`sync-targets` (`base_url`, `pull`, `push`, `dt_last_pull`) VALUES ('dir.friendi.ca', 1, 0, '');
|
84
util/vagrant_provision.sh
Normal file
84
util/vagrant_provision.sh
Normal file
|
@ -0,0 +1,84 @@
|
|||
#!/bin/bash
|
||||
#Script to setup the vagrant instance for running friendica
|
||||
#
|
||||
#DO NOT RUN on your physical machine as this won't be of any use
|
||||
#and f.e. deletes your /var/www/ folder!
|
||||
echo "Friendica configuration settings"
|
||||
sudo apt-get update
|
||||
|
||||
#Selfsigned cert
|
||||
echo ">>> Installing *.xip.io self-signed SSL"
|
||||
SSL_DIR="/etc/ssl/xip.io"
|
||||
DOMAIN="*.xip.io"
|
||||
PASSPHRASE="vaprobash"
|
||||
SUBJ="
|
||||
C=US
|
||||
ST=Connecticut
|
||||
O=Vaprobash
|
||||
localityName=New Haven
|
||||
commonName=$DOMAIN
|
||||
organizationalUnitName=
|
||||
emailAddress=
|
||||
"
|
||||
sudo mkdir -p "$SSL_DIR"
|
||||
sudo openssl genrsa -out "$SSL_DIR/xip.io.key" 4096
|
||||
sudo openssl req -new -subj "$(echo -n "$SUBJ" | tr "\n" "/")" -key "$SSL_DIR/xip.io.key" -out "$SSL_DIR/xip.io.csr" -passin pass:$PASSPHRASE
|
||||
sudo openssl x509 -req -days 365 -in "$SSL_DIR/xip.io.csr" -signkey "$SSL_DIR/xip.io.key" -out "$SSL_DIR/xip.io.crt"
|
||||
|
||||
|
||||
#Install apache2
|
||||
echo ">>> Installing Apache2 webserver"
|
||||
sudo apt-get install -y apache2
|
||||
sudo a2enmod rewrite actions ssl
|
||||
sudo cp /vagrant/util/vagrant_vhost.sh /usr/local/bin/vhost
|
||||
sudo chmod guo+x /usr/local/bin/vhost
|
||||
sudo vhost -s 192.168.33.10.xip.io -d /var/www -p /etc/ssl/xip.io -c xip.io -a friendica.dev
|
||||
sudo a2dissite 000-default
|
||||
sudo service apache2 restart
|
||||
|
||||
#Install php
|
||||
echo ">>> Installing PHP5"
|
||||
sudo apt-get install -y php5 libapache2-mod-php5 php5-cli php5-mysql php5-curl php5-gd
|
||||
sudo service apache2 restart
|
||||
|
||||
|
||||
#Install mysql
|
||||
echo ">>> Installing Mysql"
|
||||
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password root"
|
||||
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password root"
|
||||
sudo apt-get install -qq mysql-server
|
||||
# enable remote access
|
||||
# setting the mysql bind-address to allow connections from everywhere
|
||||
sed -i "s/bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
|
||||
# adding grant privileges to mysql root user from everywhere
|
||||
# thx to http://stackoverflow.com/questions/7528967/how-to-grant-mysql-privileges-in-a-bash-script for this
|
||||
MYSQL=`which mysql`
|
||||
Q1="GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;"
|
||||
Q2="FLUSH PRIVILEGES;"
|
||||
SQL="${Q1}${Q2}"
|
||||
$MYSQL -uroot -proot -e "$SQL"
|
||||
service mysql restart
|
||||
|
||||
#make the vagrant directory the docroot
|
||||
sudo rm -rf /var/www/
|
||||
sudo ln -fs /vagrant /var/www
|
||||
|
||||
# initial config file for friendica in vagrant
|
||||
cp /vagrant/util/htconfig.vagrant.php /vagrant/.htconfig.php
|
||||
|
||||
# create the friendica database
|
||||
echo "create database friendica_dir" | mysql -u root -proot
|
||||
# import test database
|
||||
$MYSQL -uroot -proot friendica_dir < /vagrant/dfrndir.sql
|
||||
$MYSQL -uroot -proot friendica_dir < /vagrant/util/vagrant_default_sync_servers.sql
|
||||
|
||||
#Install composer
|
||||
cd /vagrant
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
php composer.phar install
|
||||
|
||||
#create cronjob
|
||||
echo "*/30 * * * * www-data cd /vagrant; php include/cron_maintain.php" >> friendicacron
|
||||
echo "*/5 * * * * www-data cd /vagrant; php include/cron_sync.php" >> friendicacron
|
||||
sudo crontab friendicacron
|
||||
sudo rm friendicacron
|
177
util/vagrant_vhost.sh
Normal file
177
util/vagrant_vhost.sh
Normal file
|
@ -0,0 +1,177 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run this as sudo!
|
||||
# I move this file to /usr/local/bin/vhost and run command 'vhost' from anywhere, using sudo.
|
||||
|
||||
#
|
||||
# Show Usage, Output to STDERR
|
||||
#
|
||||
function show_usage {
|
||||
cat <<- _EOF_
|
||||
|
||||
Create a new vHost in Ubuntu Server
|
||||
Assumes /etc/apache2/sites-available and /etc/apache2/sites-enabled setup used
|
||||
|
||||
-d DocumentRoot - i.e. /var/www/yoursite
|
||||
-h Help - Show this menu.
|
||||
-s ServerName - i.e. example.com or sub.example.com
|
||||
-a ServerAlias - i.e. *.example.com or another domain altogether
|
||||
-p File path to the SSL certificate. Directories only, no file name.
|
||||
If using an SSL Certificate, also creates a port :443 vhost as well.
|
||||
This *ASSUMES* a .crt and a .key file exists
|
||||
at file path /provided-file-path/your-server-or-cert-name.[crt|key].
|
||||
Otherwise you can except Apache errors when you reload Apache.
|
||||
Ensure Apache's mod_ssl is enabled via "sudo a2enmod ssl".
|
||||
-c Certificate filename. "xip.io" becomes "xip.io.key" and "xip.io.crt".
|
||||
|
||||
Example Usage. Serve files from /var/www/xip.io at http(s)://192.168.33.10.xip.io
|
||||
using ssl files from /etc/ssl/xip.io/xip.io.[key|crt]
|
||||
sudo vhost -d /var/www/xip.io -s 192.168.33.10.xip.io -p /etc/ssl/xip.io -c xip.io
|
||||
|
||||
_EOF_
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Output vHost skeleton, fill with userinput
|
||||
# To be outputted into new file
|
||||
#
|
||||
function create_vhost {
|
||||
cat <<- _EOF_
|
||||
<VirtualHost *:80>
|
||||
ServerAdmin webmaster@localhost
|
||||
ServerName $ServerName
|
||||
$ServerAlias
|
||||
|
||||
DocumentRoot $DocumentRoot
|
||||
|
||||
|
||||
<Directory $DocumentRoot>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride All
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
|
||||
ErrorLog \${APACHE_LOG_DIR}/$ServerName-error.log
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit,
|
||||
# alert, emerg.
|
||||
LogLevel warn
|
||||
|
||||
CustomLog \${APACHE_LOG_DIR}/$ServerName-access.log combined
|
||||
|
||||
|
||||
</VirtualHost>
|
||||
_EOF_
|
||||
}
|
||||
|
||||
function create_ssl_vhost {
|
||||
cat <<- _EOF_
|
||||
<VirtualHost *:443>
|
||||
ServerAdmin webmaster@localhost
|
||||
ServerName $ServerName
|
||||
$ServerAlias
|
||||
|
||||
DocumentRoot $DocumentRoot
|
||||
|
||||
<Directory $DocumentRoot>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride All
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
|
||||
ErrorLog \${APACHE_LOG_DIR}/$ServerName-error.log
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit,
|
||||
# alert, emerg.
|
||||
LogLevel warn
|
||||
|
||||
CustomLog \${APACHE_LOG_DIR}/$ServerName-access.log combined
|
||||
|
||||
SSLEngine on
|
||||
|
||||
SSLCertificateFile $CertPath/$CertName.crt
|
||||
SSLCertificateKeyFile $CertPath/$CertName.key
|
||||
|
||||
<FilesMatch "\.(cgi|shtml|phtml|php)$">
|
||||
SSLOptions +StdEnvVars
|
||||
</FilesMatch>
|
||||
|
||||
BrowserMatch "MSIE [2-6]" \\
|
||||
nokeepalive ssl-unclean-shutdown \\
|
||||
downgrade-1.0 force-response-1.0
|
||||
# MSIE 7 and newer should be able to use keepalive
|
||||
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
|
||||
</VirtualHost>
|
||||
_EOF_
|
||||
}
|
||||
|
||||
#Sanity Check - are there two arguments with 2 values?
|
||||
if [ "$#" -lt 4 ]; then
|
||||
show_usage
|
||||
fi
|
||||
|
||||
CertPath=""
|
||||
|
||||
#Parse flags
|
||||
while getopts "d:s:a:p:c:h" OPTION; do
|
||||
case $OPTION in
|
||||
h)
|
||||
show_usage
|
||||
;;
|
||||
d)
|
||||
DocumentRoot=$OPTARG
|
||||
;;
|
||||
s)
|
||||
ServerName=$OPTARG
|
||||
;;
|
||||
a)
|
||||
Alias=$OPTARG
|
||||
;;
|
||||
p)
|
||||
CertPath=$OPTARG
|
||||
;;
|
||||
c)
|
||||
CertName=$OPTARG
|
||||
;;
|
||||
*)
|
||||
show_usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# If alias is set:
|
||||
if [ "$Alias" != "" ]; then
|
||||
ServerAlias="ServerAlias "$Alias
|
||||
else
|
||||
ServerAlias=""
|
||||
fi
|
||||
|
||||
# If CertName doesn't get set, set it to ServerName
|
||||
if [ "$CertName" == "" ]; then
|
||||
CertName=$ServerName
|
||||
fi
|
||||
|
||||
if [ ! -d $DocumentRoot ]; then
|
||||
mkdir -p $DocumentRoot
|
||||
#chown USER:USER $DocumentRoot #POSSIBLE IMPLEMENTATION, new flag -u ?
|
||||
fi
|
||||
|
||||
if [ -f "$DocumentRoot/$ServerName.conf" ]; then
|
||||
echo 'vHost already exists. Aborting'
|
||||
show_usage
|
||||
else
|
||||
create_vhost > /etc/apache2/sites-available/${ServerName}.conf
|
||||
|
||||
# Add :443 handling
|
||||
if [ "$CertPath" != "" ]; then
|
||||
create_ssl_vhost >> /etc/apache2/sites-available/${ServerName}.conf
|
||||
fi
|
||||
|
||||
# Enable Site
|
||||
cd /etc/apache2/sites-available/ && a2ensite ${ServerName}.conf
|
||||
service apache2 reload
|
||||
fi
|
|
@ -13,6 +13,5 @@ $star
|
|||
$pgroup
|
||||
<div class="directory-name-end"></div>
|
||||
<div class="directory-details">$details</div>
|
||||
$marital
|
||||
<div class="directory-item-end"></div>
|
||||
</div>
|
|
@ -42,19 +42,11 @@
|
|||
|
||||
<?php } ?>
|
||||
|
||||
<?php if(strlen($profile['gender'])) { ?>
|
||||
<div class="mf">Gender: <span class="x-gender"><?php echo $profile['gender']; ?></span></div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if(strlen($profile['pubkey'])) { ?>
|
||||
<div class="key" style="display: none"><?php echo $profile['pubkey']; ?></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if(strlen($profile['marital'])) { ?>
|
||||
<div class="marital"><span class="marital-label"><span class="heart">♥</span> Status: </span><span class="marital-text"><?php echo $profile['marital']; ?></span></div>
|
||||
<?php } ?>
|
||||
<?php if(strlen($profile['url'])) { ?>
|
||||
<div class="homepage"><span class="homepage-label">Homepage: </span><span class="homepage-url"><?php echo $profile['homepage']; ?></span></div>
|
||||
<?php } ?>
|
||||
|
|
|
@ -19,16 +19,6 @@ $o .= <<< EOT
|
|||
EOT;
|
||||
}
|
||||
|
||||
if($a->profile['gender']) {
|
||||
$o .= <<< EOT
|
||||
<div id="advanced-profile-gender-wrapper" >
|
||||
<div id="advanced-profile-gender-text">Gender:</div>
|
||||
<div id="advanced-profile-gender">{$a->profile['gender']}</div>
|
||||
</div>
|
||||
<div id="advanced-profile-gender-end"></div>
|
||||
EOT;
|
||||
}
|
||||
|
||||
if($a->profile['dob']) {
|
||||
$o .= <<< EOT
|
||||
<div id="advanced-profile-dob-wrapper" >
|
||||
|
@ -57,16 +47,6 @@ $o .= <<< EOT
|
|||
EOT;
|
||||
}
|
||||
|
||||
if($a->profile['marital']) {
|
||||
$o .= <<< EOT
|
||||
<div id="advanced-profile-marital-wrapper" >
|
||||
<div id="advanced-profile-marital-text"><span class="heart">♥</span> Status:</div>
|
||||
<div id="advanced-profile-marital">{$a->profile['marital']}</div>
|
||||
</div>
|
||||
<div id="advanced-profile-marital-end"></div>
|
||||
EOT;
|
||||
}
|
||||
|
||||
if($a->profile['sexual']) {
|
||||
$o .= <<< EOT
|
||||
<div id="advanced-profile-sexual-wrapper" >
|
||||
|
|
|
@ -29,12 +29,6 @@ $default
|
|||
</div>
|
||||
<div id="profile-edit-name-end"></div>
|
||||
|
||||
<div id="profile-edit-gender-wrapper" >
|
||||
<label id="profile-edit-gender-label" for="gender-select" >Your Gender: </label>
|
||||
$gender
|
||||
</div>
|
||||
<div id="profile-edit-gender-end"></div>
|
||||
|
||||
<div id="profile-edit-dob-wrapper" >
|
||||
<label id="profile-edit-dob-label" for="dob-select" >Birthday (y/m/d): </label>
|
||||
<div id="profile-edit-dob" >
|
||||
|
@ -94,12 +88,6 @@ $hide_friends
|
|||
</div>
|
||||
<div class="profile-edit-submit-end"></div>
|
||||
|
||||
<div id="profile-edit-marital-wrapper" >
|
||||
<label id="profile-edit-marital-label" for="profile-edit-marital" >Marital Status: </label>
|
||||
$marital
|
||||
</div>
|
||||
<div id="profile-edit-marital-end"></div>
|
||||
|
||||
<div id="profile-edit-sexual-wrapper" >
|
||||
<label id="profile-edit-sexual-label" for="sexual-select" >Sexual Preference: </label>
|
||||
$sexual
|
||||
|
|
|
@ -1,18 +1,6 @@
|
|||
<?php
|
||||
|
||||
|
||||
function gender_selector($current="",$suffix="") {
|
||||
$select = array('', t('Male'), t('Female'), t('Transsexual'), t('Hermaphrodite'), t('Neuter'), t('Other'), t('Undecided'));
|
||||
|
||||
$o .= "<select name=\"gender$suffix\" id=\"gender-select$suffix\" size=\"1\" >";
|
||||
foreach($select as $selection) {
|
||||
$selected = (($selection == $current) ? ' selected="selected" ' : '');
|
||||
$o .= "<option value=\"$selection\" $selected >$selection</option>";
|
||||
}
|
||||
$o .= '</select>';
|
||||
return $o;
|
||||
}
|
||||
|
||||
function sexpref_selector($current="",$suffix="") {
|
||||
$select = array('', t('Males'), t('Females'), t('Bisexual'), t('Autosexual'), t('Abstinent'), t('Virgin'), t('Nonsexual'));
|
||||
|
||||
|
@ -23,17 +11,4 @@ function sexpref_selector($current="",$suffix="") {
|
|||
}
|
||||
$o .= '</select>';
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
function marital_selector($current="",$suffix="") {
|
||||
$select = array('', t('Single'), t('Lonely'), t('Available'), t('Unavailable'), t('Dating'), t('Unfaithful'), t('Sex Addict'), t('Friends'), t('Friends/Benefits'), t('Casual'), t('Engaged'), t('Married'), t('Partners'), t('Cohabiting'), t('Happy'), t('Not Looking'), t('Swinger'), t('Betrayed'), t('Separated'), t('Unstable'), t('Divorced'), t('Widowed'), t('Uncertain'), t('Complicated'), t('Don\'t care'), t('Ask me') );
|
||||
|
||||
$o .= "<select name=\"marital[]\" id=\"marital-select\" multiple=\"multiple\" size=\"2\" >";
|
||||
foreach($select as $selection) {
|
||||
$selected = (($selection == $current) ? ' selected="selected" ' : '');
|
||||
$o .= "<option value=\"$selection\" $selected >$selection</option>";
|
||||
}
|
||||
$o .= '</select>';
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -544,14 +544,12 @@ input#dfrn-url {
|
|||
|
||||
#profile-edit-profile-name-label,
|
||||
#profile-edit-name-label,
|
||||
#profile-edit-gender-label,
|
||||
#profile-edit-dob-label,
|
||||
#profile-edit-address-label,
|
||||
#profile-edit-locality-label,
|
||||
#profile-edit-region-label,
|
||||
#profile-edit-postal-code-label,
|
||||
#profile-edit-country-name-label,
|
||||
#profile-edit-marital-label,
|
||||
#profile-edit-sexual-label,
|
||||
#profile-edit-politic-label,
|
||||
#profile-edit-religion-label,
|
||||
|
@ -562,14 +560,12 @@ input#dfrn-url {
|
|||
|
||||
#profile-edit-profile-name,
|
||||
#profile-edit-name,
|
||||
#gender-select,
|
||||
#profile-edit-dob,
|
||||
#profile-edit-address,
|
||||
#profile-edit-locality,
|
||||
#profile-edit-region,
|
||||
#profile-edit-postal-code,
|
||||
#profile-edit-country-name,
|
||||
#marital-select,
|
||||
#sexual-select,
|
||||
#profile-edit-politic,
|
||||
#profile-edit-religion,
|
||||
|
@ -597,14 +593,12 @@ input#dfrn-url {
|
|||
|
||||
#profile-edit-profile-name-end,
|
||||
#profile-edit-name-end,
|
||||
#profile-edit-gender-end,
|
||||
#profile-edit-dob-end,
|
||||
#profile-edit-address-end,
|
||||
#profile-edit-locality-end,
|
||||
#profile-edit-region-end,
|
||||
#profile-edit-postal-code-end,
|
||||
#profile-edit-country-name-end,
|
||||
#profile-edit-marital-end,
|
||||
#profile-edit-sexual-end,
|
||||
#profile-edit-politic-end,
|
||||
#profile-edit-religion-end,
|
||||
|
@ -619,8 +613,7 @@ input#dfrn-url {
|
|||
|
||||
|
||||
|
||||
|
||||
#gender-select, #marital-select, #sexual-select {
|
||||
#sexual-select {
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
|
@ -896,7 +889,7 @@ input#dfrn-url {
|
|||
margin-top: 10px;
|
||||
margin-left: 35px;
|
||||
}
|
||||
.directory-details, .marital {
|
||||
.directory-details {
|
||||
font-size: 0.7em;
|
||||
text-align: center;
|
||||
margin-left: 5px;
|
||||
|
@ -956,10 +949,8 @@ input#dfrn-url {
|
|||
|
||||
|
||||
#advanced-profile-name-wrapper,
|
||||
#advanced-profile-gender-wrapper,
|
||||
#advanced-profile-dob-wrapper,
|
||||
#advanced-profile-age-wrapper,
|
||||
#advanced-profile-marital-wrapper,
|
||||
#advanced-profile-sexual-wrapper,
|
||||
#advanced-profile-homepage-wrapper,
|
||||
#advanced-profile-politic-wrapper,
|
||||
|
@ -978,10 +969,8 @@ input#dfrn-url {
|
|||
}
|
||||
|
||||
#advanced-profile-name-text,
|
||||
#advanced-profile-gender-text,
|
||||
#advanced-profile-dob-text,
|
||||
#advanced-profile-age-text,
|
||||
#advanced-profile-marital-text,
|
||||
#advanced-profile-sexual-text,
|
||||
#advanced-profile-homepage-text,
|
||||
#advanced-profile-politic-text,
|
||||
|
@ -1001,10 +990,8 @@ input#dfrn-url {
|
|||
}
|
||||
|
||||
#advanced-profile-name-end,
|
||||
#advanced-profile-gender-end,
|
||||
#advanced-profile-dob-end,
|
||||
#advanced-profile-age-end,
|
||||
#advanced-profile-marital-end,
|
||||
#advanced-profile-sexual-end,
|
||||
#advanced-profile-homepage-end,
|
||||
#advanced-profile-politic-end,
|
||||
|
@ -1027,10 +1014,8 @@ input#dfrn-url {
|
|||
}
|
||||
|
||||
#advanced-profile-name,
|
||||
#advanced-profile-gender,
|
||||
#advanced-profile-dob,
|
||||
#advanced-profile-age,
|
||||
#advanced-profile-marital,
|
||||
#advanced-profile-sexual,
|
||||
#advanced-profile-homepage,
|
||||
#advanced-profile-politic,
|
||||
|
|
Loading…
Reference in a new issue