From 50b60f6735c94d9549644e8593356077b9e161ed Mon Sep 17 00:00:00 2001 From: hauke Date: Sun, 8 Nov 2015 16:54:15 +0100 Subject: [PATCH 1/9] added a vagrant configuration for development --- .gitignore | 3 +- .htconfig.php | 6 +- Vagrantfile | 43 +++++++++ util/htconfig.vagrant.php | 86 ++++++++++++++++++ util/vagrant_provision.sh | 82 ++++++++++++++++++ util/vagrant_vhost.sh | 177 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 393 insertions(+), 4 deletions(-) create mode 100644 Vagrantfile create mode 100644 util/htconfig.vagrant.php create mode 100644 util/vagrant_provision.sh create mode 100644 util/vagrant_vhost.sh 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/.htconfig.php b/.htconfig.php index 3e70ecda..4c2d39fb 100644 --- a/.htconfig.php +++ b/.htconfig.php @@ -2,9 +2,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/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/util/htconfig.vagrant.php b/util/htconfig.vagrant.php new file mode 100644 index 00000000..4c2d39fb --- /dev/null +++ b/util/htconfig.vagrant.php @@ -0,0 +1,86 @@ +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 + +); \ No newline at end of file diff --git a/util/vagrant_provision.sh b/util/vagrant_provision.sh new file mode 100644 index 00000000..007b711b --- /dev/null +++ b/util/vagrant_provision.sh @@ -0,0 +1,82 @@ +#!/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 + +#Install composer +cd /vagrant +curl -sS https://getcomposer.org/installer | php +php composer.phar install + +#create cronjob +echo "*/10 * * * * cd /vagrant; /usr/bin/php include/poller.php" >> friendicacron +sudo crontab friendicacron +sudo rm friendicacron \ No newline at end of file diff --git a/util/vagrant_vhost.sh b/util/vagrant_vhost.sh new file mode 100644 index 00000000..f26d8e14 --- /dev/null +++ b/util/vagrant_vhost.sh @@ -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_ + + ServerAdmin webmaster@localhost + ServerName $ServerName + $ServerAlias + + DocumentRoot $DocumentRoot + + + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + allow from all + + + 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 + + + +_EOF_ +} + +function create_ssl_vhost { +cat <<- _EOF_ + + ServerAdmin webmaster@localhost + ServerName $ServerName + $ServerAlias + + DocumentRoot $DocumentRoot + + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + allow from all + + + 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 + + + SSLOptions +StdEnvVars + + + 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 + +_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 \ No newline at end of file From bab544661418415de5ca6121375ec7330b85bcf9 Mon Sep 17 00:00:00 2001 From: hauke Date: Sun, 8 Nov 2015 17:41:28 +0100 Subject: [PATCH 2/9] added cron jobs --- util/vagrant_provision.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/vagrant_provision.sh b/util/vagrant_provision.sh index 007b711b..7d824144 100644 --- a/util/vagrant_provision.sh +++ b/util/vagrant_provision.sh @@ -77,6 +77,7 @@ curl -sS https://getcomposer.org/installer | php php composer.phar install #create cronjob -echo "*/10 * * * * cd /vagrant; /usr/bin/php include/poller.php" >> friendicacron +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 \ No newline at end of file From 735ca9d6fab37958eaa2bd37780eb63991e2ac46 Mon Sep 17 00:00:00 2001 From: hauke Date: Sun, 8 Nov 2015 18:01:23 +0100 Subject: [PATCH 3/9] populate the development server with default sync servers to get data --- util/vagrant_default_sync_servers.sql | 5 +++++ util/vagrant_provision.sh | 1 + 2 files changed, 6 insertions(+) create mode 100644 util/vagrant_default_sync_servers.sql diff --git a/util/vagrant_default_sync_servers.sql b/util/vagrant_default_sync_servers.sql new file mode 100644 index 00000000..4ed4e0e7 --- /dev/null +++ b/util/vagrant_default_sync_servers.sql @@ -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, ''); \ No newline at end of file diff --git a/util/vagrant_provision.sh b/util/vagrant_provision.sh index 7d824144..d9013e92 100644 --- a/util/vagrant_provision.sh +++ b/util/vagrant_provision.sh @@ -70,6 +70,7 @@ cp /vagrant/util/htconfig.vagrant.php /vagrant/.htconfig.php 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 From 3f5da874856c3cc83d21c005b9acbd1f8fd12726 Mon Sep 17 00:00:00 2001 From: hauke Date: Thu, 24 Dec 2015 08:15:22 +0100 Subject: [PATCH 4/9] fix: function_exists checked for wrong function name --- include/site-health.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/site-health.php b/include/site-health.php index 7f9d03b5..c9ed4f92 100644 --- a/include/site-health.php +++ b/include/site-health.php @@ -91,7 +91,7 @@ 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')){ +if(! function_exists('run_site_probe')){ function run_site_probe($id, &$entry_out) { From cd976b8dcc245cc20109394ce3185706559e62a2 Mon Sep 17 00:00:00 2001 From: hauke Date: Thu, 24 Dec 2015 08:42:48 +0100 Subject: [PATCH 5/9] Removed gender and marital status for better privacy --- README.md | 2 -- dfrndir.sql | 2 -- include/Scrape.php | 10 +--------- include/submit.php | 8 +------- mod/directory.php | 7 ++----- mod/moderate.php | 6 +----- mod/search.php | 2 +- util/messages.po | 4 ---- view/directory_item.tpl | 1 - view/profile.php | 8 -------- view/profile_advanced.php | 20 -------------------- view/profile_edit.tpl | 12 ------------ view/profile_selectors.php | 27 +-------------------------- view/theme/default/style.css | 19 ++----------------- 14 files changed, 9 insertions(+), 119 deletions(-) diff --git a/README.md b/README.md index a5cc9cb5..391f3324 100644 --- a/README.md +++ b/README.md @@ -70,8 +70,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/dfrndir.sql b/dfrndir.sql index 2276f0ad..017ae697 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, 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/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/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']) ? '
' . t('[Public Group]') . '
' : ''), - '$details' => $pdesc . $details, - '$marital' => ((strlen($rr['marital'])) ? '
' . t('Status:') . ' ' . $rr['marital'] . '
' : '') + '$details' => $pdesc . $details diff --git a/mod/moderate.php b/mod/moderate.php index 0d1b9879..52ffe94b 100755 --- a/mod/moderate.php +++ b/mod/moderate.php @@ -107,9 +107,6 @@ function moderate_content(&$a) { $details .= $rr['country-name']; } - if(strlen($rr['gender'])) - $details .= '
' . 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']) ? '
' . t('[Public Group]') . '
' : ''), - '$details' => $pdesc . $details, - '$marital' => ((strlen($rr['marital'])) ? '
Status: ' . $rr['marital'] . '
' : '') + '$details' => $pdesc . $details diff --git a/mod/search.php b/mod/search.php index 7011f569..f8db4a2b 100644 --- a/mod/search.php +++ b/mod/search.php @@ -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)) diff --git a/util/messages.po b/util/messages.po index 290c930e..e68df2ea 100644 --- a/util/messages.po +++ b/util/messages.po @@ -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 "" diff --git a/view/directory_item.tpl b/view/directory_item.tpl index d840d29f..c4dc4ec3 100755 --- a/view/directory_item.tpl +++ b/view/directory_item.tpl @@ -13,6 +13,5 @@ $star $pgroup
$details
-$marital
\ No newline at end of file diff --git a/view/profile.php b/view/profile.php index 64f8f410..efaf6019 100644 --- a/view/profile.php +++ b/view/profile.php @@ -42,19 +42,11 @@ - -
Gender:
- - - - -
Status:
-
Homepage:
diff --git a/view/profile_advanced.php b/view/profile_advanced.php index 73a15540..928fa313 100755 --- a/view/profile_advanced.php +++ b/view/profile_advanced.php @@ -19,16 +19,6 @@ $o .= <<< EOT EOT; } -if($a->profile['gender']) { -$o .= <<< EOT -
-
Gender:
-
{$a->profile['gender']}
-
-
-EOT; -} - if($a->profile['dob']) { $o .= <<< EOT
@@ -57,16 +47,6 @@ $o .= <<< EOT EOT; } -if($a->profile['marital']) { -$o .= <<< EOT -
-
Status:
-
{$a->profile['marital']}
-
-
-EOT; -} - if($a->profile['sexual']) { $o .= <<< EOT
diff --git a/view/profile_edit.tpl b/view/profile_edit.tpl index 44ca3922..6f13b380 100755 --- a/view/profile_edit.tpl +++ b/view/profile_edit.tpl @@ -29,12 +29,6 @@ $default
-
- -$gender -
-
-
@@ -94,12 +88,6 @@ $hide_friends
-
- -$marital -
-
-
$sexual diff --git a/view/profile_selectors.php b/view/profile_selectors.php index 03dd2aac..29f5320e 100755 --- a/view/profile_selectors.php +++ b/view/profile_selectors.php @@ -1,18 +1,6 @@ "; - foreach($select as $selection) { - $selected = (($selection == $current) ? ' selected="selected" ' : ''); - $o .= ""; - } - $o .= ''; - 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 .= ''; 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 .= "'; - return $o; -} +} diff --git a/view/theme/default/style.css b/view/theme/default/style.css index e85116e5..5ca3e17c 100755 --- a/view/theme/default/style.css +++ b/view/theme/default/style.css @@ -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, From 128f65399260039e30cf03681557eda9025d2208 Mon Sep 17 00:00:00 2001 From: hauke Date: Thu, 24 Dec 2015 09:17:27 +0100 Subject: [PATCH 6/9] Removed facebook feature listing as it is no longer supported by friendica --- mod/servers.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/mod/servers.php b/mod/servers.php index e857615b..bc0255ce 100644 --- a/mod/servers.php +++ b/mod/servers.php @@ -61,7 +61,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 +80,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'] ); From 6b4da31a97a460c15036b1455d6b6ede8b69adf7 Mon Sep 17 00:00:00 2001 From: hauke Date: Thu, 24 Dec 2015 09:49:35 +0100 Subject: [PATCH 7/9] prepared view and database to display SSLLabs grade --- dfrndir.sql | 1 + mod/servers.php | 3 ++- src/templates/view/_site.php | 5 ++++- src/templates/view/servers.php | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dfrndir.sql b/dfrndir.sql index 017ae697..b36c8a65 100644 --- a/dfrndir.sql +++ b/dfrndir.sql @@ -167,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(2) NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY `base_url` (`base_url`), KEY `health_score` (`health_score`), diff --git a/mod/servers.php b/mod/servers.php index bc0255ce..a1e42b04 100644 --- a/mod/servers.php +++ b/mod/servers.php @@ -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. @@ -94,7 +95,7 @@ function servers_content(&$a) { $site['supports_more']++; } } - + //Push to results. $public_sites[] = $site; diff --git a/src/templates/view/_site.php b/src/templates/view/_site.php index 09f1c5ac..b5333b8f 100644 --- a/src/templates/view/_site.php +++ b/src/templates/view/_site.php @@ -20,7 +20,10 @@
Features $value): if(!$value) continue; ?> -
  √
+ +
+ , Grade:   √ +
0): ?> diff --git a/src/templates/view/servers.php b/src/templates/view/servers.php index aa2a44a4..4cc8f6dc 100644 --- a/src/templates/view/servers.php +++ b/src/templates/view/servers.php @@ -7,7 +7,7 @@ We recommend these based on their health.

- 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.

From f8906282ef5a56b340ec97e6b65f556124732bd3 Mon Sep 17 00:00:00 2001 From: hauke Date: Thu, 24 Dec 2015 11:20:37 +0100 Subject: [PATCH 8/9] added skeletons for help and stats page, text adjustements --- dfrndir.sql | 2 +- include/site-health.php | 6 ++++++ mod/help.php | 10 ++++++++++ mod/stats.php | 10 ++++++++++ src/templates/layout/_navigation.php | 2 +- src/templates/view/help.php | 9 +++++++++ src/templates/view/homepage.php | 5 ++--- src/templates/view/stats.php | 5 +++++ 8 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 mod/help.php create mode 100644 mod/stats.php create mode 100644 src/templates/view/help.php create mode 100644 src/templates/view/stats.php diff --git a/dfrndir.sql b/dfrndir.sql index b36c8a65..f019a274 100644 --- a/dfrndir.sql +++ b/dfrndir.sql @@ -167,7 +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(2) 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/include/site-health.php b/include/site-health.php index c9ed4f92..bf94ad35 100644 --- a/include/site-health.php +++ b/include/site-health.php @@ -91,6 +91,12 @@ 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. +//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/mod/help.php b/mod/help.php new file mode 100644 index 00000000..db14e7a6 --- /dev/null +++ b/mod/help.php @@ -0,0 +1,10 @@ +output(); + } +} + diff --git a/mod/stats.php b/mod/stats.php new file mode 100644 index 00000000..866b33cd --- /dev/null +++ b/mod/stats.php @@ -0,0 +1,10 @@ +output(); + } +} + diff --git a/src/templates/layout/_navigation.php b/src/templates/layout/_navigation.php index bdaf5bf2..4aa57bb1 100644 --- a/src/templates/layout/_navigation.php +++ b/src/templates/layout/_navigation.php @@ -2,7 +2,7 @@